Multiplication of $BasicRateOfExcise with $billedqty and get the value in sales invoice

Discussion in 'General Discussions' started by dfas, Dec 18, 2023.

    
  1. dfas

    dfas New Member


    Hello experts,
    I am new in TDL code learning.
    I am trying to learn by changing the old codes.
    1) I have modified the below code and I want the multiplication of $BasicRateOfExcise with $billedqty in the IE Points field
    But I am not confused where should i put formula.
    2) I want to make this field invisible along with field title in printing the invoice when there is no value put in these fields
    Please check and help me in this regard :)

    I have colored the area which needs correction

    [#Form: Comprehensive Invoice]
    Option: Global Invoice : @@IsSales
    [#Form: Simple Printed Invoice]
    Option: Global Invoice : @@IsSales
    [!Form : Global Invoice]
    Delete : Parts
    Delete : Bottom Parts
    Delete : PageBreak
    Space Bottom: 0
    Space Left : 0.25 inch
    Space Right : 0.1 inch
    Add : Parts : Global Invoice Top Part
    Add : Parts : Global Invoice Body Part
    Add : Bottom Parts : Global Invoice Bottom Part
    [Part: Global Invoice Top Part]
    Lines : Global VCHDate, Global RefNo, Global PartyName, Global PartyAdd1, +
    Global ColumnTitles
    Repeat : Global PartyAdd1 : PartyAddress

    [Line: Global VCHDate]
    Fields : Global VCHNo
    Right Fields: Global VCHDate
    Local: Field: Short Prompt : Set as : ""
    Local: Field: Simple Prompt : Set as : ""

    [Field: Global VCHDate]
    Use : Short Date Field
    Set as : $Date
    Width: 45% page

    [Field: Global VCHNo]
    Use : Short Name Field
    Set as : $VoucherNumber
    Indent: 2
    [Line: Global RefNo]

    Field: vchref1
    [Field: VCHRef1]
    Use : VCH SmallTitle
    Storage : Reference
    Set as : If ($$IsEmpty:$Reference AND (@@IsDelNote OR @@IsRcptNote)) OR ((@@IsOrderVch OR @@IsJobOrderVouchers) And $OrderLineStatus) Then @VchOrderRef Else $$Value
    VchOrderRef : If $$IsSysName:mad:Locval Then "" Else @Locval
    Locval : IF $$IsEmpty:$InventoryEntries[1].BatchAllocations[1].OrderNo Then $InventoryEntries[1].OrderNo Else $InventoryEntries[1].BatchAllocations[1].OrderNo
    Set Always : Yes
    Inactive : NOT @@VchHasRefVchType AND NOT (@@IsVchOrderVch OR @@IsVchJobOrderVouchers)
    [Line: Global PartyName]
    Fields : Global PartyName


    [Field: Global PartyName]
    Use : short Name Field
    Set as : $basicbuyerName
    Full Width: Yes
    Align: Center
    Width: 99% page
    Print FG: WHITE
    Print BG: RED
    [Line: Global PartyAdd1]
    Fields : Global PartyAdd1
    [Field: Global PartyAdd1]
    Use : Name Field
    Set as : $Address
    Align: Center
    Full Width: Yes
    Print FG: WHITE
    Print BG: GREY
    [Line: Global Column Titles]
    Use : IE Details
    Local: Field: Default : Lines : 1
    Local: Field: Default : Type : String
    Local: Field: Default : Style : Normal
    Local: Field: IE SrNo : Set as : "No."
    Local: Field: IE SiName : Set as : "Name"
    Local: Field: IE Qty : Set as : "Qty"
    Local: Field: IE POINTS : SET AS : "Points"
    Local: Field: IE Rate : Set as : "Rate"
    Invisible :FIELD: If @@WithDiscount OR @@AcctsInvoice
    Local: Field: IE Discount : Set as : "."
    Local: Field: IE Discount1 : Set as : ".."
    Local: Field: IE Amount : Set as : "Amount"
    Border : Column Titles
    [Part: Global Invoice Body Part]
    Parts : IE Details, LE Details
    Vertical : Yes
    Scroll : Vertical
    Common Border: Yes
    [Part: IE Details]
    Lines : IE Details
    Repeat : IE Details : Inventory Entries
    Total : IE Qty, IE POINTS, IE Amount
    [Line: IE Details]
    Fields :IE SRNO,IE SiName
    Right Fields:IE Qty, IE Rate,IE POINTS,IE Discount1,IE Discount, IE Amount
    Border: THIN BOX
    [Field: IE SrNo]
    Use : DSP PageNo
    Set as : $$Line
    Width : 1
    Border: THIN RIGHT


    [Field: IE SIName]
    Use : short Name Field
    Set as : $StockItemName

    FullWIdth : Yes
    Print FG: deep RED
    Border: THIN RIGHT

    [Field: IE Qty]
    Use : Qty Primary Field
    Set as : $BilledQty

    Align : Right
    Border: THIN RIGHT
    [Field: IE Rate]
    Use : Rate Field
    Set as : $Rate
    Border: THIN RIGHT
    [Field: IE POINTS]
    Use: number field
    Set as : $$AsAmount:$BasicRateOfExcise*$billedqty
    Border: THIN RIGHT

    Invisible : IF (@@VchIsPurcInvoice) Then Yes Else NOT @@WITHDISCOUNT
    Inactive : $$IsEnd:$StockItemName OR @@NoBaseUnits OR NOT (@@IsInvoice OR @@RejInvoice) OR (NOT $$IsDiscountsOn AND NOT $HasDiscounts)

    Skip On : @HasInvAlloc
    Width: 4
    align: centre
    Format: "no comma, no zero,NO percentage"
    Print BG: green
    Print FG: white

    [Field: IE Discount]
    Use: number field
    Set as : $$AsAmount:$Discount


    Invisible : On
    Inactive : $$IsEnd:$StockItemName OR @@NoBaseUnits OR NOT (@@IsInvoice OR @@RejInvoice) OR (NOT $$IsDiscountsOn AND NOT $HasDiscounts)
    Skip On : @HasInvAlloc
    Width: 2
    Format: "no comma, no zero,percentage"

    [Field: IE Discount1]
    Use: number field
    Set as : $$AsAmount:$TlyTrngDiscount

    Invisible : Yes
    Inactive : $$IsEnd:$StockItemName OR @@NoBaseUnits OR NOT (@@IsInvoice OR @@RejInvoice) OR (NOT $$IsDiscountsOn AND NOT $HasDiscounts)
    Skip On : @HasInvAlloc
    Width: 2
    Format: "no comma, no zero,no percentage"

    [Field: IE Amount]
    Use : Amount Field
    Set as : $Amount


    Format : "NoComma, NoZero"
    Border: THIN LEFT
    [Part: LE Details]
    Lines : LE Details
    Repeat : LE Details : Ledger Entries
    Scroll : Vertical

    [Line: LE Details]
    Use : IE Details
    Local: Field: IE SrNo : Set as : ""
    Local: Field: IE SiName : Set as : $LedgerName
    Local: Field: IE Qty : Set as : ""
    Local: Field: IE Rate : Set as : $$String:$RateOfInvoiceTax + "%"
    Local: Field: IE Amount : Set as : $Amount
    Local: Field: IE SiName : Align : Right
    Local: Field: IE Qty : Format : "NoZero"
    Local: Field: IE Rate : Inactive : $RateOfInvoiceTax = 0
    Local: Field: IE Rate : Type : String
    Remove if : $LedgerName = $PartyLedgerName
    ;; Empty attribute is used to avoid printing of party ledger name in the invoice
    [Part: Global Invoice Bottom Part]
    Lines : Global Total Line, Global AmtInWords, Global narration
    [Line: Global Total Line]
    Use : IE Details
    Local: Field: Default : Style : Normal Bold
    Local: Field: IE SrNo : Set as : ""
    Local: Field: IE SiName : Set as : "Totals"
    Local: Field: IE Qty : Set as : $$Total:IEQty
    Local: Field: IE Rate : Set as : ""
    Local: Field: IE POINTS : Set as : $$Total:IEPOINTS
    Local: Field: IE Amount : Set as : $$Total:IEAmount
    Border : Totals
    [Line: Global AmtInWords]
    Fields : Short Prompt, Global AmtInWords
    Local: Field: Short Prompt : Set as : "Amount in words : "
    [Field: Global AmtInWords]
    Use : Name Field
    Set as : $$InWords:$Amount + " Only"
    FullWidth : Yes
    Style : Small

    [Line: Global narration]
    Right Fields: Global narration
    Space Top : 2
    [Field: Global narration]
    Use: Narration Field
    Set as : $narration
    FullWidth : Yes
    Style : Small
     


  2. NIRMALGHORAWATIN

    NIRMALGHORAWATIN New Member


    Your
    Code:
    [Field: IE POINTS]
    Use: number field
    Set as : $$AsAmount:$BasicRateOfExcise*$billedqty
    Border: THIN RIGHT
    You are using Number Field Type, Amount Field Type & Quantity field type in a single field.
    Try to store the values in Local variables:
    Code:
    [Field: IE POINTS]
    Use: Amount Field
    BasicRateOfED: $$AsAmount:$BasicRateOfExcise
    BillQty: $$AsQty:$BilledQty
    Set as: (@BasicRateOfED * @BillQty) 
    
     


Share This Page