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_oOrdersWP FOR oOrdersWP 14 15Object oOrdersWP is a ReportView 16 Set Label to "Orders by Order Number" 17 Set Location to 6 6 18 Set Size to 46 175 19 20 Object Vendor_DD is a Vendor_DataDictionary 21 Send DefineAllExtendedFields 22 End_Object // Vendor_DD 23 24 Object Invt_DD is a Invt_DataDictionary 25 Set DDO_Server to Vendor_DD 26 Send DefineAllExtendedFields 27 End_Object // Invt_DD 28 29 Object Customer_DD is a Customer_DataDictionary 30 Send DefineAllExtendedFields 31 End_Object // Customer_DD 32 33 Object SalesP_DD is a Salesp_DataDictionary 34 Send DefineAllExtendedFields 35 End_Object // SalesP_DD 36 37 Object Orderhea_DD is a Orderhea_DataDictionary 38 Set DDO_Server to Customer_DD 39 Set DDO_Server to SalesP_DD 40 Send DefineAllExtendedFields 41 End_Object // Orderhea_DD 42 43 Object Orderdtl_DD is a Orderdtl_DataDictionary 44 Set DDO_Server to Orderhea_DD 45 Set DDO_Server to Invt_DD 46 Send DefineAllExtendedFields 47 End_Object // Orderdtl_DD 48 49 Object oPrintTo is a RadioGroup 50 Set Size to 38 105 51 Set Location to 4 5 52 Set Label to "Print to" 53 Object oRadio1 is a Radio 54 Set Label to "Preview" 55 Set Size to 10 42 56 Set Location to 12 6 57 Set Status_Help to "Prints the report to screen" 58 End_Object // oRadio1 59 60 Object oRadio2 is a Radio 61 Set Label to "Printer" 62 Set Size to 10 42 63 Set Location to 24 6 64 Set Status_Help to "Prints the report to printer" 65 End_Object // oRadio2 66 67 End_Object // oPrintTo 68 69 Object oBtnPrint is a Button 70 Set Label to "Print" 71 Set Location to 10 120 72 Set Status_Help to "Print the Selected report" 73 Set Default_State to True 74 75 Procedure OnClick 76 Send StartReport 77 End_Procedure 78 79 End_Object // oBtnPrint 80 81 Object oBtnCancel is a Button 82 Set Label to "Cancel" 83 Set Location to 28 120 84 Set Status_Help to "Close this Panel" 85 86 Procedure OnClick 87 Send Close_Panel 88 End_Procedure 89 90 End_Object // oBtnCancel 91 92 Object oOrders is a cWinReport2 93 Set Report_Title to "Customer Report" 94 95 //Main File for the report 96 Set Server to Orderdtl_DD 97 98 //Breaks and Index for the report 99 Report_Breaks ORDERHEA.ORDER_NUMBER 100 Report_Index By 1 101 102 Function Starting_Main_Report Returns Integer 103 Integer iRetVal 104 Set PrintDlgInPreview of WinprintId to True 105 Send DFSetMetrics To WinPrintId "CM" 106 Send DFSetmargins To WinPrintId 1 1 1 1 107 Forward Get Starting_Main_Report To iRetVal 108 If iRetVal Function_return iRetVal 109 End_Function 110 111 Procedure Page_Top 112 DFFont "Arial" // Use Arial 113 DFFontSize 8 114 DFBeginHeader DFPageTop 115 DFHeaderPos HDR_RIGHT 116 DFHeaderFrame HDR_NOFRAME 117 DFWriteLn ("Page:" * "#pagecount#") 118 DFEndHeader 119 End_Procedure 120 121 Procedure Page_Title 122 DFFont "Arial" 123 DFFontSize 14 124 DFBeginHeader DFPageTitle 125 DFHeaderFrame HDR_MARGINs 0 RGB_DGREY RGB_DGREY 126 DFHEADERPOS HDR_LEFT 127 DFWritelnPos "Orders by Order Number Report" 0.10 (FONT_BOLD+RGB_WHITE) 128 DFEndHeader 129 End_Procedure 130 131 Procedure SubHeader1 132 133 DFFont "Arial" // Use Arial 134 DFFontSize 8 135 136 DFBeginHeader DFSubHeader 1 //Header of type DFSubHeader 137 138 Send Update_Status ("Order:" * String(OrderHea.Order_number)) 139 140 141 DFHeaderWrap HDR_WRAP 142 DFHeaderLineCheck 5 //Check that the header + 5 lines fits on the page, if not wrap 143 144 DFHeaderPos HDR_LEFT //Write data from left margin in the header 145 DFHeaderFrame HDR_NoFrame //Set the box from margin to margin using size 0.05 146 DFHeaderMargin hm_BottomOuter 0.04 147 148 DFWritePos "Order Number" 0.10 (FONT_BOLD+RGB_DBLUE) 149 DFWritelnPos Orderhea.ORDER_NUMBER 4.0 (FONT_DEFAULT) 150 DFWritePos "Order Date" 0.10 (FONT_BOLD+RGB_DBLUE) 151 DFWritelnPos Orderhea.ORDER_DATE 4.0 (FONT_DEFAULT) 152 DFWritePos "Customer Number" 0.10 (FONT_BOLD+RGB_DBLUE) 153 DFWritelnPos Customer.CUSTOMER_NUMBER 4.0 154 DFWritePos "Name" 0.10 (FONT_BOLD+RGB_DBLUE) 155 DFWritelnPos Customer.NAME 4.0 (FONT_DEFAULT) 156 DFWritePos "Address" 0.10 (FONT_BOLD+RGB_DBLUE) 157 DFWritelnPos Customer.ADDRESS 4.0 (FONT_DEFAULT) 158 DFWritePos "City" 0.10 (FONT_BOLD+RGB_DBLUE) 159 DFWritelnPos Customer.CITY 4.0 (FONT_DEFAULT) 160 DFWritePos "State" 0.10 (FONT_BOLD+RGB_DBLUE) 161 DFWritelnPos Customer.STATE 4.0 (FONT_DEFAULT) 162 DFWritePos "Zip" 0.10 (FONT_BOLD+RGB_DBLUE) 163 DFWritelnPos Customer.ZIP 4.0 (FONT_DEFAULT) 164 DFWritePos "Terms" 0.10 (FONT_BOLD+RGB_DBLUE) 165 DFWritelnPos Orderhea.TERMS 4.0 (FONT_DEFAULT) 166 DFWritePos "Ship Via" 0.10 (FONT_BOLD+RGB_DBLUE) 167 DFWritelnPos Orderhea.SHIP_VIA 4.0 (FONT_DEFAULT) 168 DFFontSize 2 169 DFWriteLn 170 171 DFFontSize 8 172 DfWriteRect DFGR_CURRLINE 0 0.34 DFGR_RB_MARGIN RGB_GREY 0.0 dfgr_noWrap RGB_GREY 173 DFWritePos "Item Id" 0.1 (FONT_BOLD+RGB_DBLUE) -1 1.36 174 DFWritePos "Description" 4.00 (FONT_BOLD+RGB_DBLUE) -1 4.77 175 DFWritePos "Qty Ordered" 11.5 (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 1.87 176 DFWritePos "Price" 13.22 (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 1.22 177 DFWritePos "Extended Price" 16.0 (FONT_BOLD+FONT_RIGHT+RGB_DBLUE) -1 2.40 178 DFWriteln 179 180 DFEndHeader //End and print header 181 182 End_Procedure 183 184 Procedure Body 185 186 DFFont "Arial" // Use Arial 187 DFFontSize 8 188 189 DFLineCheck 5 190 191 DFWritePos Invt.ITEM_ID 0.1 (FONT_DEFAULT) -1 2.28 192 DFWritePos Invt.DESCRIPTION 4.00 (FONT_DEFAULT) -1 4.77 193 DFWritePos Orderdtl.QTY_ORDERED 11.5 (FONT_DEFAULT+FONT_RIGHT) 0 1.87 194 DFWritePos Orderdtl.PRICE 13.22 (FONT_DEFAULT+FONT_RIGHT) 2 1.22 195 DFWritePos Orderdtl.EXTENDED_PRICE 16.0 (FONT_DEFAULT+FONT_RIGHT) 2 2.40 196 DFWriteln 197 198 // Using SubTotal in WinPrint. 199 Send Add_SubTotal 1 (Orderdtl.EXTENDED_PRICE) 200 201 End_Procedure 202 203 Procedure SubTotal1 204 Number nAmount 205 Get SubTotal 1 to nAmount 206 Send Add_SubTotal 2 nAmount // subtotal 2 is total 207 208 DFFont "Arial" // Use Arial 209 DFFontSize 8 210 DFBeginHeader DFSubTotal 1 211 212 DFHEADERPOS HDR_LEFT 213 DFHeaderFrame hdr_margins 0.01 rgb_grey rgb_Grey 214 dfHeaderMargin hm_bottomOuter 0.10 215 dfHeaderMargin hm_bottomInner 0.01 216 dfHeaderMargin hm_TopInner 0.01 217 218 DFWritelnPos nAmount 16.0 (Font_BOLD+FONT_RIGHT) 2 0 219 DFEndHeader 220 221 End_Procedure 222 223 Procedure Total 224 Number nTotal 225 Get SubTotal 2 to nTotal 226 227 DFFont "Arial" // Use Arial 228 DFFontSize 8 229 DFBeginHeader DFTotal //Header of type DFTotal 230 231 DFHeaderPos HDR_LEFT //Write data from left margin in the header 232 DFHeaderFrame HDR_MARGINs 0 RGB_DGREY RGB_GREY //rgb_Cyan rgb_Cyan 233 234 DFWritelnPos nTotal 16.0 (FONT_BOLD+FONT_RIGHT) 2 235 236 DFEndHeader //End and print header 237 238 End_Procedure 239 240 Procedure Page_Bottom 241 DateTime dtDT 242 Move (CurrentDateTime()) to dtDT 243 244 DFFont "Arial" // Use Arial 245 DFFontSize 8 246 DFBeginHeader DFPageBottom 247 DFHeaderPos HDR_CENTER //Write data in center 248 DFHeaderFrame HDR_MARGINS 0.01 rgb_dGrey 249 DFWriteLn ("Report Printed on: " +string(dtDT)) (rgb_dBlue) 250 DFEndHeader 251 252 End_Procedure 253 254 End_Object // oOrders 255 256 // Procedures and functions used by the user interface 257 258 //This function is called by the procedure StartReport 259 Function Print_to_Screen_State Returns Integer 260 Integer iRad 261 Get Current_Radio of oPrintTo To iRad 262 Function_Return (iRad=1) 263 End_Function 264 265 // Use this procedure to do print setup 266 Procedure SetupReport 267 Boolean bSetupOk 268 Get DFPrintSetupDialog of (Report_Object_Id(Self)) to bSetupOk 269 End_Procedure 270 271 // Use this procedure to start the report 272 Procedure StartReport 273 Integer iToPrinter iRepObj 274 String sVal 275 Get Report_Object_Id To iRepObj 276 277 Get Print_to_Screen_State to iToPrinter 278 If iToPrinter Set OutPut_Device_Mode to PRINT_TO_PRINTER 279 Else Set OutPut_Device_Mode to PRINT_TO_WINDOW 280 281 Send Run_Report to iRepObj 282 283 End_Procedure 284 285End_Object // oOrdersWP