Lock Voucher Entry on Holiday, Weekly Off

Discussion in 'Free Source Codes' started by Devendra_Rawat, Feb 9, 2019.

    
  1. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    :);):(

    Not a bad name at all... and do not test on educational version of tally..:);):(

    TDL to show how to control voucher entry on holidays declared in your company or weekly offs.

    This tdl is modified version of that available in forum.. No credits please


    Code:
    [#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
    
     

    Attached Files:



  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Good effort..... :)
     
    Devendra_Rawat likes this.


  3. Devendra_Rawat

    Devendra_Rawat Well-Known Member



  4. PANKAJ BHONDLE

    PANKAJ BHONDLE Active Member


    Thanku You, Garimaji
     


  5. admin

    admin Administrator Staff Member


    Nice efforts
     


  6. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    It was effort of @Vikram Bhat :D;)

    I just helped him and posted here ... ;)
     
    MZMS and chintamani like this.


  7. Johar

    Johar Member


    Sir, how to filter out only Sales & Purchase Voucher, rest all voucher it should ignore

    Thanks
     


  8. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    First, you are off-topic...............

    secondly............ as per your above statement.............
    Filter out Sales & Purchase........... means you do not want Sales/Purchase
    then..... rest all voucher it should ignore..........means rest of the vouchers is also to be ignored...........

    Then....what exactly you want.......... a BLANK Collection?????
     


  9. Johar

    Johar Member


    Sir,
    You are not getting me right, I want only Sales & Purchase voucher to get control of Holiday Dates, rest all voucher should not get control of Holiday Dates.

    Thanks
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Open your own thread with appropriate title and ask your query..........
     


  11. Sanjeev S

    Sanjeev S Active Member


    Great Add on Devendra Ji.
     


  12. Mahesh Sethi

    Mahesh Sethi Member


    Hi Garima Ji,

    Can possible in day book (Any voucher Type) random selected voucher lock thru password.

    If it is possible pls guide me how it is possiable.

    Thanks in Advance,

    Mani
     
    Last edited: Feb 10, 2023


  13. Mahesh Sethi

    Mahesh Sethi Member



    Garima Ji,

    Can it is possible pls replay me.

    Thanks in Advance

    Mani
     


  14. laxman

    laxman Member


    Great .....
     


Share This Page