import sqlite3
from datetime import date,time
curr_date = date.today()
conn = sqlite3.connect( 'mydatabase.db' )
cursor = conn.cursor ()
v = input("enter itemname ")
cursor.execute("SELECT basicquantity FROM local WHERE `itamname`=?",[v])
itamname = cursor.fetchone()[0]
date = curr_date.strftime('%Y-%m-%d')
cursor.execute("SELECT basicquantity from local WHERE itamname=?",[v,])
result = cursor.fetchone()[0]
cursor.execute("SELECT SUM(userquantity) FROM local WHERE itamname=?",[v,])
c = cursor.fetchall()[0][0]
print("SUM",c)
o = result - c
print("subtraction",o)
if itamname:
r = int(input("enter quantity"))
if r < o or r == o:
conn.execute('''insert into local
select ? ,po , itamno,itamname,basicquantity,rate, ?
from local
where itamname= ? ORDER BY itamname DESC LIMIT 1;''',[date, r,v])
else:
print("quantity grater than inventry")
else:
print("insert valid itemname ")
conn.commit()
conn.close()
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOS5mPyK4k49%3D6__dnPiOprzoeMa4CpUMkD7YwoHDhDqE_SoVw%40mail.gmail.com.
No comments:
Post a Comment