ria/app/Views/editRevenueAmendPO.php

2709 lines
99 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php $ReqType = '';
$CompanyAddress = '';
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$CurrentDate = $dt->format('d-m-Y');
$MaxPoDate = '';
$AvlAmount = 0;
$DeliverSchedule = '';
$DeliverOption = '';
$RowCount = 0;
$PrePOFile = '';
$Reqon = '';
$RequesterName = '';
if (!empty($MaxPODate)) {
foreach ($MaxPODate as $date) {
$MaxPoDate = $date->PODate;
}
}
if (!empty($CompanyDetails)) {
foreach ($CompanyDetails as $Req) {
$CompanyAddress = $Req->Address;
}
}
if (!empty($AvlBudAmt)) {
$AvlAmount = $AvlBudAmt;
//echo $AvlAmount;
}
foreach ($PaymentTerms as $TER) {
$Terms = $TER->PaymentTerms;
}
$SupId = '';
$SupName = '';
$Address = '';
$PODate = '';
$Deliverydt = '';
$DeliveryAddress = '';
$POStatus = '';
$PONO = '';
$totBasicAmt = 0;
$totDiscountAmt = 0.0;
$totPackagingAmt = 0.0;
$totExciseAmt = 0.0;
$totVATAmt = 0.0; //FOR SGST
$totCSTAmt = 0.0; //FOR CGST
$totGSTAmt = 0.0; //FOR IGST
$totOtherTaxAmt = 0.0;
$totFreightAmt = 0.0;
$totInsuranceAmt = 0.0;
$totOrderSummaryAmt = 0.0;
$PaymentOtherDescription = '';
$ServiceDescription = '';
$taxrange = "";
$modeofshipment = '';
$supplierref = '';
$suppofferno = '';
$otherref = '';
$revenuesubtype = '';
$insurencestatus = '';
$insurenceno = '';
$BudgetType = '';
if (!empty($POMaster)) {
// print_r($POMaster);
// print_r($Payment);
// echo "****";
// print_r($PaymentTerms);
foreach ($POMaster as $Req) {
$SupId = $Req->SupplierID;
$SupName = $Req->SupplierName;
$Address = $Req->MSME ? "MSME : " . $Req->MSME . "\n" . $Req->Address : $Req->Address;
$Pdt = new DateTime($Req->PODate);
$PODate = $Pdt->format('d-m-Y');
$DeliverOption = $Req->DeliveryOption;
$DeliverSchedule = $Req->DeliverySchedule;
$Ddt = new DateTime($Req->DeliveryDate);
//echo $Req->DeliveryDate."<br>";
$Deliverydt = $Ddt->format('d-m-Y');
//echo $Deliverydt;
$PaymentOtherDescription = $Req->PaymentOtherDescription;
//echo $PaymentOtherDescription;
$DeliveryAddress = $Req->DeliveryAddress;
$POStatus = $Req->StatusName;
$PONO = $Req->PONO;
$taxrange = $Req->PORange;
//echo $taxrange . "t";
$ServiceDescription = $Req->ServiceDescription;
$modeofshipment = $Req->Mode_Of_Shipment;
$supplierref = $Req->Supplier_Reference;
$suppofferno = $Req->Supplier_Offer_No;
$otherref = $Req->Other_Reference;
$revenuesubtype = $Req->POSubType;
$insurencestatus = $Req->InsuranceStatus;
$insurenceno = $Req->InsuranceNumber;
$BudgetType = $Req->BudgetType;
$PrePOFile = $Req->POFile;
}
}
//echo $BudgetType;
if (!empty($RequistionDetails)) {
foreach ($RequistionDetails as $ReqDet) {
$Reqon = $ReqDet->ReqDate;
$Requestedby = $ReqDet->Requestedby;
//echo $ReqDet->FirstName . "3";die();
if ($Requestedby != '') {
$RequesterName = $ReqDet->FirstName;
}
$Status = $ReqDet->Status;
}
}
//echo $ServiceDescription;
foreach ($POSTATUS as $PST) {
$POStatus = $PST->StatusName;
}
if (!empty($INRSYMBOL)) {
foreach ($INRSYMBOL as $INRS) {
$INRSYM = $INRS->FontCode2000;
}
}
?>
<!-- Latest compiled and minified CSS -->
<style>
.modal {
overflow: auto !important;
}
.text-right {
text-align: right !important;
}
.text-center {
text-align: center !important;
}
</style>
<script src="<?php echo base_url() ?>public/assets/tinymce/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false,
//plugins: "link image"
});
tinymce.init({
selector: "textarea#Edit_Service_Description",
menubar: false,
statusbar: false,
toolbar: false,
//plugins: "link image"
});
</script>
<script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript"></script>
<script type="text/javascript">
var DelOpt = '<?php echo $DeliverOption; ?>';
var SchName = '<?php echo $DeliverSchedule; ?>';
var others = '<?php echo $PaymentOtherDescription; ?>';
var DelDt = '<?php echo $Deliverydt; ?>';
var insurancestatus = '<?php echo $insurencestatus; ?>';
var InsuranceNumber = '<?php echo $insurenceno; ?>';
$(document).ready(function () {
// $('#RequistionNo').attr("style", "pointer-events: none;");
$('#drpSupplier').attr("style", "pointer-events: none;");
$('#PoTypeOptions').attr("style", "pointer-events: none;");
$('#insurancestatus').attr("style", "pointer-events: none;");
$('#InsuranceNumber').attr("style", "pointer-events: none;");
if (DelOpt == "0") {
$('#Deliverydtdiv').show();
$('#Schedulediv').hide();
$('#Deliverydt').val(DelDt);
} else if (DelOpt == "1") {
$('#Deliverydtdiv').hide();
$('#Schedulediv').show();
$('#Deliverydt').val('');
$('#Scheduleby').val(SchName);
}
if ($('#PaymentTerms').val() == 'PT08') {
$('#otheroptiondiv').show();
$('#Otherpayment').val(others);
}
if (insurancestatus == 1) {
$('#insurancestatus').val(insurancestatus);
$("#InsuranceNumberdiv").show();
$('#InsuranceNumber').val(InsuranceNumber);
} else {
$('#insurancestatus').val(insurancestatus);
$('#InsuranceNumber').val("");
$("#InsuranceNumberdiv").hide();
}
});
</script>
<script>
var NilType = '<?php echo NILTYPE; ?>';
var PercentageType = '<?php echo PERCENTAGE; ?>';
var POMaxDate = '<?php echo $MaxPoDate; ?>';
var PackagingCalculation = '';
var FreightCalculation = '';
var ExciseCalculation = '';
var StateTaxCheck = '';
var VatCalculation = ''; //FOR SGST
var RequistQuantity = '';
var IsEdit = '0';
var d = new Date(POMaxDate);
var SelectedMaterialCode = [];
var CollIndex = 0;
var SelectedMaterialList = {
Mat: []
};
// alert(new Date(year,month,day));
$(function () {
$("#PODate").datepicker({
minDate: d,
maxDate: 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
$("#Deliverydt").datepicker({
minDate: 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '0:+10'
});
/* $("#Requeston").datepicker({
//minDate : d,
maxDate : 'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
}); */
$('#drpSupplier').change(function () {
var cd = $("#drpSupplier option:selected").text();
//alert(cd);
$("#changeSup").val(cd);
var id = $('#drpSupplier').val();
$("#SupAddress").val('');
if (id != '0') {
var y = <?php echo json_encode($Suplist, JSON_PRETTY_PRINT) ?>;
$.each(y, function (idx, obj) {
if (obj.SupplierID === id) {
if (obj.MSME) {
$("#SupAddress").val("MSME : " + obj.MSME + "\n" + obj.Address);
} else {
$("#SupAddress").val(obj.Address);
}
}
});
} else {
alert('Please select the SupplierID');
return false;
}
});
$('#EditDiscountType').change(function () {
selValue = $("#EditDiscountType").val();
$('#txtEditDiscount').val('');
$('#txtEditAfterDiscount').val('');
if (selValue == NilType) {
$('#txtEditDiscount').attr('readonly', 'true');
$('#txtEditDiscount').val('0.00');
$('#txtEditAfterDiscount').val('0.00');
} else {
$('#txtEditDiscount').removeAttr('readonly', 'true');
$('#txtEditDiscount').val('');
$('#txtEditAfterDiscount').val('');
}
calculateDiscount();
});
$('#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');
} else {
$('#txtEditPackaging').removeAttr('readonly', 'true');
}
}
calculatePackaging();
});
$('#drpEditFreight').change(function () {
var FreightType = $("#drpEditFreight").val();
if (FreightType == "PER TRIP") {
$('#EditTripsValue').show();
} else {
$('#EditTripsValue').hide();
}
selValue = $("#drpEditFreight").val();
$('#txtEditFreight').val('');
$('#txtEditAfterFreight').val('');
if (selValue == PercentageType) {
var PackagingCalculation = '';
$('#freightmodel').modal('show');
$('#freightmodel').modal({
backdrop: true,
keyboard: true
});
$('#txtEditFreight').removeAttr('readonly', 'true');
} else if (selValue == NilType) {
$('#txtEditFreight').attr('readonly', 'true');
$('#txtEditFreight').val('0.00');
} else {
$('#txtEditFreight').removeAttr('readonly', 'true');
$('#txtEditFreight').val('');
}
calculateFreight();
});
});
/*
* To calcuate the Discount */
function calculateDiscount() {
if ($('#EditRate').val() == '') {
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
if ($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0") {
var basicValue = parseFloat($('#txtEditBasicValue').val());
var DiscountType = $("#EditDiscountType").val();
/* if(DiscountType == "0")
{
alert('Please Select the discount Type');
$('#txtEditDiscount').val('');
$("#EditDiscountType").focus();
}
else */
if ($('#txtEditDiscount').val() != '' && $('#txtEditDiscount').val() != '0') {
var AfterDiscount = 0.0;
var Discountval = parseFloat($('#txtEditDiscount').val());
if (DiscountType == PercentageType) {
AfterDiscount = <?php echo DIS_PERCENTAGE; ?>;
} else if (DiscountType == NilType) {
AfterDiscount = "0.00";
} else {
AfterDiscount = <?php echo DIS_LUMPSUM; ?>;
}
var discount = parseFloat(AfterDiscount).toFixed(2);
$('#txtEditAfterDiscount').val(discount);
calculateVat();
} else {
$('#txtEditAfterDiscount').val("0.00");
}
}
calculateEditTotalValue();
}
function SetVatorCST() {
StateTaxCheck = $("input:radio[name='Range']:checked").val();
$('#txtPoRange').val(StateTaxCheck);
//alert(StateTaxCheck);
//alert('Radio clicke:'+StateTaxCheck);
if (StateTaxCheck == "0") {
//alert("local");
// style="display:none;"
$('#Vat').removeAttr("style");
$('#TotSCST').removeAttr("style");
$('#CST').attr("style", "display:none;");
$('#TotICST').attr("style", "display:none;");
$('#IGSTEditModel').attr("style", "display:none;");
$('#SGSTEditModel').removeAttr("style");
$('#IGSTViewModel').attr("style", "display:none;");
$('#SGSTViewModel').removeAttr("style");
$('#CGSTArea').attr("style", "display:flex;");
$('#IGSTAddModel').attr("style", "display:none;");
$('#SGSTAddModel').removeAttr("style");
$('#CGSTshow').attr("style", "display:block;");
} else {
// alert("111");
$('#CST').removeAttr("style");
$('#TotICST').removeAttr("style");
$('#SGSTShow').attr("style", "display:none;");
$('#IGSTShow').attr("style", "display:block;");
$('#CGSTshow').attr("style", "display:none;");
$('#TotSCST').attr("style", "display:none;");
$('#IGSTEditModel').removeAttr("style");
$('#SGSTModel').attr("style", "display:none;");
$('#IGSTViewModel').removeAttr("style");
$('#IGSTModel').attr("style", "display:block;");
$('#IGSTAddModel').removeAttr("style");
$('#CGSTArea').attr("style", "display:none;");
}
}
/*
* To calcuate the Packaging */
function calculatePackaging() {
if ($('#EditRate').val() == '') {
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
} else {
var basicValue = parseFloat($('#txtEditBasicValue').val());
var PackagingType = $("#EditPackagingType").val();
/* if(PackagingType == "0")
{
alert('Please select the Packaging Type');
$('#txtEditPackaging').val('');
$("#EditPackagingType").focus();
}
else */
if ($('#txtEditPackaging').val() != '' && $('#txtEditPackaging').val() != '0') {
var Packagingvalue = parseFloat($('#txtEditPackaging').val());
var AfterPackaging = 0.0;
if (PackagingType == PercentageType) {
if (PackagingCalculation != 0 && $('#txtEditAfterDiscount').val() == '') {
alert('Please Enter the Discount value');
$('#EditDiscountType').focus();
$('#txtEditPackaging').val('');
return false;
} else {
var AfterDiscount = parseFloat($('#txtEditAfterDiscount').val());
AfterPackaging = PackagingCalculation == 0 ? <?php echo PACKAGING_PERCENTAGE_BYBASICVALUE; ?> : <?php echo PACKAGING_PERCENTAGE_BYDISCOUNTVALUE; ?>;
}
} else if (PackagingType == NilType) {
AfterPackaging = "0.00";
} else {
AfterPackaging = PackagingCalculation == 0 ? <?php echo PACKAGING_LUMPSUM_BYBASICVALUE; ?> : <?php echo PACKAGING_LUMPSUM_BYDISCOUNTVALUE; ?>;
}
var Packaging = parseFloat(AfterPackaging).toFixed(2);
$('#txtEditAfterPackaging').val(Packaging);
calculateVat();
} else {
$('#txtEditAfterPackaging').val("0.00");
}
}
calculateEditTotalValue();
}
function calculateVat() //SGST
{
//alert();
if ($('#EditRate').val() == '') {
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
} else {
var basicValue = parseFloat($('#txtEditBasicValue').val());
var discount = parseFloat($('#txtEditAfterDiscount').val());
basicValue = basicValue - discount;
//alert(basicValue);
// alert("Final"+basicValue);
//var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val());
var AfterVat = 0.0;
// if(VatCalculation != 0 && $('#txtEditVat').val() != '' )
// {
// if($('#txtEditAfterExciseDuty').val() == '')
// {
// alert('Please Enter the Excise value');
// $('#txtEditAfterExciseDuty').focus();
// $('#txtEditVat').val('');
// return false;
// }
// else
// {
// var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val());
// vatValue = parseFloat($('#txtEditVat').val());
// AfterVat = <?php echo VAT_ONEXICSEVALUE; ?>;
// var Vatval = parseFloat(AfterVat).toFixed(2);
// $('#txtEditAfterVat').val(Vatval);
// }
// }
if ($('#txtEditVat').val() != '') {
var vatValue = parseFloat($('#txtEditVat').val()).toFixed(2);
var basicValue2 = parseFloat($('#txtEditBasicValue').val());
var discount = parseFloat($('#txtEditAfterDiscount').val());
basicValue1 = basicValue2 - discount;
//alert(basicValue1);
var packaging = parseFloat($('#txtEditAfterPackaging').val());
var freight = parseFloat($('#txtEditAfterFreight').val());
var packfreight = parseFloat(packaging) + parseFloat(freight);
//alert(packfreight);
basicValue = parseFloat(basicValue1 + packfreight);
//alert(vatValue);
$('#txtEditGST').val(parseFloat(vatValue).toFixed(2));
//$('#txtEditOtherTax').val(0.00);
AfterVat = <?php echo VAT_ONBASICVALUE; ?>;
Vatval = parseFloat(AfterVat).toFixed(2);
$('#txtEditAfterVat').val(Vatval);
} else {
$('#txtEditAfterVat').val("0.00");
}
calculateGST();
calculateOtherTaxes();
calculateEditTotalValue();
}
}
function calculateGST() //CGST
{
if ($('#EditRate').val() == '') {
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
} else {
var basicValue1 = parseFloat($('#txtEditBasicValue').val());
var discount = parseFloat($('#txtEditAfterDiscount').val());
basicValue2 = basicValue1 - discount;
if ($('#txtEditGST').val() != "0" && $('#txtEditGST').val() != '') {
var GSTValue = parseFloat($('#txtEditGST').val());
var packaging = parseFloat($('#txtEditAfterPackaging').val());
var freight = parseFloat($('#txtEditAfterFreight').val());
var packfreight = parseFloat(packaging) + parseFloat(freight);
basicValue = parseFloat(basicValue2 + packfreight);
var AfterGST = 0.0;
AfterGST = <?php echo GSTTAX; ?>;
var GSTval = parseFloat(AfterGST).toFixed(2);
$('#txtEditAfterGST').val(GSTval);
} else {
$('#txtEditAfterGST').val("0.00");
}
}
calculateEditTotalValue();
}
function calculateOtherTaxes() //IGST
{
if ($('#EditRate').val() == '') {
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
} else {
var basicValue = parseFloat($('#txtEditBasicValue').val());
//alert("basic only "+basicValue);
var discount = parseFloat($('#txtEditAfterDiscount').val());
basicValue = basicValue - discount;
//alert("with discount "+basicValue);
var packaging = parseFloat($('#txtEditAfterPackaging').val());
var freight = parseFloat($('#txtEditAfterFreight').val());
var packfreight = parseFloat(packaging) + parseFloat(freight);
basicValue = parseFloat(basicValue + packfreight);
//alert("with packfreight "+basicValue);
if ($('#txtEditOtherTax').val() != "0" && $('#txtEditOtherTax').val() != '') {
// $('#txtEditGST').val(0.00);
// $('#txtEditVat').val(0.00);
// $('#txtEditAfterVat').val(0.00);
// $('#txtEditAfterGST').val(0.00);
var OtherTaxValue = parseFloat($('#txtEditOtherTax').val());
var AfterOtherTaxes = 0.0;
AfterOtherTaxes = <?php echo OTHERTAX; ?>;
var Otherval = parseFloat(AfterOtherTaxes).toFixed(2);
$('#txtEditAfterOtherTax').val(Otherval);
} else {
$('#txtEditAfterOtherTax').val("0.00");
}
//calculateVat();
//calculateGST();
calculateEditTotalValue();
}
}
function calculateFreight() {
if ($('#EditRate').val() == '') {
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
} else {
var basicValue = parseFloat($('#txtEditBasicValue').val());
var FreightType = $("#drpEditFreight").val();
/* if(FreightType == "0")
{
alert('Please select Freight Type');
$('#txtEditFreight').val('');
$("#drpEditFreight").focus();
}
else */
if ($('#txtEditFreight').val() != "0" && $('#txtEditFreight').val() != '') {
var FreightValue = parseFloat($('#txtEditFreight').val());
var UOM = parseFloat($('#EditUOM').val());
var Quantity = parseFloat($('#EditQuantity').val());
var AfterFreight = 0.0;
if (FreightType == PercentageType) {
if (FreightCalculation != 0 && $('#txtEditAfterDiscount').val() == '') {
//alert(FreightType);
alert('Please Enter the Discount value');
$('#EditDiscountType').focus();
$('#txtEditFreight').val('');
return false;
} else {
var AfterDiscount = parseFloat($('#txtEditAfterDiscount').val());
//alert((FreightValue/100) * (basicValue-AfterDiscount));
//alert(((FreightValue/100) * basicValue));
//alert(FreightCalculation);
if (FreightCalculation == 0) {
AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
} else {
AfterFreight = <?php echo FREIGHT_PERCENTAGE_AFTER; ?>;
}
//AfterFreight = FreightCalculation == 0 ? <?php echo FREIGHT_PERCENTAGE; ?> : <?php echo FREIGHT_PERCENTAGE_AFTER; ?> ;
}
}
// if(FreightType == PercentageType)
// {
// AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
// }
else if (FreightType == NilType) {
AfterFreight = 0.0;
} else if (FreightType == '<?php echo LUMPSUM; ?>') {
AfterFreight = <?php echo FREIGHT_LUMPSUM; ?>;
} else if (FreightType == '<?php echo PERUOM; ?>') {
AfterFreight = <?php echo FREIGHT_PERUOM; ?>;
} else if (FreightType == '<?php echo PERTRIP; ?>') {
var nooftrips = $('#EditNOOfTrips').val();
var freightrate = $('#txtEditFreight').val();
if ((nooftrips == '') || (txtEditFreight == '')) {
alert("Please Enter Number of Trips or Freight Rate!");
$('#EditNOOfTrips').val(0.0);
$('#txtEditFreight').val(0.0);
$('#txtEditAfterFreight').val(0.0);
} else {
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
var nooftrips = $('#EditNOOfTrips').val();
if ((nooftrips != '') || (txtEditFreight == '')) {
AfterFreight = AfterFreight * nooftrips;
}
}
} else {
AfterFreight = $('#txtEditFreight').val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#txtEditAfterFreight').val(AfterFreightval);
calculateVat();
} else {
$('#txtEditAfterFreight').val("0.00");
}
}
calculateEditTotalValue();
}
/* Set the Packaging calculation option for calculating Packaging */
function SetPackagingOption() {
PackagingCalculation = $("input:radio[name='optPackaging']:checked").val();
// alert(PackagingCalculation);
$('#packagingcalmodel').modal('hide');
calculatePackaging();
}
function SetFreightOption() {
FreightCalculation = $("input:radio[name='optfreight']:checked").val();
// alert("this is value taken as before after radio value"+FreightCalculation);
$('#freightmodel').modal('hide');
// $('#EDITREVENUE').modal('show');
calculateFreight();
}
function SetVatCalculation() {
//VatCalculation = $("input:radio[name='optVat']:checked").val();
//$('#VatCalModel').modal('hide');
calculateVat();
}
function Editchange() {
//ExceedEditQuantityCheck();
if (($('#EditQuantity').val() != '' || $('#EditQuantity').val() != 0) && ($('#EditRate').val() != '' || $('#EditRate').val() != 0)) {
var txtQuantity = parseFloat($('#EditQuantity').val());
var txtUnitPrice = parseFloat($('#EditRate').val());
var Tot = txtQuantity * txtUnitPrice
$('#txtEditBasicValue').val(Tot);
calculateDiscount();
calculatePackaging();
calculateFreight();
// calculateExcise();
calculateVat();
// calculateCST();
calculateGST();
calculateOtherTaxes(); //this is for igst
calculateEditTotalValue($('#isEdit').val());
}
}
function validateEditExceedLimit() {
var avalbudAmt = parseFloat($('#EditAvlBudAmt').val());
var basicAmountRate = parseFloat($('#txtEditBasicValue').val());
//alert(basicAmountRate);
var discount = parseFloat($('#txtEditAfterDiscount').val());
basicAmountRate = basicAmountRate - discount;
//alert(basicAmountRate+'-'+avalbudAmt+'-'+discount);
// if(basicAmountRate > avalbudAmt)// || totalAmount > avalbudAmt)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#EditRate').focus();
// return false;
// }
// else
// {
return true;
//}
}
function calculateEditTotalValue() {
var Packaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val();
var Vat = $('#txtEditAfterVat').val() == '' ? '0.00' : $('#txtEditAfterVat').val(); //SGST
var GST = $('#txtEditAfterGST').val() == '' ? '0.00' : $('#txtEditAfterGST').val(); //CGST
var OtherTax = $('#txtEditAfterOtherTax').val() == '' ? '0.00' : $('#txtEditAfterOtherTax').val(); //IGST
var Freight = $('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val();
var Insurance = $('#txtEditInsurance').val() == '' ? '0.00' : $('#txtEditInsurance').val();
var Discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val();
var BasicVal = $('#txtEditBasicValue').val() == '' ? '0.00' : $('#txtEditBasicValue').val();
var totvalue = (parseFloat(BasicVal) + parseFloat(Packaging) + parseFloat(Vat) + parseFloat(GST) + parseFloat(OtherTax) + parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount);
var tot = parseFloat(totvalue).toFixed(2);
$('#txtEditTotalOrderValue').val(tot);
// validateEditExceedLimit();
}
function calculateEditTaxValue() {
var Packaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val();
var Vat = $('#txtEditAfterVat').val() == '' ? '0.00' : $('#txtEditAfterVat').val(); //SGST
var GST = $('#txtEditAfterGST').val() == '' ? '0.00' : $('#txtEditAfterGST').val(); //CGST
var OtherTax = $('#txtEditAfterOtherTax').val() == '' ? '0.00' : $('#txtEditAfterOtherTax').val(); //IGST
var Freight = $('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val();
var Insurance = $('#txtEditInsurance').val() == '' ? '0.00' : $('#txtEditInsurance').val();
var Discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val();
var totvalue = parseFloat(Vat) + parseFloat(GST) + parseFloat(OtherTax); //VAT => SGST,GST => CGST, OtherTax => IGST
var tot = parseFloat(totvalue).toFixed(2);
//alert('tot:'+tot);
return tot;
}
$(document).ready(function () {
$("#PaymentTerms").select2();
$('#Date').click(function () {
//for Date range selection
$('#Schedulediv').hide();
$('#Deliverydtdiv').show();
});
$('#Schedule').click(function () {
//for schedule range selection
$('#Deliverydtdiv').hide();
$('#Schedulediv').show();
});
SetVatorCST();
});
$(document).ready(function () {
$('#Local').click(function () {
//for Date range selection
$('#IGSTShow').hide();
$('#SGSTShow').show();
$('#SGSTModel').show(); // SGST Fields in Modal Show
$('#IGSTModel').hide(); // IGST Fields in Modal Hide
});
$('#Inter_state').click(function () {
//for schedule range selection
$('#SGSTShow').hide();
$('#IGSTShow').show();
$('#IGSTModel').show(); // IGST Fields in Modal Show
$('#SGSTModel').hide(); // SGST Fields in Modal Hide
});
});
</script>
<style>
.pagination {
margin: 0px ! important;
}
.box-body {
padding: 0px ! important;
}
.num {
text-align: right;
}
.btn-container .btn {
margin-left: 10px;
}
.header-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 25px;
}
.header-container h2 {
flex: 1;
text-align: center;
margin: 0;
}
.centered {
display: flex;
/* justify-content: center; */
align-items: center;
height: 10vh;
}
.centered label,
.centered input {
margin: 0 5px;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4><?= "Amendment Revenue Purchase Order - $PONO "; ?></h4>
<a href="<?php echo base_url() ?>amendmentpurchaseorder" class="btn btn-secondary" id="back"
value="Back">Back</a>
</div>
</div>
</div>
<!-- end page title -->
<!-- Form row -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<?php
$attributes = array('class' => 'form-label-left CreatePO ', 'name' => 'CreatePO', 'id' => 'CreatePO');
echo form_open(base_url() . '/purchaseorder/addPO/', $attributes);
?>
<div class="form-row">
<div class="form-group col-md-3">
<label>Requistion No</label>
<?php
$options = array("0" => 'Selected Requisition Numbers');
if (!empty($ReqList)) {
foreach ($ReqList as $SID):
$options[$SID->ReqNo] = $SID->ReqNo;
//$ReqType = $SID->ReqType;
endforeach;
}
echo form_multiselect('RequistionNo', $options, set_value('RequistionNo', array()), 'id="RequistionNo"', 'required="true"', 'height="400px"');
?>
</div>
<div class="form-group col-md-3">
<label>Purchase Order Type</label>
<?php
$data = array('name' => 'POType', 'value' => set_value('POType', REVENUE), 'id' => 'POType', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Select Supplier<span class="text-danger">*</span></label>
<?php
$options = array("0" => 'Select Supplier');
//print_r( $options);
if (!empty($Suplist)) {
foreach ($Suplist as $SID):
$options[$SID->SupplierID] = $SID->SupplierID . ' - ' . $SID->SupplierName;
endforeach;
}
echo form_dropdown('drpSupplier', $options, set_value('drpSupplier', $SupId), 'id="drpSupplier" required="true" class="form-control select2" readonly');
?>
</div>
<div class="form-group col-md-3">
<label>Supplier Address</label>
<div>
<?php
$data = array('name' => 'SupAddress', 'value' => set_value('SupAddress', $Address), 'id' => 'SupAddress', 'class' => 'form-control', 'readonly' => 'true', 'rows' => '3', 'cols' => '40');
echo Form_textarea($data);
?>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<div id="div1" style="display:block;">
<b><u>Select Tax Range</u></b><br />
<div class="centered">
<?php echo form_label('Local', 'Local') . "&nbsp;&nbsp;" . form_radio(array("name" => "Range", "id" => "Local", "value" => "0", 'checked' => ('0' == $taxrange) ? TRUE : FALSE, 'onchange' => 'SetVatorCST();')); ?>&nbsp;&nbsp;
<?php echo form_label('Inter state', 'Inter state') . "&nbsp;&nbsp;" . form_radio(array("name" => "Range", "id" => "Inter_state", "value" => "1", 'checked' => ('1' == $taxrange) ? TRUE : FALSE, 'onchange' => 'SetVatorCST();')); ?>
</div>
</div>
</div>
<div class="form-group col-md-3">
<b><u>Select Delivery By<span class="text-danger">*</span></u></b><br />
<input type="hidden" name="beforeDelivery" value="<?php echo $DeliverOption; ?>">
<div class="centered">
<?php echo form_label('Date', 'Date') . "&nbsp;&nbsp;" . form_radio(array('name' => 'DateRange', 'value' => '0', 'checked' => ('0' == $DeliverOption) ? TRUE : FALSE, 'id' => 'Date')); ?>
<?php echo form_label('Schedule', 'Schedule') . form_radio(array('name' => 'DateRange', 'value' => '1', 'checked' => ('1' == $DeliverOption) ? TRUE : FALSE, 'id' => 'Schedule')); ?>
</div>
</div>
<div class="form-group col-md-3" id="Deliverydtdiv">
<?php if ($DeliverOption == 1) {
$Deliverydt = null;
}
?>
<input type="hidden" name="beforeDeliverydt" value="<?php echo $Deliverydt; ?>">
<label>Delivery Date<span class="text-danger">*</span></label>
<div>
<?php
$data = array('name' => 'Deliverydt', 'value' => set_value('Deliverydt', $Deliverydt), 'id' => 'Deliverydt', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;', 'min' => date('d-m-Y'), );
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3" id="Schedulediv" style="display:none;">
<input type="hidden" name="beforeScheduleby"
value="<?php echo $DeliverSchedule; ?>">
<label>Schedule By<span class="text-danger">*</span></label>
<?php
$data = array('name' => 'Scheduleby', 'value' => set_value('Scheduleby', $DeliverSchedule), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110');
echo Form_textarea($data);
?>
</div>
<div class="form-group col-md-3">
<label>Delivery Address</label>
<div>
<?php
$data = array('name' => 'DeliveryAddr', 'value' => set_value('DeliveryAddr', $DeliveryAddress), 'id' => 'DeliveryAddr', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'readonly' => 'true');
echo Form_textarea($data);
?> <input type="hidden" name="txtDeliveryAddress" id="txtDeliveryAddress"
value="<?php echo $DeliveryAddress; ?>">
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Purchase Order Date</label>
<?php
$data = array('name' => 'PODate', 'value' => set_value('PODate', $PODate), 'id' => 'PODate', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Mode Of Shipment</label>
<div>
<?php
$data = array('name' => 'addmodeofshipment', 'value' => set_value('addmodeofshipment', $modeofshipment), 'id' => 'addmodeofshipment', 'class' => 'form-control', 'readonly' => 'readonly');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Contact Reference</label>
<div>
<?php
$data = array('name' => 'amendsupplierreference', 'value' => set_value('amendsupplierreference', $supplierref), 'id' => 'amendsupplierreference', 'class' => 'form-control', 'readonly' => 'readonly', 'maxlength' => '40');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Supplier's Offer No</label>
<div>
<?php
$data = array('name' => 'amendsupplierofferno', 'value' => set_value('amendsupplierofferno', $suppofferno), 'id' => 'amendsupplierofferno', 'class' => 'form-control', 'readonly' => 'readonly');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Other Reference(S)</label>
<div>
<?php
$data = array('name' => 'amendotherreference', 'value' => set_value('amendotherreference', $otherref), 'id' => 'amendotherreference', 'class' => 'form-control', 'readonly' => 'readonly');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Revenue Type Options<span class="text-danger">*</span></label>
<div>
<?php
//$optionsWork = array("0"=>'Select Work Status');
if (!empty($PoTypeOptions)) {
foreach ($PoTypeOptions as $POpt):
$optionsPO[$POpt->ConfigValue] = $POpt->ConfigValue;
endforeach;
}
// $revenuesubtype
echo form_dropdown('PoTypeOptions', $optionsPO, set_value('PoTypeOptions'), 'id="PoTypeOptions" required="true" class="form-control select2"');
?>
</div>
</div>
<div class="form-group col-md-3">
<label for="payablefrom">Payable Terms<span class="text-danger">*</span></label>
<input type="hidden" name="beforePaymentTerms" value="<?php echo $Terms; ?>">
<?php
if (!empty($Payment)) {
foreach ($Payment as $pay2)
if ($Terms == $pay2->PaymentID) {
//echo "$Terms";
//echo "$pay2->PaymentTerms";
?>
<input type="hidden" name="beforePaymentTermsText"
value="<?php echo $pay2->PaymentTerms ?>">
<?php
$optionsPay[$pay2->PaymentID] = $pay2->PaymentTerms;
}
foreach ($Payment as $pay1):
if ($Terms != $pay1->PaymentID) {
$optionsPay[$pay1->PaymentID] = $pay1->PaymentTerms;
}
endforeach;
}
echo form_dropdown('PaymentTerms', $optionsPay, set_value('PaymentTerms'), 'id="PaymentTerms" required="true" class="form-control select2"');
?>
</div>
<div class="form-group col-md-3" id="otheroptiondiv" style="display:none;">
<label>Description of Payable Terms<span class="text-danger">*</span></label>
<?php
$data = array('name' => 'Otherpayment', 'Otherpayment' => set_value('Otherpayment'), 'id' => 'Otherpayment', 'class' => 'form-control', 'required' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="insurance">Insurance<span class="text-danger">*</span></label>
<?php
$optionsnew = array('1' => 'Yes', '0' => 'No');
echo form_dropdown('insurancestatus', $optionsnew, set_value('insurancestatus'), 'id="insurancestatus" required="true" class="form-control select2"');
?>
</div>
<div class="form-group col-md-3" id="InsuranceNumberdiv" style="display:block;">
<label>Insurance No / Insurance Details<span class="text-danger">*</span></label>
<div>
<?php
$data = array('name' => 'InsuranceNumber', 'InsuranceNumber' => set_value('InsuranceNumber', $insurenceno), 'id' => 'InsuranceNumber', 'class' => 'form-control', 'required' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label for="BudgetType">Budget Type<span class="text-danger">*</span></label>
<select id='BudgetType' name='BudgetType' class="form-control">
<?php if ($BudgetType == 'CAPITAL') {
$opt1 = 'CAPITAL';
$opt2 = 'REVENUE';
} else {
$opt1 = 'REVENUE';
$opt2 = 'CAPITAL';
} ?>
<option value=<?php echo $opt1; ?>><?php echo $opt1; ?></option>
<option value=<?php echo $opt2; ?>><?php echo $opt2; ?></option>
</select>
</div>
<div class="form-group col-md-3">
</div>
</div>
<br>
<div class="form-row">
<div class="table-responsive">
<table id="revenueTax" class="table table-striped table-hover mb-0"
style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Name</th>
<th class="text-center">Quantity</th>
<th>UOM</th>
<th class="text-right">Rate<?php echo "($INRSYM)" ?></th>
<th class="text-right">Basic Amount<?php echo "($INRSYM)" ?></th>
<th class="text-right">Tax Amount<?php echo "($INRSYM)" ?></th>
<th class="text-right">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th>Action</th>
</tr>
</thead>
<tbody id='RevenueAppend'>
<?php
if (!empty($POItem)) {
$index = 0;
foreach ($POItem as $record) {
//print_r($POItem);
$index = $index + 1;
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialName ?></td>
<td align="center"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Rate ?></td>
<td align="right">
<?php echo number_format($record->BasicValue, 2, '.', '') ?></td>
<td align="right"><?php echo $record->Taxamount ?></td>
<td align="right"><?php echo $record->TotalValue ?></td>
<input type="hidden" name="<?php echo 'Reqnumber' . $index ?>"
id="<?php echo 'Reqnumber' . $index ?>"
value="<?php echo $record->ReqNo; ?>" />
<input type="hidden" name="<?php echo 'departmentName' . $index ?>"
id="<?php echo 'departmentName' . $index ?>"
value="<?php echo $record->DepartmentName; ?>" />
<input type="hidden" name="<?php echo 'AvlAmount' . $index ?>"
id="<?php echo 'AvlAmount' . $index ?>"
value="<?php echo $AvlAmount; ?>" />
<input type="hidden" name="<?php echo 'LineItemNo' . $index ?>"
id="<?php echo 'LineItemNo' . $index ?>"
value="<?php echo $record->LineItemNo; ?>" />
<input type="hidden" name="<?php echo 'costCode' . $index ?>"
id="<?php echo 'costCode' . $index ?>"
value="<?php echo $record->CostCenterCode; ?>" />
<input type="hidden" name="<?php echo 'materialCode' . $index ?>"
id="<?php echo 'materialCode' . $index ?>"
value="<?php echo $record->MaterialCode; ?>" />
<input type="hidden" name="<?php echo 'materialName' . $index ?>"
id="<?php echo 'materialName' . $index ?>"
value="<?php echo $record->MaterialName; ?>" />
<input type="hidden" name="<?php echo 'uom' . $index ?>"
id="<?php echo 'uom' . $index ?>"
value="<?php echo $record->UOM; ?>" />
<input type="hidden" name="<?php echo 'quantity' . $index ?>"
id="<?php echo 'quantity' . $index ?>"
value="<?php echo $record->Quantity; ?>" />
<input type="hidden" name="<?php echo 'itemRate' . $index ?>"
id="<?php echo 'itemRate' . $index ?>"
value="<?php echo $record->Rate; ?>" />
<input type="hidden" name="<?php echo 'per' . $index ?>"
id="<?php echo 'per' . $index ?>"
value="<?php echo $record->Per; ?>" />
<input type="hidden" name="<?php echo 'service_description' . $index ?>"
id="<?php echo 'service_description' . $index ?>"
value="<?php echo $record->ServiceMaterialDescription; ?>" />
<input type="hidden" name="<?php echo 'DisType' . $index ?>"
id="<?php echo 'DisType' . $index ?>"
value="<?php echo $record->DiscountType; ?>" />
<input type="hidden" name="<?php echo 'beforeDisType' . $index ?>"
id="<?php echo 'beforeDisType' . $index ?>"
value="<?php echo $record->DiscountType; ?>" />
<input type="hidden" name="<?php echo 'DisVal' . $index ?>"
id="<?php echo 'DisVal' . $index ?>"
value="<?php echo $record->DiscountValue; ?>" />
<input type="hidden" name="<?php echo 'beforeDisVal' . $index ?>"
id="<?php echo 'beforeDisVal' . $index ?>"
value="<?php echo $record->DiscountValue; ?>" />
<input type="hidden" name="<?php echo 'AfterDisVal' . $index ?>"
id="<?php echo 'AfterDisVal' . $index ?>"
value="<?php echo $record->AfterDiscount; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterDisVal' . $index ?>"
id="<?php echo 'beforeAfterDisVal' . $index ?>"
value="<?php echo $record->AfterDiscount; ?>" />
<input type="hidden" name="<?php echo 'PackOption' . $index ?>"
id="<?php echo 'PackOption' . $index ?>"
value="<?php echo $record->PackagingCalulatedOn; ?>" />
<input type="hidden" name="<?php echo 'PackType' . $index ?>"
id="<?php echo 'PackType' . $index ?>"
value="<?php echo $record->PackagingType; ?>" />
<input type="hidden" name="<?php echo 'beforePackType' . $index ?>"
id="<?php echo 'beforePackType' . $index ?>"
value="<?php echo $record->PackagingType; ?>" />
<input type="hidden" name="<?php echo 'PackVal' . $index ?>"
id="<?php echo 'PackVal' . $index ?>"
value="<?php echo $record->PackagingValue; ?>" />
<input type="hidden" name="<?php echo 'beforePackVal' . $index ?>"
id="<?php echo 'beforePackVal' . $index ?>"
value="<?php echo $record->PackagingValue; ?>" />
<input type="hidden" name="<?php echo 'AfterPackVal' . $index ?>"
id="<?php echo 'AfterPackVal' . $index ?>"
value="<?php echo $record->AfterPackagingValue; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterPackVal' . $index ?>"
id="<?php echo 'beforeAfterPackVal' . $index ?>"
value="<?php echo $record->AfterPackagingValue; ?>" />
<input type="hidden" name="<?php echo 'VatOption' . $index ?>"
id="<?php echo 'VatOption' . $index ?>"
value="<?php echo isset($record->VatCalulatedOn) ? $record->VatCalulatedOn : ''; ?>" />
<input type="hidden" name="<?php echo 'VatVal' . $index ?>"
id="<?php echo 'VatVal' . $index ?>"
value="<?php echo $record->SGST; ?>" /> <!-- SGST-->
<input type="hidden" name="<?php echo 'beforeVatVal' . $index ?>"
id="<?php echo 'beforeVatVal' . $index ?>"
value="<?php echo $record->SGST; ?>" /><!-- SGST-->
<input type="hidden" name="<?php echo 'AfterVatVal' . $index ?>"
id="<?php echo 'AfterVatVal' . $index ?>"
value="<?php echo $record->AfterSGST; ?>" /><!-- SGST-->
<input type="hidden" name="<?php echo 'beforeAfterVatVal' . $index ?>"
id="<?php echo 'beforeAfterVatVal' . $index ?>"
value="<?php echo $record->AfterSGST; ?>" /><!-- SGST-->
<input type="hidden" name="<?php echo 'GSTVal' . $index ?>"
id="<?php echo 'GSTVal' . $index ?>"
value="<?php echo $record->CGST; ?>" /><!-- CGST-->
<input type="hidden" name="<?php echo 'beforeGSTVal' . $index ?>"
id="<?php echo 'beforeGSTVal' . $index ?>"
value="<?php echo $record->CGST; ?>" /><!-- CGST-->
<input type="hidden" name="<?php echo 'AfterGSTVal' . $index ?>"
id="<?php echo 'AfterGSTVal' . $index ?>"
value="<?php echo $record->AfterCGST; ?>" /><!-- CGST-->
<input type="hidden" name="<?php echo 'beforeAfterGSTVal' . $index ?>"
id="<?php echo 'beforeAfterGSTVal' . $index ?>"
value="<?php echo $record->AfterCGST; ?>" /><!-- CGST-->
<input type="hidden" name="<?php echo 'OtherTaxVal' . $index ?>"
id="<?php echo 'OtherTaxVal' . $index ?>"
value="<?php echo $record->IGST; ?>" /><!-- IGST-->
<input type="hidden" name="<?php echo 'beforeOtherTaxVal' . $index ?>"
id="<?php echo 'beforeOtherTaxVal' . $index ?>"
value="<?php echo $record->IGST; ?>" /><!-- IGST-->
<input type="hidden" name="<?php echo 'AfterOtherTaxVal' . $index ?>"
id="<?php echo 'AfterOtherTaxVal' . $index ?>"
value="<?php echo $record->AfterIGST; ?>" /><!-- IGST-->
<input type="hidden"
name="<?php echo 'beforeAfterOtherTaxVal' . $index ?>"
id="<?php echo 'beforeAfterOtherTaxVal' . $index ?>"
value="<?php echo $record->AfterIGST; ?>" /><!-- IGST-->
<!-- <input type="hidden" name="<?php echo 'FreightOption' . $index ?>" id="<?php echo 'FreightOption' . $index ?>" value="<?php echo isset($record->FreightCalulatedOn) ? $record->FreightCalulatedOn : ''; ?>" /> -->
<input type="hidden" name="<?php echo 'FreightType' . $index ?>"
id="<?php echo 'FreightType' . $index ?>"
value="<?php echo $record->FreightType; ?>" />
<input type="hidden" name="<?php echo 'beforeFreightType' . $index ?>"
id="<?php echo 'beforeFreightType' . $index ?>"
value="<?php echo $record->FreightType; ?>" />
<input type="hidden" name="<?php echo 'FreightVal' . $index ?>"
id="<?php echo 'FreightVal' . $index ?>"
value="<?php echo $record->FreightValue; ?>" />
<input type="hidden" name="<?php echo 'beforeFreightVal' . $index ?>"
id="<?php echo 'beforeFreightVal' . $index ?>"
value="<?php echo $record->FreightValue; ?>" />
<input type="hidden" name="<?php echo 'AfterFreightVal' . $index ?>"
id="<?php echo 'AfterFreightVal' . $index ?>"
value="<?php echo $record->AfterFreightValue; ?>" />
<input type="hidden"
name="<?php echo 'beforeAfterFreightVal' . $index ?>"
id="<?php echo 'before-AfterFreightVal' . $index ?>"
value="<?php echo $record->AfterFreightValue; ?>" />
<input type="hidden" name="<?php echo 'Nooftrips' . $index ?>"
id="<?php echo 'Nooftrips' . $index ?>"
value="<?php echo $record->NoOfTrip; ?>" />
<input type="hidden" name="<?php echo 'beforeNooftrips' . $index ?>"
id="<?php echo 'beforeNooftrips' . $index ?>"
value="<?php echo $record->NoOfTrip; ?>" />
<input type="hidden" name="<?php echo 'basicval' . $index ?>"
id="<?php echo 'basicval' . $index ?>"
value="<?php echo $record->BasicValue; ?>" />
<input type="hidden" name="<?php echo 'Insval' . $index ?>"
id="<?php echo 'Insval' . $index ?>"
value="<?php echo $record->Insurance; ?>" />
<input type="hidden" name="<?php echo 'beforeInsval' . $index ?>"
id="<?php echo 'beforeInsval' . $index ?>"
value="<?php echo $record->Insurance; ?>" />
<input type="hidden" name="<?php echo 'TotalOrderValue' . $index ?>"
id="<?php echo 'TotalOrderValue' . $index ?>"
value="<?php echo $record->TotalValue; ?>" />
<input type="hidden" name="<?php echo 'beforeqty' . $index ?>"
id="<?php echo 'beforeqty' . $index ?>"
value="<?php echo $record->Quantity; ?>" />
<input type="hidden" name="<?php echo 'beforeitemRate' . $index ?>"
id="<?php echo 'beforeitemRate' . $index ?>"
value="<?php echo $record->Rate; ?>" />
<td> <a data-target='#EDITREVENUE' data-id="<?php echo $index; ?>"
data-userid="<?php echo $index; ?>" data-toggle="modal"
href="#EDITREVENUE"><i class="ri-pencil-fill"></i></a>
<!-- <td> <a data-toggle="tooltip" href="#"><i class="ri-pencil-fill" data-toggle="tooltip" title="<?php //echo $record->ReqNo;
?> - Click here to view Requistion details"></i>&nbsp;&nbsp;&nbsp;</a> </td> -->
</td>
</tr>
<?php
$totBasicAmt = $totBasicAmt + $record->BasicValue;
$totDiscountAmt = $totDiscountAmt + $record->AfterDiscount;
$totPackagingAmt = $totPackagingAmt + $record->AfterPackagingValue;
$totExciseAmt = isset($record->AfterExciseDuty) ? $totExciseAmt + $record->AfterExciseDuty : "";
$totVATAmt = $totVATAmt + $record->AfterSGST;
//$totCSTAmt = $totCSTAmt + $record->AfterCST;
$totGSTAmt = $totGSTAmt + $record->AfterCGST;
$totOtherTaxAmt = $totOtherTaxAmt + $record->AfterIGST;
$totFreightAmt = $totFreightAmt + $record->AfterFreightValue;
$totInsuranceAmt = $totInsuranceAmt + $record->Insurance;
$totOrderSummaryAmt = $totOrderSummaryAmt + $record->TotalValue;
}
?>
<?php
$RowCount = $index;
}
?>
</tbody>
</table>
</div>
</div>
<br>
<div class="form-row">
<div class="form-group col-md-3">
<label>Basic Amount <?php echo "($INRSYM)" ?> </label>
<?php
$data = array('name' => 'txtTotBasicAmount', 'value' => set_value('txtTotBasicAmount', number_format($totBasicAmt, 2, '.', '')), 'id' => 'txtTotBasicAmount', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Total Discount Amount <?php echo "($INRSYM)" ?> </label>
<?php
$data = array('name' => 'txtTotalDiscount', 'value' => set_value('txtTotalDiscount', number_format($totDiscountAmt, 2, '.', '')), 'id' => 'txtTotalDiscount', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" id="SGSTShow">
<label>Total SGST Amount <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtTotalVat', 'value' => set_value('txtTotalVat', number_format($totVATAmt, 2, '.', '')), 'id' => 'txtTotalVat', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" id="IGSTShow" style="display:none;">
<label>Total IGST Amount In INR </label>
<?php
$data = array('name' => 'txtTotalOtherTaxes', 'value' => set_value('txtTotalOtherTaxes', number_format($totOtherTaxAmt, 2, '.', '')), 'id' => 'txtTotalOtherTaxes', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" id="CGSTshow">
<label>Total CGST Amount <?php echo "($INRSYM)" ?> </label>
<?php
$data = array('name' => 'txtTotalGST', 'value' => set_value('txtTotalGST', number_format($totGSTAmt, 2, '.', '')), 'id' => 'txtTotalGST', 'readonly' => 'true', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => ' calculateGST(0);');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Total Packaging Amount <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtTotalPackaing', 'value' => set_value('txtTotalPackaing', number_format($totPackagingAmt, 2, '.', '')), 'id' => 'txtTotalPackaing', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Total Insurance Amount <?php echo "($INRSYM)" ?> </label>
<?php
$data = array('name' => 'txtTotalInsurance', 'value' => set_value('txtTotalInsurance', number_format($totInsuranceAmt, 2, '.', '')), 'id' => 'txtTotalInsurance', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Total Freight Amount <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtTotalFreight', 'value' => set_value('txtTotalFreight', number_format($totFreightAmt, 2, '.', '')), 'id' => 'txtTotalFreight', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Total Order Amount <?php echo "($INRSYM)" ?> </label>
<input type="hidden" name="preTotalOdervalue"
value="<?php echo $totOrderSummaryAmt; ?>">
<?php
$data = array('name' => 'txtTotalOrderValueSummary', 'value' => set_value('txtTotalOrderValueSummary', number_format($totOrderSummaryAmt, 2, '.', '')), 'id' => 'txtTotalOrderValueSummary', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction', 'id' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'rows' => '8', 'class' => 'form-control');
echo form_textarea($data);
?>
<input type="hidden" name="SpcialInstruction" id="SpcialInstruction" value=" ">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12" align="right"><br />
<div>
<input type="file" name="POFile" id="POFile">
<?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File"
href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously
uploaded - </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile"
value="<?php echo $PrePOFile; ?>" /><br>
</div>
<div class="btn-container" style="text-align: right;">
<input type="hidden" name="txtPoRange" id="txtPoRange" />
<input type="hidden" name="isEdit" id="isEdit" value="0" />
<input type="hidden" name="txtStatus" id="txtStatus" />
<input type="hidden" name="txtRowCount" id="txtRowCount"
value="<?php echo $RowCount; ?>" />
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<input type="hidden" name="txtPONO" id="txtPONO" value="<?php echo $PONO; ?>" />
<input type="button" class="btn btn-secondary" value="Cancel"
onClick="window.location ='amendmentpurchaseorder';">
<a class="btn btn-primary Save" onclick="Save(0)">&nbsp;&nbsp;<span
class="bold">Draft</span></a>
<a class="btn btn-success Save" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span
class="bold">Approve</span></a>
<!-- <input type="reset" class="btn btn-success" value = "OK"> -->
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<?php $Reqon = new DateTime($Reqon, new DateTimeZone('Asia/Kolkata'));
$Reqon = $Reqon->format('d-m-Y'); ?>
<label>Request On :</label><?php echo $Reqon; ?><br>
<?php if ($RequesterName != '' || $RequesterName != null) { ?>
<label>Request By : </label><?php echo $RequesterName; ?><br />
<?php } ?>
<label>Status : </label><?php
$statusMappings = [
'PO APPROVED' => 'AWAITING APPROVE',
'AWAITING RELEASE' => 'AWAITING APPROVE',
'RELEASER ONHOLD' => 'APPROVER ONHOLD',
'PO RELEASED' => 'PO APPROVED',
];
if (isset($POStatus) && !empty($POStatus)) {
if (isset($statusMappings[$POStatus])) {
echo $statusMappings[$POStatus];
} else {
echo $POStatus;
}
} else {
echo "Status not provided";
}
?>
</div>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<!-- Modal for Packing Calculation -->
<div id="packagingcalmodel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Packing Calculation On</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<form>
<div>
<input type="radio" name="optPackaging" checked="checked" value="0"
id="optPackagingBasicAmount">
<label for="optPackagingBasicAmount">Basic Amount</label>
</div>
<div>
<input type="radio" name="optPackaging" id="optPackagingAfterDiscountAmount" value="1">
<label for="optPackagingAfterDiscountAmount">After Discount Amount</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel">Cancel</a>
&nbsp;&nbsp;
<a class="btn btn-success" ID="PackagingOption" onclick="SetPackagingOption();">&nbsp;&nbsp;<span
class="bold">Ok</span></a>
</div>
</div>
</div>
</div><!-- /.modal -->
<!-- Modal for CST Calculation -->
<div id="CSTCalModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
style="display: none;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">CST Calculation On</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<form>
<div class="radio">
<label><input type="radio" name="optCST" checked="checked" value="0" id="optCST">Basic
Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optCST" value="1" id="optCST">Excise Duty</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success" ID="CSTOption" onclick="SetCSTCalculation();"
style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
</div>
</div>
</div>
</div><!-- /.modal -->
<div id="EDITREVENUE" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
style="display: none;">
<div class="modal-dialog modal-full-width" style="width:1060px !important ;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Edit Revenue Purchase Order Line Item</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<form>
<div class="modal-body p-4">
<div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Req No<span class="text-danger">*</span></label>
<div>
<?php
$data = array('name' => 'EditReqNo', 'value' => set_value('EditReqNo'), 'id' => 'EditReqNo', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Department Name</label>
<div>
<?php
$data = array('name' => 'EditdeptName', 'value' => set_value('EditdeptName'), 'id' => 'EditdeptName', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Cost Center Code</label>
<div>
<?php
$data = array('name' => 'EditCostCenter', 'value' => set_value('EditCostCenter'), 'id' => 'EditCostCenter', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Avl Bud Amt</label>
<div>
<?php
$data = array('name' => 'EditAvlBudAmt', 'value' => set_value('EditAvlBudAmt'), 'id' => 'EditAvlBudAmt', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Item Code<span class="text-danger">*</span></label>
<div>
<?php
$data = array('name' => 'EditMaterialCode', 'value' => set_value('EditMaterialCode'), 'id' => 'EditMaterialCode', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Item Name</label>
<div>
<?php
$data = array('name' => 'EditItemName', 'value' => set_value('EditItemName'), 'id' => 'EditItemName', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>UOM</label>
<div>
<?php
$data = array('name' => 'EditUOM', 'value' => set_value('EditUOM'), 'id' => 'EditUOM', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Quantity<span class="text-danger">*</span></label>
<div>
<?php
$data = array('name' => 'EditQuantity', 'value' => set_value('EditQuantity'), 'id' => 'EditQuantity', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Editchange()', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3"></div>
<div class="form-group col-md-3">
<label>Rate <?php echo "($INRSYM)" ?><span class="text-danger">*</span></label>
<div>
<?php
$data = array('name' => 'EditRate', 'value' => set_value('EditRate'), 'id' => 'EditRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Editchange()', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Per</label> <?php
$data = array('name' => 'EditAmendPer', 'value' => set_value('EditAmendPer'), 'id' => 'EditAmendPer', 'class' => 'form-control');
echo form_input($data); ?>
</div>
<div class="form-group col-md-3" style="padding-left: 0px;">
<label>Basic Amt <?php echo "($INRSYM)" ?></label>
<div>
<?php
$data = array('name' => 'txtEditBasicValue', 'value' => set_value('txtEditBasicValue'), 'id' => 'txtEditBasicValue', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3"></div>
<div class="form-group col-md-3">
<label>Discount Type </label>
<?php
$options = array("0" => 'Select Discount Type');
//print_r( $options);
if (!empty($TaxType)) {
foreach ($TaxType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('EditDiscountType', $options, set_value('EditDiscountType'), 'id="EditDiscountType" class="form-control"');
?>
</div>
<div class="form-group col-md-3">
<label>Discount Rate </label>
<?php
$data = array('name' => 'txtEditDiscount', 'value' => set_value('txtEditDiscount'), 'id' => 'txtEditDiscount', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateDiscount();', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Discounted Amt <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtEditAfterDiscount', 'value' => set_value('txtEditAfterDiscount'), 'id' => 'txtEditAfterDiscount', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3"></div>
<div class="form-group col-md-3">
<label>Freight Type </label>
<?php
$options = array("0" => 'Select Freight Type');
if (!empty($FreightType)) {
foreach ($FreightType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('drpEditFreight', $options, set_value('drpEditFreight'), 'id="drpEditFreight" class="form-control "');
?>
</div>
<div class="form-group col-md-3">
<label>Freight Rate </label>
<?php
$data = array('name' => 'txtEditFreight', 'value' => set_value('txtEditFreight'), 'id' => 'txtEditFreight', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateFreight();', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Freight Amt <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtEditAfterFreight', 'value' => set_value('txtEditAfterFreight'), 'id' => 'txtEditAfterFreight', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-9"></div>
<div class="form-group col-md-3" id="EditTripsValue" style="display:none;">
<label>NO Of Trips</label>
<?php
$data = array('name' => 'EditNOOfTrips', 'value' => set_value('EditNOOfTrips'), 'id' => 'EditNOOfTrips', 'class' => 'form-control num', 'onchange' => 'calculateFreight();');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" style="text-align:left;">
<div class="form-group col-md-3"></div>
<div class="form-group col-md-3">
<label>Packaging Type </label>
<div>
<?php
$options = array("0" => 'Select Packaging Type');
//print_r( $options);
if (!empty($TaxType)) {
foreach ($TaxType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('EditPackagingType', $options, set_value('EditPackagingType'), 'id="EditPackagingType" class="form-control "');
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Packaging Rate </label>
<div>
<?php
$data = array('name' => 'txtEditPackaging', 'value' => set_value('txtEditPackaging'), 'id' => 'txtEditPackaging', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculatePackaging();', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Packaging Amt <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtEditAfterPackaging', 'value' => set_value('txtEditAfterPackaging'), 'id' => 'txtEditAfterPackaging', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" id="CGSTArea">
<div class="form-group col-md-6"> </div>
<div class="form-group col-md-3">
<label>CGST in %</label>
<?php
$data = array('name' => 'txtEditGST', 'value' => set_value('txtEditGST'), 'id' => 'txtEditGST', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => ' calculateGST(1);', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>CGST Amt <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtEditAfterGST', 'value' => set_value('txtEditAfterGST'), 'id' => 'txtEditAfterGST', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" id="SGSTModel">
<div class="form-group col-md-6"></div>
<div class="form-group col-md-3">
<label>SGST in %</label>
<?php
$data = array('name' => 'txtEditVat', 'value' => set_value('txtEditVat'), 'id' => 'txtEditVat', 'class' => 'form-control num', 'onchange' => 'calculateVat();', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>SGST Amt <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtEditAfterVat', 'value' => set_value('txtEditAfterVat'), 'id' => 'txtEditAfterVat', 'class' => 'form-control num', 'readonly' => 'true', 'onkeypress' => 'return isNumberKey(event);', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" id="IGSTModel" style="display:none;">
<div class="form-group col-md-6"></div>
<div class="form-group col-md-3">
<label>IGST in %</label>
<div>
<?php
$data = array('name' => 'txtEditOtherTax', 'value' => set_value('txtEditOtherTax'), 'id' => 'txtEditOtherTax', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateOtherTaxes(1);', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>IGST Amt <?php echo "($INRSYM)" ?></label>
<div>
<?php
$data = array('name' => 'txtEditAfterOtherTax', 'value' => set_value('txtEditAfterOtherTax'), 'id' => 'txtEditAfterOtherTax', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-9"></div>
<div class="form-group col-md-3">
<label> Insurance Amt <?php echo "($INRSYM)" ?>(if Any)</label>
<div>
<?php
$data = array('name' => 'txtEditInsurance', 'value' => set_value('txtEditInsurance'), 'id' => 'txtEditInsurance', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateEditTotalValue(1);', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-9"></div>
<div class="form-group col-md-3">
<label>Total Order Amt <?php echo "($INRSYM)" ?></label>
<?php
$data = array('name' => 'txtEditTotalOrderValue', 'value' => set_value('txtEditTotalOrderValue'), 'id' => 'txtEditTotalOrderValue', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label><?php echo "Revenue Description"; ?></label>
<?php
$data = array('name' => 'Edit_Service_Description', 'value' => set_value('Edit_Service_Description'), 'id' => 'Edit_Service_Description', 'class' => 'form-control', 'rows' => '2', 'cols' => '100');
echo form_textarea($data);
;
?>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" value="Cancel" style="margin:10px;">Cancel</a>
<a class="btn btn-success EditRevenue" ID="EditRevenue">&nbsp;&nbsp;<span class="bold">Edit
Revenue</span></a>
</div>
</form>
</div>
</div>
</div><!-- /.modal -->
<!-- Modal for freight calculation -->
<div id="freightmodel" data-backdrop-limit="1" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Freight Calculation On</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<form>
<div>
<label><input type="radio" name="optfreight" checked="checked" value='0' id="optFreight"> Basic
Amount</label>
</div>
<div>
<label><input type="radio" name="optfreight" id="optFreight" value='1'> After Discount
Amount</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-secondary waves-effect" data-dismiss="modal" value="Cancel">Cancel</a>
<a class="btn btn-info waves-effect waves-light" ID="PackagingOption"
onclick="SetFreightOption();">&nbsp;&nbsp;<span class="bold">Ok</span></a>
</div>
</div>
</div>
</div><!-- /.modal -->
<!-- Modal for Excise Duty Calculation-->
<div id="ExciseDutyCalModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Excise Duty Calculation On</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<form>
<div class="radio">
<label><input type="radio" name="optExcise" checked="checked" value="0" id="optExcise">From
Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optExcise" value="1" id="optExcise">Basic Amount - Discount
Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optExcise" value="2" id="optExcise">(Basic Amount - Discount
Amount ) + Packing Cost</label>
</div>
<div class="radio">
<label><input type="radio" name="optExcise" value="3" id="optExcise">Basic Amount + Packing
Cost</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-secondary waves-effect" data-dismiss="modal" style="margin-top: -24px;"
value="Cancel">Cancel</a>
<a class="btn btn-info waves-effect waves-ligh" ID="ExciseOption" onclick="SetExciseCalculation();"
style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
</div>
</div>
</div>
</div><!-- /.modal -->
<!-- Modal for Vat Calculation -->
<div id="VatCalModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
style="display: none;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Vat Calculation On</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<form>
<div class="radio">
<label><input type="radio" name="optVat" checked="checked" value="0" id="optVat">Basic
Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optVat" value="1" id="optVat">Excise Duty</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success" ID="VatOption" onclick="SetVatCalculation();"
style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
</div>
</div>
</div>
</div><!-- /.modal -->
<!-- <script type="text/html" id="RevenueList">
<tr id="<%=index%>">
<td align="left"><%=index%></td>
<td align="left"><%=ReqNo%></td>
<td align="left"><%=MaterialName%></td>
<td align="left"><%=Quantity%></td>
<td align="left"><%=UOM%></td>
<td align="left"><%=Rate%></td>
<td align="left"><%=BasicAmount%></td>
<td align="left"><%=Taxvalue%></td>
<td align="left"><%=TotalValue%></td>
<td>
<a data-target='#EDITREVENUE' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EDITREVENUE"><i class="ri-pencil-fill" data-toggle="tooltip"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick="DeleteRow('<%=index%>')" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
</td>
</tr>
</script> -->
<script>
$(document).ready(function () {
var tempUserId = 0;
var index = '1';
var userid = '';
$("#EDITREVENUE").on("shown.bs.modal", function (e) {
var AvlBudAmt = '<?php echo $AvlAmount ?>';
AvlBudAmt = '<?php echo number_format($AvlAmount + $totBasicAmt - $totDiscountAmt, 2, '.', '') ?>';
userid = $(e.relatedTarget).data('userid');
$('#isEdit').val(1);
$('#isEdit').val(1);
if (tempUserId == 0) {
var tr = document.getElementById(userid);
var cellval = tr.cells;
var id = $('#Reqnumber' + userid).val();
$('#EditReqNo').val($('#Reqnumber' + userid).val());
$('#EditdeptName').val($('#departmentName' + userid).val());
$("#EditCostCenter").val($('#costCode' + userid).val());
$('#EditAvlBudAmt').val(AvlBudAmt);
$('#EditMaterialCode').val($('#materialCode' + userid).val());
$('#EditItemName').val($('#materialName' + userid).val());
$('#EditUOM').val($('#uom' + userid).val());
$('#EditQuantity').val($('#quantity' + userid).val());
$('#EditAmendPer').val($('#per' + userid).val());
tinyMCE.get('Edit_Service_Description').setContent($('#service_description' + userid).val());
$('#EditRate').val($('#itemRate' + userid).val());
$('#txtEditBasicValue').val(parseFloat(cellval[6].innerHTML).toFixed(2));
RequistQuantity = $('#quantity' + userid).val();
$('#txtEditDiscount').val($('#DisVal' + userid).val());
$('#txtEditAfterDiscount').val($('#AfterDisVal' + userid).val());
$('#txtEditVat').val($('#VatVal' + userid).val());
$('#txtEditAfterVat').val($('#AfterVatVal' + userid).val());
$('#txtEditPackaging').val($('#PackVal' + userid).val());
$('#txtEditAfterPackaging').val($('#AfterPackVal' + userid).val());
$('#txtEditGST').val($('#GSTVal' + userid).val());
$('#txtEditAfterGST').val($('#AfterGSTVal' + userid).val());
$('#txtEditOtherTax').val($('#OtherTaxVal' + userid).val());
$('#txtEditAfterOtherTax').val($('#AfterOtherTaxVal' + userid).val());
if ($('#FreightType' + userid).val() == 'PER TRIP') {
$('#EditTripsValue').show();
$('#EditNOOfTrips').val($('#Nooftrips' + userid).val());
}
$('#txtEditFreight').val($('#FreightVal' + userid).val());
$('#txtEditAfterFreight').val($('#AfterFreightVal' + userid).val());
$('#txtEditInsurance').val($('#Insval' + userid).val());
$('#txtEditTotalOrderValue').val($('#TotalOrderValue' + userid).val());
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function (idx, obj) {
if (obj.ReqNo === id) {
$.each(SelectedMaterialList.Mat, function (idx1, el) {
if (id == el.ReqNo) {
if (el.materialCode == obj.MaterialCode) {
isAdded = "1";
return false;
} else {
isAdded = "0";
}
}
});
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
});
}
$("#EditDiscountType").val($('#DisType' + userid).val());
$("#drpEditFreight").val($('#FreightType' + userid).val());
$("#EditPackagingType").val($('#PackType' + userid).val())
$("input:radio[name='optPackaging'][value='" + $('#PackOption' + userid).val() + "']").prop('checked', 'checked');
$("input:radio[name='optExcise'][value='" + $('#ExciseOption' + userid).val() + "']").prop('checked', 'checked');
$("input:radio[name='optVat'][value='" + $('#VatOption' + userid).val() + "']").prop('checked', 'checked');
$("input:radio[name='optCST'][value='" + $('#CSTOption' + userid).val() + "']").prop('checked', 'checked');
}
if (userid) {
tempUserId = userid;
} else {
userid = tempUserId;
}
});
$('#BudgetType').attr("style", "pointer-events: none;");
$('#EditRevenue').click(function () {
tinyMCE.triggerSave();
if (validateEditRevenueTax() && validateEditExceedLimit()) {
var CostCode = $("#EditCostCenter").val();
var AvilBudget = $('#EditAvlBudAmt').val();
var editMaterialCode = $("#EditMaterialCode").val();
var editDescription = $("#EditItemName").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
var itemRate = $("#EditRate").val();
var per = $("#EditAmendPer").val();
if (per == '') {
per = $('#EditUOM').val();
}
var DisType = $("#EditDiscountType").val();
var DisVal = $("#txtEditDiscount").val();
var AfterDisVal = $("#txtEditAfterDiscount").val();
var PackOption = PackagingCalculation;
var PackType = $("#EditPackagingType").val();
var PackVal = $("#txtEditPackaging").val();
var AfterPackVal = $("#txtEditAfterPackaging").val();
// var ExciseOption = ExciseCalculation ;
// var ExciseVal = $("#txtEditExciseDuty").val();
// var AfterExciseVal = $("#txtEditAfterExciseDuty").val();
var VatOption = VatCalculation; //SGST
var VatVal = $("#txtEditVat").val();
var AfterVatVal = $("#txtEditAfterVat").val();
// var CSTOption = CSTCalculation ;
// var CSTVal = $("#txtCST").val();
// var AfterCSTVal = $("#txtEditAfterCST").val();
var GSTVal = $("#txtEditGST").val(); //CGST
var AfterGSTVal = $("#txtEditAfterGST").val();
var OtherTaxVal = $("#txtEditOtherTax").val(); //IGST
var AfterOtherTaxVal = $("#txtEditAfterOtherTax").val();
var Trips = $('#EditNOOfTrips').val();
// var FreightOption = FreightCalculation ;
var FreightType = $("#drpEditFreight").val();
var FreightVal = $("#txtEditFreight").val();
var AfterFreightVal = $("#txtEditAfterFreight").val();
var basicval = $("#txtEditBasicValue").val();
var Insval = $("#txtEditInsurance").val();
var TotalOrderValue = $("#txtEditTotalOrderValue").val();
var Service_Description = $("#Edit_Service_Description").val();
var TotalTaxValue = calculateEditTaxValue();
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[2].innerHTML = editDescription;
cellval[3].innerHTML = parseFloat(editQuantity).toFixed(2);
cellval[4].innerHTML = editUOM;
cellval[5].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[6].innerHTML = parseFloat(basicval).toFixed(2);
cellval[7].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[8].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
$('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(editDescription);
$('#uom' + userid).val(editUOM);
$('#quantity' + userid).val(editQuantity);
$('#itemRate' + userid).val(itemRate);
$('#DisType' + userid).val(DisType);
$('#DisVal' + userid).val(DisVal);
$('#AfterDisVal' + userid).val(AfterDisVal);
$('#PackOption' + userid).val(PackOption);
$('#PackType' + userid).val(PackType);
$('#PackVal' + userid).val(PackVal);
$('#AfterPackVal' + userid).val(AfterPackVal);
// $('#ExciseOption'+userid).val(ExciseOption);
// $('#ExciseVal'+userid).val(ExciseVal);
// $('#AfterExciseVal'+userid).val(AfterExciseVal);
//$('#VatOption'+userid).val(VatOption);
$('#VatVal' + userid).val(VatVal);
$('#AfterVatVal' + userid).val(AfterVatVal);
// $('#CSTOption'+userid).val(CSTOption);
// $('#CSTVal'+userid).val(CSTVal);
//$('#AfterCSTVal'+userid).val(AfterCSTVal);
$('#GSTVal' + userid).val(GSTVal);
$('#AfterGSTVal' + userid).val(AfterGSTVal);
$('#OtherTaxVal' + userid).val(OtherTaxVal);
$('#AfterOtherTaxVal' + userid).val(AfterOtherTaxVal);
//$('#FreightOption'+userid).val(FreightOption);
$('#FreightType' + userid).val(FreightType);
$('#Nooftrips' + userid).val(Trips);
//alert($('#Nooftrips'+userid).val());
$('#FreightVal' + userid).val(FreightVal);
$('#AfterFreightVal' + userid).val(AfterFreightVal);
$('#basicval' + userid).val(basicval);
$('#Insval' + userid).val(Insval);
$('#AvilBudget' + userid).val(AvilBudget);
$('#costCode' + userid).val(CostCode);
$('#TotalOrderValue' + userid).val(TotalOrderValue);
$('#service_description' + userid).val(Service_Description);
populateValueMainFormForEditRevenueTax();
setTimeout(() => {
$('#EDITREVENUE').modal('hide');
}, 1000);
}
// alert('outside IF');
});
function populateValueMainFormForRevenue() {
var Packaging = $('#txtAfterPackaging').val() == '' ? '0.00' : $('#txtAfterPackaging').val();
var Vat = $('#txtAfterVat').val() == '' ? '0.00' : $('#txtAfterVat').val(); //SGST
var GST = $('#txtAfterGST').val() == '' ? '0.00' : $('#txtAfterGST').val(); //CGST
var OtherTax = $('#txtAfterOtherTax').val() == '' ? '0.00' : $('#txtAfterOtherTax').val(); //IGST
var Freight = $('#txtAfterFreight').val() == '' ? '0.00' : $('#txtAfterFreight').val();
var Insurance = $('#txtInsurance').val() == '' ? '0.00' : $('#txtInsurance').val();
var Discount = $('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val();
var BasicVal = $('#txtBasicValue').val() == '' ? '0.00' : $('#txtBasicValue').val();
var TotalVal = $('#txtTotalOrderValue').val() == '' ? '0.00' : $('#txtTotalOrderValue').val();
var TotalOrderValueSummary = $('#txtTotalOrderValueSummary').val() == '' ? '0.00' : $('#txtTotalOrderValueSummary').val();
var totBasicAmt = $('#txtTotBasicAmount').val() == '' ? '0.00' : $('#txtTotBasicAmount').val();
var totDiscountAmt = $('#txtTotalDiscount').val() == '' ? '0.00' : $('#txtTotalDiscount').val();
var totPackagingAmt = $('#txtTotalPackaing').val() == '' ? '0.00' : $('#txtTotalPackaing').val();
var totVATAmt = $('#txtTotalVat').val() == '' ? '0.00' : $('#txtTotalVat').val(); //SGST
var totGSTAmt = $('#txtTotalGST').val() == '' ? '0.00' : $('#txtTotalGST').val(); //CGST
var totOtherTaxAmt = $('#txtTotalOtherTaxes').val() == '' ? '0.00' : $('#txtTotalOtherTaxes').val(); //IGST
var totFreightAmt = $('#txtTotalFreight').val() == '' ? '0.00' : $('#txtTotalFreight').val();
var totInsuranceAmt = $('#txtTotalInsurance').val() == '' ? '0.00' : $('#txtTotalInsurance').val();
var totOrderSummaryAmt = $('#txtTotalOrderValueSummary').val() == '' ? '0.00' : $('#txtTotalOrderValueSummary').val();
$('#txtTotBasicAmount').val(parseFloat(totBasicAmt) + parseFloat(BasicVal));
$('#txtTotalDiscount').val(parseFloat(totDiscountAmt) + parseFloat(Discount));
$('#txtTotalPackaing').val(parseFloat(totPackagingAmt) + parseFloat(Packaging));
$('#txtTotalVat').val(parseFloat(totVATAmt) + parseFloat(Vat)); //SGST
$('#txtTotalGST').val(parseFloat(totGSTAmt) + parseFloat(GST)); //CGST
$('#txtTotalOtherTaxes').val(parseFloat(totOtherTaxAmt) + parseFloat(OtherTax)); //IGST
$('#txtTotalFreight').val(parseFloat(totFreightAmt) + parseFloat(Freight));
$('#txtTotalInsurance').val(parseFloat(totInsuranceAmt) + parseFloat(Insurance));
$('#txtTotalOrderValueSummary').val(parseFloat(totOrderSummaryAmt) + parseFloat(TotalVal));
}
function populateValueMainFormForEditRevenueTax() {
var rows = document.getElementById('revenueTax').rows.length;
var totBasicAmt = 0;
var totDiscountAmt = 0;
var totPackagingAmt = 0;
var totVATAmt = 0; //SGST
var totGSTAmt = 0; //CGST
var totOtherTaxAmt = 0; //IGST
var totFreightAmt = 0;
var totInsuranceAmt = 0;
var totOrderSummaryAmt = 0;
var i = 0;
do {
i += 1;
var tr = document.getElementById(i);
if (tr != null) {
cells = tr.getElementsByTagName('td');
var rowid = cells[0].innerHTML;
var Packaging = $('#AfterPackVal' + rowid).val() == '' ? '0.00' : $('#AfterPackVal' + rowid).val();
var Vat = $('#AfterVatVal' + rowid).val() == '' ? '0.00' : $('#AfterVatVal' + rowid).val(); //SGST
var GST = $('#AfterGSTVal' + rowid).val() == '' ? '0.00' : $('#AfterGSTVal' + rowid).val(); //CGST
var OtherTax = $('#AfterOtherTaxVal' + rowid).val() == '' ? '0.00' : $('#AfterOtherTaxVal' + rowid).val(); //IGST
var Freight = $('#AfterFreightVal' + rowid).val() == '' ? '0.00' : $('#AfterFreightVal' + rowid).val();
var Insurance = $('#Insval' + rowid).val() == '' ? '0.00' : $('#Insval' + rowid).val();
var Discount = $('#AfterDisVal' + rowid).val() == '' ? '0.00' : $('#AfterDisVal' + rowid).val();
var BasicVal = $('#basicval' + rowid).val() == '' ? '0.00' : $('#basicval' + rowid).val();
var TotalVal = $('#TotalOrderValue' + rowid).val() == '' ? '0.00' : $('#TotalOrderValue' + rowid).val();
totBasicAmt = parseFloat(totBasicAmt) + parseFloat(BasicVal);
totDiscountAmt = parseFloat(totDiscountAmt) + parseFloat(Discount);
totPackagingAmt = parseFloat(totPackagingAmt) + parseFloat(Packaging);
totVATAmt = parseFloat(totVATAmt) + parseFloat(Vat); //SGST
totGSTAmt = parseFloat(totGSTAmt) + parseFloat(GST); //CGST
totOtherTaxAmt = parseFloat(totOtherTaxAmt) + parseFloat(OtherTax); //IGST
totFreightAmt = parseFloat(totFreightAmt) + parseFloat(Freight);
totInsuranceAmt = parseFloat(totInsuranceAmt) + parseFloat(Insurance);
totOrderSummaryAmt = parseFloat(totOrderSummaryAmt) + parseFloat(TotalVal);
}
} while (i < rows);
$('#txtTotBasicAmount').val(parseFloat(totBasicAmt).toFixed(2));
$('#txtTotalDiscount').val(parseFloat(totDiscountAmt).toFixed(2));
$('#txtTotalPackaing').val(parseFloat(totPackagingAmt).toFixed(2));
$('#txtTotalVat').val(parseFloat(totVATAmt).toFixed(2)); //SGST
$('#txtTotalGST').val(parseFloat(totGSTAmt).toFixed(2)); //CGST
$('#txtTotalOtherTaxes').val(parseFloat(totOtherTaxAmt).toFixed(2)); //IGST
$('#txtTotalFreight').val(parseFloat(totFreightAmt).toFixed(2));
$('#txtTotalInsurance').val(parseFloat(totInsuranceAmt).toFixed(2));
$('#txtTotalOrderValueSummary').val(parseFloat(totOrderSummaryAmt).toFixed(2));
}
function validateEditRevenueTax() {
if ($('#EditCostCenter').val() == "") {
alert('Please select the Cost center');
$('#EditCostCenter').focus();
return false;
} else if ($('#EditMaterialCode').val() == "0") {
alert('Please select the Material Code');
$('#EditMaterialCode').focus();
return false;
} else if ($('#EditQuantity').val() == '' || $('#EditQuantity').val() == 0) {
alert('Please Enter the Quantity value');
$('#EditQuantity').focus();
return false;
} else if ($('#EditRate').val() == '') {
alert('Please Enter the Rate of the Item');
$('#EditRate').focus();
return false;
} else {
return true;
}
}
})
</script>
<script>
function validateBudgetExceedLimit() {
//alert('inside validateBudgetExceedLimit function');
var rows = document.getElementById('revenueTax').rows.length;
var ReqType = '<?php echo REVENUE ?>';
for (i = 1; i < rows; i++) {
var costcode = $('#costCode' + i).val();
var basicAmountRate = parseFloat($('#basicval' + i).val());
var totalAmount = parseFloat($('#TotalOrderValue' + i).val());
var avalbudAmt = '';
//alert('before Ajax');
$('#loader').show();
$.ajax({
data: {
id: costcode,
type: ReqType
},
type: "POST",
url: "<?php echo base_url() ?>serviceAvilBudgetAmount",
success: function (data) {
$('#loader').hide();
if (data) {
avalbudAmt = parseFloat(data);
// if(basicAmountRate > avalbudAmt || totalAmount > avalbudAmt)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('.content').loader('hide');
// $('#Rate').focus();
// return false;
// }
// else
// {
//alert('Not exceeding in else part');
return true;
//}
}
}
});
}
}
function Save(status) {
//alert('Inside else');
stat = '<?php echo PO_RELEASED; ?>';
var deladd = $('#DeliveryAddr').val();
$('#txtStatus').val(stat);
tinyMCE.triggerSave();
var splinstr = $('#txtSpcialInstruction').val();
$('#SpcialInstruction').val(splinstr);
$('#txtDeliveryAddress').val(deladd);
var AvlBudAmt = '<?php echo number_format($AvlAmount + $totBasicAmt - $totDiscountAmt, 2, '.', '') ?>';
var txtTotBasicAmount = $('#txtTotBasicAmount').val();
var txtTotalDiscount = $('#txtTotalDiscount').val();
//alert('Before Validate IF condition');
if (validate()) {
//alert('insdie Validate IF condition');
var realrows = document.getElementById('txtRowCount').value;
//alert(realrows);
if (document.getElementById('revenueTax').rows.length < 2) {
alert('Please Select Line item to Create PO');
$('#Deliverydt').focus();
return false;
}
// else if(parseInt(AvlBudAmt) < (parseInt(txtTotBasicAmount) - parseInt(txtTotalDiscount))) {
// alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.');
// return false;
// }
else {
//alert('final else for store data');
// $('.content').loader('show');
var formData = new FormData($('.CreatePO')[0]);
if (status == 0) { // for draft
formData.append('changeStatus','ST014');
};
if (status == 1) { // for approve
formData.append('changeStatus','ST026');
};
$('#loader').show();
$.ajax({
// data:$('.CreatePO').serialize(),
type: "POST",
url: "<?php echo base_url() ?>amendmentpurchaseorder/EditRevenuePurchaseOrder",
data: formData,
processData: false,
contentType: false,
success: function (data) {
console.log(data);
if (data) {
$('#loader').hide();
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
$('#txtStatus').val('');
$('#SpcialInstruction').val('');
$('#txtDeliveryAddress').val('')
window.location = (status == 1) ? "amendmentpurchaseorder" : "purchaseorderListing";
} else {
$('#loader').hide();
}
},
error : function(error){
console.error("error occured" + error);
},
complete : function (){
$('#loader').hide();
console.log("ajax call is completed ..!!")
}
});
}
}
}
// this function is used to clear data changing schedule option
$('#Scheduleby').change(function () {
$("#Deliverydt").datepicker({
minDate: 'now',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
yearRange: '0:+10'
});
});
$('#Deliverydt').change(function () {
$('#Scheduleby').val('');
});
// < !--script for table, It works uned the datatable plugin-- >
$(function () {
// $('#revenueTax').DataTable({
// "paging": false,
// "lengthChange": false,
// "searching": false,
// "ordering": false,
// // "info": true,
// "autoWidth": true
// });
});
//If others is the payment terms , display mandatory field
$("#PaymentTerms").change(function () {
if ($('#PaymentTerms').val().trim() == 'PT08') {
$('#otheroptiondiv').show();
} else {
$('#otheroptiondiv').hide();
}
});
</script>
<script>
$('#insurancestatus').change(function () {
var ans = $("#insurancestatus").val();
//alert(ans);
if (ans == 0) {
$("#InsuranceNumberdiv").hide();
//$("#InsuranceNumber").val("");
} else {
$("#InsuranceNumberdiv").show();
}
});
</script>
<script>
$(document).ready(function () {
// When the second modal is about to be shown
$('#packagingcalmodel').on('show.bs.modal', function () {
// Set a higher z-index for the second modal to appear on top
$('#packagingcalmodel').css('z-index', 1060); // Set the z-index for the second modal
// Ensure the second modal backdrop appears above the first one
setTimeout(function () {
$('.modal-backdrop').last().css('z-index', 1055);
}, 0);
});
// Reset z-index when the second modal is hidden (optional)
$('#packagingcalmodel').on('hidden.bs.modal', function () {
$('#packagingcalmodel').css('z-index', ''); // Reset to default
});
});
</script>
<script>
$(document).ready(function () {
// When the second modal is about to be shown
$('#freightmodel').on('show.bs.modal', function () {
// Set a higher z-index for the second modal to appear on top
$('#freightmodel').css('z-index', 1060); // Set the z-index for the second modal
// Ensure the second modal backdrop appears above the first one
setTimeout(function () {
$('.modal-backdrop').last().css('z-index', 1055);
}, 0);
});
// Reset z-index when the second modal is hidden (optional)
$('#freightmodel').on('hidden.bs.modal', function () {
$('#freightmodel').css('z-index', ''); // Reset to default
});
});
</script>