Fuel Buy
Available to: Admin, Super Admin, Machinery Owner, Machinery Operator, Bunk Salesman
Manage fuel purchase records from bunks for machinery operations.
Workflow
A fuel buy request goes through the following lifecycle:
Owner/Operator adds buy → Status: "Pending" → Owner reviews & clicks "Request" → Status: "Requested" → Bunk Salesman reviews → Accepted or Declined
Step-by-step
- Machinery Owner or Operator opens
/fuels/buyand clicks Add to create a new buy request with fuel details and proof uploads - The request is created with status "Pending" — this is a draft state where the owner can review and edit the details
- Owner/Operator opens the request detail view to review the filled details
- The allowed service limit is displayed at the top
- A "Pending" badge with a pencil icon and cancel option is shown
- The form remains editable — the owner can update any field
- A "Request" button is shown at the bottom
- Owner/Operator clicks "Request" to submit the request to the bunk — status changes to "Requested"
- Bunk Salesman opens the same
/fuels/buypage, sees the request, and clicks into the detail view- The form is read-only for the salesman — they cannot edit any fields
- They see Accept and Decline buttons at the bottom
- Salesman takes action:
- Accept — Status changes to "Accepted", salesman ID and timestamp are recorded. A settlement is created with status "Pending" and a due date (see Settlement Lifecycle below)
- Decline — A modal appears to enter a decline reason. Status changes to "Declined" with the reason stored
- If Declined, the Owner/Operator can edit the request and resubmit — status goes back to "Requested" for the salesman to review again
- If status is Pending, the Owner/Operator can Cancel the request
Settlement Lifecycle
When a buy request is accepted, a settlement is automatically created and eventually credited to the bunk owner's company wallet:
- Acceptance — Settlement created with status "Pending" and a due date calculated as: accepted date + bunk's settlement duration days
- Due date arrives — A daily automated job finds all pending settlements that are due
- Auto-settlement — The job marks the settlement as "Paid" and credits the final amount (bill amount minus commission) to the bunk owner's company wallet with source "Bunk Settlement"
Day 0: Salesman accepts buy request (₹5,000)
→ Settlement created: Pending, commission ₹200, due in 7 days
Day 7: Auto-settlement runs
→ Settlement: Pending → Paid
→ Company wallet: +₹4,800 (source: "Bunk Settlement")
You can track settlements at Fuels → Settlements (/fuels/settlements), and the wallet credit appears in the company's wallet history at Companies → [Company] → Account → Wallet.
Status Flow
┌─────────┐ Owner clicks "Request" ┌──────────┐
│ Pending │ ────────────────────────► │ Requested│
└────┬────┘ └────┬─────┘
│ │
│ Owner cancels Salesman reviews
▼ ┌──────┴──────┐
┌──────────┐ ▼ ▼
│ Canceled │ ┌──────────┐ ┌──────────┐
└──────────┘ │ Accepted │ │ Declined │
└──────────┘ └─────┬────┘
│
Owner/Operator
edits & resubmits
│
▼
┌──────────┐
│ Requested│ (back to review)
└──────────┘
Who can do what
| Role | Can Create | Can Edit | Can Request | Can Accept/Decline | Can Cancel |
|---|---|---|---|---|---|
| Machinery Owner | Yes | Yes (when Pending/Declined) | Yes (when Pending) | No | Yes (when Pending) |
| Machinery Operator | Yes | Yes (when Pending/Declined) | Yes (when Pending) | No | Yes (when Pending) |
| Bunk Salesman | No | No (read-only) | No | Yes (when Requested) | No |
| Admin / Super Admin | Yes | Yes | Yes | Yes | Yes |
All roles use the same /fuels/buy page. There is no separate interface for the salesman — the detail view shows different actions based on your role.
Buy List
Navigate to Fuels → Buy (/fuels/buy) to view all fuel buy records.
List Features
- Table and Card views — Switch between table layout and card-based display
- Global search — Search across bunk name, machinery, operator, and other fields
- Aggregated totals — Diesel and Petrol amount totals displayed at the top
List Columns
| Column | Description |
|---|---|
| Machinery | Registration number and fuel type badge |
| Amount | Purchase amount in ₹ |
| User | Owner/Operator name |
| Volume | Fuel volume in litres with filled-into icon |
| Bill | View icon for bunk bill |
| Date | Request date |
| Fuel Bunk | Bunk name and mobile number |
| Status | Color-coded status badge |
| Accepted by | Salesman name and timestamp, or "Yet to be accepted" |
Filtering
Use the filter panel to narrow results:
| Filter | Description |
|---|---|
| Fuel Bunk | Filter by specific bunk |
| Fuel Type | Petrol or Diesel |
| Status | Requested, Accepted, Declined, Canceled, Pending, Direct |
| Filled Into | Machinery, Can Single, Can Multiple |
| Machinery | Filter by specific machinery |
| Operator | Filter by machinery operator |
| Owner | Filter by machinery owner |
| Date Range | Filter by creation date |
| Amount Range | Filter by amount (min/max) |
| Rate Range | Filter by fuel rate (min/max) |
| Volume Range | Filter by volume (min/max) |
Buy Request Statuses
| Status | Color | Description |
|---|---|---|
| Requested | Yellow | Submitted, awaiting bunk salesman response |
| Accepted | Green | Bunk salesman has accepted the request |
| Declined | Red | Bunk salesman has declined (reason recorded) |
| Canceled | — | Request was canceled by owner/operator |
| Pending | Tertiary | Draft — created but not yet submitted to bunk |
| Direct | — | Direct purchase without prior request |
Creating a Buy Request
- Navigate to Fuels → Buy and click Add
- Choose From Bunk (purchase from a fuel bunk)
- Fill in the required fields and click Add — the request is saved with status "Pending"
- Open the request detail view to review your entries
- Click "Request" to submit it to the bunk — status changes to "Requested"
Core Fields
| Field | Required | Description |
|---|---|---|
| Fuel Bunk | Yes | Select the bunk where fuel will be purchased |
| Fuel Type | Yes | Petrol or Diesel |
| Filled Into | Yes | Where the fuel is being filled — Machinery, Can Single, or Can Multiple |
| Rate | Yes | Price per unit |
| Amount | Yes | Total amount |
| Volume | Auto | Calculated from rate and amount |
Conditional Fields
When Filled Into is set to Machinery or Can Single:
| Field | Description |
|---|---|
| Machinery | Select the machinery being fueled |
| Operator | Operator performing the fill |
| Owner | Machinery owner |
Proof Uploads
| Upload | Purpose |
|---|---|
| Before Filled Proof | Photo of fuel gauge/tank before filling |
| After Filled Proof | Photo after filling is complete |
| Bunk Meter Proof | Photo of the bunk's meter reading |
| Bunk Bill | Scanned copy of the fuel bill |
Notes
Add optional notes for additional context about the fuel purchase.
Viewing & Editing a Buy Request
Click any record in the Buy list to open the detail view (/fuels/buy/$fuelBuyId).
As Owner/Operator
- Review details and click "Request" to submit to bunk (when status is Pending)
- Edit fields and proof uploads (when status is Pending or Declined)
- Resubmit a declined request (status goes back to "Requested")
- Cancel a pending request
As Bunk Salesman
- View request details (all fields are read-only)
- Accept — Confirms the fuel purchase
- Decline — Opens a modal to enter a decline reason
Decline History
When a request is declined, the reason, declined-by user, and timestamp are stored. A request can be declined multiple times (if resubmitted after each decline), and the full decline history is viewable.
Editing Proof Uploads
Proof files can be re-uploaded or replaced when editing, depending on status and role:
| Status | Can Edit Proofs? |
|---|---|
| Pending | Yes |
| Declined | Yes |
| Canceled | Yes |
| Requested | No (locked) |
| Accepted | No (locked) |
Bunk Salesman users cannot edit proof uploads on any existing request regardless of status.