def cocacolaZero(): connectorinsert( "INSERT INTO mutatie (productid, datum, tijd) VALUES (%s, %s, %s)", (123458, getdate(), gettime())) voorraad = connector( "select voorraadaantal FROM voorraad WHERE productid = 123458") for x in voorraad: y = int(''.join(map(str, x))) updatevoorraad = y - 1 print(updatevoorraad) connectorupdate( "UPDATE voorraad SET voorraadaantal = '%s' WHERE productid = 123458" % (updatevoorraad))
def voorraadcontrole(): voorraad = connector("SELECT * FROM voorraad") for x in voorraad: product_id = x[0] product_naam = x[1] product_aantal = x[2] product_prijs = x[3] if product_aantal < 4: mailfunctie( "Product bijna op: " + product_naam, "Beste gebruiker,\nuw " + product_naam + " is bijna op.\nEr zijn nog maar " + str(product_aantal) + " over. Vul deze zo snel mogelijk bij.\nDit is een automatisch gegenereerde e-mail.", office365Usr, office365Pass)