ria/app/Views/editimportpo.php
2024-08-23 13:14:08 +00:00

5953 lines
302 KiB
PHP

<?php
$AvlAmount = 0;
$ReqType = '';
$Value = '';
$EXCRATE = 0;
$parentPO = '';
$ServiceDescription = '';
//$Value="&#36;";
//echo $ExchangeRate;
//echo $Currency;
//echo $unicode;
$Value = $unicode;
//echo $Value;
$Currencycode = $currencycode;
//echo $Currencycode;
$Terms = '';
$DeliverySchedule = '';
$PrePOFile = '';
foreach ($CurrencyDetail as $Detail) {
$Cur = $Detail->Currency_Code . ' ' . ' - ' . ' ' . $Detail->Country_and_Currency;
}
//echo $Cur;
foreach ($PaymentTerms as $TER) {
$Terms = $TER->PaymentTerms;
}
//echo $Terms;
$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;
}
}
if (!empty($AvlBudAmt)) {
$AvlAmount = $AvlBudAmt;
}
//echo $AvlBudAmt;;
$CompanyAddress = '';
if (!empty($CompanyDetails)) {
foreach ($CompanyDetails as $Req) {
$CompanyAddress = $Req->Address;
}
}
$INR = '';
$INRSYM = '';
if (!empty($INRSYMBOL)) {
foreach ($INRSYMBOL as $INR) {
$INRSYM = $INR->Currency_Code;
$INR = $INR->FontCode2000;
}
}
//echo $INR;
//echo "$CompanyAddress";
//$Exchangerate=$ExchangeRate;
$index = 0;
$SupId = '';
$SupName = '';
$Address = '';
$PODate = '';
$Deliverydt = '';
$DeliveryAddress = '';
$PONOStatus = '';
$PONO = '';
$ServiceDescription = '';
$TotalLanding = 0;
$tothighseas = 0;
$totcustom = 0;
$totexciseduty = 0;
$totexcisedutyED = 0;
$totexciseSH = 0;
$totcustomED = 0;
$totcustomSH = 0;
$totaddtnlexcise = 0;
$totgrossduty = 0;
$totavlmodvat = 0;
$totgrossexpense = 0;
$totordervalue = 0;
$totfreight = 0;
$ExchangeRate = 0;
$totorder = 0;
$totassesable = 0;
$totSubtotal = 0;
$totigst = 0;
$Cur = '';
$Currency_Type = '';
$PayableAT = '';
//$ExchangeRate
$ExchangeRateCalculatedon = '';
$StatusName = '';
$Import_DispatchDetails = '';
$Import_PlaceofOrgin = '';
$DeliveryOption = '';
$Orderedsum = '';
$PaymentTermsCode = '';
$Shipmentmode = '';
$SupplierRef = '';
$SupOfferno = '';
$Otherref = '';
$BudgetType = '';
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);
//echo "$ExchangeRate";
$EDt = new DateTime($Req->ExchangeRateCalculatedon);
$ExchangeRateCalculatedon = $EDt->format('d-m-Y');
$PaymentTerms = $Req->PaymentTerms;
// $PayableAT=$Req->PayableAT;
// $PaymentDays=$Req->PaymentDays;
$StatusName = $Req->StatusName;
$Currency_Type = $Req->CurrencyType;
$parentPO = $Req->ParentPO;
$DeliverySchedule = $Req->DeliverySchedule;
$Import_DispatchDetails = $Req->Import_DispatchDetails;
$Import_PlaceofOrgin = $Req->Import_PlaceofOrgin;
$PaymentTerms = $Req->PaymentTerms;
$DeliveryOption = $Req->DeliveryOption;
$ServiceDescription = $Req->ServiceDescription;
$Orderedsum = $Req->TotalOrderValue;
$PaymentTermsCode = $Req->PaymentOtherDescription;
$Shipmentmode = $Req->Mode_Of_Shipment;
$SupplierRef = $Req->Supplier_Reference;
$SupOfferno = $Req->Supplier_Offer_No;
$Otherref = $Req->Other_Reference;
$Insurance = $Req->InsuranceStatus;
$InsuranceNumber = $Req->InsuranceNumber;
$Importoption = $Req->POSubType;
$BudgetType = $Req->BudgetType;
$PrePOFile = $Req->POFile;
}
}
//echo $InsuranceNumber;
$ins = '';
if ($Insurance == 1) {
$ins = 'YES';
} else {
$ins = 'NO';
}
$SavedSum = $Orderedsum * $ExchangeRate;
//echo $SavedSum;
$AvilableBudget = $SavedSum + $AvlAmount;
//echo $AvilableBudget;
//echo $PaymentTermsCode;
if (!empty($RequistionDetails)) {
foreach ($RequistionDetails as $ReqDet) {
// $Reqon=$ReqDet->ReqDate;
$Reqonn = new DateTime($ReqDet->ReqDate);
$Reqon = $Reqonn->format('d-m-Y');
$Requestedby = $ReqDet->Requestedby;
$RequesterName = $ReqDet->FirstName;
//$Status=$ReqDet->Status;
}
}
if (!empty($getlogpodtl)) {
foreach ($getlogpodtl as $values) {
$update = $values->FirstName;
}
} else {
$update = [];
}
?>
<style>
.modal {
padding-right: 25% ! important;
}
.dataTables_paginate {
margin-top: -5%;
}
.dataTables_wrapper {
padding-bottom: 0px;
}
.pagination {
margin: 0px ! important;
}
.box-body {
padding: 0px ! important;
}
.num {
text-align: right;
}
.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/tinymce/js/tinymce/tinymce.min.js"></script>
<script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript">
</script>
<script>
$(document).ready(function() {
$("#PaymentTerms").select2();
tinymce.init({
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#addtxtInstruction",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#edittxtInstruction",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#viewtxtInstruction",
menubar: false,
statusbar: false,
toolbar: false
});
/*****************************/
var update = '<?php echo json_encode($update) ?>';
if (update != 'null')
{
$('#editpodiv').show();
} else {
$('#editpodiv').hide();
}
/*****************************/
//Initialize Select2 Elements
//$("#drpSupplier").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'
// $("#PayableAT").datepicker({
// minDate : m,
// //maxDate : 'now',
// dateFormat: 'mm/dd/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-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<?php if ($parentPO == '') { ?>
<h4><?= "Edit Import Purchase Order - $PONO "; ?></h4>
<?php } else { ?>
<h4><?= "Amended Import Purchase Order - $PONO "; ?></h4>
<?php } ?>
<a href="<?php echo base_url() ?>purchaseorderListing" class="btn btn-cancel" id="back" value="Back">Back</a>
</div>
</div>
</div>
<!-- end page title -->
<!-- Form row -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="content-wrapper">
<section class="content">
<?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 class="box">
<div class="col-md-12">
</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;
// print_r($SID->ReqNo);
// $options[$SID->ReqNo] = $SID->ReqNo ."-". $SID->ReqBy;
//$ReqType = $SID->ReqType;
endforeach;
}
//echo form_multiselect('RequistionNo', $options,set_value('RequistionNo'),'id="RequistionNo"' , 'required="true"');
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>Select 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');
?> <input type="hidden" name="b4supplier" id="b4supplier" value="<?php echo $SupId; ?>">
<input type="hidden" name="newsup" id="changeSup">
</div>
<div class="col-md-3">
<label>Supplier 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
if (!empty($Currency)) {
foreach ($Currency as $Cur) :
if ($Currency_Type == $Cur->Currency_Code) {
$options1[$Cur->Currency_Code] = $Cur->Currency_Code . ' ' . ' - ' . ' ' . $Cur->Country_and_Currency;
}
endforeach;
foreach ($Currency as $Cur) :
if ($Currency_Type != $Cur->Currency_Code) {
$options1[$Cur->Currency_Code] = $Cur->Currency_Code . ' ' . ' - ' . ' ' . $Cur->Country_and_Currency;
}
endforeach;
}
echo form_dropdown('currencytype', $options1, set_value('currencytype', $Currency_Type), 'id="currencytype"', 'class="form-control select2"', 'required="true"');
?>
</div>
<div class="col-md-3">
<b><u>Select Delivery By<span class="badge mandatory">*</span></u></b><br />
<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;">
<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>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' => 'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', '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>
</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);
?> <input type="hidden" name="b4podate" id="b4podate" value="<?php echo $PODate; ?>">
</div>
</div>
<div class="col-md-3">
<label>Mode Of Shipment</label>
<div class="form-group">
<?php
$data = array('name' => 'editmodeofshipment', 'value' => set_value('editmodeofshipment', $Shipmentmode), 'id' => 'editmodeofshipment', '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' => 'editsupplierreference', 'value' => set_value('editsupplierreference', $SupplierRef), 'id' => 'editsupplierreference', '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' => 'editsupplierofferno', 'value' => set_value('editsupplierofferno', $SupOfferno), 'id' => 'editsupplierofferno', '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' => 'editotherreference', 'value' => set_value('editotherreference', $Otherref), 'id' => 'editotherreference', '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 // $options2 = 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) {
?>
<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', $PaymentTermsCode), '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 Option<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=<?php echo $opt1; ?>><?php echo $opt1; ?></option>
<option value=<?php echo $opt2; ?>><?php echo $opt2; ?></option>
</select>
</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');
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">
<div class="col-md-12">
<div class="col-md-3 col-md-offset-7" align="right" style="padding:10px">
<!-- <input type="checkbox" id="IsOpenOrder" name="IsOpenOrder" value="1"> IS THIS OPEN ORDER FORMAT -->
</div>
<div class="col-md-1" align="right">
<?php if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == PO_APPROVED) { ?>
<a data-toggle="modal" data-target="#importpomodel" class="btn btn-success" data-dismiss="modal" onclick="myFunction();">Add Line Item </a>
<?php } ?>
</div>
</div>
<!--<a data-toggle="modal"><button type="submit" onclick="myFunction();" class="btn btn-success" id="abcd" >Select Line Item</button> </a>-->
<!-- <div class="modal fade" id="importpomodel" role="dialog">-->
<div id="importpomodel" 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:1091px;font-size:12px;">
<div class="modal-header">
<center>
<h4>Add 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" style="color:red;text-align:right;background-color: #fff
;">*</span></label>
<div>
<?php
$options = array("0" => 'Req No');
//echo form_dropdown('ImportMaterialCode', $options,set_value('ImportMaterialCode'),'id="ImportMaterialCode"' ,'class="form-control required"');
$RL = array("0" => 'Select Req No');
if (!empty($RequistionDetails)) {
foreach ($RequistionDetails as $SID) :
$RL[$SID->ReqNo] = $SID->ReqNo . ' ' . ' - ' . ' ' . $SID->DepartmentName;
endforeach;
}
echo form_dropdown('ReqNo', $RL, set_value('ReqNo'), 'id="ReqNo"', 'class="form-control"');
?>
</div>
</div>
<div class="col-md-3">
<label>Department Name</label>
<div class="form-group">
<?php
//$data = array('name' => 'ImportDepartmentName','value' => set_value('ImportDepartmentName'),'id'=>'ImportDepartmentName', 'class' => 'form-control' ,'readonly' => 'true');
$data = array('name' => 'deptName', 'value' => set_value('deptName'), 'id' => 'deptName', '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('CostCenter', $options,set_value('CostCenter'),'id="CostCenter"' ,'class="form-control"');
$data = array('name' => 'CostCenter', 'value' => set_value('CostCenter'), 'id' => 'CostCenter', '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' => 'AvlBudAmt', 'value' => set_value('AvlBudAmt'), 'id' => 'AvlBudAmt', 'class' => 'form-control num', '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" style="color:red;text-align:right;background-color: #fff;">*</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');
//if(!empty($MaterialList))
//{
// foreach ($MaterialList as $SID):
// $options[$SID->MaterialCode] = $SID->MaterialCode.' '.' - '.' '.$SID->MaterialName;
//endforeach;
//}
//echo form_dropdown('ImportMaterialCode', $options,set_value('ImportMaterialCode'),'id="ImportMaterialCode"' ,'class="form-control"');
$options = array("0" => 'Item Code');
//print_r( $options);
echo form_dropdown('MaterialCode', $options, set_value('MaterialCode'), 'id="MaterialCode"', 'class="form-control"');
?>
</div>
</div>
<div class="col-md-2">
<label>Item Name</label>
<div class="form-group">
<?php
$data = array('name' => 'ItemName', 'value' => set_value('ItemName'), 'id' => 'ItemName', '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' => 'UOM', 'value' => set_value('UOM'), 'id' => 'UOM', '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" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'Quantity', 'value' => set_value('Quantity'), 'id' => 'Quantity', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Ratechange(),calculateFreight(0)');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<!-- <label>Rate </label>
-->
<!-- <P id=labelRate> --> <label id=labelRate><?php echo "Rate in $Currencycode ($Value)"; ?><span class="badge mandatory" style="color:red;text-align:right;background-color: #fff;">*</span> </label><!-- </P> -->
<div class="form-group">
<?php
$data = array('name' => 'Rate', 'value' => set_value('Rate'), 'id' => 'Rate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Ratechange(),calculateFreight(0)');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Per</label> <?php
$data = array('name' => 'AddPer', 'value' => set_value('AddPer'), 'id' => 'AddPer', 'class' => 'form-control');
echo form_input($data); ?>
</div>
<div class="col-md-3" style="padding: 0px;">
<!-- <label>Basic Amount </label>-->
<!-- <p id=labelBasicvalue><label><?php echo "Basic Value In $Currencycode ($Value)"; ?></label></p>
-->
<!-- <p id=label2> --> <label id=label2><?php echo "Basic Value In $Currencycode"; ?></label><!-- </p> -->
<div class="form-group">
<?php
//$data = array('name' => 'imTotalAmount','value' => set_value('imTotalAmount'),'id'=>'imTotalAmount', 'class' => 'form-control' ,'readonly' => 'true');
$data = array('name' => 'txtBasicValue', 'value' => set_value('txtBasicValue'), 'id' => 'txtBasicValue', '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=labelBasicpriceus><b><?php echo "Basic Value in $Currencycode ($Value)" ?></p> -->
<label id=labelBasicpriceus><?php echo "Basic Value in $Currencycode ($Value)" ?></label>
<div class="form-group">
<?php
$data = array('name' => 'imBasicPrice', 'value' => set_value('imBasicPrice'), 'id' => 'imBasicPrice', 'class' => 'form-control', 'placeholder ' => 'basic price', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'USRate()', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<!-- Exchange Rate : -->
<!-- <p id=label1><b><?php echo "Exchange Rate" ?></p> -->
<!-- <label id=labeladdexc> </label> -->
<label id=labeladdexc><?php echo "Exchange Rate ($Currencycode ($Value))" ?></label>
<div class="form-group">
<?php
$data = array('name' => 'ExchangeRt', 'value' => set_value('ExchangeRt'), 'id' => 'ExchangeRt', '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=labelBasicINR><?php echo "Basic value in ($INR)"; ?> </label>
<div class="form-group">
<?php
$data = array('name' => 'INRBasicvalue', 'value' => set_value('INRBasicvalue'), 'id' => 'INRBasicvalue', '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' => 'BasicPriceTax', 'value' => set_value('BasicPriceTax'), 'id' => 'BasicPriceTax', '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' => 'AfterBasicPriceTax', 'value' => set_value('AfterBasicPriceTax'), 'id' => 'AfterBasicPriceTax', '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' => 'LandingCharge', 'value' => set_value('LandingCharge', 0), 'id' => 'LandingCharge', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Calculateloadingcharge()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'AfterLandingCharge', 'value' => set_value('AfterLandingCharge'), 'id' => 'AfterLandingCharge', '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' => 'Highseas ', 'value' => set_value('Highseas', 0), 'id' => 'Highseas', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateHighseassalescharge()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'AfterAssessable', 'value' => set_value('AfterAssessable'), 'id' => 'AfterAssessable', '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' => 'Customduty', 'value' => set_value('Customduty', 0), 'id' => 'Customduty', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateCustomduty()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'AfterCustomduty', 'value' => set_value('AfterCustomduty'), 'id' => 'AfterCustomduty', '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' => 'CustomEDcess', 'value' => set_value('CustomEDcess', 0), 'id' => 'CustomEDcess', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateCustomEdcess()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'AfterCustomEDcess', 'value' => set_value('AfterCustomEDcess'), 'id' => 'AfterCustomEDcess', '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' => 'CustomSHcess', 'value' => set_value('CustomSHcess', 0), 'id' => 'CustomSHcess', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateCustomSHcess()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'AfterCustomSHcess', 'value' => set_value('AfterCustomSHcess'), 'id' => 'AfterCustomSHcess', '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' => 'AdditionalExciseduty ', 'value' => set_value('AdditionalExciseduty', 0), 'id' => 'AdditionalExciseduty', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateaddlExciseDuty(),CalculateAvlModvat(),CalculateGrossExpense()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'Subtotal', 'value' => set_value('Subtotal'), 'id' => 'Subtotal', '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' => 'Igst ', 'value' => set_value('Igst', 0), 'id' => 'Igst', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateIgst()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'AfterIgst', 'value' => set_value('AfterIgst', 0), 'id' => 'AfterIgst', '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+F)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'Grossdutypayable ', 'value' => set_value('Grossdutypayable'), 'id' => 'Grossdutypayable', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateAvlModvat()');
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('drpaddFreight', $options, set_value('drpaddFreight'), 'id="drpaddFreight"', 'class="form-control "');
?>
</div>
</div>
<div class="col-md-3" id="AddTripsValue" style="display:none;">
<span>NO Of Trips</span>
<div class="form-group">
<?php
$data = array('name' => 'addNOOfTrips', 'value' => set_value('addNOOfTrips'), 'id' => 'addNOOfTrips', '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' => 'addtxtFreight', 'value' => set_value('addtxtFreight'), 'id' => 'addtxtFreight', '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' => 'addtxtAfterFreight', 'value' => set_value('addtxtAfterFreight'), 'id' => 'addtxtAfterFreight', '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">
<label>Duty Impact</label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'DutyImpact', 'value' => set_value('DutyImpact'), 'id' => 'DutyImpact', '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' => 'PurQuantity', 'value' => set_value('PurQuantity'), 'id' => 'PurQuantity', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateCtable()');
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 Expenses($INR)/UOM"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'CustomDutyExpenses ', 'value' => set_value('CustomDutyExpenses'), 'id' => 'CustomDutyExpenses', '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' => 'ClearingCharges', 'value' => set_value('ClearingCharges'), 'id' => 'ClearingCharges', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'CalculateCtable()');
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' => 'Nett', 'value' => set_value('Nett', 0), 'id' => 'Nett', '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: -->
<label id=labelTotalAmount>Total Amount</label>
</div>
<div class="col-md-4" style="display: none">
<div class="form-group" style="display: none;">
<?php
$data = array('name' => 'TotalExp', 'value' => set_value('TotalExp'), 'id' => 'TotalExp', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<label>Import Description :</label>
<?php
$data = array('name' => 'addtxtInstruction', 'value' => set_value('addtxtInstruction'), 'id' => 'addtxtInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
</div>
</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 AddImport" ID="AddImport"> &nbsp;&nbsp;<span class="bold">Add 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>
</div>
<!--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:1091px;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" style="color:red;text-align:right;background-color: #fff;">*</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 num', '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" style="color:red;text-align:right;background-color: #fff;">*</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');
//if(!empty($MaterialList))
//{
// foreach ($MaterialList as $SID):
// $options[$SID->MaterialCode] = $SID->MaterialCode.' '.' - '.' '.$SID->MaterialName;
//endforeach;
//}
//echo form_dropdown('ImportMaterialCode', $options,set_value('ImportMaterialCode'),'id="ImportMaterialCode"' ,'class="form-control"');
$options = array("0" => 'Item Code');
//print_r( $options);
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" style="color:red;text-align:right;background-color: #fff;">*</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">
<!-- <label>Rate </label> -->
<!-- <P id=labelEditRate> --> <label id=labelEditRate><?php echo "Rate in $Currencycode ($Value)"; ?> <span class="badge mandatory" style="color:red;text-align:right;background-color: #fff;">*</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(),validateEditExceedLimit()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Per</label> <?php
$data = array('name' => 'EditPer', 'value' => set_value('EditPer'), 'id' => 'EditPer', 'class' => 'form-control');
echo form_input($data); ?>
</div>
<div class="col-md-3" style="padding: 0px;">
<!-- <label><?php echo "Basic Value In"; ?></label>-->
<!-- <p id=label3> --><label id=label3><?php echo "Basic Value In $Currencycode ($Value)"; ?></label><!-- </p> -->
<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> -->
<label id=labelEditBasicPriceUs><?php echo "Basic Value in $Currencycode ($Value)" ?> </label>
<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">
<!-- <label>Exchange Rate :</label> -->
<label id=labeleditexc><?php echo "Exchange Rate ($Currencycode ($Value))" ?></label>
<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 : -->
<!-- <p id=labelEditBasicINR> --><label id=labelEditBasicINR><?php echo "Basic value in ($INR) :"; ?></label><!-- </p> -->
<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+F)"; ?></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('drpeditFreight', $options, set_value('drpeditFreight'), 'id="drpeditFreight"', 'class="form-control "');
?>
</div>
</div>
<div class="col-md-3" id="EditTripsValue" style="display:block;">
<span>NO Of Trips</span>
<div class="form-group">
<?php
$data = array('name' => 'editNOOfTrips', 'value' => set_value('editNOOfTrips'), 'id' => 'editNOOfTrips', 'class' => 'form-control num', 'onchange' => 'calculateFreight(1);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<span>Freight Rate </span>
<div class="form-group">
<?php
$data = array('name' => 'edittxtFreight', 'value' => set_value('edittxtFreight'), 'id' => 'edittxtFreight', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateFreight(1);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3" style="padding-left: 0px;">
<span>Freight Amt <?php echo $INR; ?></span>
<div class="form-group">
<?php
$data = array('name' => 'edittxtAfterFreight', 'value' => set_value('edittxtAfterFreight'), 'id' => 'edittxtAfterFreight', '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">
<label>Duty Impact</label>
</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 Expenses($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: -->
<label id=labelEditTotalAmount>Total Amount</label>
</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>
<!-- view model body -->
<div id="viewimportmodal" 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:1091px; font-size: 12px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center>
<h4>View 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" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div>
<?php
$data = array('name' => 'ViewReqNo', 'value' => set_value('ViewReqNo'), 'id' => 'ViewReqNo', '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' => 'ViewdeptName', 'value' => set_value('ViewdeptName'), 'id' => 'ViewdeptName', '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' => 'ViewCostCenter', 'value' => set_value('ViewCostCenter'), 'id' => 'ViewCostCenter', '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' => 'ViewAvlBudAmt', 'value' => set_value('ViewAvlBudAmt'), 'id' => 'ViewAvlBudAmt', 'class' => 'form-control num', '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" style="color:red;text-align:right;background-color: #fff;">*</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');
//if(!empty($MaterialList))
//{
// foreach ($MaterialList as $SID):
// $options[$SID->MaterialCode] = $SID->MaterialCode.' '.' - '.' '.$SID->MaterialName;
//endforeach;
//}
//echo form_dropdown('ImportMaterialCode', $options,set_value('ImportMaterialCode'),'id="ImportMaterialCode"' ,'class="form-control"');
$options = array("0" => 'Item Code');
//print_r( $options);
echo form_dropdown('ViewMaterialCode', $options, set_value('ViewMaterialCode'), 'id="ViewMaterialCode"', 'class="form-control"');
?>
</div>
</div>
<div class="col-md-2">
<label>Item Name</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewItemName', 'value' => set_value('ViewItemName'), 'id' => 'ViewItemName', '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' => 'ViewUOM', 'value' => set_value('ViewUOM'), 'id' => 'ViewUOM', '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" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'ViewQuantity', 'value' => set_value('ViewQuantity'), 'id' => 'ViewQuantity', 'readonly' => true, 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange(),ExceedEditQuantityCheck()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<!-- <label>Rate </label> -->
<!-- <P id=labelEditRate> --> <label id=labelEditRate><?php echo "Rate in $Currencycode ($Value)"; ?><span class="badge mandatory" style="color:red;text-align:right;background-color: #fff;">*</span> </label>
<div class="form-group">
<?php
$data = array('name' => 'ViewRate', 'value' => set_value('ViewRate'), 'id' => 'ViewRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => true, 'onchange' => 'EditRatechange()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Per</label> <?php
$data = array('name' => 'ViewPer', 'value' => set_value('ViewPer'), 'id' => 'ViewPer', 'readonly' => true, 'class' => 'form-control');
echo form_input($data); ?>
</div>
<div class="col-md-3" style="padding: 0px;">
<!-- <label><?php echo "Basic Value In"; ?></label>-->
<!-- <p id=label3> --><label id=label3><?php echo "Basic Value In $Currencycode ($Value)"; ?></label><!-- </p> -->
<div class="form-group">
<?php
//$data = array('name' => 'imTotalAmount','value' => set_value('imTotalAmount'),'id'=>'imTotalAmount', 'class' => 'form-control' ,'readonly' => 'true');
$data = array('name' => 'ViewtxtBasicValue', 'value' => set_value('ViewtxtBasicValue'), 'id' => 'ViewtxtBasicValue', '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 Price in $Currencycode ($Value)" ?></p>
<div class="form-group">
<?php
$data = array('name' => 'ViewimBasicPrice', 'value' => set_value('ViewimBasicPrice'), 'id' => 'ViewimBasicPrice', 'class' => 'form-control num', 'placeholder ' => 'basic price', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<!-- Exchange Rate : -->
<label id=labelviewexc><?php echo "Exchange Rate ($Currencycode ($Value))" ?></label>
<div class="form-group">
<?php
$data = array('name' => 'ViewExchangeRt', 'value' => set_value('ViewExchangeRt', $ExchangeRate), 'id' => 'ViewExchangeRt', '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 : -->
<p id=labelEditBasicINR><label><?php echo "Basic value in ($INR) :"; ?></label></p>
<div class="form-group">
<?php
$data = array('name' => 'ViewINRBasicvalue', 'value' => set_value('ViewINRBasicvalue'), 'id' => 'ViewINRBasicvalue', '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 (<?php echo $INR ?>)
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'ViewBasicPriceTax', 'value' => set_value('ViewBasicPriceTax'), 'id' => 'ViewBasicPriceTax', 'readonly' => true, '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' => 'ViewAfterBasicPriceTax', 'value' => set_value('ViewAfterBasicPriceTax'), 'id' => 'ViewAfterBasicPriceTax', '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' => 'ViewLandingCharge', 'value' => set_value('ViewLandingCharge'), 'id' => 'ViewLandingCharge', 'readonly' => true, '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' => 'ViewAfterLandingCharge', 'value' => set_value('ViewAfterLandingCharge'), 'id' => 'ViewAfterLandingCharge', 'readonly' => true, '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' => 'ViewHighseas ', 'value' => set_value('ViewHighseas'), 'id' => 'ViewHighseas', 'class' => 'form-control num', 'readonly' => true, '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' => 'ViewAfterAssessable', 'value' => set_value('ViewAfterAssessable'), 'id' => 'ViewAfterAssessable', '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' => 'ViewCustomduty', 'value' => set_value('ViewCustomduty'), 'id' => 'ViewCustomduty', 'class' => 'form-control num', 'readonly' => true, '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' => 'ViewAfterCustomduty', 'value' => set_value('ViewAfterCustomduty'), 'id' => 'ViewAfterCustomduty', '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' => 'ViewCustomEDcess', 'value' => set_value('ViewCustomEDcess'), 'id' => 'ViewCustomEDcess', 'readonly' => true, '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' => 'ViewAfterCustomEDcess', 'value' => set_value('ViewAfterCustomEDcess'), 'id' => 'ViewAfterCustomEDcess', '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' => 'ViewCustomSHcess', 'value' => set_value('ViewCustomSHcess'), 'id' => 'ViewCustomSHcess', 'class' => 'form-control num', 'readonly' => true, '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' => 'ViewAfterCustomSHcess', 'value' => set_value('ViewAfterCustomSHcess'), 'id' => 'ViewAfterCustomSHcess', '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' => 'ViewAdditionalExciseduty ', 'value' => set_value('ViewAdditionalExciseduty'), 'id' => 'ViewAdditionalExciseduty', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => true, 'onchange' => 'EditCalculateaddlExciseDuty(),EditCalculateAvlModvat(),EditCalculateGrossExpense()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'ViewSubtotal', 'value' => set_value('ViewSubtotal'), 'id' => 'ViewSubtotal', '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' => 'ViewIgst ', 'value' => set_value('ViewIgst', 0), 'id' => 'ViewIgst', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true', 'onchange' => 'EditCalculateIgst()');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'ViewAfterIgst', 'value' => set_value('ViewAfterIgst', 0), 'id' => 'ViewAfterIgst', '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 ($INR) (B+C+D+F)"; ?></label>
</div>
<div class="col-md-4">
<div class="form-group">
<?php
$data = array('name' => 'ViewGrossdutypayable ', 'value' => set_value('ViewGrossdutypayable'), 'id' => 'ViewGrossdutypayable', 'class' => 'form-control num', 'readonly' => true, '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('drpviewFreight', $options, set_value('drpviewFreight'), 'id="drpviewFreight"', 'class="form-control "');
?>
</div>
</div>
<div class="col-md-3" id="ViewTripsValue" style="display:block;">
<span>NO Of Trips</span>
<div class="form-group">
<?php
$data = array('name' => 'viewNOOfTrips', 'value' => set_value('viewNOOfTrips'), 'id' => 'viewNOOfTrips', 'class' => 'form-control num', 'onchange' => 'calculateFreight(2);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<span>Freight Rate </span>
<div class="form-group">
<?php
$data = array('name' => 'viewtxtFreight', 'value' => set_value('viewtxtFreight'), 'id' => 'viewtxtFreight', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateFreight(2);');
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' => 'viewtxtAfterFreight', 'value' => set_value('viewtxtAfterFreight'), 'id' => 'viewtxtAfterFreight', '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 KG</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' => 'ViewDutyImpact', 'value' => set_value('ViewDutyImpact'), 'id' => 'ViewDutyImpact', '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' => 'ViewPurQuantity', 'value' => set_value('ViewPurQuantity'), 'id' => 'ViewPurQuantity', 'class' => 'form-control num', 'readonly' => true, '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' => 'ViewCustomDutyExpenses ', 'value' => set_value('ViewCustomDutyExpenses'), 'id' => 'ViewCustomDutyExpenses', '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' => 'ViewClearingCharges', 'value' => set_value('ViewClearingCharges'), 'id' => 'ViewClearingCharges', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'readonly' => 'true');
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' => 'ViewNett', 'value' => set_value('ViewNett'), 'id' => 'ViewNett', '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: -->
<label id=labelViewTotalAmount>Total Amount</label>
</div>
<div class="col-md-4">
<div class="form-group" style="display:none;">
<?php
$data = array('name' => 'ViewTotalExp', 'value' => set_value('ViewTotalExp'), 'id' => 'ViewTotalExp', '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' => 'viewtxtInstruction', 'value' => set_value('viewtxtInstruction'), 'id' => 'viewtxtInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
</div>
</div </div>
<div class="modal-footer">
<!-- <a class="btn btn-success font EditImport" ID="EditImport" ><i class="fa fa-plus" ></i>&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>-->
<a class="btn btn-cancel" data-dismiss="modal" value="Cancel">Cancel</a>
<a class="btn btn-success font UpdateImport" ID="UpdateImport"> &nbsp;&nbsp;<span class="bold">Update</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>Material Code</th>
<th>Description</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate<?php echo $INR ?></th>
<th>Basic Amount<?php echo $INR ?></th>
<!-- <th>Received Qty</th>
<th>Rejected Qty</th>
<th>Pending Qty</th> -->
<!-- <th>Tax Amount</th>
<th>Total Order Amount</th> -->
<th>Action</th>
</tr>
</thead>
<tbody id='ImportAppend'>
<?php
if (!empty($POItem)) {
foreach ($POItem as $record) {
$index = $index + 1;
//echo $record->Rate;
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialCode ?></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->ReceivedQuantity ?></td> -->
<!-- <td><?php echo $record->QuantityRejected ?></td> -->
<!-- <td><?php echo $record->PendingQty ?></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 $record->AvlBudAmt ;
?>" /> -->
<input type="hidden" name="<?php echo 'AvlBudAmt' . $index ?>" id="<?php echo 'AvlBudAmt' . $index ?>" value="<?php echo "$AvlAmount"; ?>" />
<input type="hidden" name="<?php echo 'LineItemNo' . $index ?>" id="<?php echo 'LineItemNo' . $index ?>" value="<?php echo $record->LineItemNo; ?>" />
<input type="hidden" name="<?php echo 'costCode' . $index ?>" id="<?php echo 'costCode' . $index ?>" value="<?php echo $record->CostCenterCode; ?>" />
<input type="hidden" name="<?php echo 'materialCode' . $index ?>" id="<?php echo 'materialCode' . $index ?>" value="<?php echo $record->MaterialCode; ?>" />
<input type="hidden" name="<?php echo 'materialName' . $index ?>" id="<?php echo 'materialName' . $index ?>" value="<?php echo $record->MaterialName; ?>" />
<input type="hidden" name="<?php echo 'uom' . $index ?>" id="<?php echo 'uom' . $index ?>" value="<?php echo $record->UOM; ?>" />
<input type="hidden" name="<?php echo 'quantity' . $index ?>" id="<?php echo 'quantity' . $index ?>" value="<?php echo $record->Quantity; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4qty' . $index ?>" id="<?php echo 'b4qty' . $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 align="right" type="hidden" name="<?php echo 'b4rate' . $index ?>" id="<?php echo 'b4rate' . $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 'AfterLandingCharge' . $index ?>" id="<?php echo 'AfterLandingCharge' . $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 'AfterCustomDuty' . $index ?>" id="<?php echo 'AfterCustomDuty' . $index ?>" value="<?php echo $record->AfterCustomDuty; ?>" />
<input type="hidden" name="<?php echo 'ExchangeRate' . $index ?>" id="<?php echo 'ExchangeRate' . $index ?>" value="<?php echo $record->ExchangeRate; ?>" />
<input type="hidden" name="<?php echo 'Grossdutypayable' . $index ?>" id="<?php echo 'Grossdutypayable' . $index ?>" value="<?php echo $record->Grossdutypayable; ?>" />
<input type="hidden" name="<?php echo 'CustomDutyExpensesPerKG' . $index ?>" id="<?php echo 'CustomDutyExpensesPerKG' . $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 'BasicPriceInMTon' . $index ?>" id="<?php echo 'BasicPriceInMTon' . $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 'CustomSHCess' . $index ?>" id="<?php echo 'CustomSHCess' . $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 'Grossdutypayable' . $index ?>" id="<?php echo 'Grossdutypayable' . $index ?>" value="<?php echo $record->Grossdutypayable; ?>" /> -->
<!-- <input type="hidden" name="<?php echo 'QuantityKG' . $index ?>" id="<?php echo 'QuantityKG' . $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 'ProductPrice' . $index ?>" id="<?php echo 'ProductPrice' . $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 'Grossdutypayable' . $index ?>" id="<?php echo 'Grossdutypayable' . $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 'TotalValue' . $index ?>" id="<?php echo 'TotalValue' . $index ?>" value="<?php echo $record->ProductPrice; ?>" />
<input type="hidden" name="<?php echo 'ExchangeRate' . $index ?>" id="<?php echo 'ExchangeRate' . $index ?>" value="<?php echo $record->ExchangeRate; ?>" />
<!-- <input type="hidden" name="<?php echo 'AfterCustomEDcess' . $index ?>" id="<?php echo 'AfterCustomEDcess' . $index ?>" value="<?php echo $record->AfterCustomEdCess; ?>" /> -->
<!-- <input type="hidden" name="<?php echo 'CustomEDcess' . $index ?>" id="<?php echo 'CustomEDcess' . $index ?>" value="<?php echo $record->CustomEdCess; ?>" /> -->
<input type="hidden" name="<?php echo 'FreightType' . $index ?>" id="<?php echo 'FreightType' . $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 'FreightValue' . $index ?>" id="<?php echo 'FreightValue' . $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 'Per' . $index ?>" id="<?php echo 'Per' . $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 'AfterFreightValue' . $index ?>" id="<?php echo 'AfterFreightValue' . $index ?>" value="<?php echo $record->AfterFreightValue; ?>" /> -->
<input type="hidden" name="<?php echo 'AssessableValue' . $index ?>" id="<?php echo 'AssessableValue' . $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 'IGST' . $index ?>" id="<?php echo 'IGST' . $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 'DutyImpact' . $index ?>" id="<?php echo 'DutyImpact' . $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 'NetValue' . $index ?>" id="<?php echo 'NetValue' . $index ?>" value="<?php echo $record->NetValue; ?>" />
<input type="hidden" name="<?php echo 'AfterCustomEdCess1' . $index ?>" id="<?php echo 'AfterCustomEdCess1' . $index ?>" value="<?php echo $record->AfterCustomEdCess; ?>" />
<?php
if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == REQITEM_Emergency_PO_CREATED || $PONOStatus == PO_APPROVED) { ?>
<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-target='#viewimportmodal' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#viewimportmodal"><i class="fa fa-eye" data-toggle="tooltip" title="Click here to view the <?php echo $record->ReqNo; ?>Click here to view Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> </td>
<?php
} ?>
</tr> <?php
//echo $record->AfterLandingCharge + $TotalLanding;
$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;
//echo $totorder;
$totorder = $totorder + $record->TotalOrderValue;
//echo $totorder;
$totfreight = $totfreight + $record->AfterFreightValue;
$totassesable = $totassesable + $record->AssessableValue;
$totSubtotal = $totSubtotal + $record->SubTotal;
$totigst = $totigst + $record->AfterIGST;
//echo $totcustomED;
// $totorder=$record->TotalOrderValue;
// //$ServiceDescription=$record->ServiceDescription;
// echo $totorder;
//alert($totorder);
}
?>
<input type="hidden" name="txtRowCount" id="txtRowCount" value="<?php echo $index; ?>">
<?php
//echo $totcustomED;
$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>
<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>
<!-- <input type="text" name="txttot" id="txtPONO" value=<?php echo "$totalhidden"; ?>> -->
</div>
<input type="hidden" name="txttot" id="txttot" value=<?php echo $totalhidden ?>>
<!--################################################################## -->
<?php if (!empty($update)) { ?>
<div class="col-md-12" id="editpodiv">
<div class="col-md-12"><label>Editable POScreen</label>
<table id="edittable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;">
<thead>
<tr>
<th>Sno</th>
<th>PONO</th>
<!-- <th>Material</th> -->
<!-- <th>Date</th> -->
<th>LineItemNo</th>
<th>Entity</th>
<th>OldValue</th>
<th>NewValue</th>
<th>UpdatedBy</th>
<th>UpdateOn</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($getlogpodtl)) {
//print_r($getlogpodtl); die;
$inde = 0;
foreach ($getlogpodtl as $oldpo) {
$inde = $inde + 1;
?>
<tr id="<?php echo $inde; ?>">
<td><?php echo $inde; ?></td>
<td><?php echo $oldpo->PONO ?></td>
<!--
<?php if ($oldpo->logDate != '-') {
$logdate = date('d-m-Y', strtotime($oldpo->logDate));
} else {
$logdate = '-';
} ?>
<td><?= $logdate; ?></td> -->
<td><?php echo $oldpo->LineItemNos; ?></td>
<td><?php echo $oldpo->entity ?></td>
<?php if ($oldpo->entity == 'PO DateChanged') {
$oldValue = date('d-m-Y', strtotime($oldpo->oldValue));
} else {
$oldValue = $oldpo->oldValue;
} ?>
<td><?php echo $oldValue . '-' . $oldpo->SupplierName; ?></td>
<?php if ($oldpo->entity == 'PO DateChanged') {
$newValue = date('d-m-Y', strtotime($oldpo->newValue));
} else {
$newValue = $oldpo->newValue;
} ?>
<td><?php echo $newValue ?></td>
<td><?php echo $oldpo->FirstName ?></td>
<td><?php $date = new DateTime($oldpo->UpdatedOn);
echo $date->format('d-m-Y'); ?></td>
</tr>
<?php
}
}
?>
</tbody>
<?php } else {
} ?>
</table>
</div>
</div>
<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" /> -->
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<input type="hidden" name="txtRow" id="txtRow" value="<?php echo $index; ?>" />
<input type="hidden" name="txtPONO" id="txtPONO" value="<?php echo $PONO; ?>" />
<input type="hidden" name="Budget" id="Budget" value="<?php echo $BudgetType; ?>" />
<a class="btn btn-cancel Save" ID="Cancel" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">Cancel</span></a>
<?php if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED) {
if ($PONOStatus == PO_DRAFT) { ?>
<a class="btn btn-success Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<?php } ?>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-approved Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<!-- <input type="reset" class="btn btn-success" value="Reset"> -->
<?php } else { ?>
<?php if ($DEPCode == FINANCE) { ?>
<a class="btn btn-success" ID="OK" onclick="PageRedirect()">OK</a>
<?php } else { ?>
<!-- <input type="reset" class="btn btn-success" value = "OK"> -->
<a class="btn btn-success Submit" ID="Submit" onclick="Save(2)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-approved Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-success" href="<?php echo base_url(); ?>purchaseorderListing">OK</a>
<?php } ?>
<?php } ?>
</div>
<br />
</div>
<label>Request On :</label><?php echo $Reqon; ?><br />
<label>Request By :</label><?php echo $RequesterName; ?><br />
<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>
</div>
</section>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/html" id="ImportList">
<tr id="<%=index%>">
<td align="left"><%=index%></td>
<td align="left"><%=ReqNo%></td>
<td align="left"><%=MaterialCode%></td>
<td align="left"><%=Description%></td>
<td align="left"><%=Quantity%></td>
<td align="left"><%=UOM%></td>
<td align="left"><%=Rate%></td>
<td align="left"><%=BasicAmount%></td>
<td align="left"><%=ReceivedQty%></td>
<td align="left"><%=RejectedQty%></td>
<td align="left"><%=PendingQty%></td>
<!-- <td align="left"><%=index%></td>
<td align="left"><%=ReqNo%></td>
<td align="left"><%=ItemName%></td>
<td align="left"><%=Quantity%></td>
<td align="left"><%=UOM%></td>
<td align="left"><%=Rate%></td>
<td align="left"><%=BasicAmount%></td> -->
<!-- <td align="left"><%=Taxvalue%></td>
<td align="left"><%=TotalValue%></td> -->
<td>
<a data-target='#editimportpomodel' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#editimportpomodel"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=ReqNo%> Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick="DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del"><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
</script>
<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 viewAvlBudAmt = '<?php echo $AvlAmount ?>';
//var viewAvlBudAmt='<?php echo $AvilableBudget ?>';
$('#ViewAvlBudAmt').val(parseFloat(viewAvlBudAmt).toFixed(2));
var SelectedMaterialCode = [];
var RequistQuantity = '';
var AvilBudAmt = '';
var CollIndex = 0;
//var index='';
var index = '<?php echo $index; ?>';
//alert(index);
// var index=$('#txtRowCount').val();
var userid = '';
var NilType = '<?php echo NILTYPE; ?>';
var PercentageType = '<?php echo PERCENTAGE; ?>';
var IsEdit = '0';
var SelectedMaterialList = {
Mat: []
};
$("#BudgetType").change(function() {
var aa = $("#BudgetType option:selected").text();
$('#Budget').val(aa);
});
$('#Importoption').attr("style", "pointer-events: none;");
$('#Insurance').change(function() {
var insuree = $('#Insurance').val();
//console.log(insuree);
var insure = $("#Insurance :selected").text();
// var insure=$('#Insurance').Value();
//console.log(insure);
if (insure == 'YES') {
$('#insurancenum').show();
$('#InsuranceNumber').val('Yes');
} else {
$('#insurancenum').hide();
}
});
var insureoption = <?php echo json_encode($Insurance, JSON_PRETTY_PRINT) ?>;
var insureno = <?php echo json_encode($InsuranceNumber, JSON_PRETTY_PRINT) ?>;
//console.log(insureoption);
if (insureoption == 1) {
$('#insurancenum').show();
$('#InsuranceNumber').val(insureno);
} else {
$('#insurancenum').hide();
}
var paymentoption = <?php echo json_encode($PaymentTerms, JSON_PRETTY_PRINT) ?>;
var payvalue = <?php echo json_encode($PaymentTermsCode, JSON_PRETTY_PRINT) ?>;
//alert(payvalue);
if (paymentoption == 'PT08') {
$('#otheroptiondiv').show();
$('#Otherpayment').val(payvalue);
}
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();
}
// $('#ExchangeRate').val(<?php echo $ExchangeRate; ?>);
var budamt = <?php echo $AvilableBudget; ?>;
//console.log(budamt);
$('#EditAvlBudAmt').val(<?php echo $AvlAmount; ?>);
$('#EditAvlBudAmt').val(parseFloat(budamt).toFixed(2));
//var a=$('#ExchangeRate').val();
//alert(a);
var txtexchangerate = parseFloat($('#ExchangeRate').val());
$('#EditExchangeRt').val(parseFloat(txtexchangerate).toFixed(2));
var txtbasics = parseFloat($('#BasicPriceInMTon').val());
//alert(txtexchangerate);
//alert(txtbasics);
var basicpriceinus = parseFloat($('#BasicPriceinUS').val());
var txtbasic = txtexchangerate * basicpriceinus;
//alert(txtbasic);
$('#EditINRBasicvalue').val(txtbasic);
$('#currencytype').change(function() {
//alert();
var id = $('#currencytype').val();
//alert(id);
var symbol = <?php echo json_encode($Currency, JSON_PRETTY_PRINT) ?>;
//alert(symbol);
//alert(JSON.stringify(symbol));
$.each(symbol, function(idx, obj) {
//alert(JSON.stringify(symbol[i]));
//console.log(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 Value In ' + code + '(' + sign + ')' + ' per UOM';
document.getElementById("labelBasicINR").innerHTML = 'Basic Price in INR:' + code + '(' + sign + ')';
document.getElementById("labelEditRate").innerHTML = 'Rate in ' + sign;
document.getElementById("labelEditBasicPriceUs").innerHTML = 'Basic Value In ' + code + '(' + sign + ')' + ' per UOM';
document.getElementById("labelEditBasicINR").innerHTML = 'Basic Price in INR:' + code + '(' + sign + ')';
document.getElementById("labelTotalAmount").innerHTML = 'Total Amount ' + code + '(' + sign + ')';
document.getElementById("labelEditTotalAmount").innerHTML = 'Total Amount ' + code + '(' + sign + ')';
document.getElementById("labelViewTotalAmount").innerHTML = 'Total Amount ' + code + '(' + sign + ')';
}
});
});
$('#drpSupplier').change(function() {
var cd = $("#drpSupplier option:selected").text();
//alert(cd);
$("#changeSup").val(cd);
var id = $('#drpSupplier').val();
$("#SupAddress").val('');
if (id != '0') {
var y = <?php echo json_encode($Suplist, JSON_PRETTY_PRINT) ?>;
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 (a=="After")
// {
// //alert();
// document.getElementById("After").checked = true;
// }
// else
// document.getElementById("Before").checked = true;
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));
}
// else
// {
// // $("#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 ?>';
var AvlBudAmt = '<?php echo $AvilableBudget ?>';
//alert(JSON.stringify(Material));
// For Binding DepartmentName
$.each(y, function(idx, obj) {
if (obj.ReqNo === id) {
$("#deptName").val(obj.DepartmentName);
$("#CostCenter").val(obj.CostCenterCode);
}
});
$("#AvlBudAmt").val(parseFloat(AvlBudAmt).toFixed(2));
// 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 = '';
});
var reqq = '';
$('#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;
reqq = RequistQuantity;
//RequistQuantity=parseFloat($('#Quantity').val());
//console.log(RequistQuantity);
}
});
}
} else {
alert('Please select the MaterialCode');
return false;
}
var d = $('#drpSupplier').val();
});
function USRate() {
//if($('#imBasicPrice').val() != '' && $('#ExchangeRate').val() != '')
//{
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.ceil(txtINR*10)/10;
txtINR = Math.round(txtINRvalue);
//alert(txtINR);BasicPriceTax
$('#AfterBasicPriceTax').val(txtINR);
$('#imBasicPrice').val(txtbasics);
$('#ExchangeRt').val(txtexchangerate);
$('#EditAfterBasicPriceTax').val(txtINR);
$('#EditimBasicPrice').val(txtbasics);
$('#EditExchangeRt').val(parseFloat(txtexchangerate).toFixed(2));
$('#EditINRBasicvalue').val(txtINRvalue);
//}
}
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() {
if (EditQtyZerocheck()) {
//var txteditQuantity=parseFloat($('#EditQuantity').val());
var txteditQuantity = $('#EditQuantity').val() == '' ? '0.00' : $('#EditQuantity').val()
//var txteditUnitPrice=parseFloat($('#EditRate').val());
var txteditUnitPrice = $('#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 QtyZerocheck() {
if (($('#Rate').val() == "0") || $('#Quantity').val() == "0" || ($('#Rate').val() == '') || $('#Quantity').val() == '') {
alert('Please Enter A Valid Number for Rate and Quantity');
$('#txtBasicValue').val(0);
$('#imBasicPrice').val(0);
$('#ExchangeRt').val(0);
$('#INRBasicvalues').val(0);
$('#AfterBasicPriceTax').val(0);
$('#INRBasicvalue').val(0);
return false;
} else
return true;
}
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() != '') {
if (QtyZerocheck()) { //alert('inside');
// var txtQuantity = parseFloat( $('#Quantity').val());
var txtQuantity = $('#Quantity').val() == '' ? '0.00' : $('#Quantity').val()
//var txtUnitPrice = parseFloat($('#Rate').val());
var txtUnitPrice = $('#Rate').val() == '' ? '0.00' : $('#Rate').val()
var Tot = txtQuantity * txtUnitPrice
$('#txtBasicValue').val(parseFloat(Tot).toFixed(2));
$('#TotalExp').val(Tot);
$('#imBasicPrice').val(parseFloat(Tot).toFixed(2));
var txtbasics = parseFloat($('#imBasicPrice').val());
var txtexchangerate = parseFloat($('#ExchangeRate').val());
//console.log(txtexchangerate);
$('#ExchangeRt').val(txtexchangerate);
var txtINRvalue = txtbasics * txtexchangerate;
$('#INRBasicvalues').val(parseFloat(txtINRvalue).toFixed(2));
$('#INRBasicvalue').val(parseFloat(txtINRvalue).toFixed(2));
$('#BasicPriceTax').val(parseFloat(txtINRvalue).toFixed(2));
//txtINR = Math.ceil(txtINR*10)/10;
txtINR = Math.round(txtINRvalue);
//alert(txtINR);BasicPriceTax
$('#AfterBasicPriceTax').val(parseFloat(txtINR).toFixed(2));
$('#imBasicPrice').val(parseFloat(txtbasics).toFixed(2));
$('#ExchangeRt').val(parseFloat(txtexchangerate).toFixed(2));
$('#EditAfterBasicPriceTax').val(parseFloat(txtINR).toFixed(2));
$('#EditimBasicPrice').val(parseFloat(txtbasics).toFixed(2));
$('#EditExchangeRt').val(parseFloat(txtexchangerate).toFixed());
$('#EditINRBasicvalue').val(parseFloat(txtINRvalue).toFixed(2));
Calculateloadingcharge();
}
}
}
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('');
var txtlanding = 0;
var txtbasicprice = 0;
//txtlanding=$('#LandingCharge').val() == '' ? '0.00' : $('#LandingCharge').val()
txtlanding = parseFloat($('#LandingCharge').val() == '' ? '0.00' : $('#LandingCharge').val());
//$('#Rate').val() == '' ? '0.00' : $('#Rate').val()
//txtbasicprice=parseFloat($('#AfterBasicPriceTax').val());
txtbasicprice = parseFloat($('#AfterBasicPriceTax').val() == '' ? '0.00' : $('#AfterBasicPriceTax').val());
//var result=(txtlanding*txtbasicprice/100);
var result = <?php echo LOADING_CHARGE; ?>;
var assessble = parseFloat(result) + parseFloat(txtbasicprice);
var assessble = <?php echo ASSESSBLE; ?>;
//$('#AfterLandingCharge').val(parseFloat(Math.round(result)));
if (isNaN(result)) {
$('#AfterLandingCharge').val('');
$('#AfterAssessable').val(txtbasicprice.toFixed(2));
} else {
$('#AfterLandingCharge').val(result.toFixed(2));
//$('#AfterAssessable').val(assessble.toFixed(2));
}
if (isNaN(assessble)) {
$('#AfterAssessable').val(txtbasicprice);
} else {
$('#AfterAssessable').val(assessble.toFixed(2));
}
CalculateCustomduty()
}
function EditCalculateloadingcharge() {
//alert();
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);
//console.log(Assessable);
//alert(Assessable);
$('#EditAfterLandingCharge').val(result.toFixed(2));
$('#EditAfterAssessable').val(Assessable);
EditCalculateCustomduty();
//alert();
}
function CalculateCustomduty() {
var txtbasic = 0;
var txtcustompercentage = 0;
var txthighse = 0;
var txtlandingch = 0;
var sumcustom = 0;
var txtcustomduty = 0;
//var accessible=parseFloat($('#AfterAssessable').val());
var accessible = parseFloat($('#AfterAssessable').val() == '' ? '0.00' : $('#AfterAssessable').val());
//var txtcustompercentage=parseFloat($('#Customduty').val());
var txtcustompercentage = parseFloat($('#Customduty').val() == '' ? '0.00' : $('#Customduty').val());
txtcustomduty = <?php echo CUSTOM_DUTY1; ?>;
if (isNaN(txtcustomduty)) {
$('#AfterCustomduty').val('');
} else {
$('#AfterCustomduty').val(parseFloat(txtcustomduty).toFixed(2));
}
CalculateCustomEdcess()
}
function ExceedEditQuantityCheck() { //salert();
// RequistQuantity
var EnterQuantity = $("#EditQuantity").val() == '' ? "0.00" : parseFloat($("#EditQuantity").val());
var ReqQuantity = parseFloat(RequistQuantity);
//alert(reqq);
//var ReqQuantity=parseFloat($('#EditQuantity').val());
//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 CalculateCustomEdcess() {
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($('#AfterCustomduty').val());
txtcustomduty1 = parseFloat($('#AfterCustomduty').val() == '' ? '0.00' : $('#AfterCustomduty').val());
// txtedcesspercentage=parseFloat($('#CustomEDcess').val());
txtedcesspercentage = parseFloat($('#CustomEDcess').val() == '' ? '0.00' : $('#CustomEDcess').val());
//var txtcustomedsess=(totalval*txtedcesspercentage)/100;
txtcustomedsess = <?php echo CUSTOM_ED1; ?>;
if (isNaN(txtcustomedsess)) {
$('#AfterCustomEDcess').val('');
} else {
$('#AfterCustomEDcess').val(parseFloat(txtcustomedsess).toFixed(2));
}
CalculateCustomSHcess();
}
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 CalculateCustomSHcess() { //alert();
var landingch = 0;
var customch = 0;
var totcustomsh = 0;
var txtshpercentage = 0;
var totresult = 0;
//customch=parseFloat($('#AfterCustomduty').val());
//console.log(customch);
customch = parseFloat($('#AfterCustomduty').val() == '' ? '0.00' : $('#AfterCustomduty').val());
//txtshpercentage=parseFloat($('#CustomSHcess').val());
txtshpercentage = parseFloat($('#CustomSHcess').val() == '' ? '0.00' : $('#CustomSHcess').val());
//var totresult=(totcustomsh*txtshpercentage)/100;
totresult = <?php echo CUSTOM_SH1; ?>;
if (isNaN(totresult)) {
$('#AfterCustomSHcess').val('');
} else {
$('#AfterCustomSHcess').val(parseFloat(totresult).toFixed(2));
}
//CalculateaddlExciseDuty();
CalculateIgst();
}
function CalculateIgst() {
var basucprice = parseFloat($('#AfterBasicPriceTax').val());
//var basucprice=$('#AfterBasicPriceTax').val() == '' ? '0.00' : $('#AfterBasicPriceTax').val();
var landing = parseFloat($('#AfterLandingCharge').val());
//var landing=$('#AfterLandingCharge').val() == '' ? '0.00' : $('#AfterLandingCharge').val();
var custom = parseFloat($('#AfterCustomduty').val());
//var custom=$('#AfterCustomduty').val() == '' ? '0.00' : $('#AfterCustomduty').val();
var customsh = parseFloat($('#AfterCustomSHcess').val());
//var customsh=$('#AfterCustomSHcess').val() == '' ? '0.00' : $('#AfterCustomSHcess').val();
var customed = parseFloat($('#AfterCustomEDcess').val());
//var customed=$('#AfterCustomEDcess').val() == '' ? '0.00' : $('#AfterCustomEDcess').val();
var assessble = parseFloat($('#AfterAssessable').val());
//var assessble=$('#AfterAssessable').val() == '' ? '0.00' : $('#AfterAssessable').val();
// var tot=parseFloat(assessble)+parseFloat(custom)+parseFloat(customsh)+
// parseFloat(customed);
var tot = <?php echo SUBTOTAL; ?>;
var igstpercentage = parseFloat($('#Igst').val());
var afterigst = <?php echo IGST; ?>;
if (isNaN(tot)) {
$('#Subtotal').val('');
} else {
$('#Subtotal').val(parseFloat(tot).toFixed(2));
}
if (isNaN(afterigst)) {
$('#AfterIgst').val('');
} else {
$('#AfterIgst').val(parseFloat(afterigst).toFixed(2));
}
var grossexp = custom + customsh + customed + afterigst;
//$('#Grossdutypayable').val(parseFloat(grossexp).toFixed(2));
var txtgrossduty = <?php echo GROSS_DUTY1; ?>;
//console.log(grossexp);
if (isNaN(txtgrossduty)) {
$('#Grossdutypayable').val('');
} else {
$('#Grossdutypayable').val(parseFloat(txtgrossduty).toFixed(2));
}
CalculateCtable();
}
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 = parseFloat($('#AfterBasicPriceTax').val() == '' ? '0.00' : $('#AfterBasicPriceTax').val());
//landingch=parseFloat($('#EditAfterLandingCharge').val());
landingch = parseFloat($('#EditAfterLandingCharge').val() == '' ? '0.00' : $('#EditAfterLandingCharge').val());
//highsesssalles=parseFloat($('#EditAfterHighseas').val());
// customch=parseFloat($('#EditAfterCustomduty').val());
customch = parseFloat($('#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 CalculateCtable() {
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($('#Quantity').val());
var igst = parseFloat($('#AfterIgst').val());
var totduty = parseFloat($('#Grossdutypayable').val());
var txtdutyimpact = <?php echo DUTYIMPACT; ?>;
// console.log(txtdutyimpact);
if (isNaN(txtdutyimpact)) {
$('#DutyImpact').val('');
} else {
$('#DutyImpact').val(parseFloat(txtdutyimpact).toFixed(2));
}
quantity = parseFloat($('#PurQuantity').val());
var dutyimpact = parseFloat($('#DutyImpact').val());
var peruom = <?php echo PURCHASE_RATE1; ?>;
if (isNaN(peruom)) {
$('#CustomDutyExpenses').val('');
} else {
$('#CustomDutyExpenses').val((peruom).toFixed(2));
}
var customdutyexp = $('#CustomDutyExpenses').val() == '' ? '0.00' : $('#CustomDutyExpenses').val();
var basicqtyval = $('#AfterBasicPriceTax').val() == '' ? '0.00' : $('#AfterBasicPriceTax').val();
var qty = parseFloat($('#Quantity').val());
var clearing = $('#ClearingCharges').val() == '' ? '0.00' : $('#ClearingCharges').val();
var basicres = <?php echo MATBYQTY; ?>;
var clear = <?php echo CLEARINGQTY; ?>;
var basicnett = parseFloat(basicres) + parseFloat(clear) + parseFloat(customdutyexp);
if (isNaN(basicnett)) {
$('#Nett').val('');
} else {
$('#Nett').val((basicnett).toFixed(2));
}
}
function EditCalculateCtable() {
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));
}
}
//index = parseInt(index)+1;
function ExceedQuantityCheck() {
// RequistQuantity
var EnterQuantity = $("#Quantity").val() == '' ? "0.00" : parseFloat($("#Quantity").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.');
// //$('#Quantity').val(RequistQuantity);
// $('#Quantity').focus();
// return false;
// }
// else
//{
return true;
//}
}
var avalbudAmte = <?php echo json_encode($AvlAmount, JSON_PRETTY_PRINT) ?>;
var Sum = <?php echo json_encode($SavedSum, JSON_PRETTY_PRINT) ?>;
//console.log(Sum)
//console.log(avalbudAmte);
var totavlbud = avalbudAmte + Sum;
//console.log(totavlbud);
function validateEditExceedLimit() {
//var avalbudAmt = parseFloat($('#EditAvlBudAmt').val());
// var addedamount=parseFloat($('#txtavlbud').val());
// alert(addedamount);
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;
//}
}
var avalbudAmt = <?php echo json_encode($AvlAmount, JSON_PRETTY_PRINT) ?>;
//var avalbudAmte= <?php echo json_encode($AvlAmount, JSON_PRETTY_PRINT) ?>;
var Sum = <?php echo json_encode($SavedSum, JSON_PRETTY_PRINT) ?>;
// console.log(Sum)
var totavlbud = avalbudAmt + Sum;
function validateExceedLimit() {
//alert('ddf');
//avalbudAmt = parseFloat($('#AvlBudAmt').val());
var basicAmountRate = parseFloat($('#txtBasicValue').val());
var totalAmount = parseFloat($('#TotalExp').val());
var exchangerate = parseFloat($('#ExchangeRt').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.');
// $('#Rate').focus();
// return false;
// }
// else
// {
return true;
//}
}
$('.AddImport').click(function() {
//alert('out');
// if(validateImport())
if (validateImport() && ExceedQuantityCheck() && validateExceedLimit() && QtyZerocheck()) {
//alert('in');
index = parseInt(index) + 1;
var temp = index;
//alert(temp);
var Reqnumber = $('#ReqNo').val();
//alert(JSON.strigify(Reqnumber));
var departmentName = $('#deptName').val();
var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').val();
var materialName = $("#ItemName").val();
var uom = $("#UOM").val();
var quantity = $("#Quantity").val();
var itemRate = $("#Rate").val();
var BasicAmt = parseFloat($("#txtBasicValue").val());
var taxamt = parseFloat($("#RMCIncludingCustomers").val());
var totalexp = parseFloat($("#TotalExp").val());
// console.log(totalexp);
var Exchangerate = parseFloat($("#ExchangeRt").val());
var Basicpriceinus = parseFloat($("#imBasicPrice").val());
var BasicPrice = $("#BasicPriceTax").val();
var AfterBasicPrice = parseFloat($("#AfterBasicPriceTax").val());
var LandingChargee = $("#LandingCharge").val();
var AfterLandingChargee = $("#AfterLandingCharge").val();
//var AfterHighseass=($"#AfterHighseas").val();
var CustomDutyy = $("#Customduty").val();
var AfterCustomDutyy = $("#AfterCustomduty").val();
var CustomED = $("#CustomEDcess").val();
var AfterCustomED = $("#AfterCustomEDcess").val();
var CustomSH = $("#CustomSHcess").val();
var AfterCustomSH = $("#AfterCustomSHcess").val();
var GrossDuty = $("#Grossdutypayable").val();
var PurchaseQuantity = $("#PurQuantity").val();
var CustomDutyExpense = $("#CustomDutyExpenses").val();
var Assessable = $('#AfterAssessable').val();
var Subtotal = $('#Subtotal').val();
var Igst = $('#Igst').val();
var AfterIgst = $('#AfterIgst').val();
var DutyImpact = $('#DutyImpact').val();
var ClearingCharges = $('#ClearingCharges').val();
var Nett = $('#Nett').val();
var FreightType = $('#drpaddFreight').val();
var Nooftrip = $('#addNOOfTrips').val();
var Freightrate = $('#addtxtFreight').val();
var AfterFreightAmount = $('#addtxtAfterFreight').val();
var splins = $.trim(tinymce.get('addtxtInstruction').getContent());
var per = $('#AddPer').val();
if (per == '') {
var per = $('#UOM').val();
}
// console.log(FreightType);
// console.log(Nooftrip);
// console.log(Freightrate);
// console.log(AfterFreightAmount);
var receivedqty = '';
var rejectedqty = '';
var pendingqty = '';
//console.log(CustomED);
$('#MaterialCode option[value=' + materialCode + ']').remove();
$('#MaterialCode option[value=' + materialCode + ']').remove();
SelectedMaterialCode[CollIndex] = materialCode;
CollIndex = CollIndex + 1;
SelectedMaterialList.Mat.push({
"materialCode": materialCode,
"ReqNo": Reqnumber,
});
//index = parseInt(index)+1;
// populateValueMainFormForImportTax();
//alert('in');
var template = jQuery("#ImportList").html();
$('#ImportAppend').append(_.template(template, {
index: temp,
ReqNo: Reqnumber,
MaterialCode: materialCode,
Description: materialName,
Quantity: quantity,
UOM: uom,
Rate: itemRate,
BasicAmount: BasicAmt,
Taxvalue: taxamt,
TotalValue: totalexp,
ReceivedQty: receivedqty,
RejectedQty: rejectedqty,
PendingQty: pendingqty
}));
//alert(JSON.strigify(BasicAmt));
//$('#ImportAppend').append(_.template(template,{index:temp,ReqNo:Reqnumber,ItemName:materialName,Quantity:quantity,UOM:uom,Rate:itemRate,BasicAmount:BasicAmt,Taxvalue:taxamt,TotalValue:totalexp}));
//clearTaxField();
//from above defined variables
var theForm = $(".ImportPO");
addHidden(theForm, "Reqnumber" + temp, Reqnumber);
addHidden(theForm, "departmentName" + temp, departmentName);
addHidden(theForm, "AvlBudAmt" + temp, AvilBudget);
addHidden(theForm, "costCode" + temp, costCode);
addHidden(theForm, "materialCode" + temp, materialCode);
addHidden(theForm, "materialName" + temp, materialName);
addHidden(theForm, "uom" + temp, uom);
addHidden(theForm, "quantity" + temp, quantity);
addHidden(theForm, "itemRate" + temp, itemRate);
addHidden(theForm, "BasicAmt" + temp, BasicAmt);
addHidden(theForm, "taxamt" + temp, taxamt);
addHidden(theForm, "ExchangeRate" + temp, Exchangerate);
addHidden(theForm, "BasicPriceTax" + temp, BasicPriceTax);
addHidden(theForm, "BasicPriceinUS" + temp, Basicpriceinus);
addHidden(theForm, "AfterBasicPriceTax" + temp, AfterBasicPrice);
addHidden(theForm, "LandingCharge" + temp, LandingChargee);
addHidden(theForm, "AfterLandingCharge" + temp, AfterLandingChargee);
addHidden(theForm, "CustomDuty" + temp, CustomDutyy);
addHidden(theForm, "AfterCustomDuty" + temp, AfterCustomDutyy);
addHidden(theForm, "CustomEdCess" + temp, CustomED);
addHidden(theForm, "AfterCustomEdCess1" + temp, AfterCustomED);
addHidden(theForm, "CustomSHCess" + temp, CustomSH);
addHidden(theForm, "AfterCustomSHCess" + temp, AfterCustomSH);
addHidden(theForm, "Grossdutypayable" + temp, GrossDuty);
addHidden(theForm, "QuantityKG" + temp, PurchaseQuantity);
addHidden(theForm, "CustomDutyExpensesPerKG" + temp, CustomDutyExpense);
addHidden(theForm, "TotalValue" + temp, totalexp);
addHidden(theForm, "ProductPrice" + temp, BasicAmt);
addHidden(theForm, "BasicPriceInMTon" + temp, Basicpriceinus);
addHidden(theForm, "BasicINRValue" + temp, AfterBasicPrice);
addHidden(theForm, "FreightType" + temp, FreightType);
addHidden(theForm, "NoOfTrip" + temp, Nooftrip);
addHidden(theForm, "FreightValue" + temp, Freightrate);
addHidden(theForm, "AfterFreightValue" + temp, AfterFreightAmount);
addHidden(theForm, "Per" + temp, per.trim());
addHidden(theForm, "Addinstruction" + temp, splins.trim());
addHidden(theForm, "AssessableValue" + temp, Assessable);
addHidden(theForm, "SubTotal" + temp, Subtotal);
addHidden(theForm, "IGST" + temp, Igst);
addHidden(theForm, "AfterIGST" + temp, AfterIgst);
addHidden(theForm, "DutyImpact" + temp, DutyImpact);
addHidden(theForm, "NetValue" + temp, ClearingCharges);
addHidden(theForm, "ClearingCharge" + temp, Nett);
// var a=parseFloat($('#AfterCustomEdCess1'+temp).val());
// console.log(a);
//addHidden(theForm,"TotalitemExp"+temp,TotalValue);
// alert(JSON.stringify(totalexp));
// addHidden(theForm,"AfterBasicPriceTax"+temp,AfterBasicPriceTax);
//addHidden(theForm,"AfterBasicPriceTax"+temp,AfterBasicPriceTax);
$('#txtRow').val(index);
var a = parseFloat($('#txtRow').val());
//alert(a)
populateValueMainFormForImportTax();
clearTaxField();
}
});
$("#viewimportmodal").on("shown.bs.modal", function(e) {
// alert();
userid = $(e.relatedTarget).data('userid');
//alert(userid);
//alert('inadd');
var tr = document.getElementById(userid);
//alert(tr);
var cellval = tr.cells;
//alert(cellval);
var id = $('#Reqnumber' + userid).val();
//alert(id);
//var a=$('#Reqnumber'+userid).val();
//alert(a)
$('#ViewReqNo').val($('#Reqnumber' + userid).val());
$('#ViewdeptName').val($('#departmentName' + userid).val());
$("#ViewCostCenter").val($('#costCode' + userid).val());
// $('#EditAvlBudAmt').val($('#AvilBudget'+userid).val());
$('#ViewItemName').val($('#materialName' + userid).val());
$('#ViewUOM').val($('#uom' + userid).val());
$('#ViewQuantity').val($('#quantity' + userid).val());
//$('#ViewExchangeRt').val($('#'))
//RequistQuantity = $('#quantity'+userid).val();
$('#ViewRate').val($('#itemRate' + userid).val());
var q = parseFloat($('#quantity' + userid).val());
var r = parseFloat($('#itemRate' + userid).val());
var p = q * r;
// console.log(p);
$('#ViewtxtBasicValue').val(parseFloat(p).toFixed(2));
$('#ViewimBasicPrice').val(parseFloat(p).toFixed(2));
var a = parseFloat($('#ViewtxtBasicValue').val())
var b = parseFloat($('#ExchangeRate').val());
var c = a * b;
// console.log(c);
$('#ViewINRBasicvalue').val(parseFloat(c).toFixed(2));
$('#ViewAfterBasicPriceTax').val(parseFloat(c).toFixed(2));
$('#ViewLandingCharge').val($("#LandingCharge" + userid).val());
$('#ViewAfterLandingCharge').val($("#AfterLandingCharge" + userid).val());
$('#ViewCustomduty').val($("#CustomDuty" + userid).val());
$('#ViewAfterCustomduty').val($("#AfterCustomDuty" + userid).val());
$('#ViewCustomEDcess').val($("#CustomEdCess" + userid).val());
$('#ViewAfterCustomEDcess').val($("#AfterCustomEDCess" + userid).val());
$('#ViewCustomSHcess').val($("#CustomSHCess" + userid).val());
$('#ViewAfterCustomSHcess').val($("#AfterCustomSHCess" + userid).val());
$('#ViewGrossdutypayable').val($("#Grossdutypayable" + userid).val());
$('#ViewPurQuantity').val($("#QuantityKG" + userid).val());
$('#ViewCustomDutyExpenses').val($("#CustomDutyExpensesPerKG" + userid).val());
//$('#ViewAfterBasicPriceTax').val($("#BasicINRValue"+userid).val());
$('#ViewTotalExp').val($("#TotalValue" + userid).val());
// $('#ViewINRBasicvalue').val($("#BasicINRValue"+userid).val());
$('#ViewAfterAssessable').val($("#AssessableValue" + userid).val());
$('#ViewAfterCustomEDcess').val($("#AfterCustomEdCess1" + userid).val());
$('#ViewSubtotal').val($("#SubTotal" + userid).val());
$('#ViewIgst').val($("#IGST" + userid).val());
$('#ViewAfterIgst').val($("#AfterIGST" + userid).val());
$('#ViewDutyImpact').val($("#DutyImpact" + userid).val());
$('#ViewClearingCharges').val($("#ClearingCharge" + userid).val());
$('#ViewNett').val($("#NetValue" + userid).val());
$('#drpviewFreight').val($("#FreightType" + userid).val());
$('#viewNOOfTrips').val($("#NoOfTrip" + userid).val());
$('#viewtxtFreight').val($("#FreightValue" + userid).val());
$('#viewtxtAfterFreight').val($("#AfterFreightValue" + userid).val());
tinyMCE.get('viewtxtInstruction').setContent($('#Addinstruction' + userid).val());
var FreightType = $('#drpviewFreight').val();
if (FreightType == "PER TRIP") {
$('#ViewTripsValue').show();
} else {
$('#ViewTripsValue').hide();
}
$('#ViewPer').val($("#Per" + userid).val());
$('#ViewTotalOrderValue').val(cellval[6].innerHTML);
$("#ViewMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#ViewMaterialCode").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));
}
}
});
}
var FreightType = $('#drpviewFreight').val();
var FreightRate = $('#viewtxtFreight').val();
var FreightRateAmount = $('#viewtxtAfterFreight').val();
var Nooftrip = $('#viewNOOfTrips').val();
// console.log(FreightType);
// console.log(FreightRate);
// console.log(FreightRateAmount);
// console.log(Nooftrip);
});
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 addHidden(theForm, key, value) {
// Create a hidden input element, and append it to the form:
var input = document.createElement('input');
input.type = 'hidden';
input.name = key;
'name-as-seen-at-the-server';
input.id = key;
'name-as-seen-at-the-server';
input.value = value;
theForm.append(input);
}
function populateValueMainFormForImportTax() {
var TotalLanding = 0;
var TotalCustom = 0;
var TotalCustomED = 0;
var TotalCustomSH = 0;
var TotalGrossDuty = 0;
var TotalOrder = 0;
var TotalOrdervalue = 0;
var TotalFreight = 0;
var TotalAssessable = 0;
var TotalSubtotal = 0;
var Totaligst = 0;
//$('#txtToatlOrder').val(parseFloat(TotalOrderValue)).toFixed(2);
//var Aft=$('#AfterLandingCharge').val();
//console.log(Aft);
var rows = document.getElementById('ImportTax').rows.length;
var i = 0;
do {
i += 1;
var tr = document.getElementById(i);
if (tr != null) {
cells = tr.getElementsByTagName('td');
var rowid = cells[0].innerHTML;
var AfterLandingCharge = $('#AfterLandingCharge' + rowid).val() == '' ? '0.00' : $('#AfterLandingCharge' + rowid).val();
//console.log(AfterLandingCharge);
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 Grossdutypayable = $('#Grossdutypayable' + rowid).val() == '' ? '0.00' : $('#Grossdutypayable' + rowid).val();
var totalexp = $('#TotalValue' + rowid).val() == '' ? '0.00' : $('#TotalValue' + rowid).val();
var Frieght = $('#AfterFreightValue' + rowid).val() == '' ? '0.00' : $('#AfterFreightValue' + rowid).val();
var Assessable = $('#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();
//console.log(totalexp);
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(totalexp);
TotalFreight = parseFloat(TotalFreight) + parseFloat(Frieght);
TotalAssessable = parseFloat(TotalAssessable) + parseFloat(Assessable);
TotalSubtotal = parseFloat(TotalSubtotal) + parseFloat(Subtotal);
Totaligst = parseFloat(Totaligst) + parseFloat(Igst);
//console.log(TotalLanding);
}
} 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));
//console.log(r);
//var x=parseFloat($('#txttotalcustomED').val());
//console.log(x);
//alert(TotalOrder);
}
function clearTaxField() {
//$('#AfterBasicPriceTax').val('');
//$('#ReqNo').val('');
//$('#deptName').val('');
//$('#CostCenter').val('');
//$('#AvlBudAmt').val('');
$('#MaterialCode').val('');
$('#ItemName').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#Rate').val('');
$('#txtBasicValue').val('');
$('#imBasicPrice').val('');
$('#ExchangeRt').val('');
$('#INRBasicvalue').val('');
$('#BasicPriceTax').val('');
$('#AfterBasicPriceTax').val('');
$('#TotalExp').val('');
$('#AfterLandingCharge').val('');
$('#LandingCharge').val(0);
$('#AfterHighseas').val('');
$('#Highseas').val(0);
$('#AfterCustomduty').val('');
$('#Customduty').val(0);
$('#AfterExcisedutyTax').val('');
$('#ExcisedutyTax').val(0);
$('#AfterExcisedutyEDcess').val('');
$('#ExcisedutyEDcess').val(0);
$('#AfterExcisedutySHcess').val('');
$('#ExcisedutySHcess').val(0);
$('#AfterCustomEDcess').val('');
$('#CustomEDcess').val(0);
$('#AfterCustomSHcess').val('')
$('#CustomSHcess').val(0);
$('#AfterCustomSHcess').val('');
$('#AfterAdditionalExciseduty').val('');
$('#AdditionalExciseduty').val(0);
$('#Grossdutypayable').val('');
$('#AvailableModvat').val('');
$('#Grossexpenses').val('');
$('#PurQuantity').val('');
$('#purchaserate').val('');
$('#CustomDutyExpenses').val('');
$('#RMCIncludingCustomers').val('');
$('#drpaddFreight').val('');
$('#addNOOfTrips').val('');
$('#addtxtFreight').val('');
$('#addtxtAfterFreight').val('');
$('#AfterAssessable').val('');
$('#Subtotal').val('');
$('#Igst').val(0);
$('#AfterIgst').val('');
$('#DutyImpact').val('');
$('#ClearingCharges').val('');
$('#Nett').val('');
tinyMCE.get('addtxtInstruction').setContent('');
}
$("#editimportpomodel").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
//alert(userid);
//alert('inadd');
var tr = document.getElementById(userid);
//alert(tr);
var cellval = tr.cells;
//alert(cellval);
var id = $('#Reqnumber' + userid).val();
//alert(id);
$('#EditReqNo').val($('#Reqnumber' + userid).val());
//alert($('#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());
var as = q * r;
$('#EdittxtBasicValue').val(parseFloat(as).toFixed(2));
$('#EditimBasicPrice').val(parseFloat(as).toFixed(2));
var a = parseFloat($('#EdittxtBasicValue').val())
var b = parseFloat($('#ExchangeRate').val());
var c = a * b;
//console.log(b);
$('#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($("#CustomEdCess" + userid).val());
// $('#EditCustomEDcess').val($("#CustomEdCess"+userid).val());
//var x=parseFloat($('#CustomEDcess'+userid).val());
//console.log(x);AfterCustomEDcess
$('#EditAfterCustomEDcess').val($("#AfterCustomEdCess1" + userid).val());
var aa = parseFloat($('#EditAfterCustomEDcess').val());
// console.log(aa);
$('#EditCustomSHcess').val($("#CustomSHCess" + userid).val());
$('#EditAfterCustomSHcess').val($("#AfterCustomSHCess" + userid).val());
$('#EditGrossdutypayable').val($("#Grossdutypayable" + userid).val());
$('#EditPurQuantity').val($("#QuantityKG" + userid).val());
$('#EditCustomDutyExpenses').val($("#CustomDutyExpensesPerKG" + 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());
//$('#EditAfterBasicPriceTax').val($("#BasicINRValue"+userid).val());
$('#EditTotalExp').val($("#TotalValue" + userid).val());
//$('#EditINRBasicvalue').val($("#BasicINRValue"+userid).val());
$('#drpeditFreight').val($("#FreightType" + userid).val());
$('#editNOOfTrips').val($("#NoOfTrip" + userid).val());
$('#edittxtFreight').val($("#FreightValue" + userid).val());
$('#edittxtAfterFreight').val($("#AfterFreightValue" + userid).val());
$('#EditPer').val($("#Per" + userid).val());
tinyMCE.get('edittxtInstruction').setContent($('#Addinstruction' + userid).val());
var FreightType = $('#drpeditFreight').val();
// var type=
if (FreightType == "PER TRIP") {
///salert();
$('#EditTripsValue').show();
} else {
$('#EditTripsValue').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();
var BasicUSPrice = $("#EdittxtBasicValue").val();
var basicinr = $('#EditINRBasicvalue').val();
//console.log(basicinr);
//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();
//console.log(CustomED);
var AfterCustomED = $("#EditAfterCustomEDcess").val();
var CustomSH = $("#EditCustomSHcess").val();
var AfterCustomSH = $("#EditAfterCustomSHcess").val();
var GrossDuty = $("#EditGrossdutypayable").val();
var Quantity = $("#EditPurQuantity").val();
var CustomDutyExpense = $("#EditCustomDutyExpenses").val();
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 TotalExp = $('#EdittxtBasicValue').val();
//alert(itemRate);
//console.log(GrossDuty);
var spclins = $.trim(tinymce.get('edittxtInstruction').getContent());
var FreightType = $('#drpeditFreight').val();
var FreightRate = $('#edittxtFreight').val();
var FreightRateAmount = $('#edittxtAfterFreight').val();
var Nooftrip = $('#editNOOfTrips').val();
//console.log(FreightRateAmount);
var FreightTypename = $('#drpeditFreight').val();
if (FreightTypename != "PER TRIP") {
Nooftrip = '';
}
// console.log(FreightType);
// console.log(Nooftrip);
// console.log(FreightRate);
// console.log(FreightRateAmount);
var per = $('#EditPer').val();
if (per == '') {
var per = $('#EditUOM').val();
}
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[4].innerHTML = editQuantity;
cellval[5].innerHTML = editUOM;
cellval[6].innerHTML = itemRate;
cellval[7].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);
$('#BasicPriceInMTon' + userid).val(BasicUSPrice);
$('#BasicINRValue' + userid).val(basicinr);
$('#BasicPriceTax' + userid).val(BasicPrice);
$('#AfterBasicPriceTax' + userid).val(AfterBasicPrice);
$('#LandingCharge' + userid).val(Landingcharge);
$('#AfterLandingCharge' + userid).val(AfterLanding);
$('#CustomDuty' + userid).val(CustomDuty);
$('#AfterCustomDuty' + userid).val(AfterCustomDuty);
$('#CustomEdCess' + userid).val(CustomED);
$('#AfterCustomEdCess1' + userid).val(AfterCustomED);
$('#CustomSHCess' + userid).val(CustomSH);
$('#AfterCustomSHCess' + userid).val(AfterCustomSH);
$('#Grossdutypayable' + userid).val(GrossDuty);
$('#QuantityKG' + userid).val(Quantity);
$('#CustomDutyExpensesPerKG' + userid).val(CustomDutyExpense);
$('#TotalValue' + userid).val(TotalExp);
$('#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);
$('#FreightType' + userid).val(FreightType);
$('#NoOfTrip' + userid).val(Nooftrip);
$('#FreightValue' + userid).val(FreightRate);
$('#AfterFreightValue' + userid).val(FreightRateAmount);
$('#Per' + userid).val(per.trim());
$('#Addinstruction' + userid).val(spclins);
// var a=parseFloat($('#ProductPrice'+userid).val());
// console.log(a);
// var a=$('#FreightType'+userid).val();
// var b=$('#NoOfTrip'+userid).val();
// var c=$('#FreightValue'+userid).val();
var d = $('#AfterCustomEDCess' + userid).val();
// console.log(a);
// console.log(b);
// console.log(c);
// console.log(d);
populateValueMainFormForEditImportTax();
}
});
function populateValueMainFormForEditImportTax() {
var rows = document.getElementById('ImportTax').rows.length;
var TotalLanding = 0;
var TotalCustom = 0;
var TotalGrossDuty = 0;
var TotalCustomED = 0;
var TotalGrossExpense = 0;
var Totalvalue = 0;
var TotalOrdervalue = 0;
var TotalFreight = 0;
var TotalCustomSH = 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;
var AfterLandingCharge = $('#AfterLandingCharge' + rowid).val() == '' ? '0.00' : $('#AfterLandingCharge' + rowid).val();
//console.log(AfterLandingCharge);
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 = $('#Grossdutypayable' + rowid).val() == '' ? '0.00' : $('#Grossdutypayable' + rowid).val();
var Totalvalue = $('#TotalValue' + rowid).val() == '' ? '0.00' : $('#TotalValue' + rowid).val();
var Frieght = $('#AfterFreightValue' + rowid).val() == '' ? '0.00' : $('#AfterFreightValue' + rowid).val();
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();
//var RMC=$('#RMCIncludingCustomers'+rowid).val()==''?'0.00':$('#RMCIncludingCustomers'+rowid).val();
//console.log(Totalvalue);
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(Totalvalue);
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));
$('#txttotalcustomSH').val(parseFloat(TotalCustomSH).toFixed(2));
$('#txttotalgrossduty').val(parseFloat(TotalGrossDuty).toFixed(2));
$('#txttotalcustomED').val(parseFloat(TotalCustomED).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($('#txttotallanding').val());
//console.log(a);
//$('#txttotallanding').val(parseFloat(TotalLanding).toFixed(2));
}
// function DeleteRow(rowid)
// { //alert('Delete');
// var DelRows = $('#txtDeletedRow').val();
// var answer = confirm(" Do you want to delete the Item from the List?")
// if (answer)
// {
// //alert('Confirm');
// var td = document.getElementById(rowid);
// td.parentNode.removeChild(td);
// var removeItem = $('#materialCode'+rowid).val();
// SelectedMaterialCode.splice( SelectedMaterialCode.indexOf('removeItem'), 1 );
// $.each(SelectedMaterialList.Mat, function(i, el){
// if (this.materialCode == removeItem){//Type = '';
// SelectedMaterialList.Mat.splice(i, 1);
// }
// });
// // alert(SelectedMaterialCode);
// if(DelRows != '')
// {
// DelRows = DelRows + ":" + rowid;
// }
// else
// {
// DelRows= "0" + ":" + rowid;
// }
// $('#txtDeletedRow').val(DelRows);
// populateValueMainFormForDeleteItem(rowid);
// }
// }
$('.UpdateImport').click(function() {
var FreightType = $('#drpviewFreight').val();
var FreightRate = $('#viewtxtFreight').val();
var FreightRateAmount = $('#viewtxtAfterFreight').val();
var Nooftrip = $('#viewNOOfTrips').val();
var FreightTypename = $('#drpviewFreight').val();
if (FreightTypename != "PER TRIP") {
Nooftrip = '';
}
var tr = document.getElementById(userid);
$('#FreightType' + userid).val(FreightType);
$('#NoOfTrip' + userid).val(Nooftrip);
$('#FreightValue' + userid).val(FreightRate);
$('#AfterFreightValue' + userid).val(FreightRateAmount);
populateValueMainFormForupdateImportTax();
});
function populateValueMainFormForupdateImportTax() {
var rows = document.getElementById('ImportTax').rows.length;
var TotalFreight = 0;
var i = 0;
do {
i += 1;
var tr = document.getElementById(i);
if (tr != null) {
cells = tr.getElementsByTagName('td');
var rowid = cells[0].innerHTML;
var Frieght = $('#AfterFreightValue' + rowid).val() == '' ? '0.00' : $('#AfterFreightValue' + rowid).val();
TotalFreight = parseFloat(TotalFreight) + parseFloat(Frieght);
}
} while (i < rows);
$('#txtTotalFreight').val(parseFloat(TotalFreight).toFixed(2));
}
function PageRedirect() {
window.location = "poapproval";
}
var DeletedMaterialCode = '';
var DeletedMaterialName = '';
function DeleteRow(rowid) {
var id = [];
var DelRows = $('#txtDeletedRow').val();
var tr = document.getElementById(rowid);
var MaterialCode = $('#materialCode' + rowid).val();
var LineItemNo = $('#LineItemNo' + rowid).val();
var ReqNo = $('#Reqnumber' + rowid).val();
var POType = '<?php echo IMPORT ?>';
id[0] = LineItemNo;
id[1] = ReqNo;
id[2] = MaterialCode;
id[3] = POType;
var answer = confirm(" Do you want to delete the Item from the List?")
if (answer) {
populateValueMainFormForDeleteItem(rowid);
tr.parentNode.removeChild(tr);
var removeItem = $('#materialCode' + rowid).val();
var materialCode = $('#materialCode' + rowid).val();
var removeItem = $('#materialCode' + rowid).val();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(index, value) {
if (value.MaterialCode == materialCode) {
// $("#MaterialCode").append( $('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName) );
DeletedMaterialCode = $('#materialCode' + rowid).val();
DeletedMaterialName = $('#materialName' + rowid).val();
}
});
}
SelectedMaterialCode.splice(SelectedMaterialCode.indexOf('removeItem'), 1);
var x = <?php echo json_encode($POItem, JSON_PRETTY_PRINT) ?>;
var result = '0';
$.each(x, function(idx, obj) {
if (obj.LineItemNo === LineItemNo) {
result = '1';
return false;
}
});
// alert(result);
if (result == '0') {
var DelRows = $('#txtDeletedRow').val();
//tr.parentNode.removeChild(tr);
if (DelRows != '') {
DelRows = DelRows + ":" + rowid;
} else {
DelRows = "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
}
// To delete the value from Tables
else if (result == '1') {
var DelRows = $('#txtDeletedRow').val();
//tr.parentNode.removeChild(tr);
if (DelRows != '') {
DelRows = DelRows + ":" + rowid;
} else {
DelRows = "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
$.ajax({
data: {
id: id
},
type: "POST",
url: "<?php echo base_url() ?>purchaseorder/DeletePODetails",
success: function(data) {
if (data) {
$('#content').loader('hide');
alert(data);
} else {
alert("Error");
}
}
});
}
// populateValueMainFormForDeleteItem(rowid);
}
}
function populateValueMainFormForDeleteItem(rowid) {
var TotalLanding = $('#txttotallanding').val();
var TotalCustom = $('#txttotalcustom').val();
var TotalCustomED = $('#txttotalcustomED').val();
var TotalCustomSH = $('#txttotalcustomSH').val();
var TotalGrossDuty = $('#txttotalgrossduty').val();
var TotalOrderValue = $('#txtToatlOrder').val();
var TotalFreight = $('#txtTotalFreight').val();
var TotalAssessable = $('#txttotalAssessable').val();
var TotalSubtotal = $('#txttotalSubtotal').val();
var TotalIgst = $('#txttotalIgst').val();
//console.log(TotalCustomED);
var AfterLandingCharge = $('#AfterLandingCharge' + rowid).val() == '' ? '0.00' : $('#AfterLandingCharge' + rowid).val();
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 Grossdutypayable = $('#Grossdutypayable' + rowid).val() == '' ? '0.00' : $('#Grossdutypayable' + rowid).val();
//console.log(AfterCustomEDcess);
var totalExp = $('#TotalValue' + rowid).val() == '' ? '0.00' : $('#TotalValue' + rowid).val();
var Frieght = $('#AfterFreightValue' + rowid).val() == '' ? '0.00' : $('#AfterFreightValue' + rowid).val();
var AfterAssessable = $('#AssessableValue' + rowid).val() == '' ? '0.00' : $('#AssessableValue' + rowid).val();
var AfterIgst = $('#AfterIGST' + rowid).val() == '' ? '0.00' : $('#AfterIGST' + rowid).val();
var AfterSubtotal = $('#SubTotal' + rowid).val() == '' ? '0.00' : $('#SubTotal' + rowid).val();
TotalAssessable = parseFloat(TotalAssessable) - parseFloat(AfterAssessable);
TotalIgst = parseFloat(TotalIgst) - parseFloat(AfterIgst);
TotalSubtotal = parseFloat(TotalSubtotal) - parseFloat(AfterSubtotal);
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(totalExp);
TotalFreight = parseFloat(TotalFreight) - parseFloat(Frieght);
$('#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));
}
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');
// return false;
// }
// else
// {
return true;
//}
}
function Save(status) {
//alert();
if (status == '0') {
stat = '<?php echo PO_DRAFT; ?>';
} else if (status == '1') {
stat = '<?php echo PO_CREATED; ?>';
} else if (status == '4') {
stat = '<?php echo PO_RELEASED; ?>';
}
$('#txtStatus').val(stat);
//var txtRowCount = $('#txtRowCount').val();
//var Row=$('#txtRow').val();
//alert(Row);
//exit();
tinyMCE.triggerSave();
var Row = $('#txtRow').val();
//alert(Row);
var txtDeletedRow = $('#txtDeletedRow').val();
//alert(Row);
//alert(txtRowCount);
//exit();
//var TotalOrder=$('#txtToatlOrder').val();
//alert(TotalOrder);
//exit();
if (validate() && Budgetcheck()) { //alert();
if (document.getElementById('ImportTax').rows.length <= 0) {
alert('Please Select Line item to Create PO');
$('#Deliverydt').focus();
return false;
} else {
//alert();
$('#content').loader('show');
var formData = new FormData($('.ImportPO')[0]);
formData.append('txtRowCount', Row);
formData.append('txtDeletedRow', txtDeletedRow);
formData.append('textStatus', stat);
$.ajax({
// data:$('.ImportPO').serialize()+"&txtRowCount="+Row+"&txtDeletedRow="+txtDeletedRow+"&textStatus="+stat,
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() ?>purchaseorder/EditImportPurchaseOrder",
success: function(data) {
if (data) {
$('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
//$('#SpcialInstruction').val('');
//$('#txtDeliveryAddress').val('');
window.location = "purchaseorderListing";
} else {
alert("Error");
}
}
});
}
}
}
$(function() {
//$("#revenueTax").DataTable();
$('#ImportTax').DataTable({
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": false,
// "info": true,
"autoWidth": true
});
});
$("#PaymentTerms").change(function() {
if ($('#PaymentTerms').val().trim() == 'PT08')
{
$('#otheroptiondiv').show();
} else {
$('#otheroptiondiv').hide();
}
});
$('#drpviewFreight').change(function() {
var FreightType = $('#drpviewFreight').val();
if (FreightType == "PER TRIP") {
$('#ViewTripsValue').show();
} else {
$('#ViewTripsValue').hide();
}
$('#viewNOOfTrips').val('');
$('#viewtxtFreight').val('');
$('#viewtxtAfterFreight').val('');
selValue = $("#drpviewFreight").val();
if (selValue == NilType) {
$('#viewtxtFreight').attr('readonly', 'true');
$('#viewtxtFreight').val('0.00');
} else {
$('#viewtxtFreight').removeAttr('readonly', 'true');
$('#viewtxtFreight').val('');
}
calculateFreight(2);
});
$('#drpeditFreight').change(function() {
var FreightType = $('#drpeditFreight').val();
if (FreightType == "PER TRIP") {
$('#EditTripsValue').show();
} else {
$('#EditTripsValue').hide();
}
$('#editNOOfTrips').val('');
$('#edittxtFreight').val('');
$('#edittxtAfterFreight').val('');
if ($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0") {
selValue = $("#drpEditFreight").val();
$('#txtEditFreight').val('');
$('#edittxtAfterFreight').val('');
if (selValue == NilType) {
$('#txtEditFreight').attr('readonly', 'true');
$('#txtEditFreight').val('0.00');
} else {
$('#txtEditFreight').removeAttr('readonly', 'true');
$('#txtEditFreight').val('');
}
} else {
alert('Please Select MaterialCode and Rate Field Value');
$('#drpEditFreight').val("0");
$('#EditRate').focus();
}
calculateFreight(1);
});
$('#drpaddFreight').change(function() {
//alert();
var FreightType = $('#drpaddFreight').val();
if (FreightType == "PER TRIP") {
$('#AddTripsValue').show();
} else {
$('#AddTripsValue').hide();
}
if ($('#Rate').val() != '' && $('#MaterialCode').val() != "0") {
selValue = $("#drpaddFreight").val();
$('#txtFreight').val('');
$('#txtAfterFreight').val('');
if (selValue == NilType) {
$('#txtFreight').attr('readonly', 'true');
$('#txtFreight').val('0.00');
} else {
$('#txtFreight').removeAttr('readonly', 'true');
$('#txtFreight').val('');
}
} else {
alert('Please Select MaterialCode and Rate Field Value');
$('#drpaddFreight').val("0");
$('#Rate').focus();
}
calculateFreight(0);
});
function calculateFreight(isEdit) {
//alert();
if (isEdit == '0') { //alert();
if ($('#MaterialCode').val() == "0") {
alert('Please Select the Material Code');
$('#MaterialCode').focus();
$('#txtFreight').val('');
return false;
} else if ($('#Rate').val() == '') {
alert('Please Enter the Rate value');
$('#Rate').focus();
$('#addtxtFreight').val('');
return false;
} else {
// var basicValue = parseFloat($('#txtBasicValue').val());
var basicValue = parseFloat($('#INRBasicvalue').val());
var FreightType = $("#drpaddFreight").val();
if (FreightType == "0") {
alert('Please select Freight Type');
$('#addtxtFreight').val('');
$("#drpaddFreight").focus();
} else if ($('#addtxtFreight').val() != "0" && $('#addtxtFreight').val() != '') {
var FreightValue = parseFloat($('#addtxtFreight').val());
var UOM = parseFloat($('#UOM').val());
var Quantity = parseFloat($('#Quantity').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 ($('#addNOOfTrips').val() == '') {
alert('Please Enter No of Trip');
$("#addNOOfTrips").focus();
$('#addtxtFreight').val(0)
AfterFreight = 0;
$('#addtxtAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#addNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#addtxtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#addtxtAfterFreight').val(AfterFreightval);
} else {
$('#addtxtAfterFreight').val("0.00");
}
}
// calculateTotalValue();
} else if (isEdit == '1') {
// 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();
$('#edittxtFreight').val('');
return false;
} else {
var basicValue = parseFloat($('#EditINRBasicvalue').val());
var FreightType = $("#drpeditFreight").val();
if (FreightType == "0") {
alert('Please select Freight Type');
$('#edittxtFreight').val('');
$("#drpeditFreight").focus();
} else if ($('#edittxtFreight').val() != "0" && $('#edittxtFreight').val() != '') {
var FreightValue = parseFloat($('#edittxtFreight').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 ($('#editNOOfTrips').val() == '') {
alert('Please Enter No of Trip');
$("#editNOOfTrips").focus();
$('#edittxtFreight').val(0)
AfterFreight = 0;
$('#edittxtAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#editNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#edittxtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#edittxtAfterFreight').val(AfterFreightval);
} else {
$('#edittxtAfterFreight').val("0.00");
}
}
// calculateEditTotalValue();
} else {
//alert();
var basicValue = parseFloat($('#ViewINRBasicvalue').val());
///console.log(basicValue);
var FreightType = $("#drpviewFreight").val();
if (FreightType == "0") {
alert('Please select Freight Type');
$('#viewtxtFreight').val('');
$("#drpviewFreight").focus();
} else if ($('#viewtxtFreight').val() != "0" && $('#viewtxtFreight').val() != '') {
var FreightValue = parseFloat($('#viewtxtFreight').val());
var UOM = parseFloat($('#ViewUOM').val());
var Quantity = parseFloat($('#ViewQuantity').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 ($('#viewNOOfTrips').val() == '') {
alert('Please Enter No of Trip');
$("#viewNOOfTrips").focus();
$('#viewtxtFreight').val(0)
AfterFreight = 0;
$('#viewtxtAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#viewNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#viewtxtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#viewtxtAfterFreight').val(AfterFreightval);
} else {
$('#viewtxtAfterFreight').val("0.00");
}
}
}
</script>