@php
/* Controller can pass $patients and $products. The fallbacks keep this Blade usable immediately. */
$billingPatients = ($patients ?? \App\Models\Patient::query()
->select('id', 'sheet_no', 'patient_name', 'first_name', 'middle_name', 'last_name', 'phone', 'age', 'gender', 'place')
->latest('id')->get())
->map(function ($patient) {
$fullName = trim(collect([$patient->first_name, $patient->middle_name, $patient->last_name])->filter()->implode(' '));
return [
'id' => (string) $patient->id,
'sheet_no' => (string) ($patient->sheet_no ?? ''),
'name' => (string) ($patient->patient_name ?: $fullName ?: 'Unnamed Patient'),
'phone' => (string) ($patient->phone ?? ''),
'age' => (string) ($patient->age ?? ''),
'gender' => (string) ($patient->gender ?? ''),
'place' => (string) ($patient->place ?? ''),
];
})->values();
$billingProducts = ($products ?? \App\Models\Product::query()
->with('categoryDetail')
->orderBy('product_name')->get())
->map(function ($product) {
return [
'id' => (string) $product->id,
'name' => (string) $product->product_name,
'code' => (string) ($product->hsn_code ?: $product->id),
'category' => (string) (optional($product->categoryDetail)->category_name ?? optional($product->categoryDetail)->name ?? ''),
'brand' => (string) ($product->brand ?? ''),
'sp' => (float) ($product->selling_price ?? 0),
'gst' => (float) ($product->tax ?? 0),
'stock' => (float) ($product->current_stock ?? 0),
'unit' => trim((string) ($product->st_val ?? '') . ' ' . (string) ($product->st_unit ?? '')),
'status' => (string) ($product->status ?? 'active'),
];
})->values();
$billingHoldBills = ($holdBills ?? collect())->map(function ($hold) {
return [
'id' => (string) $hold->id,
'name' => (string) ($hold->bill_name ?: 'Bill'),
'customer' => (string) ($hold->customer_name ?: 'Walk-in'),
'patientId' => $hold->patient_id ? (string) $hold->patient_id : null,
'patientPhone' => (string) ($hold->customer_phone ?? ''),
'discType' => (string) ($hold->discount_type ?? 'flat'),
'discount' => (float) ($hold->discount_value ?? 0),
'charge' => (float) ($hold->charge ?? 0),
'chargeLabel' => (string) ($hold->charge_label ?? ''),
'heldAt' => optional($hold->held_at)->format('h:i A'),
'items' => collect($hold->items ?? [])->map(function ($item) {
return [
'id' => (string) ($item['product_id'] ?? ''),
'name' => (string) ($item['name'] ?? ''),
'code' => (string) ($item['code'] ?? ''),
'unit' => (string) ($item['unit'] ?? ''),
'sp' => (float) ($item['sp'] ?? 0),
'gst' => (float) ($item['gst'] ?? 0),
'qty' => (float) ($item['qty'] ?? 0),
'remark' => (string) ($item['remark'] ?? ''),
'stock' => (float) ($item['stock'] ?? 0),
];
})->values(),
];
})->values();
@endphp
POS Billing
{{-- Today Bills --}}
Today Bills
{{-- Held Bills --}}
{{-- Settings --}}
| # |
Item |
Code |
Unit |
SP (₹) |
QTY |
GST |
Amount (₹) |
Remark |
Action |
Bill Details
Sub Total₹ 0.00
GST₹ 0.00
Discount- ₹ 0.00
Charges+ ₹ 0.00
Total₹ 0.00
Select Payment Mode
F1 Search
F2 Discount
F3 Charge
F6 Save & Print
F7 Hold Bill
F8 Hold Bills
CTRL+B New Bill
CTRL+P Change Price
CTRL+Q Change QTY
DEL Delete Item
ESC Exit