Module CustomerReport.wo

     1Use cWebBusinessProcess.pkg
     2Use DataDict.pkg
     3Use cWebReport.pkg
     4Use Customer.DD
     5
     6Object oCustomerReport is a cWebBusinessProcess
     7    Set pbAllowDelete to False
     8    Set pbAllowSaveEdit to False
     9    Set pbAllowSaveNew to False
    10    Set pbVerboseErrors to True
    11    Set psDescription to "Customer Information Drill Down Report"
    12
    13    Object Customer_DD is a Customer_DataDictionary
    14        Send DefineAllExtendedFields
    15
    16        Property Number pnStartCustomer_Number
    17        Property Number pnStopCustomer_Number
    18
    19        Procedure OnConstrain
    20            Number nStart nStop
    21            Date   dStart dStop
    22            String sStart sStop
    23
    24            Get pnStartCustomer_Number To nStart
    25            Get pnStopCustomer_Number  To nStop
    26
    27            If (nStart<>0 And nStop<>0) ;
    28                Constrain Customer.Customer_Number Between nStart And nStop
    29            Else If (nStart>0) ;
    30                Constrain Customer.Customer_Number Ge nStart
    31            Else If (nStop<0) ;
    32                Constrain Customer.Customer_Number Le nStop
    33        End_Procedure // OnConstrain
    34
    35    End_Object    // Customer_DD
    36
    37    Set Main_DD to Customer_DD
    38
    39    Object oReport is a cWebReport
    40
    41        Procedure OnPageTop
    42            Send WriteHtmlTableBegin 'border="0" width="99%" Class="ReportTable"'
    43
    44            Send WriteHtmlRowBegin
    45                Send WriteHtmlCellHeader 'Number' 'Class="Header" Align="right"'
    46                Send WriteHtmlCellHeader 'Customer Name' 'Class="Header" Align="left"'
    47                Send WriteHtmlCellHeader 'Phone' 'Class="Header" Align="left"'
    48                Send WriteHtmlCellHeader 'Balance' 'Class="Header" Align="right"'
    49                Send WriteHtmlCellHeader 'Status' 'Class="Header" Align="left"'
    50            Send WriteHtmlRowEnd
    51        End_Procedure // OnPageTop
    52
    53        Procedure OnBody
    54            String sText sName sPhone sStatus
    55            Number nID nBalance
    56
    57            Send WriteHtmlRowBegin
    58                Get ddValueEncode "Customer.Customer_Number" To nID
    59                Get ddValueEncode "Customer.Name"            To sName
    60                Get ddValueEncode "Customer.Phone_Number"    To sPhone
    61                Get ddValueEncode "Customer.Balance"         To nBalance
    62                Get ddValueEncode "Customer.Status"          To sStatus
    63                If (sStatus="Y") Move "Active" To sStatus
    64                Else             Move "Inactive" To sStatus
    65                Get AddRowIdLink (FormatNumber(nId,0)) To sText
    66                Send WriteHtmlCell sText 'Class="Data" Align="right"'
    67                Get AddRowIdLink sName To sText
    68                Send WriteHtmlCell sText 'Class="Data" Align="left"'
    69                Send WriteHtmlCell sPhone 'Class="Data" Align="left"'
    70                Send WriteHtmlCell (FormatNumber(nBalance,2)) 'Class="Data" Align="right"'
    71                Send WriteHtmlCell sStatus 'Class="Data" Align="left"'
    72            Send WriteHtmlRowEnd
    73        End_Procedure // OnBody
    74
    75        Procedure OnPageBottom
    76            Send WriteHtmlTableEnd
    77        End_Procedure // OnPageBottom
    78
    79        Function RunCustomerReport Integer iIndex RowId riStart Integer iMax Returns RowId
    80            RowId   riEnd
    81            Integer iEnd iStat
    82
    83            Set piOrdering           To iIndex
    84            Set piMaxCount           To iMax
    85            Set piMaxCountBreakLevel To 0
    86            Set priStartRowId        To riStart
    87            Get DoRunReport          To iStat
    88            Get priLastRowId         To riEnd
    89            Function_Return riEnd
    90        End_Function // RunCustomerReport
    91
    92    End_Object    // oReport
    93
    94    { Published = True  }
    95    { Description = ""  }
    96    Procedure SetHRefName String sName
    97        Set psHRefname Of oReport To sName
    98    End_Procedure // SetHRefName
    99
   100    { Published = True  }
   101    { Description = ""  }
   102    Procedure SetCustomer_Number String sStart String sStop
   103        Handle hDD
   104
   105        Get phMainDD To hDD
   106        Set pnStartCustomer_Number Of hDD To sStart
   107        Set pnStopCustomer_Number  Of hDD To sStop
   108    End_Procedure // SetCustomer_Number
   109
   110    { Published = True  }
   111    { Description = ""  }
   112    Function RunCustomerReport Integer iIndex string sStart Integer iMax Returns string
   113        Rowid riEnd
   114
   115        Get RunCustomerReport Of oReport iIndex (DeserializeRowId(sStart)) iMax To riEnd
   116
   117        Function_Return (SerializeRowid(riEnd))
   118    End_Function // RunCustomerReport
   119
   120    // Register WBO interfaces
   121    // Register standard interface, which registers, and thus gives us
   122    // web access to function CreateFindIndexCombo
   123    Send RegisterStandardInterface
   124
   125End_Object    // oCustomerReport
   126