//Orders Plain // Register all objects Register_Object OrdersPlain Register_Object oOrderdtlOrderNumberGroup Register_Object oFromOrderdtlOrderNumber Register_Object oToOrderdtlOrderNumber Register_Object oDestinationGroup Register_Object oScreenRadio Register_Object oPrinterRadio Register_Object oFileRadio Register_Object oPrintButton Register_Object oCancelButton Register_Object oCrystalOrdersPlain Use DFAllEnt.pkg Use cCrystal.pkg //Use cStatusPanel.pkg ACTIVATE_VIEW Activate_OrdersPlain FOR OrdersPlain Object OrdersPlain is a ReportView Set Label To "Orders Plain" Object oOrderdtlOrderNumberGroup is a Group Set Label to "Select Order Number" Set Location to 5 5 Object oFromOrderdtlOrderNumber is a Form Set Size to 13 42 Set Location to 10 66 Set Label_Justification_Mode To jMode_Right Set Label_Col_Offset to 2 Set Label_Row_Offset to 0 Set Label to "From:" Set Status_Help to "First value in selection range." Set Numeric_Mask 0 to 6 0 End_Object // FromOrderdtlOrderNumber Object oToOrderdtlOrderNumber is a Form Set Size to 13 42 Set Location to 25 66 Set Label_Justification_Mode to jMode_Right Set Label_Col_Offset to 2 Set Label_Row_Offset to 0 Set Label to "To:" Set Status_Help to "Last value in selection range." Set Numeric_Mask 0 to 6 0 End_Object // ToOrderdtlOrderNumber Set Size to 43 113 End_Object // OrderdtlOrderNumberGroup Object oDestinationGroup is a RadioGroup Set Label to "Output destination" Set Location to 53 5 Set Size to 46 77 Object oScreenRadio is a Radio Set Label to "Preview" Set Size to 10 60 Set Location to 10 6 Set Status_Help to "Print the report to screen" End_Object // oScreenRadio Object oPrinterRadio is a Radio Set Label to "Printer" Set Size to 10 60 Set Location to 22 6 Set Status_Help to "Prints the report to printer" End_Object // oPrinterRadio Object oFileRadio is a Radio Set Label to "Export" Set Size to 10 60 Set Location to 34 6 Set Status_Help to "Outputs the report to disk file, application or email" End_Object // oFileRadio // This function returns the output destination constant. Function PrintDestination Returns Integer Integer iCurrentRadio eDestination Get Current_Radio to iCurrentRadio If (iCurrentRadio=0) Move PRINT_TO_WINDOW to eDestination If (iCurrentRadio=1) Move PRINT_TO_PRINTER to eDestination If (iCurrentRadio=2) Move PRINT_TO_FILE to eDestination Function_Return eDestination End_Function // PrintDestination End_Object // oDestinationGroup Object oPrintButton is a Button Set Label to "Print" Set Size to 14 50 Set Location to 132 13 Set Status_Help to "Print the report" Set Default_State to True // This procedure outputs the report by sending RunReport. Procedure OnClick Integer i iLoop Get Value of oFormLoop to iLoop For i from 1 to iLoop Send RunReport of oCrystalOrdersPlain Set Value of oFormLoop to i Send PumpMsgQueue of Desktop Loop End_Procedure // OnClick End_Object // oPrintButton Object oCancelButton is a Button Set Label to "Cancel" Set Size to 14 50 Set Location to 132 68 Set Status_Help to "Cancel this Panel" // This procedure closes the view. Procedure OnClick Send Close_Panel End_Procedure // OnClick End_Object // oCancelButton Object oCrystalOrdersPlain is a cCrystal Set psReportName to "OrdersPlain.rpt" // This event is sent when the report is run and the cCrystalReport COM object has been created. Procedure OnInitializeReport handle hoReport Integer eDestination String sSelection Integer iFromOrderdtlOrderNumber iToOrderdtlOrderNumber Forward Send OnInitializeReport hoReport // Set the print destination. Get PrintDestination of oDestinationGroup to eDestination Set peOutputDestination to eDestination // Create the selection formula string. Get Value of oFromOrderdtlOrderNumber to iFromOrderdtlOrderNumber Get Value of oToOrderdtlOrderNumber to iToOrderdtlOrderNumber If (iFromOrderdtlOrderNumber<>0) Begin Move (sSelection+(If(sSelection<>""," and ",""))+"{ORDERDTL.Order_Number} >= "+(String(iFromOrderdtlOrderNumber))) to sSelection End If (iToOrderdtlOrderNumber<>0) Begin Move (sSelection+(If(sSelection<>""," and ",""))+"{ORDERDTL.Order_Number} <= "+(String(iToOrderdtlOrderNumber))) to sSelection End // Set the selection formula. Set ComRecordSelectionFormula of hoReport to sSelection End_Procedure // OnInitializeReport // Event is called when report is sent to previewer Procedure OnDisplayReport Handle hoReport Handle hoViewer Forward Send OnDisplayReport hoReport // Viewer options can be customized by setting properties of the active/x viewer object //Get ActiveXReportViewerObject of hoReport to hoViewer // handle of active/x viewer //Set ComDisplayToolbar of hoViewer to True //Set ComDisplayTabs of hoViewer to False //Set ComDisplayGroupTree of hoViewer to False //Set ComEnableGroupTree of hoViewer to False //Set ComEnablePrintButton of hoViewer to True //Set ComEnableCloseButton of hoViewer to False //Set ComEnableRefreshButton of hoViewer to False //Set ComEnableExportButton of hoViewer to True //Set ComEnableSearchExpertButton of hoViewer to True //Set ComEnableHelpButton of hoViewer to False //Set ComEnableZoomControl of hoViewer to True //Set ComEnableProgressControl of hoViewer to True //Set ComEnableSearchControl of hoViewer to True //Set ComEnableNavigationControls of hoViewer to True //Set ComEnableDrillDown of hoViewer to False //Set ComEnableAnimationCtrl of hoViewer to True //Set ComEnableSelectExpertButton of hoViewer to False //Set ComLaunchHTTPHyperlinksInNewBrowser of hoViewer to True End_Procedure // OnDisplayReport // Event is called when report is sent to Export Procedure OnExportReport Handle hoReport Handle hoExport Forward Send OnExportReport hoReport // By default Export options will be prompted when report is run. // Or, Export can be set up within the program Set pbExportPrompt of hoReport to False // suppress prompt for all export information Get ExportObject of hoReport to hoExport // Sample for export to disk file (word) //Set ComDestinationType of hoExport to crEDTDiskFile //Set ComFormatType of hoExport to crEFTWordForWindows //Set ComDiskFileName of hoExport to "Report.dat" // Sample for export to disk file (XML) //Set ComDestinationType of hoExport to crEDTDiskFile //Set ComFormatType of hoExport to crEFTXML //Set ComXMLFileName of hoExport to "Report.xml" // Sample for export to disk file (HTML) //Set ComDestinationType of hoExport to crEDTDiskFile //Set ComFormatType of hoExport to crEFTHTML40 //Set ComHTMLFileName of hoExport to "Report.html" // Sample for export to mapi //Get ExportObject of hoReport to hoExport //Set ComDestinationType of hoExport to crEDTEMailMAPI //Set ComFormatType of hoExport to crEFTWordForWindows //Set ComDiskFileName of hoExport to "Report.dat" //Set ComMailToList of hoExport to "Add-name@name.net" //Set ComMailSubject of hoExport to "Add-Subject" //Set ComMailMessage of hoExport to "Add-Message" //Set ComMailBccList of hoExport to "Add-name@name.net" // Sample for export to application (Word) //Get ExportObject of hoReport to hoExport //Set ComDestinationType of hoExport to crEDTApplication //Set ComFormatType of hoExport to crEFTWordForWindows Set ComFormatType of hoExport to crEFTPortableDocFormat // Complete File Name With Disk Path Set ComDestinationType of hoExport to crEDTDiskFile Set ComDiskFileName of hoExport to "D:\Test.pdf" End_Procedure // OnExportReport // procedure is called when report is sent to printer Procedure OnPrintReport Handle hoReport Forward Send OnPrintReport hoReport Set pbPrinterPrompt of hoReport to True // will prompt to set-up printer // Or... printer can be set up within the program //Send ComSelectPrinter of hoReport "sDriverName" "sPrinterName" "sPortName" //Set piPrinterCopies of hoReport to 1 //Set pbPrinterCollate of hoReport to True End_Procedure // OnPrintReport End_Object // oCrystalOrdersPlain Set Location to 6 6 Set Size to 153 123 Object oFormLoop is a Form Set Size to 13 54 Set Location to 109 64 Set Label to "Loop #" End_Object End_Object // OrdersPlain