home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog Special Freeware 31
/
FreelogHS31.iso
/
ArgentCompta
/
Bankperfect
/
bp.exe
/
Scripts
/
Rib
/
rib.py
< prev
Wrap
Text File
|
2005-10-25
|
3KB
|
75 lines
import BP
def key(banque, agence, compte):
try:
s = ""
l = "12345678912324567892345678"
for c in compte.upper():
if c.isalpha(): s += l[ord(c) - 65]
else: s += c
i = (8 * long(banque)) % 97 + 194 - (15 * long(agence)) % 97 - (3 * long(s)) % 97
i = i % 97
if i == 0: i = 97
if i < 10: return "0%d" %i
return "%d" %i
except:
return ""
i = BP.AccountCurrent()
bank = BP.AccountBankName[i]
bic = BP.AccountBIC[i]
iban = BP.AccountIBAN[i]
logo = BP.AccountBankLogo[i]
guic = BP.AccountBranchName[i]
adr = BP.AccountBranchAddress[i]
n1, n2 = BP.AccountBranchNumber[i].split(" ")
n3 = BP.AccountNumber[i]
f = CreateComponent("TForm", None)
f.Font.Name = "Tahoma"
f.SetProps(Position="poMainFormCenter", Width=400, Height=180, Caption="Impression de RIB", BorderStyle="bsSingle", BorderIcons=["biSystemMenu"])
CreateComponent("TLabel", f).SetProps(Parent=f, Left=30, Top=30, Caption="Nom du titulaire du compte :")
CreateComponent("TLabel", f).SetProps(Parent=f, Left=30, Top=60, Caption="ClΘ RIB :")
E1 = CreateComponent("TEdit", f)
E1.SetProps(Parent=f, Left=180, Top=25, Width=180)
E2 = CreateComponent("TEdit", f)
E2.SetProps(Parent=f, Left=180, Top=55, Width=180, Text=key(n1, n2, n3))
CreateComponent("TButton", f).SetProps(Parent=f, Left=100, Top=100, Width=90, Height=25, Caption="OK", ModalResult=1, Default=1)
CreateComponent("TButton", f).SetProps(Parent=f, Left=200, Top=100, Width=90, Height=25, Caption="Annuler", ModalResult=2, Cancel=1)
f.ShowModal()
pdf = """FontName Helvetica-Bold
%s
TextOut 700;%d;RelevΘ d'IdentitΘ Bancaire
FontName Helvetica
TextOut 200;%d;Banque
TextOut 700;%d;: %s
TextOut 200;%d;Guichet
TextOut 700;%d;: %s
TextOut 200;%d;N░ de compte
TextOut 700;%d;: %s
TextOut 200;%d;ClΘ RIB
TextOut 700;%d;: %s
TextOut 200;%d;Nom du titulaire
TextOut 700;%d;: %s
TextOut 200;%d;Domiciliation
TextOut 700;%d;: %s
TextOut 200;%d;N░ IBAN (international)
TextOut 700;%d;: %s
TextOut 200;%d;Bank Identification Code
TextOut 700;%d;: %s
"""
def printRIB(Y):
if logo == "": s = ""
else: s = "DrawImage 300;200;200;%d;%s" %(Y, logo.replace("\\", "\\\\"))
return pdf %(s, Y+80, Y+300, Y+300, n1, Y+350, Y+350, n2, Y+400, Y+400, n3, Y+450, Y+450, E2.Text, Y+500, Y+500, E1.Text, Y+550, Y+550, "%s, %s" %(bank, adr), Y+600, Y+600, iban, Y+650, Y+650, bic)
if f.ModalResult == 1:
line = "DrawLine 100;%d;2000;%d\n"
path = BP.BankPerfectExePath() + 'bankperfect_rib.pdf'
code = "Create Reτu;%s;2100;2970\nFontSize 40\n%s%s%s%s%s" %(path.replace("\\", "\\\\"), printRIB(200), line %(1000,1000), printRIB(1100), line %(1900,1900), printRIB(2000))
BP.GetURL("pdf:%s" %code)
BP.ShellExecute("open", path, "", 1)