Wednesday 25 May 2022

Lock Voucher Entry on Holiday, Weekly Off

 

[#Menu: Gateway of Tally]
    Add: Button: HoldyBtn
   
[Button: HoldyBtn]

    Title:"My Holiday"
    Key: F7
    Action: Alter: MyHoldyReport



[Report: MyHoldyReport]

    Form            : MyHoldyReport
    Object        : Company

[Form: MyHoldyReport]

    Width       : 50% Screen
    height      : 40% Screen
    Parts       : MyHoldyTitle, MyHoldyTitles, MyHoldy
    Background  : Light Lily Yellow
        Bottom part: Holdypart
;-----------------------------------;

[Part : MyHoldyTitle]
    Line : MyHoldyTitleTitle
    
[Line : MyHoldyTitleTitle]

    Space Bottom : 1
    Field :  Form SubTitle
    Local : Field :Form SubTitle: Info  : " My Holiday Task"
    Local : Field :Form SubTitle: Color : Red
    Local : Field :Form SubTitle: Style : Normal Bold
;-----------------------------------;
[Part: MyHoldyTitles]

    Lines           : MyHoldyTitles
    ;Border      : Column Titles

    [Line: MyHoldyTitles]
   
        Use     : MyHoldy

        Local   : Field : Default : Style       : Normal Bold Italic
        Local   : Field : Default : Skip        : Yes
        Local   : Field : Default : Type        : String
            Local   : Field : Default : Align       : centre
            Local   : Field : Default : Background  : Yellow
          ;  Local   : Field : Default : Color       : Dodger Blue
        Local   : Field : Default : Delete      : Storage
        Local   : Field : Default : Delete      : Inactive

                Local   : Field : CMP SRno    : Set as: "SR No"
        Local   : Field : CMP Date    : Set as: "Date"
       
        Local   : Field : CMP Reason  : Set as: "Reason For Holiday"       
       
                Border  : Column Titles

[Part: MyHoldy]

    Line        : MyHoldy
    Repeat      : MyHoldy : MyHoldy
    Scroll      : Vertical
    CommonBorder: Yes
    BreakOn     : $$IsEmpty:$VDate

    [Line: MyHoldy]
   
        Field       : CMP SRno, CMP Date, CMP Reason
       
       
        Local   : Field : Default : Style       : Normal
                ;Local   : Field : Default : Color       : Sky Blue
                Local   : Field : Default : Background  : White
            Local   : Field : Default : Align       : Centre

            [Field: CMP SRno]
       
            Set as : $$Line
                    Width  : 5
            ;Border  : Thin Left
                       

        [Field: CMP Date]
                        Use     : Uni Date Field
                        Set As     : $VDate
            Storage : VDate
            ;Border  : Thin Left
                        Width   : 20         
                       


        [Field: CMP Reason]
       
            Use     : Name Field
            Storage : VReason
            ;Border  : Thin Left
            Inactive: $$IsEmpty:$VDate           
            Full Width  : Yes                    

;------------------------------------------------;

[part : Holdypart]
Line : Holdypart

[Line : Holdypart]
Field : Simple Prompt, MyHoldyFld

Local: Field: Simple Prompt: Set as : "W e e k l y__o f f"

Local: Field: Simple Prompt: Width     : 24.5
Local: Field: Simple Prompt: Style     : Normal Bold Italic
Local: Field: Simple Prompt: Align     : Left
;Local: Field: Simple Prompt: Border    : Thin  Bottom
Local: Field: Simple Prompt: Color     :  Blue
;Local: Field: Simple Prompt: Background: Light Grey

[Field: MyHoldyFld]

    Use         : Name Field
        Width  : 16
        Style       : Normal
        Table       : Holdyweek, End of List       
        scroll        : Vertical       
        Show table  : Always
        Align       : Center
        Border      : Thin  Box
        Background: Light Grey
        Storage : Voffday   

[Table : Holdyweek]

    Title        : "Weekday List"
    List Name     : $$LocaleString:"Sunday", $$LocaleString:"Monday", $$LocaleString:"Tuesday", $$LocaleString:"Wednesday", $$LocaleString:"Thursday", $$LocaleString:"Friday", $$LocaleString:"Saturday"
    Format        : $Name,15
    Client Only    : Yes       

[System: UDF]

       MyHoldy         : Aggregate : 19000
      VSrNo            : Number    : 19001
      VDate            : Date      : 19002
      Vreason        : String    : 19003

[System: UDF]
      Voffday        : String    : 20000

[System: Variables]
    svReasonForBloack :""

[Variable: svReasonForBloack]
    Type: String
    Default: ""
    Persistent: No
   
[#Object: Company]
    vhdoffday : $$String:$vOffDay

[Collection    : RbcBlockeDaysList]
    Type: MyHoldy : Company
    Child Of: #SvCurrentCompany
    Format    : $vSrNo,5
    Format    : $vDate, 10
    Format    : $vReason, 25
   
    Title:  : "Blocked Days"
   

[Function: RbcFindBlockedDay]

    Variable    : IsDayBlocked : Logical: False
    Parameter    : pDateAsked    : date
    Returns        : Logical
   
    005    : Walk Collection: RbcBlockeDaysList
   
    010 : If: (##pDateAsked = $vDate) Or ($$DayOfWeek:##pDateAsked =$vOffday:Company:##SVCurrentCompany)

    020    :     If: (##pDateAsked = $vDate) AND ($$DayOfWeek:##pDateAsked =$vOffday:Company:##SVCurrentCompany)
    030    :         Set: svReasonForBloack : $vReason + " Holiday and also is a Weekly Off :" +$vOffday:Company:##SVCurrentCompany
   
    040    :     Else

    050    :        If: (##pDateAsked = $vDate)
    060    :             Set: svReasonForBloack : $vReason + " Holdiay"
    070    :        ELSE
    080    :            If: ($$DayOfWeek:##pDateAsked =$vOffday:Company:##SVCurrentCompany)
    090    :             Set: svReasonForBloack : "Weekly Off :" +$vOffday:Company:##SVCurrentCompany
    100    :            ENd if
    110    :        END IF
   
    120    :     END if   
    130    :    Set: IsDayBlocked : True
    140    :     Return    : ##IsDayBlocked
    150    :     Log:$$String:##IsDayBlocked
    160    :     END If
    170    : End Walk
    180    : Return        : False

;; End-of-File


;----------------------------------------------------------;

[System : Formula]


       
    ControlBlock    : "Date not allowed !"+$$NewLine+ @@ReasonBlock

    DtIsOpen        : NOT $$RbcFindBlockedDay:$Date ; $Date >= $VDate:Company:##SVCurrentCompany 
    EffDtIsOpen        : NOT $$RbcFindBlockedDay:$EffectiveDate ;$EffectiveDate= >= $VDate:Company:##SVCurrentCompany

    VchrCreation: $$InCreateMode AND NOT @@DtIsOpen
    VchrAlter    : $$InAlterMode AND (NOT @@DtIsOpen OR NOT @@EffDtIsOpen)
   
    ReasonBlock :  ##svReasonForBloack

[#Key   : Delete Line Object]
    Inactive    :  Not @@DtIsOpen

[#Key: Cancel Line Object]
    Inactive    :   Not @@DtIsOpen


[#Key   : Form Delete]
    Inactive    : (NOT $$CanDelete) OR (NOT @@DtIsOpen)

[#Key    : Form Cancel]
    Inactive    : (NOT $$CanCancel) OR (NOT @@DtIsOpen)

[#Form: Voucher]
    Local    : Key     : Form Delete         : Inactive    : NOT @@DtIsOpen
    Local   : Key   : Delete Line Object : Inactive : NOT @@DtIsOpen
    Local   : Key   : Form Cancel         : Inactive : NOT @@DtIsOpen
    Add : Control   : ControlBlock : $$RbcFindBlockedDay:$$Value
    Add : Control    : ControlBlock    : @@VchrAlter


[#Field: Chg SVDate]
    Add: Control     : ControlBlock :  $$RbcFindBlockedDay:$$Value


[#Field: Plain VCH Date]
    Add : Control     : ControlBlock :  $$RbcFindBlockedDay:$$Value
   

[#Line: DSP VchDetail]
    Local   : Key   : Delete Line Object : Inactive : NOT @@DtIsOpen
    Local   : Key   : Cancel Line Object : Inactive : NOT @@DtIsOpen


[#Line: STKVCH NormalDetail]
    Local   : Key   : Delete Line Object : Inactive : NOT @@DtIsOpen
    Local   : Key   : Cancel Line Object : Inactive : NOT @@DtIsOpen

[#Line: STKVCH InTRACKLead]
    Local   : Key   : Delete Line Object : Inactive : NOT @@DtIsOpen
    Local   : Key   : Cancel Line Object : Inactive : NOT @@DtIsOpen


[#Line: STKVCH OutTRACKLead]
    Local   : Key   : Delete Line Object : Inactive : NOT @@DtIsOpen
    Local   : Key   : Delete Line Object : Inactive : NOT @@DtIsOpen
    Local   : Key   : Cancel Line Object : Inactive : NOT @@DtIsOpen

No comments:

Post a Comment