Module OrdersByCustomerWP.rv

     1Use dfrptvw.pkg
     2Use DataDict.pkg
     3Use dfRadio.pkg
     4Use Windows.pkg
     5Use cWinReport2.pkg
     6Use VENDOR.DD
     7Use INVT.DD
     8Use CUSTOMER.DD
     9Use SALESP.DD
    10Use ORDERHEA.DD
    11Use ORDERDTL.DD
    12
    13ACTIVATE_VIEW Activate_oOrdersByCustomerWP FOR oOrdersByCustomerWP
    14
    15Object oOrdersByCustomerWP is a ReportView
    16
    17    property integer main_dd
    18    Property integer server
    19
    20    Set Label to "Orders by Customer"
    21    Set Location to 6 6
    22    Set Size to 110 174
    23
    24    Object Vendor_DD is a Vendor_DataDictionary
    25        Send DefineAllExtendedFields
    26    End_Object    // Vendor_DD
    27
    28    Object Invt_DD is a Invt_DataDictionary
    29        Set DDO_Server to Vendor_DD
    30        Send DefineAllExtendedFields
    31    End_Object    // Invt_DD
    32
    33    Object Customer_DD is a Customer_DataDictionary
    34        Send DefineAllExtendedFields
    35    End_Object    // Customer_DD
    36
    37    Object SalesP_DD is a Salesp_DataDictionary
    38        Send DefineAllExtendedFields
    39    End_Object    // SalesP_DD
    40
    41    Object Orderhea_DD is a Orderhea_DataDictionary
    42        Set DDO_Server to Customer_DD
    43        Set DDO_Server to SalesP_DD
    44        Set Constrain_File to Customer.File_Number
    45        Send DefineAllExtendedFields
    46    End_Object    // Orderhea_DD
    47
    48    Object Orderdtl_DD is a Orderdtl_DataDictionary
    49        Set DDO_Server to Orderhea_DD
    50        Set DDO_Server to Invt_DD
    51        Set Constrain_File to Orderhea.File_Number
    52        Send DefineAllExtendedFields
    53    End_Object    // Orderdtl_DD
    54
    55    Set Main_DD to Customer_DD
    56    Set Server to Customer_DD
    57
    58    Object oPrintTo is a RadioGroup
    59        Set Size to 38 105
    60        Set Location to 5 5
    61        Set Label to "Print to"
    62        Object oRadio1 is a Radio
    63            Set Label to "Preview"
    64            Set Size to 10 42
    65            Set Location to 12 6
    66            Set Status_Help to "Prints the report to screen"
    67        End_Object    // oRadio1
    68
    69        Object oRadio2 is a Radio
    70            Set Label to "Printer"
    71            Set Size to 10 42
    72            Set Location to 24 6
    73            Set Status_Help to "Prints the report to printer"
    74        End_Object    // oRadio2
    75
    76    End_Object    // oPrintTo
    77
    78    Object oReportOrder is a RadioGroup
    79        Set Size to 38 105
    80        Set Location to 45 5
    81        Set Label to "Report Order"
    82        Object oRadio3 is a Radio
    83            Set Label to "Customer Number"
    84            Set Size to 10 73
    85            Set Location to 12 6
    86            Set Status_Help to "Prints the report to screen"
    87        End_Object    // oRadio3
    88
    89        Object oRadio4 is a Radio
    90            Set Label to "Customer Name"
    91            Set Size to 10 67
    92            Set Location to 24 6
    93            Set Status_Help to "Prints the report to printer"
    94        End_Object    // oRadio4
    95
    96        Function OrderByNumber returns boolean
    97            function_return (current_radio(self)=0)
    98        end_function
    99        
   100    End_Object    // oReportOrder
   101
   102    Object oSetupButton is a Button
   103        Set Label to "Printer Setup"
   104        Set Location to 7 120
   105
   106        Procedure OnClick
   107            Boolean bSetupOk
   108            Get DFPrintSetupDialog of oOrders to bSetupOk
   109        End_Procedure
   110
   111    End_Object    // oSetupButton
   112
   113    Object oBtnPrint is a Button
   114        Set Label to "Print"
   115        Set Location to 49 120
   116        Set Status_Help to "Print the Selected report"
   117        Set Default_State to True
   118
   119        Procedure OnClick
   120            boolean bByNumber
   121            Get OrderByNumber of oReportOrder  to bByNumber
   122            Set Ordering of oOrders to (if(bByNumber,1,2))
   123            Send StartReport
   124        End_Procedure
   125
   126    End_Object    // oBtnPrint
   127
   128    Object oBtnCancel is a Button
   129        Set Label to "Cancel"
   130        Set Location to 67 120
   131        Set Status_Help to "Close this Panel"
   132
   133        Procedure OnClick
   134            Send Close_Panel
   135        End_Procedure
   136
   137    End_Object    // oBtnCancel
   138
   139    Object oOnePageCkBx is a CheckBox
   140        Set Label to "New Page for Each Customer"
   141        Set Size to 10 110
   142        Set Location to 92 6
   143
   144        Procedure OnChange
   145            Boolean bChecked
   146        
   147            Get Checked_State To bChecked
   148        End_Procedure // OnChange
   149
   150    End_Object    // oOnePageCkBx
   151
   152    Object oOrders is a cWinReport2
   153
   154        Property Boolean pbOnePagePerCust False
   155        
   156        Set Report_Title to "Printing all Orders by Customer"
   157        
   158        //Main File for the report
   159        Set Server to Customer_DD
   160        //Breaks and Index for the report
   161        Report_Breaks Customer.Customer_number
   162        
   163        Set Ordering to 2
   164        
   165        Object oOrderHea is a cWinReport2
   166
   167            Set Server to Orderhea_DD
   168            Report_Breaks ORDERHEA.Order_number
   169            set Ordering to 2
   170
   171            Object oOrderDtl is a cWinReport2
   172
   173                Set Server to Orderdtl_DD
   174                Report_Breaks Orderhea.Order_Number
   175                Set Ordering to 1
   176                
   177                Procedure SubHeader1
   178                      Send Update_Status (Customer.Name - '/' - string(Orderhea.Order_number))
   179                
   180                      DFFont "Arial"
   181                      DFFontSize 8
   182                
   183                      DFBeginHeader DFSubHeader 2
   184                        DFHeaderFrame hdr_NoFrame
   185                        DFHeaderPos   hdr_Left
   186                        DFHeaderWrap hdr_Wrap
   187                        DfHeaderMargin hm_BottomOuter 0.04
   188                        DFHeaderLineCheck 5            //Check that the header + 5 lines fits on the page, if not wrap
   189                
   190                        DFWritePos    "Order Number"            0.10  (FONT_BOLD+RGB_DBLUE)
   191                        DFWritelnPos  Orderhea.Order_number       4.0   (FONT_DEFAULT)
   192                        DFWritePos    "Order Date"              0.10  (FONT_BOLD+RGB_DBLUE)
   193                        DFWritelnPos  Orderhea.Order_date         4.0   (FONT_DEFAULT)
   194                        DFWritePos    "Terms"                   0.10  (FONT_BOLD+RGB_DBLUE)
   195                        DFWritelnPos  Orderhea.Terms              4.0   (FONT_DEFAULT)
   196                        DFWritePos    "Ship Via"                0.10  (FONT_BOLD+RGB_DBLUE)
   197                        DFWritelnPos  Orderhea.Ship_via           4.0   (FONT_DEFAULT)
   198                
   199                        DfWriteRect dfgr_CurrLine 0 0.34 dfgr_rb_Margin rgb_Grey 0.0 dfgr_NoWrap rgb_Grey
   200                        DFWritePos    "Item Id"                 0.1     (FONT_BOLD+RGB_DBLUE)            -1 1.36
   201                        DFWritePos    "Description"             4.00    (FONT_BOLD+RGB_DBLUE)            -1 4.77
   202                        DFWritePos    "Qty Ordered"             11.5     (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 1.87
   203                        DFWritePos    "Price"                   13.22   (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 1.22
   204                        DFWritePos    "Extended Price"          16.0    (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 2.50
   205                        DFWriteln
   206                
   207                      DFEndHeader
   208                
   209                End_Procedure
   210                
   211                Procedure Body // order detail body
   212                
   213                    DFFont "Arial"
   214                    DFFontSize 8
   215                
   216                    DFLineCheck 5
   217                
   218                    DFWritePos    Invt.Item_id                0.1     (FONT_DEFAULT)            -1 2.28
   219                    DFWritePos    Invt.Description            4.00    (FONT_DEFAULT)            -1 4.77
   220                    DFWritePos    Orderdtl.Qty_ordered        11.5     (FONT_DEFAULT+FONT_RIGHT)  0 1.87
   221                    DFWritePos    Orderdtl.Price              13.22   (FONT_DEFAULT+FONT_RIGHT)  2 1.22
   222                    DFWritePos    Orderdtl.Extended_price     16.0    (FONT_DEFAULT+FONT_RIGHT)  2 2.50
   223                    DFWriteln
   224                
   225                    // Using rectotal in WinPrint.
   226                    Send Add_SubTotal 1 (Orderdtl.Extended_price)
   227                
   228                End_Procedure
   229                
   230                Procedure SubTotal1 // order total
   231                    Number nAmount
   232                
   233                    Get SubTotal 1 to nAmount
   234                    Send Add_SubTotal 2 nAmount // subtotal 2 is customer total
   235                
   236                    DFFont "Arial"
   237                    DFFontSize 8
   238                    DFBeginHeader DFSubTotal 2
   239                        DFHeaderPos hdr_Left
   240                        DFHeaderFrame hdr_Margins 0.01 rgb_dGrey rgb_Grey
   241                        DfHeaderMargin hm_TopInner 0.02
   242                        DfHeaderMargin hm_BottomInner 0.02
   243                        DfHeaderMargin hm_BottomOuter 0.08
   244                        DfHeaderMargin hm_TopOuter 0.04
   245                
   246                        DFWritePos   "Order Total:"  14.0  (FONT_BOLD+RGB_DBLUE+FONT_RIGHT)
   247                        DFWritelnPos nAmount         16.0   (FONT_RIGHT) 2
   248                    DFEndHeader
   249                
   250                End_Procedure
   251                
   252            End_Object    // oOrderDtl
   253
   254        End_Object    // oOrderHea
   255        
   256        Function Starting_Main_Report Returns Integer
   257            Integer iRetVal bBreak
   258            Get OnePagePerCust to bBreak
   259            Set pbOnePagePerCust to bBreak
   260            Send DFSetMetrics to WinPrintId "CM"
   261            Send DFSetmargins to WinPrintId 1 1 1 1
   262            Forward Get Starting_Main_Report to iRetVal
   263            If iRetVal Function_Return iRetVal
   264        End_Function
   265        
   266        Procedure Page_Top
   267            DFFont "Arial"
   268            DFFontSize 8
   269            DFBeginHeader DFPageTop
   270                DFHeaderFrame hdr_NoFrame
   271                DFHeaderPos   hdr_Right
   272        
   273                DFWriteLn ("Page:" * "#pagecount#")
   274            DFEndHeader
   275        End_Procedure
   276        
   277        Procedure Page_Title
   278            DFFont "Arial"
   279            DFFontSize 14
   280            DFBeginHeader DFPageTitle
   281                DFHeaderFrame hdr_Margins 0.01 rgb_dGrey rgb_dGrey
   282                DFHeaderPos hdr_Left
   283                DFHeaderMargin hm_BottomOuter 0.08
   284        
   285                DFWriteLnPos "Orders by Customer Report" 0.10 (FONT_BOLD+RGB_WHITE)
   286            DFEndHeader
   287        End_Procedure
   288        
   289        Procedure SubHeader1
   290            Integer iClr
   291            DFFont "Arial" //  Use Arial
   292            DFFontSize 8
   293            Get DFGetDFColor of winprintId  242 242 242 to iClr // Move -218959360 to iClr  can be used instead
   294        
   295            DFBeginHeader DFSubHeader 1 // customer sub-header
   296                DFHeaderFrame hdr_Margins 0.01 rgb_dGrey iClr
   297                DFHeaderPos   hdr_Left
   298                DFHeaderWrap hdr_Wrap
   299                DFHeaderLineCheck 10 //Check that the header + 10 lines fits on the page, if not wrap
   300        
   301                DFWritePos    "Customer Number"         0.10  (FONT_BOLD+RGB_DBLUE)
   302                DFWriteLnPos  Customer.Customer_number    4.0
   303                DFWritePos    "Name"                    0.10  (FONT_BOLD+RGB_DBLUE)
   304                DFWriteLnPos  Customer.Name               4.0   (FONT_DEFAULT)
   305                DFWritePos    "Address"                 0.10  (FONT_BOLD+RGB_DBLUE)
   306                DFWriteLnPos  Customer.Address            4.0   (FONT_DEFAULT)
   307                DFWritePos    "City"                    0.10  (FONT_BOLD+RGB_DBLUE)
   308                DFWriteLnPos  Customer.City               4.0   (FONT_DEFAULT)
   309                DFWritePos    "State"                   0.10  (FONT_BOLD+RGB_DBLUE)
   310                DFWriteLnPos  Customer.State              4.0   (FONT_DEFAULT)
   311                DFWritePos    "Zip"                     0.10  (FONT_BOLD+RGB_DBLUE)
   312                DFWriteLnPos  Customer.Zip                4.0   (FONT_DEFAULT)
   313            DFEndHeader
   314        End_Procedure
   315        
   316        Procedure SubTotal1 // customer total
   317            Number nAmount
   318            Integer iClr
   319            Boolean bBreak
   320        
   321            Get SubTotal 2 to nAmount
   322            Send Add_SubTotal 3 nAmount // subtotal 3 is total of all
   323        
   324            Get DFGetDFColor of winprintId  242 242 242 to iClr // Move -218959360 to iClr   can be used instead
   325        
   326            DFFont "Arial" //  Use Arial
   327            DFFontSize 8
   328            DFBeginHeader DFSubTotal 1
   329                DFHeaderPos hdr_Left
   330                DFHeaderFrame hdr_Margins 0.01 rgb_dGrey iClr
   331                DFHeaderMargin hm_BottomOuter 0.16
   332        
   333                DFWritePos   "Customer Total:"  14.0 (FONT_BOLD+RGB_DBLUE+FONT_RIGHT)
   334                DFWriteLnPos nAmount 16.0              (FONT_RIGHT+FONT_Bold) 2 0
   335            DFEndHeader
   336            Get pbOnePagePerCust to bBreak
   337            If bBreak Begin
   338                Send DFNew_Page
   339            End
   340        End_Procedure
   341        
   342        Procedure Total // total of all customers
   343            Number nTotal
   344            Get SubTotal 3 to nTotal
   345        
   346            DFFont "Arial" //  Use Arial
   347            DFFontSize 10
   348        
   349            DFBeginHeader DFTotal
   350        
   351                DFHeaderPos   hdr_Left
   352                DFHeaderFrame hdr_Margins 0.01 rgb_dGrey rgb_Grey
   353        
   354                DFWritePos    "Grand Total:"  14.0        (FONT_BOLD+RGB_DBLUE+FONT_RIGHT)
   355                DFWriteLnPos   nTotal         16.0      (FONT_BOLD+FONT_RIGHT) 2
   356        
   357            DFEndHeader                     //End and print header
   358        
   359        End_Procedure
   360        
   361        Procedure Page_Bottom
   362            DateTime dtDT
   363            Move (CurrentDateTime()) to dtDT
   364        
   365            DFFont "Arial"
   366            DFFontSize 8
   367            DFBeginHeader DFPageBottom
   368                DFHeaderPos   hdr_Center
   369                DFHeaderFrame hdr_Margins 0.01 rgb_dGrey
   370                DFWriteLn   ("Report Printed on: " +String(dtDT)) (rgb_dBlue)
   371            DFEndHeader
   372        
   373        End_Procedure
   374
   375    End_Object    // oOrders
   376
   377    // Procedures and functions used by the user interface
   378    
   379    //This function is called by the procedure StartReport
   380    Function Print_to_Screen_State Returns Integer
   381        Integer iRad
   382        Get Current_Radio of oPrintTo To iRad
   383        Function_Return (iRad=1)
   384    End_Function
   385    
   386    // Use this procedure to do print setup
   387    Procedure SetupReport
   388        Boolean bSetupOk
   389        Get DFPrintSetupDialog of oOrders to bSetupOk
   390    End_Procedure
   391    
   392    // Use this procedure to start the report
   393    Procedure StartReport
   394        Boolean bToPrinter
   395        String sVal
   396        Get Print_to_Screen_State to bToPrinter
   397        If bToPrinter Set OutPut_Device_Mode to PRINT_TO_PRINTER
   398        Else          Set OutPut_Device_Mode to PRINT_TO_WINDOW
   399    
   400        Send Run_Report of oOrders
   401    
   402    End_Procedure
   403    
   404    Function OnePagePerCust returns boolean
   405        boolean bBreak
   406        Get checked_state of oOnePageCkBx to bBreak
   407        Function_return bBreak
   408    end_function
   409    
   410    // The Report
   411    //    Object oOrders is a cWinReport2
   412    //    //Object oOrders is a WinReport
   413    
   414    //        Property Boolean pbOnePagePerCust False
   415    //        Set Report_Title to "Printing all Orders by Customer"
   416    
   417    //        //Main File for the report
   418    //        Set Server to Customer_DD
   419    //        //Breaks and Index for the report
   420    //        Report_Breaks ORDERHEA.CUSTOMER_NUMBER
   421    //        Set Ordering to 2
   422    
   423    //        Function Starting_Main_Report Returns Integer
   424    //            Integer iRetVal bBreak
   425    //            Get OnePagePerCust to bBreak
   426    //            Set pbOnePagePerCust to bBreak
   427    //            Send DFSetMetrics To WinPrintId "CM"
   428    //            Send DFSetmargins To WinPrintId 1 1 1 1
   429    //            Forward Get Starting_Main_Report To iRetVal
   430    //            If iRetVal Function_return iRetVal
   431    //        End_Function
   432    
   433    //        Procedure Page_Top
   434    //            DFFont "Arial"
   435    //            DFFontSize 8
   436    //            DFBeginHeader DFPageTop
   437    //                DFHeaderFrame HDR_NOFRAME
   438    //                DFHeaderPos   HDR_RIGHT
   439    
   440    //                DFWriteLn ("Page:" * "#pagecount#")
   441    //            DFEndHeader
   442    //        End_Procedure
   443    
   444    //        Procedure Page_Title
   445    //            DFFont "Arial"
   446    //            DFFontSize 14
   447    //            DFBeginHeader DFPageTitle
   448    //                DFHeaderFrame HDR_MARGINs 0.01 RGB_DGREY RGB_DGREY
   449    //                DFHEADERPOS HDR_LEFT
   450    //                DfHeaderMargin hm_BottomOuter 0.08
   451    
   452    //                DFWritelnPos "Orders by Customer Report" 0.10 (FONT_BOLD+RGB_WHITE)
   453    //            DFEndHeader
   454    //        End_Procedure
   455    
   456    //        Procedure SubHeader1
   457    //            integer iClr
   458    //            DFFont "Arial" //  Use Arial
   459    //            DFFontSize 8
   460    //            //Get DFGetDFColor of winprintId  242 242 242 to iClr // doesn't work YET
   461    //            Move -218959360 to iClr
   462    
   463    //            DFBeginHeader DFSubHeader 1 // customer sub-header
   464    //                DFHeaderFrame hdr_Margins 0.01 rgb_dGrey iClr
   465    //                DFHeaderPos   HDR_LEFT
   466    //                DFHeaderWrap HDR_WRAP
   467    //                DFHeaderLineCheck 10 //Check that the header + 10 lines fits on the page, if not wrap
   468    
   469    //                DFWritePos    "Customer Number"         0.10  (FONT_BOLD+RGB_DBLUE)
   470    //                DFWritelnPos  Customer.CUSTOMER_NUMBER    4.0
   471    //                DFWritePos    "Name"                    0.10  (FONT_BOLD+RGB_DBLUE)
   472    //                DFWritelnPos  Customer.NAME               4.0   (FONT_DEFAULT)
   473    //                DFWritePos    "Address"                 0.10  (FONT_BOLD+RGB_DBLUE)
   474    //                DFWritelnPos  Customer.ADDRESS            4.0   (FONT_DEFAULT)
   475    //                DFWritePos    "City"                    0.10  (FONT_BOLD+RGB_DBLUE)
   476    //                DFWritelnPos  Customer.CITY               4.0   (FONT_DEFAULT)
   477    //                DFWritePos    "State"                   0.10  (FONT_BOLD+RGB_DBLUE)
   478    //                DFWritelnPos  Customer.STATE              4.0   (FONT_DEFAULT)
   479    //                DFWritePos    "Zip"                     0.10  (FONT_BOLD+RGB_DBLUE)
   480    //                DFWritelnPos  Customer.ZIP                4.0   (FONT_DEFAULT)
   481    //            DFEndHeader
   482    //        End_Procedure
   483    
   484    //        Object oOrderHea is a cWinReport2
   485    //    //        Object oOrders is a WinReport
   486    
   487    //            Set Server to Orderhea_DD
   488    //            Report_Breaks ORDERHEA.Order_number
   489    //            set Ordering to 2
   490    
   491    //            Object oOrderDtl is a cWinReport2
   492    //    //            Object oOrders is a WinReport
   493    
   494    //                Set Server to Orderdtl_DD
   495    //                Report_Breaks ORDERHEA.Order_Number
   496    //                Set Ordering to 1
   497    
   498    //                Procedure SubHeader1 // order sub-header
   499    //                      Send Update_Status (Customer.Name - '/' - string(Orderhea.order_number))
   500    
   501    //                      DFFont "Arial"
   502    //                      DFFontSize 8
   503    
   504    //                      DFBeginHeader DFSubHeader 2
   505    //                        DFHeaderFrame hdr_NoFrame
   506    //                        DFHeaderPos   HDR_LEFT
   507    //                        DFHeaderWrap HDR_WRAP
   508    //                        DfHeaderMargin hm_BottomOuter 0.04
   509    //                        DFHeaderLineCheck 5            //Check that the header + 5 lines fits on the page, if not wrap
   510    
   511    //                        DFWritePos    "Order Number"            0.10  (FONT_BOLD+RGB_DBLUE)
   512    //                        DFWritelnPos  Orderhea.ORDER_NUMBER       4.0   (FONT_DEFAULT)
   513    //                        DFWritePos    "Order Date"              0.10  (FONT_BOLD+RGB_DBLUE)
   514    //                        DFWritelnPos  Orderhea.ORDER_DATE         4.0   (FONT_DEFAULT)
   515    //                        DFWritePos    "Terms"                   0.10  (FONT_BOLD+RGB_DBLUE)
   516    //                        DFWritelnPos  Orderhea.TERMS              4.0   (FONT_DEFAULT)
   517    //                        DFWritePos    "Ship Via"                0.10  (FONT_BOLD+RGB_DBLUE)
   518    //                        DFWritelnPos  Orderhea.SHIP_VIA           4.0   (FONT_DEFAULT)
   519    
   520    //                        DfWriteRect DFGR_CURRLINE 0 0.34 DFGR_RB_MARGIN RGB_GREY 0.0 dfgr_noWrap RGB_GREY
   521    //                        DFWritePos    "Item Id"                 0.1     (FONT_BOLD+RGB_DBLUE)            -1 1.36
   522    //                        DFWritePos    "Description"             2.36    (FONT_BOLD+RGB_DBLUE)            -1 4.77
   523    //                        DFWritePos    "Qty Ordered"             9.5     (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 1.87
   524    //                        DFWritePos    "Price"                   11.22   (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 1.22
   525    //                        DFWritePos    "Extended Price"          14.1    (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 2.38
   526    //                        DFWriteln
   527    
   528    //                      DFEndHeader
   529    
   530    //                End_Procedure
   531    
   532    //                Procedure Body // order detail body
   533    
   534    //                    DFFont "Arial"
   535    //                    DFFontSize 8
   536    
   537    //                    DFLineCheck 5
   538    
   539    //                    DFWritePos    Invt.ITEM_ID                0.1     (FONT_DEFAULT)            -1 2.24
   540    //                    DFWritePos    Invt.DESCRIPTION            2.36    (FONT_DEFAULT)            -1 4.77
   541    //                    DFWritePos    Orderdtl.QTY_ORDERED        9.5     (FONT_DEFAULT+FONT_RIGHT)  0 1.87
   542    //                    DFWritePos    Orderdtl.PRICE              11.22   (FONT_DEFAULT+FONT_RIGHT)  2 1.22
   543    //                    DFWritePos    Orderdtl.EXTENDED_PRICE     14.1    (FONT_DEFAULT+FONT_RIGHT)  2 2.38
   544    //                    DFWriteln
   545    
   546    //                    // Using rectotal in WinPrint.
   547    //                    Send Add_SubTotal 1 (Orderdtl.EXTENDED_PRICE)
   548    
   549    //                End_Procedure
   550    
   551    //                Procedure SubTotal1 // order total
   552    //                    Number nAmount
   553    
   554    //                    Get SubTotal 1 to nAmount
   555    //                    Send Add_SubTotal 2 nAmount // subtotal 2 is customer total
   556    
   557    //                    DFFont "Arial"
   558    //                    DFFontSize 8
   559    //                    DFBeginHeader DFSubTotal 2
   560    //                        DFHEADERPOS HDR_LEFT
   561    //                        DFHEADERFRAME HDR_Margins 0.01 rgb_dGrey rgb_Grey
   562    //                        DfHeaderMargin hm_TopInner 0.02
   563    //                        DfHeaderMargin hm_BottomInner 0.02
   564    //                        DfHeaderMargin hm_BottomOuter 0.08
   565    //                        DfHeaderMargin hm_TopOuter 0.04
   566    
   567    //                        DFWritePos   "Order Total:"  12.00  (FONT_BOLD+RGB_DBLUE+FONT_RIGHT)
   568    //                        DFWritelnPos nAmount         14.1   (FONT_RIGHT) 2
   569    //                    DFEndHeader
   570    
   571    //                End_Procedure
   572    
   573    //            end_object // orderdtl nested report
   574    
   575    //        end_object // orderhea nested report
   576    
   577    //        Procedure SubTotal1 // customer total
   578    //            Number nAmount
   579    //            integer iClr
   580    //            Boolean bBreak
   581    
   582    //            Get SubTotal 2 to nAmount
   583    //            Send Add_SubTotal 3 nAmount // subtotal 3 is total of all
   584    
   585    //            //Get DFGetDFColor of winprintId  242 242 242 to iClr // doesn't work YET
   586    //            Move -218959360 to iClr
   587    
   588    //            DFFont "Arial" //  Use Arial
   589    //            DFFontSize 8
   590    //            DFBeginHeader DFSubTotal 1
   591    //                DFHEADERPOS HDR_LEFT
   592    //                DFHeaderFrame HDR_Margins 0.01 RGB_DGREY iClr
   593    //                DfHeaderMargin hm_BottomOuter 0.16
   594    
   595    //                DFWritePos   "Customer Total:"  12.00 (FONT_BOLD+RGB_DBLUE+FONT_RIGHT)
   596    //                DFWritelnPos nAmount 14.1              (FONT_RIGHT+FONT_Bold) 2 0
   597    //            DFEndHeader
   598    //            Get pbOnePagePerCust to bBreak
   599    //            If bBreak Begin
   600    //                send DFNew_Page
   601    //            end
   602    //        end_procedure
   603    
   604    //        Procedure Total // total of all customers
   605    //            Number nTotal
   606    //            Get SubTotal 3 to nTotal
   607    
   608    //            DFFont "Arial" //  Use Arial
   609    //            DFFontSize 10
   610    
   611    //            DFBeginHeader DFTotal
   612    
   613    //                DFHeaderPos   HDR_LEFT
   614    //                DFHeaderFrame HDR_MARGINs 0.01 RGB_DGREY RGB_GREY
   615    
   616    //                DFWritePos    "Grand Total:"  12        (FONT_BOLD+RGB_DBLUE+FONT_RIGHT)
   617    //                DFWritelnPos   nTotal         14.1      (FONT_BOLD+FONT_RIGHT) 2
   618    
   619    //            DFEndHeader                     //End and print header
   620    
   621    //        End_Procedure
   622    
   623    //        Procedure Page_Bottom
   624    //            DateTime dtDT
   625    //            Move (CurrentDateTime()) to dtDT
   626    
   627    //            DFFont "Arial"
   628    //            DFFontSize 8
   629    //            DFBeginHeader DFPageBottom
   630    //                DFHeaderPos   HDR_CENTER
   631    //                DFHeaderFrame HDR_MARGINS 0.01 rgb_dGrey
   632    //                DFWriteLn   ("Report Printed on: " +string(dtDT)) (rgb_dBlue)
   633    //            DFEndHeader
   634    
   635    //        End_Procedure
   636    
   637    //    End_Object // customer main report
   638    
   639End_Object    // oOrdersByCustomerWP
   640