Use dfrptvw.pkg Use DataDict.pkg Use dfRadio.pkg Use Windows.pkg Use cWinReport2.pkg Use CUSTOMER.DD ACTIVATE_VIEW Activate_oCustomerListWP FOR oCustomerListWP Object oCustomerListWP is a ReportView Property Boolean pbComments False Set Label to "Customer List" Set Location to 6 6 Set Size to 115 185 Object Customer_DD is a Customer_DataDictionary Send DefineAllExtendedFields End_Object // Customer_DD Set Main_DD to Customer_DD Set Server to Customer_DD Object oPrintTo is a RadioGroup Set Size to 50 80 Set Location to 5 5 Set Label to "Send Report to" Object oScreenRadio is a Radio Set Label to "Report Viewer" Set Size to 10 61 Set Location to 15 10 Set Status_Help to "Preview the report to screen" End_Object // oScreenRadio Object oPrinterRadio is a Radio Set Label to "Printer" Set Size to 10 37 Set Location to 30 10 Set Status_Help to "Send the report to the default printer" End_Object // oPrinterRadio Function IsToPrinter Returns boolean integer iRadio Get Current_radio to iRadio Function_return (iRadio=1) End_Function // IsToPrinter End_Object // oPrintTo Object oOrder is a RadioGroup Set Size to 50 80 Set Location to 5 95 Set Label to "Report Order" Object oNumberRadio is a Radio Set Label to "Number" Set Size to 10 41 Set Location to 15 10 Set Status_Help to "Sort by customer number" End_Object // oNumberRadio Object oNameRadio is a Radio Set Label to "Name" Set Size to 10 35 Set Location to 30 10 Set Status_Help to "Sort by customer name" End_Object // oNameRadio Function IsSortedByNumber Returns boolean integer iRadio Get Current_radio to iRadio Function_return (iRadio=1) End_Function // IsSortedByNumber End_Object // oOrder Object oCommentsCkBx is a CheckBox Set Label to "Print Comments" Set Size to 10 65 Set Location to 59 95 End_Object // oCommentsCkBx Object oBtnPrint is a Button Set Label to "Print" Set Location to 76 7 Procedure OnClick Send StartReport End_Procedure End_Object // oBtnPrint Object oBtnCancel is a Button Set Label to "Cancel" Set Location to 76 65 Procedure OnClick Send Close_Panel End_Procedure End_Object // oBtnCancel Object oBtnPrinterSetup is a Button Set Label to "Printer Setup" Set Location to 76 123 Procedure OnClick Send DFPrintSetup of oReport End_Procedure End_Object // oBtnPrinterSetup Object oReport is a cWinReport2 Set Report_Title to "Customer List" // Set DDO, Index and breaks for the report Set Server to Customer_DD Set Ordering to 1 // Report_Breaks file.field // no breaks in this report Property Boolean pbLandscape false Function Starting_Main_Report Returns Integer Integer iIndex Boolean bOn bErr Send DFSetMetrics wpm_cm Send DFSetmargins 1 1 1 1 Get pbComments to bOn Send DFSetLandscape (if(bOn,True,false)) // This can be used to force a page orientation Get DFGetLandscape to bOn Set pbLandscape to bOn Forward Get Starting_Main_Report To bErr Function_return bErr End_Function // Page_Top is printed first at the top margin of each page Procedure Page_Top string sFont integer iFontSize iStyle Move "arial" to sFont Move 8 to iFontSize Move (Font_Default) to iStyle DFFont sFont DFFontSize iFontSize DFBeginHeader DFPageTop DFHeaderFrame Hdr_NoFrame DFHeaderPos Hdr_Left DFWriteLn ("Page:" * "#pagecount#") iStyle DFEndHeader End_Procedure Procedure Page_Header integer iFill iBorder iStyle string sFont sReportTitle integer iFontSize Move "arial" to sFont Move 16 to iFontSize Move (Font_bold + rgb_White) to iStyle Move (rgb_dGrey) to iFill Move (rgb_dGrey) to iBorder Get Report_Title to sReportTitle DFFont sFont DFFontSize iFontSize DFBeginHeader DFPageHeader DFHeaderPos Hdr_Left DFHeaderFrame Hdr_Margins 0.01 iBorder iFill DFWritelnPos sReportTitle 0.1 iStyle DFHeaderMargin HM_BottomOuter 0.08 DFEndHeader End_Procedure // Page_Header Procedure Page_Title string sFont integer iFontSize iHeaderStyle iFill iBorder Boolean bOn Get pbLandscape to bOn Move "arial" to sFont Move 8 to iFontSize Move (Font_Bold + rgb_dBlue) to iHeaderStyle Move (rgb_Grey) to iFill Move (rgb_Grey) to iBorder DFFont sFont DFFontSize iFontSize DFBeginHeader DFPageTitle DFHeaderPos Hdr_Left DFHeaderFrame Hdr_Margins 0 iBorder iFill DfHeaderMargin HM_TopInner 0.01 DfHeaderMargin HM_BottomInner 0.01 DFHeaderMargin HM_BottomOuter 0.16 DfWritePos "Number" 0.1 (iHeaderStyle) DfWritePos "Customer Name" 2 (iHeaderStyle) DfWritePos "Address" 7 (iHeaderStyle) DfWritePos "City" 12 (iHeaderStyle) DfWritePos "St." 15 (iHeaderStyle) DfWritePos "Zip" 17 (iHeaderStyle) If bOn begin DfWritePos "Comments" 19 (iHeaderStyle) end DfWriteln DFEndHeader End_Procedure // Page_Title Procedure Body string sFont integer iFontSize iStyle Boolean bOn Send Update_Status (String(Customer.Customer_number)) Get pbLandscape to bOn Move "arial" to sFont Move 8 to iFontSize Move (font_default) to iStyle DFFont sFont DFFontSize iFontSize DFLineCheck 5 DfWritePos Customer.Customer_Number 0.8 (iStyle + Font_Right) 0 DfWritePos Customer.Name 2 iStyle -1 4.98 DfWritePos Customer.Address 7 iStyle -1 4.98 DfWritePos Customer.City 12 iStyle -1 3.98 DfWritePos Customer.State 15 iStyle -1 0.98 DfWritePos Customer.Zip 17 iStyle -1 1.98 If bOn begin DfWritePos Customer.Comments 19 iStyle -1 0 dfWriteln end dfWriteln End_Procedure // Body // Page_Bottom is printed last at the bottom margin of each page Procedure Page_Bottom string sFont integer iFontSize iBorder iStyle iFill DateTime dtDT Move (CurrentDateTime()) to dtDT Move "arial" to sFont Move 8 to iFontSize Move (font_default) to iStyle Move (rgb_dGrey) to iBorder Move (rgb_White) to iFill DFFont sFont DFFontSize iFontSize DFBeginHeader DFPageBottom DFHeaderFrame Hdr_Margins 0 iBorder iFill DFHeaderPos Hdr_Center // Write data in center DFWriteln ("Report Printed on" * string(dtDT)) (iStyle) DFEndHeader End_Procedure // Page_Bottom End_Object // oReport Procedure StartReport Boolean bToPrinter bComments bSortByNumber // determine if direct print Get IsToPrinter of oPrintTo to bToPrinter Set OutPut_Device_Mode of oReport to (If(bToPrinter, PRINT_TO_PRINTER, PRINT_TO_WINDOW)) // determine if sort order is by number or name Get IsSortedByNumber of oOrder to bSortByNumber Set Ordering of oReport to (if(bSortByNumber, 2, 1)) Get Checked_State of oCommentsCkBx to bComments Set pbComments to bComments // run the report Send Run_Report of oReport End_Procedure // StartReport End_Object // oCustomerListWP