Use DFAllRpt Use VWinRpt // For conversion to VPE Open Customer Open OrderHea Open OrderDtl Open Invt DEFERRED_VIEW Activate_oWinReport5 FOR ; ; OBJECT oWinReport5 IS A ReportView Set Label to "WinPrint (WinReport) Sample Order Report5" Set Size to 138 232 Object OrderRadio is a RadioGroup Set Label to "Output Order" Set Size to 77 129 Set Location to 7 5 Set Status_Help to "Choose order to print report" Object R1 is a Radio Set Label to "Order Number" Set Location to 10 10 End_Object // R1 Object R2 is a Radio Set Label to "Order Date" Set Location to 26 10 End_Object // R2 Object R3 is a Radio Set Label to "Customer Id x Order" Set Location to 44 10 End_Object // R3 Object R4 is a Radio Set Label to "Customer Name x Order" Set Location to 61 10 End_Object // R4 End_Object // OrderRadio Object PageBreaks is a CheckBox Set Label to "Page Break" Set Location to 12 145 Set Status_Help to "Break between order or between customers." End_Object // PageBreak Object FindDown is a CheckBox Set Label to "Descending Order" Set Location to 27 145 Set Status_Help to "Print report in Descending (reversed) Index order." End_Object // FindDown Object PrintTo is a CheckBox On_Item 'Print to Screen' Send NONE Set Label to "Print to Screen" Set Status_Help to "Determine if Report is Printed to Printer or Window" Set Location to 42 145 Set Checked_State to True End_Object // PrintTo Object PrintSetUpBn is a Button Set Label to "Printer Setup" Set Location to 94 5 Set Status_Help to "Select and set up Printer and Paper" Procedure OnClick Send SetupReport End_Procedure End_Object // PrintSetUpBn Object ReportBn is a Button Set Label to "Report" Set Location to 94 60 Set Status_Help to "Print the Selected report" Procedure OnClick Send StartReport End_Procedure End_Object // ReportBn Object CancelBn is a Button Set Label to "Cancel" Set Location to 94 115 Set Status_Help to "Close this Panel" Procedure OnClick Send Request_Cancel End_procedure End_Object // CancelBn Object Cust_Order_Listing is a VPE_WinReport // Changed from WinReport for VPE. Set Report_Title to "Printing Customer Orders" Property Integer Break_Cust_State public False Report_Main_File Customer Report_Breaks Customer.Number Procedure_Section Page_Top DFFont "Arial" //Using font Arial DFFontSize 14 //Set fontsize to 14 //The last used font and size will //be used if you dont change it //Before we where using images. Now we use DFBeginHeader and //DFEndHeader to define an image. DFBeginHeader DFPageTop //A Header of type DFPageTop DFHeaderPos HDR_LEFT //Set all items in the header to //left justify DFHeaderFrame HDR_MARGINS // Set frame to MarginToMargin // Writeln in header to position 6 using bold. In this case 6 cm // Default for metrics is cm but you can change it to inch DFWritelnPos "Orders Listing" 6 (FONT_BOLD) DFFontSize 12 DFWritePos "Page:" 11.5 (FONT_ITALIC) //This is how to do page counting in WinPrint // #pagecount# MUST be in small letters DFWritelnPos "#pagecount#" 13 (FONT_ITALIC) DFEndHeader End_Procedure Procedure_Section SubHeader1 DFFont "Arial" DFFontSize 12 DFBeginHeader DFSubHeader 1 //A header of type DFSubHeader. //1=SubHeader 1 DFHeaderWrap HDR_NOWRAP //Donīt wrap/reprint on page break DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFHeaderLineCheck 8 //Check that the header + 8 lines //fits on the page. Using last //font and size DFWritePos Customer.Number 0.5 (FONT_ITALIC+FONT_BOLD) DFWritelnPos Customer.Name 2 (FONT_ITALIC+FONT_BOLD) DFEndHeader End_Procedure // // report Class: Order_Listing // Print customer orders. This can be used as a main outer report // (Order_listing--> Order_Dtl) or it can be used as an inner report // (Cust_order_Listing-->Order_Listing-->Order_Dtl). // Object Order_listing is a VPE_WinReport // Changed from WinReport for VPE. Report_Main_File OrderHea Report_Index by OrderHea.Customer_Number // // Report: Order_Dtl // Inner report for check Order Detail. // Object Order_Dtl is a VPE_WinReport // Changed from WinReport for VPE. Report_Main_File OrderDtl Report_Index BY OrderDtl.Order_Number Report_Breaks OrderHea.Order_Number Procedure_Section SubHeader1 Send Update_Status (Customer.Name - ":" * String(Orderhea.Order_Number)) DFFont "Arial" DFFontSize 12 DFBeginHeader DFSubHeader 5 //This is a very special thing in //nested reports. If you look in the //source you will se that itīs two //SubHeaders 1. If they are nested //they canīt have the same number. //use an unused number !!! DFHeaderWrap HDR_NOWRAP DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFHeaderLineCheck 5 //Check that the header + 5 lines //fits on the page. Using last //font and size DFWritePos "Order Number" 0.5 (FONT_ITALIC) DFWritePos OrderHea.Order_Number 3.5 (FONT_ITALIC) DFWritePos "Customer#" 6 (FONT_ITALIC) DFWritelnPos Customer.Number 9 (FONT_ITALIC) DFWritePos "Bill To" 0.5 (FONT_ITALIC) DFWritePos Customer.Name 2.5 (FONT_ITALIC) DFWritePos "Date" 8.5 (FONT_ITALIC) DFWritePos "Via" 10.5 (FONT_ITALIC) DFWritelnPos "Slsmn" 13.5 (FONT_ITALIC) DFWritePos Customer.Address 2.5 (FONT_ITALIC) DFWritePos OrderHea.Order_date 8.5 (FONT_ITALIC) DFWritePos Orderhea.Ship_Via 10.5 (FONT_ITALIC) DFWritelnPos Orderhea.Salesperson_ID 13.5 (FONT_ITALIC) DFWritePos Customer.City 2.5 (FONT_ITALIC) DFWritePos Customer.State 5.5 (FONT_ITALIC) DFWritelnPos Customer.Zip 6.5 (FONT_ITALIC) DFWriteln "" DFWritePos "Part Id" 0.5 (FONT_BOLD) DFWritePos "Description" 3.5 (FONT_BOLD) DFWritePos "Price" 9 (FONT_BOLD) DFWritePos "Qty" 11 (FONT_BOLD) DFWritelnPos "Amount" 13 (FONT_BOLD) DFEndHeader End_Procedure Procedure_Section Body DFFont "Times New Roman" DFFontSize 12 DFWritePos Orderdtl.Item_ID 0.5 (FONT_ITALIC) DFWritePos Invt.Description 3.5 (FONT_ITALIC) -1 4.8 DFWritePos (Orderdtl.Price / Orderdtl.Qty_Ordered) 10 (FONT_ITALIC) 2 DFWritePos Orderdtl.Qty_Ordered 11 (FONT_ITALIC) DFWritelnPos Orderdtl.Price 14.5 (FONT_ITALIC) 2 End_Procedure Procedure_Section SubTotal1 DFFont "Arial" DFFontSize 12 DFWriteln "" DFBeginHeader DFSubTotal 5 //Muste use this in nested reports and //Se SubHeader in same report. DFHeaderWrap HDR_NOWRAP DFHeaderPos HDR_LEFT DFHeaderFrame HDR_NOFRAME //Donīt print any frame DFWritelnPos Orderhea.Order_Total 14.5 (FONT_ITALIC+FONT_BOLD+FONT_UNDER) 2 DFEndHeader DFWriteln "" Send Add_SubTotal 1 Orderhea.Order_Total Send Add_SubTotal 2 Orderhea.Order_Total End_Procedure End_Object End_Object Procedure_Section SubTotal1 Local integer iBreak DFFont "Arial" DFFontSize 12 DFBeginHeader DFSubTotal 1 //A header of type DFSubTotal. DFHeaderWrap HDR_NOWRAP DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFWritePos Customer.Number 0.5 (FONT_ITALIC+FONT_BOLD) DFWritePos Customer.Name 2 (FONT_ITALIC+FONT_BOLD) //Print total at pos 14.4 italic+bold USING 2 decimals //If you send a param 0-?? it will be treated as a numeric //value printed with ?? digits to the right of the number //All numeric values will be right justify. DFWritelnPos (SubTotal(Current_Object,2)) 14.5 (FONT_ITALIC+FONT_BOLD) 2 DFEndHeader DFWriteln "" //*** If you have a report that donīt have any header or //*** footers you can remove the page break from the start //*** procedure and put it in the SubHeader section. //*** All headers needs a page to print to Get Break_Cust_State to iBreak If iBreak ; Send DFNew_Page // Page_Break on Cust/Name End_Procedure Procedure_Section Total DFFont "Arial" DFFontSize 12 DFWriteln "" DFBeginHeader DFTotal DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFWritelnPos (SubTotal(Current_Object,1)) 14.5 (FONT_ITALIC+FONT_BOLD) 2 DFEndHeader End_Procedure Procedure_Section Page_Bottom Local Date dDate Sysdate dDate DFFont "Arial" DFFontSize 10 DFBeginHeader DFPageBottom DFHeaderPos HDR_CENTER DFHeaderFrame HDR_MARGINS //If you use DFWrite and DFWriteln (not Pos or Col) the //text will be centert. DFWrite "WinRpt10 Sample: Printed on: " (FONT_ITALIC) DFWriteln (RptToday(Current_Object)) (FONT_ITALIC) DFEndHeader End_Procedure Procedure Run_Order_Report Integer OutputOrder ; Integer DownOrder ; Integer iBreak Set Break_Cust_State to iBreak If OutPutOrder eq 1 Report_Index by Customer.Number Else Report_Index by Customer.Name Set Find_Down_State to DownOrder Send Run_report End_Procedure End_Object // // report: Order_Listing // Print customer orders. This can be used as a main outer report // (Order_listing--> Order_Dtl) or it can be used as an inner report // (Cust_order_Listing-->Order_Listing-->Order_Dtl). // Object Order_listing is a VPE_WinReport // Changed from WinReport for VPE. Report_Main_File OrderHea Property Integer Break_Order_State public False Set Report_Title to "Printing Orders" Procedure_Section Page_Top DFFont "Arial" DFFontSize 14 DFBeginHeader DFPageTop DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFWritelnPos "Orders Listing" 6 (FONT_BOLD) DFFontSize 12 DFWritePos "Page:" 11.5 (FONT_ITALIC) DFWritelnPos "#pagecount#" 13 (FONT_ITALIC) DFEndHeader End_Procedure // // Report: Order_Dtl // Inner report for check Order Detail. // Object Order_Dtl is a VPE_WinReport // Changed from WinReport for VPE. Report_Main_File OrderDtl Report_Index BY OrderDtl.Order_Number Report_Breaks OrderHea.Order_Number Procedure_Section SubHeader1 Send Update_Status (Customer.Name - ":" * String(Orderhea.Order_Number)) DFFont "Arial" DFFontSize 12 DFBeginHeader DFSubHeader 5 //This is a very special thing in //nested reports. If you look in the //source you will se that itīs two //SubHeaders 1. If they are nested //they canīt have the same number. //use an unused number !!! DFHeaderWrap HDR_NOWRAP DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFHeaderLineCheck 5 //Check that the header + 5 lines //fits on the page. Using last //font and size DFWritePos "Order Number" 0.5 (FONT_ITALIC) DFWritePos OrderHea.Order_Number 3.5 (FONT_ITALIC) DFWritePos "Customer#" 6 (FONT_ITALIC) DFWritelnPos Customer.Number 9 (FONT_ITALIC) DFWritePos "Bill To" 0.5 (FONT_ITALIC) DFWritePos Customer.Name 2.5 (FONT_ITALIC) DFWritePos "Date" 8.5 (FONT_ITALIC) DFWritePos "Via" 10.5 (FONT_ITALIC) DFWritelnPos "Slsmn" 13.5 (FONT_ITALIC) DFWritePos Customer.Address 2.5 (FONT_ITALIC) DFWritePos OrderHea.Order_date 8.5 (FONT_ITALIC) DFWritePos Orderhea.Ship_Via 10.5 (FONT_ITALIC) DFWritelnPos Orderhea.Salesperson_ID 13.5 (FONT_ITALIC) DFWritePos Customer.City 2.5 (FONT_ITALIC) DFWritePos Customer.State 5.5 (FONT_ITALIC) DFWritelnPos Customer.Zip 6.5 (FONT_ITALIC) DFWriteln "" DFWritePos "Part Id" 0.5 (FONT_BOLD) DFWritePos "Description" 3.5 (FONT_BOLD) DFWritePos "Price" 9 (FONT_BOLD) DFWritePos "Qty" 11 (FONT_BOLD) DFWritelnPos "Amount" 13 (FONT_BOLD) DFEndHeader End_Procedure Procedure_Section Body DFFont "Times New Roman" DFFontSize 12 DFWritePos Orderdtl.Item_ID 0.5 (FONT_ITALIC) DFWritePos Invt.Description 3.5 (FONT_ITALIC) -1 4.8 DFWritePos (Orderdtl.Price / Orderdtl.Qty_Ordered) 10 (FONT_ITALIC) 2 DFWritePos Orderdtl.Qty_Ordered 11 (FONT_ITALIC) DFWritelnPos Orderdtl.Price 14.5 (FONT_ITALIC) 2 End_Procedure Procedure_Section SubTotal1 Local integer iBreak DFFont "Arial" DFFontSize 12 DFWriteln "" DFBeginHeader DFSubTotal 5 //Muste use this in nested reports and //Se SubHeader in same report. DFHeaderWrap HDR_NOWRAP DFHeaderPos HDR_LEFT DFHeaderFrame HDR_NOFRAME //Donīt print any frame DFWritelnPos Orderhea.Order_Total 14.5 (FONT_ITALIC+FONT_BOLD+FONT_UNDER) 2 DFEndHeader DFWriteln "" Send Add_SubTotal 1 Orderhea.Order_Total Send Add_SubTotal 2 Orderhea.Order_Total //*** If you have a report that donīt have any header or //*** footers you can remove the page break from the start //*** procedure and put it in the SubHeader section. //*** All headers needs a page to print to Get Break_Order_State to iBreak If iBreak ; Send DFNew_Page //Page_Break on Order/Date End_Procedure End_Object Procedure_Section Total DFFont "Arial" DFFontSize 12 DFWriteln "" DFBeginHeader DFTotal DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFWritelnPos (SubTotal(Current_Object,1)) 14.5 (FONT_ITALIC+FONT_BOLD) 2 DFEndHeader End_Procedure Procedure_Section Page_Bottom DFFont "Arial" DFFontSize 10 DFBeginHeader DFPageBottom DFHeaderPos HDR_CENTER DFHeaderFrame HDR_MARGINS DFWrite "WinRpt10 Sample: Printed on: " (FONT_ITALIC) DFWriteln (RptToday(Current_Object)) (FONT_ITALIC) DFEndHeader End_Procedure Procedure Run_Order_Report Integer OutputOrder ; Integer DownOrder ; integer iBreak Set Break_Order_State to iBreak If OutPutOrder eq 0 Report_Index by OrderHea.Order_Number Else Report_Index by OrderHea.Order_Date Set Find_Down_State to (DownOrder) Send Run_Report End_Procedure End_Object Procedure SetupReport send DFPrintSetup to (Report_Object_Id(Current_Object)) End_Procedure Function OutputOrder returns Integer // 0 - order id, 1 - date order, 2 -cust id, 3 - cust name Function_Return (Current_Radio(OrderRadio(Current_Object))) End_Function Function Print_to_Screen_State Returns Integer Function_Return ( Checked_State(PrintTo(Current_Object))) End_Function // ID_Order Function Print_Down_State returns integer Function_Return ( Checked_State(FindDown(Current_Object))) End_Function Function Page_Break_State returns integer Function_Return ( Checked_State(PageBreaks(Current_Object))) End_Function // Run the report // set indicators to tell the report object what we are doing and // then tell the report object to perform its magic. // Procedure StartReport Local Integer iDown iOrder iBreak ToScreen Get Print_to_Screen_State to ToScreen If ToScreen ; Set OutPut_Device_Mode to PRINT_TO_WINDOW Else ; Set OutPut_Device_Mode to PRINT_TO_PRINTER Get OutputOrder to iOrder Get Page_Break_State to iBreak Get Print_Down_State to iDown If (iOrder=1 OR iOrder=2) ; Send Run_Order_Report to (Cust_Order_Listing(Current_Object)) ; iOrder iDown iBreak Else ; Send Run_Order_Report to (Order_Listing(Current_Object)) ; iOrder iDown iBreak End_Procedure CD_end_object // End of view