Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Initialize (
|
MacroPlan owner
|
)
|
{
|
TextBody:
|
[*
|
// 甄兰鸽 Jun-24-2024 (created)
|
owner.FinancialProductionSource( relflush );
|
ccunit := FinancialProductionReport::GetDefaultCCUnit();
|
dlunit := FinancialProductionReport::GetDefaultDLUnit();
|
allunit := FinancialProductionReport::GetDefaultAllUnit();
|
source := owner.FinancialProductionSource( relnew, IsImport := false, Name := FinancialProductionReport::GetDefaultName() );
|
table := source.FinancialProductionReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false );
|
showtable := source.FinancialProductionReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
|
startofplanning := owner.StartOfPlanning();
|
startofnextmonth := owner.StartOfPlanning().StartOfNextMonth();
|
startofyear := startofplanning.StartOfYear();
|
startofnextyear := startofplanning.StartOfNextYear();
|
|
search := source.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
|
|
products := construct( Product_MPs );
|
|
table.GenerateColumn( owner );
|
|
traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
|
unit := pisp.StockingPoint_MP().UnitID();
|
info( unit, pisp.ProductID() );
|
ccrow := null( FinancialProductionRow );
|
dlrow := null( FinancialProductionRow );
|
allrow := selectobject( table, FinancialProductionRow, row, row.Name() = pisp.ProductID() and row.Unit() = allunit );
|
if( unit = ccunit ){
|
ccrow := table.FinancialProductionRow( relnew, Name := pisp.ProductID(), Unit := unit );
|
}else{
|
dlrow := table.FinancialProductionRow( relnew, Name := pisp.ProductID(), Unit := unit );
|
}
|
if( isnull( allrow ) ){
|
products.Add( pisp.Product_MP() );
|
allrow := table.FinancialProductionRow( relnew, Name := pisp.ProductID(), Unit := allunit );
|
}
|
|
for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
|
periodtime := start.Date();
|
periodname := periodtime.Format( "M2/D2/Y" );
|
column := selectobject( table, FinancialProductionColumn, column, column.Name() = periodname and column.Period() = periodtime );
|
|
if( not isnull( ccrow ) ){
|
ccrow.Initialize( column, ccunit );
|
}
|
if( not isnull( dlrow ) ){
|
dlrow.Initialize( column, dlunit );
|
}
|
if( not exists( allrow, FinancialProductionCell, allcell, allcell.FinancialProductionColumn() = column ) ){
|
allrow.Initialize( column, allunit );
|
}
|
}
|
|
traverse( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() >= startofplanning
|
and ( ( pispip.Start() < startofnextmonth and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() )
|
or ( pispip.Start() < startofnextyear and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Month() ) ) ){
|
periodtime := pispip.Start().StartOfMonth().Date();
|
periodname := periodtime.Format( "M2/D2/Y" );
|
|
column := selectobject( table, FinancialProductionColumn, column, column.Name() = periodname and column.Period() = periodtime );
|
|
if( not isnull( ccrow ) ){
|
ccrow.Initialize( column, pispip.NewSupplyProductionQuantity() );
|
}
|
if( not isnull( dlrow ) ){
|
dlrow.Initialize( column, pispip.NewSupplyProductionQuantity() );
|
}
|
allrow.Initialize( column, pispip.NewSupplyProductionQuantity() );
|
}
|
}
|
rows := selectsortedset( table, FinancialProductionRow, row, row.Name() );
|
i := 0;
|
traverse( rows, Elements, e ){
|
e.RowNr( i );
|
i := i + 1;
|
}
|
showtable.Generate( search, products );
|
*]
|
}
|