Module Customer.wo

     1Use cWebBusinessProcess.pkg
     2Use DataDict.pkg
     3Use cWebReport.pkg
     4Use Customer.DD
     5
     6Object oCustomer is a cWebBusinessProcess
     7    Set pbClearAfterSave to False
     8    Set psDescription to "Customer: Entry, Report and Maintenance"
     9
    10    Object Customer_DD is a Customer_DataDictionary
    11        Send DefineAllExtendedFields
    12        Send DefineAllExtendedFields
    13
    14    End_Object    // Customer_DD
    15
    16    Set Main_DD to Customer_DD
    17
    18    Object oReport is a cWebReport
    19
    20        Procedure OnPageTop
    21            Send WriteHtmlTableBegin 'border="0" width="99%" Class="ReportTable"'
    22
    23            Send WriteHtmlRowBegin
    24                Send WriteHtmlCellHeader 'Number' 'Class="Header" Align="right"'
    25                Send WriteHtmlCellHeader 'Customer Name' 'Class="Header" Align="left"'
    26                Send WriteHtmlCellHeader 'Phone' 'Class="Header" Align="left"'
    27                Send WriteHtmlCellHeader 'Balance' 'Class="Header" Align="right"'
    28            Send WriteHtmlRowEnd
    29        End_Procedure // OnPageTop
    30
    31        Procedure OnBody
    32            String sText sName sPhone
    33            Number nID nBalance
    34
    35            Send WriteHtmlRowBegin
    36                Get ddValueEncode "Customer.Customer_Number" To nID
    37                Get ddValueEncode "Customer.Name"            To sName
    38                Get ddValueEncode "Customer.Phone_Number"    To sPhone
    39                Get ddValueEncode "Customer.Balance"         To nBalance
    40
    41                Get AddRowIdLink (FormatNumber(nId,0)) To sText
    42                Send WriteHtmlCell sText 'Class="Data" Align="right"'
    43                Get AddRowIdLink sName To sText
    44                Send WriteHtmlCell sText 'Class="Data" Align="left"'
    45                Send WriteHtmlCell sPhone 'Class="Data" Align="left"'
    46                Send WriteHtmlCell (FormatNumber(nBalance,2)) 'Class="Data" Align="right"'
    47            Send WriteHtmlRowEnd
    48        End_Procedure // OnBody
    49
    50        // This also works, using expressions instead of Get. Shorter but harder to read
    51        //        Procedure OnBody
    52        //            String sText
    53        //
    54        //            Send WriteHtmlRowBegin
    55        //                Get AddRowIdLink (FormatNumber(ddValue(self,"Customer.Customer_Number"),0)) to sText
    56        //                Send WriteHtmlCell sText 'Class="Data" Align="right"'
    57        //                Send WriteHtmlCell (ddValue(self,"Customer.Name")) 'Class="Data" Align="left"'
    58        //                Send WriteHtmlCell (ddValue(self,"Customer.Phone_Number")) 'Class="Data" Align="left"'
    59        //                Send WriteHtmlCell (FormatNumber(ddValue(self,"Customer.Balance"),2)) 'Class="Data" Align="right"'
    60        //            Send WriteHtmlRowEnd
    61        //        End_Procedure // OnBody
    62
    63        Procedure OnPageBottom
    64            // Output table end tag
    65            Send WriteHtmlTableEnd
    66        End_Procedure // OnPageBottom
    67
    68        Function RunCustomerReport Integer iIndex RowId riStart Integer iMax Returns RowId
    69            RowId   riEnd
    70            Integer iStat
    71
    72            Set piOrdering           To iIndex
    73            Set piMaxCount           To iMax
    74            Set piMaxCountBreakLevel To 0
    75            Set priStartRowId        To riStart
    76            Get DoRunReport          To iStat
    77            Get priLastRowId         To riEnd
    78            Function_Return riEnd
    79        End_Function // RunCustomerReport
    80
    81    End_Object    // oReport
    82
    83    { Published = True  }
    84    { Description = ""  }
    85    Procedure SetHRefName String sName
    86        Set psHRefname Of oReport To sName
    87    End_Procedure // SetHRefName
    88
    89    { Published = True  }
    90    { Description = ""  }
    91    Function RunCustomerReport Integer iIndex string sStart Integer iMax Returns string
    92        RowId  riStart riEnd
    93        Move (DeserializeRowId(sStart)) to riStart
    94        Get RunCustomerReport Of oReport iIndex riStart iMax To riEnd
    95        Function_Return (SerializeRowId(riEnd))
    96    End_Function // RunCustomerReport
    97
    98    //  Register WBO interfaces
    99    Send RegisterStandardInterface
   100    // Send RegisterDebugInterface
   101    // Send RegisterFullErrorInterface
   102    // Send RegisterAutoEntryInterface
   103
   104End_Object    // oCustomer
   105