Use dfrptvw.pkg Use DataDict.pkg Use dfRadio.pkg Use Windows.pkg Use cWinReport2.pkg Use VENDOR.DD Use INVT.DD Use CUSTOMER.DD Use SALESP.DD Use ORDERHEA.DD Use ORDERDTL.DD ACTIVATE_VIEW Activate_oItemsPerOrderWP FOR oItemsPerOrderWP Object oItemsPerOrderWP is a ReportView Set Label to "Items per Order" Set Location to 6 6 Set Size to 84 140 Object Vendor_DD is a Vendor_DataDictionary End_Object // Vendor_DD Object Invt_DD is a Invt_DataDictionary Set DDO_Server to Vendor_DD End_Object // Invt_DD Object Customer_DD is a Customer_DataDictionary End_Object // Customer_DD Object SalesP_DD is a Salesp_DataDictionary End_Object // SalesP_DD Object Orderhea_DD is a Orderhea_DataDictionary Set DDO_Server to Customer_DD Set DDO_Server to SalesP_DD End_Object // Orderhea_DD Object Orderdtl_DD is a Orderdtl_DataDictionary Set DDO_Server to Orderhea_DD Set DDO_Server to Invt_DD End_Object // Orderdtl_DD Object oPrintTo is a RadioGroup Set Size to 38 131 Set Location to 5 5 Set Label to "Print to" Object oRadio1 is a Radio Set Label to "Preview" Set Size to 10 42 Set Location to 12 6 Set Status_Help to "Prints the report to screen" End_Object // oRadio1 Object oRadio2 is a Radio Set Label to "Printer" Set Size to 10 42 Set Location to 24 6 Set Status_Help to "Prints the report to printer" End_Object // oRadio2 End_Object // oPrintTo Object oBtnPrint is a Button Set Label to "Print" Set Location to 48 85 Set Status_Help to "Print the Selected report" Set Default_State to True Procedure OnClick Send StartReport End_Procedure End_Object // oBtnPrint Object oBtnCancel is a Button Set Label to "Cancel" Set Location to 66 85 Set Status_Help to "Close this Panel" Procedure OnClick Send Close_Panel End_Procedure End_Object // oBtnCancel Object oOrders is a cWinReport2 Set Report_Title to "Customer Report" //Main File for the report Set Server to Orderdtl_DD //Breaks and Index for the report Report_Breaks ORDERHEA.ORDER_NUMBER Set Ordering to 1 Function Starting_Main_Report Returns Integer Integer iRetVal Send DFSetMetrics WPM_CM Send DFSetmargins 1 1 1 1 Forward Get Starting_Main_Report To iRetVal If iRetVal Function_return iRetVal End_Function Procedure Page_Top DFFont "Arial" // Use Arial DFFontSize 8 DFBeginHeader DFPageTop DFHeaderPos HDR_RIGHT DFHeaderFrame HDR_NOFRAME DFWriteLn ("Page:" * "#pagecount#") DFEndHeader End_Procedure Procedure Page_Header DFFont "Arial" DFFontSize 14 DFBeginHeader DFPageHeader DFHeaderFrame HDR_MARGINs 0 RGB_DGREY RGB_DGREY DFHEADERPOS HDR_LEFT DFHeaderMargin HM_BottomOuter 0.08 DFWritelnPos "Orders by Order Number Report" 0.10 (FONT_BOLD+RGB_WHITE) DFEndHeader End_Procedure Procedure Page_Title DFFont "Arial" DFFontSize 8 DFBeginHeader DFPageTitle DFHeaderFrame HDR_MARGINs 0 RGB_GREY RGB_GREY DFHEADERPOS HDR_LEFT DFWritePos "Item Id" 0.1 (FONT_BOLD+RGB_DBLUE) -1 1.36 DFWritePos "Description" 4.00 (FONT_BOLD+RGB_DBLUE) -1 4.77 DFWritePos "Qty Ordered" 11.5 (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 1.87 DFWritePos "Price" 13.22 (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 1.22 DFWritePos "Extended Price" 16.0 (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 2.38 DFWriteln DFEndHeader End_Procedure Procedure SubHeader1 DFFont "Arial" // Use Arial DFFontSize 10 DFBeginHeader DFSubHeader 1 //Header of type DFSubHeader Send Update_Status ("Order:" * String(OrderHea.Order_number)) DFHeaderWrap HDR_WRAP DFHeaderLineCheck 5 //Check that the header + 5 lines fits on the page, if not wrap DFHeaderPos HDR_LEFT //Write data from left margin in the header DFHeaderFrame HDR_NoFrame //Set the box from margin to margin using size 0.05 DFWriteLnPos ("Order: "+string(Orderhea.ORDER_NUMBER)) 0.1 (FONT_BOLD) DFEndHeader //End and print header End_Procedure Procedure Body DFFont "Arial" // Use Arial DFFontSize 8 DFLineCheck 5 DFWritePos Invt.ITEM_ID 0.1 (FONT_DEFAULT) -1 2.28 DFWritePos Invt.DESCRIPTION 4.00 (FONT_DEFAULT) -1 4.77 DFWritePos Orderdtl.QTY_ORDERED 11.5 (FONT_DEFAULT+FONT_RIGHT) 0 1.87 DFWritePos Orderdtl.PRICE 13.22 (FONT_DEFAULT+FONT_RIGHT) 2 1.22 DFWritePos Orderdtl.EXTENDED_PRICE 16.0 (FONT_DEFAULT+FONT_RIGHT) 2 2.38 DFWriteln "" // Using SubTotal in WinPrint. Send Add_SubTotal 1 (Orderdtl.EXTENDED_PRICE) End_Procedure Procedure SubTotal1 Number nAmount Get SubTotal 1 to nAmount Send Add_SubTotal 2 nAmount // subtotal 2 is total DFFont "Arial" // Use Arial DFFontSize 8 DFBeginHeader DFSubTotal 1 DFHEADERPOS HDR_LEFT DFHEADERFRAME HDR_NOFRAME DFWritelnPos nAmount 16.0 (FONT_BOLD+FONT_RIGHT) 2 0 DFWriteLine DFGR_CURRLINE DFGR_CURRLINE DFGR_RB_MARGIN DFGR_HORI Rgb_dGrey DFEndHeader End_Procedure Procedure Total Number nTotal Get SubTotal 2 to nTotal DFFont "Arial" // Use Arial DFFontSize 8 DFBeginHeader DFTotal //Header of type DFTotal DFHeaderPos HDR_LEFT //Write data from left margin in the header DFHeaderFrame HDR_MARGINs 0 RGB_DGREY RGB_GREY //rgb_Cyan rgb_Cyan DFWritelnPos nTotal 16.0 (FONT_BOLD+FONT_RIGHT) 2 DFEndHeader //End and print header End_Procedure Procedure Page_Bottom DateTime dtDT Move (CurrentDateTime()) to dtDT DFFont "Arial" // Use Arial DFFontSize 8 DFBeginHeader DFPageBottom DFHeaderPos HDR_CENTER //Write data in center DFHeaderFrame HDR_MARGINS 0.01 rgb_dGrey DFWriteLn ("Report Printed on: " +string(dtDT)) (rgb_dBlue) DFEndHeader End_Procedure End_Object // oOrders // Procedures and functions used by the user interface //This function is called by the procedure StartReport Function Print_to_Screen_State Returns Integer Integer iRad Get Current_Radio of oPrintTo To iRad Function_Return (iRad=1) End_Function // Use this procedure to do print setup Procedure SetupReport Boolean bSetupOk Get DFPrintSetupDialog of (Report_Object_Id(Self)) to bSetupOk End_Procedure // Use this procedure to start the report Procedure StartReport Integer iToPrinter iRepObj String sVal Get Report_Object_Id To iRepObj Get Print_to_Screen_State to iToPrinter If iToPrinter Set OutPut_Device_Mode to PRINT_TO_PRINTER Else Set OutPut_Device_Mode to PRINT_TO_WINDOW Send Run_Report to iRepObj End_Procedure End_Object // oItemsPerOrderWP