Negative Stock Control

Discussion in 'Free Source Codes' started by admin, Feb 3, 2016.

    
  1. admin

    admin Administrator Staff Member


    This TDL does not allow the user to enter the Quantity, if there is Negative Stock. Tally.ERP 9 prompts you with a warning message. In default this will help you to decide whether to proceed with the entry or not. Using this TDL it will not allow you to pass the voucher.

    Code:
    [#Part: CMP InvFeat Right]
    
        Add    : Lines : After    : CMP UsePriceLevels    : TDLeXperts  Control Neg Stk
    
        [Line: TDLeXperts  Control Neg Stk]
    
            Fields      : Medium Prompt, TDLeXperts  Control Neg Stk
            Local       : Field : Medium Prompt       : Set as        : $$LocaleString:"Control Negative Stock ?"
            Invisible   : NOT $IsInventoryOn
            Space Top   : 0.4
    
            [Field: TDLeXperts  Control Neg Stk]
    
                Use         : Logical Field
                Set as        : If NOT $IsInvoicingOn then "No" else $$Value
                Storage     : TDLeXperts  ControlNegStk
                Skip        : If $$IsRemoteCompany Then Yes Else NOT $IsInvoicingOn
                Set Always    : Yes
    
    [System: UDF]
    
        TDLeXperts  Control Neg Stk    : Logical    : 1100
    
    ;; Altering Stock Item Line
    
    [#Line: EI InvInfo]
    
        Option    : TDLeXperts  Neg Stk EI InvInfo        : @@TDLeXpertsIsNSC AND @@IsOutwardType
    
        [!Line: TDLeXperts  Neg Stk EI InvInfo]
    
            Add        : Right Fields    : TDLeXperts  Final Qty
            Local    : Field    : VCHActualQty            : Control    : TDLeXperts  NegativeStock    : $$IsNegative:@@TDLeXpertsClosQty AND $ActualQty != $BilledQty
            Local    : Field    : VCHBilledQty            : Control    : TDLeXperts  NegativeStock    : $$IsNegative:@@TDLeXpertsClosQty AND $ActualQty = $BilledQty
            On        : Focus    : Yes    : CALL            : TDLeXperts  Set List Variables             : $$Line : "Item"
    
    ;; Altering Batch Line
    
    [#Line: STKVCH Batch2]
    
        Option    : TDLeXperts  Neg Stk STKVCH Batch2    : @@TDLeXpertsIsNSC AND @@IsOutwardType
    
        [!Line: TDLeXperts  Neg Stk STKVCH Batch2]
    
            Add        : Right Fields    : TDLeXperts  Final Qty, TDLeXperts  Orig Qty
            Local    : Field    : VCHBATCH ActualQty    : Control    : TDLeXperts  NegativeStock    : $$IsNegative:@@TDLeXpertsClosQty AND $ActualQty != $BilledQty
            Local    : Field    : VCHBATCH BilledQty    : Control    : TDLeXperts  NegativeStock    : $$IsNegative:@@TDLeXpertsClosQty AND $ActualQty = $BilledQty
            On        : Focus    : Yes    : CALL            : TDLeXperts  Set List Variables             : $$Line : "Batch"
    
            [Field: TDLeXperts  Final Qty]
    
                Use            : Qty Primary Field
                Set As        : @@TDLeXpertsClosQty
                Invisible    : Yes
                Set Always    : Yes
                Skip        : Yes
    
            [Field: TDLeXperts  Orig Qty]
    
                Use            : Qty Primary Field
                Storage        : TDLeXperts  Orig Qty
                Set As        : if $$IsEmpty:$$Value then $ActualQty else $$Value
                Invisible    : Yes
    
    [System: UDF]
    
        TDLeXperts  Orig Qty    : Quantity    : 1000
    
    ;; Function to add list variable
    
    [Function: TDLeXperts  Set List Variables]
    
        Parameter    : pLine        : Number
        Parameter    : pItemBatch: String
    
        Variable    : LineKey    : String
        Variable    : LineIndex    : Number
    
        00    : IF    : ##pItemBatch = "Batch"
        10    :     SET        : LineKey                : $StockItemName + #VCHBATCHName + #VCHBATCHGodown
        20    :     IF        : NOT $$ListFind:TDLeXpertsBatchVar:##LineKey
        30    :         LIST ADD: TDLeXperts  BatchVar    : ##LineKey
        40    :     ENDIF
        50    :    SET        : LineIndex    : $$ListIndex:TDLeXpertsBatchVar:##LineKey
        60    :     SET        : TDLeXperts  BatchVar[##LineIndex].TDLeXperts  OrigBatch        : #VCHBATCHName
        70    :     SET        : TDLeXperts  BatchVar[##LineIndex].TDLeXperts  OrigGodown    : #VCHBATCHGodown
        80    :     SET        : TDLeXperts  BatchVar[##LineIndex].TDLeXperts  OrigQty        : if $$IsEmpty:##TDLeXpertsBatchVar[##LineIndex].TDLeXpertsOrigQty then #TDLeXpertsOrigQty else if ##pLine = ##LineIndex then ##TDLeXpertsBatchVar[##LineIndex].TDLeXpertsOrigQty else ##TDLeXpertsBatchVar[##LineIndex].TDLeXpertsOrigQty + #TDLeXpertsOrigQty
        90    : ELSE    :
    
        100    :     SET        : LineKey                : #VCHStockItem
        110    :     IF        : NOT $$ListFind:TDLeXpertsItemVar:##LineKey
        120    :         LIST ADD: TDLeXperts  ItemVar    : ##LineKey
        130    :     ENDIF
        140    :    SET        : LineIndex                : $$ListIndex:TDLeXpertsItemVar:##LineKey
        150    :     SET        : TDLeXperts  ItemVar[##LineIndex].TDLeXperts  OrigItem        : #VCHStockItem
        160    :     SET        : TDLeXperts  ItemVar[##LineIndex].TDLeXperts  OrigQty        : if $$IsEmpty:##TDLeXpertsItemVar[##LineIndex].TDLeXpertsOrigQty then #VCHActualQty else if ##pLine = ##LineIndex then ##TDLeXpertsItemVar[##LineIndex].TDLeXpertsOrigQty else ##TDLeXpertsItemVar[##LineIndex].TDLeXpertsOrigQty + #VCHActualQty
        170    : ENDIF
    
    ;; System Formula Definition
    
    [System: Formula]
    
        TDLeXperts  IsNSC                : $TDLeXpertsControlNegStk:Company:##SVCurrentCompany
    
        TDLeXperts  ClosQty            : if $$InAlterMode then @@FinalStockTotal + @@TDLeXpertsLVQtyBatchItem else @@FinalStockTotal
        TDLeXperts  LV Qty BatchItem    : If @@HasBatchWise OR $$IsMultiGodownOn then ##TDLeXpertsBatchVar[$$ListIndex:TDLeXpertsBatchVar:@@TDLeXpertsBatGdn].TDLeXpertsOrigQty else +
                                        ##TDLeXpertsItemVar[$$ListIndex:TDLeXpertsItemVar:$StockItemName].TDLeXpertsOrigQty
    
        TDLeXperts  BatGdn                : $StockItemName + #VCHBATCHName + #VCHBATCHGodown
    
        TDLeXperts  NegativeStock      : $$SPrintf:@@NegativeStockFormat:@@TDLeXpertsNegativeStkFormula
        TDLeXperts  NegativeStkFormula    : $$String:@@TDLeXpertsSignedStockTot:Signed
        TDLeXperts  SignedStockTot     : @@TDLeXpertsClosQty
    
    ;; ---------------- General changes
    ;; Altering the Configuration Part
    
    [#Part: VCFG Inventory]
    
        Local     : Line     : VCFG NegativeStock     : Invisible : Yes
    
    [#Part: ICFG Invoicing]
    
        Local     : Line     : VCFG NegativeStock     : Invisible : Yes
    
    ;; Variable Definition and List Variable Association at the System Level
    
    [Variable: TDLeXperts  ItemVar]
    
        Variable    : TDLeXperts  OrigItem         : String
        Variable    : TDLeXperts  OrigQty            : Quantity
    
    [Variable: TDLeXperts  BatchVar]
    
        Variable    : TDLeXperts  OrigBatch         : String
        Variable    : TDLeXperts  OrigGodown        : String
        Variable    : TDLeXperts  OrigQty            : Quantity
    
    [System: Variable]
    
        List Variable    : TDLeXperts  BatchVar, TDLeXperts  ItemVar
    
    ;; Emptying List Variable at the Report Level
    
    [#Report: Voucher]
    
        Variable    : VarDummy    : Logical
        Set            : VarDummy    : $$TDLeXpertsDeleteLV
    
    [Function: TDLeXpertsDeleteLV]        ;; Function deleting System List Variable values
    
        00    : LIST DELETE    : TDLeXperts  BatchVar
        05    : LIST DELETE    : TDLeXperts  ItemVar
        10    : RETURN        : True
    
    
    
     

    Attached Files:

    goldi and Sanjeev S like this.


  2. goldi

    goldi New Member


    graet job sir,,,but this TDL not allow to pass order voucher also(if stock negative),pl update code to allow order voucher
    thank u
     


  3. Hardik Nagar

    Hardik Nagar New Member


    Sir whenever I try to pass sales order, it won't allow me to pass that too which is illogical. Kindly update the code to exclude negative stock at the time of passing sales order
     


  4. Ranjith M C

    Ranjith M C New Member


    Option : TDLeXperts Neg Stk EI InvInfo : @@TDLeXpertsIsNSC or @@Issales or @@IsDelnote

    [!Line: TDLeXperts Neg Stk EI InvInfo]

    Add : Right Fields : TDLeXperts Final Qty
    Local : Field : VCHActualQty : Control : TDLeXperts NegativeStock : $$IsNegative:mad:@TDLeXpertsClosQty AND $ActualQty != $BilledQty
    Local : Field : VCHBilledQty : Control : TDLeXperts NegativeStock : $$IsNegative:mad:@TDLeXpertsClosQty AND $ActualQty = $BilledQty
    On : Focus : Yes : CALL : TDLeXperts Set List Variables : $$Line : "Item"

    ;; Altering Batch Line

    [#Line: STKVCH Batch2]

    Option : TDLeXperts Neg Stk STKVCH Batch2 : @@TDLeXpertsIsNSC or @@Issales or @@IsDelnote
     


  5. Hardik Nagar

    Hardik Nagar New Member


    Sir, whenever loading the TDL in release 6.0.2, I get error

    T0008: Could not find the original description of Part ICFG Invoicing
     
    TEJAS A SHAH and tmdmuzammil like this.


  6. tmdmuzammil

    tmdmuzammil New Member


    Sir After updated tally its not blocking negative stock

    T0008: Could not find the original description of Part ICFG Invoicing
     


Share This Page