Greetings, I hope everyone is in good health and happiness... I have 3 invoices with the following codes with serial numbers: 1st invoice: RS001, RS002, RS003..... RSnnn 2nd invoice: MB001, MB002, MB003..... MBnnn 3rd invoice: BQ001, BQ002, BQ003..... BQnnn I want to save the 3 invoices in a table. I created an automatic identifier ID with the code for each invoice, namely RS, MB and BQ so when I add data with the RS code, the sequence numbers are 1,2,3.... (automatic) then when I add data with code MB, the sequence numbers are 1,2,3... (automatic), likewise for code BQ Please help... Thank You
Salut, Il suffit de garder le dernier numéro soit dans un fichier ou comme paramètre Et voilà J'ai pas compris où était la difficulté. Ça me paraît tellement évident.
Je pense que lui son problème c'est de transformer 1 en 001. Là non plus d'ailleurs, pas besoin d'avoir fait les grandes écoles. Par contre, popoy, le dernier numéro d'une facture il se trouve dans la dernière facture. Donc HSauvePoisition, HlitDernier, HretourPosition et +1 pour la prochaine.
thank you in advance for your response, I have found the solution as follows: MyQRY_Max is Data Source MyCode_Max is string MyCode_Max = [ SELECT test.code AS code, MAX(test.number) AS Max_number FROM test WHERE test.code = {Var_Code} GROUP BY test.code ] MyQRY_Max.Var_Code = EDT_Code HExecuteSQLQuery(MyQRY_Max,hQueryDefault,MyCode_Max) IF EDT_Code = "" THEN ReturnToCapture(EDT_Code) TEST.CODE = EDT_Code IF HNbRec(MyQRY_Max) = 0 THEN TEST.NUMBER = 1 ELSE TEST.NUMBER = MyQRY_Max.Max_number + 1 END HAdd(TEST) TableDisplay(TABLE_TEST,taCurrentRecord) Thanks, problem solved