Auto Number/Prefix of Ledger Masters created within a particular group

Discussion in 'Free Source Codes' started by Devendra_Rawat, Feb 2, 2020.

    
  1. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    Auto Number/Prefix of Ledger Masters created within a particular group

    Original code belongs to Member Ria in this forum.
    ------------------------------------------------------------


    Code:
    [#Form : Group]
      
        Add    : Option    : CrGrp        : ( $$IsGroupSundryDebtors:$Parent OR $$IsGroupSundryDebtors:#MstName) Or  $$IsBelongsTo:$$GroupSundryDebtors
      
    [!Form : CrGrp]
      
        Local    : Part    : Grp Details    : Add    : Line    : CrLedCount
      
    [Line : Cr Led Count]
      
        Field    : Short Prompt, Cr Led Count
        Local    : Field    : Short Prompt    : Set as    : "Cr Led Count"
        ;Invisible : NO;Yes;(NOT $$IsGroupSundryCreditors:$Parent AND NOT $$IsGroupSundryCreditors:$GrandParent)Or NOT $$InCreateMode
      
    [Field : Cr Led Count]
          
        Use            : Number Field
        ;Set as        : $$Value;l1;If $$InCreatemode Then 1 Else $$Value
        Set Always    : Yes;$$InCreateMode
        Storage        : udfCrLedCount
        Skip        : Yes
      
        Set By Condition    : $$InCreateMode    : 1
      
        Invisible    : NOT $$IsGroupSundryDebtors:$GrandParent AND NOT $$IsGroupSundryDebtors:$Parent; Or NOT $$InCreateMode
      
    [System    : UDF]
      
        udfCrLedCount    : Number    : 8000
      
    [#Object    : Group]
        CrLedCount : $udfCrLedCount
      
    [#Report : Ledger]
      
        Add    : Option    : Cr Led    : Yes ;( $$IsGroupSundryDebtors:#MstParent OR $$IsGroupSundryDebtors:$Parent:Group:#MstParent) Or  $$IsBelongsTo:$$GroupSundryDebtors
      
    [!Report : Cr Led]
      
        Local    : Form    : Ledger    : Replace    : Part    : MST Led Initial    : RBC MST Led Initial
      
        Local    : Form    : Ledger    : Add    : On    : Form Accept    : Yes    : Call    : IncrLedCount
        Local    : Form    : Ledger    : Add    : On    : Form Accept    : Yes    : Form Accept
      
    [#Form : Ledger]
      
        Add    : Option    : CrLed     : Yes ; ( $$IsGroupSundryDebtors:#MstParent OR $$IsGroupSundryDebtors:$Parent:Group:#MstParent) Or  $$IsBelongsTo:$$GroupSundryDebtors
      
    [!Form : CrLed]
      
        ;Local    : Part    : MSTLedInitial    : Add        : Line    : Before    : MST Name        : RBC MST Alias
        ;Local    : Part    : MSTLedInitial : Replace    : Line    : MST Name     : RBC MST Name
      
        Replace    : Part    : MST Led Initial    : RBC MST Led Initial
      
        Add    : On    : Form Accept    : Yes    : Call    : IncrLedCount
        Add    : On    : Form Accept    : Yes    : Form Accept
      
        Local    : Field    : MST Parent    : Add    : Modifies    : svCurrentGrp
      
    [Variable : svCurrentGrp]
      
        Type    : String
      
    [Variable : svCurrentCount]
      
        Type    : Number
      
    [System : Variable]
      
        svCurrentGrp
        svCurrentCount
      
    [Part : RBC MST Led Initial]
      
        Parts       : RBC MST Basic
        RightPart    : MSTLED OpAmts
        Vertical    : No
          Local        : Part    : RBC MST Basic    : Space Top   : If ##UseLangAliasesInMaster OR ##MSTHasLangAliases then 0 else 0.25
      
    [Part : RBC MST Basic]
      
        Option      : RBC MSTAliasMode           : (##UseAliasesInMaster OR ##MSTHasAliases) AND NOT ##UseLangAliasesInMaster AND NOT ##MSTHasLangAliases
        Option      : RBC MSTSimpleMode          : NOT ##UseAliasesInMaster AND NOT ##MSTHasAliases AND NOT ##UseLangAliasesInMaster AND NOT ##MSTHasLangAliases
        Option      : MSTLangAliasMode           : ##UseLangAliasesInMaster OR ##MSTHasLangAliases
      
    [!Part : RBC MSTAliasMode]
      
        Object      : LanguageName:First
        Lines       : RBC MST Name, RBC MST Name main, MST Alias
        Repeat      : MST Alias : Name :LanguageName : First
        Height      : 5
        Space Bottom: 0.5
        Break On    : $$IsEmpty:$Name
          
    [Line : RBC MST Name]
      
        Use        : Master Name Line
        Fields    : Short Prompt, RBC MST Name
        Invisible    : Not  $$InCreateMode
      
        [Field : RBC MST Name]
            Use    : Name Field
            Invisible    : Not  $$InCreateMode
      
    [Line : RBC MST Name main]
      
        Use     : Master Name Line
        Fields  : Short Prompt, MST LangId, RBC MST Name main
      
          
        [Field : RBC MST Name main]
    
            Use         : Master Name Field
            Set as      : if $$InCreateMode then $$String:@CountFill  + "-" + #RBCMSTName else $$Value
            CountFill    : $$ZeroFill:@Count:3
            Count          : $(Group, #MstParent).CrLedCount
            Set Always    : Yes
            Modifies    : PrevMasterName
            Key         : PrevMasterName
            Invisible    : $$InCreateMode
            Skip        : $$InCreateMode
      
            On            : Accept    : Yes    : Set    : svCurrentCount    :    $(Group, #MstParent).CrLedCount
            On            : Accept    : Yes    : Field Accept
              
      
    [!Part : RBC MSTSimpleMode]
      
        Object          : LanguageName:First
        Lines           : RBC MST Name, RBC MST Name main
        Space Bottom    : 0.5    
      
    [!Part : RBC MSTLangAliasMode]
      
    
    [Function : IncrLedCount]
      
        ;Object    : Group : ##svCurrentGrp
        Variable    : IncCount : Number
      
      
      
        10    : Log    : "Incrementing Led Count"
        11    : Log    : "Group : " + ##svCurrentGrp
        20    : Set    : IncCount : $(Group, ##svCurrentGrp).CrLedCount
        25    : Log    : $$String:##IncCount
        30    : Set     : IncCount : ##IncCount+1
        35    : Log    : $$String:##IncCount
        40    : Modify Object    : (Group, ##svCurrentGrp).udfCrLedCount[1].udfCrLedCount  : ##IncCount
        45    : Log    : "New Value = " + $$String:$(Group, ##svCurrentGrp).CrLedCount
        50    : Log    : "Value Incremented"
     


Share This Page