How to set (-) Roundoff Amount?

Discussion in 'Free Source Codes' started by ASHTAMOORTHY, Apr 6, 2019.

    
  1. ASHTAMOORTHY

    ASHTAMOORTHY New Member


    [#Menu : Gateway of Tally]
    Item : Column INVOICE : Execute: ColumnINVOICE

    [Report: ColumnINVOICE]
    Form: ColumnINVOICE
    Object : Voucher


    [Form: Column INVOICE]
    Parts : ColumnINVOICETitle,ColumnINVOICEEdit;, MallUDFEditLines
    ;Background : Light Lily Yellow
    ;Use : DSP Template
    Height : 90% screen
    Width : 90% screen
    Background : white
    Horizontal Alignment:Center
    Vertical Alignment:Center
    On:Form Accept:yes:Call: RaiseInvoice
    On:Form Accept:yes:Form Accept
    [Part:ColumnINVOICETitle]
    Line : ColumnINVOICETitle
    CommonBorder: Yes
    Border : Column Titles
    [Part: ColumnINVOICEEdit]
    Line : ColumnINVOICEEditLines
    CommonBorder: Yes
    Border : Column Titles

    [Line: ColumnINVOICETitle]

    use: ColumnINVOICEEditLines

    Local : Field : Default : Style : Small Bold
    Local : Field : Default : Skip : Yes
    Local : Field : Default : Type : String
    Local : Field : Default : Delete: Storage
    ;Local : Field : Default : Lines : 1
    Local : Field : Default : Color : blue
    ;Local : Field : Default : border : flush totals
    Local : Field : Default : Delete: Inactive

    Local : Field : mDate : Set as: "Date"
    Local : Field : mPartyName : Set as: "Partyledger"
    Local : Field : mFullAmount : Set as: "FullAmount"
    Local : Field : mAmount : Set as: "RentAmount"
    Local : Field : mGstType : Set as: "GstType"
    [Line: ColumnINVOICEEditLines]
    Fields : mDate, mPartyName, mFullAmount, mAmount,mGstType
    Local : Field : Default : Style : Small Bold
    Border : Thin cover




    [Field:mDate]
    Use : Uni Date Field
    Set as:##Svcurrentdate
    Modifies:mDate:yes
    [Field :mPartyName]
    use : Name Field
    Table : RentLedgers
    Show Table : Always
    Width: 40
    Full Width:Yes
    Modifies:mPartyLedger:yes
    [Collection: RentLedgers]
    Use : Alias Collection
    Type : Ledger
    Title : "Select Ledger"
    Child Of: $$GroupSundryDebtors
    Belongs To:Yes
    ;Fetch : Name, Language Name
    Full Height : yes
    Align : Center

    [Field : mAmount]
    use : NUmber Field
    Set as:$LEDBasicRent:Ledger:$RentUdfPartyName
    Set Always:Yes
    Modifies:mAmount:yes
    [Field : mFullAmount]
    use : NUmber Field
    Width:15
    Set as:$LedTotRent:Ledger:$RentUdfPartyName
    Set Always:Yes
    Modifies:mFullAmount:yes
    [Field : mGstType]
    use : Name Field
    Width:15
    Set as:"SGST"
    Table : GstTypes
    Show Table: always
    Modifies:mGstType:tes
    [Table:GstTypes]
    LISTName : "SGST"
    LISTName : "IGST"
    Title: "Select Type"

    [Variable : mDate]
    Type : Date
    ;Default : ""
    Persist : Yes
    [Variable : mPartyLedger]
    Type : String
    ;Default : ""
    Persist : Yes
    [Variable : mAmount]
    Type : Number
    ;Default : ""
    Persist : Yes

    [Variable : mFullAmount]
    Type : Number
    ;Default : ""
    Persist : Yes

    [Variable : mGstType]
    Type : String
    ;Default : ""
    Persist : Yes

    [Variable : mIGSTLedger]
    Type : String
    ;Default : ""
    Persist : Yes
    [Variable : mCGSTLedger]
    Type : String
    ;Default : ""
    Persist : Yes
    [Variable : mSGSTLedger]
    Type : String
    ;Default : ""
    Persist : Yes
    [Variable : mRentalIncomeLedger]
    Type : String
    ;Default : ""
    Persist : Yes

    [Variable : mRoundOffLedger]
    Type : String
    ;Default : ""
    Persist : Yes



    [System : Variable]
    mDate: ""
    mPartyLedger : ""
    mAmount:0
    mFullAmount:0
    mGstType:"SGST"

    mRoundOffLedger:"Roundoff"
    mIGSTLedger:"IGST"
    mCGSTLedger:"CGST"
    mSGSTLedger:"SGST"
    mRentalIncomeLedger:"Rental Income"


    [Function : RaiseInvoice]

    ;; Definition Block

    Variable : Account: String

    Variable:partyName:String

    Variable : RentPlusGSTAmount: Number
    Variable : ActualRentAmount: Number
    Variable : CGSTAmount: Number
    Variable : SGSTAmount: Number
    Variable: IGSTAmount:Number
    Variable: RoundofAmount:Number

    Variable:mGST:String


    Variable : mVoucherTypeName : String

    Variable:DeemedVal:String
    Variable:SaveAmount:Amount




    105 : SET : SVViewName : $$SysName:InvVchView ;AcctgVchView ;

    115 : NEW OBJECT : Voucher
    125: Set:RoundofAmount:0
    135 : Set:ActualRentAmount:##mAmount
    145 : Set:RentPlusGSTAmount:##mFullAmount
    155 : Set:CGSTAmount: (##ActualRentAmount*9)/100
    165 : Set:SGSTAmount:(##ActualRentAmount*9)/100
    175 : Set:IGSTAmount:(##ActualRentAmount*18)/100


    185 : SET : PartyName :##mPartyLedger
    195: SET: mGST: $PARTYGSTIN:Ledger:##PartyName ;$IncomeTaxNumber:ledger:$UDFLedgerName
    205 : Set: mVoucherTypeName: "Rent Invoice";"Sales"
    215 : SET VALUE : Date : ##mDate
    225 : SET VALUE : VoucherTypeName : ##mVoucherTypeName ;"Rent Invoice";$$VchTypeSales
    235 : SET VALUE : Narration : "Rent"
    245 : SET VALUE : PARTYNAME : ##PartyName
    ;255: msgbox : ##PartyName : ##ActualRentAmount
    255 : SET VALUE : PARTYLEDGERNAME : ##PartyName
    265 : SET VALUE : BASICBASEPARTYNAME : ##PartyName
    275 : SET VALUE : BASICBUYERNAME : ##PartyName
    295: SET VALUE : PartyGSTIN : ##mGST
    305 : SET VALUE : ISINVOICE : Yes

    315 : Insert Collection Object : Ledger Entries
    325 : SET : Account :##PartyName
    335 : Set:DeemedVal:"Yes"
    345 : set : SaveAmount: -1*$$AsAmount:##RentPlusGSTAmount
    355 : SET TARGET : LedgerEntries
    365 : SET VALUE : LedgerName : ##PartyName

    385 : SET VALUE : Amount :($$TgtObject:($$AsAmount:##SaveAmount))
    395 : SET VALUE : ISDEEMEDPOSITIVE : $$String:##DeemedVal
    405 : SET VALUE : ISPARTYLEDGER : $$String:##DeemedVal
    415 : SET VALUE : ISLASTDEEMEDPOSITIVE: $$String:##DeemedVal
    425 : SET TARGET : ..

    435 : Insert Collection Object : Ledger Entries
    445 : SET : Account :##mRentalIncomeLedger
    455 : Set:DeemedVal:"No"
    465 : set : SaveAmount: $$AsAmount:##ActualRentAmount
    475 : SET TARGET : LedgerEntries
    485 : SET VALUE : LedgerName : ##Account
    495 : SET VALUE : BasicUserDescription : ""
    505 : SET VALUE : Amount :($$TgtObject:($$AsAmount:##SaveAmount))
    515 : SET VALUE : ISDEEMEDPOSITIVE : $$String:##DeemedVal
    525 : SET VALUE : ISPARTYLEDGER : $$String:##DeemedVal
    535 : SET VALUE : ISLASTDEEMEDPOSITIVE: $$String:##DeemedVal
    545 : SET TARGET : ..


    555: If : ##mGstType = "SGST"
    565 : Set:RoundofAmount: ##RentPlusGSTAmount-(##SGSTAmount+##CGSTAmount+##ActualRentAmount)

    575 : Insert Collection Object : Ledger Entries
    585 : SET : Account : ##mSGSTLedger
    595 : Set:DeemedVal:"No"
    605 : set : SaveAmount: $$AsAmount:##CGSTAmount
    615 : SET TARGET : LedgerEntries
    625 : SET VALUE : LedgerName : ##Account

    635 : SET VALUE : BasicUserDescription : ""
    645 : SET VALUE : Amount :($$TgtObject:($$AsAmount:##SaveAmount))
    655 : SET VALUE : ISDEEMEDPOSITIVE : $$String:##DeemedVal
    665 : SET VALUE : ISPARTYLEDGER : $$String:##DeemedVal
    675 : SET VALUE : ISLASTDEEMEDPOSITIVE: $$String:##DeemedVal
    685: SET TARGET : ..

    695 : Insert Collection Object : Ledger Entries
    705 : SET : Account :##mCGSTLedger
    715 : Set:DeemedVal:"No"
    725 : set : SaveAmount: $$AsAmount:##SGSTAmount
    735 : SET TARGET : LedgerEntries
    745 : SET VALUE : LedgerName : ##Account
    765 : SET VALUE : Amount :($$TgtObject:($$AsAmount:##SaveAmount))
    775 : SET VALUE : ISDEEMEDPOSITIVE : $$String:##DeemedVal
    785 : SET VALUE : ISPARTYLEDGER : $$String:##DeemedVal
    795 : SET VALUE : ISLASTDEEMEDPOSITIVE: $$String:##DeemedVal
    805: SET TARGET : ..

    815 : else
    825 : Set: RoundofAmount : ##RentPlusGSTAmount-(##IGSTAmount+##ActualRentAmount)

    835 : Insert Collection Object : Ledger Entries
    845 : SET : Account : ##mIGSTLedger
    855 : Set:DeemedVal:"No"
    865 : set : SaveAmount: $$AsAmount:##IGSTAmount
    875 : SET TARGET : LedgerEntries
    885 : SET VALUE : LedgerName : ##Account
    895 : SET VALUE : BasicUserDescription : ""
    905 : SET VALUE : Amount :($$TgtObject:($$AsAmount:##SaveAmount))
    915 : SET VALUE : ISDEEMEDPOSITIVE : $$String:##DeemedVal
    925 : SET VALUE : ISPARTYLEDGER : $$String:##DeemedVal
    935 : SET VALUE : ISLASTDEEMEDPOSITIVE: $$String:##DeemedVal
    945: SET TARGET : ..

    955: End IF


    965: If : ##RoundofAmount<>0
    975 : Insert Collection Object : Ledger Entries
    985 : SET : Account : ##mRoundOffLedger
    995 : Set:DeemedVal:"No"
    997: set : SaveAmount: $$AsAmount:##RoundofAmount

    1015 : SET TARGET : LedgerEntries
    1025 : SET VALUE : LedgerName : ##Account
    1026: SET:SaveAmount: $$SignedAmount:##SaveAmount ;

    1036: Start Block
    ;1037 : msgbox : ##Account : ##SaveAmount
    1045 : SET VALUE : Amount : $$TgtObject:##SaveAmount
    1055 : SET VALUE : ISDEEMEDPOSITIVE : ##DeemedVal
    1065 : SET VALUE : ISPARTYLEDGER : "No"
    1075 : SET VALUE : ISLASTDEEMEDPOSITIVE: "No"
    1076: END BLOCK
    1085: SET TARGET : ..
    1095: End IF

    1105 : SET VALUE : PersistedView : ##SVViewName

    1115 : CREATE TARGET

    2005 : Msg Box : "Status" : " Vouchers created!! "
    2015 : RETURN
     

    Attached Files:

    • Rent.png
      Rent.png
      File size:
      14.5 KB
      Views:
      108


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Code:
    Giving you an example..............
    
    [System : Formula]
    InvNettTotal : $NettInvTotal + $IGSTAmt + $CGSTAmt +$SGSTAmt
    InvoiceRound : $$Round:mad:@InvNettTotal:2
    
    RoundOffDiff : @@InvNettTotal - @@InvoiceRound
    
    ..... then use @@RoundOffDiff in your respective field
    
     


  3. ASHTAMOORTHY

    ASHTAMOORTHY New Member


    Thank you for your suggstion sir,

    But Problem still persists sir,

    In the function, Roundoff Ledger Entry Section, When I set Deemed Value Set to "Yes".. Voucher will save.. But the invoice Total Amount Showing the Added Difference amount even if it is Roundoff debit entry.. Since it is an automated voucher creation through the function.. how to set the field value?

    I checked the XML output of both type entries ..
    when i changed .. the Roundoff Amount to (-)0.08.. the xml lokks likes this
    Deemed Value is NO

    <LEDGERNAME>Roundoff</LEDGERNAME>
    <GSTCLASS/>
    <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
    <LEDGERFROMITEM>No</LEDGERFROMITEM>
    <REMOVEZEROENTRIES>No</REMOVEZEROENTRIES>
    <ISPARTYLEDGER>No</ISPARTYLEDGER>
    <ISLASTDEEMEDPOSITIVE>No</ISLASTDEEMEDPOSITIVE>
    <ISCAPVATTAXALTERED>No</ISCAPVATTAXALTERED>
    <ISCAPVATNOTCLAIMED>No</ISCAPVATNOTCLAIMED>
    <AMOUNT>-0.08</AMOUNT>


    But i cannot Set Deemed Value to "No" through the function
    then Tally raise an error
    Voucher totals
    do not match!
    Dr: 2,780.00 Dr
    Cr: 2,780.16 Cr
    Diff: 0.16 Cr


    Please help me....
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    well I do not have much knowledge about functions...........

    but logically I will tell you this........

    In your function you should have two rundoff line....one for "isdeemedpositive" and another for "NOT isdeemedpositive"

    then you apply condition.....
    If A-B > 0 then +roundoff else 0 in "isdeemedpositive"
    If A-B < 0 then (-)roundoff else 0 in "NOT isdeemedpositive" ..... or vice versa... I do not know which is which.
     


  5. ASHTAMOORTHY

    ASHTAMOORTHY New Member


    OK.. Sir,

    Thank you for your kind attention and helping mentality...


    While creating Voucher through Tally Account Voucher Creation.. entering negative Value will minus from the total..

    Hope any other experts will run this code and give me a solution...
     


  6. Johar

    Johar Member


    100 : Insert collection object : Ledger Entries
    110 : Set value : Ledger Name : <<<<roundoff ledger name >>>
    120 : set value : IsDeemedPositive : No
    130 : set value : Amount : ($$round:<<roundoffamount>>>:1 - <<roundoffamount>>>)
    140 : set target : ..

    150 : insert collection object : Ledger Entries
    160 : set target : Ledger Entries[1]
    170 : set value : Amount : $$Round:<<roundoffamount>>>:1
    180 : set target : Bill Allocation[1]
    190 : set value : Amount : -$$Round:<<roundoffamount>>:1
    200: set Target : ...
     


  7. Johar

    Johar Member


    Try out above code it will help <<roundoffledger>> and <<roundoffamount >> enter your ledger name and round off amount field
     


  8. ASHTAMOORTHY

    ASHTAMOORTHY New Member


    Thank you.. Sir,

    Will check it..
    Thank you
     


  9. ASHTAMOORTHY

    ASHTAMOORTHY New Member


    After adding these two entries, it shows an error evaluation failed... (Bill allocations)
     


  10. Jeevan Pendhari

    Jeevan Pendhari New Member




  11. hi,
    did you found your solutions, I need a solution on the same case for discount on invoice badly. Please let me know if you have solution on this issue. Thank you
     


Share This Page