Dear Admin / TDL Experts, I have done tdl for automatic generate purchase order from sales entry. It will create that Voucher and capture all details except inventory details.Particulary, billedqty not captured. it is showing error in my function. I will try to this code, i did not got it. Please help me. Advance thanks and Regards Ribu ;; Below this TDL Snipet, [#Part : DBL Line Narration] Add:Line : Po Genrate Line [Line : Po Genrate Line] Field : Long Prompt,Po Genrate Fld Local : Field : Long Prompt : Info : "Generate Purchase Order ?" Local : Field : Long Prompt : Color : Red Local : Field : Long Prompt : Style : Normal Italic Invisible : (NOT @@IsSales) [Field : Po Genrate Fld] Use : Logical Field Storage : GenAutoPo SubForm : POSubForm : $$Value ;;Skip : $$InCreateMode [System : Udf] GenAutoPo : Logical : 1176 [Report : POSubForm] Form : POSubForm [Form : POSubForm] Space Top : 3% Page Space Bottom : 3% Page Space Right : 2% Page Space Left : 2% Page Height : 70% Page Width : 70% Page Horizontal Align : Center BackGround : White Part : PodetailPart On : Form Accept : Yes : Form Accept On : Form Accept : Yes : CALL : AutoPOCreate [Part : PodetailPart] Line : FormSubtitle,PodetailPart Local : Field : FormSubtitle : Info :"PO Details" [Line : PodetailPart] Right Field : Short Prompt,PODateFld Local : Field : Short Prompt : Set as :"PO.Date :" [Field : PODateFld] Use : Short Date Field Storage : Date Set as : $Date [Function: AutoPOCreate] ;; Definition Block Variable : Counter : Number FETCH OBJECT : Voucher : ($$SPrintF@VCHMasterID:##pVchId) : InventoryEntries.*, LedgerEntries.* ;; Procedural Block 00 : SET FILE LOG ON 01 : SET : SVViewName : $$SysName:InvVchView 02 : QUERYBOX : "Create Purchase Order ?":Yes:No 03 : IF : $$LastResult 04 : NEW OBJECT : VOUCHER 05 : SET VALUE : Date : $Date ;; ##InputDate1 06 : SET VALUE : Reference : $VoucherNumber 660 : SET VALUE : PartyLedgerName : $PartyLedgerName ;;711 : SET VALUE : Is Deemed Positive : "yes" ;;12 : Set Value : ISPARTYLEDGER : Yes 07 : SET VALUE : VoucherTypeName : "Purchase Order" 08 : SET Value : IsInvoice : Yes ; 19e : WALK Collection : PartyAddress ; 19g : INSERT COLLECTION OBJECT : Address ; 19i : SET VALUE : Address : $Address ; 19j : Set Target : .. ; 19k : End Walk 09 : INSERT COLLECTION OBJECT : Ledger Entries 10 : SET VALUE : LedgerName : $LedgerName 710 : SET VALUE : Is Deemed Positive : "yes" ;;12 : Set Value : ISPARTYLEDGER : Yes 120 : SET VALUE : Amount : $Amount*-1 140 : SET TARGET : .. 700 : SET : Counter : 1 810 : WALK COLLECTION : All Inventory Entries ;;150 : INSERT COLLECTION OBJECT : INVENTORY ENTRIES 320 : IF : ##Counter = 1 430 : SET TARGET : All Inventory Entries ;;[1] 340 : ELSE: 350 : INSERT COLLECTION OBJECT : All Inventory Entries 360 : ENDIF 160 : SET VALUE : StockItemName : $StockItemName 170 : SET VALUE : IsDeemedPositive : No ;;171 : SET VALUE : ActualQty : ($$TgtObject$$AsQty:"100")) * -1 177 : SET VALUE : BilledQty : $$AsQty:"10" ;;$$TgtObject:$$Number:$BilledQty ;;($$TgtObject$$AsQty:"100")) * -1 ;;173 : SET VALUE : Rate : ($$TgtObject$$AsRate:$Rate)) 180 : SET VALUE : Amount : $Amount 190 : INSERT COLLECTION OBJECT : BATCH ALLOCATIONS 200 : SET TARGET : BatchAllocations ;; [1] 201 : SET VALUE : OrderDueDate : $$DateRange:"10 Days"$$TgtObject:$Date):True 210 : SET VALUE : GodownName : $GodownName ;; "Main Location" 220 : SET VALUE : BatchName : $BatchName ;; "Test" 230 : SET VALUE : OrderNo : $OrderNo ;; "Test" ;;240 : SET VALUE : ActualQty : $$TgtObject:$BilledQty ;;($$TgtObject$$AsQty:"100")) * -1 255 : SET VALUE : BilledQty : $$TgtObject:$BilledQty ;;($$TgtObject$$AsQty:"100")) * -1 ;;260 : SET VALUE : Rate : ($$TgtObject$$AsRate:$Rate)) 270 : SET VALUE : Amount : $Amount ;; ($$TgtObject$$AsAmount:$Amount)) 280 : SET TARGET : ... 330 : INCREMENT : Counter 33 : End Walk ; 13 : INSERT COLLECTION OBJECT : BillAllocations ; 14 : SET VALUE : BillType : $$SysName:NewRef ; 15 : SET VALUE : Name : $VoucherNumber ; 16 : SET VALUE : Amount : $Amount ; 17 : SET TARGET : .. 19 : INSERT COLLECTION OBJECT : Accounting Allocations 110 : SET VALUE : LedgerName : "PURCHASE" 111 : SET VALUE : Is Deemed Positive : "No" ;;112 : Set Value : ISPARTYLEDGER : No 113 : SET VALUE : Amount : $Amount 117 : SET TARGET : ... 34 : SET VALUE : PersistedView : ##SVViewName 35 : CREATE TARGET 36 : ENDIF 37 : Return ;; END
I WILL CORRECT THE CODE BUT NOT ALLOCATE ON ACCOUNTING ALLOCATIONS PART PLS HELP ME [#Part : DBL Line Narration] Add:Line : Po Genrate Line [Line : Po Genrate Line] Field : Long Prompt,Po Genrate Fld Local : Field : Long Prompt : Info : "Generate Purchase Order ?" Local : Field : Long Prompt : Color : Red Local : Field : Long Prompt : Style : Normal Italic Invisible : (NOT @@IsSales) [Field : Po Genrate Fld] Use : Logical Field Storage : GenAutoPo SubForm : POSubForm : $$Value ;;Skip : $$InCreateMode [System : Udf] GenAutoPo : Logical : 1176 [Report : POSubForm] Form : POSubForm [Form : POSubForm] Space Top : 3% Page Space Bottom : 3% Page Space Right : 2% Page Space Left : 2% Page Height : 70% Page Width : 70% Page Horizontal Align : Center BackGround : White Part : PodetailPart On : Form Accept : Yes : Form Accept On : Form Accept : Yes : CALL : AutoPOCreate [Part : PodetailPart] Line : FormSubtitle,PodetailPart Local : Field : FormSubtitle : Info :"PO Details" [Line : PodetailPart] Field :mediumprompt;,cstnamefield Right Field : Short Prompt,PODateFld Local : Field : Short Prompt : Set as :"PO.Date :" [Field : PODateFld] Use : Short Date Field Storage : Date Set as : $Date [Function: AutoPOCreate] ;; Definition Block Variable : Counter : Number FETCH OBJECT : Voucher : ($$SPrintF@VCHMasterID:##pVchId) : InventoryEntries.*, LedgerEntries.* ;; Procedural Block 00 : SET FILE LOG ON 01 : SET : SVViewName : $$SysName:InvVchView 02 : QUERYBOX : "Create Purchase Order ?":Yes:No 03 : IF : $$LastResult 04 : NEW OBJECT : VOUCHER 05 : SET VALUE : Date : $Date ;; ##InputDate1 06 : SET VALUE : Reference : $VoucherNumber 660 : SET VALUE : PartyLedgerName : $PartyLedgerName ;;711 : SET VALUE : Is Deemed Positive : "yes" ;;12 : Set Value : ISPARTYLEDGER : Yes 07 : SET VALUE : VoucherTypeName : "Purchase Order" 08 : SET Value : IsInvoice : Yes ; 19e : WALK Collection : PartyAddress ; 19g : INSERT COLLECTION OBJECT : Address ; 19i : SET VALUE : Address : $Address ; 19j : Set Target : .. ; 19k : End Walk 09 : INSERT COLLECTION OBJECT : Ledger Entries 10 : SET VALUE : LedgerName : $LedgerName 710 : SET VALUE : Is Deemed Positive : "yes" ;;12 : Set Value : ISPARTYLEDGER : Yes 120 : SET VALUE : Amount : $Amount;*-1 140 : SET TARGET : .. 700 : SET : Counter : 1 810 : WALK COLLECTION : All Inventory Entries 150 : INSERT COLLECTION OBJECT : INVENTORY ENTRIES 320 : IF : ##Counter = 1 430 : SET TARGET : All Inventory Entries ;;[1] 340 : ELSE: 350 : INSERT COLLECTION OBJECT : All Inventory Entries 360 : ENDIF 160 : SET VALUE : StockItemName : $StockItemName 170 : SET VALUE : IsDeemedPositive : No ;;171 : SET VALUE : ActualQty : ($$TgtObject$$AsQty:"100")) * -1 175 : SET VALUE : ActualQty : $ActualQty;$$TgtObject:$BilledQty 177 : SET VALUE : BilledQty : $billedqty;$$AsQty:"10" ;;$$TgtObject:$$Number:$BilledQty ;;($$TgtObject$$AsQty:"100")) * -1 ;;173 : SET VALUE : Rate : ($$TgtObject$$AsRate:$Rate)) 180 : SET VALUE : Amount : $Amount 190 : INSERT COLLECTION OBJECT : BATCH ALLOCATIONS 200 : SET TARGET : BatchAllocations ;; [1] 201 : SET VALUE : OrderDueDate : $$DateRange:"10 Days"$$TgtObject:$Date):True 210 : SET VALUE : GodownName : $GodownName ;; "Main Location" 220 : SET VALUE : BatchName : $BatchName ;; "Test" 230 : SET VALUE : OrderNo : $OrderNo ;; "Test" 240 : SET VALUE : ActualQty : $$TgtObject:$actualqty ;;($$TgtObject$$AsQty:"100")) * -1 255 : SET VALUE : BilledQty : $$TgtObject:$BilledQty ;;($$TgtObject$$AsQty:"100")) * -1 ;;260 : SET VALUE : Rate : ($$TgtObject$$AsRate:$Rate)) ;110 : Set Value: LedgerName : "Purchase @ 14.5%" 270 : SET VALUE : Amount : $Amount ;; ($$TgtObject$$AsAmount:$Amount)) 280 : SET TARGET : ... ;258 : Walk Collection:ALL LEDGER ENTRIES 19 : INSERT COLLECTION OBJECT :LEDGER ENTRIES 109 : SET TARGET :LEDGER ENTRIES 110 : Set Value: LedgerName : "Purchase @ 14.5%" 111 : Set Value : Is Deemed Positive :"No" ;"" 249a: SET VALUE : ISLASTDEEMEDPOSITIVE : No 254 : SET VALUE : TAXCLASSIFICATIONNAME : $$SysName:NotApplicable ;;112 : Set Value : ISPARTYLEDGER : No 113 : Set Value : Amount : $Amount 114 : Set Target:..... ;115: End Walk 330 : INCREMENT : Counter 33 : End Walk ; 18 : WALK COLLECTION : All ledger Entries ; 19 : INSERT COLLECTION OBJECT : LEDGERENTRIES ; 109 : SET TARGET : LEDGERENTRIES ; 110 : SET VALUE : LedgerName : "Purchase @ 14.5%" ; 111 : SET VALUE : Is Deemed Positive : "No" ; ;;112 : Set Value : ISPARTYLEDGER : No ; 113 : SET VALUE : Amount : $Amount ; 117 : SET TARGET : ... ; 118 : End Walk ; 13 : INSERT COLLECTION OBJECT : BillAllocations ; 14 : SET VALUE : BillType : $$SysName:NewRef ; 15 : SET VALUE : Name : $VoucherNumber ; 16 : SET VALUE : Amount : $Amount ; 17 : SET TARGET : .. ; 19 : INSERT COLLECTION OBJECT : Accounting Allocations ; 110 : SET VALUE : LedgerName : "PURCHASE" ; 111 : SET VALUE : Is Deemed Positive : "No" ; ;;112 : Set Value : ISPARTYLEDGER : No ; 113 : SET VALUE : Amount : $Amount ; 117 : SET TARGET : ... 34 : SET VALUE : PersistedView : ##SVViewName 35 : CREATE TARGET 36 : ENDIF 37 : Return ;; END [#Field:EIACCALLOCNAME] [#Field:vchbatchactualqty]
admin plz help this tdl file accounting allocations part will not working and also i changed purchase voucher type but it not created
[Function: AutoPOCreate] ;; Definition Block Variable : Counter : Number Variable:addcount:Number FETCH OBJECT : Voucher : ($$SPrintF@VCHMasterID:##pVchId) : InventoryEntries.*, LedgerEntries.* Variable : accallocindex : Number ;; Procedural Block 05 : SET FILE LOG ON 10 : SET : SVViewName : $$SysName:InvVchView 15 : QUERYBOX : "Create Sales Order ?":Yes:No 20 : IF : $$LastResult 25 : NEW OBJECT : VOUCHER 30 : SET VALUE : Date : $Date ;; ##InputDate1 35 : SET VALUE : Reference : $VoucherNumber 40 : SET VALUE : VoucherTypeName : "Sales Order" 45 : SET Value : IsInvoice : Yes 50:Insert Collection Object:BasicBuyerAddress 55:Set Value:BasicBuyerAddress:$$CollectionField:$BasicBuyerAddress:1:BasicBuyerAddress 60:Set Target:.. 65:Insert Collection Object:BasicBuyerAddress 70:Set Value:BasicBuyerAddress:$$CollectionField:$BasicBuyerAddress:2:BasicBuyerAddress 75:Set Target:.. 80:Insert Collection Object:BasicBuyerAddress 85:Set Value:BasicBuyerAddress:$$CollectionField:$BasicBuyerAddress:3:BasicBuyerAddress 90:Set Target:.. 95:Insert Collection Object:Address 100:Set Value:Address:$$CollectionField:$Address:1:Address 105:Set Target:.. 110:Insert Collection Object:Address 115:Set Value:Address:$$CollectionField:$Address:2:Address 120:Set Target:.. 125:Insert Collection Object:Address 130:Set Value:Address:$$CollectionField:$Address:3:Address 135:Set Target:.. 180 : INSERT COLLECTION OBJECT : Ledger Entries 200 : SET VALUE : LedgerName : $LedgerName 201 : Set:addcount:1 ;202: Walk Collection:Address ;203: Insert Collection Object:Address ;220: SET VALUE : Address:$Address ;221: INCREMENT : Counter ;222: End Walk 240: SET VALUE : StateName : $StateName 250:Set ValueartyGSTIN:$PartyGSTIN 260 :Set Value:ConsigneeGSTIN:$ConsigneeGSTIN 261 :Set Value:ConsigneeStateName:$ConsigneeStateName ;53: SET VALUE : BuyerAddress: $Address 270 : SET VALUE : Amount : $Amount;*-1 280 : SET TARGET : .. 285 : SET : Counter : 1 290 : WALK COLLECTION : All Inventory Entries 295 : INSERT COLLECTION OBJECT : INVENTORY ENTRIES 300 : IF : ##Counter = 1 310 : SET TARGET : All Inventory Entries ;;[1] 320 : ELSE: 330 : INSERT COLLECTION OBJECT : All Inventory Entries 340 : ENDIF 350:Walk Collection:ACCOUNTINGALLOCATIONS 360 : SET : accallocindex : $$FindAccAllocIndex:$LedgerName ;; Insert a new accounting allocation object 365 : IF : ##accallocindex = 0 ;; Insert new accounting allocation object 366 : INSERT COLLECTION OBJECT : AccountingAllocations ;; Get the number of accounting allocations object to get the index 367 : SET : accallocindex : $$TgtObject$$NumItems:AccountingAllocations) ;; End if 368 : END IF 369 : DEBUGEXEC : LOG : "Accounting allocation index is : " + $$String:##accallocindex ;; Set the target as batch allocations 370 : SET TARGET : AccountingAllocations[##accallocindex] 375: CALL : CustomCopyAccAllocationsValues:##accallocindex ;; Copy the values of the accounting allocations ;131h : CALL : CopyAccAllocationsValues:##accallocindex 380:SET TARGET : .. 385:End Walk 386 : SET VALUE : StockItemName : $StockItemName 387 : SET VALUE : IsDeemedPositive : No 388 : SET VALUE : ActualQty : $ActualQty;$$TgtObject:$BilledQty 389 : SET VALUE : BilledQty : $billedqty;$$AsQty:"10" ;;$$TgtObject:$$Number:$BilledQty ;;($$TgtObject$$AsQty:"100")) * -1 390 : SET VALUE : Amount : $Amount 391 : INSERT COLLECTION OBJECT : BATCH ALLOCATIONS 392 : SET TARGET : BatchAllocations ;; [1] 393 : SET VALUE : OrderDueDate : $$DateRange:"10 Days"$$TgtObject:$Date):True 394 : SET VALUE : GodownName : $GodownName ;; "Main Location" 395 : SET VALUE : BatchName : $BatchName ;; "Test" 396 : SET VALUE : OrderNo : $OrderNo ;; "Test" 397 : SET VALUE : ActualQty : $$TgtObject:$actualqty ;;($$TgtObject$$AsQty:"100")) * -1 398 : SET VALUE : BilledQty : $$TgtObject:$BilledQty ;;($$TgtObject$$AsQty:"100")) * -1 399 : SET VALUE : Rate : $Rate 400 : SET VALUE : Amount : $Amount ;; ($$TgtObject$$AsAmount:$Amount)) 410 : SET TARGET : ... 420 : INCREMENT : Counter 430 : End Walk 440 : SET VALUE : PersistedView : ##SVViewName 450 : CREATE TARGET 460 : ENDIF 470 : Return [Function:CustomCopyAccAllocationsValues] Parameter : pAllocIndex : Number ;; Set the ledger name 10 : SET VALUE : Ledger Name ;; Set the VAT classifications 12 : SET VALUE : StatClassificationName : $StatClassificationName ;; Set the VAT Nature 14 : SET VALUE : StatNatureName : $StatNatureName ;; Set VAT Tax Rate 16 : SET VALUE : VATTaxRate : $VATTaxRate ;; Set VAT Assessable Value 18 : SET VALUE : VATAssessableValue : $VATAssessableValue ;; Set the excise classification name 20 : SET VALUE : ExciseClassificationName ;; Set the amount 150 : SET VALUE : Amount : $$AmountAdd$$TgtObject:$Amount):$Amount