Hello All, I want to Create one TDL for Purchase Order to Purchase Bill. In these TDL I want give the Multiple Discount. (% base and Amount Base). For Example, In Purchase Order Item Name : Item A --------------------------------------------------------------------------------- ItemName Qty Rate Disc% DiscAmt Amount --------------------------------------------------------------------------------- Item A 10 100 10 90 900 These will Also Print in Purchase Order. Please Help me.
Here I am share the Code. Discount Amt not display in main screen and Not Display in Print Level. Please Help me Friends. ;;-------------------------------------------------------------- ;; Discount Amt Field At Voucher Level ;;-------------------------------------------------------------- [#Line: EI ColumnOne] Add : Option : Disc EI ColumnOne : @@IsPurcOrder [!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 @@IsPurcOrder ;; OR If (@@IsJobOrderOut OR @@IsJobOrderIn) Then Yes Else NOT @@Withdiscount Skip : Yes Fixed : Yes [#Line: EI ColumnTwo] Add : Option : Disc EI ColumnOne1 : @@IsPurcOrder [!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 : @@IsPurcOrder [!Line: Disc EI ColumnName] ;; Optional definition Add : Right Fields : After : VCH DiscTitle : VCH DiscAmtTitle [#Line: VCHBATCH ColumnTwo] Add : Option : Disc EI ColumnName1 : @@IsPurcOrder [!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 : @@IsPurcOrder [!Line: Disc EI ColumnName2] ;; Optional definition Add : Right Fields : After : VCH discount : VCH GYAMT [Field: VCH GYAMT] Use : Number Field Width : @@VCHdiscountWidth Align : Right Style : Normal Bold Storage : Gyamt Set always : Yes Skip : Yes Format : "NoPercentage,NoZero" Setval :If Not $$IsFieldEdited Then $().BATCHGYAMT Else $$Value ;; if @HasInvAlloc then $BATCHGYAMT else "" [#Line: STKVCH Batch2] Add : Option : Disc EI ColumnName4 : @@IsPurcOrder [!Line: Disc EI ColumnName4] ;; Optional definition Add : Right Field : After : VCHBATCH discount : VCHBATCH GYAMT [Field: VCHBATCH GYAMT] Use : Number Field Width : @@VCHdiscountWidth Style : Small Bold Align : Right Storage : BATCHGYAMT Set always : Yes 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) 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 @@IsPurcOrder ;;If (@@IsJobOrderOut OR @@IsJobOrderIn) Then Yes Else NOT @@Withdiscount IsBilledQtyEdited : (($$IsValidPriceLevel:$PriceLevel)and (@@InvoiceinCreate) and ($$IsFieldEdited:VCHBATCHBilledQty) and $$IsEmptyTablediscount AND (Not ##ICFGEditAll OR (@@IsPrevPLdiscount))) Tablediscount : $$AltTable:VCHBATCHTrack:VCHBATCHOrder:$GyAmt [System: Formula] GyAmt : if Not @@IsPurcOrder OR @@IsOutwardType then $GyAmt else @@StdGYAMT StdGYAMT : If Not $$IsValidPriceLevel:$PriceLevel Then $GyAmt Else + If $$IsEmpty@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 ;;-------------------------------------------------------------- ;; Discount Amt Field At Print Level ;;-------------------------------------------------------------- [#Line: EXPINV Column1] Add : Right Fields : After : EXPINV DiscTitle : EXPINV DisAmtTitle Local : Field : EXPINV DisAmtTitle : Delete : Border [Field : EXPINV DisAmtTitle] Use : NumberTitleField Info : $$LocaleString:"Disc Amt" Border : Thin Left Align : Centre Width : 5 Style : Small Invisible : Not @@IsPurcOrder ;;If (@@IsJobOrderOut OR @@IsJobOrderIn OR (@@IsSales And (@@AcctsInvoice OR @@AcctsInvoiceMfgr))) Then Yes Else (NOT @@WithDiscount OR (NOT @@InvWithRate AND NOT @@InvWithAmt)) [#Line: EXPINV Column2] Add : Right Fields : After : EXPINV DiscTitle : EXPINV DisAmtTitle Local : Field : EXPINV DisAmtTitle : Info : "" [#Line: EXPINV InvDetails] Add : Right Fields : After : EXPINV Discount : EXPINV DiscountAmt [Field: EXPINV DiscountAmt] Use : Number Field Align : Right Style : Small Set as : $GyAmt Width : 5 ;; Border : Thin Left Format : "NoZero,Percentage" Invisible : Not @@IsPurcOrder ;;If (@@IsJobOrderOut OR @@IsJobOrderIn OR (@@IsSales And (@@AcctsInvoice OR @@AcctsInvoiceMfgr))) Then Yes Else (NOT @@WithDiscount OR (NOT @@InvWithRate AND NOT @@InvWithAmt)) [#Line: EXPINV BatchName] Add : Right Fields : After : EXPINV AccDiscount : EXPINV AccDiscountAmt [Field: EXPINV AccDiscountAmt] Use : Number Field Border : Thin Left Width : 5 Invisible : Not @@IsPurcOrder ;;If (@@IsJobOrderOut OR @@IsJobOrderIn OR (@@IsSales And (@@AcctsInvoice OR @@AcctsInvoiceMfgr))) Then Yes Else (NOT @@WithDiscount OR (NOT @@InvWithRate AND NOT @@InvWithAmt))
I get success with following code : ;;-------------------------------------------------------------- ;; Discount Amt Field At Voucher Level ;;-------------------------------------------------------------- [#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 :if $$IsMultiGodownOn then Yes else No Format : "NoPercentage,NoZero" Set as : $$CollectionField:$BATCHGYAMT:First:BatchAllocations ;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 [System: Formula] CalcedAmt : (($Rate * $BilledQty * (100 - $Discount)) / 100) [#Field: Vch BatchValue] Set as : @MyFormula2 My formula : If @@NoBaseUnits Then $$Value Else @@CalcedAmt My Formula1 : $BATCHGYAMT MyFormula2 : @MyFormula-@MyFormula1 [System : Udf] GyAmt : Number : 2003 BATCHGYAMT : Number : 2004 [#Field: VCH NrmlValue] Set as MyFormula2 My formula : If @@NoBaseUnits Then $$Value Else @@CalcedAmt My Formula1 : $Gyamt MyFormula2 : @MyFormula-@MyFormula1 [#Field: VCHBATCH Rate] NrmlCalcRate:$$value [#Field: VCH Rate] NrmlCalcRate: $$value