From 0e41548e2d3e3ad2c5155ffe49ae7f49c8db438d Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Sat, 1 Mar 2025 13:14:17 +0000 Subject: [PATCH] bug fixes --- app/Controllers/Purchaseorder.php | 1 + app/Models/Purchaseorder_model.php | 11 + app/Models/Requistion_model.php | 2 +- app/Views/addRawMaterial.php | 8 +- app/Views/alterpurchaseorder.php | 18 +- app/Views/editImportAmendPO.php | 2 +- app/Views/importpo.php | 25 +-- app/Views/purchaseorder.php | 118 ++++++----- app/Views/servicePurchaseorder.php | 164 ++++++++------- app/Views/viewinwardgateregister.php | 5 +- public/assets/js/CreatePOValidation.js | 279 +++++++++++++++++++++++++ 11 files changed, 485 insertions(+), 148 deletions(-) diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index 057a65c1..020efadd 100755 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -4488,6 +4488,7 @@ class Purchaseorder extends BaseController $supplierid = $this->request->getPost('supplierid'); $materialcode = $this->request->getPost('materialcode'); $result = $this->purchaseorder_model->VerifyWithSupplierForPendingPO($supplierid, $materialcode); + $materialrate = $this->purchaseorder_model->materialRate($materialcode); $response = ""; if (!empty($result)) { diff --git a/app/Models/Purchaseorder_model.php b/app/Models/Purchaseorder_model.php index 133bd261..9aef1057 100755 --- a/app/Models/Purchaseorder_model.php +++ b/app/Models/Purchaseorder_model.php @@ -2558,6 +2558,17 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, return $query->getResultArray(); } + function materialRate($materialcode){ + $builder = $this->db->table('t_materialmaster') + ->select('t_materialmaster.material_rate') + ->where('t_materialmaster.MaterialCode', $materialcode); + + $query = $builder->get()->getRow(); + + $material_rate = $query ? $query->material_rate : null; + return $material_rate; + + } function lastPONO() { diff --git a/app/Models/Requistion_model.php b/app/Models/Requistion_model.php index bfeed261..47a68809 100755 --- a/app/Models/Requistion_model.php +++ b/app/Models/Requistion_model.php @@ -175,7 +175,7 @@ class Requistion_model extends Model function GetMaterialCode($ReqType,$NotArray='') { $builder = $this->db->table('t_materialmaster') - ->select('MaterialCode, MaterialName,UOM') + ->select('MaterialCode, MaterialName,UOM,material_rate') ->where('IsActive',1); //->where('MaterialType',$ReqType ); diff --git a/app/Views/addRawMaterial.php b/app/Views/addRawMaterial.php index 001df8d9..f9bf39d7 100755 --- a/app/Views/addRawMaterial.php +++ b/app/Views/addRawMaterial.php @@ -14,8 +14,12 @@ dateFormat: 'dd-mm-yy', changeMonth: true, changeYear: true, - yearRange: '-100:+1' + yearRange: '-100:+1', + orientation: 'bottom', + autoclose: true, + autocomplete:'off' }); + }); @@ -120,7 +124,7 @@
'Date', 'value' => set_value('Date'), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;'); + $data = array('name' => 'Date', 'value' => set_value('Date'), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;', 'autocomplete'=>'"off"'); echo form_input($data); ?>
diff --git a/app/Views/alterpurchaseorder.php b/app/Views/alterpurchaseorder.php index 618819e2..c49318e5 100755 --- a/app/Views/alterpurchaseorder.php +++ b/app/Views/alterpurchaseorder.php @@ -1955,12 +1955,14 @@ if (!empty($INRSYMBOL)) { if (selectedMaterialCode == value.MaterialCode) { $("#ServiceDescription").val(value.MaterialName); $("#ServiceUOM").val(value.UOM); + $("#ServiceRate").val(value.material_rate); if ($('#ScheduleType').val().trim() != 'Recurring') { $('#FrequencyChange').val('One Time'); $('#ServiceNo').val(1); + } else { $('#FrequencyChange').val($('#ScheduleType').val()); @@ -2167,7 +2169,7 @@ if (!empty($INRSYMBOL)) { if (selectedRevenueMaterialCode == value.MaterialCode) { $("#ItemName").val(value.MaterialName); $("#UOM").val(value.UOM); - + $("#Rate").val(value.material_rate); } }); @@ -3577,7 +3579,7 @@ if (!empty($INRSYMBOL)) { class="badge mandatory">*
'ServiceRate', 'value' => set_value('ServiceRate'), 'id' => 'ServiceRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Ratechange()'); + $data = array('name' => 'ServiceRate', 'value' => set_value('ServiceRate'), 'id' => 'ServiceRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Ratechange();UpdateTheRateMaster();'); echo form_input($data); ?>
@@ -6555,7 +6557,19 @@ if (!empty($INRSYMBOL)) { $('#ServiceMaterialCode').focus(); return false; } + function UpdateTheRateMaster(){ + if ($('#ServiceMaterialCode').val() != "0" && $('#ServiceRate').val() != "0" ) { + var MaterialCode = $('#ServiceMaterialCode').val(); + var Rate = $('#ServiceRate').val(); + } + if ($('#ServiceMaterialCode').val() != "0" && $('#ServiceRate').val() != "0" ) { + var MaterialCode = $('#MaterialCode').val(); + var Rate = $('#Rate').val(); + } + if (MaterialCode != "0" && Rate != "0" ) { + } + } if ($('#ServiceQuantity').val() != '' && $('#ServiceRate').val() != '') { diff --git a/app/Views/editImportAmendPO.php b/app/Views/editImportAmendPO.php index dc7e9895..ba27c03f 100755 --- a/app/Views/editImportAmendPO.php +++ b/app/Views/editImportAmendPO.php @@ -1199,7 +1199,7 @@ if (!empty($RequistionDetails)) {
- +
diff --git a/app/Views/importpo.php b/app/Views/importpo.php index 4cfe8c3f..07bc9dcb 100755 --- a/app/Views/importpo.php +++ b/app/Views/importpo.php @@ -399,14 +399,19 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { } function vaildateBeforeOpenModal() { - if ($('#PODate').val() == '') { - alert('Please Enter the Purchase Order date'); - $('#PODate').focus(); - return false; - } else if ($('#drpSupplier').val() == "0") { + + if ($('#drpSupplier').val() == "0") { alert('Please Select the Supplier details'); $('#drpSupplier').focus(); return false; + } else if ($('#currencytype').val() == '0') { + alert('Please Select the Currency Type'); + $('#currencytype').focus(); + return false; + } else if ($('#PODate').val() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; } else if ($('#DeliveryAddr').val() == '') { alert('Please Enter the Delivery Address'); $('#DeliveryAddr').focus(); @@ -4185,15 +4190,7 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { //alert(JSON.stringify(txtStatus)); //exit(); if (validate() && Budgetcheck()) { - if (document.getElementById('ImportTax').rows.length <= 0) { - - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - - - - } else if ($('#Importoption').val() == "0") { + else if ($('#Importoption').val() == "0") { alert('Please Select Import Type'); $('#Importoption').focus(); return false; diff --git a/app/Views/purchaseorder.php b/app/Views/purchaseorder.php index 1fcb4103..45de4b7c 100755 --- a/app/Views/purchaseorder.php +++ b/app/Views/purchaseorder.php @@ -203,38 +203,47 @@ if (!empty($INRSYMBOL)) { } function vaildateBeforeOpenModal() { - var radioValue = $("input[name='DateRange']:checked").val(); - if ($('#drpSupplier').val() == "0") { - alert('Please Select the Supplier details'); - $('#drpSupplier').focus(); - return false; - } else if ($('#PODate').val() == '') { - alert('Please Enter the Purchase Order date'); - $('#PODate').focus(); - return false; - } else if ($('#DeliveryAddr').val() == '') { - alert('Please Enter the Delivery Address'); - $('#DeliveryAddr').focus(); - return false; - } else if (radioValue == 0 && $('#Deliverydate').val() == '') { - alert('Please Select the Delivery Date'); - $('#Deliverydate').focus(); - return false; - } else if (radioValue == 1 && $('#Scheduleby').val().trim() == '') { + var radioValue = parseInt($("input[name='DateRange']:checked").val()); + + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + }else if ($('#PODate').val().trim() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#DeliveryAddr').val().trim() == '') { + alert('Please Enter the Delivery Address'); + $('#DeliveryAddr').focus(); + return false; + }else if (radioValue === 0 && $('#Deliverydt').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydt').focus(); + return false; + }else if (radioValue == 1) { + var scheduleBy = $('#Scheduleby').val(); // Get the value + if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined alert('Please Enter the Schedule By'); - $('#Deliverydate').focus(); + $('#Scheduleby').focus(); return false; - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select Revenue Type'); - $('#PoTypeOptions').focus(); - return false; - } else if ($('#BudgetType').val() == "0") { - alert('Please Select Budget Type'); - $('#BudgetType').focus(); - return false; - } else { - return true; } + }else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Revenue Type'); + $('#PoTypeOptions').focus(); + return false; + }else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + }else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + } else { + return true; + } + } var NilType = ''; @@ -2157,7 +2166,7 @@ if (!empty($INRSYMBOL)) {
-
+
@@ -3909,36 +3918,33 @@ if (!empty($INRSYMBOL)) { var txtTotalDiscount = $('#txtTotalDiscount').val(); var finalBasicAmount = txtTotBasicAmount - txtTotalDiscount; //alert(txtTotBasicAmount+"--"+txtTotalDiscount+"--"+finalBasicAmount+"--"+AvlBudAmt); - if (validate()) { - if (document.getElementById('revenueTax').rows.length < 1) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } - // else if(parseInt(AvlBudAmt) < parseInt(finalBasicAmount)) { - // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); - + if (revenueValidate()) { + // if (document.getElementById('revenueTax').rows.length < 1) { + // alert('Please Select Line item to Create PO'); + // return false; + // } + // else if(parseInt(AvlBudAmt) < parseInt(finalBasicAmount)) { + // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); // return false; - // } - else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { - alert('Please Enter Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } else if ($('#insurance').val() == 1 && $('#InsuranceNumber').val() == '') { - alert('Please Enter Insurance No / Insurance Details..!'); - $('#insurance').focus(); - return false; - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select Revenue Type'); - $('#PoTypeOptions').focus(); - return false; - - } else { + // } + // else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + // alert('Please Enter Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } else if ($('#insurance').val() == 1 && $('#InsuranceNumber').val() == '') { + // alert('Please Enter Insurance No / Insurance Details..!'); + // $('#insurance').focus(); + // return false; + // } else if ($('#PoTypeOptions').val() == "0") { + // alert('Please Select Revenue Type'); + // $('#PoTypeOptions').focus(); + // return false; + // } + // else { var formData = new FormData($('.CreatePO')[0]); disableButtons(); - $.ajax({ type: "POST", url: "purchaseorder/addNewPurchaseOrder", @@ -3970,7 +3976,7 @@ if (!empty($INRSYMBOL)) { } }); - } + // } } } diff --git a/app/Views/servicePurchaseorder.php b/app/Views/servicePurchaseorder.php index 3b57b6fb..75e71157 100755 --- a/app/Views/servicePurchaseorder.php +++ b/app/Views/servicePurchaseorder.php @@ -239,20 +239,21 @@ if (!empty($INRSYMBOL)) { }); // Conditional logic for PaymentID - if (PaymentID === 'PT08') { - $('#otheroptiondiv').show(); - $('#Otherpayment').val(''); - } else { + if (PaymentID != 'PT08') { $('#otheroptiondiv').hide(); + $('#Otherpayment').prop('required', false); $('#Otherpayment').val(''); + } else if (PaymentID == 'PT08') { + $('#otheroptiondiv').show(); + $('#Otherpayment').prop('required', true); } - // Populate Payment Terms + var Payment = ; $('#PaymentTerms').empty(); - $.each(payments, function(pay, payobj) { - $("#PaymentTerms").append($('').val(payobj.PaymentID).html(payobj.PaymentTerms)); + $.each(Payment, function(idx, obj) { + $("#PaymentTerms").append($('').val(obj.PaymentID).html(obj.PaymentTerms)); }); - + $("#PaymentTerms").val(PaymentID); } else { alert('Please select a Supplier.'); return false; @@ -1044,7 +1045,7 @@ if (!empty($INRSYMBOL)) {
-
SNo
+
@@ -2376,33 +2377,30 @@ if (!empty($INRSYMBOL)) { $('#txtStatus').val(stat); var AvlBudAmt = ''; var txtTotalOrderValueSummary = $('#txtTotBasicAmount').val(); - if (validate()) { - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } - // else if(parseInt(AvlBudAmt) < parseInt(txtTotalOrderValueSummary)) { + if (serviceValidate()) { + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // return false; + // } + // else if(parseInt(AvlBudAmt) < parseInt(txtTotalOrderValueSummary)) { // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); - // return false; - // } - else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { - alert('Please Enter Other Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } else if ($('#descofpo').val().trim() == '') { - alert('Please Enter Description Of Service'); - $('#descofpo').focus(); - return false; - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select POType'); - $('#PoTypeOptions').focus(); - return false; - - } else { + // } + // else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + // alert('Please Enter Other Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } else if ($('#descofpo').val().trim() == '') { + // alert('Please Enter Description Of Service'); + // $('#descofpo').focus(); + // return false; + // } else if ($('#PoTypeOptions').val() == "0") { + // alert('Please Select POType'); + // $('#PoTypeOptions').focus(); + // return false; + // } else { var formData = new FormData($('.ServicePO')[0]); - + disableButtons(); console.log("inside add service purchase order view page"); console.log(formData); @@ -2422,15 +2420,21 @@ if (!empty($INRSYMBOL)) { $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val(''); window.location = "purchaseorderListing"; - + setTimeout(function() { enableButtons(); }, 2000); } else { alert("Error"); + setTimeout(function() { enableButtons(); }, 2000); } + }, + error: function(jqXHR, textStatus, errorThrown) { + console.error("AJAX Error: " + textStatus + ": " + errorThrown); + alert("Error: " + textStatus); + setTimeout(function() { enableButtons(); }, 2000); } }); - } + // } } } @@ -2454,45 +2458,58 @@ if (!empty($INRSYMBOL)) { } function vaildateBeforeOpenModal() { - var radioValue = $("input[name='DateRange']:checked").val(); - if ($('#PODate').val() == '') { - alert('Please Enter the Purchase Order date'); - $('#PODate').focus(); - return false; - } else if ($('#drpSupplier').val() == "0") { - alert('Please Select the Supplier details'); - $('#drpSupplier').focus(); - return false; - } else if ($('#DeliveryAddr').val() == '') { - alert('Please Enter the Delivery Address'); - $('#DeliveryAddr').focus(); - return false; - } else if (radioValue == 0 && $('#Deliverydate').val() == '') { - alert('Please Select the Delivery Date'); - $('#Deliverydate').focus(); - return false; - } else if (radioValue == 1 && $('#Scheduleby').val().trim() == '') { + var radioValue = parseInt($("input[name='DateRange']:checked").val()); + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + }else if ($('#workstatus').val() == "0") { + alert('Please Select the Work Status'); + $('#drpSupplier').focus(); + return false; + }else if ($('#PODate').val().trim() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#DeliveryAddr').val().trim() == '') { + alert('Please Enter the Delivery Address'); + $('#DeliveryAddr').focus(); + return false; + }else if (radioValue === 0 && $('#Deliverydt').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydt').focus(); + return false; + }else if (radioValue == 1) { + var scheduleBy = $('#Scheduleby').val(); // Get the value + if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined alert('Please Enter the Schedule By'); - $('#Deliverydate').focus(); + $('#Scheduleby').focus(); return false; - } else if ($('#workstatus').val() == "0") { - alert('Please Enter WorkStatus'); - $('#workstatus').focus(); - return false; - - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select POType'); - $('#PoTypeOptions').focus(); - return false; - - } else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { - alert('Please Enter Other Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - - } else { - return true; } + }else if($('#PODate').val() == ''){ + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Service Type'); + $('#PoTypeOptions').focus(); + return false; + }else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + }else if($('#insuranceStatus').val() == "1" && $('#InsuranceNumber').val().trim() == ''){ + alert('Please Enter the Insurance No / Insurance Details'); + $('#InsuranceNumber').focus(); + return false; + }else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + }else { + return true; + } + } function calculateCgstTax(varBasicValue, Cgst) { @@ -2565,9 +2582,14 @@ if (!empty($INRSYMBOL)) { function Reset() { + disableButtons(); location.reload(); + setTimeout(function() { + enableButtons(); + }, 2000); } + $('#insuranceTxtDiv').hide(); $("#insuranceStatus").change(function() { diff --git a/app/Views/viewinwardgateregister.php b/app/Views/viewinwardgateregister.php index cf455b80..7fbb9f08 100755 --- a/app/Views/viewinwardgateregister.php +++ b/app/Views/viewinwardgateregister.php @@ -1257,7 +1257,10 @@ success: function(data) { alert(data); - // location.reload(); + // setTimeout(function () { + // $("#Igrshow").modal('hide'); + // }, 2000); + location.reload(); }, error: function(xhr, status, error) { // Error callback console.error('AJAX Error:', status, error); diff --git a/public/assets/js/CreatePOValidation.js b/public/assets/js/CreatePOValidation.js index c4869792..f1e86374 100755 --- a/public/assets/js/CreatePOValidation.js +++ b/public/assets/js/CreatePOValidation.js @@ -26,6 +26,285 @@ function myFunction() { } } + +function disableButtons() { + document.querySelectorAll('.Save, .Submit').forEach(function(button) { + button.classList.add('disabled'); + button.setAttribute('disabled', 'disabled'); + }); +} + +function enableButtons() { + document.querySelectorAll('.Save, .Submit').forEach(function(button) { + button.classList.remove('disabled'); + button.removeAttribute('disabled'); + }); +} + +function revenueValidate(){ + var radioValue = parseInt($("input[name='DateRange']:checked").val()); + + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + }else if ($('#PODate').val().trim() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#DeliveryAddr').val().trim() == '') { + alert('Please Enter the Delivery Address'); + $('#DeliveryAddr').focus(); + return false; + }else if (radioValue === 0 && $('#Deliverydt').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydt').focus(); + return false; + }else if (radioValue == 1) { + var scheduleBy = $('#Scheduleby').val(); // Get the value + if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined + alert('Please Enter the Schedule By'); + $('#Scheduleby').focus(); + return false; + } + }else if($('#PODate').val() == ''){ + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Revenue Type'); + $('#PoTypeOptions').focus(); + return false; + }else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + }else if($('#insuranceStatus').val() == "1" && $('#InsuranceNumber').val().trim() == ''){ + alert('Please Enter the Insurance No / Insurance Details'); + $('#InsuranceNumber').focus(); + return false; + }else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + }else if ($('#revenueTax tbody tr').length < 1) { + alert('Please Select Line item to Create PO'); + return false; + }else { + return true; + } +} + +function serviceValidate(){ + var radioValue = parseInt($("input[name='DateRange']:checked").val()); + + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + }else if ($('#workstatus').val() == "0") { + alert('Please Select the Work Status'); + $('#workstatus').focus(); + return false; + }else if ($('#PODate').val().trim() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#DeliveryAddr').val().trim() == '') { + alert('Please Enter the Delivery Address'); + $('#DeliveryAddr').focus(); + return false; + }else if (radioValue === 0 && $('#Deliverydt').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydt').focus(); + return false; + }else if (radioValue == 1) { + var scheduleBy = $('#Scheduleby').val(); // Get the value + if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined + alert('Please Enter the Schedule By'); + $('#Scheduleby').focus(); + return false; + } + }else if($('#PODate').val() == ''){ + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Service Type'); + $('#PoTypeOptions').focus(); + return false; + }else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + }else if($('#insuranceStatus').val() == "1" && $('#InsuranceNumber').val().trim() == ''){ + alert('Please Enter the Insurance No / Insurance Details'); + $('#InsuranceNumber').focus(); + return false; + }else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + }else if ($('#serviceTax tbody tr').length < 1) { + alert('Please Select Line item to Create PO'); + return false; + } else if ($('#descofpo').val().trim() == '') { + alert('Please Enter Description Of Service'); + $('#descofpo').focus(); + return false; + }else { + return true; + } +} + +function capitalValidate(){ + var radioValue = parseInt($("input[name='DateRange']:checked").val()); + var PoType = $('#POType').val(); + if(PoType=='CAPITAL' && capitalType=='International'){ + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + } + }else{ + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + } + } + + else if ($('#PODate').val().trim() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#DeliveryAddr').val().trim() == '') { + alert('Please Enter the Delivery Address'); + $('#DeliveryAddr').focus(); + return false; + }else if (radioValue === 0 && $('#Deliverydt').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydt').focus(); + return false; + }else if (radioValue == 1) { + var scheduleBy = $('#Scheduleby').val(); // Get the value + if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined + alert('Please Enter the Schedule By'); + $('#Scheduleby').focus(); + return false; + } + }else if($('#PODate').val() == ''){ + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Service Type'); + $('#PoTypeOptions').focus(); + return false; + }else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + }else if($('#insuranceStatus').val() == "1" && $('#InsuranceNumber').val().trim() == ''){ + alert('Please Enter the Insurance No / Insurance Details'); + $('#InsuranceNumber').focus(); + return false; + }else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + }else if ($('#serviceTax tbody tr').length < 1) { + alert('Please Select Line item to Create PO'); + return false; + } else if ($('#descofpo').val().trim() == '') { + alert('Please Enter Description Of Service'); + $('#descofpo').focus(); + return false; + }else { + return true; + } +} + +function importValidate(){ + var radioValue = parseInt($("input[name='DateRange']:checked").val()); + + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + } else if ($('#currencytype').val() == '0') { + alert('Please Select the Currency Type'); + $('#currencytype').focus(); + return false; + } else if ($('#DeliveryAddr').val().trim() == '') { + alert('Please Enter the Delivery Address'); + $('#DeliveryAddr').focus(); + return false; + } else if (radioValue === 0 && $('#Deliverydt').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydt').focus(); + return false; + } else if (radioValue == 1) { + var scheduleBy = $('#Scheduleby').val(); // Get the value + if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined + alert('Please Enter the Schedule By'); + $('#Scheduleby').focus(); + return false; + } + } else if ($('#Dispatch').val() == '' && $('#Scheduleby').val() == '') { + if (document.getElementById("Schedule").checked) { + alert('Please Enter Schedule By'); + return false; + } else if (document.getElementById("Date").checked) { + alert('Please Enter Dispatch Instruction'); + return false; + } + + } else if ($('#ExchangeRate').val() == '') { + alert('Please Enter the Exchange Rate'); + $('#ExchangeRate').focus(); + return false; + } else if ($('#ExchangeRate').val() == 0) { + alert('Please Enter the Exchange Rate'); + $('#ExchangeRate').focus(); + return false; + } else if ($('#PlaceOforigin').val() == '') { + alert('Please Enter Place Of Origin'); + $('#PlaceOforigin').focus(); + return false; + } else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Service Type'); + $('#PoTypeOptions').focus(); + return false; + } else if($('#PODate').val() == ''){ + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + } else if ($('#PaymentTerms').val() == '') { + alert('Please Select Payment Terms'); + $('#PaymentTerms').focus(); + return false; + + } else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + } else if($('#insuranceStatus').val() == "1" && $('#InsuranceNumber').val().trim() == ''){ + alert('Please Enter the Insurance No / Insurance Details'); + $('#InsuranceNumber').focus(); + return false; + } else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + }else if ($('#ImportTax tbody tr').length < 1) { + alert('Please Select Line item to Create PO'); + return false; + }else { + return true; + } +} + function validate() { var radioValue = $("input[name='DateRange']:checked").val();
SNo