ria/app/Views/editImportAmendPO.php
2024-08-13 05:14:29 +00:00

3361 lines
170 KiB
PHP

<?php
$AvlAmount = 0;
$ReqType = '';
$Value = '';
$EXCRATE = 0;
$Rowcount = 0;
$Value = $unicode;
$totassesable = 0;
$totSubtotal = 0;
$totigst = 0;
$totalhidden = '';
$Import_DispatchDetails = '';
$Import_PlaceofOrgin = '';
$DeliverySchedule = '';
$Currencycode = $currencycode;
$Cur = '';
$CurCode = '';
foreach ($CurrencyDetail as $Detail) {
$Cur = $Detail->Currency_Code . ' ' . ' - ' . ' ' . $Detail->Country_and_Currency;
$CurCode = $Detail->Currency_Code;
}
if (!empty($AvlBudAmt)) {
$AvlAmount = $AvlBudAmt;
}
//echo $AvlBudAmt;
foreach ($PaymentTerms as $TER) {
$Terms = $TER->PaymentTerms;
}
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$CurrentDate = $dt->format('d-m-Y');
$MaxPoDate = '';
if (!empty($MaxPODate)) {
foreach ($MaxPODate as $date) {
$MaxPoDate = $date->PODate;
}
}
$INR = '';
$INRSYM = '';
if (!empty($INRSYMBOL)) {
foreach ($INRSYMBOL as $INR) {
$INRSYM = $INR->Currency_Code;
$INR = $INR->FontCode2000;
}
}
//echo $INR;
$CompanyAddress = '';
if (!empty($CompanyDetails)) {
foreach ($CompanyDetails as $Req) {
$CompanyAddress = $Req->Address;
}
}
$SupId = '';
$SupName = '';
$Address = '';
$PODate = '';
$Deliverydt = '';
$DeliveryAddress = '';
$PONOStatus = '';
$PONO = '';
$ServiceDescription = '';
$TotalLanding = 0.00;
$tothighseas = 0.00;
$totcustom = 0.00;
$totexciseduty = 0.00;
$totexcisedutyED = 0.00;
$totexciseSH = 0.00;
$totcustomED = 0.00;
$totcustomSH = 0.00;
$totaddtnlexcise = 0.00;
$totgrossduty = 0.00;
$totavlmodvat = 0.00;
$totgrossexpense = 0.00;
$totordervalue = 0.00;
$ExchangeRate = 0.00;
$totorder = 0.00;
$totfreight = 0.00;
//$ExchangeRate
$ExchangeRateCalculatedon = '';
$StatusName = '';
$Reqon = '';
$Requestedby = '';
$RequesterName = '';
$BudgetType = '';
$PrePOFile = '';
if (!empty($POMaster)) {
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');
$Ddt = new DateTime($Req->DeliveryDate);
$Deliverydt = $Ddt->format('d-m-Y');
$DeliveryAddress = $Req->DeliveryAddress;
$PONOStatus = $Req->StatusCode;
$PONO = $Req->PONO;
$ServiceDescription = $Req->ServiceDescription;
$ExchangeRate = number_format(($Req->ExchangeRate), 2);
$EDt = new DateTime($Req->ExchangeRateCalculatedon);
$ExchangeRateCalculatedon = $EDt->format('d-m-Y');
// $ExchangeRateCalculatedon=$Req->ExchangeRateCalculatedon;
$PaymentTerms = $Req->PaymentTerms;
// $PayableAT=$Req->PayableAT;
// $PaymentDays=$Req->PaymentDays;
$StatusName = $Req->StatusName;
$Import_DispatchDetails = $Req->Import_DispatchDetails;
$Import_PlaceofOrgin = $Req->Import_PlaceofOrgin;
$DeliverySchedule = $Req->DeliverySchedule;
$ServiceDescription = $Req->ServiceDescription;
$DeliveryOption = $Req->DeliveryOption;
$Orderedsum = $Req->TotalOrderValue;
$Shipmentmode = $Req->Mode_Of_Shipment;
$SupplierRef = $Req->Supplier_Reference;
$SupOfferno = $Req->Supplier_Offer_No;
$Otherref = $Req->Other_Reference;
$Otherpay = $Req->PaymentOtherDescription;
$Insurance = $Req->InsuranceStatus;
$InsuranceNumber = $Req->InsuranceNumber;
$Importoption = $Req->POSubType;
$InsuranceStatus = $Req->InsuranceStatus;
$BudgetType = $Req->BudgetType;
$PrePOFile = $Req->POFile;
}
}
//$AvilableBudget=0;
//echo $InsuranceStatus;
$SavedSum = $Orderedsum * $ExchangeRate;
//echo $SavedSum;
$AvilableBudget = $SavedSum + $AvlAmount;
//echo $AvilableBudget;
if (!empty($RequistionDetails)) {
foreach ($RequistionDetails as $ReqDet) {
// $Reqon=$ReqDet->ReqDate;
$Reqonn = new DateTime($ReqDet->ReqDate);
$Reqon = $Reqonn->format('Y-m-d');
$Requestedby = $ReqDet->Requestedby;
$RequesterName = $ReqDet->FirstName;
//$Status=$ReqDet->Status;
}
}
//echo $RequesterName;
// foreach ($POSTATUS as $PST )
// {
// $POStatus=$PST->StatusName;
// }
//echo "$POStatus";
?>
<style>
.modal {
padding-right: 25% ! important;
}
.dataTables_paginate {
margin-top: -5%;
}
.dataTables_wrapper {
padding-bottom: 0px;
}
.num {
text-align: right;
}
.pagination {
margin: 0px ! important;
}
.box-body {
padding: 0px ! important;
}
.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;
}
.mandatory {
color: red;
text-align: right;
background-color: white;
}
</style>
<script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript">
</script>
<script src="<?php echo base_url() ?>public/assets/tinymce/js/tinymce/tinymce.min.js"></script>
<script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#edittxtInstruction",
menubar: false,
statusbar: false,
toolbar: false
});
</script>
<script>
$(document).ready(function() {
$("#PaymentTerms").select2();
$("#currencytype").select2();
var POMaxDate = '<?php echo $MaxPoDate; ?>';
var d = new Date(POMaxDate);
var t = '<?php echo $CurrentDate; ?>';
var m = new Date(t);
$("#PODate").datepicker({
minDate: d,
maxDate: 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
// $("#Deliverydt").datepicker({
// minDate : 'now',
// dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
// });
$("#Requeston").datepicker({
//minDate : d,
maxDate: 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
$("#Exchangerateon").datepicker({
minDate: m,
//maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
});
</script>
<div class="content-wrapper">
<section class="content">
<div id="content"></div>
<?php
$attributes = array('class' => 'form-label-left ImportPO ', 'name' => 'ImportPO', 'id' => 'ImportPO', 'enctype' => 'multipart/form-data');
echo form_open(base_url() . '/purchaseorder/addPO/', $attributes); ?>
<!-- <section class="content"> -->
<div style="border:2px solid #333;">
<div class="col-md-12">
<div class="header-container">
<h2> Amended Import Purchase Order-<?php echo "$PONO" ?></h2>
<a href="<?php echo base_url() ?>amendmentpurchaseorder" class="btn btn-cancel" id="back" value="Back">Back</a>
</div>
<!--<div class="col-md-1"><br/>
<a class="btn btn-info" href="<?php echo base_url(); ?>purchaseorder/CreateimportPOPrint" target="_blank">Print</a>
</div> -->
</div>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="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;
endforeach;
}
echo form_multiselect('RequistionNo', $options, set_value('RequistionNo', array()), 'id="RequistionNo"', 'required="true"', 'height="400px"');
?>
</div>
<div class="col-md-3">
<label>Purchase Order Type</label>
<div class="form-group">
<?php
$data = array('name' => 'POType', 'value' => set_value('POType', IMPORT), 'id' => 'POType', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Supplier<span class="badge mandatory">*</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'),'id="drpSupplier"' ,'required="true"' ,'class="form-control select2');
echo form_dropdown('drpSupplier', $options, set_value('drpSupplier', $SupId), 'id="drpSupplier"', 'required="true"', 'class="form-control select2');
?>
</div>
<div class="col-md-3">
<label>Address</label>
<div class="form-group">
<?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>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Currency Type<span class="badge mandatory">*</span></label>
<?php
$options = array($CurCode => $Cur);
if (!empty($Currency)) {
foreach ($Currency as $CUR) :
$options[$CUR->Currency_Code] = $CUR->Currency_Code . ' ' . ' - ' . ' ' . $CUR->Country_and_Currency;
endforeach;
}
echo form_dropdown('currencytype', $options, set_value('currencytype'), 'id="currencytype"', 'required="true"', 'class="form-control select2'); ?>
</div>
<div class="col-md-3">
<b><u>Select Delivery By<span class="badge mandatory">*</span></u></b><br />
<!-- <?php echo form_label('Date', 'Date') . "&nbsp;&nbsp;" . form_radio(array("name" => "DateRange", "id" => "Date", "value" => "0", 'checked' => 'checked')); ?>&nbsp;&nbsp;&nbsp;&nbsp;</td> -->
<div class="centered">
<?php echo form_label('Dispatch instruction', 'Dispatch instruction') . "&nbsp;&nbsp;" . form_radio(array("name" => "DateRange", "id" => "Date", "value" => "2", 'checked' => 'checked')); ?>&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo form_label('Schedule', 'Schedule') . "&nbsp;&nbsp;" . form_radio(array("name" => "DateRange", "id" => "Schedule", "value" => "1")); ?>
</div>
</div>
<div class="col-md-3" id="Schedulediv" style="display:none;"> <br />
<!-- <label >Schedule </label>
<?php
$data = array('name' => 'Scheduleby', 'value' => set_value('Scheduleby'), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40');
echo Form_textarea($data);
?> -->
<label>Schedule By<span class="badge mandatory">*</span></label>
<?php
$data = array('name' => 'Scheduleby', 'value' => set_value('Scheduleby', $DeliverySchedule), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110');
echo Form_textarea($data);
?>
</div>
<div class="col-md-3" id="Deliverydtdiv">
<!-- <label>Delivery Date</label>
<?php
$data = array('name' => 'Deliverydt', 'value' => set_value('Deliverydt', $CurrentDate), 'id' => 'Deliverydt', 'class' => 'form-control', 'required' => 'true');
echo form_input($data);
?> -->
<label>Dispatch Instruction<span class="badge mandatory">*</span></label>
<?php
// $data = array('name' => 'Dispatch','value' => set_value('Dispatch',$Import_DispatchDetails),'id'=>'Dispatch', 'class' => 'form-control' ,'required' => 'true');
// echo form_input($data);
$data = array('name' => 'Dispatch', 'value' => set_value('Dispatch', $Import_DispatchDetails), 'id' => 'Dispatch', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110');
echo Form_textarea($data);
?>
</div>
<div class="col-md-3">
<label>Delivery Address</label>
<div class="form-group">
<?php
$data = array('name' => 'DeliveryAddr', 'value' => set_value('DeliveryAddr', $DeliveryAddress), 'id' => 'DeliveryAddr', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40');
echo Form_textarea($data);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
Check Today's Foreign Exchange value <a href="http://www.xe.com/" target="_blank"><u>(Click here)</u></a>
</div>
<div class="col-md-3">
<label>Exchange Rate On</label>
<div class="form-group">
<?php
$data = array('name' => 'Exchangerateon', 'value' => set_value('Exchangerateon', $ExchangeRateCalculatedon), 'id' => 'Exchangerateon', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<!-- <label>Exchange Rate </label> -->
<label id=label1><b><?php echo "Exchange Rate in $Currencycode ($Value)" ?><span class="badge mandatory">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'ExchangeRate', 'value' => set_value('ExchangeRate', $ExchangeRate), 'id' => 'ExchangeRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'USRate()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Place of Origin<span class="badge mandatory">*</span></label>
<div class="form-group">
<?php
// $data = array('name' => 'PODate','value' => set_value('PODate',$CurrentDate),'id'=>'PODate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
// echo form_input($data);
$data = array('name' => 'PlaceOforigin', 'value' => set_value('PlaceOforigin', $Import_PlaceofOrgin), 'id' => 'PlaceOforigin', 'class' => 'form-control', 'required' => 'true');
echo form_input($data);
?>
</div>
<!-- <div class="form-group" style="display:none;">
<?php
// $data = array('name' => 'PODate','value' => set_value('PODate',$CurrentDate),'id'=>'PODate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
// echo form_input($data);
$data = array('name' => 'beforePlaceOforigin', 'value' => set_value('beforePlaceOforigin', $Import_PlaceofOrgin), 'id' => 'beforePlaceOforigin', 'class' => 'form-control', 'required' => 'true');
echo form_input($data);
?>
</div> -->
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Purchase Order Date</label>
<div class="form-group">
<?php
$data = array('name' => 'PODate', 'value' => set_value('PODate', $PODate), 'id' => 'PODate', 'class' => 'form-control', 'required' => 'true', 'onkeypress' => 'return false;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Mode Of Shipment</label>
<div class="form-group">
<?php
$data = array('name' => 'addmodeofshipment', 'value' => set_value('addmodeofshipment', $Shipmentmode), 'id' => 'addmodeofshipment', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Contact Reference</label>
<div class="form-group">
<?php
$data = array('name' => 'amendsupplierreference', 'value' => set_value('amendsupplierreference', $SupplierRef), 'id' => 'amendsupplierreference', 'class' => 'form-control', 'maxlength' => '40');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Supplier's Offer No</label>
<div class="form-group">
<?php
$data = array('name' => 'amendsupplierofferno', 'value' => set_value('amendsupplierofferno', $SupOfferno), 'id' => 'amendsupplierofferno', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Our Reference(S)</label>
<div class="form-group">
<?php
$data = array('name' => 'amendotherreference', 'value' => set_value('amendotherreference', $Otherref), 'id' => 'amendotherreference', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label for="payablefrom">Import Type Options<span class="badge mandatory">*</span></label>
<?php
//$options1 = array("0"=>'Select Import Option');
if (!empty($PoTypeOptions)) {
foreach ($PoTypeOptions as $payment) :
if ($Importoption == $payment->ConfigValue) {
$options2[$payment->ConfigValue] = $payment->ConfigValue;
}
endforeach;
foreach ($PoTypeOptions as $payment) :
if ($Importoption != $payment->ConfigValue) {
$options2[$payment->ConfigValue] = $payment->ConfigValue;
}
endforeach;
}
echo form_dropdown('Importoption', $options2, set_value('Importoption'), 'id="Importoption"', 'class="form-control"'); ?>
</div>
<div class="col-md-3">
<label for="payablefrom">Payable Terms<span class="badge mandatory">*</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="col-md-3" id="otheroptiondiv" style="display:none;">
<label>Description of Payable Terms<span class="badge mandatory">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'Otherpayment', 'Otherpayment' => set_value('Otherpayment', $Otherpay), 'id' => 'Otherpayment', 'class' => 'form-control', 'required' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label for="payablefrom">Insurance<span class="badge mandatory">*</span></label>
<!-- <select id='Insurance' name='Insurance'>
<?php if ($Insurance == 1) {
$opt1 = 'YES';
$opt2 = 'NO';
} else {
$opt1 = 'NO';
$opt2 = 'YES';
} ?>
<option value="NO"><?php echo $opt1; ?></option>
<option value="YES"><?php echo $opt2; ?></option>
</select> -->
<?php
if ($Insurance == 1) {
$opt1 = 'YES';
$opt2 = 'NO';
} else {
$opt1 = 'NO';
$opt2 = 'YES';
}
$data = array('name' => 'Insurance', 'Insurance' => set_value('Insurance', $opt1), 'id' => 'Insurance', 'class' => 'form-control', 'required' => 'true', 'readonly' => true);
echo form_input($data);
?>
</div>
<div class="col-md-3" id="insurancenum" style="display:none;">
<label>Insurance No / Insurance Details<span class="badge mandatory">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'InsuranceNumber', 'InsuranceNumber' => set_value('InsuranceNumber'), 'id' => 'InsuranceNumber', 'class' => 'form-control', 'required' => 'true', 'readonly' => true);
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label for="BudgetType">Budget Type<span class="badge mandatory">*</span></label>
<select id='BudgetType' name='BudgetType'>
<?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="col-md-3">
</div>
</div>
</div>
<div class="">
<table class="table table-bordered" style="border:1px solid #333">
<div align="right" style="padding-right:10px">
<div align="right">
<!-- <a data-toggle="modal" data-target="#importpomodel" class="btn btn-success" data-dismiss="modal" onclick="myFunction();" >Add Line Item </a> -->
<!--Edit modal body-->
<div id="editimportpomodel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<!-- Modal content-->
<form>
<div class="modal-content" style="width:1000px; font-size: 12px;">
<div class="modal-header">
<center>
<h4>Edit Import Purchase Order Item </h4>
</center>
</div>
<div align="left">
<div class="col-md-12">
<div class="col-md-3">
<label>Req No<span class="badge mandatory">*</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="col-md-3">
<label>Department Name</label>
<div class="form-group">
<?php
$data = array('name' => 'EditdeptName', 'value' => set_value('EditdeptName'), 'id' => 'EditdeptName', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Cost Center Code</label>
<div class="form-group">
<?php
$options = array("0" => 'Select Cost Center');
//echo form_dropdown('EditCostCenter', $options,set_value('EditCostCenter'),'id="EditCostCenter"' ,'class="form-control"');
$data = array('name' => 'EditCostCenter', 'value' => set_value('EditCostCenter'), 'id' => 'EditCostCenter', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3" style="padding-right: 0px;">
<label>Available Budget Amount (<?php echo $INR ?>)</label>
<div class="form-group">
<?php
// $data = array('name' => 'EditAvlBudAmt','value' => set_value('EditAvlBudAmt',),'id'=>'EditAvlBudAmt', 'class' => 'form-control' ,'readonly' => 'true');
// echo form_input($data);
$data = array('name' => 'EditAvlBud', 'value' => set_value('EditAvlBud'), 'id' => 'EditAvlBud', 'class' => 'form-control num', 'readonly' => 'true');
// $data = array('name' => 'EditAvlBudAmt','value' => set_value('EditAvlBudAmt','dsfd'),'id'=>'EditAvlBudAmt', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-2">
<label>Item Code<span class="badge mandatory">*</span></label>
<!--In this item code the value should come from DB , so it getting error , so i am disabling this div , once get the data from DB uncommand this div-->
<div>
<?php
$options = array("0" => 'Item Code');
echo form_dropdown('EditMaterialCode', $options, set_value('EditMaterialCode'), 'id="EditMaterialCode"', 'class="form-control"');
?>
</div>
</div>
<div class="col-md-2">
<label>Item Name</label>
<div class="form-group">
<?php
$data = array('name' => 'EditItemName', 'value' => set_value('EditItemName'), 'id' => 'EditItemName', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>UOM</label>
<div class="form-group">
<?php
$data = array('name' => 'EditUOM', 'value' => set_value('EditUOM'), 'id' => 'EditUOM', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6" style="padding: 0px;">
<div class="col-md-3">
<label>Quantity<span class="badge mandatory">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'EditQuantity', 'value' => set_value('EditQuantity'), 'id' => 'EditQuantity', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange(),ExceedEditQuantityCheck()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3" style="padding-left: 0px;">
<!-- <label>Rate </label> -->
<label id=labelEditRate><?php echo "Rate in $Currencycode ($Value)"; ?><span class="badge mandatory">*</span> </label>
<div class="form-group">
<?php
$data = array('name' => 'EditRate', 'value' => set_value('EditRate'), 'id' => 'EditRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange()');
echo form_input($data);
?>
</div>
</div>
<div class="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="col-md-3" style="padding: 0px;">
<!-- <label><?php echo "Basic Value In"; ?></label>-->
<label id="label3"><?php echo "Basic Value In $Currencycode ($Value)"; ?></label>
<div class="form-group">
<?php
//$data = array('name' => 'imTotalAmount','value' => set_value('imTotalAmount'),'id'=>'imTotalAmount', 'class' => 'form-control' ,'readonly' => 'true');
$data = array('name' => 'EdittxtBasicValue', 'value' => set_value('EdittxtBasicValue'), 'id' => 'EdittxtBasicValue', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<!-- Basic Price in US $ per Ton : -->
<p id="labelEditBasicPriceUs"><b><?php echo "Basic Value in $Currencycode ($Value)" ?></p>
<div class="form-group">
<?php
$data = array('name' => 'EditimBasicPrice', 'value' => set_value('EditimBasicPrice'), 'id' => 'EditimBasicPrice', 'class' => 'form-control num', 'placeholder ' => 'basic price', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<?php echo "Exchange Rate ($Currencycode ($Value))" ?>
<div class="form-group">
<?php
$data = array('name' => 'EditExchangeRt', 'value' => set_value('EditExchangeRt'), 'id' => 'EditExchangeRt', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<!-- Basic value in INR : -->
<label id="labelEditBasicINR"><?php echo "Basic value in ($INR) :"; ?></label>
<div class="form-group">
<?php
$data = array('name' => 'EditINRBasicvalue', 'value' => set_value('EditINRBasicvalue'), 'id' => 'EditINRBasicvalue', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<!--<div class="col-md-3">
<a href="http://www.xe.com/" target="_blank"><u>Click nere to check Today's Foreign Exchange value</u></a>
</div>-->
<div class="col-md-12" style="border:1px solid #000;padding:0px;">
<br />
<div class="col-md-6" style="padding:0px;">
<div class="col-md-12">
<div class="col-md-4">
<!-- Basic Price: -->
<label><?php echo "Basic Price ($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group" style="display:none;">
<?php
$data = array('name' => 'EditBasicPriceTax', 'value' => set_value('EditBasicPriceTax'), 'id' => 'EditBasicPriceTax', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditAfterBasicPriceTax', 'value' => set_value('EditAfterBasicPriceTax'), 'id' => 'EditAfterBasicPriceTax', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<!-- Landing charge -->
<label><?php echo "Landing charge ($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditLandingCharge', 'value' => set_value('EditLandingCharge'), 'id' => 'EditLandingCharge', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateloadingcharge()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditAfterLandingCharge', 'value' => set_value('EditAfterLandingCharge'), 'id' => 'EditAfterLandingCharge', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<!-- High seas sales charge -->
<label><?php echo "Assessable Value (A) ($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group" style="display: none">
<?php
$data = array('name' => 'EditHighseas ', 'value' => set_value('EditHighseas'), 'id' => 'EditHighseas', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateHighseassalescharge()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditAfterAssessable', 'value' => set_value('EditAfterAssessable'), 'id' => 'EditAfterAssessable', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<!-- Custom duty : (a) -->
<label><?php echo "Custom duty (B)($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditCustomduty', 'value' => set_value('EditCustomduty'), 'id' => 'EditCustomduty', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateCustomduty()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditAfterCustomduty', 'value' => set_value('EditAfterCustomduty'), 'id' => 'EditAfterCustomduty', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<!-- Custom ED_cess : (e) -->
<label><?php echo "Custom ED_cess (C) ($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditCustomEDcess', 'value' => set_value('EditCustomEDcess'), 'id' => 'EditCustomEDcess', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateCustomEdcess()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditAfterCustomEDcess', 'value' => set_value('EditAfterCustomEDcess'), 'id' => 'EditAfterCustomEDcess', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<!-- Custom S & H cess : (f) -->
<label><?php echo "Custom S & H cess (D)($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditCustomSHcess', 'value' => set_value('EditCustomSHcess'), 'id' => 'EditCustomSHcess', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateCustomSHcess()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditAfterCustomSHcess', 'value' => set_value('EditAfterCustomSHcess'), 'id' => 'EditAfterCustomSHcess', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="col-md-6" style="padding:0px;">
<div class="col-md-12">
<div class="col-md-4">
<!-- Additional Excise duty : (g) -->
<label><?php echo "Subtotal (E)($INR) (A+B+C+D)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group" style="display: none">
<?php
$data = array('name' => 'EditAdditionalExciseduty ', 'value' => set_value('EditAdditionalExciseduty'), 'id' => 'EditAdditionalExciseduty', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateaddlExciseDuty(),EditCalculateAvlModvat(),EditCalculateGrossExpense()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditSubtotal', 'value' => set_value('EditSubtotal'), 'id' => 'EditSubtotal', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<!-- Additional Excise duty : (g) -->
<label><?php echo "IGST on (E): (F) ($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditIgst ', 'value' => set_value('EditIgst', 0), 'id' => 'EditIgst', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateIgst()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditAfterIgst', 'value' => set_value('EditAfterIgst', 0), 'id' => 'EditAfterIgst', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-8">
<!-- Gross duty payable -->
<label><?php echo "Total Duty (G)($INR) (B+C+D+E)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditGrossdutypayable ', 'value' => set_value('EditGrossdutypayable'), 'id' => 'EditGrossdutypayable', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
?>
</div>
</div>
</div>
<!--Start of Adding of Frieght model-->
<div class="col-md-12" style="padding:0px;">
<div class="col-md-3">
<span>Freight Type </span>
<div>
<?php
$options = array("0" => 'Select Freight Type');
//print_r( $options);
if (!empty($FreightType)) {
foreach ($FreightType as $SID) :
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('drpamendFreight', $options, set_value('drpamendFreight'), 'id="drpamendFreight"', 'class="form-control "');
?>
</div>
</div>
<div class="col-md-3" id="AmendTripsValue" style="display:block;">
<span>NO Of Trips</span>
<div class="form-group">
<?php
$data = array('name' => 'AmendNOOfTrips', 'value' => set_value('AmendNOOfTrips'), 'id' => 'AmendNOOfTrips', 'class' => 'form-control num', 'onchange' => 'calculateFreight(0);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<span>Freight Rate </span>
<div class="form-group">
<?php
$data = array('name' => 'AmendtxtFreight', 'value' => set_value('AmendtxtFreight'), 'id' => 'AmendtxtFreight', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateFreight(0);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3" style="padding-left: 0px;">
<span>Freight Amt In <?php echo $INR; ?></span>
<div class="form-group">
<?php
$data = array('name' => 'AmendtxtAfterFreight', 'value' => set_value('AmendtxtAfterFreight'), 'id' => 'AmendtxtAfterFreight', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<!--End of Adding of freight in edit model -->
<div class="col-md-12">
<center> <label>Cost of the product Per UOM</label></center>
<hr />
</div>
<div class="col-md-12">
<div class="col-md-4">
Duty Impact
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditDutyImpact', 'value' => set_value('EditDutyImpact'), 'id' => 'EditDutyImpact', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4" style="margin-top: -4.8%">
<span>Quantity</span>
<div class="form-group">
<?php
$data = array('name' => 'EditPurQuantity', 'value' => set_value('EditPurQuantity'), 'id' => 'EditPurQuantity', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateCtable()');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<!-- Custom Duty Expenses -->
<label><?php echo "Custom Duty($INR) /UOM"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditCustomDutyExpenses ', 'value' => set_value('EditCustomDutyExpenses'), 'id' => 'EditCustomDutyExpenses', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<!-- RMC Including Customers -->
<label><?php echo "Clearing Charges ($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditClearingCharges', 'value' => set_value('EditClearingCharges'), 'id' => 'EditClearingCharges', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<!-- RMC Including Customers -->
<label><?php echo "Nett per UOM($INR)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'EditNett', 'value' => set_value('EditNett'), 'id' => 'EditNett', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4" style="display:none;">
<!-- Total Amount: -->
</div>
<div class="col-md-4">
<div class="form-group" style="display:none;">
<?php
$data = array('name' => 'EditTotalExp', 'value' => set_value('EditTotalExp'), 'id' => 'EditTotalExp', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<label>Import Description :</label>
<?php
$data = array('name' => 'edittxtInstruction', 'value' => set_value('edittxtInstruction'), 'id' => 'edittxtInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" value="Cancel">Cancel</a>
<a class="btn btn-success font EditImport" ID="EditImport"> &nbsp;&nbsp;<span class="bold">Edit Import</span></a>
<!--<a class="btn btn-success font AddService" ID="AddService" ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add Service</span></a>-->
</div>
</div>
</form>
</div>
</div>
</div>
<br />
<div class="box-body" style="margin-top: -3%;">
<table id="ImportTax" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Name</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate<?php echo $INR ?></th>
<th>Basic Amount<?php echo $INR ?></th>
<!-- <th>Tax Amount</th>
<th>Total Order Amount</th> -->
<th>Action</th>
</tr>
</thead>
<tbody id='ImportAppend'>
<?php
if (!empty($POItem)) {
$index = 0;
foreach ($POItem as $record) {
$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><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td><?php echo $record->Rate ?></td>
<td><?php echo $record->BasicValue ?></td>
<!-- <td><?php echo $record->Taxamount ?></td>
<td><?php echo $record->TotalOrderValue ?></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 'AvlBudAmt'.$index
?>" id="<?php //echo 'AvlBudAmt'.$index
?>" value="<?php //echo $AvlBudAmt;
?>" /> -->
<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 'beforequantity' . $index ?>" id="<?php echo 'beforequantity' . $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 'beforeitemRate' . $index ?>" id="<?php echo 'beforeitemRate' . $index ?>" value="<?php echo $record->Rate; ?>" />
<input type="hidden" name="<?php echo 'LandingCharge' . $index ?>" id="<?php echo 'LandingCharge' . $index ?>" value="<?php echo $record->LandingCharge; ?>" />
<input type="hidden" name="<?php echo 'beforeLandingCharge' . $index ?>" id="<?php echo 'beforeLandingCharge' . $index ?>" value="<?php echo $record->LandingCharge; ?>" />
<input type="hidden" name="<?php echo 'AfterLandingCharge' . $index ?>" id="<?php echo 'AfterLandingCharge' . $index ?>" value="<?php echo $record->AfterLandingCharge; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterLandingCharge' . $index ?>" id="<?php echo 'beforeAfterLandingCharge' . $index ?>" value="<?php echo $record->AfterLandingCharge; ?>" />
<input type="hidden" name="<?php echo 'CustomDuty' . $index ?>" id="<?php echo 'CustomDuty' . $index ?>" value="<?php echo $record->CustomDuty; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomDuty' . $index ?>" id="<?php echo 'beforeCustomDuty' . $index ?>" value="<?php echo $record->CustomDuty; ?>" />
<input type="hidden" name="<?php echo 'AfterCustomDuty' . $index ?>" id="<?php echo 'AfterCustomDuty' . $index ?>" value="<?php echo $record->AfterCustomDuty; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterCustomDuty' . $index ?>" id="<?php echo 'beforeAfterCustomDuty' . $index ?>" value="<?php echo $record->AfterCustomDuty; ?>" />
<input type="hidden" name="<?php echo 'CustomEdCess' . $index ?>" id="<?php echo 'CustomEdCess' . $index ?>" value="<?php echo $record->CustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomEdCess' . $index ?>" id="<?php echo 'CustomEdCess' . $index ?>" value="<?php echo $record->CustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'AfterCustomEdCess' . $index ?>" id="<?php echo 'AfterCustomEdCess' . $index ?>" value="<?php echo $record->AfterCustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterCustomEdCess' . $index ?>" id="<?php echo 'beforeAfterCustomEdCess' . $index ?>" value="<?php echo $record->AfterCustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'ExchangeRate' . $index ?>" id="<?php echo 'ExchangeRate' . $index ?>" value="<?php echo $record->ExchangeRate; ?>" />
<input type="hidden" name="<?php echo 'beforeExchangeRate' . $index ?>" id="<?php echo 'beforeExchangeRate' . $index ?>" value="<?php echo $record->ExchangeRate; ?>" />
<input type="hidden" name="<?php echo 'CustomDutyExpensesPerKG' . $index ?>" id="<?php echo 'CustomDutyExpensesPerKG' . $index ?>" value="<?php echo $record->CustomDutyExpensesPerKG; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomDutyExpensesPerKG' . $index ?>" id="<?php echo 'beforeCustomDutyExpensesPerKG' . $index ?>" value="<?php echo $record->CustomDutyExpensesPerKG; ?>" />
<!-- <input type="hidden" name="<?php echo 'QuantityKG' . $index ?>" id="<?php echo 'QuantityKG' . $index ?>" value="<?php echo $record->QuantityKG; ?>" />
<input type="hidden" name="<?php echo 'beforeQuantityKG' . $index ?>" id="<?php echo 'beforeQuantityKG' . $index ?>" value="<?php echo $record->QuantityKG; ?>" /> -->
<input type="hidden" name="<?php echo 'BasicPriceInMTon' . $index ?>" id="<?php echo 'BasicPriceInMTon' . $index ?>" value="<?php echo $record->BasicPriceInMTon; ?>" />
<input type="hidden" name="<?php echo 'beforeBasicPriceInMTon' . $index ?>" id="<?php echo 'beforeBasicPriceInMTon' . $index ?>" value="<?php echo $record->BasicPriceInMTon; ?>" />
<input type="hidden" name="<?php echo 'ProductPrice' . $index ?>" id="<?php echo 'ProductPrice' . $index ?>" value="<?php echo $record->BasicValue; ?>" />
<input type="hidden" name="<?php echo 'beforeProductPrice' . $index ?>" id="<?php echo 'beforeProductPrice' . $index ?>" value="<?php echo $record->ProductPrice; ?>" />
<input type="hidden" name="<?php echo 'CustomSHCess' . $index ?>" id="<?php echo 'CustomSHCess' . $index ?>" value="<?php echo $record->CustomSHCess; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomSHCess' . $index ?>" id="<?php echo 'beforeCustomSHCess' . $index ?>" value="<?php echo $record->CustomSHCess; ?>" />
<input type="hidden" name="<?php echo 'AfterCustomSHCess' . $index ?>" id="<?php echo 'AfterCustomSHCess' . $index ?>" value="<?php echo $record->AfterCustomSHCess; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterCustomSHCess' . $index ?>" id="<?php echo 'beforeAfterCustomSHCess' . $index ?>" value="<?php echo $record->AfterCustomSHCess; ?>" />
<input type="hidden" name="<?php echo 'QuantityKG' . $index ?>" id="<?php echo 'QuantityKG' . $index ?>" value="<?php echo $record->QuantityKG; ?>" />
<input type="hidden" name="<?php echo 'beforeQuantityKG' . $index ?>" id="<?php echo 'beforeQuantityKG' . $index ?>" value="<?php echo $record->QuantityKG; ?>" />
<input type="hidden" name="<?php echo 'BasicPriceInMTon' . $index ?>" id="<?php echo 'BasicPriceInMTonG' . $index ?>" value="<?php echo $record->BasicPriceInMTon; ?>" />
<input type="hidden" name="<?php echo 'beforeBasicPriceInMTon' . $index ?>" id="<?php echo 'beforeBasicPriceInMTonG' . $index ?>" value="<?php echo $record->BasicPriceInMTon; ?>" />
<input type="hidden" name="<?php echo 'ProductPrice' . $index ?>" id="<?php echo 'ProductPrice' . $index ?>" value="<?php echo $record->ProductPrice; ?>" />
<input type="hidden" name="<?php echo 'beforeProductPrice' . $index ?>" id="<?php echo 'beforeProductPrice' . $index ?>" value="<?php echo $record->ProductPrice; ?>" />
<input type="hidden" name="<?php echo 'CustomEdCess' . $index ?>" id="<?php echo 'CustomEdCess' . $index ?>" value="<?php echo $record->CustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomEdCess' . $index ?>" id="<?php echo 'beforeCustomEdCess' . $index ?>" value="<?php echo $record->CustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'AfterCustomEdCess' . $index ?>" id="<?php echo 'AfterCustomEdCess' . $index ?>" value="<?php echo $record->AfterCustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterCustomEdCess' . $index ?>" id="<?php echo 'beforeAfterCustomEdCess' . $index ?>" value="<?php echo $record->AfterCustomEdCess; ?>" />
<!-- <input type="hidden" name="<?php echo 'Grossdutypayable' . $index ?>" id="<?php echo 'Grossdutypayable' . $index ?>" value="<?php echo $record->Grossdutypayable; ?>" />
<input type="hidden" name="<?php echo 'beforeGrossdutypayable' . $index ?>" id="<?php echo 'beforeGrossdutypayable' . $index ?>" value="<?php echo $record->Grossdutypayable; ?>" /> -->
<input type="hidden" name="<?php echo 'BasicINRValue' . $index ?>" id="<?php echo 'BasicINRValue' . $index ?>" value="<?php echo $record->BasicINRValue; ?>" />
<input type="hidden" name="<?php echo 'beforeBasicINRValue' . $index ?>" id="<?php echo 'beforeBasicINRValue' . $index ?>" value="<?php echo $record->BasicINRValue; ?>" />
<input type="hidden" name="<?php echo 'TotalValue' . $index ?>" id="<?php echo 'TotalValue' . $index ?>" value="<?php echo $record->TotalOrderValue; ?>" />
<input type="hidden" name="<?php echo 'beforeTotalValue' . $index ?>" id="<?php echo 'beforeTotalValue' . $index ?>" value="<?php echo $record->TotalOrderValue; ?>" />
<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 'NoOfTrip' . $index ?>" id="<?php echo 'NoOfTrip' . $index ?>" value="<?php echo $record->NoOfTrip; ?>" />
<input type="hidden" name="<?php echo 'beforeNoOfTrip' . $index ?>" id="<?php echo 'beforeNoOfTrip' . $index ?>" value="<?php echo $record->NoOfTrip; ?>" />
<input type="hidden" name="<?php echo 'FreightValue' . $index ?>" id="<?php echo 'FreightValue' . $index ?>" value="<?php echo $record->FreightValue; ?>" />
<input type="hidden" name="<?php echo 'beforeFreightValue' . $index ?>" id="<?php echo 'beforeFreightValue' . $index ?>" value="<?php echo $record->FreightValue; ?>" />
<input type="hidden" name="<?php echo 'AfterFreightValue' . $index ?>" id="<?php echo 'AfterFreightValue' . $index ?>" value="<?php echo $record->AfterFreightValue; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterFreightValue' . $index ?>" id="<?php echo 'beforeAfterFreightValue' . $index ?>" value="<?php echo $record->AfterFreightValue; ?>" />
<input type="hidden" name="<?php echo 'Per' . $index ?>" id="<?php echo 'Per' . $index ?>" value="<?php echo $record->Per; ?>" />
<input type="hidden" name="<?php echo 'beforePer' . $index ?>" id="<?php echo 'beforePer' . $index ?>" value="<?php echo $record->Per; ?>" />
<input type="hidden" name="<?php echo 'Addinstruction' . $index ?>" id="<?php echo 'Addinstruction' . $index ?>" value="<?php echo $record->ServiceMaterialDescription; ?>" />
<input type="hidden" name="<?php echo 'AssessableValue' . $index ?>" id="<?php echo 'AssessableValue' . $index ?>" value="<?php echo $record->AssessableValue; ?>" />
<input type="hidden" name="<?php echo 'beforeAssessableValue' . $index ?>" id="<?php echo 'beforeAssessableValue' . $index ?>" value="<?php echo $record->AssessableValue; ?>" />
<input type="hidden" name="<?php echo 'SubTotal' . $index ?>" id="<?php echo 'SubTotal' . $index ?>" value="<?php echo $record->SubTotal; ?>" />
<input type="hidden" name="<?php echo 'beforeSubTotal' . $index ?>" id="<?php echo 'beforeSubTotal' . $index ?>" value="<?php echo $record->SubTotal; ?>" />
<input type="hidden" name="<?php echo 'IGST' . $index ?>" id="<?php echo 'IGST' . $index ?>" value="<?php echo $record->IGST; ?>" />
<input type="hidden" name="<?php echo 'beforeIGST' . $index ?>" id="<?php echo 'beforeIGST' . $index ?>" value="<?php echo $record->IGST; ?>" />
<input type="hidden" name="<?php echo 'AfterIGST' . $index ?>" id="<?php echo 'AfterIGST' . $index ?>" value="<?php echo $record->AfterIGST; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterIGST' . $index ?>" id="<?php echo 'beforeAfterIGST' . $index ?>" value="<?php echo $record->AfterIGST; ?>" />
<input type="hidden" name="<?php echo 'DutyImpact' . $index ?>" id="<?php echo 'DutyImpact' . $index ?>" value="<?php echo $record->DutyImpact; ?>" />
<input type="hidden" name="<?php echo 'beforeDutyImpact' . $index ?>" id="<?php echo 'beforeDutyImpact' . $index ?>" value="<?php echo $record->DutyImpact; ?>" />
<input type="hidden" name="<?php echo 'ClearingCharge' . $index ?>" id="<?php echo 'ClearingCharge' . $index ?>" value="<?php echo $record->ClearingCharge; ?>" />
<input type="hidden" name="<?php echo 'beforeClearingCharge' . $index ?>" id="<?php echo 'beforeClearingCharge' . $index ?>" value="<?php echo $record->ClearingCharge; ?>" />
<input type="hidden" name="<?php echo 'NetValue' . $index ?>" id="<?php echo 'NetValue' . $index ?>" value="<?php echo $record->NetValue; ?>" />
<input type="hidden" name="<?php echo 'beforeNetValue' . $index ?>" id="<?php echo 'beforeNetValue' . $index ?>" value="<?php echo $record->NetValue; ?>" />
<input type="hidden" name="<?php echo 'AfterCustomEdCess1' . $index ?>" id="<?php echo 'AfterCustomEdCess1' . $index ?>" value="<?php echo $record->AfterCustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterCustomEdCess1' . $index ?>" id="<?php echo 'beforeAfterCustomEdCess1' . $index ?>" value="<?php echo $record->AfterCustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'CustomEdCess1' . $index ?>" id="<?php echo 'CustomEdCess1' . $index ?>" value="<?php echo $record->CustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomEdCess1' . $index ?>" id="<?php echo 'beforeCustomEdCess1' . $index ?>" value="<?php echo $record->CustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'Grossdutypayable1' . $index ?>" id="<?php echo 'Grossdutypayable1' . $index ?>" value="<?php echo $record->Grossdutypayable; ?>" />
<input type="hidden" name="<?php echo 'beforeGrossdutypayable' . $index ?>" id="<?php echo 'beforeGrossdutypayable' . $index ?>" value="<?php echo $record->Grossdutypayable; ?>" />
<?php
// if($PONOStatus == PO_DRAFT)
// {
?>
<td> <a data-target='#editimportpomodel' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#editimportpomodel"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <?php echo $record->ReqNo; ?> Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> <!-- <a href='#' onclick = "DeleteRow(<?php echo $index; ?>)" class="link" data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>-->
<?php
// } else {
?>
<td> <!-- <a data-toggle="tooltip" href="#"><i class="fa fa-eye" data-toggle="tooltip" title="<?php echo $record->ReqNo; ?> - Click here to view Requistion details"></i>&nbsp;&nbsp;&nbsp;</a> </td> -->
<?php
// }
?>
</tr> <?php
$TotalLanding = $TotalLanding + $record->AfterLandingCharge;
$tothighseas = $tothighseas + $record->AfterHighSeasSalesCharge;
$totcustom = $totcustom + $record->AfterCustomDuty;
$totexciseduty = $totexciseduty + $record->AfterExciseDuty;
$totexcisedutyED = $totexcisedutyED + $record->AfterExciseDutyEdCess;
$totexciseSH = $totexciseSH + $record->AfterExciseDutySHCess;
$totcustomED = $totcustomED + $record->AfterCustomEdCess;
$totcustomSH = $totcustomSH + $record->AfterCustomSHCess;
$totaddtnlexcise = $totaddtnlexcise + $record->AfterAddlExciseDuty;
//$totgrossduty = $totgrossduty + $record->Grossdutypayable;
//$totavlmodvat = $totavlmodvat +$record->AvailableModvat;
$totgrossduty = $totgrossduty + $record->Grossdutypayable;
$totavlmodvat = $totavlmodvat + $record->AvailableModvat;
$totgrossexpense = $totgrossexpense + $record->Grossexpensesduetocustomduty;
$ExchangeRate = $record->ExchangeRate;
$totorder = $totorder + $record->BasicValue;
$totfreight = $totfreight + $record->AfterFreightValue;
//alert($totorder);
$totassesable = $totassesable + $record->AssessableValue;
$totSubtotal = $totSubtotal + $record->SubTotal;
$totigst = $totigst + $record->AfterIGST;
}
$Rowcount = $index;
?>
<?php
$totalhidden = $totorder;
$totorder = number_format($totorder, 2, '.', '');
//echo $to;
$TotalLanding = number_format($TotalLanding, 2, '.', '');
$tothighseas = number_format($tothighseas, 2, '.', '');
$totcustom = number_format($totcustom, 2, '.', '');
$totexciseduty = number_format($totexciseduty, 2, '.', '');
$totexcisedutyED = number_format($totexcisedutyED, 2, '.', '');
$totexciseSH = number_format($totexciseSH, 2, '.', '');
$totcustomED = number_format($totcustomED, 2, '.', '');
$totcustomSH = number_format($totcustomSH, 2, '.', '');
$totaddtnlexcise = number_format($totaddtnlexcise, 2, '.', '');
$totgrossduty = number_format($totgrossduty, 2, '.', '');
$totavlmodvat = number_format($totavlmodvat, 2, '.', '');
$totgrossexpense = number_format($totgrossexpense, 2, '.', '');
$totfreight = number_format($totfreight, 2, '.', '');
$totassesable = number_format($totassesable, 2, '.', '');
$totSubtotal = number_format($totSubtotal, 2, '.', '');
$totigst = number_format($totigst, 2, '.', '');
}
?>
</tbody>
</table>
</div>
<div class="col-md-12" style="border: 1px solid;">
<div class="col-md-12">
<div class="col-md-4">
<label>Total Landing Charge <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotallanding', 'value' => set_value('txttotallanding', $TotalLanding), 'id' => 'txttotallanding', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Total Assessable Value <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotalAssessable', 'value' => set_value('txttotalAssessable', $totassesable), 'id' => 'txttotalAssessable', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Total Custom Duty Charge <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotalcustom', 'value' => set_value('txttotalcustom', $totcustom), 'id' => 'txttotalcustom', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Total Subtotal Charge <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotalSubtotal', 'value' => set_value('txttotalSubtotal', $totSubtotal), 'id' => 'txttotalSubtotal', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Total IGST <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotalIgst', 'value' => set_value('txttotalIgst', $totigst), 'id' => 'txttotalIgst', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Total Custom ED_cess Charge <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotalcustomED', 'value' => set_value('txttotalcustomED', $totcustomED), 'id' => 'txttotalcustomED', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Total Custom S & H cess Charge <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotalcustomSH', 'value' => set_value('txttotalcustomSH', $totcustomSH), 'id' => 'txttotalcustomSH', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Total Gross duty payable Charge <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotalgrossduty', 'value' => set_value('txttotalgrossduty', $totgrossduty), 'id' => 'txttotalgrossduty', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Total Freight Value </label> <?php
$data = array('name' => 'txtTotalFreight', 'value' => set_value('txtTotalFreight', $totfreight), 'id' => 'txtTotalFreight', 'class' => 'form-control', 'required' => 'true', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<input type="hidden" name="txttotamend" id="txttotamed" value=<?php echo $totorder; ?>>
<div class="col-md-4">
<label>Total Order Value <?php echo "($Value)" ?></label> <?php
$data = array('name' => 'txtToatlOrder', 'value' => set_value('txtToatlOrder', $totorder), 'id' => 'txtToatlOrder', 'class' => 'form-control', 'required' => 'true', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<input type="hidden" name="txttot" id="txttot" value=<?php echo $totalhidden; ?>>
<div class="col-md-12">
<div class="col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
</div>
</div>
<div align="right" style="padding-right:10px">
<div class="col-md-5 col-md-offset-7" 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>
<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="txtPONO" id="txtPONO" value="<?php echo $PONO; ?>" />
<input type="hidden" name="txtTotalorderValue" id="txtTotalorderValue" />
<input type="hidden" name="beforePlaceOforigin" id="beforePlaceOforigin" value="<?php echo $Import_PlaceofOrgin; ?>" />
<input type="hidden" name="beforePaymentterms" id="beforePaymentterms" value="<?php echo $PaymentTerms; ?>" />
<!-- <input type="hidden" name="beforeschedule" id="beforeschedule" value="<?php echo $DeliverySchedule; ?>" />
<input type="hidden" name="beforeDispatch" id="beforeschedule" value="<?php echo $Import_DispatchDetails; ?>" /> -->
<?php //if($PONOStatus == PO_DRAFT) {
?>
<!-- <a class="btn btn-success Save" ID="Save" onclick="Save(0)" >&nbsp;&nbsp;<span class="bold">Save</span></a> -->
<a class="btn btn-cancel Save" ID="Cancel" href="<?php echo base_url() . 'amendmentpurchaseorder'; ?>">&nbsp;&nbsp;<span class="bold">Cancel</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<!-- <input type="reset" class="btn btn-success" value="Reset"> -->
<?php //}else {
?>
<!-- <input type="reset" class="btn btn-success" value = "OK"> <?php //}
?>-->
<br />
</div>
</div>
</div>
<label>Request On :</label><?php echo $Reqon; ?><br />
<label>Request By :</label><?php echo $RequesterName; ?><br />
<!--<label>Status :</label><?php echo $StatusName; ?>-->
<label>Status : </label><?php
$statusMappings = [
'PO APPROVED' => 'AWAITING APPROVE',
'AWAITING RELEASE' => 'AWAITING APPROVE',
'RELEASER ONHOLD' => 'APPROVER ONHOLD',
'PO RELEASED' => 'PO APPROVED',
];
if (isset($StatusName) && !empty($StatusName)) {
if (isset($statusMappings[$StatusName])) {
echo $statusMappings[$StatusName];
} else {
echo $StatusName;
}
} else {
echo "Status not provided";
}
?>
</div>
</div>
</section>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#Date').click(function() {
//for Date range selection
$('#Schedulediv').hide();
$('#Deliverydtdiv').show();
});
$('#Schedule').click(function() {
//for schedule range selection
$('#Deliverydtdiv').hide();
$('#Schedulediv').show();
});
});
var SelectedMaterialCode = [];
var RequistQuantity = '';
var AvilBudAmt = '';
var CollIndex = 0;
var index = '1';
var userid = '';
var NilType = '<?php echo NILTYPE; ?>';
var PercentageType = '<?php echo PERCENTAGE; ?>';
var IsEdit = '0';
var SelectedMaterialList = {
Mat: []
};
$('#BudgetType').attr("style", "pointer-events: none;");
$('#Insurance').change(function() {
//var insure=$('#Insurance').val();
var insure = $("#Insurance :selected").text();
//console.log(insure);
if (insure == 'YES') {
$('#insurancenum').show();
} else {
$('#insurancenum').hide();
}
});
$('#Importoption').attr("style", "pointer-events: none;");
var insureoption = <?php echo json_encode($Insurance, JSON_PRETTY_PRINT) ?>;
var insureno = <?php echo json_encode($InsuranceNumber, JSON_PRETTY_PRINT) ?>;
//console.log(insureoption);
// $('#insurancenum').attr("style", "pointer-events: none;");
// $('#InsuranceNumber').attr("style", "pointer-events: none;");
if (insureoption == 1) {
$('#insurancenum').show();
$('#InsuranceNumber').val(insureno);
$('#Insurance').val('YES');
} else {
$('#Insurance').val('NO');
$('#insurancenum').hide();
}
var paymentoption = <?php echo json_encode($PaymentTerms, JSON_PRETTY_PRINT) ?>;
var payvalue = <?php echo json_encode($Otherpay, JSON_PRETTY_PRINT) ?>;
//alert(payvalue);
if (paymentoption == 'PT08') {
$('#otheroptiondiv').show();
$('#Otherpayment').val(payvalue);
}
var AvlBudAmt = '<?php echo $AvlAmount ?>';
//alert(AvlBudAmt);
//$('#EditAvlBud').val(AvlBudAmt);
var budamt = <?php echo $AvilableBudget; ?>;
//$('#EditAvlBud').val(<?php echo $AvilableBudget ?>);
$('#EditAvlBud').val(parseFloat(budamt).toFixed(2));
//$('#EditAvlBudAmt').val(<?php echo $AvlAmount; ?>);
var delivery = <?php echo json_encode($DeliveryOption, JSON_PRETTY_PRINT) ?>;
if (delivery == 1) {
document.getElementById("Schedule").checked = true;
$('#Deliverydtdiv').hide();
$('#Schedulediv').show();
} else {
document.getElementById("Date").checked = true;
$('#Deliverydtdiv').show();
$('#Schedulediv').hide();
}
var txtexchangerate = parseFloat($('#ExchangeRate').val());
$('#EditExchangeRt').val(parseFloat(txtexchangerate).toFixed(2));
var txtbasics = parseFloat($('#BasicPriceInMTon').val());
var basicpriceinus = parseFloat($('#BasicPriceinUS').val());
var txtbasic = txtexchangerate * basicpriceinus;
$('#EditINRBasicvalue').val(txtbasic);
$('#currencytype').change(function() {
var id = $('#currencytype').val();
var symbol = <?php echo json_encode($Currency, JSON_PRETTY_PRINT) ?>;
$.each(symbol, function(idx, obj) {
if (obj.Currency_Code == id) {
var sign = obj.FontCode2000;
var code = obj.Currency_Code;
document.getElementById("label1").innerHTML = 'Exchange Rate in ' + code + '(' + sign + ')';
document.getElementById("label2").innerHTML = 'Basic Value in ' + code + '(' + sign + ')';
document.getElementById("label3").innerHTML = 'Basic Value in ' + code + '(' + sign + ')';
document.getElementById("labelRate").innerHTML = 'Rate in ' + code + '(' + sign + ')';
document.getElementById("labelBasicpriceus").innerHTML = 'Basic Price In ' + code + '(' + sign + ')' + ' per Ton';
document.getElementById("labelBasicINR").innerHTML = 'Basic Price in INR:' + code + '(' + sign + ')';
document.getElementById("labelEditRate").innerHTML = 'Rate in ' + sign;
document.getElementById("labelEditBasicPriceUs").innerHTML = 'Basic Price In ' + code + '(' + sign + ')' + ' per Ton';
document.getElementById("labelEditBasicINR").innerHTML = 'Basic Price in INR:' + code + '(' + sign + ')';
}
});
});
$('#drpSupplier').change(function() {
var id = $('#drpSupplier').val();
$("#SupAddress").val('');
if (id != '0') {
var y = <?php echo json_encode($Suplist, JSON_PRETTY_PRINT) ?>;
var Payment = <?php echo json_encode($Payment, 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);
}
PaymentID = obj.PaymentID;
//$("#PayableAT").val(obj.PayableAT);
var a = obj.PaymentDays;
//console.log(a);
}
});
if (PaymentID == 'PT08') {
$('#otheroptiondiv').show();
$('#Otherpayment').val('');
} else {
$('#otheroptiondiv').hide();
$('#Otherpayment').show();
}
$('#PaymentTerms').empty();
var paymentList = <?php echo json_encode($Payment, JSON_PRETTY_PRINT) ?>;
$.each(paymentList, function(pay, payobj)
{
if (payobj.PaymentID == PaymentID) {
$("#PaymentTerms").append($('<option></option>').val(payobj.PaymentID).html(payobj.PaymentTerms));
}
});
$.each(Payment, function(pay, payobj) {
if (payobj.PaymentID == PaymentID) {
} else {
$("#PaymentTerms").append($('<option></option>').val(payobj.PaymentID).html(payobj.PaymentTerms));
}
});
} else {
alert('Please select the SupplierID');
return false;
}
});
$('#currencytype').change(function() {
$('#ExchangeRate').val('');
});
$('#ReqNo').change(function() {
var id = $('#ReqNo').val();
$("#AvlBudAmt").val('');
$("#CostCenter").empty();
$("#MaterialCode").empty();
$("#deptName").val('');
$("#UOM").val('');
$("#Quantity").val('');
$("#ItemName").val('');
$("#Rate").val('');
$("#txtBasicValue").val('');
//clearTaxField();
if (id != '0') {
var y = <?php echo json_encode($RequistionDetails, JSON_PRETTY_PRINT) ?>;
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// console.log(Material);
//var AvlBudAmt = '<?php echo $AvlAmount ?>';
//alert(JSON.stringify(Material));
// For Binding DepartmentName
$.each(y, function(idx, obj) {
if (obj.ReqNo === id) {
$("#deptName").val(obj.DepartmentName);
$("#CostCenter").val(obj.CostCenterCode);
}
});
//$("#EditAvlBudAmt").val(AvlBudAmt);
// For Binding Material list center for the selected Requistion Number
$("#MaterialCode").append($('<option></option>').val("0").html("Select Material Code"));
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) {
//alert();
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") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
});
}
} else {
alert('Please select the Requisition Number');
return false;
}
id = '';
});
$('#MaterialCode').change(function() {
var id = $('#MaterialCode').val();
$("#ItemName").val('');
$("#UOM").val('');
$("#Quantity").val('');
$("#ItemName").val('');
$("#Rate").val('');
$("#txtBasicValue").val('');
RequistQuantity = '';
//clearTaxField();
if (id != '0') {
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) {
if (obj.MaterialCode === id) {
$("#ItemName").val(obj.MaterialName);
$("#UOM").val(obj.UOM);
$("#Quantity").val(obj.Quantity);
RequistQuantity = obj.Quantity;
}
});
}
var d = $('#drpSupplier').val();
$.ajax({
url: "<?php echo base_url() ?>VerifyWithSupplierForPendingPO",
type: 'POST',
data: {
supplierid: d,
materialcode: id
},
success: function(response) {
if (response) alert(response);
}
});
} else {
alert('Please select the MaterialCode');
return false;
}
var d = $('#drpSupplier').val();
});
function USRate() {
var txtbasics = parseFloat($('#imBasicPrice').val());
var txtexchangerate = parseFloat($('#ExchangeRate').val());
$('#ExchangeRt').val(txtexchangerate);
var txtINRvalue = txtbasics * txtexchangerate;
$('#INRBasicvalues').val(txtINRvalue)
$('#INRBasicvalue').val(txtINRvalue);
$('#BasicPriceTax').val(txtINRvalue);
txtINR = Math.round(txtINRvalue);
$('#AfterBasicPriceTax').val(txtINR);
$('#imBasicPrice').val(txtbasics);
$('#ExchangeRt').val(txtexchangerate);
$('#EditAfterBasicPriceTax').val(txtINR);
$('#EditimBasicPrice').val(parseFloat(txtbasics).toFixed(2));
$('#EditExchangeRt').val(parseFloat(txtexchangerate).toFixed(2));
$('#EditINRBasicvalue').val(parseFloat(txtINRvalue).toFixed(2));
}
function EditQtyZerocheck() {
if (($('#EditRate').val() == "0") || $('#EditQuantity').val() == "0" || ($('#EditRate').val() == '') || $('#EditQuantity').val() == '') {
alert('Please Enter A Valid Number for Rate and Quantity');
$('#EdittxtBasicValue').val(0);
$('#EditimBasicPrice').val(0);
var txtexchangerate = parseFloat($('#ExchangeRate').val());
$('#EditExchangeRt').val(parseFloat(txtexchangerate).toFixed(2));
$('#EditINRBasicvalues').val(0);
$('#EditAfterBasicPriceTax').val(0);
$('#EditINRBasicvalue').val(0);
return false;
} else
return true;
}
function EditRatechange() { //alert('in');
if (EditQtyZerocheck()) {
var txteditQuantity = parseFloat($('#EditQuantity').val() == '' ? '0.00' : $('#EditQuantity').val());
//var txteditUnitPrice=parseFloat($('#EditRate').val());
var txteditUnitPrice = parseFloat($('#EditRate').val() == '' ? '0.00' : $('#EditRate').val());
var editTot = txteditQuantity * txteditUnitPrice
$('#EdittxtBasicValue').val(parseFloat(editTot).toFixed(2));
$(EditimBasicPrice).val(parseFloat(editTot).toFixed(2));
var exchangerate = parseFloat($('#EditExchangeRt').val());
var txtINR = editTot * exchangerate;
$('#EditINRBasicvalue').val(parseFloat(txtINR).toFixed(2));
$('#EditBasicPriceTax').val(parseFloat(txtINR).toFixed(2));
$('#EditAfterBasicPriceTax').val(parseFloat(txtINR).toFixed(2));
calculateFreight(1);
EditCalculateloadingcharge();
}
}
function Ratechange() {
//alert();
if ($('#ReqNo').val() == "0") {
alert('Please select the Requisition Number');
$('#ReqNo').focus();
return false;
} else if ($('#MaterialCode').val() == "0") {
alert('Please select the Material Code');
$('#MaterialCode').focus();
return false;
} else if ($('#CostCenter').val() == "0") {
alert('Please select the CostCenterCode');
$('#CostCenter').focus();
return false;
}
//ExceedQuantityCheck();
if ($('#Quantity').val() != '' && $('#Rate').val() != '') {
var txtQuantity = parseFloat($('#Quantity').val());
var txtUnitPrice = parseFloat($('#Rate').val());
var Tot = txtQuantity * txtUnitPrice
$('#txtBasicValue').val(Tot);
}
}
function Calculateloadingcharge() {
//alert();
$('#AfterHighseas').val('');
$('#AfterCustomduty').val('');
$('#AfterExcisedutyTax').val('');
$('#AfterExcisedutyEDcess').val('');
$('#AfterExcisedutySHcess').val('');
$('#AfterCustomEDcess').val('');
$('#AfterCustomSHcess').val('');
$('#AfterAdditionalExciseduty').val('');
$('#Grossdutypayable').val('');
$('#AvailableModvat').val('');
$('#Grossexpenses').val('');
$('#purchaserate').val('');
$('#CustomDutyExpenses').val('');
$('#RMCIncludingCustomers').val('');
$('#TotalExp').val('');
var txtlanding = 0;
var txtbasicprice = 0;
txtlanding = parseFloat($('#LandingCharge').val());
txtbasicprice = parseFloat($('#AfterBasicPriceTax').val());
//var result=(txtlanding*txtbasicprice/100);
var result = <?php echo LOADING_CHARGE; ?>;
$('#AfterLandingCharge').val(result.toFixed(2));
CalculateHighseassalescharge();
//alert();
}
function EditCalculateloadingcharge() {
var txtlanding = 0;
var txtbasicprice = 0;
var asss = 0;
txtlanding = parseFloat($('#EditLandingCharge').val() == '' ? '0.00' : $('#EditLandingCharge').val());
//txtlanding=parseFloat($('#EditLandingCharge').val());
//txtbasicprice=parseFloat($('#EditAfterBasicPriceTax').val());
txtbasicprice = parseFloat($('#EditAfterBasicPriceTax').val() == '' ? '0.00' : $('#EditAfterBasicPriceTax').val());
// console.log(txtbasicprice);
var result = <?php echo LOADING_CHARGE; ?>;
//console.log(result);
asss = result;
//console.log(asss);
// var Assessable= <?php echo ASSESSBLE; ?>;
var Assessable = parseFloat(txtbasicprice) + parseFloat(asss);
$('#EditAfterLandingCharge').val(result.toFixed(2));
$('#EditAfterAssessable').val(Assessable);
EditCalculateCustomduty();
}
function ExceedEditQuantityCheck() {
// RequistQuantity
var EnterQuantity = $("#EditQuantity").val() == '' ? "0.00" : parseFloat($("#EditQuantity").val());
var ReqQuantity = parseFloat(RequistQuantity);
if (EnterQuantity > ReqQuantity) {
alert('Your exceeding the Quantity from the Requisition Quantity:' + RequistQuantity + '.Please adjust the Quantity to proceed further.');
$('#EditQuantity').focus();
return false;
} else {
return true;
}
}
function EditCalculateCustomduty() {
var txtbasic = 0;
var txtcustompercentage = 0;
var txthighse = 0;
var txtlandingch = 0;
var sumcustom = 0;
var txtcustomduty = 0;
//var accessible=parseFloat($('#EditAfterAssessable').val());
var accessible = parseFloat($('#EditAfterAssessable').val() == '' ? '0.00' : $('#EditAfterAssessable').val());
// var txtcustompercentage=parseFloat($('#EditCustomduty').val());
var txtcustompercentage = parseFloat($('#EditCustomduty').val() == '' ? '0.00' : $('#EditCustomduty').val());
//sumcustom=txthighse+txtlandingch+txtbasic;
txtcustomduty = <?php echo CUSTOM_DUTY1; ?>;
if (isNaN(txtcustomduty)) {
$('#EditAfterCustomduty').val('');
} else {
$('#EditAfterCustomduty').val(parseFloat(txtcustomduty).toFixed(2));
}
EditCalculateCustomEdcess();
}
function EditCalculateCustomEdcess() {
var txtloading = 0;
var txthighses = 0;
var txtcustomduty1 = 0;
var txtexciseduty = 0;
var txtedexciseduty = 0;
var txtshexcisesess = 0;
var totalval = 0;
var txtedcesspercentage = 0;
//var txtcustomedsess=(totalval*txtedcesspercentage)/100;
var txtcustomedsess = 0;
//txtcustomduty1=parseFloat($('#EditAfterCustomduty').val());
//txtedcesspercentage=parseFloat($('#EditCustomEDcess').val());
//var txtcustomedsess=(totalval*txtedcesspercentage)/100;
txtcustomduty1 = parseFloat($('#EditAfterCustomduty').val() == '' ? '0.00' : $('#EditAfterCustomduty').val());
// txtedcesspercentage=parseFloat($('#CustomEDcess').val());
txtedcesspercentage = parseFloat($('#EditCustomEDcess').val() == '' ? '0.00' : $('#EditCustomEDcess').val());
txtcustomedsess = <?php echo CUSTOM_ED1; ?>;
if (isNaN(txtcustomedsess)) {
$('#EditAfterCustomEDcess').val('');
} else {
$('#EditAfterCustomEDcess').val(parseFloat(txtcustomedsess).toFixed(2));
}
EditCalculateCustomSHcess();
}
function EditCalculateCustomSHcess() { //alert();
var landingch = 0;
var highsesssalles = 0;
var customch = 0;
var excisech = 0;
var exciseedch = 0;
var exciseshch = 0;
var totcustomsh = 0;
var txtshpercentage = 0;
//var totresult=(totcustomsh*txtshpercentage)/100;
var totresult = 0;
var basucprice = $('#AfterBasicPriceTax').val() == '' ? '0.00' : $('#AfterBasicPriceTax').val()
//landingch=parseFloat($('#EditAfterLandingCharge').val());
landingch = $('#EditAfterLandingCharge').val() == '' ? '0.00' : $('#EditAfterLandingCharge').val()
//highsesssalles=parseFloat($('#EditAfterHighseas').val());
// customch=parseFloat($('#EditAfterCustomduty').val());
customch = $('#EditAfterCustomduty').val() == '' ? '0.00' : $('#EditAfterCustomduty').val()
//excisech=parseFloat($('#EditAfterExcisedutyTax').val());
totcustomsh = landingch + highsesssalles + customch + excisech + exciseedch + exciseshch;
//txtshpercentage=parseFloat($('#EditCustomSHcess').val());
txtshpercentage = $('#EditCustomSHcess').val() == '' ? '0.00' : $('#EditCustomSHcess').val()
//var totresult=(totcustomsh*txtshpercentage)/100;
var totresult = <?php echo CUSTOM_SH1; ?>;
if (isNaN(totresult)) {
$('#EditAfterCustomSHcess').val('');
} else {
$('#EditAfterCustomSHcess').val(parseFloat(totresult).toFixed(2));
}
//EditCalculateaddlExciseDuty();
EditCalculateIgst()
}
function EditCalculateIgst() {
// var custom=parseFloat($('#EditAfterCustomduty').val());
// var customsh=parseFloat($('#EditAfterCustomSHcess').val());
// var customed=parseFloat($('#EditAfterCustomEDcess').val());
// var assessble=parseFloat($('#EditAfterAssessable').val());
var custom = parseFloat($('#EditAfterCustomduty').val() == '' ? '0.00' : $('#EditAfterCustomduty').val());
var customsh = parseFloat($('#EditAfterCustomSHcess').val() == '' ? '0.00' : $('#EditAfterCustomSHcess').val());
var customed = parseFloat($('#EditAfterCustomEDcess').val() == '' ? '0.00' : $('#EditAfterCustomEDcess').val());
var assessble = parseFloat($('#EditAfterAssessable').val() == '' ? '0.00' : $('#EditAfterAssessable').val());
var tot = <?php echo SUBTOTAL; ?>;
//console.log(tot);
//var igstpercentage=parseFloat($('#EditIgst').val());
var igstpercentage = $('#EditIgst').val() == '' ? '0.00' : $('#EditIgst').val()
var afterigst = <?php echo IGST; ?>;
if (isNaN(tot)) {
$('#EditSubtotal').val('');
} else {
$('#EditSubtotal').val(parseFloat(tot).toFixed(2));
}
if (isNaN(afterigst)) {
$('#EditAfterIgst').val('');
} else {
$('#EditAfterIgst').val(parseFloat(afterigst).toFixed(2));
}
var grossexp = custom + customsh + customed + afterigst;
var txtgrossduty = <?php echo GROSS_DUTY1; ?>;
;
if (isNaN(txtgrossduty)) {
$('#EditGrossdutypayable').val('');
} else {
$('#EditGrossdutypayable').val(parseFloat(txtgrossduty).toFixed(2));
}
EditCalculateCtable()
}
function EditCalculateCtable() {
//alert();
var quantity = 0;
var txtbasicinrprice = 0;
var txtpurchaserate = 0;
var txtgrossexp = 0;
var txtcustomdutyexp = 0;
var txtrmc = 0;
var total = 0;
var basicamt = 0;
var qty = parseFloat($('#EditQuantity').val());
var igst = parseFloat($('#EditAfterIgst').val());
var totduty = parseFloat($('#EditGrossdutypayable').val());
var txtdutyimpact = <?php echo DUTYIMPACT; ?>;
// console.log(txtdutyimpact);
if (isNaN(txtdutyimpact)) {
$('#EditDutyImpact').val('');
} else {
$('#EditDutyImpact').val(parseFloat(txtdutyimpact).toFixed(2));
}
quantity = parseFloat($('#EditPurQuantity').val());
var dutyimpact = parseFloat($('#EditDutyImpact').val());
var peruom = <?php echo PURCHASE_RATE1; ?>;
if (isNaN(peruom)) {
$('#EditCustomDutyExpenses').val('');
} else {
$('#EditCustomDutyExpenses').val((peruom).toFixed(2));
}
var customdutyexp = $('#EditCustomDutyExpenses').val() == '' ? '0.00' : $('#EditCustomDutyExpenses').val();
var basicqtyval = $('#EditAfterBasicPriceTax').val() == '' ? '0.00' : $('#EditAfterBasicPriceTax').val();
var qty = parseFloat($('#EditQuantity').val());
var clearing = $('#EditClearingCharges').val() == '' ? '0.00' : $('#EditClearingCharges').val();
var basicres = <?php echo MATBYQTY; ?>;
var clear = <?php echo CLEARINGQTY; ?>;
var basicnett = parseFloat(basicres) + parseFloat(clear) + parseFloat(customdutyexp);
if (isNaN(basicnett)) {
$('#EditNett').val('');
} else {
$('#EditNett').val((basicnett).toFixed(2));
}
}
function validateImport() {
//alert();
if ($('#ReqNo').val() == "0") {
alert('Please select the Requisition Number');
$('#ReqNo').focus();
return false;
} else if ($('#CostCenter').val() == "0") {
alert('Please select the Cost center');
$('#CostCenter').focus();
return false;
} else if ($('#MaterialCode').val() == "0") {
alert('Please select the Material Code');
$('#MaterialCode').focus();
return false;
} else if ($('#Quantity').val() == '') {
alert('Please Enter the Quantity value');
$('#Quantity').focus();
return false;
} else if ($('#Rate').val() == '') {
alert('Please Enter the Rate of the Item');
$('#Rate').focus();
return false;
} else if ($('#imBasicPrice').val() == '') {
alert('Please Enter Basic Price In Us');
$('#imBasicPrice').focus();
return false;
}
/* else if(ExceedQuantityCheck() == false)
{
return false;
}*/
else
return true;
}
function populateValueMainFormForImportTax() {
//$('#txtToatlOrder').val(parseFloat(TotalOrderValue)).toFixed(2);
var AfterLandingCharge = $('#AfterLandingCharge').val() == '' ? '0.00' : $('#AfterLandingCharge').val();
var AfterHighseas = $('#AfterHighseas').val() == '' ? '0.00' : $('#AfterHighseas').val();
var AfterCustomduty = $('#AfterCustomduty').val() == '' ? '0.00' : $('#AfterCustomduty').val();
var AfterExcisedutyTax = $('#AfterExcisedutyTax').val() == '' ? '0.00' : $('#AfterExcisedutyTax').val();
var AfterExcisedutyEDcess = $('#AfterExcisedutyEDcess').val() == '' ? '0.00' : $('#AfterExcisedutyEDcess').val();
var AfterExciseDutySH = $("#AfterExcisedutySHcess").val() == '' ? '0.00' : $('#AfterExcisedutySHcess').val();
var AfterCustomEDcess = $('#AfterCustomEDcess1').val() == '' ? '0.00' : $('#AfterCustomEDcess1').val();
var AfterCustomSHcess = $('#AfterCustomSHcess').val() == '' ? '0.00' : $('#AfterCustomSHcess').val();
var AfterAdditionalExciseduty = $('#AfterAdditionalExciseduty').val() == '' ? '0.00' : $('#AfterAdditionalExciseduty').val();
var Grossdutypayable = $('#Grossdutypayable').val() == '' ? '0.00' : $('#Grossdutypayable').val();
var AvailableModvat = $('#AvailableModvat').val() == '' ? '0.00' : $('#AvailableModvat').val();
var Grossexpenses = $('#Grossexpenses').val() == '' ? '0.00' : $('#Grossexpenses').val();
var totalexp = $('#TotalExp').val() == '' ? '0.00' : $('#TotalExp').val();
var TotalLanding = $('#txttotallanding').val() == '' ? '0.00' : $('#txttotallanding').val();
var TotalHighseas = $('#txttotalhighseas').val() == '' ? '0.00' : $('#txttotalhighseas').val();
var TotalCustom = $('#txttotalcustom').val() == '' ? '0.00' : $('#txttotalcustom').val();
var TotalExcise = $('#txttotalexcise').val() == '' ? '0.00' : $('#txttotalexcise').val();
var TotalExciseED = $('#txttotalexciseED').val() == '' ? '0.00' : $('#txttotalexciseED').val();
var TotalExciseSH = $('#txttotalexciseSH').val() == '' ? '0.00' : $('#txttotalexciseSH').val();
var TotalCustomED = $('#txttotalcustomED').val() == '' ? '0.00' : $('#txttotalcustomED').val();
var TotalCustomSH = $('#txttotalcustomSH').val() == '' ? '0.00' : $('#txttotalcustomSH').val();
var TotalAdditionalExcise = $('#txttotalAdditionalExciseduty').val() == '' ? '0.00' : $('#txttotalAdditionalExciseduty').val();
var TotalGrossDuty = $('#txttotalgrossduty').val() == '' ? '0.00' : $('#txttotalgrossduty').val();
var TotalAvlmodvat = $('#txttotalavlmodvat').val() == '' ? '0.00' : $('#txttotalavlmodvat').val();
var TotalGrossExpense = $('#txttotalgrossexpense').val() == '' ? '0.00' : $('#txttotalgrossexpense').val();
var TotalOrder = $('#txtToatlOrder').val() == '' ? '0.00' : $('#txtToatlOrder').val();
$('#txttotallanding').val((parseFloat(AfterLandingCharge) + parseFloat(TotalLanding)).toFixed(2));
$('#txttotalhighseas').val((parseFloat(TotalHighseas) + parseFloat(AfterHighseas)).toFixed(2));
$('#txttotalcustom').val((parseFloat(TotalCustom) + parseFloat(AfterCustomduty)).toFixed(2));
$('#txttotalexcise').val((parseFloat(TotalExcise) + parseFloat(AfterExcisedutyTax)).toFixed(2));
$('#txttotalexciseED').val((parseFloat(TotalExciseED) + parseFloat(AfterExcisedutyEDcess)).toFixed(2));
$('#txttotalexciseSH').val((parseFloat(TotalExciseSH) + parseFloat(AfterExciseDutySH)).toFixed(2));
$('#txttotalcustomED').val((parseFloat(TotalCustomED) + parseFloat(AfterCustomEDcess)).toFixed(2));
$('#txttotalcustomSH').val((parseFloat(TotalCustomSH) + parseFloat(AfterCustomSHcess)).toFixed(2));
$('#txttotalAdditionalExciseduty').val((parseFloat(TotalAdditionalExcise) + parseFloat(AfterAdditionalExciseduty)).toFixed(2));
$('#txttotalgrossduty').val((parseFloat(TotalGrossDuty) + parseFloat(Grossdutypayable)).toFixed(2));
$('#txttotalavlmodvat').val((parseFloat(TotalAvlmodvat) + parseFloat(AvailableModvat)).toFixed(2));
$('#txttotalgrossexpense').val((parseFloat(TotalGrossExpense) + parseFloat(Grossexpenses)).toFixed(2));
$('#txtToatlOrder').val((parseFloat(TotalOrder) + parseFloat(totalexp)).toFixed(2));
$('#txttot').val((parseFloat(TotalOrder) + parseFloat(totalexp)).toFixed(2));
}
$('#editimportpomodel').on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
// alert('test'+userid);
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($('#AvilBudget' + userid).val());
$('#EditItemName').val($('#materialName' + userid).val());
$('#EditUOM').val($('#uom' + userid).val());
$('#EditQuantity').val($('#quantity' + userid).val());
//RequistQuantity = $('#quantity'+userid).val();
$('#EditRate').val($('#itemRate' + userid).val());
var q = parseFloat($('#quantity' + userid).val());
// console.log(q);
var r = parseFloat($('#itemRate' + userid).val());
//console.log(r);
var as = q * r;
$('#EdittxtBasicValue').val(parseFloat(as).toFixed(2));
$('#EditimBasicPrice').val(parseFloat(as).toFixed(2));
// $('#EdittxtBasicValue').val($('#ProductPrice'+userid).val());
// $('#EditimBasicPrice').val($("#ProductPrice"+userid).val());
var a = parseFloat($('#EdittxtBasicValue').val())
var b = parseFloat($('#ExchangeRate').val());
var c = a * b;
//console.log(c);
$('#EditINRBasicvalue').val(parseFloat(c).toFixed(2));
$('#EditAfterBasicPriceTax').val(parseFloat(c).toFixed(2));
$('#EditLandingCharge').val($("#LandingCharge" + userid).val());
$('#EditAfterLandingCharge').val($("#AfterLandingCharge" + userid).val());
$('#EditCustomduty').val($("#CustomDuty" + userid).val());
$('#EditAfterCustomduty').val($("#AfterCustomDuty" + userid).val());
$('#EditCustomEDcess').val($("#CustomEdCess1" + userid).val());
$('#EditAfterCustomEDcess').val($("#AfterCustomEdCess1" + userid).val());
$('#EditCustomSHcess').val($("#CustomSHCess" + userid).val());
$('#EditAfterCustomSHcess').val($("#AfterCustomSHCess" + userid).val());
$('#EditGrossdutypayable').val($("#Grossdutypayable1" + userid).val());
$('#EditPurQuantity').val($("#QuantityKG" + userid).val());
$('#EditCustomDutyExpenses').val($("#CustomDutyExpensesPerKG" + userid).val());
//$('#EditAfterBasicPriceTax').val($("#BasicINRValue"+userid).val());
$('#EditTotalExp').val($("#TotalValue" + userid).val());
//$('#EditINRBasicvalue').val($("#BasicINRValue"+userid).val());
$('#EditAfterAssessable').val($("#AssessableValue" + userid).val());
$('#EditSubtotal').val($("#SubTotal" + userid).val());
$('#EditIgst').val($("#IGST" + userid).val());
$('#EditAfterIgst').val($("#AfterIGST" + userid).val());
$('#EditDutyImpact').val($("#DutyImpact" + userid).val());
$('#EditNett').val($("#NetValue" + userid).val());
$('#EditClearingCharges').val($("#ClearingCharge" + userid).val());
$('#drpamendFreight').val($("#FreightType" + userid).val());
$('#AmendNOOfTrips').val($("#NoOfTrip" + userid).val());
$('#AmendtxtFreight').val($("#FreightValue" + userid).val());
$('#AmendtxtAfterFreight').val($("#AfterFreightValue" + userid).val());
$('#EditAmendPer').val($("#Per" + userid).val());
tinyMCE.get('edittxtInstruction').setContent($('#Addinstruction' + userid).val());
var FreightType = $('#drpamendFreight').val();
if (FreightType == "PER TRIP") {
$('#AmendTripsValue').show();
} else {
$('#AmendTripsValue').hide();
}
$('#EditTotalOrderValue').val(cellval[6].innerHTML);
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#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));
}
}
});
}
});
$('.EditImport').click(function() {
//alert('inside edit');
if (validateEditExceedLimit() && ExceedEditQuantityCheck() && EditQtyZerocheck()) {
var CostCode = $("#EditCostCenter").val();
var AvilBudget = $('#EditAvlBudAmt').val();
var editMaterialCode = $("#EditMaterialCode").val();
var edititemname = $("#EditItemName").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
var itemRate = $("#EditRate").val();
var BasicValue = $("#EdittxtBasicValue").val();
//console.log(BasicValue);
var BasicUSPrice = $("#EditimBasicPrice").val();
var basicinr = $('#EditINRBasicvalue').val();
//var BasicValue=$("#EdittxtBasicValue").val();
var BasicPrice = $("#EditBasicPriceTax").val();
var AfterBasicPrice = $("#EditAfterBasicPriceTax").val();
var Landingcharge = $("#EditLandingCharge").val();
var AfterLanding = $("#EditAfterLandingCharge").val();
var CustomDuty = $("#EditCustomduty").val();
var AfterCustomDuty = $("#EditAfterCustomduty").val();
var CustomED = $("#EditCustomEDcess").val();
var AfterCustomED = $("#EditAfterCustomEDcess").val();
var CustomSH = $("#EditCustomSHcess").val();
var AfterCustomSH = $("#EditAfterCustomSHcess").val();
var GrossDuty = $("#EditGrossdutypayable").val();
//console.log(GrossDuty);
var Quantity = $("#EditPurQuantity").val();
var CustomDutyExpense = $("#EditCustomDutyExpenses").val();
var TotalExp = $('#EdittxtBasicValue').val();
//alert(itemRate);
var Assessable = $("#EditAfterAssessable").val();
var SubTotal = $("#EditSubtotal").val();
var Igst = $("#EditIgst").val();
var AfterIgst = $("#EditAfterIgst").val();
var DutyImpact = $("#EditDutyImpact").val();
var ClearingCharges = $('#EditClearingCharges').val();
var Nett = $('#EditNett').val();
var FreightType = $('#drpamendFreight').val();
var FreightRate = $('#AmendtxtFreight').val();
var FreightRateAmount = $('#AmendtxtAfterFreight').val();
var Nooftrip = $('#AmendNOOfTrips').val();
var spclins = $.trim(tinymce.get('edittxtInstruction').getContent());
var FreightTypename = $('#drpamendFreight').val();
if (FreightTypename != "PER TRIP") {
Nooftrip = '';
}
var per = $('#EditAmendPer').val();
if (per == '') {
var per = $('#EditUOM').val();
}
// console.log(FreightType);
// console.log(Nooftrip);
// console.log(FreightRate);
// console.log(FreightRateAmount);
///console.log(TotalExp);
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[3].innerHTML = editQuantity;
cellval[4].innerHTML = editUOM;
cellval[5].innerHTML = itemRate;
cellval[6].innerHTML = BasicValue;
$('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(edititemname);
$('#uom' + userid).val(editUOM);
$('#quantity' + userid).val(editQuantity);
$('#itemRate' + userid).val(itemRate);
$('#ProductPrice' + userid).val(BasicValue);
$('#BasicAmt' + userid).val(BasicValue);
$('#BasicINRValue' + userid).val(basicinr);
$('#BasicPriceInMTon' + userid).val(BasicUSPrice);
$('#BasicPriceTax' + userid).val(BasicPrice);
$('#AfterBasicPriceTax' + userid).val(AfterBasicPrice);
$('#LandingCharge' + userid).val(Landingcharge);
$('#AfterLandingCharge' + userid).val(AfterLanding);
$('#CustomDuty' + userid).val(CustomDuty);
$('#AfterCustomDuty' + userid).val(AfterCustomDuty);
$('#CustomEdCess1' + userid).val(CustomED);
$('#AfterCustomEdCess1' + userid).val(AfterCustomED);
$('#CustomSHCess' + userid).val(CustomSH);
$('#AfterCustomSHCess' + userid).val(AfterCustomSH);
$('#Grossdutypayable1' + userid).val(GrossDuty);
$('#QuantityKG' + userid).val(Quantity);
$('#CustomDutyExpensesPerKG' + userid).val(CustomDutyExpense);
//$('#TotalValue'+userid).val(TotalExp);
$('#TotalValue' + userid).val(BasicValue);
$('#FreightType' + userid).val(FreightType);
$('#NoOfTrip' + userid).val(Nooftrip);
$('#FreightValue' + userid).val(FreightRate);
$('#AfterFreightValue' + userid).val(FreightRateAmount);
$('#AssessableValue' + userid).val(Assessable);
$('#SubTotal' + userid).val(SubTotal);
$('#IGST' + userid).val(Igst);
$('#AfterIGST' + userid).val(AfterIgst);
$('#DutyImpact' + userid).val(DutyImpact);
$('#NetValue' + userid).val(Nett);
$('#ClearingCharge' + userid).val(ClearingCharges);
$('#Per' + userid).val(per.trim());
$('#Addinstruction' + userid).val(spclins);
// var a=$('#FreightType'+userid).val();
// var b=$('#NoOfTrip'+userid).val();
// var c=$('#FreightValue'+userid).val();
// var d=$('#AfterFreightValue'+userid).val();
// console.log(a);
// console.log(b);
// console.log(c);
// console.log(d);
//var a=parseFloat($('#TotalValue'+userid).val());
//console.log(a);
//console.log(userid);
// var a=parseFloat($('#itemRate'+1).val());
// var b=parseFloat($('#itemRate'+2).val());
// var c=parseFloat($('#itemRate'+3).val());
// var d=parseFloat($('#itemRate'+4).val());
// console.log(a);
// console.log(b);
// console.log(c);
// console.log(d);
populateValueMainFormForEditImportTax();
}
});
var avalbudAmte = <?php echo json_encode($AvlAmount, JSON_PRETTY_PRINT) ?>;
var Sum = <?php echo json_encode($SavedSum, JSON_PRETTY_PRINT) ?>;
var totavlbud = avalbudAmte + Sum;
function validateEditExceedLimit() {
//var avalbudAmt = parseFloat($('#EditAvlBudAmt').val());
var basicAmountRate = parseFloat($('#EdittxtBasicValue').val());
var totalAmount = parseFloat($('#EditTotalExp').val());
var exchangerate = parseFloat($('#EditExchangeRt').val());
var exp = 0;
exp = basicAmountRate * exchangerate;
//console.log(exp);
// if(exp > totavlbud || totalAmount > totavlbud)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#EditRate').focus();
// return false;
// }
// else
// {
// return true;
// }
return true; // newly added.
}
function populateValueMainFormForEditImportTax() {
var rows = document.getElementById('ImportTax').rows.length;
var TotalLanding = 0;
var TotalCustom = 0;
var TotalCustomED = 0;
var TotalCustomSH = 0;
var TotalGrossDuty = 0;
var TotalGrossExpense = 0;
var Totalvalue = 0;
var TotalOrdervalue = 0;
var TotalFreight = 0;
var TotalAssessable = 0;
var TotalSubtotal = 0;
var TotalIgst = 0;
var i = 0;
var TotalRMC = 0;
do {
i += 1;
var tr = document.getElementById(i);
if (tr != null) {
cells = tr.getElementsByTagName('td');
var rowid = cells[0].innerHTML;
//console.log(rowid);
var AfterLandingCharge = $('#AfterLandingCharge' + rowid).val() == '' ? '0.00' : $('#AfterLandingCharge' + rowid).val();
//console.log(AfterLandingCharge);
//console.log(rowid);
var AfterCustomduty = $('#AfterCustomDuty' + rowid).val() == '' ? '0.00' : $('#AfterCustomDuty' + rowid).val();
var AfterCustomEDcess = $('#AfterCustomEdCess1' + rowid).val() == '' ? '0.00' : $('#AfterCustomEdCess1' + rowid).val();
var AfterCustomSHcess = $('#AfterCustomSHCess' + rowid).val() == '' ? '0.00' : $('#AfterCustomSHCess' + rowid).val();
//var AdditionalExciseduty=$('#AfterAddlExciseDuty'+rowid).val()==''?'0.00':$('#AfterAddlExciseDuty'+rowid).val();
var Grossdutypayable = $('#Grossdutypayable1' + rowid).val() == '' ? '0.00' : $('#Grossdutypayable1' + rowid).val();
//var Totalvalue=$('#TotalValue'+rowid).val()==''?'0.00':$('#TotalValue'+rowid).val();
var Total = $('#ProductPrice' + rowid).val() == '' ? '0.00' : $('#ProductPrice' + rowid).val();
var Frieght = $('#AfterFreightValue' + rowid).val() == '' ? '0.00' : $('#AfterFreightValue' + rowid).val();
//console.log(rowid);
var Assesable = $('#AssessableValue' + rowid).val() == '' ? '0.00' : $('#AssessableValue' + rowid).val();
var Subtotal = $('#SubTotal' + rowid).val() == '' ? '0.00' : $('#SubTotal' + rowid).val();
var Igst = $('#AfterIGST' + rowid).val() == '' ? '0.00' : $('#AfterIGST' + rowid).val();
TotalLanding = parseFloat(TotalLanding) + parseFloat(AfterLandingCharge);
TotalCustom = parseFloat(TotalCustom) + parseFloat(AfterCustomduty);
TotalCustomED = parseFloat(TotalCustomED) + parseFloat(AfterCustomEDcess);
TotalCustomSH = parseFloat(TotalCustomSH) + parseFloat(AfterCustomSHcess);
TotalGrossDuty = parseFloat(TotalGrossDuty) + parseFloat(Grossdutypayable);
TotalOrdervalue = parseFloat(TotalOrdervalue) + parseFloat(Total);
TotalFreight = parseFloat(TotalFreight) + parseFloat(Frieght);
TotalAssessable = parseFloat(TotalAssessable) + parseFloat(Assesable);
TotalSubtotal = parseFloat(TotalSubtotal) + parseFloat(Subtotal);
TotalIgst = parseFloat(TotalIgst) + parseFloat(Igst);
//TotalRMC=parseFloat(TotalRMC)+parseFloat(RMC);
//console.log(Totalvalue);
}
} while (i < rows);
$('#txttotallanding').val(parseFloat(TotalLanding).toFixed(2));
$('#txttotalcustom').val(parseFloat(TotalCustom).toFixed(2));
$('#txttotalcustomED').val(parseFloat(TotalCustomED).toFixed(2));
$('#txttotalcustomSH').val(parseFloat(TotalCustomSH).toFixed(2));
$('#txttotalgrossduty').val(parseFloat(TotalGrossDuty).toFixed(2));
$('#txtToatlOrder').val(parseFloat(TotalOrdervalue).toFixed(2));
$('#txttot').val(parseFloat(TotalOrdervalue).toFixed(2));
$('#txtTotalFreight').val(parseFloat(TotalFreight).toFixed(2));
$('#txttotalAssessable').val(parseFloat(TotalAssessable).toFixed(2));
$('#txttotalSubtotal').val(parseFloat(TotalSubtotal).toFixed(2));
$('#txttotalIgst').val(parseFloat(TotalIgst).toFixed(2));
//var a=parseFloat($('#txttot').val());
//console.log(a);
//$('#txttotallanding').val(parseFloat(TotalLanding).toFixed(2));
}
function Budgetcheck() {
//alert();
var totalorderedamount = parseFloat($('#txttot').val());
var Exchange = parseFloat($('#ExchangeRate').val());
//console.log(Exchange);
var totordring = totalorderedamount * Exchange;
var TotalSum = totavlbud;
//console.log(TotalSum);
// if(totordring>TotalSum)
// {
// alert('You are Exceeding The Budget Amount');
// return false;
// }
// else
// {
return true;
//}
}
function Save(status) {
stat = '<?php echo PO_RELEASED; ?>';
$('#txtStatus').val(stat);
tinyMCE.triggerSave();
var splinstr = $('#txtSpcialInstruction').val();
var txtRowCount = $('#txtRowCount').val();
var txtDeletedRow = $('#txtDeletedRow').val();
if (validate() && Budgetcheck()) {
if (document.getElementById('ImportTax').rows.length <= 0) {
alert('Please Select Line item to Create PO');
$('#Deliverydt').focus();
return false;
} else {
$('#content').loader('show');
var formData = new FormData($('.ImportPO')[0]);
$.ajax({
// data:$('.ImportPO').serialize(),
data: formData,
processData: false,
contentType: false,
//data:$('.CreatealterPO').serialize()+"&TextRowCount="+TextRowCount+"&TextDeQletedRowCount="+TextDeletedRowCount+"&TextTotalOrderValueSummaryService="+TextTotalOrderValueSummaryService+"&TextSpcialInstruction="+TextSpcialInstruction+"&TextExchangerate"+ExcLandingCharge="+hangerate+"Status="+TextStatus,
type: "POST",
url: "<?php echo base_url() ?>amendmentpurchaseorder/EditAmendImportPO",
success: function(data) {
if (data) {
$('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
//$('#SpcialInstruction').val('');
//$('#txtDeliveryAddress').val('');
window.location = "amendmentpurchaseorder";
} else {
alert("Error");
}
}
});
}
}
}
$(function() {
//$("#revenueTax").DataTable();
$('#ImportTax').DataTable({
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": false,
// "info": true,
"autoWidth": true
});
});
var Detail = <?php echo json_encode($Payment, JSON_PRETTY_PRINT) ?>;
//console.log(Detail);
$.each(Detail, function(index, value) {
$("#PaymentTerms").append($('<option></option>').val(value.ConfigValue).html(value.ConfigValue));
});
$("#PaymentTerms").change(function() {
if ($('#PaymentTerms').val().trim() == 'PT08')
{
$('#otheroptiondiv').show();
} else {
$('#otheroptiondiv').hide();
}
});
$('#drpamendFreight').change(function() {
//alert();
var FreightType = $('#drpamendFreight').val();
if (FreightType == "PER TRIP") {
$('#AmendTripsValue').show();
} else {
$('#AmendTripsValue').hide();
}
if ($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0") {
selValue = $("#drpamendFreight").val();
$('#AmendtxtFreight').val('');
$('#edittxtAfterFreight').val('');
if (selValue == NilType) {
$('#AmendtxtFreight').attr('readonly', 'true');
$('#AmendtxtFreight').val('0.00');
} else {
$('#AmendtxtFreight').removeAttr('readonly', 'true');
$('#AmendtxtFreight').val('');
}
} else {
alert('Please Select MaterialCode and Rate Field Value');
$('#drpamendFreight').val("0");
$('#EditRate').focus();
}
calculateFreight();
});
function calculateFreight() {
//alert('af');
if ($('#EditMaterialCode').val() == '') {
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
$('#edittxtFreight').val('');
return false;
} else if ($('#EditRate').val() == '') {
alert('Please Enter the Rate value');
$('#EditRate').focus();
$('#AmendtxtFreight').val('');
return false;
} else {
var basicValue = parseFloat($('#EditINRBasicvalue').val());
var FreightType = $("#drpamendFreight").val();
if (FreightType == "0") {
alert('Please select Freight Type');
$('#AmendtxtFreight').val('');
$("#drpamendFreight").focus();
} else if ($('#AmendtxtFreight').val() != "0" && $('#AmendtxtFreight').val() != '') {
var FreightValue = parseFloat($('#AmendtxtFreight').val());
var UOM = parseFloat($('#EditUOM').val());
var Quantity = parseFloat($('#EditQuantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
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; ?>') {
if ($('#AmendNOOfTrips').val() == '') {
alert('Please Enter No of Trip');
$("#AmendNOOfTrips").focus();
$('#AmendtxtFreight').val(0)
AfterFreight = 0;
$('#AmendtxtAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#AmendNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#AmendtxtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#AmendtxtAfterFreight').val(AfterFreightval);
} else {
$('#AmendtxtAfterFreight').val("0.00");
}
}
// calculateEditTotalValue();
}
</script>