PWCT 1.9 Art Documentation ( http://doublesvsoop.sourceforge.net )

2006-2013, Mahmoud Fayed ( msfclipper@users.sourceforge.net )

_____________________________________________________________________________________

Table of contents

1 - Introduction

2 - Implementation steps

3 - Final Steps Tree

4 - Application during the runtime

1 - Introduction

In this lesson we are going to learn how to use the (Access report with filter - Child Class) template.

2 - Implementation Steps

Create new file using the template (Access report with filter Ė child class)

s1.JPG

Fig. 1

File name = CustomersReport2.SSF

s2.JPG

Fig. 2

s3.JPG

Fig. 3

Set class name = CustomersReport2Class

s4.JPG

Fig. 4

s5.JPG

Fig. 5

s6.JPG

Fig. 6

Set report name = Customers_All

s7.JPG

Fig. 7

s8.JPG

Fig. 8

Set datecolumn = DateOfBirth

s9.JPG

Fig. 9

Set the property cWindowName to CustomersReport2Window

s10.JPG

Fig. 10

Delete the attribute OrderColumn

s11.JPG

Fig. 11

s12.JPG

Fig. 12

s13.JPG

Fig. 13

s14.JPG

Fig. 14

Delete step (Order Number)

s15.JPG

Fig. 15

s16.JPG

Fig. 16

Open method SizeReport

Delete step Order Number Controls Resize

s17.JPG

Fig. 17

s18.JPG

Fig. 18

Open method CheckChange

Delete steps that check the order number

s19.JPG

Fig. 19

s20.JPG

Fig. 20

The cDate() function used to convert text column to data column

Since dateofbirth is a date column not text, we donít need to use cDate() with dateofbirth (self:dateColumn)

s21.JPG

Fig. 21

s22.JPG

Fig. 22

Press CTRL+R to generate the source code file CustomersReport2.PRG

s23.JPG

Fig. 23

Open Main.SSF

s24.JPG

Fig. 24

Use the component (Set procedure to) to include the source code file (CustomersReport2.PRG)

s25.JPG

Fig. 25

s26.JPG

Fig. 26

Create new object CustomersReport2Object of class CustomersReport2Class

s27.JPG

Fig. 27

s28.JPG

Fig. 28

s29.JPG

Fig. 29

s30.JPG

Fig. 30

s31.JPG

Fig. 31

s32.JPG

Fig. 32

s33.JPG

Fig. 33

s34.JPG

Fig. 34

s35.JPG

Fig. 35

s36.JPG

Fig. 36

s37.JPG

Fig. 37

s38.JPG

Fig. 38

s39.JPG

Fig. 39

3 - Final Steps Tree

=======================

Main.SSF

=======================

 

The First Step

                Load System Modules

                                Set Procedure to "About.PRG"

                                Set Procedure to "Database.PRG"

                                Set Procedure to "Customers.PRG"

                                Set Procedure to "CustomersBrowse.PRG"

                                Set Procedure to "CustDataBrowse.PRG"

                                Set Procedure to "CustomerBrowse2.PRG"

                                Set Procedure to "ReportParent.PRG"

                                Set Procedure to "CustomersReport.PRG"

                                Set Procedure to "CustomersReport2.PRG"

                Create System Objects

                                Create Object AboutObject of Class AboutClass

                                Create Object CustomersDataObject of Class CustomersDataClass

                                Create Object CustomersBrowseObject of Class CustomersBrowseClass

                                Create Object CustDataBrowseObject of Class CustDataBrowseClass

                                Create Object CustomersBrowse2Object of Class CustomersBrowse2Class

                                Create Object CustomersReportObject of Class CustomersReportClass

                                Create Object CustomersReport2Object of Class CustomersReport2Class

                Define New Window ( win1 ) , Title : "System"

                                Window Events

                                Window Properties

                                Window Controls

                                                START OF MAIN MENU

                                                                MENU POPUPS

                                                                                DEFINE POPUP "File"

                                                                                                POPUP ITEMS

                                                                                                                Define ITEM ( "Customers Data/Browse" )

                                                                                                                Define ITEM ( "Customers Browse" )

                                                                                                                Define ITEM ( "Customers Browse by Country" )

                                                                                                                Define ITEM ( "Customers" )

                                                                                                                Define ITEM ( "Customers Report" )

                                                                                                                Define ITEM ( "Customers Report - filter by date of birth" )

                                                                                                                Define ITEM ( "About" )

                                                                                                                Define ITEM ( "Close System" )

                                                                                                END OF POPUP

                                                                END OF MAIN MENU

                                                Define New Statusbar

                                                                Items

                                                                                Define New StatusItem ( "Ready" )

                                                                                                Events

                                                                                                Properties

                                                                                Keyboard

                                                                                                Events

                                                                                                Properties

                                                                                Clock

                                                                                                Events

                                                                                                Properties

                                                                End Statusbar

                                End Of Window

                                win1.Maximize ( )

                                Activate window

Procedures

                Define Procedure closesystem

                                Start Here

                                                win1.Release ( )

                                End of Procedure

 

============================

CustomersReport2.SSF

============================

 

Set Class Name & Window Name

                PWCT-Code Generator: Replace String (MyClassName) with (CustomersReport2Class)

                PWCT-Code Generator: Replace String (MyWindowName) with (&(self:cWindowName))

Class

                Define Class MyClassName From Report_Base

                                Declare Class Data

                                                Data ReportName Init Value "Customers_All"

                                                Data datecolumn Init Value "DateOfBirth"

                                                Data cWindowName Init Value "CustomersReport2Window"

                                Declare Class Methods

                                                Method showwindow

                                                Method closewindow

                                                Method SizeReport

                                                Method checkchange

                                End of Class

                                Class Methods

                                                Define Method ShowWindow Class MyClassName

                                                                Start Here

                                                                                Define New Window ( MyWindowName ) , Title : "Report"

                                                                                                Window Events

                                                                                                                Event: ON INIT : Action self:ShowReport()

                                                                                                                Event: ON SIZE : Action self:SizeReport()

                                                                                                                Event: ON MAXIMIZE : Action self:SizeReport()

                                                                                                Window Properties

                                                                                                Window Controls

                                                                                                                Define New Button ( btn1 ) , Caption : "Close"

                                                                                                                                Button Events

                                                                                                                                                Event: ON CLICK : Action self:CloseWindow()

                                                                                                                                Button Properties

                                                                                                                Define New Button ( btn2 ) , Caption : "Print"

                                                                                                                                Button Events

                                                                                                                                                Event: ON CLICK : Action self:PrintReport()

                                                                                                                                Button Properties

                                                                                                                Define New Button ( btn3 ) , Caption : "Refresh"

                                                                                                                                Button Events

                                                                                                                                                Event: ON CLICK : Action self:ShowReport()

                                                                                                                                Button Properties

                                                                                                                Active Control ( self:oActiveX )

                                                                                                                Date Range Controls

                                                                                                                                Define Label ( lbl1 ) , Caption : "From"

                                                                                                                                                Label Events

                                                                                                                                                Label Properties

                                                                                                                                Define Label ( lbl2 ) , Caption : "To"

                                                                                                                                                Label Events

                                                                                                                                                Label Properties

                                                                                                                                Define CheckBox ( check1 ) , Caption : "Date Range :"

                                                                                                                                                CheckBox Events

                                                                                                                                                                Event: ON CHANGE : Action self:checkchange()

                                                                                                                                                CheckBox Properties

                                                                                                                                Define New DatePicker ( datepicker1 )

                                                                                                                                                Events

                                                                                                                                                                Event: ON CHANGE : Action self:checkchange()

                                                                                                                                                Properties

                                                                                                                                Define New DatePicker ( datepicker2 )

                                                                                                                                                Events

                                                                                                                                                                Event: ON CHANGE : Action self:checkchange()

                                                                                                                                                Properties

                                                                                                End Of Window

                                                                                                MyWindowName.Maximize ( )

                                                                                                Activate window

                                                                End of Method (Return 0)

                                                Define Method CloseWindow Class MyClassName

                                                                Start Here

                                                                                MyWindowName.Release ( )

                                                                End of Method (Return 0)

                                                Define Method SizeReport Class MyClassName

                                                                Start Here

                                                                                Local tempvar1,tempvar2

                                                                                tempvar1 = MyWindowName.Width

                                                                                tempvar2 = MyWindowName.Height

                                                                                self:oactivex.nWidth := tempvar1 - 84

                                                                                self:oactivex.nHeight := tempvar2 - 125

                                                                                MyWindowName.btn1.Row := tempvar2-88

                                                                                MyWindowName.btn2.Row := tempvar2-88

                                                                                MyWindowName.btn3.Row := tempvar2-88

                                                                                self:oactivex.Show ( )

                                                                                Date Range Controls Resize

                                                                                                MyWindowName.lbl1.Row := tempvar2 - 88

                                                                                                MyWindowName.lbl2.Row := tempvar2 - 88

                                                                                                MyWindowName.check1.Row := tempvar2 - 88

                                                                                                MyWindowName.DatePicker1.Row := tempvar2 - 88

                                                                                                MyWindowName.DatePicker2.Row := tempvar2 - 88

                                                                End of Method (Return 0)

                                                Define Method CheckChange Class MyClassName

                                                                Start Here

                                                                                Check Filter

                                                                                                tvalue = MyWindowName.Check1.Value

                                                                                                self.filter = ""

                                                                                                IF ( tvalue = true )

                                                                                                                Start Here

                                                                                                                                cdate1 = MyWindowName.Datepicker1.Value

                                                                                                                                cdate2 = MyWindowName.Datepicker2.Value

                                                                                                                                cdate1 = CONVERT Date cdate1 TO String

                                                                                                                                cdate2 = CONVERT Date cdate2 TO String

                                                                                                                                cdate1 = All Trim cdate1

                                                                                                                                cdate2 = All Trim cdate2

                                                                                                                                self.filter = self:datecolumn+" >= cdate('" + cdate1 + "') and "+self:datecolumn+" <= cdate('" + cdate2 + "')"

                                                                                                                ELSE

                                                                                                                                Start Here

                                                                                                                                                self.filter = "1 = 1"

                                                                                                                END OF IF STATEMENT

                                                                End of Method (Return 0)

4 - Application during the runtime

runtime1.JPG

Fig. 40

runtime2.JPG

Fig. 41

runtime3.JPG

Fig. 42