1Use DFAllRpt.pkg 2Use Basic\CustBasicRptImages.inc // contains the images for the report 3 4Open Customer 5Use dfrptvw.pkg 6Use dfRadio.pkg 7Use Windows.pkg 8 9DEFERRED_VIEW Activate_oCustomerListBR FOR ; 10; 11Object oCustomerListBR is a ReportView 12 13 Property Integer piSortIndex Public 1 14 15 Set Label to "Customer List" 16 Set Location to 6 6 17 Set Size to 80 180 18 19 Object oDestination is a RadioGroup 20 Set Size to 50 80 21 Set Location to 5 5 22 Set Label to "Output Device:" 23 Object oScreen is a Radio 24 Set Label to "Screen" 25 Set Size to 10 39 26 Set Location to 15 10 27 Set Status_Help to "Preview the report to screen" 28 End_Object // oScreen 29 30 Object oPrinter is a Radio 31 Set Label to "Printer" 32 Set Size to 10 37 33 Set Location to 30 10 34 Set Status_Help to "Send the report to the default printer" 35 End_Object // oPrinter 36 37 // set the Output_Device_Mode each time the radio button changes 38 Procedure Notify_Select_State Integer iNewItem Integer iOldItem 39 Forward Send Notify_Select_State iNewItem iOldItem 40 41 If (iNewItem=0) Set Output_Device_Mode To PRINT_TO_WINDOW 42 Else Set Output_Device_Mode To PRINT_TO_PRINTER 43 End_Procedure 44 45 End_Object // oDestination 46 47 Object oOrderRadio is a RadioGroup 48 Set Size to 50 80 49 Set Location to 5 95 50 Set Label to "Report Order:" 51 Object oNumber is a Radio 52 Set Label to "Number" 53 Set Size to 10 41 54 Set Location to 15 10 55 Set Status_Help to "Sort by customer number" 56 End_Object // oNumber 57 58 Object oName is a Radio 59 Set Label to "Name" 60 Set Size to 10 35 61 Set Location to 30 10 62 Set Status_Help to "Sort by customer name" 63 End_Object // oName 64 65 // set the piSortIndex each time the radio button changes 66 Procedure Notify_Select_State Integer iNewItem Integer iOldItem 67 Forward Send Notify_Select_State iNewItem iOldItem 68 69 Set piSortIndex To (iNewItem + 1) 70 End_Procedure 71 72 End_Object // oOrderRadio 73 74 Object oOkButton is a Button 75 Set Label to "OK" 76 Set Size to 14 51 77 Set Location to 62 71 78 Set Default_State to True 79 80 Procedure OnClick 81 Send StartReport 82 End_Procedure 83 84 End_Object // oOkButton 85 86 Object oCancelButton is a Button 87 Set Label to "Cancel" 88 Set Location to 62 125 89 90 Procedure OnClick 91 Send Request_Cancel 92 End_Procedure 93 94 End_Object // oCancelButton 95 96 Procedure StartReport 97 Integer iOutputDevice 98 Handle hoThisWorkspace 99 String sCurDir sDataPath 100 String sFileName 101 102 Get Output_Device_Mode to iOutputDevice 103 104 If (iOutputDevice=PRINT_TO_WINDOW) Begin 105 // save current location 106 Get_Current_Directory to sCurDir 107 108 // get workspace data path (all users must have r/w rights to it) to output the temp file there 109 Get phoWorkspace of ghoApplication to hoThisWorkspace 110 Get psDataPath of hoThisWorkspace to sDataPath 111 Get PathAtIndex of hoThisWorkspace sDataPath 1 to sDataPath 112 113 // set current directory to DataPath 114 Set_Directory sDataPath 115 116 Make_Temp_File "TXT" sFileName 117 Move (".\" - sFileName) to sFileName 118 Set Output_Device_Name to sFileName 119 End 120 Else Begin 121 Set Output_Device_Name to "WinLST:" 122 End 123 124 Send Run_Report 125 126 If (iOutputDevice=PRINT_TO_WINDOW) Begin 127 Runprogram background "NotePad" sFileName 128 EraseFile sFileName 129 End 130 131 // restore previous location 132 Set_Directory sCurDir 133 134 End_Procedure // StartReport 135 136 Object oCustomer_BasicReport is a BasicReport 137 138 Report_Main_File Customer 139 140 Set Report_Title to "Printing Customer Names" 141 142 Function Starting_Main_Report Returns Integer 143 Integer iRetVal 144 Integer iIndex 145 146 Forward Get Starting_Main_Report to iRetVal 147 148 Get piSortIndex To iIndex 149 Report_Index BY iIndex // set the sort order 150 Sysdate Footer.1 // set date for report 151 152 Function_Return iRetVal 153 End_Function 154 155 Procedure_Section Page_Top as CustHdr 156 Integer iPage 157 Get Page_Count To iPage 158 Print iPage 159 OutPut_PageCheck 160 End_Procedure 161 162 Procedure_Section Body as CustBody 163 Send Update_Status (String(Customer.Customer_Number)- ":" * Customer.Name ) 164 Print Customer.Customer_number 165 Print Customer.Name 166 OutPut_PageCheck 167 End_Procedure 168 169 Procedure_Section Page_Bottom as Footer 170 OutPut_PageCheck 171 End_Procedure 172 173 End_Object // Customer_BasicReport 174 175CD_End_Object // oCustomerListBR