DOUBLE DISCOUNT

Discussion in 'Free Source Codes' started by akj_om, May 5, 2018.

    
  1. akj_om

    akj_om New Member


    I GOT THIS DOUBLE DISCOUNT CODE FROM FORUM BUT ITS NOT WORKING ITS NOT CALCULATING TOTAL AMOUNT AND NITHER ITS SHOWING SECOND DISCOUNT COLUMN IN INVOICE PRINTING PLZ RECTIFY THE CODE THANKS IN ADVANCE


    [#Line: EI ColumnOne]

    Add : Option : Disc EI ColumnOne : @@IsSales

    [!Line: Disc EI ColumnOne] ;; Optional definition

    Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle

    [Field: VCH DiscAmtTitle]

    Width : @@VCHdiscountWidth
    Setas : $$LocaleString:"Disc Amt"
    Style : Small
    Align : Centre
    ;;The field is invisible in case of job order vouchers else based on the withdscount condition it becomes invisible
    Invisible :NOT @@IsSales ;; OR If (@@IsJobOrderOut OR @@IsJobOrderIn) Then Yes Else NOT @@Withdiscount
    Skip : yes
    Fixed : Yes

    [#Line: EI ColumnTwo]

    Add : Option : Disc EI ColumnOne1 : @@IsSales

    [!Line: Disc EI ColumnOne1] ;; Optional definition

    Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle

    Local : Field : VCH DiscAmtTitle : Setas: ""



    [#Line: VCHBATCH ColumnOne] ;; Column Title in the Batch Subform

    Add : Option : Disc EI ColumnName : @@IsSales

    [!Line: Disc EI ColumnName] ;; Optional definition

    Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle


    [#Line: VCHBATCH ColumnTwo]

    Add : Option : Disc EI ColumnName1 : @@IsSales

    [!Line: Disc EI ColumnName1] ;; Optional definition

    Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle
    Local : Field : VCH DiscAmtTitle : Setas: ""

    [#Line: EI InvInfo]

    Add : Option : Disc EI ColumnName2 : @@IsSales

    [!Line: Disc EI ColumnName2] ;; Optional definition

    Add : Right Fields : before : VCH value : VCH GYAMT


    [Field: VCH GYAMT]

    Use : Number Field
    Width : @@VCHdiscountWidth
    Align : Right
    Style : Normal Bold
    Storage : Gyamt
    Set always : Yes
    Skip : No
    Format : "NoPercentage,NoZero"
    Setval :If Not $$IsFieldEdited Then $().BATCHGYAMT Else $$Value ;; if @HasInvAlloc then $BATCHGYAMT else ""
    [#Line: STKVCH Batch2]

    Add : Option : Disc EI ColumnName4 : @@IsSales

    [!Line: Disc EI ColumnName4] ;; Optional definition

    Add : Right Fields : After : VCHBATCH discount : VCHBATCH GYAMT


    [Field: VCHBATCH GYAMT]

    Use : Number Field
    Width : @@VCHdiscountWidth
    Style : Normal Bold
    Align : Right
    Storage : BATCHGYAMT
    Skip On : If @@IsExciseSupplementaryInv Then $$Line > 1 OR @@NoBaseUnits OR $$IsEmpty:#VCHBatchOrigBilledQt Else +
    $$Line > 1 OR $$IsEmpty:$BilledQty OR (NOT @@DoEditAll AND $$IsValidPriceLevel:$PriceLevel AND @@StdVchFldSkipCond)
    Inactive : If @@IsExciseSupplementaryInv Then @@NoBaseUnits OR $$IsEmpty:#VCHBatchOrigBilledQty Else +
    @@NoBaseUnits OR @@BatchAllocBreak OR NOT (@@IsInvoice OR @@RejInvoice) OR (NOT $$IsdiscountsOn AND NOT $Hasdiscounts)

    Set always : Yes

    Format : "NoPercent,NoZero"

    Set as : if $BilledQty = 0 then 0 else +
    if $$Line > 1 then $GyAmt else +
    if ($$Line = 1) AND NOT $$IsEmpty:$$AltTable:VCHBATCHTrack:VCHBATCHOrder:$GyAmt AND ($$IsEmpty:$$Value OR $$IsFieldEdited:VCHBATCHTrack OR $$IsFieldEdited:VCHBATCHOrder) then $$AltTable:VCHBATCHTrack:VCHBATCHOrder:$GyAmt else +
    if @IsBilledQtyEdited then @@StdGYAMT else +
    if $$IsValidPriceLevel:$PriceLevel and $BatchRate=0 then @@StdGYAMT else +
    if $$IsValidPriceLevel:$PriceLevel and $$Isempty:$$Value and $BatchRate!=0 then $$Value else +
    if $$InAlterMode OR $$IsFieldEdited then $$Value else +
    if $$IsEmpty:$GyAmt then @@StdGYAMT else $GyAmt

    ;;discount field is invisible in case of job work out/in orders else based on with discount condition
    Invisible : NOT @@IsSales ;;If (@@IsJobOrderOut OR @@IsJobOrderIn) Then Yes Else NOT @@Withdiscount
    IsBilledQtyEdited : (($$IsValidPriceLevel:$PriceLevel)and (@@InvoiceinCreate) and ($$IsFieldEdited:VCHBATCHBilledQty) and $$IsEmpty:mad:Tablediscount AND (Not ##ICFGEditAll OR (@@IsPrevPLdiscount)))
    Tablediscount : $$AltTable:VCHBATCHTrack:VCHBATCHOrder:$GyAmt



    [System: Formula]

    GyAmt : if Not @@IsSales OR @@IsOutwardType then $GyAmt else @@StdGYAMT
    StdGYAMT : If Not $$IsValidPriceLevel:$PriceLevel Then $GyAmt Else +
    If $$IsEmpty:mad:@PriceLeveldiscount Then $GyAmt Else @@PriceLeveldiscount


    [#System: Formula] ;; Recalculate the following Formula rest will be taken care by Tally

    CalcedAmt : ($Rate * $BilledQty) - ($Batchdiscount + $BATCHGYAMT)
    NrmlAmount : ($BilledQty * $Rate) - ($Batchdiscount + $BATCHGYAMT)



    [System : Udf]

    GyAmt : Number : 2003
    BATCHGYAMT : Number : 2004
     


  2. HVPatel

    HVPatel Active Member


    Recheck your TDL code with Tally Developer, Compile it, to find out errors if any. and rectify it.
     


  3. akj_om

    akj_om New Member


    I AM NEW TO TDL CAN YOU PLEASE HELP TO RECTIFY CODE AND MAKE A TDL FOR DOUBLE DISCOUNT PRINTING IN INVOICE
     



  4. NOT WORKING DISC AMOUNT NOT LESS


    [#Line: EI ColumnOne]

    Add : Option : Disc EI ColumnOne : @@IsSales

    [!Line: Disc EI ColumnOne] ;; Optional definition

    Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle

    [Field: VCH DiscAmtTitle]

    Width : @@VCHdiscountWidth
    Setas : $$LocaleString:"Disc Amt"
    Style : Small
    Align : Centre
    ;;The field is invisible in case of job order vouchers else based on the withdscount condition it becomes invisible
    Invisible :NOT @@IsSales ;; OR If (@@IsJobOrderOut OR @@IsJobOrderIn) Then Yes Else NOT @@Withdiscount
    Skip : yes
    Fixed : Yes

    [#Line: EI ColumnTwo]

    Add : Option : Disc EI ColumnOne1 : @@IsSales

    [!Line: Disc EI ColumnOne1] ;; Optional definition

    Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle

    Local : Field : VCH DiscAmtTitle : Setas: ""



    [#Line: VCHBATCH ColumnOne] ;; Column Title in the Batch Subform

    Add : Option : Disc EI ColumnName : @@IsSales

    [!Line: Disc EI ColumnName] ;; Optional definition

    Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle


    [#Line: VCHBATCH ColumnTwo]

    Add : Option : Disc EI ColumnName1 : @@IsSales

    [!Line: Disc EI ColumnName1] ;; Optional definition

    Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle
    Local : Field : VCH DiscAmtTitle : Setas: ""

    [#Line: EI InvInfo]

    Add : Option : Disc EI ColumnName2 : @@IsSales

    [!Line: Disc EI ColumnName2] ;; Optional definition

    Add : Right Fields : before : VCH value : VCH GYAMT


    [Field: VCH GYAMT]

    Use : Number Field
    Width : @@VCHdiscountWidth
    Align : Right
    Style : Normal Bold
    Storage : Gyamt
    Set always : Yes
    Skip : No
    Format : "NoPercentage,NoZero"
    Setval :If Not $$IsFieldEdited Then $().BATCHGYAMT Else $$Value ;; if @HasInvAlloc then $BATCHGYAMT else ""
    [#Line: STKVCH Batch2]

    Add : Option : Disc EI ColumnName4 : @@IsSales

    [!Line: Disc EI ColumnName4] ;; Optional definition

    Add : Right Fields : After : VCHBATCH discount : VCHBATCH GYAMT


    [Field: VCHBATCH GYAMT]

    Use : Number Field
    Width : @@VCHdiscountWidth
    Style : Normal Bold
    Align : Right
    Storage : BATCHGYAMT
    Skip On : If @@IsExciseSupplementaryInv Then $$Line > 1 OR @@NoBaseUnits OR $$IsEmpty:#VCHBatchOrigBilledQt Else +
    $$Line > 1 OR $$IsEmpty:$BilledQty OR (NOT @@DoEditAll AND $$IsValidPriceLevel:$PriceLevel AND @@StdVchFldSkipCond)
    Inactive : If @@IsExciseSupplementaryInv Then @@NoBaseUnits OR $$IsEmpty:#VCHBatchOrigBilledQty Else +
    @@NoBaseUnits OR @@BatchAllocBreak OR NOT (@@IsInvoice OR @@RejInvoice) OR (NOT $$IsdiscountsOn AND NOT $Hasdiscounts)

    Set always : Yes

    Format : "NoPercent,NoZero"

    Set as : if $BilledQty = 0 then 0 else +
    if $$Line > 1 then $GyAmt else +
    if ($$Line = 1) AND NOT $$IsEmpty:$$AltTable:VCHBATCHTrack:VCHBATCHOrder:$GyAmt AND ($$IsEmpty:$$Value OR $$IsFieldEdited:VCHBATCHTrack OR $$IsFieldEdited:VCHBATCHOrder) then $$AltTable:VCHBATCHTrack:VCHBATCHOrder:$GyAmt else +
    if @IsBilledQtyEdited then @@StdGYAMT else +
    if $$IsValidPriceLevel:$PriceLevel and $BatchRate=0 then @@StdGYAMT else +
    if $$IsValidPriceLevel:$PriceLevel and $$Isempty:$$Value and $BatchRate!=0 then $$Value else +
    if $$InAlterMode OR $$IsFieldEdited then $$Value else +
    if $$IsEmpty:$GyAmt then @@StdGYAMT else $GyAmt

    ;;discount field is invisible in case of job work out/in orders else based on with discount condition
    Invisible : NOT @@IsSales ;;If (@@IsJobOrderOut OR @@IsJobOrderIn) Then Yes Else NOT @@Withdiscount
    IsBilledQtyEdited : (($$IsValidPriceLevel:$PriceLevel)and (@@InvoiceinCreate) and ($$IsFieldEdited:VCHBATCHBilledQty) and $$IsEmpty:mad:Tablediscount AND (Not ##ICFGEditAll OR (@@IsPrevPLdiscount)))
    Tablediscount : $$AltTable:VCHBATCHTrack:VCHBATCHOrder:$GyAmt



    [System: Formula]

    GyAmt : if Not @@IsSales OR @@IsOutwardType then $GyAmt else @@StdGYAMT
    StdGYAMT : If Not $$IsValidPriceLevel:$PriceLevel Then $GyAmt Else +
    If $$IsEmpty:mad:@PriceLeveldiscount Then $GyAmt Else @@PriceLeveldiscount


    [#System: Formula] ;; Recalculate the following Formula rest will be taken care by Tally

    CalcedAmt : ($Rate * $BilledQty) - ($Batchdiscount + $BATCHGYAMT)
    NrmlAmount : ($BilledQty * $Rate) - ($Batchdiscount + $BATCHGYAMT)



    [System : Udf]

    GyAmt : Number : 2003
    BATCHGYAMT : Number : 2004[/QUOTE]
     


  5. shiakh ismail

    shiakh ismail New Member



  6. dkp_jal

    dkp_jal Member


    Check This for Double Discount. Its Working.


    Code is attached on Youtube Video Below Section.
     
    Last edited: Apr 19, 2020


  7. dfas

    dfas New Member


    i want to remove the % symbol from printout.
    can anybody help me.
     


Share This Page