// Rpt_w3.rpt (Include File) // // Report Objects to be added to report Views // // oRpt_W3a // Interface: Send Run_Report runs the report // // oRpt_W3b // Interface: Send Run_Report runs the report // Set CustId_State to T|F Run in ID (T) or Name(F) order // Object oRpt_W3a is a VPE_WinReport Report_Main_File OrderHea Report_Index BY OrderHea.Order_Number Set Report_Title to "Printing Orders" Property Integer pRecs Public 0 // This controls the alternating grey bar. Procedure_Section Page_Top Set pRecs to 0 // Reset so that the first line of the page will be white. DFFont "Arial" //Use Arial size 16 DFFontSize 16 DFBeginHeader DFPageTop //Header of type DFPageTop DFHeaderPos HDR_LEFT //Write data from left DFHeaderFrame HDR_MARGINS //Write frame margin to margin //Write and Writeln data to positions DFWritelnPos "Orders Listed by Order Number" 3.5 (FONT_BOLD) DFFontSize 14 DFWritePos "Order Num" 0.5 (FONT_ITALIC) DFWritePos "Customer" 3 (FONT_ITALIC) // The text will be centerd from this position DFWritePos "Order Date" 11 (FONT_ITALIC+FONT_CENTER) //Right jystify to same position as numeric value DFWritelnPos "Amount" 14.5 (FONT_ITALIC+FONT_RIGHT) //End and print header DFEndHeader End_Procedure Procedure_Section Body Local Integer iRecs Send Update_Status ("Order #" * String(OrderHea.Order_Number)) DFFont "Times New Roman" //Font and size DFFontSize 12 // Grey bar. Get pRecs to iRecs If (Mod(iRecs,2) = 1) Begin // DFWriteRectRel 0.1 0 0.4 DFGR_RB_MARGIN RGB_GREY 0.01 DFGR_NOWRAP RGB_GREY DFGR_NOPOS DFWriteRectRel -0.08 0 0.5 DFGR_RB_MARGIN RGB_GREY 0.01 DFGR_NOWRAP RGB_GREY DFGR_NOPOS // DFWriteRectRel -0.03 0 0.20 DFGR_RB_MARGIN RGB_GREY 0.01 DFGR_NOWRAP RGB_GREY DFGR_NOPOS End Set pRecs to (iRecs + 1) //Write and Writeln data to positions DFWritePos OrderHea.Order_Number 0.5 (FONT_ITALIC) DFWritePos Customer.Number 3 (FONT_ITALIC) DFWritePos Customer.Name 4 (FONT_ITALIC) // The text will be centerd from this position DFWritePos OrderHea.Order_Date 11 (FONT_ITALIC+FONT_CENTER) //Here i tell WinPrint to use 2 decimals //The give position is the right pos of the data DFWritePos Orderhea.Order_Total 14.5 (FONT_ITALIC) 2 // Checkbox at position 15. DFWriteRectRel 0.1 15.0 0.3 0.3 RGB_BLACK 0.01 DFGR_NOWRAP RGB_WHITE DFGR_NOPOS DFWriteLn "" // // Grey bar. // DFWriteRectRel 0.1 0 0.4 DFGR_RB_MARGIN RGB_GREY 0.01 DFGR_NOWRAP RGB_GREY DFGR_NOPOS // DFWriteln "" //Using total procedure in DFReport. Add the value to //Counter number 1 Send Add_SubTotal 1 Orderhea.Order_Total End_Procedure Procedure_Section Total Local Number nTotal DFWriteln "" DFBeginHeader DFTotal //Header of type DFTotal DFHeaderPos HDR_LEFT //Write data from left DFHeaderFrame HDR_MARGINS //Write frame margin to margin DFWritePos "Total:" 11 (FONT_BOLD) //Here i tell WinPrint to use 2 decimals //The give position is the right of the data // Print the value of SubTotal 1 Get SubTotal 1 to nTotal DFWritelnPos nTotal 14.5 (FONT_BOLD) 2 DFEndHeader End_Procedure Procedure_Section Page_Bottom DFFont "Arial" DFFontSize 10 DFBeginHeader DFPageBottom //Header of type DFPageBottom DFHeaderPos HDR_CENTER //Write data in center DFHeaderFrame HDR_MARGINS //Frame margin to margin DFWrite "WinRpt3a Sample: Printed on: " (FONT_ITALIC) DFWriteln (RptToday(Current_Object)) (FONT_ITALIC) DFEndHeader End_Procedure END_OBJECT //Report a OBJECT oRpt_W3b is a VPE_WinReport Property Integer CustId_State Set Report_Title to "Printing Orders" Report_Main_File Customer Function Starting_Main_Report Returns Integer Local Integer IdxId Local Integer iRetVal Forward Get Starting_Main_Report to iRetval // we must remember to forward this Get CustId_State To IdxId If IdxId Report_Index BY Customer.Number // customer id Else Report_Index BY Customer.Name // customer name End_Function Procedure_Section Page_Top DFFont "Arial" DFFontSize 16 DFBeginHeader DFPageTop DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFWritelnPos "Orders Listed by Customer" 4 (FONT_BOLD) DFFontSize 14 DFWritePos "Cst Id" 0.5 (FONT_ITALIC) DFWritePos "Name" 2 (FONT_ITALIC) DFWritePos "Order Num." 5 (FONT_ITALIC) // The text will be centerd from this position DFWritePos "Date" 9.5 (FONT_ITALIC+FONT_CENTER) //Right justify to same position as numeric value DFWritelnPos "Amount" 14.5 (FONT_ITALIC+FONT_RIGHT) DFEndHeader End_Procedure // Nested Inner Report // Find all Orders for the Current Customer Object Cust_Ordr is a VPE_WinReport Report_Main_file OrderHea Report_Breaks OrderHea.Customer_Number // note that no index or constraints are specified here. These // are figured out automatically Procedure_Section SubHeader1 DFFont "Arial" DFFontSize 12 DFBeginHeader DFSubHeader 1 //Header of type DFSeubHeader //Argument 1=SubHeader1 DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFWritePos Customer.Number 0.5 (FONT_BOLD) DFWritelnPos Customer.Name 2 (FONT_BOLD) DFEndHeader End_Procedure Procedure_Section Body Send Update_Status (Customer.Name - ":" * String(OrderHea.Order_Number)) DFFont "Times New Roman" DFFontSize 12 // Grey rectangle DFWritePos OrderHea.Order_Number 5 (FONT_ITALIC) // The text will be centerd from this position DFWritePos OrderHea.Order_Date 9.5 (FONT_ITALIC+FONT_CENTER) //Use 2 decimals DFWritePos Orderhea.Order_Total 14.5 (FONT_ITALIC) 2 // Checkbox DFWriteRectRel 0.1 15.0 0.3 0.3 RGB_BLACK 0.01 DFGR_NOWRAP RGB_WHITE DFGR_NOPOS DFWriteln "" // Grey bar. DFWriteRectRel 0.1 0 0.4 DFGR_RB_MARGIN RGB_GREY 0.01 DFGR_NOWRAP RGB_GREY DFGR_NOPOS DFWriteln "" //Using total procedure in DFReport. Add the value to //Counter number 1 and 2 (of 10). Send Add_SubTotal 1 Orderhea.Order_Total Send Add_SubTotal 2 Orderhea.Order_Total End_Procedure Procedure_Section SubTotal1 DFFont "Arial" DFFontSize 12 DFWriteln "" DFBeginHeader DFSubTotal 1 //Header of type DFSubTotal //Argument 1=SubTotal1 DFHeaderWrap HDR_NOWRAP //Donīt wrap/repaint on new page DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFWritePos "SubTotal" 10.5 (FONT_BOLD) //Use 2 decimals //Using the total 2 in DFReport. Use the right one //Total is a nested report! DFWritelnPos (Sum_SubTotal(Current_Object,2)) 14.5 (FONT_BOLD) 2 DFEndHeader DFWriteln "" End_Procedure End_Object // end nested report Procedure_Section Total Local Number nTotal DFWriteln "" DFBeginHeader DFTotal //Header of type DFTotal DFHeaderPos HDR_LEFT DFHeaderFrame HDR_MARGINS DFWritePos "Total:" 10.5 (FONT_BOLD) //Using total 1 in DF_PRINT Get SubTotal 1 to nTotal DFWritelnPos nTotal 14.5 (FONT_BOLD) 2 DFEndHeader End_Procedure Procedure_Section Page_Bottom Local Date dDate Sysdate dDate DFFont "Arial" DFFontSize 10 DFBeginHeader DFPageBottom //Header of type DFPageBottom DFHeaderPos HDR_CENTER DFHeaderFrame HDR_MARGINS DFWrite "WinRpt3b Sample: Printed on: " (FONT_ITALIC) //Using the date property in DFReport DFWriteln (RptToday(Current_Object)) (FONT_ITALIC) DFEndHeader End_Procedure END_OBJECT //Report b