warn-skript, euro-umstellungsfehler

This commit is contained in:
Enno Rehling 2002-02-04 23:44:14 +00:00
parent 17a3cfd8df
commit 4fd1c237d1
5 changed files with 53 additions and 11 deletions

View File

@ -11,17 +11,17 @@ From="accounts@vinyambar.de"
server=smtplib.SMTP('localhost') server=smtplib.SMTP('localhost')
cursor=db.cursor() cursor=db.cursor()
records=cursor.execute("SELECT users.id, users.password, users.email, users.balance, "+ records=cursor.execute("SELECT u.id, u.password, u.email, "+
"races.name, "+ "races.name, "+
"games.name, games.info, subscriptions.id "+ "games.name, games.info, subscriptions.id "+
"from users, games, subscriptions, races "+ "from users u, games, subscriptions, races "+
"where users.id = subscriptions.user AND games.id = subscriptions.game "+ "where u.id = subscriptions.user AND games.id = subscriptions.game "+
"AND races.race = subscriptions.race AND races.locale='de' "+ "AND races.race = subscriptions.race AND races.locale='de' "+
"AND subscriptions.status='NEW'") "AND subscriptions.status='NEW'")
while (records>0): while (records>0):
records = records - 1 records = records - 1
customerid, passwd, email, balance, race, gamename, gameinfo, subscription = cursor.fetchone() customerid, passwd, email, race, gamename, gameinfo, subscription = cursor.fetchone()
Msg = ("From: "+From+"\nTo: "+email+"\nSubject: Vinyambar Anmeldung angenommen.\n\n"+ Msg = ("From: "+From+"\nTo: "+email+"\nSubject: Vinyambar Anmeldung angenommen.\n\n"+
"Deine Anmeldung für '"+gamename+"' wurde akzeptiert.\n" "Deine Anmeldung für '"+gamename+"' wurde akzeptiert.\n"
@ -31,7 +31,6 @@ while (records>0):
"Auftragsnummer: " + str(int(subscription)) + "\n"+ "Auftragsnummer: " + str(int(subscription)) + "\n"+
"Passwort: " + passwd + "\n" + "Passwort: " + passwd + "\n" +
"Rasse: " + race + "\n\n"+ "Rasse: " + race + "\n\n"+
"Kontostand: " + str(balance) + " DEM\n\n"+
"Bitte bewahre diese Mail sorgfältig auf, da Du deine Kundennummer und das\n"+ "Bitte bewahre diese Mail sorgfältig auf, da Du deine Kundennummer und das\n"+
"Passwort für das Spiel benötigst. Solltest Du noch Fragen zu Deiner \n"+ "Passwort für das Spiel benötigst. Solltest Du noch Fragen zu Deiner \n"+
"Anmeldung haben, wende Dich bitte an accounts@vinyambar.de.\n\n"+ "Anmeldung haben, wende Dich bitte an accounts@vinyambar.de.\n\n"+

View File

@ -23,7 +23,7 @@ i=cursor.execute('SELECT sum(balance) from transactions WHERE user='+str(userid)
balance=cursor.fetchone()[0] balance=cursor.fetchone()[0]
if balance==None: if balance==None:
balance=0.0 balance=0.0
print 'Balance for '+firstname+' '+lastname+' is '+str(balance)+' DEM' print 'Balance for '+firstname+' '+lastname+' is '+str(balance)+' EUR'
if len(sys.argv)>4: if len(sys.argv)>4:
cash=float(sys.argv[3]) cash=float(sys.argv[3])
@ -47,9 +47,9 @@ if len(sys.argv)>4:
"Kundennummer: "+str(userid)+"\n"+ "Kundennummer: "+str(userid)+"\n"+
"Eingangsdatum: "+date+"\n"+ "Eingangsdatum: "+date+"\n"+
"Transaktionsnummer: "+str(lastid)+"\n"+ "Transaktionsnummer: "+str(lastid)+"\n"+
"Alter Kontostand: "+str(balance)+" DEM\n"+ "Alter Kontostand: "+str(balance)+" EUR\n"+
"Zahlungseingang: "+str(cash)+" DEM\n"+ "Zahlungseingang: "+str(cash)+" EUR\n"+
"Neuer Kontostand: "+str(balance+cash)+" DEM\n"+ "Neuer Kontostand: "+str(balance+cash)+" EUR\n"+
"Verwendungszweck: "+reason+"\n"+ "Verwendungszweck: "+reason+"\n"+
"\n"+ "\n"+
"Deine Zahlung ist eingegangen und wurde auf dein Spielerkonto verbucht.\n") "Deine Zahlung ist eingegangen und wurde auf dein Spielerkonto verbucht.\n")
@ -65,5 +65,5 @@ cursor.execute("select count(*) from users u, transactions t where u.id=t.user g
count = cursor.fetchone()[0] count = cursor.fetchone()[0]
cursor.execute("select sum(transactions.balance) from transactions") cursor.execute("select sum(transactions.balance) from transactions")
balance = cursor.fetchone()[0] balance = cursor.fetchone()[0]
print str(balance)+ " DEM (" + str(balance/1.955830)+ " EUR) in " + str(int(count)) + " Konten" print str(balance)+ " EUR (" + str(balance*1.955830)+ " DEM) in " + str(int(count)) + " Konten"

View File

@ -39,7 +39,7 @@ def show_detail():
while count>0: while count>0:
count = count-1 count = count-1
balance, description, date = cursor.fetchone() balance, description, date = cursor.fetchone()
custdetail.addstr(line, 2, str(date)[0:10]+' - '+description+' - '+str(balance)+' DEM') custdetail.addstr(line, 2, str(date)[0:10]+' - '+description+' - '+str(balance)+' EUR')
line=line+1 line=line+1
custdetail.refresh() custdetail.refresh()

42
scripts/register/warn.py Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env python
import MySQLdb
import sys
import smtplib
From='accounts@vinyambar.de'
dbname=sys.argv[1]
price=1.25
warnahead=2
db=MySQLdb.connect(db=dbname)
cursor=db.cursor()
users = cursor.execute("select users.email, users.id, count(subscriptions.game) from users, subscriptions, games where users.id=subscriptions.user and subscriptions.game=games.id and games.status='RUNNING' GROUP BY users.id")
server=smtplib.SMTP('localhost')
while users > 0:
users=users-1
email, uid, games = cursor.fetchone()
c2 = db.cursor()
t = c2.execute("select sum(balance) from transactions where user="+str(int(uid)))
if t==0:
balance=0.0
else:
balance = c2.fetchone()[0]
if balance < games*warnahead*price:
print "Warning "+email+", uid="+str(int(uid))+", balance="+str(balance)+", games="+str(int(games))
Msg = ("From: Vinyambar Buchhaltung <"+From+">\nTo: "+email+"\nSubject: Vinyambar Kontostand, Warnung.\n\n"+
"Dein Vinyambar Kontostand reicht nicht mehr aus, um die kommenden "+str(warnahead)+"\n"+
"Wochen zu bezahlen. Bitte mache baldmöglichst eine neue Überweisung\n"
"auf das Vinyambar-Konto.\n\n"+
"Kundennummer: "+str(uid)+"\n"+
"Kontostand: "+str(balance)+" EUR\n"+
"\n"+
"Unser Konto: Katja Zedel\n"+
"Kontonummer 1251 886 106\n"+
"BLZ 500 502 01 (Frankfurter Sparkasse)\n")
try:
# print Msg
server.sendmail(From, email, Msg)
except:
print "Could not send confirmation to "+email
print "Exception is:", sys.exc_type, ":", sys.exc_value

View File

@ -15,3 +15,4 @@ while k!=0:
user = int(cursor.fetchone()[0]) user = int(cursor.fetchone()[0])
update=db.cursor() update=db.cursor()
update.execute("INSERT INTO transactions (user,date,balance,description) VALUES ("+str(user)+", '"+date+"', -"+str(price)+", 'ZAT-"+str(game)+"')") update.execute("INSERT INTO transactions (user,date,balance,description) VALUES ("+str(user)+", '"+date+"', -"+str(price)+", 'ZAT-"+str(game)+"')")