Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Quintiq file version 2.0
#parent: #root
StaticMethod GetAnnualSalesQuantity (
  const GlobalOTDTable globalOTDTable,
  Number year,
  Number month,
  String placeOfProductionOfArray,
  String businessType
) as Real
{
  TextBody:
  [*
    total := 0.0;
    
    targetGlobal_MappingAnnualBudgetDatas := selectset( globalOTDTable, Global_MappingAnnualBudgetData, tempGMABD, 
                                                        tempGMABD.YearNo()       = [String]year             and
                                                        tempGMABD.OrganCode()    = placeOfProductionOfArray and
                                                        tempGMABD.BusinessType() = businessType             
                                                       );
    
    if ( month = 0 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales1() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales2() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales3() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales4() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales5() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales6() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales7() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales8() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales9() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales10() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales11() )
             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales12() );
    } else if ( month = 1 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales1() );
    } else if ( month = 2 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales2() );
    } else if ( month = 3 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales3() );
    } else if ( month = 4 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales4() );
    } else if ( month = 5 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales5() );
    } else if ( month = 6 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales6() );
    } else if ( month = 7 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales7() );
    } else if ( month = 8 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales8() );
    } else if ( month = 9 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales9() );
    } else if ( month = 10 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales10() );
    } else if ( month = 11 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales11() );
    } else if ( month = 12 ) {
      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales12() );
    } 
    
    return total;
  *]
}