Skip to main content

Documentation 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.

Customers are the end users of the petrol pump. Each customer record is identified by a unique Customer_Code and can be linked to multiple invoices for fuel purchase history. The Customer table sits at the heart of sales tracking — every invoice optionally carries a Customer_Code foreign key so that per-customer purchase history can be reconstructed at any time.

Customer Fields

Customer_Code
varchar(10)
required
Primary key. A unique alphanumeric code that identifies the customer across the system. Example: "SFG252".
C_Name
varchar(30)
required
Full name of the customer.
Phone_No
char(10)
10-digit mobile or landline number. Stored as a fixed-width char to preserve leading zeros.
Email_ID
varchar(100)
Customer email address, used for communication and record-keeping.
Gender
char
Single character representing gender. Accepted values: 'M' (Male) or 'F' (Female).
City
varchar(50)
City of residence of the customer.
Age
int(3)
Age of the customer in years.

Add a Customer

1

Open the Customer table

In the left sidebar, select Customer from the Tables dropdown.
2

Choose the Add operation

Select Add from the CRUD Operations dropdown. The subheader will read “Enter trainer Details:”.
3

Fill in the form fields

Complete the following fields in the form:
  • Customer_Code — unique identifier (e.g. SFG252)
  • C_Name — customer’s full name
  • Phone_No — 10-digit phone number
  • Email_ID — email address
  • GenderM or F
  • City — city of residence
  • Age — age in years (numeric input)
4

Submit the record

Click Add Customer Details. A success banner will confirm the new Customer_Code.
The UI function that collects the form inputs (create.py):
def create_for_Customer():
    with st.container():
        Customer_Code = st.text_input("Customer_Code")
        C_Name = st.text_input("C_Name:")
        Phone_No = st.text_input("Phone_No:")
        Email_ID = st.text_input("Email_ID")
        Gender = st.text_input("Gender:")
        City = st.text_input("City:")
        Age = st.number_input("Age")

    if st.button("Add Customer Details"):
        add_Customer_data(Customer_Code, C_Name, Phone_No, Email_ID, Gender, City, Age)
        st.success("Successfully added Customer details: {}".format(Customer_Code))
The underlying INSERT statement executed by add_Customer_data() in database.py:
INSERT INTO Customer
  (Customer_Code, C_Name, Phone_No, Email_ID, Gender, City, Age)
VALUES
  (%s, %s, %s, %s, %s, %s, %s);

View Customers

1

Open the Customer table

In the sidebar, select CustomerView.
2

Expand the data panel

Click the View all Customers expander to reveal the full DataFrame.
The read_for_Customer() function in read.py fetches all rows and maps them to a pandas DataFrame with these columns:
def read_for_Customer():
    result = view_all_Customer_data()
    df = pd.DataFrame(result, columns=[
        'Customer_Code', 'C_Name', 'Phone_No',
        'Email_ID', 'Gender', 'City', 'Age'
    ])
    with st.expander("View all Customers"):
        st.dataframe(df)

Update a Customer

1

Open the Update screen

In the sidebar, select CustomerUpdate.
2

Choose the customer to edit

The current records are shown in the Current Customer details expander. Select the target customer from the Customer to Edit dropdown, which is populated with all existing Customer_Code values.
3

Edit the mutable fields

The form pre-fills with the selected customer’s current values. Modify any of the following fields:
  • C_Name
  • Phone_No
  • Email_ID
  • Gender
  • City
  • Age
4

Save changes

Click Update Customer. The updated table is shown in the Updated data expander.
Customer_Code is the primary key and is not editable through the UI. Only C_Name, Phone_No, Email_ID, Gender, City, and Age can be changed. To change a Customer_Code, the record must be deleted and re-created.
The UPDATE statement executed by edit_Customer_data() in database.py:
UPDATE Customer
SET
    C_Name     = %s,
    Phone_No   = %s,
    Email_ID   = %s,
    Gender     = %s,
    City       = %s,
    Age        = %s
WHERE Customer_Code = %s;

Delete a Customer

1

Open the Remove screen

In the sidebar, select CustomerRemove.
2

Select the customer

Choose the Customer_Code of the customer to remove from the Customer to delete dropdown. A warning banner will display the selected code for confirmation.
3

Confirm deletion

Click Delete customer. A success message is shown and the record is removed from the table.
The DELETE statement executed by delete_data_Customer() in database.py:
DELETE FROM Customer
WHERE Customer_Code = "<selected_Customer_Code>";
If the customer has one or more associated Invoice records (linked via Invoice.Customer_Code), MySQL will block the deletion with a foreign key constraint error. Remove or reassign those invoices first before deleting the customer.

Seed / Sample Data

The following six customer records are inserted by create_table.sql and serve as the initial dataset:
INSERT INTO `Customer`
  (`Customer_Code`, `C_Name`, `Phone_No`, `Email_ID`, `Gender`, `City`, `Age`)
VALUES
  ('SFG252', 'Akash',   '6542589700', 'akash@gmail.com',     'M', 'Bihar',     27),
  ('GHE785', 'Praneet', '7539514600', 'praneet@yahoo.com',   'M', 'Orissa',    59),
  ('FJD253', 'Chetan',  '8426951300', 'chetan@hotmail.com',  'M', 'Bengalore', 24),
  ('OUI325', 'Ayush',   '7618425500', 'ayush@outlook.com',   'M', 'Kota',      18),
  ('CGM235', 'Vinesh',  '6794324600', 'vines@pesu.pes.edu',  'M', 'Kolkata',   54),
  ('BFR426', 'Anamika', '9569731800', 'anamika@gmai.com',    'F', 'Jharkhand', 26);

The Serves join table (Employee_ID, Customer_Code) records which employees have served which customers. This relationship is seeded directly in the database and is not exposed through the Streamlit UI — it can be queried via Query → Custom Query using SELECT * FROM Serves.

Build docs developers (and LLMs) love