Vender Code At Ledger Master

Discussion in 'Tally Developer' started by Salman, Jun 17, 2017.

    
  1. Salman

    Salman Member


    I written a code which adds the vender code at ledger master if the group is sundry debtors then customer code will appear.Till here my code is running. I want to generate vender code automatic with some prefix. i added prefix and suffix at group creation or alteration. as please help me for same. Its working fine but for old ledger its showing the total number of ledger I mean if there are 10 customer already entered in the system before implementing the customized module for those 10 customer I am not able to give them the customer code. This is happening only for the ledger creation not on the ledger alteration. Please kindly assist me further.
    my code is

    [#Part: MST LED Explode Sundry]

    Add: Line: After : LED IsCostCentred : LED CustomerCode
    ;Add: Line: After : LED CustomerCode : Customer Code

    [Line: LED CustomerCode]

    Field : Long Prompt, LED CustomerCode
    Local : Field : Long Prompt : Set as : $$LocaleString:"Customer Code"
    Local : Field : Long Prompt : Color:blue
    Invisible:#MSTParent="Sundry Creditors"

    ;[#Field:MSTParent]
    ;
    ; On : Accept : Yes : Call : Fun1
    ; On : Accept : Yes : Field Accept

    [Field: LED CustomerCode]

    Use:name field

    Set Always: Yes
    Set as :##final1

    Background:red

    [#Field:MST Parent]
    On:Accept:Yes:Call:funC12
    On:Accept:Yes:Field Accept

    [Collection:GrpColC]
    Type:Group
    Fetch:Name,CustomerManualSuffix,CustomerManualPrefix,CustomerManualStartNumber
    Filter:xyz

    [Collection:ledColC]
    Type:Ledger
    Fetch:parent
    Filter:mnp

    ;;select $name from GrpColC

    [System:Formulae]
    xyz:$name="Sundry Debtors"
    mnp:$Parent="Sundry Debtors"
    ;;select $Name,$CustomerManualSuffix
    [System:Variables]
    final1
    [Variable:final1]
    Type:String

    [Function:funC12]
    Variable:v2:Number
    Variable:xyz:Number
    Returns:String
    01a:Set:xyz:$$Number:($$NumItems:ledColC)
    01aa:Log:##xyz
    00:Walk Collection:GrpColC
    01:If:$name="Sundry Debtors"

    02:Set:v2:$$Number:$CustomerManualStartNumber
    04:Set:v2:##v2 + ##xyz
    05:Set:final1:$CustomerManualPrefix+($$String:##v2)+$CustomerManualSuffix
    06:Else
    07:Set:final1:$CustomerManualPrefix+($$String:$CustomerManualStartNumber)+$CustomerManualSuffix
    08:End If
    10:End Walk
    11:Return:##final1


    [#Form: GROUP]
    Option:VIPL Led Cust GROUPMode;:mad:@ItemMasterCreation

    [!Form:VIPL Led Cust GROUPMode]
    Parts : Form Subtitle, Customer Method Alteration
    Local : Field : Form SubTitle : Info : "Auto Customer Code with a Group"
    Width : 40% Page


    [Part: Customer Method Alteration]

    Lines : /*IMA Stock Group ,*/ Customer Manual Prefix, Customer Manual Suffix, Customer Manual Start ;, IMA Description
    ;Invisible:#MSTParent="Current Assets"
    [Line: Customer Manual Start]

    Field : Long Prompt, Customer Manual Start

    Local : Field : Long Prompt : Set as : "Starting Number :"
    Local : Field : Long Prompt : Indent : 2

    [Line: Customer Manual Suffix]

    Field : Long Prompt, Customer Manual Suffix
    Local : Field : Long Prompt : Set as : "Suffix ? "
    Local : Field : Long Prompt : Indent : 2

    [Field: Customer Manual Suffix]

    Use : Short Name Field
    Case : Upper Case
    Storage : Customer Manual Suffix
    Width : @@ShortWidth

    [Line: Customer Manual Prefix]

    Field : Long Prompt, Customer Manual Prefix
    Local : Field : Long Prompt : Set as : "Prefix ? "
    Local : Field : Long Prompt : Indent : 2

    [Field:Customer Manual Prefix]

    Use : Short Name Field
    Case : Upper Case
    Storage : Customer Manual Prefix
    Width : @@ShortWidth


    [Field: Customer Manual Start]

    Use : Number Field
    Set as : $CustomerManualStartNumber
    Storage : CustomerManualStartNumber
    Width : @@ShortWidth
    ; Inactive : NOT $$IsSysNameEqual:Manual:#VTYPNumbering
    ;Validate : NOT $CustomerManualStartNumber<1

    [#Part: LEDNotes]

    Option:VIPL MST Led Explode Sundry Mode Customer:mad:@ItemMasterCreation

    [!Part:VIPL MST Led Explode Sundry Mode Customer]
    Lines:Customer Man VCH Number, LEDNotes
    ; Line :
    ; Invisible : NOT ##LEDNotes
    Space Right : 0.5
    Space Top : 0.125
    Space Bottom: 0.25

    ;[#Part: MST Led Explode Sundry]
    ; Option:VIPL MST Led Explode Sundry Mode:mad:@ItemMasterCreation
    ;


    [Line:Customer Man VCH Number]

    Field : Customer Man VCH Number, Customer Man VCH NumberA1 ;,Long Prompt,Customer VIPLManuNumber
    Local : Field : Long Prompt : Set as : "Auto Customer Code: "
    Local : Field : Long Prompt : Style : Large


    [Variable:Customer VIPLManuNumber]

    Type: String

    [Field:Customer Man VCH Number]

    Use : Number Field
    Set as : If $$NumItems:CustomerTSPLSmpParentFilter = 0 then $CustomerManualStartNumber:Group:$parent +
    else @@CustomerNoOfSVCurrentVouchers + 1
    Storage : CustomerManVchNumber
    SEt Always : Yes
    Skip : Yes
    Background: Red
    ; border : thin box : $$numitems:TSPLSmpParentFilter = 0
    ; Invisible: Yes

    [Field:Customer Man VCH NumberA1]

    Use : Number Field
    Set as : If $$NumItems:CustomerTSPLSmpParentFilterA1 = 0 then $CustomerManualStartNumber:$parent:Group:$parent +
    else @@CustomerNoOfSVCurrentVouchersA1 + 1
    Storage : CustomerManVchNumberA1
    SEt Always : Yes
    Skip : Yes
    Background: Green
    ; border : thin box : $$numitems:TSPLSmpParentFilter = 0
    Invisible: Yes



    [Collection: CustomerTSPLSmpParentFilter]
    Type : Ledger
    Child Of : #MSTParent ;or #MSTGrandParent
    Fetch : CustomerManVchNumber
    Sort : @@Default : - $CustomerManVchNumber

    [Collection: CustomerTSPLSmpParentFilterA1]
    Type : Ledger
    Child Of : #MSTGrandParent
    Fetch : CustomerManVchNumberA1
    Sort : @@Default : - $CustomerManVchNumberA1


    [#Object: Ledger]

    CustomerSHVNumericVchNo : $$Number:mad:@CustomerSHVNumericVchNoFor
    CustomerSHVVchStartNumber : $CustomerManualStartNumber:LedgerName:##LedgerName

    [System: Formula]

    CustomerManuNumber : @@CustomerSHVVchPrefixName + $$String:#CustomerManVCHNumber + @@CustomerSHVVchSuffixName
    CustomerManuNumberA1 : @@CustomerSHVVchPrefixNameA1 + $$String:#CustomerManVCHNumberA1 + @@CustomerSHVVchSuffixNameA1

    CustomerNoOfSVCurrentVouchers : $$CollectionField:$CustomerSHVNumericVchNo:1:CustomerTSPLSmpParentFilter
    CustomerNoOfSVCurrentVouchersA1 : $$CollectionField:$CustomerSHVNumericVchNoA1:2:CustomerTSPLSmpParentFilterA1

    CustomerSHVVchPrefixName : $CustomerManualPrefix:Group:$parent ;or $CustomerManualPrefix:$parent:Group:$parent

    CustomerSHVVchSuffixName : $CustomerManualSuffix:Group:$parent ;or $CustomerManualSuffix:$parent:Group:$parent

    CustomerSHVVchPrefixNameA1 : $CustomerManualPrefix:$parent:Group:$parent
    CustomerSHVVchSuffixNameA1 : $CustomerManualSuffix:$parent:Group:$parent

    CustomerSHVNumericVchNoFor : $CustomerManVchNumber
    CustomerSHVNumericVchNoForA1 : $CustomerManVchNumberA1


    [System: UDF]

    CustomerCMPVCHPrefix : String : 1110
    CustomerManual Suffix : String : 2220
    CustomerManual Prefix : String : 3330
    CustomerManualStartNumber : Number : 4440
    CustomerManVchNumber : Number : 4501
    CustomerManVchNumberA1 : Number : 4502
     


  2. Salman

    Salman Member


    Plz anyone help
     


Share This Page