Hi, can anyone point out the issue with the below code it is not giving any errors but i couldnot find the voucher [Function: ImportSVCH] 30 : SET : SVViewName : $$SysName:InvVchView 40 : NEW OBJECT : Voucher 70 : SET VALUE : Date :$$MachineDate 80 : SET VALUE : VoucherTypeName : "Form8B" 90 : SET VALUE : VoucherNumber : "B/324234" 100 : SET VALUE : PartyLedgerName : "AB STORES" 101 : SET VALUE : PartyName : "AB STORES" 110 : SET VALUE : IsInvoice : Yes 130 : INSERT COLLECTION OBJECT : LEDGERENTRIES 140 : SET VALUE : LedgerName : "AB STORES" 150 : SET VALUE : IsDeemedPositive : Yes 151 : SET VALUE : IsPartyLedger : Yes 160 : SET VALUE : Amount : $$AsAmount:"1000" * -1 170 : SET TARGET : .. 180 : INSERT COLLECTION OBJECT : INVENTORYENTRIES 190 : SET VALUE : StockItemName : "45 Gm Jo Soap" 200 : SET VALUE : IsDeemedPositive : No 210 : SET VALUE : ActualQty : ($$TgtObject: ($$AsQty:"-10")) 220 : SET VALUE : BilledQty : ($$TgtObject: ($$AsQty:"-10")) 230 : SET VALUE : Rate : ($$TgtObject: ($$AsRate:"100")) 240 : SET VALUE : Amount : $$AsAmount:"1000" 250 : INSERT COLLECTION OBJECT : BATCHALLOCATIONS 260 : SET VALUE : GodownName : "Main Location" 270 : SET VALUE : BatchName : "Primary Batch" 280 : SET VALUE : ActualQty : ($$TgtObject: ($$AsQty:"-10")) 290 : SET VALUE : BilledQty : ($$TgtObject: ($$AsQty:"-10")) 300 : SET VALUE : Rate : ($$TgtObject: ($$AsRate:"100")) 310 : SET VALUE : Amount : $$AsAmount:"1000" 320 : SET TARGET : .. 330 : INSERT COLLECTION OBJECT : ACCOUNTING ALLOCATIONS 340 : SET VALUE : LedgerName : "Sales @ 14.5%" 350 : SET VALUE : IsDeemedPositive : No 360 : SET VALUE : Amount : $$AsAmount:"1000" 370 : SET TARGET : ... 380 : SET VALUE : PersistedView : ##SVViewName 390 : CREATE TARGET 410 : MSGBOX : "Status" : "Created Sales Voucher" 440 : RETURN
Dear Ansal, First thing that you have to write LEDGERENTRIES 2 times means one for Dr and second for Cr. Second in your Line No. 390 write SAVE TARGET instead of CREATE TARGET
Try This Code: [Function: ImportSVCH] 30 : SET : SVViewName : $$SysName:InvVchView 40 : NEW OBJECT : Voucher 70 : SET VALUE : Date :$$Date:"01-Nov-2013" 80 : SET VALUE : VoucherTypeName : "Sales" 90 : SET VALUE : VoucherNumber : "B/324234" 100 : SET VALUE : PartyLedgerName : "All India Computer Institute" 101 : SET VALUE : PartyName : "All India Computer Institute" 110 : SET VALUE : IsInvoice : Yes 130 : INSERT COLLECTION OBJECT : LEDGERENTRIES 140 : SET VALUE : LedgerName : "All India Computer Institute" 150 : SET VALUE : IsDeemedPositive : Yes 151 : SET VALUE : IsPartyLedger : Yes 160 : SET VALUE : Amount : $$AsAmount:"2000" * -1 170 : SET TARGET : .. 130a : INSERT COLLECTION OBJECT : LEDGERENTRIES 140a : SET VALUE : LedgerName : "Sales" 150a : SET VALUE : IsDeemedPositive : No 151a : SET VALUE : IsPartyLedger : Yes 160a : SET VALUE : Amount : $$AsAmount:"1000" 170a : SET TARGET : .. 180 : INSERT COLLECTION OBJECT : INVENTORYENTRIES 190 : SET VALUE : StockItemName : "Hard Disk" 200 : SET VALUE : IsDeemedPositive : No 210 : SET VALUE : ActualQty : ($$TgtObject:($$AsQty:"-10")) 220 : SET VALUE : BilledQty : ($$TgtObject:($$AsQty:"-10")) 230 : SET VALUE : Rate : ($$TgtObject:($$AsRate:"100")) 240 : SET VALUE : Amount : $$AsAmount:"1000" 250 : INSERT COLLECTION OBJECT : BATCHALLOCATIONS 260 : SET VALUE : GodownName : "Stores" 270 : SET VALUE : BatchName : "Primary Batch" 280 : SET VALUE : ActualQty : ($$TgtObject:($$AsQty:"-10")) 290 : SET VALUE : BilledQty : ($$TgtObject:($$AsQty:"-10")) 300 : SET VALUE : Rate : ($$TgtObject:($$AsRate:"100")) 310 : SET VALUE : Amount : $$AsAmount:"1000" 320 : SET TARGET : .. 330 : INSERT COLLECTION OBJECT : ACCOUNTING ALLOCATIONS 340 : SET VALUE : LedgerName : "Sales @ 12.5%" 350 : SET VALUE : IsDeemedPositive : No 360 : SET VALUE : Amount : $$AsAmount:"1000" 370 : SET TARGET : .. 380 : SET VALUE : PersistedView : ##SVViewName 390 : SAVE TARGET 410 : MSGBOX : "Status" : "Created Sales Voucher" 440 : RETURN
Thanks Maulik, Finally it worked. Could you please check my other post: http://tdlexperts.com/index.php?threads/httppost-action-from-menu.3392/