bug fixes

This commit is contained in:
VE10-Sanjeev 2025-03-01 13:14:17 +00:00
parent 9ef36dca9b
commit 0e41548e2d
11 changed files with 485 additions and 148 deletions

View File

@ -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)) {

View File

@ -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()
{

View File

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

View File

@ -14,8 +14,12 @@
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+1'
yearRange: '-100:+1',
orientation: 'bottom',
autoclose: true,
autocomplete:'off'
});
});
</script>
<!-- <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/Autocomplete/jquery.autocomplete.js"></script> -->
@ -120,7 +124,7 @@
<div class="col-md-3">
<label for="OpenStockDate">Open Stock Date</label>
<?php
$data = array('name' => '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);
?>
</div>

View File

@ -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">*</span></label>
<div class="form-group">
<?php
$data = array('name' => '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);
?>
</div>
@ -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() != '') {

View File

@ -1199,7 +1199,7 @@ if (!empty($RequistionDetails)) {
<br />
<div class="form-row">
<div class="table-responsive">
<table id="ImportTax" class="table table-striped table-hover mb-0" style="font-size:12px;">
<table id="ImportTax" class="table table-bordered table-hover mb-0" style="font-size:12px;">
<thead>
<tr>

View File

@ -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;

View File

@ -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 = '<?php echo NILTYPE; ?>';
@ -2157,7 +2166,7 @@ if (!empty($INRSYMBOL)) {
<!-- Table -->
<div class="form-row">
<div class="table-responsive" style="padding-bottom: 30px;">
<table id="revenueTax" class="table table-striped table-hover mb-0" style="font-size:12px;">
<table id="revenueTax" class="table table-bordered table-hover mb-0" style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
@ -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: "<?php echo base_url() ?>purchaseorder/addNewPurchaseOrder",
@ -3970,7 +3976,7 @@ if (!empty($INRSYMBOL)) {
}
});
}
// }
}
}

View File

@ -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 = <?php echo json_encode($Payment, JSON_PRETTY_PRINT) ?>;
$('#PaymentTerms').empty();
$.each(payments, function(pay, payobj) {
$("#PaymentTerms").append($('<option></option>').val(payobj.PaymentID).html(payobj.PaymentTerms));
$.each(Payment, function(idx, obj) {
$("#PaymentTerms").append($('<option></option>').val(obj.PaymentID).html(obj.PaymentTerms));
});
$("#PaymentTerms").val(PaymentID);
} else {
alert('Please select a Supplier.');
return false;
@ -1044,7 +1045,7 @@ if (!empty($INRSYMBOL)) {
</div><!-- 6. form-row div closed here -->
<div class="form-row">
<div class="table-responsive" style="padding-bottom: 30px;">
<table id="serviceTax" class="table table-striped table-hover mb-0" style="font-size:12px;">
<table id="serviceTax" class="table table-bordered table-hover mb-0" style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
@ -2376,33 +2377,30 @@ if (!empty($INRSYMBOL)) {
$('#txtStatus').val(stat);
var AvlBudAmt = '<?php echo $AvlAmount ?>';
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() {

View File

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

View File

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