Module OrdersByCustomerCR.rv

     1Use Crystal\CheckForCrystal.dg
     2Use dfrptvw.pkg
     3Use dfRadio.pkg
     4Use Windows.pkg
     5Use cCrystal.pkg
     6
     7DEFERRED_VIEW Activate_oOrdersByCustomerCR FOR ;
     8;
     9Object oOrdersByCustomerCR is a ReportView
    10    Set Label to "Orders by Customer"
    11    Set Location to 2 23
    12    Set Size to 72 185
    13    Set piMinSize to 72 185
    14
    15    Object oDetailRadioGroup is a RadioGroup
    16        Set Size to 40 100
    17        Set Location to 15 11
    18        Set Label to "Order Detail"
    19        Object oRadio1 is a Radio
    20            Set Label to "Show Order Detail"
    21            Set Size to 10 74
    22            Set Location to 12 10
    23        End_Object    // oRadio1
    24
    25        Object oRadio2 is a Radio
    26            Set Label to "Show Summary"
    27            Set Size to 10 65
    28            Set Location to 25 10
    29        End_Object    // oRadio2
    30
    31        Set Current_Radio to 0
    32        
    33        Function IsDetail Returns Integer
    34            Function_Return (Current_Radio(self)=0)
    35        End_Function
    36
    37    End_Object    // oDetailRadioGroup
    38
    39    Object oRunButton is a Button
    40        Set Label to "Run Report"
    41        Set Size to 14 53
    42        Set Location to 20 122
    43        Set Default_State to True
    44
    45        Procedure OnClick
    46            Boolean bCrystalOK
    47        
    48            Get CheckCrystalEnvironment of oCheckForCrystal to bCrystalOK
    49            If (bCrystalOK) Begin
    50               Send RunReport of oCrystalReport1
    51            End
    52            Else Begin
    53                Send DisplayDialog of oCheckForCrystal
    54            End
    55        
    56        End_Procedure
    57
    58    End_Object    // oRunButton
    59
    60    Object oCancelButton is a Button
    61        Set Label to "Cancel"
    62        Set Size to 14 53
    63        Set Location to 42 122
    64
    65        Procedure OnClick
    66            Send Close_Panel
    67        End_Procedure
    68
    69    End_Object    // oCancelButton
    70
    71    Object oCrystalReport1 is a cCrystal
    72
    73        // Mark an entire report section of {type} as suppressed
    74        //      Available Options are:
    75        //      crReportHeader
    76        //      crPageHeader
    77        //      crGroupHeader
    78        //      crDetail
    79        //      crGroupFooter
    80        //      crPageFooter
    81        //      crReportFooter
    82        Procedure MakeSectionsInvisible integer eSectionType Integer iGroup
    83            Handle  hoReport
    84            Handle  hoAreas hoArea
    85            Variant vAreas  vArea
    86            Integer iAreas  iArea iKind
    87        
    88            Get ReportObject to hoReport
    89        
    90            Get Create of hoReport U_cCrystalAreas to hoAreas // areas collection
    91            Get Create of hoReport U_cCrystalArea  to hoArea  // area object
    92        
    93            Get ComAreas of hoReport to vAreas // areas dispatch
    94            Set pvComObject Of hoAreas To vAreas // attach dispatch to object
    95            Get ComCount Of hoAreas To iAreas
    96            For iArea from 1 to iAreas
    97                Get ComItem of hoAreas iArea to vArea
    98                Set pvComObject Of hoArea To vArea // attach area dispatch to object
    99                Get ComKind of hoArea to iKind // is it the right kind, if so, suppress
   100                If (iKind=eSectionType) Begin
   101                    If (iGroup) Begin
   102                        If (ComGroupNumber(hoArea)=iGroup) Begin
   103                            Set ComSuppress of hoArea to True
   104                        End
   105                    End
   106                    Else Set ComSuppress of hoArea to True
   107                End
   108            Loop
   109            Send Destroy of hoArea //destroy objects used
   110            Send Destroy of hoAreas
   111        End_Procedure // MakeSectionsInvisible
   112
   113        Set psReportName to "OrdersByCustomer.rpt"
   114
   115        // This is a hook message sent by the OpenReport procedure. You may use this
   116        // procedure to set selection values, print options, etc. This procedure is
   117        // intended for augmentation; it has no action by default.
   118        Procedure OnInitializeReport handle hoReport
   119            Boolean bDetail
   120            // Set the details section to visible/invisible.
   121        
   122            Get IsDetail of oDetailRadioGroup To bDetail
   123            If (bDetail) Begin
   124                Set ComReportTitle of hoReport to "List all Orders for Customers"
   125            End
   126            Else Begin
   127                Set ComReportTitle of hoReport to "List Order summary information for Customers"
   128                Send AssignFormula of hoReport "DetailType" '"Show Summary Information"'
   129                Send MakeSectionsInvisible crDetail 0
   130                Send MakeSectionsInvisible crGroupHeader 2 // Group2
   131                Send MakeSectionsInvisible crGroupFooter 2 // Group2
   132            End
   133        End_Procedure // OnInitializeReport
   134        
   135        // This event is called when a report is being printed to screen.
   136        Procedure OnDisplayReport Handle hoReport
   137            Handle hoViewer
   138            Forward Send OnDisplayReport hoReport
   139            Get ActiveXReportViewerObject   of hoReport to hoViewer
   140            Set ComDisplayTabs              of hoViewer To True
   141            Set ComDisplayGroupTree         of hoViewer To True
   142            Set ComEnableGroupTree          of hoViewer To True
   143            Set ComEnableStopButton         of hoViewer To True
   144            Set ComEnableCloseButton        of hoViewer To True
   145            Set ComEnableDrillDown          of hoViewer To True
   146        End_Procedure // DisplayReport
   147        
   148    End_Object    // oCrystalReport1
   149
   150CD_End_Object    // oOrdersByCustomerCR
   151