diff --git a/app/Views/alterpurchaseorder.php b/app/Views/alterpurchaseorder.php index f10c9456..2e348498 100755 --- a/app/Views/alterpurchaseorder.php +++ b/app/Views/alterpurchaseorder.php @@ -6,7 +6,7 @@ $insuranceStatus = array( $ReqType = ''; $CompanyAddress = ''; $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); -$CurrentDate = $dt->format('d-m-Y'); +$CurrentDate = $dt->format('d-m-Y'); $CurrentDateNextYear = $dt->modify('+1 year')->format('d-m-Y'); $MaxPoDate = ''; @@ -171,7 +171,7 @@ if (!empty($INRSYMBOL)) { var RequistQuantity = ''; var IsEdit = '0'; - $(function() { + $(function () { // $("#PODate").datepicker({ @@ -223,308 +223,296 @@ if (!empty($INRSYMBOL)) { var y = ; - $.each(y, function(idx, obj) { - if(obj.SupplierID === id) - { - $("#SupAddress").val(obj.Address); + $.each(y, function (idx, obj) { + if (obj.SupplierID === id) { + $("#SupAddress").val(obj.Address); - } + } - }); + }); - } + } else - { - alert('Please select the SupplierID'); + { + alert('Please select the SupplierID'); return false; - } + } }); - $('#ReqNo').change(function() { + $('#ReqNo').change(function () { - var id = $('#ReqNo').val(); - $("#deptName").val(''); - $("#CostCenter").empty(); - $("#MaterialCode").empty(); - resetTaxField(); - if(id != '0') - { - var y = ; - var cost = ; - var Material = ; + var id = $('#ReqNo').val(); + $("#deptName").val(''); + $("#CostCenter").empty(); + $("#MaterialCode").empty(); + resetTaxField(); + if (id != '0') { + var y = ; + var cost = ; + var Material = ; - // For Binding DepartmentName - $.each(y, function(idx, obj) { - if(obj.ReqNo === id) - { - $("#deptName").val(obj.DepartmentName); + // For Binding DepartmentName + $.each(y, function (idx, obj) { + if (obj.ReqNo === id) { + $("#deptName").val(obj.DepartmentName); - } - }); - // For Binding Cost center for the selected department - $("#CostCenter").append( $('').val("0").html("Select Cost Center") ); - $.each(cost, function(idx, obj) { - if(obj.ReqNo === id) - { - $("#CostCenter").append( $('').val(obj.CostCenterCode).html(obj.CostCenterCode + "-" + obj.CostCenterName) ); + } + }); + // For Binding Cost center for the selected department + $("#CostCenter").append($('').val("0").html("Select Cost Center")); + $.each(cost, function (idx, obj) { + if (obj.ReqNo === id) { + $("#CostCenter").append($('').val(obj.CostCenterCode).html(obj.CostCenterCode + "-" + obj.CostCenterName)); - } + } - }); - // For Binding Material list center for the selected Requistion Number - $("#MaterialCode").append( $('').val("0").html("Select Material Code") ); - $.each(Material, function(idx, obj) { - if(obj.ReqNo === id) - { - $("#MaterialCode").append( $('').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName) ); + }); + // For Binding Material list center for the selected Requistion Number + $("#MaterialCode").append($('').val("0").html("Select Material Code")); + $.each(Material, function (idx, obj) { + if (obj.ReqNo === id) { + $("#MaterialCode").append($('').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); - } + } - }); + }); - } - else - { - alert('Please select the Requisition Number'); - return false; - } + } + else { + alert('Please select the Requisition Number'); + return false; + } - }); - $('#MaterialCode').change(function() { + }); + $('#MaterialCode').change(function () { - var id = $('#MaterialCode').val(); - RequistQuantity = ''; - resetTaxField(); - if(id != '0') - { - var y = ; + var id = $('#MaterialCode').val(); + RequistQuantity = ''; + resetTaxField(); + if (id != '0') { + var y = ; - $.each(y, function(idx, obj) { - if(obj.MaterialCode === id) - { - $("#ItemName").val(obj.MaterialName); - $("#UOM").val(obj.UOM); - $("#Quantity").val(obj.Quantity); - RequistQuantity = obj.Quantity; - } - }); - } - else - { - alert('Please select the MaterialCode'); - return false; - } + $.each(y, function (idx, obj) { + if (obj.MaterialCode === id) { + $("#ItemName").val(obj.MaterialName); + $("#UOM").val(obj.UOM); + $("#Quantity").val(obj.Quantity); + RequistQuantity = obj.Quantity; + } + }); + } + else { + alert('Please select the MaterialCode'); + return false; + } - }); + }); - $('#CostCenter').change(function() { + $('#CostCenter').change(function () { - var id = $('#CostCenter').val(); - $("#AvlBudAmt").val(''); + var id = $('#CostCenter').val(); + $("#AvlBudAmt").val(''); - if(id != '0') - { - var cost = ; + if (id != '0') { + var cost = ; - $.each(cost, function(idx, obj) { - if(obj.CostCenterCode === id) - { - $("#AvlBudAmt").val(obj.BudgetAmount); - } + $.each(cost, function (idx, obj) { + if (obj.CostCenterCode === id) { + $("#AvlBudAmt").val(obj.BudgetAmount); + } - }); - } - else - { - alert('Please select the MaterialCode'); - return false; - } + }); + } + else { + alert('Please select the MaterialCode'); + return false; + } - }); */ - /* Revenue Tax calcualation */ + }); */ + /* Revenue Tax calcualation */ - $('#DiscountType').change(function() { - selValue = $("#DiscountType").val(); + $('#DiscountType').change(function () { + selValue = $("#DiscountType").val(); + $('#txtDiscount').val(''); + $('#txtAfterDiscount').val(''); + if (selValue == NilType) { + + $('#txtDiscount').attr('readonly', 'true'); + $('#txtDiscount').val('0.00'); + $('#txtAfterDiscount').val('0.00'); + change(); + + } else { + $('#txtDiscount').removeAttr('readonly', 'true'); $('#txtDiscount').val(''); $('#txtAfterDiscount').val(''); + } + change(); + + }); + $('#EditDiscountType').change(function () { + if ($('#EditRevenueRate').val() != '' && $('#EditRevenueMaterialCode').val() != "0") { + selValue = $("#EditDiscountType").val(); + $('#txtEditDiscount').val(''); + $('#txtEditAfterDiscount').val(''); if (selValue == NilType) { - $('#txtDiscount').attr('readonly', 'true'); - $('#txtDiscount').val('0.00'); - $('#txtAfterDiscount').val('0.00'); + $('#txtEditDiscount').attr('readonly', 'true'); + $('#txtEditDiscount').val('0.00'); + $('#txtEditAfterDiscount').val('0.00'); change(); } else { - $('#txtDiscount').removeAttr('readonly', 'true'); - $('#txtDiscount').val(''); - $('#txtAfterDiscount').val(''); - } - change(); - - }); - $('#EditDiscountType').change(function() { - if ($('#EditRevenueRate').val() != '' && $('#EditRevenueMaterialCode').val() != "0") { - selValue = $("#EditDiscountType").val(); + $('#txtEditDiscount').removeAttr('readonly', 'true'); $('#txtEditDiscount').val(''); $('#txtEditAfterDiscount').val(''); - if (selValue == NilType) { - - $('#txtEditDiscount').attr('readonly', 'true'); - $('#txtEditDiscount').val('0.00'); - $('#txtEditAfterDiscount').val('0.00'); - change(); - - } else { - $('#txtEditDiscount').removeAttr('readonly', 'true'); - $('#txtEditDiscount').val(''); - $('#txtEditAfterDiscount').val(''); - change(); - } - } else { - alert('Please Select MaterialCode and Rate Field Value'); - $('#EditDiscountType').val("0"); - $('#EditRate').focus(); + change(); } - Editchange(); - }); + } else { + alert('Please Select MaterialCode and Rate Field Value'); + $('#EditDiscountType').val("0"); + $('#EditRate').focus(); + } + Editchange(); + }); - $('#PackagingType').change(function() { - $('#txtPackaging').val(''); - $('#txtAfterPackaging').val(''); - selValue = $("#PackagingType").val(); - if (selValue == PercentageType) { - var PackagingCalculation = ''; - $('#packagingcalmodel').modal('show'); - $('#txtPackaging').removeAttr('readonly', 'true'); - } else { - if (selValue == NilType) { + $('#PackagingType').change(function () { + $('#txtPackaging').val(''); + $('#txtAfterPackaging').val(''); + selValue = $("#PackagingType").val(); + if (selValue == PercentageType) { + var PackagingCalculation = ''; + $('#packagingcalmodel').modal('show'); + $('#txtPackaging').removeAttr('readonly', 'true'); + } else { + if (selValue == NilType) { - $('#txtPackaging').attr('readonly', 'true'); - $('#txtPackaging').val('0.00'); - $('#txtAfterPackaging').val('0.00'); - change(); - } else { - $('#txtPackaging').removeAttr('readonly', 'true'); - } - } - //change(); - }); - $('#EditPackagingType').change(function() { - $('#txtEditPackaging').val(''); - $('#txtEditAfterPackaging').val(''); - selValue = $("#EditPackagingType").val(); - if (selValue == PercentageType) { - var PackagingCalculation = ''; - $('#packagingcalmodel').modal('show'); - $('#txtEditPackaging').removeAttr('readonly', 'true'); - } else { - if (selValue == NilType) { - - $('#txtEditPackaging').attr('readonly', 'true'); - $('#txtEditPackaging').val('0.00'); - $('#txtEditAfterPackaging').val('0.00'); - Editchange(); - } else { - $('#txtEditPackaging').removeAttr('readonly', 'true'); - } - } - //change(); - - }); - $('#txtExciseDuty').change(function() { - - if (ExciseCalculation == '') { - $('#ExciseDutyCalModel').modal('show'); - } - - }); - $('#txtVat').change(function() { - - /* if(VatCalculation == '') - { - $('#VatCalModel').modal('show'); - } - */ - - }); - $('#txtCST').change(function() { - - if (CSTCalculation == '') { - $('#CSTCalModel').modal('hide'); - } - - }); - $('#drpEditFreight').change(function() { - $('#txtEditFreight').val(''); - $('#txtEditAfterFreight').val(''); - var FreightType = $("#drpEditFreight").val(); - // selValue = $("#drpFreight").val() ; - - if (FreightType == "PER TRIP") { - - $('#EditTripsValue').show(); - } else { - - $('#EditTripsValue').hide(); - } - if (FreightType == PercentageType) { - var freightCalculation = ''; - $('#freightmodel').modal('show'); - $('#txtEditFreight').removeAttr('readonly', 'true'); - } else if (selValue == NilType) { - - $('#txtEditFreight').attr('readonly', 'true'); - $('#txtEditFreight').val('0.00'); - $('#txtEditAfterFreight').val('0.00'); - Editchange(); - } else { - $('#txtEditFreight').removeAttr('readonly', 'true'); - // $('#txtEditAfterFreight').val(''); - - - } - // selValue = $("#drpEditFreight").val() ; - - }); - //add // - $('#drpFreight').change(function() { - var FreightType = $("#drpFreight").val(); - - if (FreightType == "PER TRIP") { - - $('#TripsValue').show(); - } else { - - $('#TripsValue').hide(); - } - - selValue = $("#drpFreight").val(); - if (selValue == PercentageType) { - var freightCalculation = ''; - $('#freightmodel').modal('show'); - $('#txtFreight').removeAttr('readonly', 'true'); - } else if (selValue == NilType) { - - $('#txtFreight').attr('readonly', 'true'); - $('#txtFreight').val('0.00'); - $('#txtAfterFreight').val('0.00'); + $('#txtPackaging').attr('readonly', 'true'); + $('#txtPackaging').val('0.00'); + $('#txtAfterPackaging').val('0.00'); change(); } else { - $('#txtFreight').removeAttr('readonly', 'true'); - $('#txtFreight').val(''); - - + $('#txtPackaging').removeAttr('readonly', 'true'); } - change(); + } + //change(); + }); + $('#EditPackagingType').change(function () { + $('#txtEditPackaging').val(''); + $('#txtEditAfterPackaging').val(''); + selValue = $("#EditPackagingType").val(); + if (selValue == PercentageType) { + var PackagingCalculation = ''; + $('#packagingcalmodel').modal('show'); + $('#txtEditPackaging').removeAttr('readonly', 'true'); + } else { + if (selValue == NilType) { - }); + $('#txtEditPackaging').attr('readonly', 'true'); + $('#txtEditPackaging').val('0.00'); + $('#txtEditAfterPackaging').val('0.00'); + Editchange(); + } else { + $('#txtEditPackaging').removeAttr('readonly', 'true'); + } + } + //change(); + + }); + $('#txtExciseDuty').change(function () { + + if (ExciseCalculation == '') { + $('#ExciseDutyCalModel').modal('show'); + } + + }); + $('#txtVat').change(function () { + + /* if(VatCalculation == '') + { + $('#VatCalModel').modal('show'); + } + */ + + }); + $('#txtCST').change(function () { + + if (CSTCalculation == '') { + $('#CSTCalModel').modal('hide'); + } + + }); + $('#drpEditFreight').change(function () { + $('#txtEditFreight').val(''); + $('#txtEditAfterFreight').val(''); + var FreightType = $("#drpEditFreight").val(); + // selValue = $("#drpFreight").val() ; + + if (FreightType == "PER TRIP") { + + $('#EditTripsValue').show(); + } else { + + $('#EditTripsValue').hide(); + } + if (FreightType == PercentageType) { + var freightCalculation = ''; + $('#freightmodel').modal('show'); + $('#txtEditFreight').removeAttr('readonly', 'true'); + } else if (selValue == NilType) { + + $('#txtEditFreight').attr('readonly', 'true'); + $('#txtEditFreight').val('0.00'); + $('#txtEditAfterFreight').val('0.00'); + Editchange(); + } else { + $('#txtEditFreight').removeAttr('readonly', 'true'); + // $('#txtEditAfterFreight').val(''); + + + } + // selValue = $("#drpEditFreight").val() ; + + }); + //add // + $('#drpFreight').change(function () { + var FreightType = $("#drpFreight").val(); + + if (FreightType == "PER TRIP") { + + $('#TripsValue').show(); + } else { + + $('#TripsValue').hide(); + } + + selValue = $("#drpFreight").val(); + if (selValue == PercentageType) { + var freightCalculation = ''; + $('#freightmodel').modal('show'); + $('#txtFreight').removeAttr('readonly', 'true'); + } else if (selValue == NilType) { + + $('#txtFreight').attr('readonly', 'true'); + $('#txtFreight').val('0.00'); + $('#txtAfterFreight').val('0.00'); + change(); + } else { + $('#txtFreight').removeAttr('readonly', 'true'); + $('#txtFreight').val(''); + + + } + change(); + + }); }); /* @@ -1899,11 +1887,11 @@ if (!empty($INRSYMBOL)) { } } } - $(document).ready(function() { - $('#ServiceMaterialCode').change(function() { + $(document).ready(function () { + $('#ServiceMaterialCode').change(function () { var selectedMaterialCode = ''; selectedMaterialCode = $("#ServiceMaterialCode").val(); - $.each(JSON.parse(materialData), function(index, value) { + $.each(JSON.parse(materialData), function (index, value) { if (selectedMaterialCode == value.MaterialCode) { $("#ServiceDescription").val(value.MaterialName); $("#ServiceUOM").val(value.UOM); @@ -1928,7 +1916,7 @@ if (!empty($INRSYMBOL)) { supplierid: d, materialcode: selectedMaterialCode }, - success: function(response) { + success: function (response) { if (response) alert(response); } }); @@ -1937,12 +1925,13 @@ if (!empty($INRSYMBOL)) { let materialData; - $('#purpose').on('change', function() { + $('#purpose').on('change', function () { console.log("purpose first"); $('#POType').val(this.value); if (this.value == 'REVENUE') //Revenue po { + $("#potaxes").show(); $("#QualityChecked").show(); $("#revenuepotaxes").show(); $("#currencyexchange").hide(); @@ -1959,6 +1948,7 @@ if (!empty($INRSYMBOL)) { $('#typeOptions').html('Revenue Type Options'); } else if (this.value == 'SERVICE') // Service po { + $("#potaxes").show(); $("#QualityChecked").hide(); $("#servicepotaxes").show(); $("#Deliveryby").show(); @@ -1974,6 +1964,7 @@ if (!empty($INRSYMBOL)) { } else if (this.value == 'IMPORT') // Import po { + $("#potaxes").show(); $("#currencyexchange").show(); $("#revenuepotaxes").hide(); @@ -1982,6 +1973,7 @@ if (!empty($INRSYMBOL)) { $('#typeOptions').html('Import Type Options'); } else if (this.value == 'CAPITAL') // Capital po { + $("#potaxes").show(); $("#currencyexchange").show(); $("#revenuepotaxes").hide(); @@ -1990,6 +1982,7 @@ if (!empty($INRSYMBOL)) { $('#typeOptions').html('Capital Type Options'); } else // Default { + $("#potaxes").show(); $("#currencyexchange").hide(); $("#revenuepotaxes").hide(); @@ -2018,7 +2011,7 @@ if (!empty($INRSYMBOL)) { }, type: "POST", url: "emergencypurchaseorder/getMaterialCode", - success: function(data) { + success: function (data) { console.log("4444444444444444"); if (data) { @@ -2034,7 +2027,7 @@ if (!empty($INRSYMBOL)) { $('#ServiceMaterialCode').empty(); $("#ServiceMaterialCode").append($('').val("0").html("Select Item Code")); - $.each(JSON.parse(data), function(index, value) { + $.each(JSON.parse(data), function (index, value) { $("#ServiceMaterialCode").append($('').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName)); @@ -2045,7 +2038,7 @@ if (!empty($INRSYMBOL)) { $('#MaterialCode').empty(); $("#MaterialCode").append($('').val("0").html("Select Item Code")); - $.each(JSON.parse(data), function(index, value) { + $.each(JSON.parse(data), function (index, value) { $("#MaterialCode").append($('').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName)); @@ -2078,7 +2071,7 @@ if (!empty($INRSYMBOL)) { }, type: "POST", url: "serviceAvilBudgetAmount", - success: function(data) { + success: function (data) { if (data) { // $('#content').loader('hide'); $("#AvalBuget").val(data ? parseFloat(data).toFixed(2) : 0); @@ -2104,7 +2097,7 @@ if (!empty($INRSYMBOL)) { /** * getting item name and uom using global variable materialData each change in revenue */ - $('#MaterialCode').on('change', function() { + $('#MaterialCode').on('change', function () { console.log("111111111111"); // $('#MaterialCode').change(function() { @@ -2112,7 +2105,7 @@ if (!empty($INRSYMBOL)) { selectedRevenueMaterialCode = $("#MaterialCode").val(); console.log(materialData); console.log("materialData - 1111111"); - $.each(JSON.parse(materialData), function(index, value) { + $.each(JSON.parse(materialData), function (index, value) { if (selectedRevenueMaterialCode == value.MaterialCode) { $("#ItemName").val(value.MaterialName); $("#UOM").val(value.UOM); @@ -2128,7 +2121,7 @@ if (!empty($INRSYMBOL)) { supplierid: d, materialcode: selectedRevenueMaterialCode }, - success: function(response) { + success: function (response) { if (response) alert(response); } }); @@ -2175,7 +2168,7 @@ if (!empty($INRSYMBOL)) { //This function is used to add material list after delete - $.each(JSON.parse(materialData), function(index, value) { + $.each(JSON.parse(materialData), function (index, value) { if (value.MaterialCode == materialCode) { $("#MaterialCode").append($('').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName)); } @@ -2308,7 +2301,7 @@ if (!empty($INRSYMBOL)) { 'form-label-left CreatealterPO ', 'name' => 'CreatealterPO', 'id' => 'CreatealterPO'); + $attributes = array('class' => 'form-label-left CreatealterPO ', 'name' => 'CreatealterPO', 'id' => 'CreatealterPO'); echo form_open(base_url() . '/purchaseorder/addalterPO/', $attributes); ?>