Invoices record each fuel sale transaction, capturing the customer, fuel type, volume, payment method, any discount applied, and the total price charged. Every invoice is identified by a uniqueDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Adarsh275/PetrolPump-Management-System/llms.txt
Use this file to discover all available pages before exploring further.
Invoice_No and optionally links to a customer record via the Customer_Code foreign key, enabling a complete per-customer purchase history. The Date field also acts as a foreign key to the Sales table, correlating invoices with nozzle-level sales shift data.
Invoice Fields
Primary key. A unique alphanumeric identifier for the invoice. Example:
"XC34".Date on which the fuel sale took place. Also used as a foreign key to
Sales.Date.Method of payment used for the transaction. Common values:
"Cash", "UPI", "Credit Card", "Debit Card".Volume of fuel dispensed, measured in litres.
Type of fuel purchased. Known values in the system:
"PetrolE10", "Diesel", "CNG", "Gasoline91", "Kerosene".Percentage discount applied to the sale, if any.
NULL indicates no discount was applied.Final amount charged to the customer in Indian Rupees (₹), after any discount is applied.
Foreign key referencing
Customer.Customer_Code. Links the invoice to a specific customer. May be NULL for anonymous sales.Add an Invoice
Fill in the invoice form
Complete all fields in the form:
- Invoice_No — unique identifier (e.g.
XC34) - Date — sale date (date picker)
- Payment_Type — payment method (e.g.
UPI) - Fuel_Amount — litres dispensed (numeric)
- Fuel_Type — fuel product name (e.g.
Diesel) - Discount — discount percentage (numeric; enter
0for none) - Total_Price — final charged amount in ₹ (numeric)
- Customer_Code — linked customer code (e.g.
SFG252)
create.py):
add_Invoice_data() in database.py:
View Invoices
The
read_for_Invoice() function in read.py fetches all rows and renders them as a DataFrame with all eight columns:
Update an Invoice
Choose the invoice to edit
The current records are shown in the Current Invoice details expander. Select the target invoice from the Invoice to Edit dropdown, which is populated with all existing
Invoice_No values.Edit the mutable fields
The form pre-fills with the selected invoice’s current values. Modify any of the following:
- Date
- Payment_Type
- Fuel_Amount
- Fuel_Type
- Discount
- Total_Price
- Customer_Code
Invoice_No is the primary key and is not editable through the UI. To change an invoice number, delete the existing record and create a new one.edit_Invoice_data() in database.py:
Delete an Invoice
Select the invoice
Choose the
Invoice_No of the invoice to remove from the Invoices to delete dropdown. A warning banner will display the selected invoice number for confirmation.delete_data_Invoice() in database.py:
Deleting an invoice does not delete the related
Customer record or any Sales records. The Customer referenced by Customer_Code and any Sales row sharing the same Date remain entirely unaffected.Seed / Sample Data
The following five invoice records are inserted bycreate_table.sql as the initial dataset:
Payment Types Reference
The following payment types appear in the seed data and are supported by the system:- Cash — direct cash payment at the pump
- UPI — Unified Payments Interface (e.g. GPay, PhonePe, Paytm)
- Credit Card — credit card transaction
- Debit Card — debit card transaction
Fuel Types Reference
The following fuel product names appear in the seed data and are accepted values forFuel_Type:
- PetrolE10 — 10 % ethanol-blended petrol
- Diesel — standard diesel
- CNG — Compressed Natural Gas
- Gasoline91 — 91-octane petrol / gasoline
- Kerosene — kerosene / paraffin