On receipt of payment discount and tds should be calculated and show pending bill details

Discussion in 'Tally Developer' started by SANTOSH SHRESTHA, Feb 18, 2019.

    

  1. [System:formula]
    testdays:mad:@machinedate - $BillDate
    discperc:if @@testdays<=10 then "10" else "5"
    [System:udf]
    santa:String:1050


    [#Collection: Pending Bills]

    Title : $$LocaleString:"Pending Bills"
    Sub Title : $$LocaleString:"Name", $$LocaleString:"Date", $$LocaleString:"Days",$$LocaleString:"Disc %",$$LocaleString:"Bill Miti", $$LocaleString:"Balance",
    Fetch : Name, BillDate, BillCreditPeriod, BaseClosing, FinalBalance, OverDueDays
    Unique : $$Name
    Format : $$Name, 10
    Format : $BillDate, 8 : Universal Date
    Format : @@testdays,8
    Format : @@discperc,5
    Format : $BaseClosing,-30 : "AllSymbols, DrCr"
    Format : $BBillMiti,8
    Client Only : Yes
    Keep Source : ...
    [#Menu:Gateway of Tally]
    Add:Item:Reports:Display:Vch Receipt Info

    [Report:Vch Receipt Info]
    Form:Vch Receipt Info
    Object:Voucher
    [Form:Vch Receipt Info]
    Part:Titlepart,Test Part,Vch Receipt Info
    Width:100% screen
    Height:100% screen

    [Part:Test Part]
    Line:Test Line
    Repeat:Test Line:Test Collection
    Scroll:Vertical
    [Line:Test Line]
    Field:Medium prompt, Name field
    Local:Field:Medium Prompt:Set as:"Voucher No. "
    Local:Field:Name field:Set as:$VoucherNumber
    Explode:LedExplodes
    Border:Thin Top
    Delete:Repeat
    [Part:Titlepart]
    Line:Titleline

    [Line:titleline]
    Field:rcptreftype,rcptbillno,rcptflddays,
    right fields:rcptfldamt,rcptflddiscount,rcptfldamountdisc
    Local:Field:rcptreftype:Info:"Ref Type"
    Local:Field:rcptbillno:Info:"Bill Date"
    Local:Field:rcptflddays:Info:"Days"
    Local:Field:rcptfldamt:Info:"Receipt Amount"
    Local:Field:rcptflddiscount:Info:"Disc %"
    Local:Field:rcptfldamountdisc:Info:"Discount Amount"

    [Part:LedExplodes]
    Line:LedExplodeLine
    Repeat:LedExplodeLine:AllLedgerEntries

    [Line:LedExplodeLine]
    Field:Name field
    Local:Field:Name field:Set as:$LedgerName
    Border:Thin Top
    Explode:Expbill Allocations

    [Field:rcptreftype]
    Width:8
    Use:name field
    ; Table : Bill Methods : $$Line = 1 OR NOT @@DoneDirectBills
    ; Table : Bill Methods, EndOfList : $$Line > 1 AND @@DoneDirectBills
    ; Show Table : Always
    Set as:$billtype

    Storage:rcptref
    ;:$rcptbilldetails>$rcptamt
    ;Sub Form:VCHBILL Allocation
    [Field:rcptbillno]
    Use:name field
    ;set as:if #rcptreftype="Agst Ref" then #rcptreftype else ""
    ;Table:pending Bills:#rcptreftype="Agst Ref"
    Set as:$BBillMiti
    ;Skip SysNames:Advance
    Show Table:Always
    Storage:rcptbillno
    Width:10
    ; skip:$rcptbilldetails>$rcptamt
    [Field:rcptflddays]
    Use:name field
    ;Set as:if #rcptreftype="Agst Ref" then @@testdays else ""
    Set as:mad:@testdays
    ;Invisible:not $$Name=0
    Storage:rcptbilldays
    Width:8
    ; skip:$rcptbilldetails>$rcptamt

    [Field:rcptfldamt]
    Use:amount field
    ;Set as:if $BaseClosing>$Amount then $VchReceiptInfo else ""
    Set as:$Amount;$VchReceiptInfo else ""
    ;Set as:mad:DirValue;$VchReceiptInfo
    Storage:rcptamt
    Width : @@VCHAmountWidth

    Set always : Yes

    [Field:rcptflddiscount]
    Use:Amount field
    ;Set as:if #rcptreftype="Agst Ref" then @@discperc else ""
    Set as:mad:@discperc
    Storage:rcptdiscperc
    Width:10
    ; skip:$rcptbilldetails>$rcptamt
    [Field:rcptfldamountdisc]
    Use:amount field
    Set as:$$discountcalculation:#rcptfldamt:#rcptflddiscount
    Set Always:Yes
    Storage:rcptdiscamt
    Width:10
    Local:Field:default:Inactive:$$IsEmpty:#rcptfldamt or $$IsEmpty:#rcptflddiscount
    ;skip:$rcptbilldetails>$rcptamt
    [System:udf]
    PendingAggr:Aggregate:8000
    rcptref:String:8001
    rcptbillno:String:8002
    rcptbilldays:String:8003
    rcptdiscperc:Amount:8005
    rcptdiscamt:Amount:8006
    rcptamt:Amount:8007
    [Part:Expbill Allocations]
    Line:ExpbillAllocationLine
    Repeat:ExpbillAllocationLine:Bill Allocations
    Bottom Line:BillAllocTotal
    Total:rcptfldamt,rcptfldamountdisc
    [Line:ExpbillAllocationLine]
    Field:rcptreftype,rcptbillno,rcptflddays,
    right fields:rcptfldamt,rcptflddiscount,rcptfldamountdisc

    [Line:BillAllocTotal]
    Field:rcptreftype,rcptbillno,rcptflddays,
    right fields:rcptfldamt,rcptflddiscount,rcptfldamountdisc
    Local:Field:rcptreftype:Info:""
    Local:Field:rcptbillno:Info:"Total"
    Local:Field:rcptflddays:Info:""
    Local:Field:rcptfldamt:Set as:$$Total:rcptfldamt
    Local:Field:rcptflddiscount:Info:""
    Local:Field:rcptfldamountdisc:Set as:$$Total:rcptfldamountdisc
    Border:totals
    [Collection:Test Collection]
    Type:Voucher
    Fetch:AllLedgerEntries
    Filter:eek:nlyrcpt

    [System:formula]
    onlyrcpt:mad:@rcptvch
    rcptvch:$$IsReceipt:$voucherTypeName


    [Function:discountcalculation]
    Parameter:rcptamtv:Amount
    Parameter:rcptamtdiscv:Amount
    Return:Amount
    Variable:mydiscamt:Amount
    01:Set:mydiscamt:(##rcptamtv*##rcptamtdiscv)/100
    02:Return:##mydiscamt

    [Part : Vch Receipt Info]
    Part:vchreceiptpart1
    Vertical:Yes
    [Part:vchreceiptpart1]
    Top Lines : VCH Receiptdr, VCH BillName New, VchReceipt Amt,Vch Receipt Info,vchtdsled,vchrcpttds, VCH Narr New,
    ;Repeat:VCH BillName New;:pending Bills
    ;Break On:$Baseclosing
    Local : Line : Default : Space Top : 1
    Scroll:Vertical


    [#Part : DBLLINE Narration]
    Add : Line : Before : Vch Narrprompt : VCH ReceiptPass

    [Line : VCH ReceiptPass]
    Left Fields : Medium Prompt, VCH ReceiptPass
    Local : Field : Medium Prompt : Set as :"Pass Journal Entry : "
    Invisible : Not @@IsReceipt

    [Line : VchReceiptdr]
    Left Fields : Medium Prompt, Name Field
    Local : Field : Medium Prompt : Set as : "Discount Ledger Name :"
    Local : Field : Name Field : Table : Cash Class Ledgers ExtractCash : $$IsEmpty:mad:VchLed
    Local : Field : Name Field : Storage : VchReceiptdr
    Local : Field : Name Field : Show Table : Always


    [Line : vchtdsled]
    Left Fields : Medium Prompt, Name Field
    Local : Field : Medium Prompt : Set as : "TDS Ledger Name :"
    Local : Field : Name Field : Table : Ledger
    Local : Field : Name Field : Storage : VchReceiptCr
    Local : Field : Name Field : Show Table : Always



    [Line : VchReceiptInfo]
    Left Fields : Medium Prompt, Vch Receipt Info
    Local : Field : Medium Prompt : Set as : "Discount Amount :"

    [Line : vchrcpttds]
    Left Fields : Medium Prompt, Vch Receipt Infotds
    Local : Field : Medium Prompt : Set as : "TDS Amount :"

    [Field:Vch Receipt Infotds]
    Use : Amount Field
    Set as:#VchReceiptInfo*10%
    Set Always:Yes
    Storage : VchReceiptInfoTDS



    [Line : VchNarrNew]
    Left Fields : Medium Prompt, Vch Narr New
    Local : Field : Medium Prompt : Set as : "Narration :"

    [Line : VchBillNameNew]
    Left Fields : Medium Prompt, Vch BillName New

    Local : Field : Medium Prompt : Set as : "Bill No :"

    [line:VchReceipt Amt]
    Field:Medium Prompt,Vchramt
    Local:Field:Medium Prompt:Set as:"Recived Amount"
    [Field:Vchramt]
    Use:Amount field
    Set as:$Amount







    [Field : VCH Narr New]
    Use : Name Field
    Storage : VCHNarrNew
    Set Always : Yes

    [Field : VCH BillName New]
    Use : Name Field
    Storage : VCHBillNameNew
    Show Table:Always



    [Field : VCH ReceiptPass]
    Use : Logical Field
    Storage : VCHReceiptPass
    ;Set Always : Yes
    Set as:"No"
    Show Table : Always
    Sub Forms : Vch Receipt Info : $$Value="Yes"

    [Field : VchReceiptInfo]
    Use : Amount Field
    Set as:mad:@mytotaldiscamt
    Set Always:Yes
    Storage : VchReceiptInfo

    [System:formula]
    mytotaldiscamt:$$Total:rcptfldamountdisc
    [Collection : Cash Class Ledgers ExtractCash]
    Use : Extract Alias Collection
    Source Collection : LedgersVch Src
    Collections : Not applicable
    Title : $$LocaleString:"List of Ledger Accounts"
    Parm Var : GroupSundryDebtors : String : $$GroupSundryDebtors
    Native Method : Name, Parent, ReserveName
    Keep Source : ().
    Client Only : Yes
    [#Form : Receipt Color]

    ;Add : On : Form Accept :Yes:mad:@AutoJrnal : CALL : JournalVchCreate
    Add : On : At End : Form Accept : Yes : CALL : JournalVchCreate
    [System : Formula]
    IsJournalEntry : $VCHReceiptPass = "YES"
    AutoJrnal : $$InCreateMode and $$InAlterMode; @@IsJournalEntry

    [Function : JournalVchCreate]
    Action : 01 : QUERYBOX : "Create Journal Voucher ?":Yes:No
    Action : 02 : IF : $$LastResult
    Action : 03 : NEW OBJECT : VOUCHER
    Action : 04 : SET VALUE : Date : $date
    Action : 05 : SET VALUE : ssDate : $ssdate

    Action : 06 : SET VALUE : VoucherTypeName : $$VchTypeJournal
    Action : 07 : SET VALUE : Narration : $Narration
    Action : 007 : SET VALUE : Narration :"Auto Journal of Receipt Voucher No : " + $VoucherNumber + " ";$VCHNarrNew;
    Action : 08 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 09 : SET VALUE : LedgerName : $Partyledgername
    Action : 10 : SET VALUE : Is Deemed Positive : No
    Action : 11 : SET VALUE : Amount : ($VchReceiptInfo-$VchReceiptInfoTDS)

    Action : 12 : INSERT COLLECTION OBJECT : Bill Allocations
    Action : 13 : SET VALUE : BillType : $$SysName:AgstRef;;:$RefType
    Action : 14 : SET VALUE : Name :$BillName1
    Action : 15 : SET VALUE : Amount :($VchReceiptInfo-$VchReceiptInfoTDS) ;($VchReceiptInfo) ;;$amount
    Action : 16 : SET TARGET : ...

    Action : 17 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 18 : SET VALUE : LedgerName : $VchReceiptCr
    Action : 19 : SET VALUE : Is Deemed Positive :No
    Action : 20 : SET VALUE : Amount : ($VchReceiptInfoTDS)


    Action : 21 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 22 : SET VALUE : LedgerName : $VchReceiptdr
    Action : 241 : SET VALUE : Is Deemed Positive : Yes
    Action : 23 : SET VALUE : Amount : $VchReceiptInfo

    Action : 25 : SET TARGET : ..

    Action : 26 : SET VALUE : PersistedView : ##SVViewName
    Action : 27 : CREATE TARGET
    Action : 28 : ENDIF
    ;


    [System : UDF]
    VchReceiptdr : String : 901 : Yes
    VCH ReceiptPass : Logical : 902 : Yes
    VchReceiptInfo : Amount : 903 : Yes
    VchNarrNew : String : 904 : Yes
    VchBillNameNew : String : 905 : Yes
    discrateperc:Amount:906:yes
    VchReceiptInfoTDS:Amount:907:yes
    VchReceiptCr:String:908:yes

    [#Object: Voucher]
    BillName1:$$CollectionField:$BillName:1:LedgerEntries
    BillAmt1 :$$CollectionField:$BillAmt:1:LedgerEntries


    [#Object: LedgerEntry]
    BillName: $$CollectionField:$Name:1:BillAllocations
    BillAmt : $$CollectionField:$Amount:1:BillAllocations
     
    Amit Kamdar likes this.


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Good job....:)
     




  3. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    You sud post screenshot from start to bottom.........

    so that members who are beginners or just learning TDL will understand what the code does...........

    Not all can understand TDL....:)
     


Share This Page