Auto sales order creation error

Discussion in 'Tally Developer' started by Anshul Garg, Sep 9, 2022.

    
  1. Anshul Garg

    Anshul Garg Member


    I am trying to Generate Auto Sales Order as per our sales invoice but i am not able to fill few fields please help


    1. Sales Ledger Field
    2. BUyer Gstn
    3. shipping Address and state and gstn


    PLease help

    Code:
    [Function: AutoSalesOrderCreate]
    
    ;; Definition Block
    
    
    Variable : Counter : Number
    
    FETCH OBJECT : Voucher : ($$SPrintF:@@VCHMasterID:##pVchId) : InventoryEntries.*, LedgerEntries.*
    
    ;; 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 : Ledger Entries
    55 : SET VALUE : LedgerName : $LedgerName
    51:        SET VALUE : Address : $Address
    52:        SET VALUE : StateName : $StateName
    ;53:        SET VALUE : BuyerAddress: $Address
    60 : SET VALUE : Amount : $Amount;*-1
    65 : SET TARGET : ..
    
    
    
    
    70 : SET : Counter : 1
    75 : WALK COLLECTION : All Inventory Entries
    
            80 : INSERT COLLECTION OBJECT : INVENTORY ENTRIES
            90 : IF : ##Counter = 1
            100 : SET TARGET : All Inventory Entries ;;[1]
            110 : ELSE:
            120 : INSERT COLLECTION OBJECT : All Inventory Entries
            130 : ENDIF
    
            140 : SET VALUE : StockItemName : $StockItemName
            150 : SET VALUE : IsDeemedPositive : No
            155 : SET VALUE : ActualQty : $ActualQty;$$TgtObject:$BilledQty
            160 : SET VALUE : BilledQty : $billedqty;$$AsQty:"10" ;;$$TgtObject:$$Number:$BilledQty ;;($$TgtObject:($$AsQty:"100")) * -1
            180 : SET VALUE : Amount : $Amount
    
            190 : INSERT COLLECTION OBJECT : BATCH ALLOCATIONS
            200 : SET TARGET : BatchAllocations ;; [1]
            205 : 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 : $Rate
            270 : SET VALUE : Amount : $Amount ;; ($$TgtObject:($$AsAmount:$Amount))
           
           
           
           
            280 : SET TARGET : ...
           
            330 : INCREMENT : Counter
    
    350 : End Walk
    
    355 : SET VALUE : PersistedView : ##SVViewName
    360 : CREATE TARGET
    365 : ENDIF
    370 : Return
    
     

    Attached Files:



Share This Page