Module OrderReport.wo

     1Use cWebBusinessProcess.pkg
     2Use DataDict.pkg
     3Use cWebReport.pkg
     4Use CUSTOMER.DD
     5Use SALESP.DD
     6Use OrderHea.DD
     7
     8Object oOrderReport is a cWebBusinessProcess
     9    Set pbAllowDelete to False
    10    Set pbAllowSaveEdit to False
    11    Set pbAllowSaveNew to False
    12    Set psDescription to "Orders by Customer Report"
    13
    14    Object Customer_DD is a Customer_DataDictionary
    15        Send DefineAllExtendedFields
    16    End_Object    // Customer_DD
    17
    18    Object SalesP_DD is a Salesp_DataDictionary
    19        Send DefineAllExtendedFields
    20    End_Object    // SalesP_DD
    21
    22    Object OrderHea_DD is a OrderHea_DataDictionary
    23        Set DDO_Server to Customer_DD
    24        Set DDO_Server to SalesP_DD
    25        Send DefineAllExtendedFields
    26    End_Object    // OrderHea_DD
    27
    28    Set Main_DD to OrderHea_DD
    29
    30    Object oReport is a cWebReport
    31
    32        Set piConstrainFile   To Customer.File_Number
    33        Set priConstrainRowId To (NullRowId()) //  We will set this elsewhere
    34        Set piOrdering to 2
    35
    36        Function Break1 Returns String
    37            Function_Return Customer.Customer_Number //  Break every time the parent record changes
    38        End_Function // Break1
    39
    40        Procedure OnInitBreakpoints
    41            Send RegisterBreakpoint get_Break1
    42        End_Procedure // OnInitBreakpoints
    43
    44        Procedure OnSubHeader1
    45            String sName
    46            Number nNumber
    47
    48            Get ddValueEncode "Customer.Customer_Number" To nNumber
    49            Get ddValueEncode "Customer.Name"   To sName
    50            Send WriteHtmlTableBegin 'border="0" width="50%" Class="ReportHdr1Table"'
    51
    52            Send WriteHtmlRowBegin
    53                Send WriteHtmlCellHeader 'Customer Number' ' Class="Label"'
    54                Send WriteHtmlCell (FormatNumber(nNumber,0)) ' Class="Data"'
    55            Send WriteHtmlRowEnd
    56            Send WriteHtmlRowBegin
    57                Send WriteHtmlCellHeader 'Customer Name' ' Class="Label"'
    58                Send WriteHtmlCell sName ' Class="Data"'
    59            Send WriteHtmlRowEnd
    60
    61            Send WriteHtmlTableEnd
    62
    63            Send WriteHtmlTableBegin 'border="0" width="99%" Class="ReportTable"'
    64
    65            Send WriteHtmlRowBegin
    66                Send WriteHtmlCellHeader 'Order Number' 'Class="Header" Align="right"'
    67                Send WriteHtmlCellHeader 'Order Date' 'Class="Header" Align="left"'
    68                Send WriteHtmlCellHeader 'ID' 'Class="Header" Align="left"'
    69                Send WriteHtmlCellHeader 'Order Total' 'Class="Header" Align="right"'
    70            Send WriteHtmlRowEnd
    71
    72        End_Procedure // OnSubHeader1
    73
    74        Procedure OnBody
    75            String sText sDate sId
    76            Number nNumber nTotal
    77
    78            Get ddValueEncode "OrderHea.Order_number" To nNumber
    79            Get ddValueEncode "OrderHea.Order_date" To sDate
    80            Get ddValueEncode "Salesp.Id" To sId
    81            Get ddValueEncode "OrderHea.Order_Total" To nTotal
    82
    83            Send WriteHtmlRowBegin
    84                Get AddRowIdLink (FormatNumber(nNumber,0)) To sText
    85                Send WriteHtmlCell sText 'Class="Data" Align="right"'
    86                Send WriteHtmlCell sDate 'Class="Data" Align="left"'
    87                Send WriteHtmlCell sId 'Class="Data" Align="left"'
    88                Send WriteHtmlCell (FormatNumber(nTotal,2)) 'Class="Data" Align="right"'
    89            Send WriteHtmlRowEnd
    90            Send AddSubTotal 1 nTotal //  Subtotal of field
    91        End_Procedure // OnBody
    92
    93        Procedure OnSubTotal1
    94            Number nTotal
    95
    96            Send WriteHtmlCell "" 'colspan="3" Class="Header"'
    97            Get SubTotal 1 To nTotal
    98            Send WriteHtmlCell (FormatNumber(nTotal,2)) 'Class="Header" align="right" '
    99
   100            Send WriteHtmlTableEnd
   101        End_Procedure // OnSubTotal1
   102
   103        Function RunOrderReport RowId riHdrRec Returns RowId
   104            RowId  riEnd
   105            Integer iStat
   106
   107            Set piMaxCount        To 0
   108            Set priStartRowId     To (NullRowId())
   109            Set priConstrainRowId To riHdrRec
   110            Get DoRunReport       To iStat
   111            Get priLastRowId      to riEnd
   112            Function_Return riEnd
   113        End_Function // RunOrderReport
   114
   115        Function RunAllOrderReport RowId riStart Integer iMax Returns RowId
   116            RowId   riEnd
   117            Integer iStat
   118
   119            Set piMaxCount           To iMax
   120            Set piMaxCountBreakLevel To 1
   121            Set priStartRowId        To riStart
   122            Set priConstrainRowId    To (NullRowId())
   123            Get DoRunReport          To iStat
   124            Get priLastRowId         To riEnd
   125            Function_Return riEnd
   126        End_Function // RunAllOrderReport
   127
   128    End_Object    // oReport
   129
   130    { Published = True  }
   131    { Description = ""  }
   132    Procedure SetHRefName string sName
   133        Set psHRefname of oReport to sName
   134    End_Procedure // SetHRefName
   135
   136    { Published = True  }
   137    { Description = ""  }
   138    Function RunOrderReport String sHdrRec Returns string
   139        RowId riEnd
   140        Get RunOrderReport of oReport (DeSerializeRowId(sHdrRec)) to riEnd
   141        Function_return (SerializeRowId(riEnd))
   142    End_Function // RunOrderReport
   143
   144    { Published = True  }
   145    { Description = ""  }
   146    Function RunAllOrderReport string sStart integer iMax Returns string
   147        RowId riEnd
   148        Get RunAllOrderReport of oReport (DeserializeRowId(sStart)) iMax to riEnd
   149        Function_return (SerializeRowId(riEnd))
   150    End_Function // RunAllOrderReport
   151
   152End_Object    // oOrderReport
   153