;; ============================================================
;; Product   : Godown Name Show in Day Book
;; Store     : www.gyanamrittdl.com
;; Support   : WhatsApp +91 79924 46290
;; For       : TallyPrime
;; ============================================================
;; What it does :
;;   Adds a GODOWN column in Day Book. It shows the godown of the
;;   first stock item of the voucher.
;; How to load  : Tally > F1 Help > TDL & Add-On > Manage Local TDL
;;                > Load TDL on Startup = Yes > give the path of this file
;; ============================================================
[#Form:DayBook]
Local:Collection:Default:Fetch:GAF53GdnName

[#Object:Voucher]
GAF53GdnName:$$GAF53GdnName

[Field: GAF53Godown]
    Use      : Name Field
    Set as   : $GAF53GdnName
    Width    : 16
    Color    : Blue
    Style    : Small Bold
    Border   : Thin Right

;; Finds the godown of the first item line of the voucher
[Function: GAF53GdnName]
    Variable : GAF53G : String

    101  : Set : GAF53G : ""
    201A : Walk Collection : InventoryEntries
    202A : Walk Collection : BatchAllocations
    203  : If : $$IsEmpty:##GAF53G
    204  : Set : GAF53G : $GodownName
    205  : End If
    202Z : End Walk
    201Z : End Walk
    301  : If : $$IsEmpty:##GAF53G
    302A : Walk Collection : AllInventoryEntries
    303A : Walk Collection : BatchAllocations
    304  : If : $$IsEmpty:##GAF53G
    305  : Set : GAF53G : $GodownName
    306  : End If
    303Z : End Walk
    302Z : End Walk
    307  : End If
    508  : Return : ##GAF53G

;----------------------------- DAY BOOK ------------------------------
[#Line: DBTitle1]
    Add   : Field : At Beginning : GAF53Godown
    Local : Field : GAF53Godown : Set as : "GODOWN"

[#Line: DBTitle2]
    Add   : Field : At Beginning : GAF53Godown
    Local : Field : GAF53Godown : Set as : ""

[#Line: DSP VchDetail]
    Add   : Field : At Beginning : GAF53Godown

;============================ END ====================================
