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 @@
| SNo | @@ -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();
|---|