CHANGE_ merging files : SS

This commit is contained in:
sriramv 2024-05-03 13:09:36 +05:30
commit 12f159f8a9
14 changed files with 614 additions and 607 deletions

View File

@ -88,7 +88,6 @@ class Jobcard extends BaseController
$data['job_card_products'] = array_merge($productdata, $labour_data); $data['job_card_products'] = array_merge($productdata, $labour_data);
// echo json_encode($complaintdata);die; // echo json_encode($complaintdata);die;
// Create an mPDF object // Create an mPDF object
$mpdf = new Mpdf([ $mpdf = new Mpdf([
'mode' => '', 'mode' => '',
@ -106,7 +105,8 @@ class Jobcard extends BaseController
$mpdf->autoLangToFont = true; $mpdf->autoScriptToLang = true; $mpdf->autoLangToFont = true;
$mpdf->autoScriptToLang = true;
// Set PDF properties // Set PDF properties
$mpdf->SetTitle('Invoice'); $mpdf->SetTitle('Invoice');
// $mpdf->SetAuthor($data[0]->branch_name); // $mpdf->SetAuthor($data[0]->branch_name);
@ -115,12 +115,13 @@ class Jobcard extends BaseController
// Generate the PDF content (HTML) with data // Generate the PDF content (HTML) with data
$html = view('invoice_pdf_template_jobcard', $data); $html = view('invoice_pdf_template_jobcard', $data);
echo $html;die;
// Load HTML into the mPDF instance // Load HTML into the mPDF instance
$mpdf->WriteHTML($html); $mpdf->WriteHTML($html);
// Output the PDF to the browser for download // Output the PDF to the browser for download
$mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D'); $mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
} }

View File

@ -138,6 +138,13 @@ class Products extends BaseController
$tax= $this->request->getPost('tax')/2; $tax= $this->request->getPost('tax')/2;
// print_r($this->request->getPost());die; // print_r($this->request->getPost());die;
if ($this->request->getPost('per') != 'ml') {
$ml = 0;
}else{
$ml = $this->request->getPost('ml');
}
$data = [ $data = [
'product_name' => $this->request->getPost('productname'), 'product_name' => $this->request->getPost('productname'),
'product_category' => $this->request->getPost('productcategory'), 'product_category' => $this->request->getPost('productcategory'),
@ -166,7 +173,8 @@ class Products extends BaseController
'branch_id' => $this->session->get('logged_user_branch_id'), 'branch_id' => $this->session->get('logged_user_branch_id'),
'total_amount' => $this->session->get('total_amount'), 'total_amount' => $this->session->get('total_amount'),
'per' => $this->session->get('per') 'per' => $this->request->getPost('per'),
'ml' => $ml
]; ];
$product_id = $this->request->getPost('product_id'); $product_id = $this->request->getPost('product_id');

View File

@ -9,6 +9,8 @@ use App\Models\ClientModel;
use App\Models\BikemodelsModel; use App\Models\BikemodelsModel;
use App\Models\BikemakeModel; use App\Models\BikemakeModel;
use App\Models\VehicleModel; use App\Models\VehicleModel;
use App\Models\BusinessModel;
use App\Models\BranchModel;
use Mpdf\Mpdf; use Mpdf\Mpdf;
class Sales extends BaseController class Sales extends BaseController
{ {
@ -291,18 +293,26 @@ public function delete_sales_product()
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Fetch the invoice data based on $invoice_id // Fetch the invoice data based on $invoice_id
$model = new SalesOrderModel(); $model = new SalesOrderModel();
$VehicleModel = new VehicleModel();
$BranchModel = new BranchModel();
$BusinessModel = new BusinessModel();
$BikemodelsModel = new BikemodelsModel();
$BikemakeModel = new BikemakeModel();
$data = $model->getSalesPdf($sales_order_id); $data = $model->getSalesPdf($sales_order_id);
$bus_id = $this->session->get('logged_user_business_id');
$company_address = $BusinessModel->where('business_id', $bus_id)->where('isactive', 1)->findAll();
$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();
$bike_model = $BikemodelsModel->where('model_id',$vehicle['model'])->first();
$bike_make = $BikemakeModel->where('make_id', $vehicle['make'])->first();
$items = $model->getSalesOrderProductsForPdf($sales_order_id); $items = $model->getSalesOrderProductsForPdf($sales_order_id);
$mpdf = new Mpdf([ $mpdf = new Mpdf([
'mode' => '', 'mode' => '',
'format' => 'A5', 'format' => 'A5',
'default_font_size' => 0, 'default_font_size' => 0,
'default_font' => '', 'default_font' => '',
// 'margin_right' => 1, // 'margin_right' => 1,
'margin_top' => 6, 'margin_top' => 6,
'margin_bottom' => 6, 'margin_bottom' => 6,
@ -311,16 +321,12 @@ public function delete_sales_product()
'orientation' => 'P', 'orientation' => 'P',
]); ]);
$mpdf->autoLangToFont = true; $mpdf->autoScriptToLang = true; $mpdf->autoLangToFont = true; $mpdf->autoScriptToLang = true;
// Set PDF properties // Set PDF properties
$mpdf->SetTitle('Invoice'); $mpdf->SetTitle('Invoice');
$mpdf->SetAuthor($data[0]->branch_name); $mpdf->SetAuthor($data[0]->branch_name);
$mpdf->SetCreator(''); $mpdf->SetCreator('');
// Generate the PDF content (HTML) // Generate the PDF content (HTML)
if ($data[0]->status === 'Draft') { if ($data[0]->status === 'Draft') {
// Set the watermark text and options // Set the watermark text and options
@ -338,9 +344,9 @@ public function delete_sales_product()
$mpdf->showWatermarkText = true; $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 // Generate the PDF content (HTML) with data
$html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]); $html = view('invoice_pdf_template', ['sales' => $data,'company_address'=>$company_address,'items'=>$items, 'business' => $business , 'vehicle' => $vehicle,'bike_model'=>$bike_model,'bike_make'=>$bike_make]);
// Load HTML into the mPDF instance // Load HTML into the mPDF instance
$mpdf->WriteHTML($html); $mpdf->WriteHTML($html);

View File

@ -9,7 +9,7 @@ class ProductModel extends Model
'quality','product_name','branch_id','prefered_vendor','product_category','mfr_part_no','purchase_order_level', 'quality','product_name','branch_id','prefered_vendor','product_category','mfr_part_no','purchase_order_level',
'unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level', 'unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level',
'handler','qty_in_demand','product_image','description','specification','hsn_sac','isactive','total_amount', 'handler','qty_in_demand','product_image','description','specification','hsn_sac','isactive','total_amount',
'per']; 'per','ml'];
public function getTax() public function getTax()

View File

@ -127,9 +127,15 @@
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;" readonly> <select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;" readonly>
<option value="">Select a Product</option> <option value="">Select a Product</option>
<?php foreach ($product as $value) : ?> <?php foreach ($product as $value) : ?>
<?php if ($value['per'] == 'ml') {
$value_ml = ' ('.$value['ml'].$value['per'].')';
} else {
$value_ml = '';
}
?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["product_id"] ?>" <?= isset($purchasechild['product_id']) && $purchasechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>> <option value="<?= $value["product_id"] ?>" <?= isset($purchasechild['product_id']) && $purchasechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>>
<?= $value["product_name"]; ?> <?= $value["product_name"].$value_ml; ?>
</option> </option>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -4,146 +4,49 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<style> <style>
/* Add your CSS styles here to format the invoice for mPDF */ /* Add your CSS styles here to format the invoice for mPDF */
body { body {font-family: 'Times New Roman', Times, sans-serif;font-size: 12px;}
table.main-table {width: 100%;border-collapse: collapse;border: -0.5px solid black;}
font-family: 'Times New Roman', Times, sans-serif; table.main-table th,table.main-table td {border: none;}
table.business-details-table {width: 100%;border-collapse: collapse;}
font-size: 12px; /* Change this value to your desired font size */ table.business-details-table td {padding: 8px;text-align: left;}
} .business-logo-container {text-align: center;}
img.business-logo {max-width: 200px;}
/* Style for the main table with border */ .business-name {font-size: 16px;font-weight: bold;margin-top: 10px;}
table.main-table { table.invoice-info-table {width: 100%;}
width: 100%; table.invoice-info-table th,table.invoice-info-table td {text-align: right;}
border-collapse: collapse; table.addresses-table {width: 100%;}
border: -0.5px solid black; /* Add a border around the entire invoice */ table.addresses-table th {text-align: left;padding-left: 8px;}
} .billing-address {width: 50%;padding-left: 8px;}
table.invoice-related-table {width: 100%;border-collapse: collapse;}
table.main-table th, table.invoice-related-table th,table.invoice-related-table td {border: none;padding: 8px;text-align: left;}
table.main-table td { table.invoice-related-table th {background-color: #DAC2AD;font-weight: bold;}
border: none; /* Remove borders from all cells inside the main table */ table.invoice-related-table thead tr th{border: 0.5px solid black;"}
table.invoice-related-table thead tr{border: 0.5px solid black;"}
} .business-stamp, .terms {text-align: center;margin-top: 20px;}
.subtotal-table {width: 100%;margin-top: 20px;}
/* Style for the table containing business details */ .subtotal-table table {width: 100%;border-collapse: collapse;border: 1px solid black;}
table.business-details-table { .subtotal-table th,.subtotal-table td {border: none;padding: 8px;text-align: right;}
width: 100%; .subtotal-table th {background-color: #f2f2f2;font-weight: bold;}
border-collapse: collapse; .subtotal-table td:last-child {font-weight: bold; }
} td.invoice-number {font-size: 18px;font-weight: bold; /* Make the text bold */}
p {margin-top: 0;margin-bottom: 0rem;}
table.business-details-table td { .invoice-info-table {border-collapse: collapse;}
padding: 8px; .invoice-info-table td {border: 1px solid black;width: 100px;}
text-align: left; .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;}
/* Style for the business logo and title */ .invoice-info-table tr td:last-child {border-right: none;}
.business-logo-container { .term_condition {border-collapse: collapse;width: 100%;}
text-align: center; .term_condition td {border: 0.5px solid black;padding: 8px;text-align: center;}
}
img.business-logo {
max-width: 200px; /* Adjust the size of the logo */
}
/* Style for the business name */
.business-name {
font-size: 16px;
font-weight: bold;
margin-top: 10px;
}
/* Style for the table containing invoice info */
table.invoice-info-table {
width: 100%;
}
table.invoice-info-table th,
table.invoice-info-table td {
text-align: right;
}
/* Style for the addresses table */
table.addresses-table {
width: 100%;
}
table.addresses-table th {
text-align: left;
padding-left: 8px;
}
/* Style for the billing and shipping addresses */
.billing-address {
width: 50%;
padding-left: 8px;
}
/* Style for the invoice-related table */
table.invoice-related-table {
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 {
background-color: #f2f2f2;
font-weight: bold;
}
/* 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 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 {
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;
}
</style> </style>
</head> </head>
<body> <body>
<h3 style="text-align:center;text-decoration: underline;">Tax Invoice</h3>
<table class="main-table"> <table class="main-table">
<tr> <tr>
<td> <td>
<table class="business-details-table"> <table class="business-details-table"><?php foreach ($company_address as $value) : ?>
<tr>
<?php foreach ($company_address as $value) : ?>
<td style="max-width: 50px;"> <td style="max-width: 50px;">
<p><b>THE MECHANIC</b><br> <p><b>THE MECHANIC</b><br>
<?= $value['address'] ?>,<br> <?= $value['address'] ?>,<br>
@ -158,116 +61,143 @@ p {
<?= '<b>State Name: </b>'.$job_card[0]['billing_state'] ?><br> <?= '<b>State Name: </b>'.$job_card[0]['billing_state'] ?><br>
<?= '<b>Place of Supply: </b>'.$value['state'] ?></p> <?= '<b>Place of Supply: </b>'.$value['state'] ?></p>
</td> </td>
</tr><?php endforeach; ?>
<tr>
<td>
<span>GSTIN: <?php echo $business['gstno']?> </span><br>
<span>State Name: <?php echo $business['state']?> , Code: <?php echo $business['code']?> </span><br>
<span>Contact : <?php echo $business['mobile']?></span><br>
<span>Email : <?php echo $business['email']?></span><br><br>
<span style="font-size: 15px;font-weight: bold;">Buyer (Bill To) </span>
</td>
</tr> </tr>
<?php endforeach; ?>
</table> </table>
</td> </td>
<td> <td>
<table class="invoice-info-table" style="max-width: 250px;border: 1px solid black;"> <table class="invoice-info-table" >
<tbody >
<tr> <tr>
<td>Invoice No.</td> <td>Invoice No.</td><td>1</td>
<td>1657</td>
</tr>
<tr style="border: 1px solid black;">
<td>Bike Name</td>
<td><?= $vehicle[0]['bike_company'].' '.$vehicle[0]['bike_name'] ?></td>
</tr> </tr>
<tr> <tr>
<td>Color</td> <td>Dated</td><td>2</td>
<td><?= $vehicle[0]['colour'] ?></td>
</tr> </tr>
<tr> <tr>
<td>Bie Number</td> <td>Bike Name</td><td><?php echo $bike_make['make'], $bike_model['model_name']; ?></td>
<td><?= $vehicle[0]['reg_no'] ?></td>
</tr> </tr>
<tr> <tr>
<td>Contact Number</td> <td>Colour</td><td><?php echo $vehicle['colour']?></td>
<td><?= $vehicle[0]['mobile_no'] ?></td>
</tr> </tr>
<tr> <tr>
<td>Job Card Number</td> <td>Bike Number</td><td><?php echo $vehicle['reg_no']?></td>
<td><?= $vehicle[0]['order_number'] ?></td>
</tr> </tr>
<tr> <tr>
<td>Dated</td> <td>Contact Number</td><td><?php echo $vehicle['mobile_no']?></td>
<td><?= (new DateTime($vehicle[0]['created_at']))->format('d/m/Y') ?></td>
</tr> </tr>
<tr> <tr>
<td>Delivery Date</td> <td>Job Card No. </td><td>5</td>
<td>04/06/2024</td>
</tr> </tr>
<tr> <tr>
<td>Mode of Payment</td> <td>Dated</td><td>5</td>
<td>Online</td>
</tr> </tr>
<tr>
<td>Delivery Date</td><td>5</td>
</tr>
<tr>
<td>Mode Of Payment</td><td>5</td>
</tr>
</tbody>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
<table class="addresses-table">
<tr >
<td class="billing-address">
<table class="invoice-related-table"> <?php foreach ($sales as $value) : ?>
<?= $value->client_name ?><br>
<?= $value->billing_address != '' ? $value->billing_address." , <br>" : ''; ?>
<?= $value->billing_city ?>&nbsp;<?= $value->billing_state." "?>
<?php if ($value->billing_postal_code!=0): ?>
<?= $value->billing_postal_code ?><br>
<?php endif; ?>
<?= $value->mobile_no." ." ?>
<?php endforeach; ?>
</td>
</tr>
</table><br><br>
<table class="invoice-related-table">
<thead> <thead>
<tr style="border: 1px solid black;"> <tr >
<th style="border: 0.5px solid black;">S no</th> <th >S no</th>
<th style="border: 0.5px solid black;">Description Of Goods</th> <th >Description Of Goods</th>
<th style="border: 0.5px solid black;">Taxable Value</th> <th >Taxable Value</th>
<th style="border: 0.5px solid black;">Quantity</th> <th >Quantity</th>
<th style="border: 0.5px solid black;">Per</th> <th >Per</th>
<th style="border: 0.5px solid black;">GST</th> <th >GST</th>
<th style="border: 0.5px solid black;">CGST Amount</th> <th >CGST Amount</th>
<th style="border: 0.5px solid black;">SGST Amount</th> <th >SGST Amount</th>
<th style="border: 0.5px solid black;">Total Tax</th> <th >Total Tax</th>
<th style="border: 0.5px solid black;">Total</th> <th >Total</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $serialNumber = 1; ?> <?php $serialNumber = 1; ?>
<?php foreach ($job_card_products as $item) : $totalamount = 0; ?> <?php foreach ($items as $item) : ?>
<tr> <tr>
<?php $taxPercentage = $item->tax / 100;
$taxAmount = $item->amount * $taxPercentage;
$amountWithoutTax = $item->amount - $taxAmount;
$value_tax = number_format($taxAmount, 2, '.', ',');?>
<td style="border: 1px solid black;"> <td style="border: 1px solid black;">
<?= $serialNumber++; ?> <?= $serialNumber++; ?>
</td> </td>
<td style="border-right: 0.5px solid black;"><?= $item['product_name'] ?></td> <td style="border-right: 0.5px solid black;"><?= $item->product_name ?></td>
<td style="border-right: 0.5px solid black;"><?= $item['amount'] ?></td> <td style="border-right: 0.5px solid black;"> <?php echo number_format($amountWithoutTax, 2, '.', ','); ?></td>
<td style="border-right: 0.5px solid black;"><?= $item['qty'] ?></td> <td style="border-right: 0.5px solid black;"><?= $item->qty ?></td>
<td style="border-right: 0.5px solid black;">nos</td> <td style="border-right: 0.5px solid black;"></td>
<td style="border-right: 0.5px solid black;"><?= $item['tax'] ?>%</td> <td style="border-right: 0.5px solid black;"><?= $item->tax ?>%</td>
<td style="border-right: 0.5px solid black;"><?= ($item['amount'] * ($item['tax'] / 2) / 100) ?></td> <td style="border-right: 0.5px solid black;"><?php echo $value_tax /2;?>
<td style="border-right: 0.5px solid black;"><?= ($item['amount'] * ($item['tax'] / 2) / 100) ?></td> </td>
<td style="border: 0.5px solid black;"><?= ($item['amount'] * $item['tax'] / 100) ?></td> <td style="border-right: 0.5px solid black;"><?php echo $value_tax /2;?>
<td style="border-right: 0.5px solid black;"><?= ($item['amount'] + ($item['amount'] * $item['tax'] / 100) ) ?></td> </td>
<td style="border: 0.5px solid black;"><?php echo $value_tax;?></td>
<td style="border-right: 0.5px solid black;"><?= $item->amount ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tr> <tr>
<td colspan="6" style="border-top: 0.5px solid black;border-left: 0.5px solid black;"></td> <td colspan="6" style="border-top: 0.5px solid black;border-left: 0.5px solid black;"></td>
<td colspan="3" style="text-align:center;border: 0.5px solid black;">Total Taxable Value</td> <td colspan="3" style="text-align:center;border: 0.5px solid black;">Total Taxable Value</td>
<td style="border: 0.5px solid black;"><?= $job_card[0]['tax'] ?></td> <td style="border: 0.5px solid black;"></td>
</tr> </tr>
<tr> <tr>
<td colspan="6" style="border-left: 0.5px solid black;"></td> <td colspan="6" style="border-left: 0.5px solid black;"></td>
<td colspan="3" style="text-align:center;border: 0.5px solid black;">CGST</td> <td colspan="3" style="text-align:center;border: 0.5px solid black;">CGST</td>
<td style="border: 0.5px solid black;"><?= $job_card[0]['tax'] ?></td> <td style="border: 0.5px solid black;"></td>
</tr> </tr>
<tr> <tr>
<td colspan="6" style="border-left: 0.5px solid black;"></td> <td colspan="6" style="border-left: 0.5px solid black;"></td>
<td colspan="3" style="text-align:center;border: 0.5px solid black;">SGST</td> <td colspan="3" style="text-align:center;border: 0.5px solid black;">SGST</td>
<td style="border: 0.5px solid black;"><?= $job_card[0]['tax'] ?></td> <td style="border: 0.5px solid black;"></td>
</tr> </tr>
<tr> <tr>
<td colspan="6" style="border-left: 0.5px solid black;"></td> <td colspan="6" style="border-left: 0.5px solid black;"></td>
<td colspan="3" style="text-align:center;border: 0.5px solid black;">Total</td> <td colspan="3" style="text-align:center;border: 0.5px solid black;">Total</td>
<td style="border: 0.5px solid black;"><?= $job_card[0]['total'] ?></td> <td style="border: 0.5px solid black;"></td>
</tr> </tr>
<tr> <tr>
<td colspan="10" style="border: 0.5px solid black;">Amount Chargeable (in words)</td> <td colspan="10" style="border: 0.5px solid black;">Amount Chargeable (in words)</td>
</tr> </tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td colspan="7" style="border: 0.5px solid black;"><p>Declaration: <br> We Declare that this invoice shows the actual price of the goods described and that all particulars are true and correct.<br><br>**This is computer generated bill and doesnt require signature</p></td>
<td colspan="3" style="border: 0.5px solid black;"><p>for THE MECHANIC</p><br><br><br> Authorised Signatory</td>
</tr>
</tbody> </tbody>
</table> </table>
</body> </body>
</html> </html>

View File

@ -54,10 +54,13 @@
/* Style for the table containing invoice info */ /* Style for the table containing invoice info */
table.invoice-info-table { table.invoice-info-table {
width: 100%; width: 100%;
border-collapse: collapse;
} }
table.invoice-info-table th, table.invoice-info-table th,
table.invoice-info-table td { table.invoice-info-table td {
border: 1px solid;
text-align: right; text-align: right;
} }
@ -87,11 +90,11 @@ table.invoice-related-table th,
table.invoice-related-table td { table.invoice-related-table td {
border: none; /* Remove borders from all cells in the invoice items table */ border: none; /* Remove borders from all cells in the invoice items table */
padding: 8px; padding: 8px;
text-align: center; /* Center-align text in cells */ text-align: left; /* Center-align text in cells */
} }
table.invoice-related-table th { table.invoice-related-table th {
background-color: #f2f2f2; background-color: #DAC2AD;
font-weight: bold; font-weight: bold;
} }
@ -138,12 +141,15 @@ p {
</style> </style>
</head> </head>
<body> <body>
<h3 style="text-align:center;text-decoration: underline;">Tax Invoice</h3>
<table class="main-table"> <table class="main-table">
<tr> <tr>
<td> <td>
<table class="business-details-table"> <table class="business-details-table">
<?php foreach ($company_address as $value) : ?> <?php foreach ($company_address as $value) : ?>
<tr>
<td style="max-width: 50px;"> <td style="max-width: 50px;">
<p><b>THE MECHANIC</b><br> <p><b>THE MECHANIC</b><br>
<?= $value['address'] ?>,<br> <?= $value['address'] ?>,<br>
@ -164,7 +170,9 @@ p {
</table> </table>
</td> </td>
<td> <td>
<table class="invoice-info-table" style="max-width: 250px;border: 1px solid black;"> <div>
<table class="invoice-info-table" style="max-width: 250px;border: 1px solid black; ">
<tbody>
<tr> <tr>
<td>Invoice No.</td> <td>Invoice No.</td>
<td>1657</td> <td>1657</td>
@ -201,7 +209,9 @@ p {
<td>Mode of Payment</td> <td>Mode of Payment</td>
<td>Online</td> <td>Online</td>
</tr> </tr>
</tbody>
</table> </table>
</div>
</td> </td>
</tr> </tr>
</table> </table>
@ -229,6 +239,7 @@ p {
<td style="border: 1px solid black;"> <td style="border: 1px solid black;">
<?= $serialNumber++; ?> <?= $serialNumber++; ?>
</td> </td>
<td style="border-right: 0.5px solid black;"><?= $item['product_name'] ?></td> <td style="border-right: 0.5px solid black;"><?= $item['product_name'] ?></td>
<td style="border-right: 0.5px solid black;"><?php echo isset($item['custom_amount']) ? $item['custom_amount'] : $item['amount'] ?></td> <td style="border-right: 0.5px solid black;"><?php echo isset($item['custom_amount']) ? $item['custom_amount'] : $item['amount'] ?></td>
<td style="border-right: 0.5px solid black;"><?= $item['qty'] ?></td> <td style="border-right: 0.5px solid black;"><?= $item['qty'] ?></td>
@ -238,6 +249,7 @@ p {
<td style="border-right: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? $item['custom_tax'] : ($item['amount'] * ($item['tax'] / 2) / 100) ?></td> <td style="border-right: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? $item['custom_tax'] : ($item['amount'] * ($item['tax'] / 2) / 100) ?></td>
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? $item['custom_tax'] : ($item['amount'] * $item['tax'] / 100) ?></td> <td style="border: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? $item['custom_tax'] : ($item['amount'] * $item['tax'] / 100) ?></td>
<td style="border-right: 0.5px solid black;"><?php echo isset($item['custom_total']) ? $item['custom_total'] : ($item['amount'] + ($item['amount'] * $item['tax'] / 100) ) ?></td> <td style="border-right: 0.5px solid black;"><?php echo isset($item['custom_total']) ? $item['custom_total'] : ($item['amount'] + ($item['amount'] * $item['tax'] / 100) ) ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tr> <tr>
@ -263,6 +275,12 @@ p {
<tr> <tr>
<td colspan="10" style="border: 0.5px solid black;">Amount Chargeable (in words)</td> <td colspan="10" style="border: 0.5px solid black;">Amount Chargeable (in words)</td>
</tr> </tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td colspan="7" style="border: 0.5px solid black;"><p>Declaration: <br> We Declare that this invoice shows the actual price of the goods described and that all particulars are true and correct.<br><br>**This is computer generated bill and doesnt require signature</p></td>
<td colspan="3" style="border: 0.5px solid black;"><p>for THE MECHANIC</p><br><br><br> Authorised Signatory</td>
</tr>
</tbody> </tbody>
</table> </table>

View File

@ -29,7 +29,7 @@
<label for="inputEmail4" class="col-form-label">Vehicle<span class="text-danger">*</span></label> <label for="inputEmail4" class="col-form-label">Vehicle<span class="text-danger">*</span></label>
<?= isset($sales['vehicle_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addVehicleModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addVehicleModal" title="Add Client"></i>' ?> <?= isset($sales['vehicle_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addVehicleModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addVehicleModal" title="Add Client"></i>' ?>
<select class="form-control vehicle-select SelExample" name="vehicle_id" <?= isset($sales['vehicle_id']) ? 'readonly' : 'required' ?>> <select class="form-control vehicle-select SelExample" name="vehicle_id" id="vehicle_name" <?= isset($sales['vehicle_id']) ? 'readonly' : 'required' ?>>
<?= isset($sales['vehicle_id']) ? '' : '<option value="">Select a vehicle</option>' ?> <?= isset($sales['vehicle_id']) ? '' : '<option value="">Select a vehicle</option>' ?>
<?php foreach ($vehicle as $value) : ?> <?php foreach ($vehicle as $value) : ?>
@ -755,7 +755,6 @@ $(document).ready(async function() {
var product = products.find(function(item) { var product = products.find(function(item) {
return item.product_id == productId; return item.product_id == productId;
}); });
console.log("22222222222");
console.log(product); console.log(product);
var cgst = parseFloat(product.cgst); var cgst = parseFloat(product.cgst);
var sgst = parseFloat(product.sgst); var sgst = parseFloat(product.sgst);
@ -782,7 +781,6 @@ $(document).ready(async function() {
var product = complaint.find(function(item) { var product = complaint.find(function(item) {
return item.complaint_id == productId; return item.complaint_id == productId;
}); });
console.log("3333333");
console.log(product); console.log(product);
var cgst = parseFloat(product.cgst); var cgst = parseFloat(product.cgst);
var igst = parseFloat(product.sgst); var igst = parseFloat(product.sgst);
@ -811,6 +809,7 @@ $(document).ready(async function() {
} }
const service_child_products = async (data,tr) => { const service_child_products = async (data,tr) => {
console.log(JSON.parse(data.product_id));
JSON.parse(data.product_id).forEach(async(element,index) => { JSON.parse(data.product_id).forEach(async(element,index) => {
if(element == 0) return; if(element == 0) return;
var product = products.find(function(item) { var product = products.find(function(item) {
@ -917,14 +916,11 @@ $(document).ready(async function() {
// Event listener for "Add More Item" button // Event listener for "Add More Item" button
$(document).on('click', '#addProduct', function() { $(document).on('click', '#addProduct', function() {
console.log(productarray.length);
if(productarray.length == 0) { if(productarray.length == 0) {
productarray = <?php echo json_encode($product) ?>; productarray = <?php echo json_encode($product) ?>;
console.log(productarray); console.log(productarray);
} }
var newRow = '<tr class="product"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><select class="form-control book-select SelExample product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>'; var newRow = '<tr class="product"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><select class="form-control book-select SelExample product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
for (var i = 0; i < productarray.length; i++) for (var i = 0; i < productarray.length; i++)
{ {
var product = productarray[i]; var product = productarray[i];
@ -940,15 +936,14 @@ $(document).ready(async function() {
'<td hidden><input type="hidden" name="id"></td>' + '<td hidden><input type="hidden" name="id"></td>' +
'</tr>'; '</tr>';
// $('#productItemTable tbody').append(newRow); // $('#productItemTable tbody').append(newRow);
$(newRow).insertAfter($(this).closest('tr')); $(newRow).insertAfter($(this).closest('tr'));
initializeSelect2(); initializeSelect2();
}); });
$('#addService').click(function() { $('#addService').click(function() {
if ($('#vehicle_name').val()) {
servicearray = <?php echo isset($service_1) ? json_encode($service_1) : json_encode($service) ?>; servicearray = <?php echo isset($service_1) ? json_encode($service_1) : json_encode($service) ?>;
// console.log(servicearray); // console.log(servicearray);
var newRow = '<tr class="service_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><select class="form-control book-select SelExample service" name="service_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Service</option>'; var newRow = '<tr class="service_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><select class="form-control book-select SelExample service" name="service_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Service</option>';
@ -971,13 +966,13 @@ $(document).ready(async function() {
$('#productItemTable tbody').append(newRow); $('#productItemTable tbody').append(newRow);
initializeSelect2(); initializeSelect2();
}else{
toastr.warning("First Select Vehicle!");
}
}); });
$('#addcomplaint').click(function() { $('#addcomplaint').click(function() {
complaint = <?php echo json_encode($complaint) ?>; complaint = <?php echo json_encode($complaint) ?>;
// console.log(productarray);
var newRow = '<tr class="complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><select class="form-control book-select SelExample complaint" id="complaint_detail" name="complaint_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Complaint</option>'; var newRow = '<tr class="complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><select class="form-control book-select SelExample complaint" id="complaint_detail" name="complaint_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Complaint</option>';
for (var i = 0; i < complaint.length; i++) for (var i = 0; i < complaint.length; i++)
@ -1003,17 +998,12 @@ $(document).ready(async function() {
'</td>' + '</td>' +
'<td hidden><input type="hidden" name="id"></td>' + '<td hidden><input type="hidden" name="id"></td>' +
'</tr>'; '</tr>';
$('#productItemTable tbody').append(newRow); $('#productItemTable tbody').append(newRow);
initializeSelect2(); initializeSelect2();
}); });
$('#addCustomComplaint').click(function() { $('#addCustomComplaint').click(function() {
complaint = <?php echo json_encode($complaint) ?>; complaint = <?php echo json_encode($complaint) ?>;
// console.log(productarray);
var newRow = '<tr class="custom_complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" rows="5"></textarea></td>' + var newRow = '<tr class="custom_complaint_class"><td hidden style="width:10%;"> <input type="number" class="form-control labour_cost" name="labour_cost"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" rows="5"></textarea></td>' +
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" value="1" name="quantity[]" readonly/></td>' + '<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" value="1" name="quantity[]" readonly/></td>' +
'<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" /></td>' + '<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" /></td>' +
@ -1044,7 +1034,25 @@ $(document).ready(async function() {
$('#productItemTable tbody').append(newRow); $('#productItemTable tbody').append(newRow);
initializeSelect2(); initializeSelect2();
// Function to increment class name And this Class name for for remove the parent Custom Comlaint is remove the child to remove
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;
}
}
}); });
$(document).on('input', '.item_dummy', function() { $(document).on('input', '.item_dummy', function() {

View File

@ -52,7 +52,7 @@
</div> </div>
<!-- Start Bike Manufacturer Create Pop-UP --> <!-- Start Biake Mnufacturer Create Pop-UP -->
<div id="manufacturer_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"> <div id="manufacturer_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">

View File

@ -7,10 +7,6 @@
<div class="page-title-right"> <div class="page-title-right">
<a href="<?= base_url() . "product_index"; ?>" class="btn btn-secondary waves-effect">Cancel</a> <a href="<?= base_url() . "product_index"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
</li>
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li>
<li class="breadcrumb-item active">Datatables</li> -->
</ol> </ol>
</div> </div>
</div> </div>
@ -25,12 +21,10 @@
<h4 class="header-title">Product Details :</h4><br> <h4 class="header-title">Product Details :</h4><br>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="make" class="col-form-label">Make<span class="text-danger">*</span></label> <label for="make" class="col-form-label">Make<span class="text-danger">*</span></label>
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i>' ?> <?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i>' ?>
<select class="form-control SelExample" id="make" name="make[]" required multiple> <select class="form-control SelExample" id="make" name="make[]" required multiple>
<option value="">Select a Make</option> <option value="">Select a Make</option>
<!-- Options for make --> <!-- Options for make -->
<?php foreach ($make as $value): ?> <?php foreach ($make as $value): ?>
<option value="<?= $value['make_id'] ?>" <?= isset($products['make_id']) && in_array($value['make_id'], $products['make_id']) ? 'selected' : '' ?>> <option value="<?= $value['make_id'] ?>" <?= isset($products['make_id']) && in_array($value['make_id'], $products['make_id']) ? 'selected' : '' ?>>
@ -39,7 +33,6 @@
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label> <label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i>'; ?> <?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i>'; ?>
@ -54,7 +47,6 @@
<?php endif; ?> <?php endif; ?>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="inputEmail4" class="col-form-label">Product Name<span class="text-danger">*</span></label> <label for="inputEmail4" class="col-form-label">Product Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="productname" placeholder="Product Name" value="<?= isset($products['product_name']) ? $products['product_name'] : '' ?>" required> <input type="text" class="form-control" name="productname" placeholder="Product Name" value="<?= isset($products['product_name']) ? $products['product_name'] : '' ?>" required>
@ -76,7 +68,6 @@
<!-- Options for quality will be populated dynamically via JavaScript --> <!-- Options for quality will be populated dynamically via JavaScript -->
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="inputAddress" class="col-form-label">Manfacturer Part Number</label> <label for="inputAddress" class="col-form-label">Manfacturer Part Number</label>
<input type="text" class="form-control" name="mfr_part_no" placeholder="Manfacturer Part Number" value="<?= isset($products['mfr_part_no']) ? $products['mfr_part_no'] : '' ?>" > <input type="text" class="form-control" name="mfr_part_no" placeholder="Manfacturer Part Number" value="<?= isset($products['mfr_part_no']) ? $products['mfr_part_no'] : '' ?>" >
@ -92,7 +83,6 @@
<?= $vendor['vendor_name'] ?> <?= $vendor['vendor_name'] ?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
@ -105,8 +95,7 @@
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">HSN/SAC<span class="text-danger"></span></label> <label for="inputEmail4" class="col-form-label">HSN/SAC<span class="text-danger"></span></label>
<input type="text" class="form-control" name="hsn_sac" placeholder="HSN/SAC" value="<?= isset($products['hsn_sac']) ? $products['hsn_sac'] : '' ?>" > <input type="text" class="form-control" name="hsn_sac" placeholder="HSN/SAC" value="<?= isset($products['hsn_sac']) ? $products['hsn_sac'] : '' ?>" >
@ -163,22 +152,17 @@
<option value="Grip" <?= (isset($products['product_category']) && $products['product_category'] == 'Grip') ? 'selected' : '' ?>>Grip</option> <option value="Grip" <?= (isset($products['product_category']) && $products['product_category'] == 'Grip') ? 'selected' : '' ?>>Grip</option>
<option value="Rubber" <?= (isset($products['product_category']) && $products['product_category'] == 'Rubber') ? 'selected' : '' ?>>Rubber</option> <option value="Rubber" <?= (isset($products['product_category']) && $products['product_category'] == 'Rubber') ? 'selected' : '' ?>>Rubber</option>
<option value="Cables" <?= (isset($products['product_category']) && $products['product_category'] == 'Cables') ? 'selected' : '' ?>>Cables</option> <option value="Cables" <?= (isset($products['product_category']) && $products['product_category'] == 'Cables') ? 'selected' : '' ?>>Cables</option>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">Specification<span class="text-danger"></span></label> <label for="inputEmail4" class="col-form-label">Specification<span class="text-danger"></span></label>
<input type="text" class="form-control" name="specification" placeholder="Specification" value="<?= isset($products['specification']) ? $products['specification'] : '' ?>" > <input type="text" class="form-control" name="specification" placeholder="Specification" value="<?= isset($products['specification']) ? $products['specification'] : '' ?>" >
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">Rack Number<span class="text-danger"></span></label> <label for="inputEmail4" class="col-form-label">Rack Number<span class="text-danger"></span></label>
<input type="text" class="form-control" name="rack_number" placeholder="Rack Number" value="<?= isset($products['rack_number']) ? $products['rack_number'] : '' ?>" > <input type="text" class="form-control" name="rack_number" placeholder="Rack Number" value="<?= isset($products['rack_number']) ? $products['rack_number'] : '' ?>" >
</div> </div>
</div> </div>
<input type="hidden" id="product_id" name="product_id" value="<?= isset($products['product_id']) ? $products['product_id'] : '' ?>"><br> <input type="hidden" id="product_id" name="product_id" value="<?= isset($products['product_id']) ? $products['product_id'] : '' ?>"><br>
<h4 class="header-title">Pricing Information :</h4><br> <h4 class="header-title">Pricing Information :</h4><br>
@ -208,21 +192,29 @@
<label for="inputPassword4" class="col-form-label">Unit Price + Tax</label> <label for="inputPassword4" class="col-form-label">Unit Price + Tax</label>
<input type="number" class="form-control" name="total_amount" placeholder="Total Price"value="<?= isset($products['total_amount']) ? $products['total_amount'] : '' ?>" required readonly> <input type="number" class="form-control" name="total_amount" placeholder="Total Price"value="<?= isset($products['total_amount']) ? $products['total_amount'] : '' ?>" required readonly>
</div> </div>
</div><br> </div><br>
<h4 class="header-title">Stock Information :</h4><br> <h4 class="header-title">Stock Information :</h4><br>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputPassword4" class="col-form-label">Unit of Measurement<span class="text-danger">*</span></label> <label for="inputPassword4" class="col-form-label">Unit of Measurement<span class="text-danger">*</span></label>
<select class="form-control status-select" name="per" required data-toggle="select2"> <select class="form-control status-select" id="per" name="per" required data-toggle="select2">
<option value="" <?= (isset($products['per']) && $products['per'] == '') ? 'selected' : '' ?>>Select</option> <option value="" <?= (isset($products['per']) && $products['per'] == '') ? 'selected' : '' ?>>Select</option>
<option value="Nos" <?= (isset($products['per']) && $products['per'] == 'Nos') ?'selected' : '' ?>>nos</option> <option value="Nos" <?= (isset($products['per']) && $products['per'] == 'Nos') ?'selected' : '' ?>>nos</option>
<option value="ml" <?= (isset($products['per']) && $products['per'] == 'ml') ? 'selected' : '' ?>>ml</option> <option value="ml" <?= (isset($products['per']) && $products['per'] == 'ml') ? 'selected' : '' ?>>ml</option>
<option value="litre" <?= (isset($products['per']) && $products['per'] == 'litre') ? 'selected' : '' ?>>litre</option> <option value="litre" <?= (isset($products['per']) && $products['per'] == 'litre') ? 'selected' : '' ?>>litre</option>
</select> </select>
</div> </div>
<div class="form-group col-md-3" id="ml_div" <?= (isset($products['per']) && $products['per'] == 'ml') ? '' : 'hidden' ?> >
<label for="inputPassword4" class="col-form-label">ML<span class="text-danger">*</span></label>
<select name="ml" id="ml" class="form-control" <?= (isset($products['per']) && $products['per'] == 'ml') ? 'required' : '' ?>>
<option value <?= (isset($products['ml']) && $products['ml'] == 0) ? 'selected' : '' ?>>Slect ML</option>
<option value="50" <?= (isset($products['ml']) && $products['ml'] == 50) ? 'selected' : '' ?>>50</option>
<option value="100" <?= (isset($products['ml']) && $products['ml'] == 100) ? 'selected' : '' ?>>100</option>
<option value="250" <?= (isset($products['ml']) && $products['ml'] == 250) ? 'selected' : '' ?>>250</option>
<option value="500" <?= (isset($products['ml']) && $products['ml'] == 500) ? 'selected' : '' ?>>500</option>
<option value="750" <?= (isset($products['ml']) && $products['ml'] == 750) ? 'selected' : '' ?>>750</option>
</select>
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputPassword4" class="col-form-label">Qty in Stock<span class="text-danger">*</span></label> <label for="inputPassword4" class="col-form-label">Qty in Stock<span class="text-danger">*</span></label>
<input type="number" class="form-control" id="qty_in_stock" name="qty_in_stock" placeholder="Qty in Stock" value="<?= isset($products['qty_stock']) ? $products['qty_stock'] : '' ?>" required> <input type="number" class="form-control" id="qty_in_stock" name="qty_in_stock" placeholder="Qty in Stock" value="<?= isset($products['qty_stock']) ? $products['qty_stock'] : '' ?>" required>
@ -235,13 +227,10 @@
<label for="inputPassword4" class="col-form-label">Purchase Re-Order Level<span class="text-danger"></span></label> <label for="inputPassword4" class="col-form-label">Purchase Re-Order Level<span class="text-danger"></span></label>
<input type="number" class="form-control" id="purchase_reorder_level" name="reorder_level" placeholder="Purchase Re-Order Level" value="<?= isset($products['reorder_level']) ? $products['reorder_level'] : '' ?>" required> <input type="number" class="form-control" id="purchase_reorder_level" name="reorder_level" placeholder="Purchase Re-Order Level" value="<?= isset($products['reorder_level']) ? $products['reorder_level'] : '' ?>" required>
</div> </div>
<div class="form-group col-md-4" hidden> <div class="form-group col-md-4" hidden>
<label for="inputPassword4" class="col-form-label">Qty in Demand</label> <label for="inputPassword4" class="col-form-label">Qty in Demand</label>
<input type="number" class="form-control" name="qty_in_demand" placeholder="Qty in Demand" value="<?= isset($products['qty_in_demand']) ? $products['qty_in_demand'] : '' ?>" > <input type="number" class="form-control" name="qty_in_demand" placeholder="Qty in Demand" value="<?= isset($products['qty_in_demand']) ? $products['qty_in_demand'] : '' ?>" >
</div> </div>
</div><br> </div><br>
<h4 class="header-title">Description Details :</h4><br> <h4 class="header-title">Description Details :</h4><br>
<div class="form-row"> <div class="form-row">
@ -249,8 +238,8 @@
<label for="inputPassword4" class="col-form-label">Description</label> <label for="inputPassword4" class="col-form-label">Description</label>
<textarea class="form-control" name="description" placeholder="Description"value="<?= isset($products['description']) ? $products['description'] : '' ?>" required> <textarea class="form-control" name="description" placeholder="Description"value="<?= isset($products['description']) ? $products['description'] : '' ?>" required>
</textarea> </textarea>
</div> </div>
</div> </div>
<button type="submit" class="btn btn-primary">Submit</button> <button type="submit" class="btn btn-primary">Submit</button>
</form> </form>
</div> </div>
@ -583,8 +572,8 @@ $('#saveMakeBtn').click(function() {
</script> </script>
<!-- Save Modal Funxtion --> <!-- Save Modal Funxtion -->
<script> <script>
// Populate make dropdown in the add model modal // Populate make dropdown in the add model modal
function populateMakeDropdown() { function populateMakeDropdown() {
$.ajax({ $.ajax({
url: '<?php echo base_url('get_makes') ?>', // URL to your CodeIgniter controller method to fetch makes url: '<?php echo base_url('get_makes') ?>', // URL to your CodeIgniter controller method to fetch makes
type: 'GET', type: 'GET',
@ -600,18 +589,17 @@ function populateMakeDropdown() {
console.error(xhr.responseText); console.error(xhr.responseText);
} }
}); });
} }
// Call the function to populate make dropdown initially // Call the function to populate make dropdown initially
$(document).ready(function() { $(document).ready(function() {
// populateMakeDropdown(); // populateMakeDropdown();
}); });
// Save model function // Save model function
$('#saveModelBtn').click(function() { $('#saveModelBtn').click(function() {
var makeId = $('#makeSelect').val(); var makeId = $('#makeSelect').val();
var model = $('#modelInput').val(); var model = $('#modelInput').val();
console.log(model);
if (makeId != '' && model != '') { if (makeId != '' && model != '') {
$.ajax({ $.ajax({
url: '<?php echo base_url().'save_model'?>', url: '<?php echo base_url().'save_model'?>',
@ -639,7 +627,18 @@ console.log(model);
} else { } else {
toastr.warning("Please fill in both make and model fields"); toastr.warning("Please fill in both make and model fields");
} }
}); });
$('#per').change(function () {
if ($(this).val() == 'ml') {
$('#ml_div').removeAttr('hidden');
$('#ml').attr('required','required');
}else{
$('#ml_div').attr('hidden', 'hidden');
$('#ml').removeAttr('required');
}
})
</script> </script>
<style> <style>
.select2-container--default .select2-results__option--highlighted[aria-selected]{ .select2-container--default .select2-results__option--highlighted[aria-selected]{

View File

@ -159,9 +159,15 @@
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;"> <select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
<option value="">Select a Product</option> <option value="">Select a Product</option>
<?php foreach ($product as $value) : ?> <?php foreach ($product as $value) : ?>
<?php if ($value['per'] == 'ml') {
$value_ml = ' ('.$value['ml'].$value['per'].')';
} else {
$value_ml = '';
}
?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["product_id"] ?>" <?= isset($purchasechild['product_id']) && $purchasechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>> <option value="<?= $value["product_id"] ?>" <?= isset($purchasechild['product_id']) && $purchasechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>>
<?= $value["product_name"]; ?> <?= $value["product_name"].$value_ml; ?>
</option> </option>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
@ -189,17 +195,15 @@
<?php endif; ?> <?php endif; ?>
<!-- You can add more rows as needed using JavaScript --> <!-- You can add more rows as needed using JavaScript -->
</tbody> </tbody>
</table> </table>
<?php if (empty($purchase["status"]) || isset($reorder)): ?> <?php if (empty($purchase["status"]) || isset($reorder)): ?>
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<!-- Show the "Add More Item" button only if invoice_type is not 1 --> <!-- Show the "Add More Item" button only if invoice_type is not 1 -->
<a class="btn" id="addItem"> <a class="btn" id="addItem">
<h4><i class="fa fa-plus" aria-hidden="true"></i> Add Product</h4> <h4><i class="fa fa-plus" aria-hidden="true"></i> Add Product</h4>
</a> </a>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
@ -412,13 +416,17 @@ $(document).ready(function() {
// Event listener for "Add More Item" button // Event listener for "Add More Item" button
$('#addItem').click(function() { $('#addItem').click(function() {
console.log(productarray); // console.log(productarray);
var newRow = '<tr>' + '<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>'; var newRow = '<tr>' + '<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
for (var i = 0; i < productarray.length; i++) for (var i = 0; i < productarray.length; i++)
{ {
var product = productarray[i]; var product = productarray[i];
newRow += '<option value="' + product.product_id + '">' + product.product_name + '</option>'; var value_ml ='';
if (product.per == 'ml') {
value_ml = "("+product.ml+product.per+")";
}
newRow += '<option value="' + product.product_id + '">' + product.product_name + value_ml + '</option>';
} }
newRow += '</select></td>' + newRow += '</select></td>' +

View File

@ -113,12 +113,18 @@
<tbody> <tbody>
<?php if (isset($products) && !empty($products)) : <?php if (isset($products) && !empty($products)) :
foreach ($products as $product) { ?> foreach ($products as $product) { ?>
<?php if ($product['per'] == 'ml') {
$value_ml = ' ('.$product['ml'].$product['per'].')';
} else {
$value_ml = '';
}
?>
<tr> <tr>
<td style="width:10%;"> <td style="width:10%;">
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;"> <select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
<option value="">Select a Product</option> <option value="">Select a Product</option>
<option value="<?= $product["product_id"] ?>" <?= isset($product['product_id']) ? 'selected' : '' ?>> <option value="<?= $product["product_id"] ?>" <?= isset($product['product_id']) ? 'selected' : '' ?>>
<?= $product["product_name"]; ?> <?= $product["product_name"].$value_ml; ?>
</option> </option>
</select> </select>
</td> </td>

View File

@ -140,9 +140,15 @@
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;"> <select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
<option value="">Select a Product</option> <option value="">Select a Product</option>
<?php foreach ($product as $value) : ?> <?php foreach ($product as $value) : ?>
<?php if ($value['per'] == 'ml') {
$value_ml = ' ('.$value['ml'].$value['per'].')';
} else {
$value_ml = '';
}
?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["product_id"] ?>" <?= isset($purchasechild['product_id']) && $purchasechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>> <option value="<?= $value["product_id"] ?>" <?= isset($purchasechild['product_id']) && $purchasechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>>
<?= $value["product_name"]; ?> <?= $value["product_name"].$value_ml; ?>
</option> </option>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
@ -166,15 +172,15 @@
<?php endif; ?> <?php endif; ?>
<!-- You can add more rows as needed using JavaScript --> <!-- You can add more rows as needed using JavaScript -->
</tbody> </tbody>
</table> </table>
<?php if (empty($purchase["status"])): ?> <?php if (empty($purchase["status"])): ?>
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<!-- Show the "Add More Item" button only if invoice_type is not 1 --> <!-- Show the "Add More Item" button only if invoice_type is not 1 -->
<a class="btn" id="addItem"> <a class="btn" id="addItem">
<h4><i class="fa fa-plus" aria-hidden="true"></i> Add Product</h4> <h4><i class="fa fa-plus" aria-hidden="true"></i> Add Product</h4>
</a> </a>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@ -159,10 +159,16 @@
required data-toggle="select2" id="" style="width: 249px !important;"> required data-toggle="select2" id="" style="width: 249px !important;">
<option value="">Select a Product</option> <option value="">Select a Product</option>
<?php foreach ($product as $value) : ?> <?php foreach ($product as $value) : ?>
<?php if ($value['per'] == 'ml') {
$value_ml = ' ('.$value['ml'].$value['per'].')';
} else {
$value_ml = '';
}
?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["product_id"] ?>" <option value="<?= $value["product_id"] ?>"
<?= isset($salechild['product_id']) && $salechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>> <?= isset($salechild['product_id']) && $salechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>>
<?= $value["product_name"]; ?> <?= $value["product_name"].$value_ml; ?>
</option> </option>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
@ -617,13 +623,18 @@ $(document).ready(function() {
// Event listener for "Add More Item" button // Event listener for "Add More Item" button
$('#addItem').click(function() { $('#addItem').click(function() {
console.log(productarray); // console.log(productarray);
var newRow = '<tr>' + var newRow = '<tr>' +
'<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>'; '<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
for (var i = 0; i < productarray.length; i++) { for (var i = 0; i < productarray.length; i++) {
var product = productarray[i]; var product = productarray[i];
newRow += '<option value="' + product.product_id + '" >' + product.product_name + // console.log("product",product);
var value_ml ='';
if (product.per == 'ml') {
value_ml = "("+product.ml+product.per+")";
}
newRow += '<option value="' + product.product_id + '" >' + product.product_name + value_ml +
'</option>'; '</option>';
} }