DUPLICATE CHEQUE CONTROL

Discussion in 'Tally Developer' started by murtuza shakir, Sep 29, 2018.

    

  1. Dear expert

    I am trying to notify duplicate cheque even if cheque range is not enabled in the master

    kindly check the code as I am not getting the result

    [#Field: VchBankAlloc ChequeNo]
    Notify : DuplicateChequeNumError : @@IsPayment and $$RTCCheckDuplicateChequeNumInVch:$LedgerName:($$Value)
    Validate : NOT $$IsEmpty:$$Value
    [Function: RTCCheckDuplicateChequeNumInVch]

    Parameter : pLedgerName : String
    Parameter : pCurrLineCheqNo : String
    Variable : IsDuplicateChkNo : Logical : No
    10 : WALK COLLECTION : RTCBankAlloc

    15 : IF : ($InstrumentNumber = ##pCurrLineCheqNo AND $$IsSysNameEqual:Cheque:$TransactionType) AND $LedgerName = ##pLedgerName
    20 : SET : IsDuplicateChkNo : Yes
    25 : RETURN : ##IsDuplicateChkNo
    30 : ENDIF

    35 : ENDWALK

    50 : RETURN : ##IsDuplicateChkNo

    [Collection: RTCBankAlloc]
    Source Collection : Default
    Walk : BankAllocations
    Compute : InstrumentNumber : $InstrumentNumber
    Compute : LedgerName : $$Owner:$Name
     


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Modify below function for your purpose...........

    Code:
    [Function: IsChequeUtilized]
           
        Parameter    : vName            : String
        Parameter    : vFromCheque    : String
        Parameter    : vToCheque        : String
       
        Variable    : Length        : Number    : $$StringLength:##vFromCheque
        Variable    : vChequeNo        : Number    : $$Number:##vFromCheque
        Variable    : ToCheque        : Number    : $$Number:##vToCheque   
        Variable    : ChequeNo        : String
       
        0100        : While            : (##vChequeNo <= ##ToCheque)
       
        0120        :    Set            : ChequeNo    : $$ZeroFill:($$String:##vChequeNo):##Length
       
        0130        :    Do If        : ($$ChequeNumExists:##vName:##ChequeNo)    : Return    : True
       
        0140        :    Incr        : vChequeNo
       
        0150        : End While
       
        0160        : Return        : False
     



  3. sir
    thank you for your reply

    instead of writing a new function if i use $$chequenumexists directly its still not working

    Notify : DuplicateChequeNumError : @@IsPayment and $$ChequeNumExist:$LedgerName:$$Value

    but still i am not getting the result
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    $$ChequeNumExist as defined by Tally takes 3 (three) parameters, whereas you are using only 2 parameters.................. i gave u an example wherein the cheque number as entered is checked from character to character....

    So in essence you cannot use the same...but you can adopt these to check character to character to check for duplicates.

    You need to re-visit this function in Tally developer....learn and implement that in context to your own code.
     



  5. i rechecked in the Tally Developer it says 2(two) parameter
    upload_2018-9-30_15-12-5.png




    also i tried to modify the function you provided but dint get the desired result

    [Function: rtcIsChequeUtilized]

    Parameter : vName : String
    Parameter : vCheque : String
    Variable : Length : Number : $$StringLength:##vCheque
    Variable : vChequeNo : Number : $$Number:##vCheque
    Variable : ChequeNo : String

    0100 : While : (##ChequeNo <= ##vCheque)
    0120 : Set : ChequeNo : $$ZeroFill:($$String:##vCheque):##Length
    0130 : Do If : ($$ChequeNumExists:##vName:##ChequeNo) : Return : True
    0150 : End While
    0160 : Return : False



    also i tried to use collection to check if duplicate exist but dint get the result

    [Function: RTCCheckDuplicateChequeNumInVch]

    Parameter : pLedgerName : String
    Parameter : pCurrLineCheqNo : String
    Variable : IsDuplicateChkNo : Logical : No
    10 : WALK COLLECTION : RTCBankAlloc
    15 : IF : $InstrumentNumber = ##pCurrLineCheqNo AND $LedgerName = ##pLedgerName
    20 : SET : IsDuplicateChkNo : Yes
    ;; 25 : RETURN : ##IsDuplicateChkNo
    30 : ENDIF
    35 : ENDWALK
    50 : RETURN : ##IsDuplicateChkNo
    [Collection: RTCBankAlloc]
    Source Collection : ...
    Walk : AllLedgerEntries, BankAllocations
    Fetch : *
    Compute : InstrumentNumber : $InstrumentNumber
    Compute : LedgerName : $..LedgerName
     


  6. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Dear Murtuza Shakir,

    The default function says 2 values..............

    But the code snippet I submitted...........takes 3 values.......... when you use that code snippet...check your calculator panel..........That why i said you need to modify as per your needs. You can make it for 2 values or even 1 value, depends on how you code it............

    In the absence of any Cheque range in your database, i think and I find that this code snippet is best suitable for your needs.
     



  7. dear Amit Kamdar

    I tied to modify but dint succed

    [Function: rtcIsChequeUtilized]
    Parameter : vName : String
    Parameter : vFromCheque : String


    Variable : Length : Number : $$StringLength:##vFromCheque
    Variable : vChequeNo : Number : $$Number:##vFromCheque
    Variable : ToCheque : Number : $$Number:##vfromCheque
    Variable : ChequeNo : String

    0100 : While : (##vChequeNo <= ##ToCheque)
    0120 : Set : ChequeNo : $$ZeroFill:($$String:##vChequeNo):##Length
    0130 : Do If : ($$ChequeNumExists:##vName:##ChequeNo) : Return : True
    0150 : End While
     



  8. hi experts

    function to control duplicate cheque is not working

    [Function: rtcIsChequeUtilized]
    Parameter : vName : String
    Parameter : vFromCheque : String


    Variable : Length : Number : $$StringLength:##vFromCheque
    Variable : vChequeNo : Number : $$Number:##vFromCheque
    Variable : ToCheque : Number : $$Number:##vfromCheque
    Variable : ChequeNo : String

    0100 : While : (##vChequeNo <= ##ToCheque)
    0120 : Set : ChequeNo : $$ZeroFill:($$String:##vChequeNo):##Length
    0130 : Do If : ($$ChequeNumExists:##vName:##ChequeNo) : Return : True
    0150 : End While
     


  9. NSA

    NSA Member


    Dear Experts,

    Can anyone please help to resolve the Duplication? at Field :DelvryLocMaster......???



    [Report: DelvryLocMaster]
    Form : DelvryLocMaster
    Object: Company : ##svcurrentcompany
    Set: UniqueRCPLocationNameVar: ""
    Set: RCPRegionVar: ""
    Set: RCPPriceLevelBasetoLocationvar: ""
    Set: RCPKMvar: 0
    Set: DelvryLocMasterCtrlVar:""
    [Form: DelvryLocMaster]
    Use: Master Accounting Form
    Delete: Parts
    Add: Parts: DelvryLocMaster
    Output: NewUniqueRCPLocationName
    On: Form Accept: Yes: Form Accept
    On: Form Accept: Yes: Call:LocationCreationFunction
    Control: RCPLocDuplicateCtrl: @@IsDuplicateRCPLocation
    [Part: DelvryLocMaster]
    Lines: DelvryLocMaster, DelvryLocMasterR, DelvryLocMasterBPL, DelvryLocMasterKM
    [Line: DelvryLocMaster]
    Fields:Simple Prompt, DelvryLocMaster, DelvryLocMasterCtrl
    Local:Field:Simple Prompt: Set as: "Name of the Location"
    [Field: DelvryLocMaster]
    Use:Short Name Field
    Set as: $$Value
    Modifies: UniqueRCPLocationNameVar

    [Field: DelvryLocMasterCtrl]
    Use: Short Name Field
    Set as: $$CollectionFieldByKey:$UniqueRCPLocationName:mad:DelvryLocMasterCtrlc:LocationMaster2
    DelvryLocMasterCtrlc:##UniqueRCPLocationNameVar
    Modifies:DelvryLocMasterCtrlVar
    Invisible: Yes

    [Line: DelvryLocMasterR]
    Space Top: 3
    Fields:Simple Prompt, DelvryLocMasterR
    Local:Field:Simple Prompt: Set as: "Region:"
    [Field: DelvryLocMasterR]
    Use: Short Name Field
    Set as: $$Value
    Table: Region Master
    Show Table:Always
    Modifies: RCPRegionVar
    [Line: DelvryLocMasterBPL]
    Space Top: 3
    Fields: Simple Prompt, DelvryLocMasterBPL
    Local: Field: Simple Prompt: Set as: "Base Price Level:"
    [Field: DelvryLocMasterBPL]
    Use: Short Name Field
    Set as: $$Value
    Table: Price Levels
    Show Table:Always
    Modifies: RCPPriceLevelBasetoLocationvar
    [Line: DelvryLocMasterKM]
    Space Top: 3
    Fields: Simple Prompt, DelvryLocMasterKM
    Local: Field: Simple Prompt: Set as: "Km?:"
    [Field: DelvryLocMasterKM]
    Use : Amount Field
    Set as: $$Value
    Modifies: RCPKMvar

    [Collection: LocationMaster2]
    Type : Location Master : Company
    Childof : ##SVCurrentCompany
    Fetch: RCPPriceLevelBasetoLocation, UniqueRCPLocationName
    Search Key : $UniqueRCPLocationName

    [system: Formula]
    RCPLocDuplicateCtrl: "Duplicate..."
    IsDuplicateRCPLocation: $$String:##DelvryLocMasterCtrlVar = $$String:##UniqueRCPLocationNameVar
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Use Attribute --- UNIQUE
     


  11. NSA

    NSA Member


    Sir,

    Originally I was saving all the data in a tabular form by Aggregate. Now I am trying to change that format similar to a ledger creation. Hence here in the field, there is no storage associated to it. And on acceptance of this form the function will store the variables to original database of Aggregate
     


Share This Page