| | |
| | | owner.FinancialWeeklyReport( relflush ); |
| | | ccunit := FinancialWeeklyReport::GetDefaultCCUnit(); |
| | | dlunit := FinancialWeeklyReport::GetDefaultDLUnit(); |
| | | allunit := FinancialWeeklyReport::GetDefaultAllUnit(); |
| | | //allunit := FinancialWeeklyReport::GetDefaultAllUnit(); |
| | | defaultname := FinancialWeeklyReport::GetDefaultName(); |
| | | startofplanning := owner.StartOfPlanning(); |
| | | |
| | |
| | | dlsales := table.FinancialWeeklyRow( relnew, Name := 'DL销量', RowNr := 5 ); |
| | | ccsales := table.FinancialWeeklyRow( relnew, Name := 'CC销量', RowNr := 6 ); |
| | | //SUM |
| | | totalpvaluesum := [Real]0; |
| | | dlpvaluesum := [Real]0; |
| | | ccpvaluesum := [Real]0; |
| | | totalsvaluesum := [Real]0; |
| | | dlsvaluesum := [Real]0; |
| | | ccsvaluesum := [Real]0; |
| | | //累计量 |
| | | totalpvaluecumulant := [Real]0; |
| | | dlpvaluecumulant := [Real]0; |
| | | ccpvaluecumulant := [Real]0; |
| | | totalsvaluecumulant := [Real]0; |
| | | dlsvaluecumulant := [Real]0; |
| | | ccsvaluecumulant := [Real]0; |
| | | |
| | |
| | | salescolumn := selectobject( salestable, FinancialSalesColumn, scolumn, scolumn.Name() = column.Name() and scolumn.Period() = column.Period() and not scolumn.IsDay() ); |
| | | |
| | | //产量汇总 |
| | | totalpvalue := [Real]0; |
| | | dlpvalue := [Real]0; |
| | | ccpvalue := [Real]0; |
| | | traverse( productioncolumn, FinancialProductionCell, cell, cell.Quantity() > 0 ){ |
| | | unit := cell.FinancialProductionRow().Unit(); |
| | | |
| | | if( unit = allunit ){ |
| | | totalpvalue := totalpvalue + cell.Quantity(); |
| | | if( column.Period() = startofplanning.StartOfMonth().Date() ){ |
| | | totalpvaluecumulant := totalpvaluecumulant - cell.PlanValue(); |
| | | } |
| | | }else if( unit = dlunit ){ |
| | | if( unit = dlunit ){ |
| | | dlpvalue := dlpvalue + cell.Quantity(); |
| | | if( column.Period() = startofplanning.StartOfMonth().Date() ){ |
| | | dlpvaluecumulant := dlpvaluecumulant - cell.PlanValue(); |
| | |
| | | } |
| | | } |
| | | } |
| | | totalpcell := column.FinancialWeeklyCell( relnew, Value := [String]( [Number]totalpvalue ) ); |
| | | totalpcell := column.FinancialWeeklyCell( relnew, Value := [String]( [Number]( dlpvalue + ccpvalue ) ) ); |
| | | totalproduction.FinancialWeeklyCell( relinsert, totalpcell ); |
| | | dlpcell := column.FinancialWeeklyCell( relnew, Value := [String]( [Number]dlpvalue ) ); |
| | | dlproduction.FinancialWeeklyCell( relinsert, dlpcell ); |
| | |
| | | ccproduction.FinancialWeeklyCell( relinsert, ccpcell ); |
| | | |
| | | //销量汇总 |
| | | totalsvalue := [Real]0; |
| | | dlsvalue := [Real]0; |
| | | ccsvalue := [Real]0; |
| | | traverse( salescolumn, FinancialSalesCell, cell, [Real]cell.Value() > 0 ){ |
| | | unit := cell.FinancialSalesRow().Unit(); |
| | | if( unit = allunit ){ |
| | | totalsvalue := totalsvalue + [Real]cell.Value(); |
| | | }else if( unit = dlunit ){ |
| | | |
| | | if( unit = dlunit ){ |
| | | dlsvalue := dlsvalue + [Real]cell.Value(); |
| | | }else if( unit = ccunit ){ |
| | | ccsvalue := ccsvalue + [Real]cell.Value(); |
| | | } |
| | | } |
| | | totalscell := column.FinancialWeeklyCell( relnew, Value := [String]totalsvalue ); |
| | | totalscell := column.FinancialWeeklyCell( relnew, Value := [String]( dlsvalue + ccsvalue ) ); |
| | | totalsales.FinancialWeeklyCell( relinsert, totalscell ); |
| | | dlscell := column.FinancialWeeklyCell( relnew, Value := [String]dlsvalue ); |
| | | dlsales.FinancialWeeklyCell( relinsert, dlscell ); |
| | |
| | | ccsales.FinancialWeeklyCell( relinsert, ccscell ); |
| | | |
| | | if( column.Period() < startofplanning.StartOfMonth().Date() ){ |
| | | totalpvaluecumulant := totalpvaluecumulant + totalpvalue; |
| | | dlpvaluecumulant := dlpvaluecumulant + dlpvalue; |
| | | ccpvaluecumulant := ccpvaluecumulant + ccpvalue; |
| | | totalsvaluecumulant := totalsvaluecumulant + totalsvalue; |
| | | dlsvaluecumulant := dlsvaluecumulant + dlsvalue; |
| | | ccsvaluecumulant := ccsvaluecumulant + ccsvalue; |
| | | } |
| | | totalpvaluesum := totalpvaluesum + totalpvalue; |
| | | dlpvaluesum := dlpvaluesum + dlpvalue; |
| | | ccpvaluesum := ccpvaluesum + ccpvalue; |
| | | totalsvaluesum := totalsvaluesum + totalsvalue; |
| | | dlsvaluesum := dlsvaluesum + dlsvalue; |
| | | ccsvaluesum := ccsvaluesum + ccsvalue; |
| | | } |
| | |
| | | cumulantcolumn := table.FinancialWeeklyColumn( relnew, Name := '累计量' ); |
| | | proportioncolumn := table.FinancialWeeklyColumn( relnew, Name := '占比' ); |
| | | //SUM |
| | | totalpcellsum := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]( [Number]totalpvaluesum ) ); |
| | | totalpcellsum := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]( [Number]( dlpvaluesum + ccpvaluesum ) ) ); |
| | | totalproduction.FinancialWeeklyCell( relinsert, totalpcellsum ); |
| | | dlpcellsum := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]( [Number]dlpvaluesum ) ); |
| | | dlproduction.FinancialWeeklyCell( relinsert, dlpcellsum ); |
| | | ccpcellsum := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]( [Number]ccpvaluesum ) ); |
| | | ccproduction.FinancialWeeklyCell( relinsert, ccpcellsum ); |
| | | totalscellsum := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]totalsvaluesum ); |
| | | totalscellsum := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]( dlsvaluesum + ccsvaluesum ) ); |
| | | totalsales.FinancialWeeklyCell( relinsert, totalscellsum ); |
| | | dlscellsum := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]dlsvaluesum ); |
| | | dlsales.FinancialWeeklyCell( relinsert, dlscellsum ); |
| | | ccscellsum := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]ccsvaluesum ); |
| | | ccsales.FinancialWeeklyCell( relinsert, ccscellsum ); |
| | | //累计量 |
| | | totalpcellcumulant := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]totalpvaluecumulant ); |
| | | totalpcellcumulant := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]( dlpvaluecumulant + ccpvaluecumulant ) ); |
| | | totalproduction.FinancialWeeklyCell( relinsert, totalpcellcumulant ); |
| | | dlpcellcumulant := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]dlpvaluecumulant ); |
| | | dlproduction.FinancialWeeklyCell( relinsert, dlpcellcumulant ); |
| | | ccpcellcumulant := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]ccpvaluecumulant ); |
| | | ccproduction.FinancialWeeklyCell( relinsert, ccpcellcumulant ); |
| | | totalscellcumulant := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]totalsvaluecumulant ); |
| | | totalscellcumulant := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]( dlsvaluecumulant + ccsvaluecumulant ) ); |
| | | totalsales.FinancialWeeklyCell( relinsert, totalscellcumulant ); |
| | | dlscellcumulant := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]dlsvaluecumulant ); |
| | | dlsales.FinancialWeeklyCell( relinsert, dlscellcumulant ); |
| | | ccscellcumulant := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]ccsvaluecumulant ); |
| | | ccsales.FinancialWeeklyCell( relinsert, ccscellcumulant ); |
| | | //占比 |
| | | totalpvalueproportion := guard( ( totalpvaluecumulant / totalpvaluesum ).Format( 'N(Dec(2))' ), '0.00' ); |
| | | totalpvalueproportion := guard( ( ( dlpvaluecumulant + ccpvaluecumulant ) / ( dlpvaluesum + ccpvaluesum ) ).Format( 'N(Dec(2))' ), '0.00' ); |
| | | totalpcellproportion := proportioncolumn.FinancialWeeklyCell( relnew, Value := totalpvalueproportion ); |
| | | totalproduction.FinancialWeeklyCell( relinsert, totalpcellproportion ); |
| | | |
| | |
| | | ccpcellproportion := proportioncolumn.FinancialWeeklyCell( relnew, Value := ccpvalueproportion ); |
| | | ccproduction.FinancialWeeklyCell( relinsert, ccpcellproportion ); |
| | | |
| | | totalsvalueproportion := guard( ( totalsvaluecumulant / totalsvaluesum ).Format( 'N(Dec(2))' ), '0.00' ); |
| | | totalsvalueproportion := guard( ( ( dlsvaluecumulant + ccsvaluecumulant ) / ( dlsvaluesum + ccsvaluesum ) ).Format( 'N(Dec(2))' ), '0.00' ); |
| | | totalscellproportion := proportioncolumn.FinancialWeeklyCell( relnew, Value := totalsvalueproportion ); |
| | | totalsales.FinancialWeeklyCell( relinsert, totalscellproportion ); |
| | | |