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; -} +

Tax Invoice

+ + +
@@ -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 : created_at)) ?>Dated2
Bike Name
Colour
Bike Number
Contact Number
Job Card No. 5
Dated5
Delivery Date5
Mode Of Payment5
- - - -
Billing Address
@@ -206,75 +283,89 @@ p {


+ - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - -status === 'Approved'): ?> - - - - - + + + + + + +
product_name ?> qty ?>tax ?>% + + amount ?>
Subtotal :   ₹subtotal, 2, '.', ',') ?>
Tax :   ₹tax, 2, '.', ',') ?>
Total Taxable Value
CGST
SGST
Total
Amount Chargeable (in words)
Total :   ₹total, 2, '.', ',') ?>
Paid :   ₹total_amount, 2, '.', ',') ?>

Declaration:
We Declare that this invoice shows the actual price of the goods described and that all particulars are true and correct.

**This is computer generated bill and doesn’t require signature

for THE MECHANIC




Authorised Signatory
+ + +
- -
- - -

terms_condition;?>

- -
+
+ +
diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php index 99986e5..49d45e5 100644 --- a/app/Views/job_card_form.php +++ b/app/Views/job_card_form.php @@ -617,7 +617,6 @@ var product = products.find(function(item) { return item.product_id == productId; }); - console.log("22222222222"); console.log(product); var cgst = parseFloat(product.cgst); var sgst = parseFloat(product.sgst); @@ -644,7 +643,6 @@ var product = complaint.find(function(item) { return item.complaint_id == productId; }); - console.log("3333333"); console.log(product); var cgst = parseFloat(product.cgst); var igst = parseFloat(product.sgst); @@ -657,7 +655,6 @@ } const service_child_products = async (data,tr) => { - console.log(); console.log(JSON.parse(data.product_id)); JSON.parse(data.product_id).forEach(async(element,index) => { if(element == 0) return; @@ -774,8 +771,13 @@ // Event listener for "Add More Item" button $(document).on('click', '#addProduct', function() { + if($(this).parent().parent().parent().attr('class') == 'complaint_class'){ + var product_tr_class_name_set = 'complaint_product_'+$(this).closest('tr').data('select2Id'); + }else{ + var product_tr_class_name_set = 'custom_complaint_product_'+$(this).parent().parent().parent().attr('class').match(/\d+/)[0]; + } - var newRow = '' + + var newRow = ' ' + '' + '' + '' + @@ -886,15 +888,32 @@ $('#productItemTable tbody').append(newRow); - initializeSelect2(); + initializeSelect2(); + // Function to increment class name + function incrementClassName(className) { + var classNumber = parseInt(className.match(/\d+/)[0]); + return className.replace(/\d+/, classNumber + 1); + } + // Initial class name + var initialClassName = 'custom_complaint_class'; + var currentClassName; + + // Loop to check for existence of subsequent classes + for (var i = 2000; i <= 2100; i++) { + currentClassName = initialClassName + '_' + i; + if ($('.' + currentClassName).length === 0) { + // If the class doesn't exist, increment the last found class + $('.' + initialClassName).removeClass(initialClassName).addClass(currentClassName); + break; + } + } }); // Event listener for removing item $(document).on('click', '.remove-item', function() { - console.log( ); var main_tr_to_remove = $(this).closest('tr').data('select2Id'); $(this).closest('tr').remove(); @@ -905,8 +924,8 @@ }else if($(this).closest('tr').attr('class') == 'service_class'){ $('.service_product_'+main_tr_to_remove).remove(); - }else if($(this).closest('tr').attr('class') == 'custom_complaint_class'){ - $('.service_product_'+main_tr_to_remove).remove(); + }else if($(this).closest('tr').attr('class').indexOf('custom_complaint_class') !== -1){ + $('.custom_complaint_product_'+$(this).closest('tr').attr('class').match(/\d+/)[0]).remove(); } diff --git a/app/Views/manufacturer_list.php b/app/Views/manufacturer_list.php index 741b12e..b594ed7 100644 --- a/app/Views/manufacturer_list.php +++ b/app/Views/manufacturer_list.php @@ -52,7 +52,7 @@ - +