From 2248bd425f2143dfde1d14e3709400fb17e6f832 Mon Sep 17 00:00:00 2001 From: sriramv Date: Sat, 11 May 2024 13:37:17 +0530 Subject: [PATCH] CHANGE_jobcard_discount_calculation:ss --- app/Controllers/Jobcard.php | 4 + app/Models/JobcardModel.php | 3 +- app/Views/job_card_form.php | 224 ++++++++++++++++------------- app/Views/jobcard_pdf_template.php | 135 ++++++++--------- app/Views/jobs_list.php | 4 +- app/Views/product_list.php | 4 +- 6 files changed, 189 insertions(+), 185 deletions(-) diff --git a/app/Controllers/Jobcard.php b/app/Controllers/Jobcard.php index c9ed40f..2290b1e 100644 --- a/app/Controllers/Jobcard.php +++ b/app/Controllers/Jobcard.php @@ -400,6 +400,10 @@ class Jobcard extends BaseController 'billing_city' => $this->request->getPost('city'), 'billing_state' => $this->request->getPost('state'), 'billing_postal_code' => $this->request->getPost('postalcode'), + 'fuel_qty'=> $this->request->getPost('fuel_qty'), + 'meter'=> $this->request->getPost('meter'), + 'delivery_date'=> $this->request->getPost('delivery_date'), + 'note'=> $this->request->getPost('note'), 'status'=> $this->request->getPost('status'), 'assigned_to'=> json_encode($this->request->getPost('assigned_to')), // 'store_item_issued'=> $this->request->getPost('store_item_issued'), diff --git a/app/Models/JobcardModel.php b/app/Models/JobcardModel.php index 54fd5b0..2c024b4 100644 --- a/app/Models/JobcardModel.php +++ b/app/Models/JobcardModel.php @@ -8,7 +8,8 @@ class JobcardModel extends Model protected $allowedFields = ['job_card_id','inv_no','vehicle_id','branch_id', 'order_number','client_mobile_no','client_name', 'billing_address','billing_city','billing_state','billing_country', - 'billing_postal_code','status','assigned_to', 'store_item_issued','subtotal','tax', 'discount','total','isactive']; + 'billing_postal_code','fuel_qty', 'meter', 'delivery_date', 'note', + 'status','assigned_to', 'store_item_issued','subtotal','tax', 'discount','total','isactive']; diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php index 183eaee..7088e27 100644 --- a/app/Views/job_card_form.php +++ b/app/Views/job_card_form.php @@ -80,6 +80,25 @@ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
@@ -316,7 +335,7 @@ $(document).ready(async function() { for (const value of edit_service_data) { servicearray = ; // console.log(servicearray); - var newRow = ` + var newRow = ` ' + - '' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + '
' + '' + ''; // console.log(value); tr = $('#productItemTable tbody').append(newRow); - initializeSelect2(); + // initializeSelect2(); /** APPEND CHILD PRODUCT */ await edit_product_data(value.product); editlabourcost(value,'service_lb'); @@ -355,7 +374,7 @@ $(document).ready(async function() { for (const value of edit_complaint_data) { complaint = ; // console.log(productarray); - var newRow = ' ' + - '' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + '
'+ '
'+ '
'+ @@ -386,7 +405,7 @@ $(document).ready(async function() { $('#productItemTable tbody').append(newRow); - initializeSelect2(); + // initializeSelect2(); /** APPEND CHILD PRODUCT */ await edit_product_data(value.product); editlabourcost(value,'complaint_lb') @@ -397,13 +416,13 @@ $(document).ready(async function() { var edit_ccomplaint_data = ; if(edit_ccomplaint_data.length > 0) { for (const value of edit_ccomplaint_data) { - var newRow = ' ' + - '' + - '' + - '' + - '' + - '' + - '' + + var newRow = ' ' + + '' + + '' + + '' + + '' + + '' + + '' + '
'+ '
'+ '
'+ @@ -419,7 +438,7 @@ $(document).ready(async function() { $('#productItemTable tbody').append(newRow); - initializeSelect2(); + // initializeSelect2(); /** APPEND CHILD PRODUCT */ await edit_product_data(value.product); editlabourcost(value,'custom_complaint_lb') @@ -429,20 +448,20 @@ $(document).ready(async function() { function editlabourcost(data,cls) { total_wih_tax = parseInt(data.labour_cost) + (parseInt(data.labour_cost) * (data.tax / 100)); total_tax_amt = total_wih_tax - parseInt(data.labour_cost); - var newRow = '' + - '' + - '' + - '' + - '' + - '' + - '' + + var newRow = '' + + '' + + '' + + '' + + '' + + '' + + '' + '' + '' + ''; $('#productItemTable tbody').append(newRow); // $(newRow).insertAfter(tr); - initializeSelect2(); + // initializeSelect2(); } function edit_product_data(products) { @@ -460,18 +479,18 @@ $(document).ready(async function() { { action = '
'; } - var newRow = ` + var newRow = ` ' + - '' + - '' + - '' + - ' ' + - '' + - '' + + '' + + '' + + '' + + ' ' + + '' + + '' + ''+ action+ ''+ @@ -482,7 +501,7 @@ $(document).ready(async function() { $('#productItemTable tbody').append(newRow); // $(newRow).insertAfter(tr); - initializeSelect2(); + // initializeSelect2(); } } @@ -694,15 +713,16 @@ $(window).on('load', function() { } var tableData; - var initial = 0; + // var initial = 0; // Update item amounts on change of discount $('#applyDiscountBtn').on('click', function() { if($('#dt_amount').val() != '' && $('#dt_amount').val() > 0 && $('#grandtotal').val() > 0) { - if(initial == 0) { - tableData = $('#productItemTable tbody').html();; - initial++; - } + // if(initial == 0) { + tableData = $('#productItemTable tbody').html(); + console.log(tableData); + // initial++; + // } var discount = parseFloat($('#dt_amount').val()); @@ -715,8 +735,8 @@ $(window).on('load', function() { $('#refreshDiscountBtn').prop('disabled', true); $('#refreshDiscountBtn').on('click', function() { - $('#productItemTable tbody').empty(); - $('#productItemTable tbody').append(tableData); + $('#productItemTable tbody').html(''); + $('#productItemTable tbody').html(tableData); $('#refreshDiscountBtn').prop('disabled', true); $('#dt_amount').val(0); @@ -1065,19 +1085,19 @@ $(window).on('load', function() { const labourcost = async (cost,tax,tr,cls) => { total_wih_tax = parseInt(cost) + (parseInt(cost) * (tax / 100)); total_tax_amt = total_wih_tax - parseInt(cost); - var newRow = '' + - '' + - '' + - '' + - '' + - '' + - '' + + var newRow = '' + + '' + + '' + + '' + + '' + + '' + + '' + '' + '' + ''; $(newRow).insertAfter(tr); - initializeSelect2(); + // initializeSelect2(); } const service_child_products = async (data,tr) => { @@ -1094,15 +1114,15 @@ $(window).on('load', function() { var tax = cgst + sgst; total_wih_tax = parseInt(product.unit_price) + (parseInt(product.unit_price) * (tax / 100)); total_tax_amt = total_wih_tax - parseInt(product.unit_price); - var newRow = '' + - '' + - '' + - '' + - ' ' + - '' + - '' + + '' + + '' + + '' + + ' ' + + '' + + '' + '
' + '' + ''; @@ -1110,7 +1130,7 @@ $(window).on('load', function() { // $('#productItemTable tbody').append(newRow); $(newRow).insertAfter(tr); - initializeSelect2(); + // initializeSelect2(); }); } @@ -1222,7 +1242,7 @@ $(window).on('load', function() { selected_pr.push(rowProductid); }); - var newRow = '' + - '' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + '
' + '' + ''; // $('#productItemTable tbody').append(newRow); $(newRow).insertAfter($(this).closest('tr')); - initializeSelect2(); + // initializeSelect2(); }); $('#addService').click(function() { @@ -1263,7 +1283,7 @@ $(window).on('load', function() { servicearray = ; } console.log(servicearray); - var newRow = ' ' + - '' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + '
' + '' + ''; $('#productItemTable tbody').append(newRow); - initializeSelect2(); + // initializeSelect2(); }else{ toastr.warning("First Select Vehicle!"); } @@ -1314,7 +1334,7 @@ $(window).on('load', function() { }); complaint = ; - var newRow = ' ' + - '' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + '
'+ '
'+ '
'+ @@ -1345,7 +1365,7 @@ $(window).on('load', function() { '' + ''; $('#productItemTable tbody').append(newRow); - initializeSelect2(); + // initializeSelect2(); }); /** To achieve this functionality where entering a value in one input field automatically populates another input field * ONLY APPLICABLE IN COMPLAINT ONLY @@ -1362,13 +1382,13 @@ $(window).on('load', function() { $('#addCustomComplaint').click(function() { complaint = ; - var newRow = ' ' + - '' + - '' + - '' + - '' + - '' + - '' + + var newRow = ' ' + + '' + + '' + + '' + + '' + + '' + + '' + '' + '
'+ '
'+ @@ -1383,19 +1403,19 @@ $(window).on('load', function() { '' + ''; - newRow += '' + - '' + - '' + - '' + - '' + - '' + - '' + + newRow += '' + + '' + + '' + + '' + + '' + + '' + + '' + '' + '' + ''; $('#productItemTable tbody').append(newRow); - initializeSelect2(); + // initializeSelect2(); }); /** To achieve this functionality where entering a value in one input field automatically populates another input field diff --git a/app/Views/jobcard_pdf_template.php b/app/Views/jobcard_pdf_template.php index ef4fd00..591509f 100644 --- a/app/Views/jobcard_pdf_template.php +++ b/app/Views/jobcard_pdf_template.php @@ -167,65 +167,42 @@ p {

JOB CARD

JOB NO: -
-
+ + -
- + - -