FILES_MERGE_PRODUCT_LIST_CONFLICT : AADHAVAN
This commit is contained in:
commit
490ebf6b99
@ -53,15 +53,40 @@ class Jobcard extends BaseController
|
||||
|
||||
public function download_jobcard_invoice($job_card_id)
|
||||
{
|
||||
|
||||
|
||||
$data['vehicle'] = $this->JobcardModel->get_jobcard_vehicle_details($job_card_id);
|
||||
$bus_id = $this->session->get('logged_user_business_id');
|
||||
$data['job_card'] = $this->JobcardModel->where('job_card_id',$job_card_id)->findAll();
|
||||
$data['company_address'] = $this->BusinessModel->where('business_id', $bus_id)->where('isactive', 1)->findAll();
|
||||
$data['job_card_products'] = $this->JobcardModel->get_jobcard_products_details($job_card_id);
|
||||
|
||||
// echo json_encode($data['job_card_products']);die;
|
||||
$productdata = $this->JobcardModel->get_jobcard_products_details($job_card_id);
|
||||
// echo json_encode($productdata);die;
|
||||
|
||||
$servicedata = $this->JobcardModel->get_jobcard_service($job_card_id);
|
||||
$complaintdata = $this->JobcardModel->get_jobcard_complaint($job_card_id);
|
||||
$labourcost = array_merge($servicedata, $complaintdata);
|
||||
/** CALCULATE LABOURCOST WITH TAX */
|
||||
$totalAmount = 0;
|
||||
$totalTax = 0;
|
||||
|
||||
// Calculate total amount and total tax
|
||||
foreach ($labourcost as $product) {
|
||||
$totalAmount += $product["labour_amount"];
|
||||
$totalTax += $product["labour_amount"] * ($product["tax"] / 100);
|
||||
}
|
||||
|
||||
// Calculate total
|
||||
$total = $totalAmount + $totalTax;
|
||||
|
||||
// Create single output array
|
||||
$labour_data[0] = [
|
||||
"product_name" => "Labour Cost",
|
||||
"qty" => 1,
|
||||
"tax" => number_format($totalTax, 2),
|
||||
"custom_amount" => number_format($totalAmount, 2),
|
||||
"custom_tax" => number_format($totalTax, 2),
|
||||
"custom_total" => number_format($total, 2)
|
||||
];
|
||||
$data['job_card_products'] = array_merge($productdata, $labour_data);
|
||||
// echo json_encode($complaintdata);die;
|
||||
|
||||
// Create an mPDF object
|
||||
$mpdf = new Mpdf([
|
||||
@ -90,7 +115,7 @@ class Jobcard extends BaseController
|
||||
|
||||
// Generate the PDF content (HTML) with data
|
||||
$html = view('invoice_pdf_template_jobcard', $data);
|
||||
// echo $html;die;
|
||||
|
||||
// Load HTML into the mPDF instance
|
||||
$mpdf->WriteHTML($html);
|
||||
|
||||
|
||||
@ -70,12 +70,46 @@ class JobcardModel extends Model
|
||||
|
||||
public function get_jobcard_products_details($job_id)
|
||||
{
|
||||
$this->select('job_card_product.*, job_card_product.tax, products.product_name, products.per');
|
||||
$this->select('job_card_product.*, products.product_name, products.per');
|
||||
$this->join('job_card_product', 'job_card_product.job_card_id = job_card.job_card_id');
|
||||
$this->join('products', 'products.product_id = job_card_product.product_id');
|
||||
$this->where('job_card_product.is_active', 1);
|
||||
$this->where('job_card_product.job_card_id', $job_id);
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
public function get_jobcard_service($job_id)
|
||||
{
|
||||
$this->select('job_card.*, job_card_service.*, services.service_name as product_name, services.labour_cost as labour_amount');
|
||||
$this->join('job_card_service', 'job_card_service.job_card_id = job_card.job_card_id');
|
||||
$this->join('services', 'services.service_id = job_card_service.service_id');
|
||||
$this->where('job_card.isactive', 1);
|
||||
$this->where('job_card.job_card_id', $job_id);
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
public function get_jobcard_complaint($job_id)
|
||||
{
|
||||
$this->select('job_card.*, job_card_complaint.*, complaints.name as product_name, complaints.labour_charge as labour_amount');
|
||||
$this->join('job_card_complaint', 'job_card_complaint.job_card_id = job_card.job_card_id');
|
||||
$this->join('complaints', 'complaints.complaint_id = job_card_complaint.complaint_id');
|
||||
$this->where('job_card.isactive', 1);
|
||||
$this->where('job_card.job_card_id', $job_id);
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
public function get_jobcard_labourcost($job_id)
|
||||
{
|
||||
$this->select('job_card.*, job_card_service.job_card_id, job_card_service.service_id, job_card_complaint.job_card_id, job_card_complaint.complaint_id, services.labour_cost, complaints.labour_charge,services.tax ,complaints.tax, services.labour_cost, complaints.labour_charge');
|
||||
$this->join('job_card_service', 'job_card_service.job_card_id = job_card.job_card_id');
|
||||
$this->join('services', 'services.service_id = job_card_service.service_id');
|
||||
$this->join('job_card_complaint', 'job_card_complaint.job_card_id = job_card.job_card_id');
|
||||
$this->join('complaints', 'complaints.complaint_id = job_card_complaint.complaint_id');
|
||||
$this->where('job_card.isactive', 1);
|
||||
$this->where('job_card.job_card_id', $job_id);
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -28,5 +28,14 @@ class ProductModel extends Model
|
||||
}
|
||||
}
|
||||
|
||||
public function get_products($branch_id)
|
||||
{
|
||||
$this->select('products.*, manufacturer.manufacturer_name');
|
||||
$this->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id');
|
||||
$this->where('products.branch_id', $branch_id);
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@ -204,4 +204,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@ -239,31 +239,33 @@ p {
|
||||
<td style="border: 1px solid black;">
|
||||
<?= $serialNumber++; ?>
|
||||
</td>
|
||||
<td style="border: 0.5px solid black;"><?= $item['product_name'] ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= $item['amount'] ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= $item['qty'] ?></td>
|
||||
<td style="border: 0.5px solid black;">nos</td>
|
||||
<td style="border: 0.5px solid black;"><?= $item['tax'] ?>%</td>
|
||||
<td style="border: 0.5px solid black;"><?= ($item['amount'] * ($item['tax'] / 2) / 100) ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= ($item['amount'] * ($item['tax'] / 2) / 100) ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= ($item['amount'] * $item['tax'] / 100) ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= ($item['amount'] + ($item['amount'] * $item['tax'] / 100) ) ?></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;"><?= $item['qty'] ?></td>
|
||||
<td style="border-right: 0.5px solid black;">nos</td>
|
||||
<td style="border-right: 0.5px solid black;"><?= $item['tax'] ?>%</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-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-right: 0.5px solid black;"><?php echo isset($item['custom_total']) ? $item['custom_total'] : ($item['amount'] + ($item['amount'] * $item['tax'] / 100) ) ?></td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<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 style="border: 0.5px solid black;"><?= $job_card[0]['tax'] ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= $job_card[0]['subtotal'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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 style="border: 0.5px solid black;"><?= $job_card[0]['tax'] ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= $job_card[0]['tax'] / 2 ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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 style="border: 0.5px solid black;"><?= $job_card[0]['tax'] ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= $job_card[0]['tax'] / 2 ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" style="border-left: 0.5px solid black;"></td>
|
||||
|
||||
@ -417,7 +417,7 @@ $(document).ready(async function() {
|
||||
'<td style="width:10%;"></td>' +
|
||||
'<td style="width:10%;"></td>' +
|
||||
'<td style="width:8%;"></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-amount" name="amount[]" value="' + data + '" readonly/></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-amount1" name="amount1[]" value="' + data + '" readonly/></td>' +
|
||||
'<td hidden></td>' +
|
||||
'<td hidden></td>' +
|
||||
'</tr>';
|
||||
@ -797,7 +797,7 @@ $(document).ready(async function() {
|
||||
'<td style="width:10%;"></td>' +
|
||||
'<td style="width:10%;"></td>' +
|
||||
'<td style="width:8%;"></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-amount" name="amount[]" value="' + data + '" readonly/></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-amount1" name="amount1[]" value="' + data + '" readonly/></td>' +
|
||||
'<td hidden></td>' +
|
||||
'<td hidden></td>' +
|
||||
'</tr>';
|
||||
@ -1027,7 +1027,7 @@ $(document).ready(async function() {
|
||||
'<td style="width:10%;"></td>' +
|
||||
'<td style="width:10%;"></td>' +
|
||||
'<td style="width:8%;"></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-amount item_dummy" name="amount[]" value="0"/></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-amount1 item_dummy" name="amount1[]" value="0"/></td>' +
|
||||
'<td hidden></td>' +
|
||||
'<td hidden></td>' +
|
||||
'</tr>';
|
||||
|
||||
@ -25,13 +25,14 @@
|
||||
|
||||
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100"
|
||||
<table id="datatable-buttons2" class="table table-striped dt-responsive nowrap w-100"
|
||||
style="width:100% !important;">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th>Product Name</th>
|
||||
<th>SKU Id</th>
|
||||
<th>Product Name</th>
|
||||
<th>Manufacturer Name</th>
|
||||
<th>Category</th>
|
||||
<th>Unit Price</th>
|
||||
<th>Qty in Stock</th>
|
||||
@ -45,11 +46,10 @@
|
||||
<?php foreach ($products as $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<td><?= $value['product_name']; ?></td>
|
||||
|
||||
<td><?= $value['sku_id']; ?></td>
|
||||
<td><?= $value['product_name']; ?></td>
|
||||
<td><?= $value['manufacturer_name']; ?></td>
|
||||
<td><?= $value['product_category']; ?></td>
|
||||
|
||||
<td><?= number_format($value['unit_price']); ?></td>
|
||||
<td><?= $value['qty_stock']; ?></td>
|
||||
<td><?= $value['rack_number']; ?></td>
|
||||
@ -76,4 +76,53 @@
|
||||
</div> <!-- end col -->
|
||||
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons2').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Products', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Products', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Products', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
// "ordering": false
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user