diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index 4ebc8bf..0860627 100644 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -9,6 +9,8 @@ use App\Models\ClientModel; use App\Models\BikemodelsModel; use App\Models\BikemakeModel; use App\Models\VehicleModel; +use App\Models\BusinessModel; +use App\Models\BranchModel; use Mpdf\Mpdf; class Sales extends BaseController { @@ -291,9 +293,24 @@ public function delete_sales_product() if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } // Fetch the invoice data based on $invoice_id $model = new SalesOrderModel(); + $VehicleModel = new VehicleModel(); + $BranchModel = new BranchModel(); + $BusinessModel = new BusinessModel(); + $BikemodelsModel = new BikemodelsModel(); + $BikemakeModel = new BikemakeModel(); $data = $model->getSalesPdf($sales_order_id); + + + $branch = $BranchModel->where('branch_id', $data[0]->branch_id)->first(); + $business = $BusinessModel->where('business_id', $branch['business_id'])->first(); + + $vehicle = $VehicleModel->where('vehicle_id',$data[0]->vehicle_id)->first(); - $items = $model->getSalesOrderProductsForPdf($sales_order_id); + $bike_model = $BikemodelsModel->where('model_id',$vehicle['model'])->first(); + + $bike_make = $BikemakeModel->where('make_id', $vehicle['make'])->first(); + + $items = $model->getSalesOrderProductsForPdf($sales_order_id); @@ -338,9 +355,9 @@ public function delete_sales_product() $mpdf->showWatermarkText = true; } - + // return view('invoice_pdf_template', ['sales' => $data,'items'=>$items, 'business' => $business , 'vehicle' => $vehicle,'bike_model'=>$bike_model,'bike_make'=>$bike_make]); // Generate the PDF content (HTML) with data - $html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]); + $html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items, 'business' => $business , 'vehicle' => $vehicle,'bike_model'=>$bike_model,'bike_make'=>$bike_make]); // Load HTML into the mPDF instance $mpdf->WriteHTML($html); diff --git a/app/Views/invoice_pdf_template.php b/app/Views/invoice_pdf_template.php index 4f41616..fd3457c 100644 --- a/app/Views/invoice_pdf_template.php +++ b/app/Views/invoice_pdf_template.php @@ -79,65 +79,105 @@ /* Style for the invoice-related table */ table.invoice-related-table { - width: 100%; - border-collapse: collapse; -} + width: 100%; + border-collapse: collapse; + } -table.invoice-related-table th, -table.invoice-related-table td { - border: none; /* Remove borders from all cells in the invoice items table */ - padding: 8px; - text-align: center; /* Center-align text in cells */ -} + table.invoice-related-table th, + table.invoice-related-table td { + border: none; + padding: 8px; + text-align: left; + } -table.invoice-related-table th { - background-color: #f2f2f2; - font-weight: bold; -} + table.invoice-related-table th { + background-color: #DAC2AD; + font-weight: bold; + } - /* Style for the business stamp and terms */ - .business-stamp, .terms { - text-align: center; + + /* Style for the business stamp and terms */ + .business-stamp, .terms { + text-align: center; + margin-top: 20px; + } + .subtotal-table { + width: 100%; margin-top: 20px; } - .subtotal-table { - width: 100%; - margin-top: 20px; -} -.subtotal-table table { - width: 100%; - border-collapse: collapse; - border: 1px solid black; /* Add a border around the subtotal table */ -} + .subtotal-table table { + width: 100%; + border-collapse: collapse; + border: 1px solid black; /* Add a border around the subtotal table */ + } -.subtotal-table th, -.subtotal-table td { - border: none; /* Remove borders from cells inside the subtotal table */ - padding: 8px; - text-align: right; -} + .subtotal-table th, + .subtotal-table td { + border: none; /* Remove borders from cells inside the subtotal table */ + padding: 8px; + text-align: right; + } + + .subtotal-table th { + background-color: #f2f2f2; + font-weight: bold; + } + + .subtotal-table td:last-child { + font-weight: bold; /* Make the last column (total values) bold */ + } + td.invoice-number { + font-size: 18px; /* Increase font size to your desired value */ + /* Highlight background color */ + font-weight: bold; /* Make the text bold */ + } + p { + margin-top: 0; + margin-bottom: 0rem; + } + + + .invoice-info-table { + border-collapse: collapse; + } + + .invoice-info-table td { + border: 1px solid black; + width: 100px; + } + + .invoice-info-table tr:first-child td { + border-top: none; + } + + .invoice-info-table tr:last-child td { + border-bottom: none; + } + + .invoice-info-table tr td:first-child { + border-left: none; + } + + .invoice-info-table tr td:last-child { + border-right: none; + } + .term_condition { + border-collapse: collapse; + width: 100%; + } + + .term_condition td { + border: 0.5px solid black; + padding: 8px; + text-align: center; + } -.subtotal-table th { - background-color: #f2f2f2; - font-weight: bold; -} -.subtotal-table td:last-child { - font-weight: bold; /* Make the last column (total values) bold */ -} -td.invoice-number { - font-size: 18px; /* Increase font size to your desired value */ - /* Highlight background color */ - font-weight: bold; /* Make the text bold */ -} -p { - margin-top: 0; - margin-bottom: 0rem; -}
+| @@ -162,30 +202,67 @@ p { |
| GSTIN: + State Name: , Code: + Contact : + Email : + Buyer (Bill To) + |
| order_number) ? 'Order # ' . $value->order_number : 'Invoice # ' . $value->invoice_number; ?> | +Invoice No. | +1 |
|---|---|---|
| Date : = date('d-m-Y', strtotime($value->created_at)) ?> | - +Dated | +2 |
| Bike Name | ++ | |
| Colour | ++ | |
| Bike Number | ++ | |
| Contact Number | ++ | |
| Job Card No. | +5 | +|
| Dated | +5 | +|
| Delivery Date | +5 | +|
| Mode Of Payment | +5 | +
| Billing Address | - -
|---|
| @@ -206,75 +283,89 @@ p { |
| S no | +Description Of Goods | +Taxable Value | +Quantity | +Per | +GST | +CGST Amount | +SGST Amount | +Total Tax | +Total | +
|---|---|---|---|---|---|---|---|---|---|
| S.no | -Item Name | - -MRP | -Qty | - -Total | -|||||
| + tax / 100; + $taxAmount = $item->amount * $taxPercentage; + $amountWithoutTax = $item->amount - $taxAmount; + $value_tax = number_format($taxAmount, 2, '.', ',');?> + | = $serialNumber++; ?> - - | - -= $item->product_name ?> | -₹= number_format($item->net_price, 2, '.', ',') ?> | -= $item->qty ?> | - - - -₹= number_format($item->amount, 2, '.', ',') ?> | -
| = $item->product_name ?> | ++ | = $item->qty ?> | ++ | = $item->tax ?>% | ++ | ++ | ++ | = $item->amount ?> | + +|
| Subtotal : ₹= number_format($value->subtotal, 2, '.', ',') ?> | -|||||||||
| Tax : ₹= number_format($value->tax, 2, '.', ',') ?> | -+ | Total Taxable Value | ++ + | ||||||
| + | CGST | ++ | |||||||
| + | SGST | ++ | |||||||
| + | Total | ++ | |||||||
| Amount Chargeable (in words) | +|||||||||
| Total : ₹= number_format($value->total, 2, '.', ',') ?> | -|||||||||
| Paid : ₹= number_format($value->total_amount, 2, '.', ',') ?> | -|||||||||
Declaration: |
+ for THE MECHANIC Authorised Signatory |
+ ||||||||
= $value->terms_condition;?>
- -