PROCEDURE Virement_CCP() // -------------------------------------------------------------------------------------- // ----------------------- Virement CCP By BOUSSAID Mustapha --------------------------- // ----------------------------- APC SALI 2020 ------------------------------------------ sRes is string = "" // Name of the selected directory // Using the Windows directory picker sRes = fSelectDir("C:\", "اختر مجلد الحفظ", "اختر المجلد أو المكان الذي سيتم حفظ الملف النصي فيه") // Was the selection of a directory validated the user IF sRes <> "" THEN // Identifier of the external file: // this identifier is used by all the functions for managing the external files nFileID is int nNbrligne is int // Retrieve the number of employees nNbrligne = HNbRec(ActiveUsers,hStateActive) //Operation date sDatesave is string = DateToString(EDT_Date,"mm_yyyy") // Create the txt file in the selected directory nFileID = fCreate(CompleteDir(sRes)+sDatesave+".txt",foAnsi) fClose(nFileID) // Open the txt file in read/write found in the Selected directory nFileID = fOpen(CompleteDir(sRes)+sDatesave+".txt",foAnsi+foReadWrite) // Check the file opening IF nFileID = -1 THEN Error("Error while creating the file",ErrorInfo()) RETURN END //Get Total & CTS nTot is int = EDT_tot cyB is currency sCt is string cyB = DecimalPart(EDT_tot) sCt = Middle(NumToString(cyB,".2f"),3,4) //First line fWriteLine(nFileID, "*"+Complete("", 8, "0")+Complete(NumToString(EDT_ccp,"012d"),12,"0")+Complete(NumToString(nTot,"011d"),11,"0")... +Complete(sCt, 2)+Complete(NumToString(nNbrligne,"07d"),7)+DateToString(EDT_Date,"mm")+ DateToString(EDT_Date,"YYYY")+Complete("", 14)+ "0") //Users HReadFirst(ActiveUsers,nameFR) WHILE HFound(ActiveUsers) //cle or rip sClee is string IF INT_MiniSwitchExternalD = 1 THEN sClee = ActiveUsers.CleRIP ELSE sClee = ActiveUsers.CleCCP END //Get the amount & Decimal nMont is int = ActiveUsers.total2 cyCts is currency sCts is string cyCts = DecimalPart(ActiveUsers.total2) sCts = Middle(NumToString(cyCts,".2f"),3,4) //LINE PER EMPLOYEE fWriteLine(nFileID, "*"+Complete("", 8, "0")+Complete(NumToString(ActiveUsers.Num_Compte,"010d"),10,"0") + sClee+ Complete(NumToString(nMont,"011d"),11,"0")... +Complete(sCts, 2)+Complete(StringBuild("%1 %2",ActiveUsers.nameFR, ActiveUsers.prenome),27)+ "1") HReadNext(ActiveUsers,nameFR) END // Close the txt file fClose(nFileID) // Inform the user Info(CompleteDir(sRes)+sDatesave+".txt " + "was successfully generated") ELSE // No directory was selected by the user Info("تم الإلغاء") END