Module SigCJBespokeCalendarDemo.vw

     1Use Windows.pkg
     2Use DFClient.pkg
     3Use cSigCjCalendarControl.pkg
     4Use Cal_Date.DD
     5Use Customer.DD
     6Use SalesP.DD
     7Use OrderHea.DD
     8
     9Deferred_View Activate_oSigCJCalendarDemo_Bespoke_View for ;
    10Object oSigCJCalendarDemo_Bespoke_View is a dbView
    11    Set Border_Style to Border_Thick
    12    Set Size to 200 443
    13    Set Location to 8 3
    14    Set Maximize_Icon to True
    15    Set piMinSize to 200 443
    16    Set Label to "Codejock Demo - Bespoke Calendar - Sales Team"
    17    Set Icon to "SIG.ico" 
    18
    19    Object oSalesp_DD is a SalesP_DataDictionary
    20    End_Object
    21
    22    Object oCustomer_DD is a Customer_DataDictionary
    23    End_Object
    24
    25    Object oOrderhea_DD is a OrderHea_DataDictionary
    26        Set DDO_Server to oSalesp_DD
    27        Set DDO_Server to oCustomer_DD
    28    End_Object
    29
    30    Object oCal_Date_DD is a Cal_Date_DataDictionary
    31    End_Object
    32
    33    Set Main_DD to oCal_Date_DD
    34    Set Server to oCal_Date_DD
    35
    36    Object oSigCJCalendarControl1 is a cSigCJCalendarControl
    37        Set Size to 192 292
    38        Set Location to 4 4
    39        Set peAnchors to anAll
    40        Set peTimeScale to eCal_TimeScale_15
    41        Set ptmLunchEndTime to "13:15"
    42        Set ptmLunchStartTime to "12:30"
    43        Set pbUseScaleTimes to True
    44        Set ptmWorkDayStartTime to "08:30"
    45        Set pbUseStdDates to False
    46        Set pbUseStdFiles to False
    47    
    48        Procedure OnCreate
    49            Forward Send OnCreate
    50            // ToDo: Set the ActiveX properties here...
    51        End_Procedure
    52
    53        Procedure OnLoad_Special_Date Date dThisDate
    54            Integer iIndex
    55            tdCal_Dates tCal_Date
    56        
    57            Clear Cal_Date
    58            Move dThisDate to Cal_Date.Date_From
    59            Find Le Cal_Date by Index.1
    60            If ((Found) and (dThisDate >= Cal_Date.Date_From) and (dThisDate <= Cal_Date.Date_To)) Begin
    61                Move dThisDate            to tCal_Date.dDate
    62                Move Cal_Date.BackColour  to tCal_Date.iBackColor
    63                Move Cal_Date.AllDay      to tCal_Date.bAllDay
    64                Move Cal_Date.AllowEvents to tCal_Date.eAllowEvents
    65                
    66                Send Add_Special_Date tCal_Date
    67            End
    68        End_Procedure
    69    
    70        //=========================================================================
    71        // List of Non Standard Table Events
    72        // If your not using the standard table set then the following events will
    73        // give you complete control over the data
    74        //=========================================================================
    75        
    76        Procedure OnEvent_GetUpcoming DateTime dtFrom DateTime dtTo
    77        End_Procedure
    78    
    79        Function OnEvent_Create tdEvent tEvent_Data Returns Integer
    80        End_Function
    81    
    82        //-------------------------------------------------------------------------
    83    
    84        Function OnEvent_Delete Integer iEvent_ID Returns Boolean
    85        End_Function
    86    
    87        //-------------------------------------------------------------------------
    88    
    89        Function OnEvent_Read Integer iEvent_ID Returns tdEvent
    90        End_Function
    91    
    92        //-------------------------------------------------------------------------
    93    
    94        Function OnEvent_Save tdEvent tEvent_Data Returns Boolean
    95
    96            Send Clear of oOrderhea_DD
    97            
    98            Send Find_By_Recnum of oOrderhea_DD OrderHea.File_Number tEvent_Data.iURN
    99            
   100            Set Field_Changed_Value of oOrderhea_DD Field OrderHea.Order_Date to tEvent_Data.dStartDate
   101            Set Field_Changed_Value of oOrderhea_DD Field OrderHea.Time_Start to (Replace(":",tEvent_Data.tmStartTime,""))
   102            Set Field_Changed_Value of oOrderhea_DD Field OrderHea.Time_End   to (Replace(":",tEvent_Data.tmEndTime,""))
   103
   104            Send Request_Save of oOrderhea_DD 
   105            
   106            Function_Return True 
   107        End_Function
   108    
   109        //-------------------------------------------------------------------------
   110    
   111        Function Move_Orders_To_tdEvent Returns tdEvent
   112            tdEvent tEvent
   113    
   114            Move OrderHea.Recnum          to tEvent.iURN
   115            Move SalesP.Recnum            to tEvent.sCategories
   116            Move SalesP.Name              to tEvent.sLocation
   117            Move ("$" + String(OrderHea.Order_Total))     to tEvent.sBody
   118            Move Customer.Name            to tEvent.sSubject
   119            Move OrderHea.Order_Date      to tEvent.dStartDate
   120            Move OrderHea.Order_Date      to tEvent.dEndDate
   121            Move OrderHea.Time_Start      to tEvent.tmStartTime
   122            Move OrderHea.Time_End        to tEvent.tmEndTime
   123
   124            Function_Return tEvent
   125        End_Function
   126
   127        Procedure OnEvents_For_Day Date dDay
   128            tdEvent tEvent
   129            
   130            Clear OrderHea
   131            Move dDay to OrderHea.Order_Date
   132            Find Ge OrderHea by Index.3
   133            While (Found)
   134                If (OrderHea.Order_Date = dDay) Begin
   135                        Relate OrderHea
   136                        Get Move_Orders_To_tdEvent to tEvent
   137                        Send Add_Event_For_Day tEvent
   138                End
   139                Find GT OrderHea by Index.3
   140            End
   141        End_Procedure
   142    
   143        //-------------------------------------------------------------------------
   144   
   145        Function Move_Sales_To_tdCats Returns tdCal_Category
   146            tdCal_Category tCats
   147
   148            Move SalesP.Recnum to tCats.iURN        
   149            Move SalesP.ID     to tCats.sShort_Desc
   150            Move SalesP.Name   to tCats.sLong_Desc
   151            Move 1676698       to tCats.iBorder_Color
   152            Move 16777215      to tCats.iColor_Dark
   153            Move 11664639      to tCats.iColor_Light
   154            Move 0.75          to tCats.nGradient
   155
   156            Function_Return tCats
   157        End_Function
   158
   159        Procedure OnCategory_Load 
   160            Handle  hoData_Prov hoCategories 
   161            Variant vCategories  
   162            tdCal_Category tCat
   163
   164            Clear SalesP
   165            Find gt SalesP by Index.1
   166            While (Found)
   167                Get Move_Sales_To_tdCats to tCat
   168                Send Add_Category tCat
   169                    
   170                Find gt SalesP by Index.1
   171            Loop
   172        End_Procedure
   173
   174    End_Object
   175
   176    Object oSigCJCalendarDatePicker1 is a cSigCJCalendarDatePicker
   177        Set Size to 100 135
   178        Set Location to 4 302
   179        Set peAnchors to anTopRight
   180    End_Object
   181
   182Cd_End_Object
   183