Python Project
Python Project
Python Project
This lifecycle provides a step-by-step understanding of how the script works, from
initialization and user input, through calculations and data preparation, to the
creation and styling of the PDF document.
Hardware Requirement:
Processor –Core i5
Hard Disk – 256 GB
Memory – 4GB RAM
Monitor
Software Requirement:
Windows 10 or higher
Python
Reortlab Module
Datetime Module
Advantages
Please note that while this script can serve these purposes,
it would need to be modified and improved to handle real-
world scenarios effectively. For instance, it would need to
handle different types of inputs, errors, and exceptions. It
might also need to be integrated with a database to store
transaction data. Additionally, the user interface could be
improved for ease of use.
Source Code
#MADE BY - JASHAN SINGH & AYUSH SINGH
DATA = [
now=datetime.now()
date=now.strftime("%H:%M:%S")
sub_total , discount = 0 , 0
while(True):
l=[]
if(product=="0") :
break
quantity=float(input("Enter quantity : "))
l.append(str(date))
l.append(product.upper())
l.append(str(quantity))
l.append(str(price))
sub_total=sub_total+(price*quantity)
DATA.append(l)
discount=round(sub_total*(0.025),2)
if(sub_total>=2000):
discount=round(sub_total*(0.050),2)
total=sub_total-discount
sblst=[]
sblst.append("Sub Total")
sblst.append(" ")
sblst.append(" ")
sblst.append(str(sub_total))
DATA.append(sblst)
dislst=[]
dislst.append("Discount")
dislst.append(str(discount))
DATA.append(dislst)
totallst=[]
totallst.append("Total")
totallst.append(" ")
totallst.append(" ")
totallst.append(str(total))
DATA.append(totallst)
print(DATA)
styles = getSampleStyleSheet()
title_style.alignment = 1
style = TableStyle(
( "GRID" , ( 0, 0 ), ( -1 , -1 ), 1 , colors.black ),
( "BACKGROUND" , ( 0, 0 ), ( 3, 0 ), colors.gray ),
www.geeksforgeeks.org