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_oOrdersWP FOR oOrdersWP Object oOrdersWP is a ReportView Set Label to "Orders by Order Number" Set Location to 6 6 Set Size to 46 175 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 105 Set Location to 4 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 10 120 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 28 120 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 Report_Index By 1 Function Starting_Main_Report Returns Integer Integer iRetVal Set PrintDlgInPreview of WinprintId to True Send DFSetMetrics To WinPrintId "CM" Send DFSetmargins To WinPrintId 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_Title DFFont "Arial" DFFontSize 14 DFBeginHeader DFPageTitle DFHeaderFrame HDR_MARGINs 0 RGB_DGREY RGB_DGREY DFHEADERPOS HDR_LEFT DFWritelnPos "Orders by Order Number Report" 0.10 (FONT_BOLD+RGB_WHITE) DFEndHeader End_Procedure Procedure SubHeader1 DFFont "Arial" // Use Arial DFFontSize 8 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 DFHeaderMargin hm_BottomOuter 0.04 DFWritePos "Order Number" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Orderhea.ORDER_NUMBER 4.0 (FONT_DEFAULT) DFWritePos "Order Date" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Orderhea.ORDER_DATE 4.0 (FONT_DEFAULT) DFWritePos "Customer Number" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Customer.CUSTOMER_NUMBER 4.0 DFWritePos "Name" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Customer.NAME 4.0 (FONT_DEFAULT) DFWritePos "Address" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Customer.ADDRESS 4.0 (FONT_DEFAULT) DFWritePos "City" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Customer.CITY 4.0 (FONT_DEFAULT) DFWritePos "State" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Customer.STATE 4.0 (FONT_DEFAULT) DFWritePos "Zip" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Customer.ZIP 4.0 (FONT_DEFAULT) DFWritePos "Terms" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Orderhea.TERMS 4.0 (FONT_DEFAULT) DFWritePos "Ship Via" 0.10 (FONT_BOLD+RGB_DBLUE) DFWritelnPos Orderhea.SHIP_VIA 4.0 (FONT_DEFAULT) DFFontSize 2 DFWriteLn DFFontSize 8 DfWriteRect DFGR_CURRLINE 0 0.34 DFGR_RB_MARGIN RGB_GREY 0.0 dfgr_noWrap RGB_GREY 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.40 DFWriteln 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.40 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_margins 0.01 rgb_grey rgb_Grey dfHeaderMargin hm_bottomOuter 0.10 dfHeaderMargin hm_bottomInner 0.01 dfHeaderMargin hm_TopInner 0.01 DFWritelnPos nAmount 16.0 (Font_BOLD+FONT_RIGHT) 2 0 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 // oOrdersWP