ria/app/Views/editCapitalAmendPO.php

5118 lines
262 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

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

<?php
$AvlCapitalBudAmt = isset($AvlCapitalBudAmt) ? (int) $AvlCapitalBudAmt : 0;
$RequesterName = '';
$insuranceStatus = array(
array("name" => "NO", "value" => "0"),
array("name" => "YES", "value" => "1")
);
$requestedBy = $requestedBy[0]->FirstName;
// $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
// $CurrentDate = $dt->format('Y-m-d');
$res_arr_values = array();
$DeliverOption = '';
$SupId = '';
$SupName = '';
$Address = '';
$PODate = '';
$TotalCgst = '';
$TotalSgst = '';
$TotalIgst = '';
$DeliveryAddress = '';
$POStatus = '';
$PONO = '';
$PaymentOtherDescription = '';
$TotalSGST = 0.0;
$TotalCGST = 0.0;
$TotalIGST = 0.0;
$Totalotherallowances = 0.0;
$TotalDiscountedAmt = 0.0;
$TotalFreightvalue = 0.0;
$TotalFrieght = 0;
$totigst = 0;
$totSubtotal = 0;
$totassesable = 0;
$TotalSummary = 0.0;
$TotalBasicAmount = 0.0;
$scopeofwork = '';
$Import_DispatchDetails = '';
$Import_PlaceofOrgin = '';
$CapitalRange = '';
$Deliverydt = '';
$DeliverSchedule = '';
$MaxPoDate = '';
$AvlAmount = 0;
$currentCurrencyType = '';
$exchangeRate = '';
$exchangeRate = $ExchangeRate;
$ConfigValue = '';
$tt = 0.0;
$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;
$ExchangeRate = 0;
$totorder = 0;
$ExchangeRate = '';
$PaymentTerms = '';
$PaymentDays = '';
$PayableAT = '';
$ExchangeDate = '';
$ExchangeRateOn = '';
$UpdatedOn;
$CapitalRange = '';
$PoStatusName = '';
$ModeOfShipment = '';
$SupplierReference = '';
$SuppliersOfferNo = '';
$OtherReferences = '';
$InsuranceOptions = '';
$InsuranceNumber = '';
$ServiceTypeOptions = '';
$FinalTotalBasic = 0;
$BudgetType = '';
$PrePOFile = '';
$INR = '';
$INRSYM = '';
if (!empty($INRSYMBOL)) {
foreach ($INRSYMBOL as $INR) {
$INRSYM = $INR->Currency_Code;
$INR = $INR->FontCode2000;
}
}
//echo $INR;
if (!empty($MaxPODate)) {
foreach ($MaxPODate as $date) {
$MaxPoDate = $date->PODate;
}
}
if (!empty($POItem)) {
//print_r($POItem);
}
if (!empty($POMaster)) {
//print_r($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');
$DeliverOption = $Req->DeliveryOption;
//echo $DeliverOption;
$DeliverSchedule = $Req->DeliverySchedule;
//echo $DeliverSchedule;
// $Deliverydt=$Req->DeliveryDate;
if (!empty($Req->DeliveryDate)) {
$Ddt = new DateTime($Req->DeliveryDate);
$Deliverydt = $Ddt->format('d-m-Y');
} else {
$Deliverydt = null;
}
$DeliveryAddress = $Req->DeliveryAddress;
$POStatus = $Req->StatusCode;
$PoStatusName = $Req->StatusName;
$PONO = $Req->PONO;
$scopeofwork = $Req->ServiceDescription;
//$PayableAT=$Req->PayableAT;
$ExchangeRateOn1 = new DateTime($Req->ExchangeRateCalculatedon);
$ExchangeRateOn = $ExchangeRateOn1->format('d-m-Y');
// $PaymentDays=$Req->PaymentDays;
$PaymentOtherDescription = $Req->PaymentOtherDescription;
$PaymentTerms = $Req->PaymentTerms;
//echo $PaymentTerms;
$UpdatedOn = $Req->UpdatedOn;
$CapitalRange = $Req->CapitalRange;
$Import_DispatchDetails = $Req->Import_DispatchDetails;
$Import_PlaceofOrgin = $Req->Import_PlaceofOrgin;
$CapitalRange = $Req->CapitalRange;
if ($CapitalRange == '0') {
$ExitExchangeRate = $Req->ExchangeRate;
$ExitTotalOrderValue = number_format($Req->TotalOrderValue * $ExitExchangeRate, 2, '.', '');
} else {
$ExitTotalOrderValue = $Req->TotalOrderValue;
}
$ModeOfShipment = $Req->Mode_Of_Shipment;
$SupplierReference = $Req->Supplier_Reference;
$SuppliersOfferNo = $Req->Supplier_Offer_No;
$OtherReferences = $Req->Other_Reference;
$InsuranceOptions = $Req->InsuranceStatus;
$InsuranceNumber = $Req->InsuranceNumber;
$ServiceTypeOptions = $Req->POSubType;
$BudgetType = $Req->BudgetType;
$PrePOFile = $Req->POFile;
}
}
//echo $CapitalRange;
if (!empty($POItem) && $CapitalRange == '1') {
$currentPoBasicAmt = 0;
$currentPoDiscountedAmt = 0;
foreach ($POItem as $getTotalAmt) {
$currentPoBasicAmt = $currentPoBasicAmt + ($getTotalAmt->Rate * $getTotalAmt->Quantity);
$currentPoDiscountedAmt = $currentPoDiscountedAmt + $getTotalAmt->Afterdiscountval;
}
if (!empty($AvlBudAmt)) {
$AvlAmount = number_format($AvlCapitalBudAmt + $currentPoBasicAmt - $currentPoDiscountedAmt, 2, '.', '');
}
} else {
$AvlAmount = number_format($AvlCapitalBudAmt + $ExitTotalOrderValue, 2, '.', '');
}
?>
<style>
.modal {
overflow: auto !important;
}
.dataTables_paginate {
margin-top: -5%;
}
.dataTables_wrapper {
padding-bottom: 0px;
}
.select2 {
width: 100% ! 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;
}
.content-wrapper {
min-height: 600px ! important;
}
#editpackagingcalmodel {
z-index: 1090 !important;
}
#EDITCAPITAL{
z-index: 1080 !important;
}
.radio input[type="radio"] {
pointer-events: auto !important;
}
</style>
<script src="<?php echo base_url() ?>public/assets/tinymce/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
// plugins: "link image"
});
tinymce.init({
selector: "textarea#EditItemDescription",
menubar: false,
statusbar: false,
toolbar: false
});
var insuranceOpt = '<?php echo $InsuranceOptions; ?>';
var DelOpt = '<?php echo $DeliverOption; ?>';
var SchName = <?php echo json_encode($DeliverSchedule); ?>;
var others = '<?php echo $PaymentOtherDescription; ?>';
var DelDt = '<?php echo $Deliverydt; ?>';
$(document).ready(function () {
$('#RequistionNo').attr("style", "pointer-events: none;");
$('#PODate').attr("style", "pointer-events: none;");
$('#drpSupplier').attr("style", "pointer-events: none;");
$('#SupAddress').attr("style", "pointer-events: none;");
$('#POType').attr("style", "pointer-events: none;");
$('#DeliveryAddr').attr("style", "pointer-events: none;");
$('#workstatus').attr("style", "pointer-events: none;");
$('#addmodeofshipment').attr("style", "pointer-events: none;");
$('#amendsupplierreference').attr("style", "pointer-events: none;");
$('#amendsupplierofferno').attr("style", "pointer-events: none;");
$('#amendotherreference').attr("style", "pointer-events: none;");
$('#PoTypeOptions').attr("style", "pointer-events: none;");
$('#InsuranceNumber').attr("style", "pointer-events: none;");
$('#insuranceStatus').attr("style", "pointer-events: none;");
$('#Exchangerateon').attr("style", "pointer-events: none;");
$('#ExchangeRt').attr("style", "pointer-events: none;");
$('#PlaceOforigin').attr("style", "pointer-events: none;");
if (insuranceOpt == "1") {
} else {
$('#insuranceTxtDiv').hide();
}
if (DelOpt == "0") {
//$('#Deliverydtdiv').show();
$('#Schedulediv').hide();
$('#deliverydateby').show();
$('#Deliverydtdiv').hide();
} else if (DelOpt == "1") {
$('#deliverydateby').hide();
$('#Schedulediv').show();
$('#Deliverydtdiv').hide();
}
if ($('#PaymentMethod').val() == 'PT08') {
$('#otheroptiondiv').show();
$('#Otherpayment').val(others);
}
});
var capitalType = '';
window.onload = function () {
var CapRan = '<?php echo $CapitalRange; ?>';
if (CapRan == '1') {
document.getElementById('FromOnline').style.display = 'none';
document.getElementById('ExchangeRateOnDiv').style.display = 'none';
document.getElementById('ExchangeRateDiv').style.display = 'none';
document.getElementById('currencyTypeDiv').style.display = 'none';
//document.getElementById('ExchangeRateModalDiv').style.display = 'none';
document.getElementById('ExchangeRateModalEditDiv').style.display = 'none';
document.getElementById('HideImportTaxTotal').style.display = 'none';
// document.getElementById('ModalImportTaxHide').style.display = 'none';
document.getElementById('EditModalImportTaxHide').style.display = 'none';
// document.getElementById('ExchangeRateModalViewDiv').style.display = 'none';
//document.getElementById('ViewModalImportTaxHide').style.display = 'none';
//document.getElementById('ExchangeRateModalViewDiv').style.display = 'none';
document.getElementById('Deliverydtdiv').style.display = 'none';
document.getElementById('dispatchinternational').style.display = 'none';
document.getElementById('placeoforgin').style.display = 'none';
document.getElementById('datedomestic').style.display = 'block';
//document.getElementById('deliverydateby').style.display = 'none';
capitalType = 'Domestic';
} else {
document.getElementById('FromOnline').style.display = 'block';
document.getElementById('ExchangeRateOnDiv').style.display = 'block';
document.getElementById('ExchangeRateDiv').style.display = 'block';
document.getElementById('currencyTypeDiv').style.display = 'block';
//document.getElementById('ExchangeRateModalDiv').style.display = 'block';
document.getElementById('ExchangeRateModalEditDiv').style.display = 'block';
//document.getElementById('ExchangeRateModalViewDiv').style.display = 'block';
capitalType = 'International';
document.getElementById('currencyTypeDiv').style.display = 'block';
document.getElementById('dispatchinternational').style.display = 'block';
//document.getElementById('deliverydateby').style.display = 'block';
//document.getElementById('ViewModalImportTaxHide').style.display = 'block';
}
}
</script>
<script>
$(document).ready(function () {
$("#PaymentMethod").select2();
//$("#EditReqnumber").select2();
$("#EditMaterialCode").select2();
//Initialize Select2 Elements
$("#drpSupplier").select2();
$("#Reqnumber").select2();
$("#CapitalCostCenter").select2();
$("#MaterialCode").select2();
$("#currencytype").select2();
// $("#PODate").datepicker({
// //minDate : d,
// maxDate: 'now',
// dateFormat: 'dd-mm-yy',
// changeMonth: true,
// changeYear: true,
// yearRange: '-100:+0'
// });
// $("#Deliverydate").datepicker({
// minDate: 'now',
// dateFormat: 'dd-mm-yy',
// changeMonth: true,
// changeYear: true,
// yearRange: '0:+10'
// });
// $("#Exchangerateon").datepicker({
// minDate: 'now',
// dateFormat: 'dd-mm-yy',
// changeMonth: true,
// changeYear: true,
// yearRange: '0:+10'
// });
$('#Date').click(function () {
//for Date range selection
$('#Schedulediv').hide();
$('#Deliverydtdiv').show();
});
$('#Schedule').click(function () {
//for schedule range selection
$('#deliverydateby').hide();
$('#Schedulediv').show();
$('#Deliverydtdiv').hide();
});
$('#DeliverycheckDate').click(function () {
//for Delivery Date selection
$('#Schedulediv').hide();
$('#deliverydateby').show();
$('#Deliverydtdiv').hide();
});
});
</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">
<h4><?= "Amended Capital Purchase - $PONO "; ?></h4>
<a href="<?php echo base_url() ?>amendmentpurchaseorder" class="btn btn-secondary" id="back"
value="Back">Back</a>
</div>
</div>
</div>
<!-- end page title -->
<!-- Form row -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<?php
$attributes = array('class' => 'form-label-left CapitalPO ', 'name' => 'CapitalPO', 'id' => 'CapitalPO', 'enctype' => 'multipart/form-data');
echo form_open(base_url() . '/purchaseorder/addPO/', $attributes); ?>
<div class="form-row">
<div class="form-group col-md-3">
<label>Requistion No</label>
<?php
$options = array("0" => 'Selected Requisition Numbers');
if (!empty($ReqList)) {
foreach ($ReqList as $SID):
$options[$SID->ReqNo] = $SID->ReqNo;
endforeach;
}
echo form_multiselect('RequistionNo', $options, set_value('RequistionNo', array()), 'id="RequistionNo"', 'required="true"');
?>
</div>
<div class="form-group col-md-3">
<label>Purchase Order Type</label>
<?php
$data = array('name' => 'POType', 'value' => set_value('POType', CAPITAL), 'id' => 'POType', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Select Supplier</label>
<?php
if (!empty($Suplist)) {
foreach ($Suplist as $SID):
$options2[$SID->SupplierID] = $SID->SupplierID . ' - ' . $SID->SupplierName;
endforeach;
}
echo form_dropdown('drpSupplier', $options2, set_value('drpSupplier', $SupId), 'id="drpSupplier" required="true" class="form-control select2"');
?>
</div>
<div class="form-group col-md-3">
<label>Supplier Address</label>
<?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 class="form-row">
<div class="form-group col-md-3" id="currencyTypeDiv">
<label>Currency Type</label>
<?php
if (!empty($Currency)) {
// $currentCurrencyType=$CurrencyDetail[0]->CurrencyCode;
$options1[$Currency[0]->Currency_Code] = $Currency[0]->Currency_Code . ' ' . ' - ' . ' ' . $Currency[0]->Country_and_Currency;
foreach ($Currency as $Cur)
if ($Currency[0]->Currency_Code != $Cur->Currency_Code) {
$options1[$Cur->Currency_Code] = $Cur->Currency_Code . ' ' . ' - ' . ' ' . $Cur->Country_and_Currency;
}
}
echo form_dropdown('currencytype', $options1, set_value('currencytype', $currentCurrencyType), 'id="currencytype" class="form-control select2" required="true"');
?>
</div>
<div class="form-group col-md-3">
<b><u>Select Delivery By</u></b>
<div style="display:inline-flex;">
<div class="centered">
<div id="dispatchinternational" style="display:none;">
<?php echo form_label('Dispatch instruction', 'Dispatch instruction') . "&nbsp;&nbsp;" . form_radio(array("name" => "DateRange", "id" => "Date", "value" => "2", 'checked' => ('2' == $DeliverOption) ? TRUE : FALSE)); ?>&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<div id="datedomestic" style="display:none;">
<?php echo form_label('Deilvery Date', 'Deilvery Date') . "&nbsp;&nbsp;" . form_radio(array("name" => "DateRange", "id" => "DeliverycheckDate", "value" => "0", 'checked' => ('0' == $DeliverOption) ? TRUE : FALSE)); ?>&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<div>
<?php echo form_label('Schedule', 'Schedule') . form_radio(array('name' => 'DateRange', 'value' => '1', 'checked' => ('1' == $DeliverOption) ? TRUE : FALSE, 'id' => 'Schedule')); ?>
</div>
</div>
</div>
</div>
<div class="form-group col-md-3" id="Schedulediv" style="display:none;">
<label>Schedule By </label>
<input type="hidden" name="beforeSchedule" value="<?php echo $DeliverSchedule; ?>">
<?php
$data = array('name' => 'Scheduleby', 'value' => set_value('Scheduleby', $DeliverSchedule), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110');
echo Form_textarea($data);
?>
</div>
<div class="form-group col-md-3" id="deliverydateby" style="display:none;">
<label>Delivery Date</label>
<?php if (($DeliverOption == 1) || ($DeliverOption == 2)) {
$Deliverydt = null;
}
?>
<input type="hidden" name="beforeDate" value="<?php echo $Deliverydt; ?>">
<?php
$data = array('type' => 'date', 'name' => 'Deliverydate', 'value' => set_value('Deliverydate', $Deliverydt), 'id' => 'Deliverydate', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" id="Deliverydtdiv">
<label>Dispatch Instruction</label>
<input type="hidden" name="beforeDisins"
value="<?php echo $Import_DispatchDetails; ?>">
<?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="form-group col-md-3">
<label>Delivery Address</label>
<?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 class="form-row">
<div class="form-group col-md-3" id="FromOnline" style="display:none;">
Check Today's Foreign Exchange value <a href="http://www.xe.com/"
target="_blank"><u>(Click here)</u></a>
</div>
<div class="form-group col-md-3" id="ExchangeRateOnDiv" style="display:none;">
<label>Exchange Rate On</label>
<?php
$data = array('type' => 'date', 'name' => 'Exchangerateon', 'value' => set_value('Exchangerateon', $ExchangeRateOn), 'id' => 'Exchangerateon', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" id="ExchangeRateDiv" style="display:none;">
<label id="CurrencySymbol">Exchange Rate </label>
<?php
$data = array('name' => 'ExchangeRt', 'value' => set_value('ExchangeRt', $exchangeRate), 'id' => 'ExchangeRt', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'style' => 'text-align:right');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" id="placeoforgin">
<label>Place of Origin</label>
<?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 class="form-row">
<div class="form-group col-md-3">
<label>Purchase Order Date</label>
<?php
$data = array('name' => 'PODate', 'value' => set_value('PODate', $PODate), 'id' => 'PODate', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Mode Of Shipment</label>
<?php
$data = array('name' => 'addmodeofshipment', 'value' => set_value('addmodeofshipment', $ModeOfShipment), 'id' => 'addmodeofshipment', 'class' => 'form-control');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Contact Reference</label>
<?php
$data = array('name' => 'amendsupplierreference', 'value' => set_value('amendsupplierreference', $SupplierReference), 'id' => 'amendsupplierreference', 'class' => 'form-control', 'maxlength' => '40');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Supplier's Offer No</label>
<?php
$data = array('name' => 'amendsupplierofferno', 'value' => set_value('amendsupplierofferno', $SuppliersOfferNo), 'id' => 'amendsupplierofferno', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Our Reference(S)</label>
<?php
$data = array('name' => 'amendotherreference', 'value' => set_value('amendotherreference', $OtherReferences), 'id' => 'amendotherreference', 'class' => 'form-control');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Capital Type Options<span class="text-danger">*</span></label>
<?php
if (!empty($PoTypeOptions)) {
foreach ($PoTypeOptions as $POpt):
if ($ServiceTypeOptions == $POpt->ConfigValue) {
$optionsPO[$POpt->ConfigValue] = $POpt->ConfigValue;
}
endforeach;
foreach ($PoTypeOptions as $POpt1):
if ($ServiceTypeOptions != $POpt1->ConfigValue) {
$optionsPO[$POpt1->ConfigValue] = $POpt1->ConfigValue;
}
endforeach;
}
echo form_dropdown('PoTypeOptions', $optionsPO, set_value('PoTypeOptions'), 'id="PoTypeOptions" required="true" class="form-control select2"');
?>
</div>
<div class="form-group col-md-3"><input type="hidden" name="beforePaymentmethod"
id="beforePaymentmethod" value="<?php echo $PaymentTerms; ?>">
<label for="payablefrom">Payable Terms</label>
<?php
foreach ($Payment as $rl):
if ($PaymentTerms == $rl->PaymentID) {
//echo $PaymentTerms."<br>";
//print_r($Payment);
$options6[$rl->PaymentID] = $rl->PaymentTerms;
?>
<input type="hidden" name="beforePaymentTermsText"
value="<?php echo $rl->PaymentTerms ?>">
<?php
}
endforeach;
if (!empty($Payment)) {
foreach ($Payment as $rl2):
if ($PaymentTerms != $rl2->PaymentID) {
$options6[$rl2->PaymentID] = $rl2->PaymentTerms;
}
endforeach;
}
echo form_dropdown('PaymentMethod', $options6, set_value('PaymentMethod', $PaymentTerms), 'id="PaymentMethod" required="true" class="form-control select2"');
?>
</div>
<div class="form-group col-md-3" id="otheroptiondiv" style="display:none;">
<label>Description of Payable Terms<span class="badge">*</span></label>
<?php
$data = array('name' => 'Otherpayment', 'Otherpayment' => set_value('Otherpayment'), 'id' => 'Otherpayment', 'class' => 'form-control', 'required' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Insurance Options<span class="text-danger">*</span></label>
<?php
if (!empty($insuranceStatus)) {
foreach ($insuranceStatus as $INS):
if ($InsuranceOptions == $INS['value']) {
$optionsInsurance[$INS['value']] = $INS['name'];
}
endforeach;
foreach ($insuranceStatus as $INS1):
if ($InsuranceOptions != $INS1['value']) {
$optionsInsurance[$INS1['value']] = $INS1['name'];
}
endforeach;
}
echo form_dropdown('insuranceStatus', $optionsInsurance, set_value('insuranceStatus'), 'id="insuranceStatus" required="true" class="form-control select2"');
?>
</div>
<div class="form-group col-md-3" id="insuranceTxtDiv" style="display:block;">
<label>Insurance No / Insurance Details<span class="badge">*</span></label>
<?php
$data = array('name' => 'InsuranceNumber', 'value' => set_value('InsuranceNumber', $InsuranceNumber), 'id' => 'InsuranceNumber', 'class' => 'form-control', 'required' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label for="BudgetType">Budget Type<span class="text-danger">*</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="form-group col-md-3">
</div>
</div>
<div class="form-row">
<div class="table-responsive">
<table id="serviceTax" class="table table-striped table-hover mb-0"
style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Name</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate</th>
<th>Basic Amount</th>
<th>Tax Amount</th>
<th>Total Order Amount</th>
<th>Action</th>
</tr>
</thead>
<tbody id='capitalAppend'>
<?php
if (!empty($POItem)) {
$index = 0;
$totalCapitalOrder = 0;
foreach ($POItem as $record) {
$index = $index + 1;
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialName ?></td>
<td style="text-align:right"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td style="text-align:right"><?php echo $record->Rate ?></td>
<td style="text-align:right">
<?php echo number_format($record->Rate * $record->Quantity, 2, '.', ''); ?>
</td>
<td style="text-align:right"><?php if ($CapitalRange == '1') {
echo $record->ServiceTaxamount;
} else if ($CapitalRange == '0') {
echo "0.0";
} ?></td>
<?php if ($CapitalRange == '1') { ?>
<!-- <td style="text-align:right"><?php echo $record->TotalValue + $record->Afvalue; ?></td> -->
<td><?php echo number_format($record->Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?>
</td>
<?php } else if ($CapitalRange == '0') { ?>
<td style="text-align:right">
<?php echo number_format(($record->Rate * $record->Quantity), 2, '.', ''); ?>
</td>
<?php } ?>
<?php
$row = array("materialCode" => $record->MaterialCode, "ReqNo" => $record->ReqNo);
array_push($res_arr_values, $row);
?>
<input type="hidden"
name="<?php echo 'CapitalItemDescrition' . $index ?>"
id="<?php echo 'CapitalItemDescrition' . $index ?>"
value="<?php echo $record->ServiceMaterialDescription; ?>" />
<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 'AvilBudget' . $index ?>"
id="<?php echo 'AvilBudget' . $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 'CPCostCode' . $index ?>"
id="<?php echo 'CPCostCode' . $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 'per' . $index ?>"
id="<?php echo 'per' . $index ?>"
value="<?php echo $record->Per; ?>" />
<input type="hidden" name="<?php echo 'frequency' . $index ?>"
id="<?php echo 'frequency' . $index ?>"
value="<?php echo $record->ServiceFrequency; ?>" />
<input type="hidden" name="<?php echo 'quantity' . $index ?>"
id="<?php echo 'quantity' . $index ?>"
value="<?php echo $record->Quantity; ?>" />
<input type="hidden" name="<?php echo 'beforequantity' . $index ?>"
id="<?php echo 'quantity' . $index ?>"
value="<?php echo $record->Quantity; ?>" />
<input type="hidden" name="<?php echo 'itemRate' . $index ?>"
id="<?php echo 'itemRate' . $index ?>"
value="<?php echo $record->Rate; ?>" />
<input type="hidden" name="<?php echo 'beforeitemRate' . $index ?>"
id="<?php echo 'itemRate' . $index ?>"
value="<?php echo $record->Rate; ?>" />
<?php if ($CapitalRange == '1') { ?>
<input type="hidden" name="<?php echo 'rateInUs' . $index ?>"
id="<?php echo 'rateInUs' . $index ?>"
value="<?php echo $record->Rate; ?>" />
<?php } ?>
<?php if ($CapitalRange == '0') { ?>
<input type="hidden" name="<?php echo 'rateInUs' . $index ?>"
id="<?php echo 'rateInUs' . $index ?>"
value="<?php echo $record->BasicPriceInMTon; ?>" />
<input type="hidden" name="<?php echo 'basicvalInINR' . $index ?>"
id="<?php echo 'basicvalInINR' . $index ?>"
value="<?php echo $record->ProductPrice; ?>" />
<input type="hidden" name="<?php echo 'beforeLanding' . $index ?>"
id="<?php echo 'beforeLanding' . $index ?>"
value="<?php echo $record->LandingCharge; ?>" />
<input type="hidden" name="<?php echo 'landingCharge' . $index ?>"
id="<?php echo 'landingCharge' . $index ?>"
value="<?php echo $record->AfterLandingCharge; ?>" />
<input type="hidden"
name="<?php echo 'beforeHighSeasSalesCharge' . $index ?>"
id="<?php echo 'beforeHighSeasSalesCharge' . $index ?>"
value="<?php echo $record->HighSeasSalesCharge; ?>" />
<input type="hidden" name="<?php echo 'HighSeasSalesCharge' . $index ?>"
id="<?php echo 'HighSeasSalesCharge' . $index ?>"
value="<?php echo $record->AfterHighSeasSalesCharge; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomDuty' . $index ?>"
id="<?php echo 'beforeCustomDuty' . $index ?>"
value="<?php echo $record->CustomDuty; ?>" />
<input type="hidden" name="<?php echo 'CustomDuty' . $index ?>"
id="<?php echo 'CustomDuty' . $index ?>"
value="<?php echo $record->AfterCustomDuty; ?>" />
<input type="hidden" name="<?php echo 'beforeExciseDuty' . $index ?>"
id="<?php echo 'beforeExciseDuty' . $index ?>"
value="<?php echo $record->ExciseDuty; ?>" />
<input type="hidden" name="<?php echo 'ExciseDuty' . $index ?>"
id="<?php echo 'ExciseDuty' . $index ?>"
value="<?php echo $record->AfterExciseDuty; ?>" />
<input type="hidden"
name="<?php echo 'beforeExciseDutyEDCess' . $index ?>"
id="<?php echo 'beforeExciseDutyEDCess' . $index ?>"
value="<?php echo $record->ExciseDutyEdCess; ?>" />
<input type="hidden" name="<?php echo 'ExciseDutyEDCess' . $index ?>"
id="<?php echo 'ExciseDutyEDCess' . $index ?>"
value="<?php echo $record->AfterExciseDutyEdCess; ?>" />
<input type="hidden"
name="<?php echo 'beforeExciseDutySHCess' . $index ?>"
id="<?php echo 'beforeExciseDutySHCess' . $index ?>"
value="<?php echo $record->ExciseDutySHCess; ?>" />
<input type="hidden" name="<?php echo 'ExciseDutySHCess' . $index ?>"
id="<?php echo 'ExciseDutySHCess' . $index ?>"
value="<?php echo $record->AfterExciseDutySHCess; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomEDCess' . $index ?>"
id="<?php echo 'beforeCustomEDCess' . $index ?>"
value="<?php echo $record->CustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'CustomEDCess' . $index ?>"
id="<?php echo 'CustomEDCess' . $index ?>"
value="<?php echo $record->AfterCustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'beforeCustomSHCess' . $index ?>"
id="<?php echo 'beforeCustomSHCess' . $index ?>"
value="<?php echo $record->CustomSHCess; ?>" />
<input type="hidden" name="<?php echo 'CustomSHCess' . $index ?>"
id="<?php echo 'CustomSHCess' . $index ?>"
value="<?php echo $record->AfterCustomSHCess; ?>" />
<input type="hidden" name="<?php echo 'echangeRate' . $index ?>"
id="<?php echo 'echangeRate' . $index ?>"
value="<?php echo $record->ExchangeRate; ?>" />
<input type="hidden"
name="<?php echo 'beforeAdditionalExciseDuty' . $index ?>"
id="<?php echo 'beforeAdditionalExciseDuty' . $index ?>"
value="<?php echo $record->AddlExciseDuty; ?>" />
<input type="hidden"
name="<?php echo 'AdditionalExciseDuty' . $index ?>"
id="<?php echo 'AdditionalExciseDuty' . $index ?>"
value="<?php echo $record->AfterAddlExciseDuty; ?>" />
<input type="hidden" name="<?php echo 'GrossDutyPayable' . $index ?>"
id="<?php echo 'GrossDutyPayable' . $index ?>"
value="<?php echo $record->Grossdutypayable; ?>" />
<input type="hidden" name="<?php echo 'AvailableModvat' . $index ?>"
id="<?php echo 'AvailableModvat' . $index ?>"
value="<?php echo $record->AvailableModvat; ?>" />
<input type="hidden"
name="<?php echo 'GrossExpensesDuetoCustom' . $index ?>"
id="<?php echo 'GrossExpensesDuetoCustom' . $index ?>"
value="<?php echo $record->Grossexpensesduetocustomduty; ?>" />
<input type="hidden" name="<?php echo 'purchaseRate' . $index ?>"
id="<?php echo 'purchaseRate' . $index ?>"
value="<?php echo $record->purchaseratePerKG; ?>" />
<input type="hidden" name="<?php echo 'CustomDutyExpenses' . $index ?>"
id="<?php echo 'CustomDutyExpenses' . $index ?>"
value="<?php echo $record->CustomDutyExpensesPerKG; ?>" />
<input type="hidden"
name="<?php echo 'RMCIncludingCustomers' . $index ?>"
id="<?php echo 'RMCIncludingCustomers' . $index ?>"
value="<?php echo $record->RMCIncludingCustomersPerKG; ?>" />
<input type="hidden" name="<?php echo 'PurQuantity' . $index ?>"
id="<?php echo 'PurQuantity' . $index ?>"
value="<?php echo $record->QuantityKG; ?>" />
<input type="hidden" name="<?php echo 'PerKgExpense' . $index ?>"
id="<?php echo 'PerKgExpense' . $index ?>"
value="<?php echo $record->ImportTotalValue; ?>" />
<input align="right" type="hidden"
name="<?php echo 'FreightType' . $index ?>"
id="<?php echo 'FreightType' . $index ?>"
value="<?php echo $record->FreightType; ?>" />
<input align="right" type="hidden"
name="<?php echo 'NoOfTrip' . $index ?>"
id="<?php echo 'NoOfTrip' . $index ?>"
value="<?php echo $record->NoOfTrip; ?>" />
<input align="right" type="hidden"
name="<?php echo 'FreightVal' . $index ?>"
id="<?php echo 'FreightVal' . $index ?>"
value="<?php echo $record->FreightValue; ?>" />
<input align="right" type="hidden"
name="<?php echo 'AfterFreightVal' . $index ?>"
id="<?php echo 'AfterFreightVal' . $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 'beforeAssessableValue' . $index ?>"
id="<?php echo 'beforeAssessableValue' . $index ?>"
value="<?php echo $record->AssessableValue; ?>" />
<input type="hidden" name="<?php echo 'SubTotal' . $index ?>"
id="<?php echo 'SubTotal' . $index ?>"
value="<?php echo $record->SubTotal; ?>" />
<input type="hidden" name="<?php echo 'beforeSubTotal' . $index ?>"
id="<?php echo 'beforeSubTotal' . $index ?>"
value="<?php echo $record->SubTotal; ?>" />
<input type="hidden" name="<?php echo 'IGSTInt' . $index ?>"
id="<?php echo 'IGSTInt' . $index ?>"
value="<?php echo $record->IGST; ?>" />
<input type="hidden" name="<?php echo 'beforeIGSTInt' . $index ?>"
id="<?php echo 'beforeIGSTInt' . $index ?>"
value="<?php echo $record->IGST; ?>" />
<input type="hidden" name="<?php echo 'AfterIGSTInt' . $index ?>"
id="<?php echo 'AfterIGSTInt' . $index ?>"
value="<?php echo $record->AfterIGST; ?>" />
<input type="hidden" name="<?php echo 'beforeAfterIGSTInt' . $index ?>"
id="<?php echo 'beforeAfterIGSTInt' . $index ?>"
value="<?php echo $record->AfterIGST; ?>" />
<input type="hidden" name="<?php echo 'DutyImpact' . $index ?>"
id="<?php echo 'DutyImpact' . $index ?>"
value="<?php echo $record->DutyImpact; ?>" />
<input type="hidden" name="<?php echo 'beforeDutyImpact' . $index ?>"
id="<?php echo 'beforeDutyImpact' . $index ?>"
value="<?php echo $record->DutyImpact; ?>" />
<input type="hidden" name="<?php echo 'ClearingCharge' . $index ?>"
id="<?php echo 'ClearingCharge' . $index ?>"
value="<?php echo $record->ClearingCharge; ?>" />
<input type="hidden"
name="<?php echo 'beforeClearingCharge' . $index ?>"
id="<?php echo 'beforeClearingCharge' . $index ?>"
value="<?php echo $record->ClearingCharge; ?>" />
<input type="hidden" name="<?php echo 'NetValue' . $index ?>"
id="<?php echo 'NetValue' . $index ?>"
value="<?php echo $record->NetValue; ?>" />
<input type="hidden" name="<?php echo 'beforeNetValue' . $index ?>"
id="<?php echo 'beforeNetValue' . $index ?>"
value="<?php echo $record->NetValue; ?>" />
<?php } ?>
<input type="hidden" name="<?php echo 'basicval' . $index ?>"
id="<?php echo 'basicval' . $index ?>"
value="<?php echo $record->Rate * $record->Quantity; ?>" />
<?php if ($CapitalRange == '1') { ?>
<input type="hidden" name="<?php echo 'SGST' . $index ?>"
id="<?php echo 'SGST' . $index ?>"
value="<?php echo $record->SGST; ?>" />
<input type="hidden" name="<?php echo 'beforeSGST' . $index ?>"
id="<?php echo 'beforeSGST' . $index ?>"
value="<?php echo $record->SGST; ?>" />
<input type="hidden" name="<?php echo 'afterSGST' . $index ?>"
id="<?php echo 'afterSGST' . $index ?>"
value="<?php echo $record->After_SGST; ?>" />
<input type="hidden" name="<?php echo 'beforeSGSTvalue' . $index ?>"
id="<?php echo 'beforeSGSTvalue' . $index ?>"
value="<?php echo $record->After_SGST; ?>" />
<input type="hidden" name="<?php echo 'CGST' . $index ?>"
id="<?php echo 'CGST' . $index ?>"
value="<?php echo $record->CGST; ?>" />
<input type="hidden" name="<?php echo 'beforeCGST' . $index ?>"
id="<?php echo 'beforeCGST' . $index ?>"
value="<?php echo $record->CGST; ?>" />
<input type="hidden" name="<?php echo 'afterCGST' . $index ?>"
id="<?php echo 'afterCGST' . $index ?>"
value="<?php echo $record->After_CGST; ?>" />
<input type="hidden" name="<?php echo 'beforeCGSTvalue' . $index ?>"
id="<?php echo 'beforeCGSTvalue' . $index ?>"
value="<?php echo $record->After_CGST; ?>" />
<input type="hidden" name="<?php echo 'IGST' . $index ?>"
id="<?php echo 'IGST' . $index ?>"
value="<?php echo $record->IGST; ?>" />
<input type="hidden" name="<?php echo 'beforeIGST' . $index ?>"
id="<?php echo 'beforeIGST' . $index ?>"
value="<?php echo $record->IGST; ?>" />
<input type="hidden" name="<?php echo 'afterIGST' . $index ?>"
id="<?php echo 'afterIGST' . $index ?>"
value="<?php echo $record->After_IGST; ?>" />
<input type="hidden" name="<?php echo 'beforeIGSTvalue' . $index ?>"
id="<?php echo 'aftebeforeIGSTvaluerIGST' . $index ?>"
value="<?php echo $record->After_IGST; ?>" />
<input type="hidden" name="<?php echo 'otherallowance' . $index ?>"
id="<?php echo 'otherallowance' . $index ?>"
value="<?php echo $record->otherallowance; ?>" />
<input type="hidden"
name="<?php echo 'beforeotherallowance' . $index ?>"
id="<?php echo 'beforeotherallowance' . $index ?>"
value="<?php echo $record->otherallowance; ?>" />
<input type="hidden" name="<?php echo 'totalservicevalue' . $index ?>"
id="<?php echo 'totalservicevalue' . $index ?>"
value="<?php echo $record->TotalValue + $record->Afvalue; ?>" />
<input align="right" type="hidden"
name="<?php echo 'DisType' . $index ?>"
id="<?php echo 'DisType' . $index ?>"
value="<?php echo $record->discount; ?>" />
<input align="right" type="hidden"
name="<?php echo 'DisVal' . $index ?>"
id="<?php echo 'DisVal' . $index ?>"
value="<?php echo $record->discountval; ?>" />
<input align="right" type="hidden"
name="<?php echo 'AfterDisVal' . $index ?>"
id="<?php echo 'AfterDisVal' . $index ?>"
value="<?php echo $record->Afterdiscountval; ?>" />
<input align="right" type="hidden"
name="<?php echo 'beforeDisType' . $index ?>"
id="<?php echo 'beforeDisType' . $index ?>"
value="<?php echo $record->discount; ?>" />
<input align="right" type="hidden"
name="<?php echo 'beforeDisVal' . $index ?>"
id="<?php echo 'beforeDisVal' . $index ?>"
value="<?php echo $record->discountval; ?>" />
<input align="right" type="hidden"
name="<?php echo 'beforeAfterDisVal' . $index ?>"
id="<?php echo 'beforeAfterDisVal' . $index ?>"
value="<?php echo $record->Afterdiscountval; ?>" />
<input type="hidden" name="<?php echo 'Ftype' . $index ?>"
id="<?php echo 'Ftype' . $index ?>"
value="<?php echo $record->Ftype; ?>" />
<input type="hidden" name="<?php echo 'beforeFtype' . $index ?>"
id="<?php echo 'beforeFtype' . $index ?>"
value="<?php echo $record->Ftype; ?>" />
<input type="hidden" name="<?php echo 'NoTrip' . $index ?>"
id="<?php echo 'NoTrip' . $index ?>"
value="<?php echo $record->NoTrip; ?>" />
<input type="hidden" name="<?php echo 'beforeNoTrip' . $index ?>"
id="<?php echo 'beforeNoTrip' . $index ?>"
value="<?php echo $record->NoTrip; ?>" />
<input type="hidden" name="<?php echo 'Fvalue' . $index ?>"
id="<?php echo 'Fvalue' . $index ?>"
value="<?php echo $record->Fvalue; ?>" />
<input type="hidden" name="<?php echo 'beforeFvalue' . $index ?>"
id="<?php echo 'beforeFvalue' . $index ?>"
value="<?php echo $record->Fvalue; ?>" />
<input type="hidden" name="<?php echo 'Afvalue' . $index ?>"
id="<?php echo 'Afvalue' . $index ?>"
value="<?php echo $record->Afvalue; ?>" />
<input type="hidden" name="<?php echo 'beforeAfvalue' . $index ?>"
id="<?php echo 'beforeAfvalue' . $index ?>"
value="<?php echo $record->Afvalue; ?>" />
<?php } else if ($CapitalRange == '0') { ?>
<input type="hidden" name="<?php echo 'SGST' . $index ?>"
id="<?php echo 'SGST' . $index ?>" value="0.0" />
<input type="hidden" name="<?php echo 'afterSGST' . $index ?>"
id="<?php echo 'afterSGST' . $index ?>" value="0.0" />
<input type="hidden" name="<?php echo 'CGST' . $index ?>"
id="<?php echo 'CGST' . $index ?>" value="0.0" />
<input type="hidden" name="<?php echo 'afterCGST' . $index ?>"
id="<?php echo 'afterCGST' . $index ?>" value="0.0" />
<input type="hidden" name="<?php echo 'IGST' . $index ?>"
id="<?php echo 'IGST' . $index ?>" value="0.0" />
<input type="hidden" name="<?php echo 'afterIGST' . $index ?>"
id="<?php echo 'afterIGST' . $index ?>" value="0.0" />
<input type="hidden" name="<?php echo 'otherallowance' . $index ?>"
id="<?php echo 'otherallowance' . $index ?>" value="0.0" />
<input type="hidden" name="<?php echo 'totalservicevalue' . $index ?>"
id="<?php echo 'totalservicevalue' . $index ?>" value="0.0" />
<input align="right" type="hidden"
name="<?php echo 'DisType' . $index ?>"
id="<?php echo 'DisType' . $index ?>" value="0" />
<input align="right" type="hidden"
name="<?php echo 'DisVal' . $index ?>"
id="<?php echo 'DisVal' . $index ?>" value="0.0" />
<input align="right" type="hidden"
name="<?php echo 'AfterDisVal' . $index ?>"
id="<?php echo 'AfterDisVal' . $index ?>" value="0.0" />
<?php } ?>
<td> <a data-target='#EDITCAPITAL' data-id="<?php echo $index; ?>"
data-userid="<?php echo $index; ?>" data-toggle="modal"
href="#EDITCAPITAL"><i class="ri-pencil-fill"
data-toggle="tooltip"></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="ri-delete-bin-7-fill"></span></a> -->
<!-- <td> <a data-target='#VIEWCAPITAL' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#VIEWCAPITAL"><i class="fa fa-eye" data-toggle="tooltip" title="Click here to view the <?php echo $record->ReqNo; ?> Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> </td> -->
</tr> <?php
//$TotalFrieght = 0;
$TotalSummary = 0;
if ($CapitalRange == '1') {
$TotalSGST = $TotalSGST + $record->After_SGST;
$TotalCGST = $TotalCGST + $record->After_CGST;
$TotalIGST = $TotalIGST + $record->After_IGST;
$FinalTotalBasic = $FinalTotalBasic + ($record->Rate * $record->Quantity);
$f = ($record->Rate * $record->Quantity);
$Totalotherallowances = $Totalotherallowances + $record->otherallowance;
$TotalDiscountedAmt = $TotalDiscountedAmt + $record->Afterdiscountval;
$TotalSummary = $TotalSummary + $record->ServiceTaxamount; //tax
//echo 'TAx' . $TotalSummary;
$TotalFreightvalue = $TotalFreightvalue + $record->Afvalue;
// echo $TotalFreightvalue;
// $totalCapitalOrder = $totalCapitalOrder+$record->Rate * $record->Quantity + $record->After_CGST + $record->After_SGST + $record->After_IGST + $record->otherallowance+ $record->Afvalue - $TotalDiscountedAmt;
$totalCapitalOrder = $totalCapitalOrder + $record->Rate * $record->Quantity + $record->After_CGST + $record->After_SGST + $record->After_IGST + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval;
// echo $TotalBasicAmount;
// echo $totalCapitalOrder;
//echo $record->TotalValue;
//echo 'ALL' . $TotalBasicAmount;
//$ServiceDescription = $ServiceDescription;
}
$TotalBasicAmount = $TotalBasicAmount + $record->TotalValue;
if ($CapitalRange == '0') {
$TotalBasicAmount = $TotalBasicAmount + ($record->Rate * $record->Quantity); //basic
$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;
$TotalFrieght = $TotalFrieght + $record->AfterFreightValue;
$totgrossexpense = $totgrossexpense + $record->Grossexpensesduetocustomduty;
$ExchangeRate = $record->ExchangeRate;
$totassesable = $totassesable + $record->AssessableValue;
$totSubtotal = $totSubtotal + $record->SubTotal;
$totigst = $totigst + $record->AfterIGST;
}
// $totorder=$totorder+$record->TotalOrderValue;
}
//echo $TotalSummary;
if ($CapitalRange == '1') {
// $totalCapitalOrder = $totalCapitalOrder+$TotalBasicAmount;
//echo 'FNAL' . $totalCapitalOrder;
} else if ($CapitalRange == '0') {
$totalCapitalOrder = $totalCapitalOrder + $TotalBasicAmount;
}
?> <input type="hidden" name="txtRowCount"
id="txtRowCount" value="<?php echo $index; ?>">
<!-- first <input type="text" name="CapitalToatlOrder" id="CapitalToatlOrder" value="<?php echo $totalCapitalOrder; ?>">-->
<input type="hidden" name="capitalType" id="capitalType"
value="<?php echo $CapitalRange; ?>" />
<?php
}
?>
</tbody>
</table>
</div>
</div>
<input type="hidden" name="txtPONO" id="txtPONO" value="<?php echo $PONO; ?>" />
<br>
<div class="form-row" id="CAPdiv">
<div class="form-group col-md-3">
<label>Total Basic Amount <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txtTotalBasic', 'value' => set_value('txtTotalBasic', number_format($FinalTotalBasic, 2, '.', '')), 'id' => 'txtTotalBasic', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Total Discount Amount <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txtTotalDiscount', 'value' => set_value('txtTotalDiscount', number_format($TotalDiscountedAmt, 2, '.', '')), 'id' => 'txtTotalDiscount', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>CGST <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txtTotCgst', 'value' => set_value('txtTotCgst', number_format($TotalCGST, 2, '.', '')), 'id' => 'txtTotCgst', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>SGST <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txtTotSgst', 'value' => set_value('txtTotSgst', number_format($TotalSGST, 2, '.', '')), 'id' => 'txtTotSgst', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>IGST <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txtTotIgst', 'value' => set_value('txtTotIgst', number_format($TotalIGST, 2, '.', '')), 'id' => 'txtTotIgst', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" style="padding: 0px;">
<label>Other Allowances <?php echo "($INR)" ?> </label>
<?php
$data = array('name' => 'TotalOtherAllowances', 'value' => set_value('TotalOtherAllowances', number_format($Totalotherallowances, 2, '.', '')), 'id' => 'TotalOtherAllowances', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Total Freight <?php echo "($INR)" ?> </label>
<?php
$data = array('name' => 'TotalFreight', 'value' => set_value('TotalFreight', number_format($TotalFreightvalue, 2, '.', '')), 'id' => 'TotalFreight', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Total Order Value <?php echo "($INR)" ?> </label>
<input type="hidden" name="preServiceTotalorderValue"
value="<?php echo $totalCapitalOrder ?>">
<?php
$data = array('name' => 'Totalservicesummary', 'value' => set_value('Totalservicesummary', number_format($totalCapitalOrder, 2, '.', '')), 'id' => 'Totalservicesummary', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div></br>
</div>
<div class="form-row" style="padding:1% 0%;" id="HideImportTaxTotal" style="display:none;">
<div class="form-group col-md-4">
<label>Total Frieght Amount <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txttotalfrieght', 'value' => set_value('txttotalfrieght', $TotalFrieght), 'id' => 'txttotalfrieght', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group 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="form-group 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="form-group 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="form-group 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="form-group 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="form-group 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="form-group 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="form-group 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 align="right" style="padding-right:10px">
<div class="col-md-3 col-md-offset-9"><br/>
<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="txtRowCount1" />
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<a class="btn btn-success Save" ID="Save" onclick="Save(0)" >&nbsp;&nbsp;<span class="bold">Save</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)" >&nbsp;&nbsp;<span class="bold">Submit</span></a>
<input type="reset" class="btn btn-success" value="Reset">
</div>
</div> -->
<div class="form-group col-md-4">
<label id="lbl_international">Total Order Value <?php echo "($INR)" ?> </label>
<input type="hidden" name="preinterTotalorderValue"
value="<?php echo $totalCapitalOrder ?>">
<?php
$data = array('name' => 'CapitalToatlOrder', 'value' => set_value('CapitalToatlOrder', number_format($totalCapitalOrder, 2, '.', '')), 'id' => 'CapitalToatlOrder', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', $scopeofwork), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
</div>
</div>
<div class="form-row" style="padding:3%;">
<div class="form-group col-md-12" align="right"><br>
<div>
<input type="file" name="POFile" id="POFile">
<?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File"
href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously
uploaded - </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile"
value="<?php echo $PrePOFile; ?>" /><br>
<input type="hidden" id="PrePOFile" name="PrePOFile" value=""><br>
</div>
<div class="btn-container" style="text-align: right;">
<input type="hidden" name="txtPoRange" id="txtPoRange" />
<input type="hidden" name="isEdit" id="isEdit" value="0" />
<input type="hidden" name="txtStatus" id="txtStatus" />
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<input type="button" class="btn btn-secondary" value="Cancel"
onClick="window.location ='amendmentpurchaseorder';"
style="margin-right:10px">
<a class="btn btn-primary Save" onclick="Save(0)">&nbsp;&nbsp;<span
class="bold">Draft</span></a>
<a class="btn btn-success Save" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span
class="bold">Submit</span></a>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<?php $UpdatedOn = new DateTime($UpdatedOn, new DateTimeZone('Asia/Kolkata'));
$UpdatedOn = $UpdatedOn->format('d-m-Y'); ?>
<label>Request On :</label><?php echo $UpdatedOn; ?><br />
<?php if ($RequesterName != '' || $RequesterName != null) { ?>
<label>Request By : </label><?php echo $RequesterName; ?><br />
<?php } ?>
<!-- <label>Status :</label><?php echo $PoStatusName; ?> -->
<label>Status : </label><?php
$statusMappings = [
'PO APPROVED' => 'AWAITING APPROVE',
'AWAITING RELEASE' => 'AWAITING APPROVE',
'RELEASER ONHOLD' => 'APPROVER ONHOLD',
'PO RELEASED' => 'PO APPROVED',
];
if (isset($PoStatusName) && !empty($PoStatusName)) {
if (isset($statusMappings[$PoStatusName])) {
echo $statusMappings[$PoStatusName];
} else {
echo $PoStatusName;
}
} else {
echo "Status not provided";
}
?>
<br />
</div>
</div>
<div class="form-row">
<div align="right">
<!-- <a data-toggle="modal" ><button type="submit" onclick="myFunction();" class="btn btn-success" id="abcd" >Select Line Item</button> </a> -->
</div>
<br>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<div id="editpackagingcalmodel" class="modal fade " tabindex="-1" aria-hidden="true"
style="display: none;"
role="document" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Freight Calculation On</h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body p-4">
<form>
<div >
<label>
<input type="radio" name="editoptPackaging" checked
value='0'> Basic Amount</label>
</div>
<br>
<div >
<label>
<input type="radio" name="editoptPackaging"
value='1'> After Discount
Amount </label>
</div>
</form>
</div>
<div class="modal-footer ">
<a class="btn btn-success" data-dismiss="modal"
value="Cancel">Cancel</a>
&nbsp;&nbsp;
<a class="btn btn-success" ID="editPackagingOption"
onclick="calculateFreightloceditper();"
>&nbsp;&nbsp;<span class="bold">Ok</span></a>
</div>
</div>
</div>
</div>
<div id="EDITCAPITAL" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
style="display: none;">
<div class="modal-dialog modal-full-width" style="width:1060px;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Edit Capital Purchase Order Item</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<form>
<div class="modal-body p-4">
<div class="form-row">
<div class="form-group col-md-3">
<label>Req No</label>
<div>
<?php
// $RL = array("0"=>'Select Req No');
// if(!empty($RequistionDetails))
// {
// foreach ($RequistionDetails as $SID):
// $RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
// endforeach;
// }
$data = array('name' => 'EditReqnumber', 'value' => set_value('EditReqnumber'), 'id' => 'EditReqnumber', 'class' => 'form-control select2', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Department Name</label>
<div>
<?php
$data = array('name' => 'EditCapitalDepartmentName', 'value' => set_value('EditCapitalDepartmentName'), 'id' => 'EditCapitalDepartmentName', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Cost Center Code</label>
<div>
<?php
$data = array('name' => 'EditCostCenter', 'value' => set_value('EditCostCenter'), 'id' => 'EditCostCenter', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Avail Bud Amount<?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'EditCapitalbudAmt', 'value' => set_value('EditCapitalbudAmt'), 'id' => 'EditCapitalbudAmt', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-9"></div>
<div class="form-group col-md-3" id="ExchangeRateModalEditDiv" style="display:none;">
<label> Exchange Rate</label>
<?php
$data = array('name' => 'EditExchangeRtModal', 'value' => set_value('EditExchangeRtModal'), 'id' => 'EditExchangeRtModal', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label>Item Code</label>
<div>
<?php
$options = array("0" => 'Item Code');
echo form_dropdown('MaterialCode', $options, set_value('EditMaterialCode'), 'id="EditMaterialCode" class="form-control select2"');
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Item Name</label>
<?php
$data = array('name' => 'EditCapitalItemName', 'value' => set_value('EditCapitalItemName'), 'id' => 'EditCapitalItemName', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>UOM</label>
<?php
$data = array('name' => 'EditCPUOM', 'value' => set_value('EditCPUOM'), 'id' => 'EditCPUOM', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Quantity</label>
<?php
$data = array('name' => 'EditCPQuantity', 'value' => set_value('EditCPQuantity'), 'id' => 'EditCPQuantity', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();calculateFreight(3);calculateFreightloceditper()');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3"></div>
<div class="form-group col-md-3" style="padding-right: 0px;">
<label id="EditRateIn">Rate(in INR/UOM)</label>
<?php
$data = array('name' => 'EditCPRate', 'value' => set_value('EditCPRate'), 'id' => 'EditCPRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();calculateFreight(3);calculateFreightloceditper()');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Per</label> <?php
$data = array('name' => 'EditAmendPer', 'value' => set_value('EditAmendPer'), 'id' => 'EditAmendPer', 'class' => 'form-control');
echo form_input($data); ?>
</div>
<div class="form-group col-md-3">
<label id="EditTotalAmount">Basic value in <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'EditCPTotalAmount', 'value' => set_value('EditCPTotalAmount'), 'id' => 'EditCPTotalAmount', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div id="EDITCAPdiv">
<div class="form-row">
<div class="form-group col-md-3">
</div>
<div class="form-group col-md-3">
<label>Discount Type </label>
<div>
<?php
$options = array("0" => 'Select Discount Type');
//print_r( $options);
if (!empty($TaxType)) {
foreach ($TaxType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('EditDiscountType', $options, set_value('EditDiscountType'), 'id="EditDiscountType" class="form-control"');
?>
</div>
</div>
<div class="form-group col-md-3">
<label>Discount Rate </label>
<?php
$data = array('name' => 'txtEditDiscount', 'value' => set_value('txtEditDiscount'), 'id' => 'txtEditDiscount', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();calculateDiscount(1);', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Discounted Amt <?php echo "($INR)" ?> </label>
<?php
$data = array('name' => 'txtEditAfterDiscount', 'value' => set_value('txtEditAfterDiscount'), 'id' => 'txtEditAfterDiscount', 'class' => 'form-control num', 'readonly' => 'true', 'style' => 'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
</div>
<div class="form-group col-md-3">
<label>Freight Type </label>
<?php
$options = array("0" => 'Select Freight Type');
if (!empty($FreightType)) {
foreach ($FreightType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('drpFreighteditloc', $options, set_value('drpFreighteditloc'), 'id="drpFreighteditloc" class="form-control "'); ?>
</div>
<div class="form-group col-md-3" id="TripsValuelocedit" style="display:none;">
<label>NO Of Trips</label>
<?php
$data = array('name' => 'NOOfTripslocedit', 'value' => set_value('NOOfTripslocedit'), 'id' => 'NOOfTripslocedit', 'class' => 'form-control num', 'onchange' => 'calculateFreightloceditper();');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label>Freight Rate </label>
<?php
$data = array('name' => 'txtFreightlocedit', 'value' => set_value('txtFreightlocedit'), 'id' => 'txtFreightlocedit', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateFreightloceditper();');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" style="padding-left: -2px;">
<label>Freight Amt <?php echo "($INR)" ?></label>
<?php
$data = array('name' => 'txtAfterFreightlocedit', 'value' => set_value('txtAfterFreightlocedit'), 'id' => 'txtAfterFreightlocedit', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="form-row" id="EDITCAPdiv1"><!--EDITCAPdiv1 -->
<div class="form-group col-md-6" align="right">
<label for=""> CGST In % </label>
</div>
<div class="form-group col-md-3">
<?php
$data = array('name' => 'EditCgst', 'value' => set_value('EditCgst'), 'id' => 'EditCgst', 'class' => 'form-control num', 'placeholder' => 'CGST TAX PERCENTAGE', 'onchange' => 'ChangeEditSgst();EditRatechange();', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<?php
$data = array('name' => 'EditAfterCgst', 'value' => set_value('EditAfterCgst'), 'id' => 'EditAfterCgst', 'class' => 'form-control num', 'placeholder' => 'After CGST', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-6" align="right">
<label for=""> SGST In % </label>
</div>
<div class="form-group col-md-3">
<?php
$data = array('name' => 'EditSgst', 'value' => set_value('EditSgst'), 'id' => 'EditSgst', 'class' => 'form-control num', 'placeholder' => 'SGST TAX PERCENTAGE', 'onchange' => 'EditRatechange()', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<?php
$data = array('name' => 'EditAfterSgst', 'value' => set_value('EditAfterSgst'), 'id' => 'EditAfterSgst', 'class' => 'form-control num', 'placeholder' => 'After SGST', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" id="EDITCAPdiv2"><!--EDITCAPdiv2 -->
<div class="form-group col-md-6" align="right">
<label for=""> IGST In %</label>
</div>
<div class="form-group col-md-3">
<?php
$data = array('name' => 'EditIgst', 'value' => set_value('EditIgst'), 'id' => 'EditIgst', 'class' => 'form-control num', 'placeholder' => 'IGST TAX PERCENTAGE', 'onchange' => 'EditRatechange()', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<?php
$data = array('name' => 'EditAfterIgst', 'value' => set_value('EditAfterIgst'), 'id' => 'EditAfterIgst', 'class' => 'form-control num', 'placeholder' => 'After IGST', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" id="EDITCAPdiv3"><!--EDITCAPdiv3 -->
<div class="form-group col-md-9" align="right">
<label>Other Allowances <?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-3">
<?php
$data = array('name' => 'EditOtherAllowances', 'value' => set_value('EditOtherAllowances'), 'id' => 'EditOtherAllowances', 'class' => 'form-control num', 'placeholder' => 'Other Allowances', 'onchange' => 'EditRatechange()', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" id="EDITCAPdiv4" style="display:flex;"><!--EDITCAPdiv4 -->
<div class="form-group col-md-9" align="right">
<label>Total Order Value <?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-3">
<?php
$data = array('name' => 'Editservicetotalordervaue', 'value' => set_value('Editservicetotalordervaue'), 'id' => 'Editservicetotalordervaue', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" style="border:solid black 1px; padding:1%;">
<div class="form-row" style="padding:1%;" id="EditModalImportTaxHide" style="display:none;">
<br/>
<div class="form-group col-md-6" style="padding:15px;">
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditBasicPriceTax">Basic Price In<?php echo "($INR)" ?></label>
</div>
<!--<div class="form-group col-md-4">
<div >
<?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 col-md-offset-4">
<?php
$data = array('name' => 'EditAfterBasicPriceTax', 'value' => set_value('EditAfterBasicPriceTax'), 'id' => 'EditAfterBasicPriceTax', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditLandingCharge">Landing charge<?php echo "$INR" ?></label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditLandingCharge', 'value' => set_value('EditLandingCharge'), 'id' => 'EditLandingCharge', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();');
echo form_input($data);
?>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditAfterLandingCharge', 'value' => set_value('EditAfterLandingCharge'), 'id' => 'EditAfterLandingCharge', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditHighseas">Assessable Value (A)<?php echo "$INR" ?></label>
</div>
<div class="form-group col-md-4">
<div style="display: none;">
<?php
$data = array('name' => 'EditHighseas ', 'value' => set_value('EditHighseas'), 'id' => 'EditHighseas', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditAfterAssessable', 'value' => set_value('EditAfterAssessable'), 'id' => 'EditAfterAssessable', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditCustomduty"> Custom duty (B) :<?php echo "$INR" ?></label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditCustomduty', 'value' => set_value('EditCustomduty'), 'id' => 'EditCustomduty', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();');
echo form_input($data);
?>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditAfterCustomduty', 'value' => set_value('EditAfterCustomduty'), 'id' => 'EditAfterCustomduty', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditCustomEDcess"> Custom ED_cess : (C)<?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditCustomEDcess', 'value' => set_value('EditCustomEDcess'), 'id' => 'EditCustomEDcess', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();');
echo form_input($data);
?>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditAfterCustomEDcess', 'value' => set_value('EditAfterCustomEDcess'), 'id' => 'EditAfterCustomEDcess', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditCustomSHcess"> Custom S & H cess : (D)<?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditCustomSHcess', 'value' => set_value('EditCustomSHcess'), 'id' => 'EditCustomSHcess', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();');
echo form_input($data);
?>
</div>
<div class="form-group col-md-4">
<?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 class="form-group col-md-6" style="padding:15px;">
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditAdditionalExciseduty"> Subtotal: (E)<?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-4">
<div style="display: none">
<?php
$data = array('name' => 'EditAdditionalExciseduty ', 'value' => set_value('EditAdditionalExciseduty'), 'id' => 'EditAdditionalExciseduty', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();');
echo form_input($data);
?>
</div>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditSubtotal', 'value' => set_value('EditSubtotal'), 'id' => 'EditSubtotal', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<!-- Additional Excise duty : (g) -->
<label for="EditIgstInt">
IGST on (E): (F)
<?php echo " ($INR)"; ?>
</label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditIgstInt ', 'value' => set_value('EditIgstInt', 0), 'id' => 'EditIgstInt', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditCalculateIgst()');
echo form_input($data);
?>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditAfterIgstInt', 'value' => set_value('EditAfterIgstInt', 0), 'id' => 'EditAfterIgstInt', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-8">
<label for="EditGrossdutypayable">
Total Duty <?php echo "($INR)" ?>
</label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditGrossdutypayable ', 'value' => set_value('EditGrossdutypayable'), 'id' => 'EditGrossdutypayable', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<!--Start of Adding of Frieght model-->
<div class="form-row" style="padding:0px;">
<div class="form-group col-md-3">
<label for="drpamendFreight">Freight Type</label>
<?php
$options = array("0" => 'Select Freight Type');
if (!empty($FreightType)) {
foreach ($FreightType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('drpamendFreight', $options, set_value('drpamendFreight'), 'id="drpamendFreight" class="form-control "');
?>
</div>
<div class="form-group col-md-3" id="AmendTripsValue" style="display:none;">
<label for="AmendNOOfTrips">NO Of Trips</label>
<?php
$data = array('name' => 'AmendNOOfTrips', 'value' => set_value('AmendNOOfTrips'), 'id' => 'AmendNOOfTrips', 'class' => 'form-control num', 'onchange' => 'calculateFreight(0);');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label for="AmendtxtFreight">Freight Rate</label>
<?php
$data = array('name' => 'AmendtxtFreight', 'value' => set_value('AmendtxtFreight'), 'id' => 'AmendtxtFreight', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateFreight(3);');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3" style="padding-left: 0px;">
<label for="AmendtxtAfterFreight"> Freight Amt </label>
<?php
$data = array('name' => 'AmendtxtAfterFreight', 'value' => set_value('AmendtxtAfterFreight'), 'id' => 'AmendtxtAfterFreight', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<!--End of Adding of freight in edit model -->
<br>
<center> <label>Cost of the product Per UOM</label></center>
<hr />
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditDutyImpact">
Duty Impact
</label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditDutyImpact', 'value' => set_value('EditDutyImpact'), 'id' => 'EditDutyImpact', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();', 'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="form-group col-md-4" style="margin-top: -4.8%">
<label for="EditPurQuantity">Quantity</label>
<?php
$data = array('name' => 'EditPurQuantity', 'value' => set_value('EditPurQuantity'), 'id' => 'EditPurQuantity', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditCustomDutyExpenses">
Custom Duty<?php echo "($INR)/UOM" ?>
</label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditCustomDutyExpenses ', 'value' => set_value('EditCustomDutyExpenses'), 'id' => 'EditCustomDutyExpenses', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="EditClearingCharges"> Clearing Charges <?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-4">
<?php
$data = array('name' => 'EditClearingCharges', 'value' => set_value('EditClearingCharges'), 'id' => 'EditClearingCharges', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange();');
echo form_input($data);
?>
</div>
<div class="form-group col-md-4 " style="margin-top: -4.8%">
<label for="EditNett">Nett per UOM<?php echo "($INR)"; ?></label>
<?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="form-group col-md-6" align="right" style="display:none;"> <label>Total Order
Amount :</label></div>
<div class="form-group col-md-6" style="display:none;">
<?php
$data = array('name' => 'EdittxtTotalOrderValue', 'value' => set_value('EdittxtTotalOrderValue'), 'id' => 'EdittxtTotalOrderValue', 'class' => 'form-control num', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<br>
<div class="form-row" style="text-align: left;">
<div class="form-group col-md-12">
<label>Capital Description </label>
<?php
$data = array('name' => 'EditItemDescription', 'value' => set_value('EditItemDescription'), 'id' => 'EditItemDescription', 'class' => 'form-control', 'rows' => '3', 'cols' => '40');
echo form_textarea($data); ?>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" value="Cancel" style="margin-right:10px">Cancel</a>
<a class="btn btn-success font EditCapital" ID="UpdateCapital"> &nbsp;&nbsp;<span
class="bold">Update Capital</span></a>
</div>
</form>
</div>
</div>
</div><!-- /.modal -->
<script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript"></script>
<!-- <script type="text/html" id="CapitalList">
<tr id="<%=index%>">
<td align="left"><%=index%></td>
<td align="left"><%=ReqNo%></td>
<td align="left"><%=MaterialName%></td>
<td align="left"><%=Quantity%></td>
<td align="left"><%=UOM%></td>
<td align="left"><%=Rate%></td>
<td align="left"><%=BasicAmount%></td>
<td align="left"><%=Taxvalue%></td>
<td align="left"><%=TotalValue%></td>
<td>
<a data-target='#EDITCAPITAL' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EDITREVENUE"><i class="ri-pencil-fill" 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="ri-delete-bin-7-fill"></span></a>
</td>
</tr>
</script> -->
<script>
var RequistQuantity = '';
var AvilBudAmt = '';
var POMaxDate = '<?php echo $MaxPoDate; ?>';
var d = new Date(POMaxDate);
var SelectedMaterialCode = [];
var CollIndex = 0;
var SelectedMaterialList = {
Mat: []
};
$('#BudgetType').attr("style", "pointer-events: none;");
var index = <?php echo $index; ?> + 1;
var myArray = <?php echo json_encode($res_arr_values); ?>;
$.each(myArray, function (idx, obj) {
SelectedMaterialCode[CollIndex] = obj.materialCode;
CollIndex = CollIndex + 1;
SelectedMaterialList.Mat.push({
"materialCode": obj.materialCode,
"ReqNo": obj.ReqNo,
});
});
$(function () {
var capital = <?php echo json_encode($CapitalRange, JSON_PRETTY_PRINT) ?>;
if (capital == 0) {
$('#CAPdiv').hide();
$('#ADDCAPdiv').hide();
$('#ADDCAPdiv1').hide();
$('#ADDCAPdiv2').hide();
$('#ADDCAPdiv3').hide();
$('#EDITCAPdiv').hide();
// $('#EDITCAPdiv1').hide();
// $('#EDITCAPdiv2').hide();
// $('#EDITCAPdiv3').hide();
// $('#VIEWCAPdiv').hide();
// $('#VIEWCAPdiv1').hide();
// $('#VIEWCAPdiv2').hide();
// $('#VIEWCAPdiv3').hide();
//$('#DOMdiv').hide();
}
$('#Supplier').change(function () {
var id = $('#drpSupplier').val();
var supPaymentTerms = '';
var supPaymentAT = '';
var subPaymentDate = '';
$("#SupAddress").val('');
if (id != '0') {
var y = <?php echo json_encode($Suplist, JSON_PRETTY_PRINT) ?>;
$.each(y, function (idx, obj) {
if (obj.SupplierID === id) {
if (obj.MSME) {
$("#SupAddress").val("MSME :" + obj.MSME + "\n" + obj.Address);
} else {
$("#SupAddress").val(obj.Address);
}
supPaymentTerms = obj.PaymentTerms;
supPaymentAT = obj.PayableAT;
subPaymentDate = obj.PaymentDays;
}
});
$('#PaymentMethod').empty();
var paymentList = <?php echo json_encode($Payment, JSON_PRETTY_PRINT) ?>;
$.each(paymentList, function (idx1, obj1) {
if (obj1.ConfigValue == supPaymentTerms) {
$("#PaymentMethod").append($('<option></option>').val(obj1.ConfigValue).html(obj1.ConfigValue));
$("#PayableAT").val(supPaymentAT);
}
});
$.each(paymentList, function (idx, obj) {
if (obj.PaymentTerms != supPaymentTerms) {
$("#PaymentMethod").append($('<option></option>').val(obj.PaymentTerms).html(obj.PaymentTerms));
$("#PayableAT").val(supPaymentAT);
}
});
} else {
alert('Please select the SupplierID');
return false;
}
});
$('#Reqnumber').change(function () {
var ExchangeRate = '';
var ExchangeRate = $('#ExchangeRt').val();
var id = $('#Reqnumber').val();
$("#CapitalbudAmt").val('');
$("#ExchangeRtModal").val(ExchangeRate);
$("#MaterialCode").empty();
$("#CapitalDepartmentName").val('');
$("#CPUOM").val('');
$("#CPQuantity").val('');
$("#CapitalItemName").val('');
$("#CPTotalAmount").val('');
$("#txtBasicValue").val('');
$("#CostCenter").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) ?>;
var AvlBudAmt = '<?php echo $AvlAmount ?>';
// For Binding DepartmentName
$.each(y, function (idx, obj) {
if (obj.ReqNo === id) {
$("#CapitalDepartmentName").val(obj.DepartmentName);
$("#CostCenter").val(obj.CostCenterCode);
}
});
$("#CapitalbudAmt").val(AvlBudAmt);
// For Binding Material list center for the selected Requistion Number
$("#MaterialCode").append($('<option></option>').val("0").html("Select Material Code"));
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function (idx, obj) {
if (obj.ReqNo === id) {
$.each(SelectedMaterialList.Mat, function (idx1, el) {
if (id == el.ReqNo) {
if (el.materialCode == obj.MaterialCode) {
isAdded = "1";
return false;
} else {
isAdded = "0";
}
}
});
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
});
}
} else {
alert('Please select the Requisition Number');
return false;
}
id = '';
});
$('#MaterialCode').change(function () {
var id = $('#MaterialCode').val();
$("#CapitalItemName").val('');
$("#CPUOM").val('');
$("#CPQuantity").val('');
$("#CPTotalAmount").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) {
$("#CapitalItemName").val(obj.MaterialName);
$("#CPUOM").val(obj.UOM);
$("#CPQuantity").val(obj.Quantity);
RequistQuantity = obj.Quantity;
var CPUOMDisplay = obj.UOM;
$('#RateIn').html('Rate(in' + " " + DisplayCurrencySymbol + '/' + CPUOMDisplay + ')');
$('#EditRateIn').html('Rate(in' + " " + DisplayCurrencySymbol + '/Ton)');
}
});
}
var d = $('#drpSupplier').val();
$('#loader').show();
$.ajax({
url: "<?php echo base_url() ?>VerifyWithSupplierForPendingPO",
type: 'POST',
data: {
supplierid: d,
materialcode: id
},
success: function (response) {
$('#loader').hide();
if (response) alert(response);
}
});
} else {
alert('Please select the MaterialCode');
return false;
}
var d = $('#drpSupplier').val();
});
$('#EditMaterialCode').change(function () {
var id = $('#EditMaterialCode').val();
$("#EditItemName").val('');
$("#EditUOM").val('');
$("#EditQuantity").val('');
$("#EditRate").val('');
$("#txtEditBasicValue").val('');
RequistQuantity = '';
clearEditTaxField();
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) {
$("#EditItemName").val(obj.MaterialName);
$("#EditUOM").val(obj.UOM);
$("#EditQuantity").val(obj.Quantity);
RequistQuantity = obj.Quantity;
var CPUOMDisplay = obj.UOM;
$('#RateIn').html('Rate(in' + " " + DisplayCurrencySymbol + '/' + CPUOMDisplay + ')');
$('#EditRateIn').html('Rate(in' + " " + DisplayCurrencySymbol + '/Ton)');
}
});
}
var d = $('#drpSupplier').val();
$('#loader').show();
$.ajax({
url: "<?php echo base_url() ?>VerifyWithSupplierForPendingPO",
type: 'POST',
data: {
supplierid: d,
materialcode: id
},
success: function (response) {
$('#loader').hide();
if (response) alert(response);
}
});
} else {
alert('Please select the MaterialCode');
return false;
}
});
var d = $('#drpSupplier').val();
});
function clearTaxField() {
$('#CPTotalAmount').val('');
$('#AfterServiceTax').val('');
$('#AfterEduCess').val('');
$('#AfterSecHighTax').val('');
$('#AfterKrishiTax').val('');
$('#AfterSwachhTax').val('');
$('#BasicPriceTax ').val('');
$('#AfterBasicPriceTax').val('');
$("#LandingCharge").val('');
$("#AfterLandingCharge").val('');
$("#Highseas").val('');
$("#AfterHighseas").val('');
$("#Customduty").val('');
$("#AfterCustomduty").val('');
$("#ExcisedutyTax").val('');
$("#AfterExcisedutyTax").val('');
$("#ExcisedutyEDcess").val('');
$("#AfterExcisedutyEDcess").val('');
$("#ExcisedutySHcess").val('');
$("#AfterExcisedutySHcess").val('');
$("#CustomEDcess").val('');
$("#AfterCustomEDcess").val('');
$("#CustomSHcess").val('');
$("#AfterCustomSHcess").val('');
$("#AdditionalExciseduty").val('');
$("#AfterAdditionalExciseduty").val('');
$("#Grossdutypayable").val('');
$("#AvailableModvat").val('');
$("#Grossexpenses").val('');
$("#purchaserate").val('');
$("#CustomDutyExpenses").val('');
$("#RMCIncludingCustomers").val('');
$("#PurQuantity").val('');
RequistQuantity = '';
}
/*
This function is used to validate all field
*/
/* This function used to check quantity exceeding or not */
// function ExceedQuantityCheck()
// {
// var EnterQuantity = $("#CPQuantity").val()== '' ? "0.00" : parseFloat($("#CPQuantity").val());
// var ReqQuantity = parseFloat(RequistQuantity);
// //alert(ReqQuantity);
// if(EnterQuantity > ReqQuantity)
// {
// alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
// $('#CPQuantity').focus();
// return false;
// }
// else {
// return true;
// }
// }
/*
This function is used to calculate tax
*/
function calculateServiceCGST(varBasicValue, varCGST) {
var basicValue = parseFloat(varBasicValue);
var Cgst = parseFloat(varCGST);
var ServiceCGSTvalue = 0.0;
ServiceCGSTvalue = <?php echo SERVICETAX_CGST; ?>;
var TAXval = parseFloat(ServiceCGSTvalue).toFixed(2);
return TAXval; // $('#AfterServiceTax').val(TAXval);
}
function calculateServiceSGST(varBasicValue, varSGST) {
// alert(varBasicValue+"-"+varSGST);
var basicValue = parseFloat(varBasicValue);
var Sgst = parseFloat(varSGST);
var ServiceSGSTvalue = 0.0;
ServiceSGSTvalue = <?php echo SERVICETAX_SGST; ?>;
var TAXval = parseFloat(ServiceSGSTvalue).toFixed(2);
return TAXval; // $('#AfterEduCess').val(TAXval);
}
function calculateServiceIGST(varBasicValue, varIGST) {
var basicValue = parseFloat(varBasicValue);
var Igst = parseFloat(varIGST);
var ServiceCGSTvalue = 0.0;
ServiceCGSTvalue = <?php echo SERVICETAX_IGST; ?>;
var TAXval = parseFloat(ServiceCGSTvalue).toFixed(2);
return TAXval; //$('#AfterSecHighTax').val(TAXval);
}
/*
Calculate Landing charge
*/
function calculateLandingCharge(landingCharge, basicValue) {
var landCharge = landingCharge;
var basicPrice = parseFloat(basicValue);
afterLandingCharge = <?php echo Capital_Landing_Charge; ?>;
return parseFloat(afterLandingCharge).toFixed(2);
}
/*Calculate Highseas Charge*/
function calculateHighseasCharge(AfterLanding, basicPrices, Highseass) {
var afterLandingCharge = parseFloat(AfterLanding);
var basicPrice = parseFloat(basicPrices);
var highSeas = Highseass;
afterHighseasCharge = <?php echo Capital_Highseas_Charge; ?>;
return parseFloat(afterHighseasCharge).toFixed(2);
}
/*Calculate calculate Customduty Charge */
function calculateCustomdutyCharge(AfterLanding, basicPrices, afterHighseass, Customduty) {
var afterLandingCharge = parseFloat(AfterLanding);
var basicPrice = parseFloat(basicPrices);
var afterHighseas = parseFloat(afterHighseass);
var Customduty = Customduty;
afterCustomdutyCharge = <?php echo Capital_Customduty_Charge; ?>;
return parseFloat(afterCustomdutyCharge).toFixed(2);
}
/*
calculate Excise Charge
*/
function calculateExciseCharge(AfterLanding, basicPrices, afterHighseass, afterCustomduty, Excise) {
var afterLandingCharge = parseFloat(AfterLanding);
var basicPrice = parseFloat(basicPrices);
var afterHighseas = parseFloat(afterHighseass);
var afterCustomduty = parseFloat(afterCustomduty);
var Excise = Excise;
afterExciseCharge = <?php echo Capital_Excise_Charge; ?>;
return parseFloat(afterExciseCharge).toFixed(2);
}
/* calculateExciseEDcessCharge*/
function calculateExciseEDcessCharge(ExciseDuty, ExciseEDcessCharge) {
var ExciseDuty = parseFloat(ExciseDuty);
var ExciseEDcessCharge = ExciseEDcessCharge;
afterExciseEDcessCharge = <?php echo Capital_ExciseEDcess_Charge; ?>;
return parseFloat(afterExciseEDcessCharge).toFixed(2);
}
/* calculate Excise duty S & H cess :(d) */
function calculateExciseSHcessCharge(ExciseDuty, ExciseSHcessCharge) {
var ExciseDuty = parseFloat(ExciseDuty);
var ExciseSHcessCharge = ExciseSHcessCharge;
afterExciseSHcessCharge = <?php echo Capital_ExciseSHcess_Charge; ?>;
return parseFloat(afterExciseSHcessCharge).toFixed(2);
}
/*
calculate CustomEDcess Charge
*/
function calculateCustomEDcessCharge(AfterLanding, AfterHighseas, AfterCustomduty, AfterExcisedutyTax, AfterExcisedutyEDcess, AfterExcisedutySHcess, CustomEDcess) {
var afterLandingCharge = parseFloat(AfterLanding);
var AfterHighseas = parseFloat(AfterHighseas);
var AfterCustomduty = parseFloat(AfterCustomduty);
var AfterExcisedutyTax = parseFloat(AfterExcisedutyTax);
var AfterExcisedutyEDcess = parseFloat(AfterExcisedutyEDcess);
var AfterExcisedutySHcess = parseFloat(AfterExcisedutySHcess);
var CustomEDcess = CustomEDcess;
afterCustomEDcessCharge = <?php echo Capital_CustomEDcess_Charge; ?>;
return parseFloat(afterCustomEDcessCharge).toFixed(2);
}
/*
calculate custom S & H cess
*/
function calculateCustomSHcessCharge(AfterLanding, AfterHighseas, AfterCustomduty, AfterExcisedutyTax, AfterExcisedutyEDcess, AfterExcisedutySHcess, CustomSHcess) {
var afterLandingCharge = parseFloat(AfterLanding);
var AfterHighseas = parseFloat(AfterHighseas);
var AfterCustomduty = parseFloat(AfterCustomduty);
var AfterExcisedutyTax = parseFloat(AfterExcisedutyTax);
var AfterExcisedutyEDcess = parseFloat(AfterExcisedutyEDcess);
var AfterExcisedutySHcess = parseFloat(AfterExcisedutySHcess);
var CustomSHcess = CustomSHcess;
afterCustomCustomSHcessCharge = <?php echo Capital_CustomSHcess_Charge; ?>;
return parseFloat(afterCustomCustomSHcessCharge).toFixed(2);
}
/*
calculate Additional ExciseDuty Charge
*/
function calculateAdditionalExciseDutyCharge(basicPrices, AfterLanding, AfterHighseas, AfterCustomduty, AfterExcisedutyTax, AfterExcisedutyEDcess, AfterExcisedutySHcess, AfterCustomEDcess, AfterCustomSHcess, AdditionalExciseduty) {
var basicPrices = parseFloat(basicPrices);
var afterLandingCharge = parseFloat(AfterLanding);
var AfterHighseas = parseFloat(AfterHighseas);
var AfterCustomduty = parseFloat(AfterCustomduty);
var AfterExcisedutyTax = parseFloat(AfterExcisedutyTax);
var AfterExcisedutyEDcess = parseFloat(AfterExcisedutyEDcess);
var AfterExcisedutySHcess = parseFloat(AfterExcisedutySHcess);
var AfterCustomEDcess = parseFloat(AfterCustomEDcess);
var AfterCustomSHcess = parseFloat(AfterCustomSHcess);
var AdditionalExciseduty = AdditionalExciseduty;
afterAdditionalExcisedutyCharge = <?php echo Capital_AdditionalExciseduty_Charge; ?>;
return parseFloat(afterAdditionalExcisedutyCharge).toFixed(2);
}
/*
calculate Additional Grossdutypayable Charge
*/
function calculateGrossdutypayableCharge(AfterLanding, AfterHighseas, AfterCustomduty, AfterExcisedutyTax, AfterExcisedutyEDcess, AfterExcisedutySHcess, AfterCustomEDcess, AfterCustomSHcess, AfterAdditionalExciseduty) {
var AfterAdditionalExciseduty = parseFloat(AfterAdditionalExciseduty);
var afterLandingCharge = parseFloat(AfterLanding);
var AfterHighseas = parseFloat(AfterHighseas);
var AfterCustomduty = parseFloat(AfterCustomduty);
var AfterExcisedutyTax = parseFloat(AfterExcisedutyTax);
var AfterExcisedutyEDcess = parseFloat(AfterExcisedutyEDcess);
var AfterExcisedutySHcess = parseFloat(AfterExcisedutySHcess);
var AfterCustomEDcess = parseFloat(AfterCustomEDcess);
var AfterCustomSHcess = parseFloat(AfterCustomSHcess);
GrossdutypayableCharge = <?php echo Capital_Grossdutypayable_Charge; ?>;
return parseFloat(GrossdutypayableCharge).toFixed(2);
}
/*
calculate ModvatCharge Charge
*/
function calculateAvailableModvatCharge(AfterExcisedutyTax, AfterExcisedutyEDcess, AfterExcisedutySHcess, AfterAdditionalExciseduty) {
var AfterExcisedutyTax = parseFloat(AfterExcisedutyTax);
var AfterExcisedutyEDcess = parseFloat(AfterExcisedutyEDcess);
var AfterExcisedutySHcess = parseFloat(AfterExcisedutySHcess);
var AfterAdditionalExciseduty = parseFloat(AfterAdditionalExciseduty);
ModvatCharge = <?php echo Capital_ModvatCharge_Charge; ?>;
return parseFloat(ModvatCharge).toFixed(2);
}
/*
calculate Grossexpenses Charge
*/
function calculateGrossexpensesCharge(Grossdutypayable, AvailableModvat) {
var Grossdutypayable = parseFloat(Grossdutypayable);
var AvailableModvat = parseFloat(AvailableModvat);
Grossexpenses = <?php echo Capital_Grossexpenses_Charge; ?>;
return parseFloat(Grossexpenses).toFixed(2);
}
/*
calculate purchaserate
*/
function calculatepurchaserate(AfterBasicPriceTax, PurQuantity) {
var AfterBasicPriceTax = parseFloat(AfterBasicPriceTax);
var PurQuantity = parseFloat(PurQuantity);
purchaserate = <?php echo Capital_purchaserate_Charge; ?>;
if (isFinite(purchaserate)) {
return parseFloat(purchaserate).toFixed(2);
} else
return (0);
//return parseFloat(purchaserate).toFixed(2);
}
/*
calculateCustomDutyExpenses
*/
function calculateCustomDutyExpenses(Grossexpenses, PurQuantity) {
var Grossexpenses = parseFloat(Grossexpenses);
var PurQuantity = parseFloat(PurQuantity);
CustomDutyExpenses = <?php echo Capital_CustomDutyExpenses_Charge; ?>;
//return parseFloat(CustomDutyExpenses).toFixed(2);
if (isNaN(CustomDutyExpenses)) {
return (0);
} else if (isFinite(CustomDutyExpenses)) {
return parseFloat(CustomDutyExpenses).toFixed(2);
} else {
return (0);
//return parseFloat(CustomDutyExpenses).toFixed(2);
}
}
/*
calculateRMCIncludingCustomers
*/
function calculateRMCIncludingCustomers(purchaserate, CustomDutyExpenses) {
var purchaserate = parseFloat(purchaserate);
var CustomDutyExpenses = parseFloat(CustomDutyExpenses);
RMCIncludingCustomers = <?php echo Capital_RMCIncludingCustomers_Charge; ?>;
return parseFloat(RMCIncludingCustomers).toFixed(2);
}
/*
This is used to calculate Total order value
*/
/*
Used to check the exceed budget
*/
function ExceedBudget(ValuetoCheck, budgetAmount) {
var ReqAmount = parseFloat(ValuetoCheck);
var BudAmount = parseFloat(budgetAmount);
// if(ReqAmount > BudAmount )
// {
// alert('Your exceeding the Avaiable Budget :'+ BudAmount +'.Please adjust the Product to proceed further.');
// return false;
// }
// else
// {
return true;
// }
}
/* This is used add capital po line item */
/* used to validateExceedLimit */
function validateExceedLimit() {
var avalbudAmt = parseFloat($('#CapitalbudAmt').val());
var basicAmountRate = parseFloat($('#CPTotalAmount').val());
var totalAmount = parseFloat($('#txtTotalOrderValue').val());
// if(basicAmountRate > avalbudAmt)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#CPRate').focus();
// return false;
// }
// else
// {
return true;
//}
}
function validateCapitalTax() {
if ($('#Reqnumber').val() == "0") {
alert('Please select the Requisition Number');
$('#Reqnumber').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 ($('#CPQuantity').val() == '') {
alert('Please Enter the Quantity value');
$('#CPQuantity').focus();
return false;
} else if ($('#CPRate').val() == '') {
alert('Please Enter the Rate of the Item');
$('#CPRate').focus();
return false;
} else {
return true;
}
}
function clearCapitalModalFields() {
$('#Reqnumber').val('0');
$('#CapitalDepartmentName').val('');
$('#CapitalbudAmt').val('');
$('#CostCenter').val('0');
$('#MaterialCode').val('0');
$("#CapitalItemName").val('');
$("#CPUOM").val('');
//var exchangeRate = $("#ExchangeRtModal").val();
$("#CPQuantity").val('');
$("#CPRate").val('');
$("#CPTotalAmount").val('');
$("#AfterServiceTax").val('');
$("#AfterEduCess").val('');
$("#AfterSecHighTax").val('');
$("#AfterKrishiTax").val('');
$("#AfterSwachhTax").val('');
$('#AfterBasicPriceTax').val('');
$('#LandingCharge').val('');
$('#AfterLandingCharge').val('');
$('#Highseas').val('');
$('#AfterHighseas').val('');
$('#Customduty').val('');
$('#AfterCustomduty').val('');
$('#ExcisedutyTax').val('');
$('#AfterExcisedutyTax').val('');
$('#ExcisedutyEDcess').val('');
$('#AfterExcisedutyEDcess').val('');
$('#ExcisedutySHcess').val('');
$('#AfterExcisedutySHcess').val('');
$('#CustomEDcess').val('');
$('#AfterCustomEDcess').val('');
$('#CustomSHcess').val('');
$('#AfterCustomSHcess').val('');
$('#AdditionalExciseduty').val('');
$('#AfterAdditionalExciseduty').val('');
$('#Grossdutypayable').val('');
$('#AvailableModvat').val('');
$('#Grossexpenses').val('');
$('#PurQuantity').val('');
$('#purchaserate').val('');
$('#CustomDutyExpenses').val('');
$('#RMCIncludingCustomers').val('');
$("#txtTotalOrderValue").val('');
}
/* get Edit Capital Po Modal*/
$(document).ready(function () {
$("#EDITCAPITAL").on("shown.bs.modal", function (e) {
userid = $(e.relatedTarget).data('userid');
$('#isEdit').val(1);
var tr = document.getElementById(userid);
var cellval = tr.cells;
var id = $('#Reqnumber' + userid).val();
var disc = $('#DisType' + userid).val();
if (disc != 'NIL') {
//alert('removed');
$('#txtEditDiscount').removeAttr('readonly');
} else {
//alert('Set');
$('#txtEditDiscount').attr('readonly', true);
}
$('#EditReqnumber').val($('#Reqnumber' + userid).val());
$('#EditCapitalDepartmentName').val($('#departmentName' + userid).val());
$("#EditCostCenter").val($('#CPCostCode' + userid).val());
$('#EditCapitalbudAmt').val($('#AvilBudget' + userid).val());
$('#EditExchangeRtModal').val($('#echangeRate' + userid).val());
$('#EditCapitalItemName').val($('#materialName' + userid).val());
$('#Edittxtservicedescription').val($('#ServiceMaterialDescription' + userid).val());
$('#EditFrequency').val($('#frequency' + userid).val());
$('#EditCPUOM').val($('#uom' + userid).val());
$('#EditAmendPer').val($('#per' + userid).val());
$('#EditCPQuantity').val($('#quantity' + userid).val());
$('#EditCPRate').val(parseFloat($('#rateInUs' + userid).val()).toFixed(2));
$('#EditCPTotalAmount').val(parseFloat($('#basicval' + userid).val()).toFixed(2));
RequistQuantity = $('#quantity' + userid).val();
$('#EditCgst').val($('#CGST' + userid).val());
$('#EditAfterCgst').val($('#afterCGST' + userid).val());
$('#EditSgst').val($('#SGST' + userid).val());
$('#EditAfterSgst').val($('#afterSGST' + userid).val());
$('#EditIgst').val($('#IGST' + userid).val());
$('#EditAfterIgst').val($('#afterIGST' + userid).val());
$('#EditOtherAllowances').val($('#otherallowance' + userid).val());
//$('#Editservicetotalordervaue').val($('#totalservicevalue'+userid).val());
$('#Editservicetotalordervaue').val(cellval[8].innerHTML);
$('#drpFreighteditloc').val($('#Ftype' + userid).val());
$('#NOOfTripslocedit').val($('#NoTrip' + userid).val());
$('#txtFreightlocedit').val($('#Fvalue' + userid).val());
$('#txtAfterFreightlocedit').val($('#Afvalue' + userid).val());
var FreightType = $('#drpFreighteditloc').val();
if (FreightType == "PER TRIP") {
///salert();
$('#TripsValuelocedit').show();
} else {
$('#TripsValuelocedit').hide();
}
$('#EditAfterBasicPriceTax').val($('#basicvalInINR' + userid).val());
$('#EditAfterLandingCharge').val($('#landingCharge' + userid).val());
$('#EditAfterCustomduty').val($('#CustomDuty' + userid).val());
$('#EditAfterCustomEDcess').val($('#CustomEDCess' + userid).val());
$('#EditAfterCustomSHcess').val($('#CustomSHCess' + userid).val());
$('#EditGrossdutypayable').val($('#GrossDutyPayable' + userid).val());
$('#EditCustomDutyExpenses').val($('#CustomDutyExpenses' + userid).val());
//$('#txtEditInsurance').val($('#RMCIncludingCustomers'+userid).val());
$('#EdittxtTotalOrderValue').val($('#PerKgExpense' + userid).val());
/* get % value */
$('#EditLandingCharge').val($('#beforeLanding' + userid).val());
$('#EditCustomduty').val($('#beforeCustomDuty' + userid).val());
$('#EditCustomEDcess').val($('#beforeCustomEDCess' + userid).val());
$('#EditCustomSHcess').val($('#beforeCustomSHCess' + userid).val());
$('#EditPurQuantity').val($('#PurQuantity' + userid).val());
$('#EditAfterAssessable').val($("#AssessableValue" + userid).val());
$('#EditSubtotal').val($("#SubTotal" + userid).val());
$('#EditIgstInt').val($("#IGSTInt" + userid).val());
$('#EditAfterIgstInt').val($("#AfterIGSTInt" + userid).val());
$('#EditDutyImpact').val($("#DutyImpact" + userid).val());
$('#EditNett').val($("#NetValue" + userid).val());
$('#EditClearingCharges').val($("#ClearingCharge" + userid).val());
var EditUOM = $('#uom' + userid).val();
$('#RateIn').html('Rate(in' + " " + DisplayCurrencySymbol + '/' + EditUOM + ')');
$('#EditRateIn').html('Rate(in' + " " + DisplayCurrencySymbol + '/' + EditUOM + ')');
$("#EditDiscountType").val($('#DisType' + userid).val());
$('#txtEditDiscount').val($('#DisVal' + userid).val());
$('#txtEditAfterDiscount').val($('#AfterDisVal' + userid).val());
tinyMCE.get('EditItemDescription').setContent($('#CapitalItemDescrition' + userid).val());
$('#AmendtxtFreight').val($('#FreightVal' + userid).val());
$('#AmendtxtAfterFreight').val($('#AfterFreightVal' + userid).val());
$('#AmendNOOfTrips').val($('#NoOfTrip' + userid).val());
$("#drpamendFreight").val($('#FreightType' + userid).val());
var FreightType = $('#FreightType' + userid).val();
if (FreightType == "PER TRIP") {
$('#AmendTripsValue').show();
} else {
$('#AmendTripsValue').hide();
}
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#EditMaterialCode").empty();
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function (idx, obj) {
if (obj.MaterialCode != $('#materialCode' + userid).val()) {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
});
}
$('#EditLandingCharge').attr("style", "pointer-events: none;");
$('#EditHighseas').attr("style", "pointer-events: none;");
$('#EditCustomduty').attr("style", "pointer-events: none;");
$('#EditExcisedutyTax').attr("style", "pointer-events: none;");
$('#EditExcisedutyEDcess').attr("style", "pointer-events: none;");
$('#EditExcisedutySHcess').attr("style", "pointer-events: none;");
$('#EditCustomEDcess').attr("style", "pointer-events: none;");
$('#EditCustomSHcess').attr("style", "pointer-events: none;");
$('#EditAdditionalExciseduty').attr("style", "pointer-events: none;");
$('#EditGrossdutypayable').attr("style", "pointer-events: none;");
$('#EditPurQuantity').attr("style", "pointer-events: none;");
$('#AmendtxtFreight').attr("style", "pointer-events: none;");
$('#AmendtxtAfterFreight').attr("style", "pointer-events: none;");
$('#AmendNOOfTrips').attr("style", "pointer-events: none;");
$('#drpamendFreight').attr("style", "pointer-events: none;");
});
});
/*get edit material list*/
$('#EditMaterialCode').change(function () {
var id = $('#EditMaterialCode').val();
$("#EditCapitalItemName").val('');
$("#EditCPUOM").val('');
$("#EditCPQuantity").val('');
$("#EditCPTotalAmount").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) {
$("#EditCapitalItemName").val(obj.MaterialName);
$("#EditCPUOM").val(obj.UOM);
$("#EditCPQuantity").val(obj.Quantity);
RequistQuantity = obj.Quantity;
}
});
}
} else {
alert('Please select the MaterialCode');
return false;
}
});
function clearEditTaxField() {
$('#EditCPRate').val('');
$('#EditCPTotalAmount').val('');
$('#EditAfterServiceTax').val('');
$('#EditAfterEduCess').val('');
$('#EditAfterSecHighTax').val('');
$('#EditAfterKrishiTax').val('');
$('#EditAfterSwachhTax').val('');
$('#EditBasicPriceTax ').val('');
$('#EditAfterBasicPriceTax').val('');
$("#EditLandingCharge").val('');
$("#EditAfterLandingCharge").val('');
$("#EditHighseas").val('');
$("#EditAfterHighseas").val('');
$("#EditCustomduty").val('');
$("#EditAfterCustomduty").val('');
$("#EditExcisedutyTax").val('');
$("#EditAfterExcisedutyTax").val('');
$("#EditExcisedutyEDcess").val('');
$("#EditAfterExcisedutyEDcess").val('');
$("#EditExcisedutySHcess").val('');
$("#EditAfterExcisedutySHcess").val('');
$("#EditCustomEDcess").val('');
$("#EditAfterCustomEDcess").val('');
$("#EditCustomSHcess").val('');
$("#EditAfterCustomSHcess").val('');
$("#EditAdditionalExciseduty").val('');
$("#EditAfterAdditionalExciseduty").val('');
$("#EditGrossdutypayable").val('');
$("#EditAvailableModvat").val('');
$("#EditGrossexpenses").val('');
$("#Editpurchaserate").val('');
$("#EditCustomDutyExpenses").val('');
$("#EditRMCIncludingCustomers").val('');
$("#EditPurQuantity").val('');
$("#EdittxtTotalOrderValue").val('');
RequistQuantity = '';
}
function Save(status) {
//alert('save function');
// stat = '<?php echo PO_CREATED; ?>';
stat = '<?php echo PO_RELEASED; ?>';
tinyMCE.triggerSave();
var splinstr = $('#txtSpcialInstruction').val();
//alert(splinstr);
var deladd = $('#DeliveryAddr').val();
var ExchangeRateOn = $('#Exchangerateon').val();
var PaymentMethod = $('#PaymentMethod').val();
var PayableAT = $('#PayableAT').val();
var Before = $('#Before').val();
var After = $('#After').val();
$('#SpcialInstruction').val(splinstr);
$('#txtDeliveryAddress').val(deladd);
$('#txtStatus').val(stat);
var ExchangeRate = $('#ExchangeRt').val() == '' ? '1.00' : $('#ExchangeRt').val();
var AvlBudAmt = '<?php echo $AvlAmount ?>';
var capitalrange = <?php echo $CapitalRange; ?>;
var basicamt = 0;
//alert(ExchangeRate+"-"+AvlBudAmt+"-"+capitalrange);
if (capitalrange == 0) { //international
basicamt = ($('#CapitalToatlOrder').val() * ExchangeRate);
//alert(basicamt);
} else if (capitalrange == 1) { //domestic
basicamt = $('#txtTotalBasic').val() - $('#txtTotalDiscount').val();
//alert(basicamt);
}
if (validate()) {
var ex = $('#ExchangeRt').val();
//alert(ex);
//alert(parseInt($('#CapitalToatlOrder').val() * ex));
var AvlBudAmt = '<?php echo $AvlAmount ?>';
//alert(AvlBudAmt);
if (document.getElementById('serviceTax').rows.length < 2) {
alert('Please Select Line item to Create PO');
$('#Deliverydt').focus();
return false;
} else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') {
alert('Please Enter Other Payable Terms Description');
$('#Otherpayment').focus();
return false;
}
// else if(parseInt(AvlBudAmt) < parseInt(basicamt)) {
// alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.');
// return false;
// }
else {
//alert('else');
// $('#content').loader('show');
//salert('ss');
//alert('before Ajax');
var formData = new FormData($('.CapitalPO')[0]);
formData.append('ExchangeRateOn', ExchangeRateOn);
formData.append('PaymentMethod', PaymentMethod);
formData.append('PayableAT', PayableAT);
formData.append('PaymentDate', PaymentDate);
if (status == 0) { // for draft
formData.append('changeStatus','ST014');
console.log("status",status);
};
if (status == 1) { // for approve
formData.append('changeStatus','ST026');
console.log("status",status);
};
$('#loader').show();
$.ajax({
// data:$('.CapitalPO').serialize()+"&ExchangeRateOn="+ExchangeRateOn+"&PaymentMethod="+PaymentMethod+"&PayableAT="+PayableAT+"&PaymentDate="+PaymentDate,
type: "POST",
url: "<?php echo base_url() ?>amendmentpurchaseorder/EditAmendCapitalPurchaseOrder",
data: formData,
processData: false,
contentType: false,
success: function (data) {
// console.log(data);
if (data) {
alert(data);
$('#loader').hide();
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
$('#SpcialInstruction').val('');
$('#txtDeliveryAddress').val('');
window.location = status == 1 ? "amendmentpurchaseorder" : "purchaseorderListing";
} else {
$('#loader').hide();
alert("Error");
}
}
});
}
}
}
function ChangeEditSgst() {
$('#EditSgst').val($('#EditCgst').val());
EditRatechange();
}
/*
This function is used to validate all field and caluclate all field while edit capital po
*/
function EditRatechange() {
if ($('#EditReqnumber').val() == "0") {
alert('Please select the Requisition Number');
$('#EditReqnumber').focus();
return false;
} else if ($('#EditMaterialCode').val() == "0") {
alert('Please select the Material Code');
$('#EditMaterialCode').focus();
return false;
} else if ($('#EditCostCenter').val() == "0") {
alert('Please select the CostCenterCode');
$('#EditCostCenter').focus();
return false;
}
// EditExceedQuantityCheck();
// if(EditExceedQuantityCheck()){
if ($('#EditCPQuantity').val() != '' && $('#EditCPRate').val() != '') {
var txtQuantity = parseFloat($('#EditCPQuantity').val());
//var txtExchangeRate = parseFloat( $('#EditExchangeRtModal').val());
var RatePerTon = parseFloat($('#EditCPRate').val());
//var txtUnitPrice = parseFloat($('#Rate').val());
var txtExchangeRate = '';
var BasicInINR = '';
if (capitalType == 'International') {
//alert('international');
txtExchangeRate = parseFloat($('#EditExchangeRtModal').val());
var Tot = txtQuantity * RatePerTon;
BasicInINR = Tot * txtExchangeRate;
} else {
var Tot = txtQuantity * RatePerTon;
if ($('#txtEditDiscount').val() != '' && $('#txtEditDiscount').val() != '0') {
$('#txtEditAfterDiscount').val(updateDiscountValuesChange(parseFloat(Tot).toFixed(2), $("#EditDiscountType").val(), $('#txtEditDiscount').val()));
}
var discountedValue = parseFloat($('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val()).toFixed(2);
txtExchangeRate = 1;
BasicInINR = Tot * txtExchangeRate - discountedValue;
}
var Freight = parseFloat($('#txtAfterFreightlocedit').val() == '' ? '0.00' : $('#txtAfterFreightlocedit').val()).toFixed(2);
var editCPtotal = parseFloat(BasicInINR) + parseFloat(Freight);
$('#EditCPTotalAmount').val(parseFloat(Tot).toFixed(2));
$('#EditAfterBasicPriceTax').val(Math.round(BasicInINR));
//ExceedBudget($('#CPTotalAmount').val(),$('#CapitalbudAmt').val());
if (ExceedBudget($('#EditAfterBasicPriceTax').val(), $('#EditCapitalbudAmt').val())) {
//Service Tax calculation
$('#EditAfterCgst').val(calculateServiceCGST(editCPtotal, $("#EditCgst").val() == '' ? "0.00" : $('#EditCgst').val()));
$('#EditAfterSgst').val(calculateServiceSGST(editCPtotal, $("#EditSgst").val() == '' ? "0.00" : $('#EditSgst').val()));
$('#EditAfterIgst').val(calculateServiceIGST(editCPtotal, $("#EditIgst").val() == '' ? "0.00" : $('#EditIgst').val()));
var tempEditservicetotalordervaue = (parseFloat($('#EditCPTotalAmount').val()) + parseFloat($('#EditAfterCgst').val()) + parseFloat($('#EditAfterSgst').val()) + parseFloat($('#EditAfterIgst').val()) + parseFloat($('#EditOtherAllowances').val() == '' ? "0.00" : $('#EditOtherAllowances').val()) + parseFloat($('#txtAfterFreightlocedit').val() == '' ? "0.00" : $('#txtAfterFreightlocedit').val())) - parseFloat($('#txtEditAfterDiscount').val() == '' ? "0.00" : $('#txtEditAfterDiscount').val());
//console.log(tempEditservicetotalordervaue);
$('#Editservicetotalordervaue').val(parseFloat(tempEditservicetotalordervaue).toFixed(2));
EditCalculateloadingcharge();
// $('#EditAfterBasicPriceTax').val(Math.round($('#EditCPTotalAmount').val()));
// if($('#EditLandingCharge').val()!='' && $('#EditAfterBasicPriceTax').val()!=''){
// $('#EditAfterLandingCharge').val(calculateLandingCharge($('#EditLandingCharge').val(),$('#EditAfterBasicPriceTax').val()));
// if($('#EditHighseas').val()!='' && $('#EditAfterLandingCharge').val()!=''){
// $('#EditAfterHighseas').val(calculateHighseasCharge($('#EditAfterLandingCharge').val(),$('#EditAfterBasicPriceTax').val(),$('#EditHighseas').val()));
// if($('#EditCustomduty').val()!='' && $('#EditAfterHighseas').val()!=''){
// $('#EditAfterCustomduty').val(calculateCustomdutyCharge($('#EditAfterLandingCharge').val(),$('#EditAfterBasicPriceTax').val(),$('#EditAfterHighseas').val(),$('#EditCustomduty').val()));
// if($('#EditAfterCustomduty').val()!='' && $('#EditExcisedutyTax').val()!=''){
// $('#EditAfterExcisedutyTax').val(calculateExciseCharge($('#EditAfterLandingCharge').val(),$('#EditAfterBasicPriceTax').val(),$('#EditAfterHighseas').val(),$('#EditAfterCustomduty').val(),$('#EditExcisedutyTax').val()));
// if($('#EditAfterExcisedutyTax').val()!='' && $('#EditExcisedutyEDcess').val()!=''){
// $('#EditAfterExcisedutyEDcess').val(calculateExciseEDcessCharge($('#EditAfterExcisedutyTax').val(),$('#EditExcisedutyEDcess').val()));
// if($('#EditAfterExcisedutyTax').val()!='' && $('#EditExcisedutySHcess').val()!=''){
// $('#EditAfterExcisedutySHcess').val(calculateExciseSHcessCharge($('#EditAfterExcisedutyTax').val(),$('#EditExcisedutySHcess').val()));
// if($('#EditAfterExcisedutySHcess').val()!='' && $('#EditCustomEDcess').val()!=''){
// $('#EditAfterCustomEDcess').val(calculateCustomEDcessCharge($('#EditAfterLandingCharge').val(),$('#EditAfterHighseas').val(),$('#EditAfterCustomduty').val(),$('#EditAfterExcisedutyTax').val(),$('#EditAfterExcisedutyEDcess').val(),$('#EditAfterExcisedutySHcess').val(),$('#EditCustomEDcess').val()));
// }
// if($('#EditAfterExcisedutySHcess').val()!='' && $('#EditCustomSHcess').val()!=''){
// $('#EditAfterCustomSHcess').val(calculateCustomSHcessCharge($('#EditAfterLandingCharge').val(),$('#EditAfterHighseas').val(),$('#EditAfterCustomduty').val(),$('#EditAfterExcisedutyTax').val(),$('#EditAfterExcisedutyEDcess').val(),$('#EditAfterExcisedutySHcess').val(),$('#EditCustomSHcess').val()));
// if($('#EditAfterCustomSHcess').val()!='' && $('#EditAdditionalExciseduty').val()!=''){
// $('#EditAfterAdditionalExciseduty').val(calculateAdditionalExciseDutyCharge($('#EditAfterBasicPriceTax').val(),$('#EditAfterLandingCharge').val(),$('#EditAfterHighseas').val(),$('#EditAfterCustomduty').val(),$('#EditAfterExcisedutyTax').val(),$('#EditAfterExcisedutyEDcess').val(),$('#EditAfterExcisedutySHcess').val(),$('#EditAfterCustomEDcess').val(),$('#EditAfterCustomSHcess').val(),$('#EditAdditionalExciseduty').val()));
// $('#EditGrossdutypayable').val(calculateGrossdutypayableCharge($('#EditAfterLandingCharge').val(),$('#EditAfterHighseas').val(),$('#EditAfterCustomduty').val(),$('#EditAfterExcisedutyTax').val(),$('#EditAfterExcisedutyEDcess').val(),$('#EditAfterExcisedutySHcess').val(),$('#EditAfterCustomEDcess').val(),$('#EditAfterCustomSHcess').val(),$('#EditAfterAdditionalExciseduty').val()));
// $('#EditAvailableModvat').val(calculateAvailableModvatCharge($('#EditAfterExcisedutyTax').val(),$('#EditAfterExcisedutyEDcess').val(),$('#EditAfterExcisedutySHcess').val(),$('#EditAfterAdditionalExciseduty').val()));
// $('#EditGrossexpenses').val(calculateGrossexpensesCharge($('#EditGrossdutypayable').val(),$('#EditAvailableModvat').val()));
// if($('#EditPurQuantity').val()!=''){
// $('#Editpurchaserate').val(calculatepurchaserate($('#EditAfterBasicPriceTax').val(),$('#EditPurQuantity').val()));
// $('#EditCustomDutyExpenses').val(calculateCustomDutyExpenses($('#EditGrossexpenses').val(),$('#EditPurQuantity').val()));
// $('#EditRMCIncludingCustomers').val(calculateRMCIncludingCustomers($('#Editpurchaserate').val(),$('#EditCustomDutyExpenses').val()));
// var Rmc = $('#EditRMCIncludingCustomers').val();
// var Quanty =$('#EditCPQuantity').val();
// var BasicAmt = $('#EditCPTotalAmount').val();
// var perKg = parseFloat(BasicAmt).toFixed(2);
// $('#EdittxtTotalOrderValue').val(perKg);
// }
// }
// }
// }
// else{
// //alert('Please Enter Excise duty S & H cess');
// }
// }
// else{
// //alert('Please Enter Excise Duty ED_cess');
// }
// }
// else{
// //alert('Please Enter Excise Duty');
// }
// }
// else{
// //alert('Please Enter Custom Duty');
// }
// }
// }
// else{
// //alert('Please Enter Landing Charge ')
// }
// calculateTotalValue();
// var res = ExceedBudget($('#TotalOrderValue').val(), $('#CapitalbudAmt').val());
//if(!res)
// {
// $('#CPRate').focus();
// return false;
// }
}
} else {
$('CPRate').focus();
}
// }
// else{
// clearTaxField();
// }
}
/* This function used to check quantity exceeding or not while Editing*/
// function EditExceedQuantityCheck()
// {
// var EnterQuantity = $("#EditCPQuantity").val()== '' ? "0.00" : parseFloat($("#EditCPQuantity").val());
// var ReqQuantity = parseFloat(RequistQuantity);
// //alert(ReqQuantity);
// if(EnterQuantity > ReqQuantity)
// {
// alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
// $('#EditCPQuantity').focus();
// return false;
// }
// else {
// return true;
// }
// }
/**
* This function is used for Edit Capital
*/
$('.EditCapital').click(function () {
//alert('EDIT CAPITAL');
tinyMCE.triggerSave();
if (validateEditCapitalTax() && validateEditExceedLimit()) {
//alert('EDIT');
var tr = document.getElementById(userid);
var cellval = tr.cells;
var Reqnumber = $('#EditReqnumber').val();
var departmentName = $('#EditCapitalDepartmentName').val();
var AvilBudget = $('#EditCapitalbudAmt').val();
var costCode = $('#EditCostCenter').val();
var servicedescription = $('#Edittxtservicedescription').val();
var materialCode = $('#EditMaterialCode').val();
var materialName = $("#EditCapitalItemName").val();
var uom = $("#EditCPUOM").val();
var editPer = '';
if ($("#EditAmendPer").val().trim() == '') {
editPer = $("#EditCPUOM").val();
} else {
editPer = $("#EditAmendPer").val();
}
var exchangeRate = $("#EditExchangeRtModal").val();
var quantity = $("#EditCPQuantity").val();
var convertRate = $("#EditCPRate").val();
var itemRate = parseFloat(convertRate).toFixed(2);
var basicval = $("#EditCPTotalAmount").val();
var CGST = $("#EditCgst").val();
var SGST = $("#EditSgst").val();
var IGST = $("#EditIgst").val();
var AfterCGST = $("#EditAfterCgst").val();
var AfterSGST = $("#EditAfterSgst").val();
var AfterIGST = $("#EditAfterIgst").val();
var otherallowance = $("#EditOtherAllowances").val();
var FreightTypeloc = $('#drpFreighteditloc').val();
var FreightRateloc = $('#txtFreightlocedit').val();
var FreightRateAmountloc = $('#txtAfterFreightlocedit').val();
var Nooftriploc = $('#NOOfTripslocedit').val();
var totalservicevalue = $("#Editservicetotalordervaue").val();
//console.log(totalservicevalue);
//var totalservicevalue = $("#EditCPTotalAmount").val();
var Totaltaxamount = (parseFloat(AfterCGST) + parseFloat(AfterSGST) + parseFloat(AfterIGST) + parseFloat(otherallowance));
//alert(totalservicevalue+"-"+Total);
var TotalTaxValue = EditcalculateTaxValue();
//alert(Totaltaxamount+"--"+TotalTaxValue);
var landingCharge = $('#EditAfterLandingCharge').val();
var CustomDuty = $('#EditAfterCustomduty').val();
var CustomEDCess = $('#EditAfterCustomEDcess').val();
var CustomSHCess = $('#EditAfterCustomSHcess').val();
var GrossDutyPayable = $('#EditGrossdutypayable').val();
var PurQuantity = $('#EditPurQuantity').val();
var CustomDutyExpenses = $('#EditCustomDutyExpenses').val();
var TotalOrderValuePerkg = $("#EdittxtTotalOrderValue").val();
/*get % values */
var beforeLanding = $('#EditLandingCharge').val();
var beforeCustomDuty = $('#EditCustomduty').val();
var beforeCustomEDCess = $('#EditCustomEDcess').val();
var beforeCustomSHCess = $('#EditCustomSHcess').val();
var Assessable = $("#EditAfterAssessable").val();
var SubTotal = $("#EditSubtotal").val();
var IgstInt = $("#EditIgstInt").val();
var AfterIgstInt = $("#EditAfterIgstInt").val();
var DutyImpact = $("#EditDutyImpact").val();
var ClearingCharges = $('#EditClearingCharges').val();
var Nett = $('#EditNett').val();
var PurQuantity = $('#EditPurQuantity').val();
var basicvalInINR = $('#EditAfterBasicPriceTax').val();
var DisType = $("#EditDiscountType").val();
var DisVal = $("#txtEditDiscount").val();
var AfterDisVal = $("#txtEditAfterDiscount").val();
var EditCapitalDescription = $("#EditItemDescription").val();
var FreightType = $("#drpamendFreight").val();
var FreightVal = $("#AmendtxtFreight").val();
var AfterFreightVal = $("#AmendtxtAfterFreight").val();
var NoOfTrip = $("#AmendNOOfTrips").val();
$('#CapitalItemDescrition' + userid).val(EditCapitalDescription);
$('#Reqnumber' + userid).val(Reqnumber);
$('#departmentName' + userid).val(departmentName);
$('#CPCostCode' + userid).val(costCode);
$('#AvilBudget' + userid).val(AvilBudget);
$('#echangeRate' + userid).val(exchangeRate);
$('#materialCode' + userid).val(materialCode);
$('#materialName' + userid).val(materialName);
$('#uom' + userid).val(uom);
$('#per' + userid).val(editPer);
$('#quantity' + userid).val(quantity);
$('#rateInUs' + userid).val(itemRate);
$('#basicval' + userid).val(basicval);
RequistQuantity = $('#quantity' + userid).val();
$('#SGST' + userid).val(SGST);
$('#CGST' + userid).val(CGST);
$('#IGST' + userid).val(IGST);
$('#afterSGST' + userid).val(AfterSGST);
$('#afterCGST' + userid).val(AfterCGST);
$('#afterIGST' + userid).val(AfterIGST);
$('#otherallowance' + userid).val(otherallowance);
$('#totalservicevalue' + userid).val(totalservicevalue);
// var a =parseFloat($('#totalservicevalue'+userid).val());
// console.log(a);
$('#ServiceMaterialDescription' + userid).val(servicedescription);
$('#Ftype' + userid).val(FreightTypeloc);
$('#NoTrip' + userid).val(Nooftriploc);
$('#Fvalue' + userid).val(FreightRateloc);
$('#Afvalue' + userid).val(FreightRateAmountloc);
$('#landingCharge' + userid).val(landingCharge);
$('#CustomDuty' + userid).val(CustomDuty);
$('#CustomEDCess' + userid).val(CustomEDCess);
$('#CustomSHCess' + userid).val(CustomSHCess);
$('#GrossDutyPayable' + userid).val(GrossDutyPayable);
$('#CustomDutyExpenses' + userid).val(CustomDutyExpenses);
$('#basicvalInINR' + userid).val(basicvalInINR);
/* get % value */
$('#beforeLanding' + userid).val(beforeLanding);
$('#beforeCustomDuty' + userid).val(beforeCustomDuty);
$('#beforeCustomEDCess' + userid).val(beforeCustomEDCess);
$('#beforeCustomSHCess' + userid).val(beforeCustomSHCess);
$('#AssessableValue' + userid).val(Assessable);
$('#SubTotal' + userid).val(SubTotal);
$('#IGSTInt' + userid).val(IgstInt);
$('#AfterIGSTInt' + userid).val(AfterIgstInt);
$('#DutyImpact' + userid).val(DutyImpact);
$('#NetValue' + userid).val(Nett);
$('#ClearingCharge' + userid).val(ClearingCharges);
$('#PurQuantity' + userid).val(PurQuantity);
$('#PerKgExpense' + userid).val(TotalOrderValuePerkg);
$('#DisType' + userid).val(DisType);
$('#FreightType' + userid).val(FreightType);
$('#FreightVal' + userid).val(FreightVal);
$('#NoOfTrip' + userid).val(NoOfTrip);
$('#AfterFreightVal' + userid).val(AfterFreightVal);
$('#DisVal' + userid).val(DisVal);
$('#AfterDisVal' + userid).val(AfterDisVal);
cellval[2].innerHTML = materialName;
//alert(materialName);
cellval[3].innerHTML = parseFloat(quantity).toFixed(2);
//alert(quantity);
cellval[4].innerHTML = uom;
//alert(uom);
cellval[5].innerHTML = parseFloat(itemRate).toFixed(2);
//alert(itemRate);
cellval[6].innerHTML = parseFloat(basicval).toFixed(2);
//alert(basicval);
cellval[7].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
//alert(TotalTaxValue);
cellval[8].innerHTML = parseFloat(totalservicevalue).toFixed(2);
//alert(basicval);
populateValueMainFormForEditCapitalTax();
$('#EDITCAPITAL').modal('hide');
}
});
function validateEditCapitalTax() {
if ($('#EditReqnumber').val() == "0") {
alert('Please select the Requisition Number');
$('#EditReqnumber').focus();
return false;
} else if ($('#EditCostCenter').val() == "0") {
alert('Please select the Cost center');
$('#EditCostCenter').focus();
return false;
} else if ($('#EditMaterialCode').val() == "0") {
alert('Please select the Material Code');
$('#EditMaterialCode').focus();
return false;
} else if ($('#EditCPQuantity').val() == '') {
alert('Please Enter the Quantity value');
$('#EditCPQuantity').focus();
return false;
} else if ($('#EditCPQuantity').val() == "0") {
alert('Please Enter the Valid Quantity value');
$('#EditCPQuantity').focus();
return false;
} else if ($('#EditCPRate').val() == '') {
alert('Please Enter the Rate of the Item');
$('#EditCPRate').focus();
return false;
} else if ($('#EditCPRate').val() == "0") {
alert('Please Enter the Valid Rate of the Item');
$('#EditCPRate').focus();
return false;
} else {
return true;
}
}
/* calculate tax value*/
function EditcalculateTaxValue() {
var CGSTTaxAmount = $('#EditAfterCgst').val() == '' ? '0.00' : $('#EditAfterCgst').val();
var SGSTTaxAmount = $('#EditAfterSgst').val() == '' ? '0.00' : $('#EditAfterSgst').val();
var IGSTTaxAmount = $('#EditAfterIgst').val() == '' ? '0.00' : $('#EditAfterIgst').val();
var otherallowanceAmount = $('#EditOtherAllowances').val() == '' ? '0.00' : $('#EditOtherAllowances').val();
//alert(CGSTTaxAmount+""+SGSTTaxAmount+""+IGSTTaxAmount+otherallowanceAmount)
var landingCharge = $('#EditAfterLandingCharge').val() == '' ? '0.00' : $('#EditAfterLandingCharge').val();
var HighSeasSalesCharge = $('#EditAfterHighseas').val() == '' ? '0.00' : $('#EditAfterHighseas').val();
var CustomDuty = $('#EditAfterCustomduty').val() == '' ? '0.00' : $('#EditAfterCustomduty').val();
var ExciseDuty = $('#EditAfterExcisedutyTax').val() == '' ? '0.00' : $('#EditAfterExcisedutyTax').val();
var ExciseDutyEDCess = $('#EditAfterExcisedutyEDcess').val() == '' ? '0.00' : $('#EditAfterExcisedutyEDcess').val();
var ExciseDutySHCess = $('#EditAfterExcisedutySHcess').val() == '' ? '0.00' : $('#EditAfterExcisedutySHcess').val();
var CustomEDCess = $('#EditAfterCustomEDcess').val() == '' ? '0.00' : $('#EditAfterCustomEDcess').val();
var CustomSHCess = $('#EditAfterCustomSHcess').val() == '' ? '0.00' : $('#EditAfterCustomSHcess').val();
var AdditionalExciseDuty = $('#EditAfterAdditionalExciseduty').val() == '' ? '0.00' : $('#EditAfterAdditionalExciseduty').val();
var GrossDutyPayable = $('#EditGrossdutypayable').val() == '' ? '0.00' : $('#EditGrossdutypayable').val();
var AvailableModvat = $('#EditAvailableModvat').val() == '' ? '0.00' : $('#EditAvailableModvat').val();
var GrossExpensesDuetoCustom = $('#EditGrossexpenses').val() == '' ? '0.00' : $('#EditGrossexpenses').val();
var purchaseRate = $('#Editpurchaserate').val() == '' ? '0.00' : $('#Editpurchaserate').val();
var CustomDutyExpenses = $('#EditCustomDutyExpenses').val() == '' ? '0.00' : $('#EditCustomDutyExpenses').val();
var RMCIncludingCustomers = $('#EditRMCIncludingCustomers').val() == '' ? '0.00' : $('#EditRMCIncludingCustomers').val();
var totTaxvalue = (parseFloat(CGSTTaxAmount) + parseFloat(SGSTTaxAmount) + parseFloat(IGSTTaxAmount));
//+parseFloat(landingCharge)+parseFloat(HighSeasSalesCharge)+parseFloat(CustomDuty)+parseFloat(ExciseDuty)+parseFloat(ExciseDutyEDCess)+parseFloat(ExciseDutySHCess)+parseFloat(CustomEDCess)+parseFloat(CustomSHCess)+parseFloat(AdditionalExciseDuty)+parseFloat(GrossDutyPayable)+parseFloat(AvailableModvat)+parseFloat(GrossExpensesDuetoCustom)+parseFloat(purchaseRate)+parseFloat(CustomDutyExpenses)+parseFloat(RMCIncludingCustomers)
var totTax = parseFloat(totTaxvalue).toFixed(2);
// alert("TAx from EditcalculateTaxValue function "+totTax );
return totTax;
}
/* used to validateExceedLimit for edit*/
function validateEditExceedLimit() {
var avalbudAmt = parseFloat($('#EditCapitalbudAmt').val());
var basicAmountRate = parseFloat($('#EditCPTotalAmount').val());
var totalAmount = parseFloat($('#EdittxtTotalOrderValue').val());
// if(basicAmountRate > avalbudAmt)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#EditCPRate').focus();
// return false;
// }
// else
// {
return true;
//}
}
/**
* This function is used to calculate the total amounts after Edit row
*/
function populateValueMainFormForEditCapitalTax() {
var rows = document.getElementById('serviceTax').rows.length;
var TotalOrderValueSummary = 0;
var basicfordometic = 0;
var qty = 0;
var rateperqty = 0;
var TotalCGSTTax = 0;
var TotalSGSTTax = 0;
var TotalIGSTTax = 0;
var TotalDiscount = 0;
//alert('Initial' + TotalDiscount);
var Totalotherallowance = 0;
var TotaFreight = 0;
var TotLanding = 0;
var TotCustom = 0;
var TotCustomED = 0;
var TotCustomSH = 0;
var TotGrossduty = 0;
var Totalfrieght = 0;
//alert('INITIAL'+ Totalfrieght);
var TotGrossexpense = 0;
var CapitalToatlOrder = 0;
var TotalAssessable = 0;
var TotalSubtotal = 0;
var TotalIgst = 0;
for (var i = 1; i < rows; i++) {
var discountedRateValue = $('#AfterDisVal' + i).val() == '' ? '0.00' : $('#AfterDisVal' + i).val();
//alert('Current Item'+ discountedRateValue);
var TotalOrderValueSummaryI = $('#totalservicevalue' + i).val() == '' ? '0.00' : $('#totalservicevalue' + i).val(); //FOr Domestic total value
//console.log(TotalOrderValueSummaryI);
TotalOrderValueSummaryI = TotalOrderValueSummaryI; //-discountedRateValue;
var TotalCGSTTaxI = $('#afterCGST' + i).val() == '' ? '0.00' : $('#afterCGST' + i).val();
var TotalSGSTTaxI = $('#afterSGST' + i).val() == '' ? '0.00' : $('#afterSGST' + i).val();
var TotalIGSTTaxI = $('#afterIGST' + i).val() == '' ? '0.00' : $('#afterIGST' + i).val();
var TotalFreightt = $('#Afvalue' + i).val() == '' ? '0.00' : $('#Afvalue' + i).val();
//console.log(TotalFreightt);
//var tr= document.getElementById(serviceTax);
//var cellval = tr.cells;
qty = $('#quantity' + i).val();
rateperqty = $('#itemRate' + i).val();
basicfordometic = basicfordometic + (qty * rateperqty);
var TotalotherallowanceI = $('#otherallowance' + i).val() == '' ? '0.00' : $('#otherallowance' + i).val();
var TotLandingI = $('#landingCharge' + i).val() == '' ? '0.00' : $('#landingCharge' + i).val();
var TotCustomI = $('#CustomDuty' + i).val() == '' ? '0.00' : $('#CustomDuty' + i).val();
var TotCustomEDI = $('#CustomEDCess' + i).val() == '' ? '0.00' : $('#CustomEDCess' + i).val();
var TotCustomSHI = $('#CustomSHCess' + i).val() == '' ? '0.00' : $('#CustomSHCess' + i).val();
var TotGrossdutyI = $('#GrossDutyPayable' + i).val() == '' ? '0.00' : $('#GrossDutyPayable' + i).val();
var totoalfrieghti = $('#AfterFreightVal' + i).val() == '' ? '0.00' : $('#AfterFreightVal' + i).val();
//alert('CURRENT'+totoalfrieghti);
var TotGrossexpenseI = $('#GrossExpensesDuetoCustom' + i).val() == '' ? '0.00' : $('#GrossExpensesDuetoCustom' + i).val();
var CapitalToatlOrderI = $('#basicval' + i).val() == '' ? '0.00' : $('#basicval' + i).val(); //for International total value
var Assessable = $('#AssessableValue' + i).val() == '' ? '0.00' : $('#AssessableValue' + i).val();
var Subtotal = $('#SubTotal' + i).val() == '' ? '0.00' : $('#SubTotal' + i).val();
var IgstInt = $('#AfterIGSTInt' + i).val() == '' ? '0.00' : $('#AfterIGSTInt' + i).val();
TotaFreight = parseFloat(TotaFreight) + parseFloat(TotalFreightt);
CapitalToatlOrderI = CapitalToatlOrderI - discountedRateValue;
TotalCGSTTax = parseFloat(TotalCGSTTax) + parseFloat(TotalCGSTTaxI);
TotalSGSTTax = parseFloat(TotalSGSTTax) + parseFloat(TotalSGSTTaxI);
TotalIGSTTax = parseFloat(TotalIGSTTax) + parseFloat(TotalIGSTTaxI);
TotalDiscount = parseFloat(TotalDiscount) + parseFloat(discountedRateValue);
Totalotherallowance = parseFloat(Totalotherallowance) + parseFloat(TotalotherallowanceI);
Totalfrieght = Totalfrieght + totoalfrieghti;
// TotaFreight=parseFloat(TotaFreight)+parseFloat(TotalFreightt);
// console.log(TotaFreight);
//alert('After Add' + TotalDiscount);
//alert('AFTER ADD'+ Totalfrieght);
TotalAssessable = parseFloat(TotalAssessable) + parseFloat(Assessable);
TotalSubtotal = parseFloat(TotalSubtotal) + parseFloat(Subtotal);
TotalIgst = parseFloat(TotalIgst) + parseFloat(IgstInt);
TotLanding = parseFloat(TotLanding) + parseFloat(TotLandingI);
TotCustom = parseFloat(TotCustom) + parseFloat(TotCustomI);
TotCustomED = parseFloat(TotCustomED) + parseFloat(TotCustomEDI);
TotCustomSH = parseFloat(TotCustomSH) + parseFloat(TotCustomSHI);
TotGrossduty = parseFloat(TotGrossduty) + parseFloat(TotGrossdutyI);
TotalOrderValueSummary = parseFloat(TotalOrderValueSummary) + parseFloat(TotalOrderValueSummaryI);
CapitalToatlOrder = parseFloat(CapitalToatlOrder) + parseFloat(CapitalToatlOrderI);
}
$('#txtTotCgst').val((parseFloat(TotalCGSTTax)).toFixed(2));
$('#txtTotSgst').val((parseFloat(TotalSGSTTax)).toFixed(2));
$('#txtTotIgst').val((parseFloat(TotalIGSTTax)).toFixed(2));
$('#TotalOtherAllowances').val((parseFloat(Totalotherallowance)).toFixed(2));
$('#txtTotalDiscount').val((parseFloat(TotalDiscount)).toFixed(2));
$('#TotalFreight').val(parseFloat(TotaFreight).toFixed(2));
$('#txttotalfrieght').val((parseFloat(Totalfrieght)).toFixed(2));
$('#txttotallanding').val((parseFloat(TotLanding)).toFixed(2));
$('#txttotalcustom').val((parseFloat(TotCustom)).toFixed(2));
$('#txttotalcustomED').val((parseFloat(TotCustomED)).toFixed(2));
$('#txttotalcustomSH').val((parseFloat(TotCustomSH)).toFixed(2));
$('#txttotalgrossduty').val((parseFloat(TotGrossduty)).toFixed(2));
$('#txttotalAssessable').val((parseFloat(TotalAssessable)).toFixed(2));
$('#txttotalSubtotal').val((parseFloat(TotalSubtotal)).toFixed(2));
$('#txttotalIgst').val((parseFloat(TotalIgst)).toFixed(2));
$('#CapitalToatlOrder').val((parseFloat(CapitalToatlOrder)).toFixed(2));
$('#Totalservicesummary').val((parseFloat(TotalOrderValueSummary)).toFixed(2));
$('#txtTotalBasic').val((parseFloat(basicfordometic)).toFixed(2));
basicfordometic = 0;
}
var DisplayCurrencySymbol = '';
var ViewCurrencySymbol = '';
var currency = <?php echo json_encode($Currency, JSON_PRETTY_PRINT) ?>;
$.each(currency, function (idx, obj) {
if (obj.Currency_Code === $("#currencytype").val()) {
$("#CurrencySymbol").val(obj.FontCode2000);
DisplayCurrencySymbol = obj.FontCode2000;
ViewCurrencySymbol = obj.FontCode2000;
var DisplayUOM = $('#uom').val();
$('#CurrencySymbol').html('Exchange Rate In' + " " + obj.FontCode2000);
$('#RateIn').html('Rate(in' + " " + obj.FontCode2000 + '/' + DisplayUOM + ')');
$('#EditRateIn').html('Rate(in' + " " + obj.FontCode2000 + '/' + DisplayUOM + ')');
$('#TotalAmount').html('Basic Value in' + " " + DisplayCurrencySymbol);
$('#EditTotalAmount').html('Basic Value in' + " " + DisplayCurrencySymbol);
//$('#ViewTotalAmount').html('Basic Value in' + " "+ViewCurrencySymbol);
// $('#ViewRateIn').html('Rate(in' + " "+ViewCurrencySymbol + '/'+DisplayUOM+')');
$('#lbl_international').html('Total Order Value (' + "" + DisplayCurrencySymbol + ')');
}
});
$('#currencytype').change(function () {
var SelectCurrency = $('#currencytype').val();
$.each(currency, function (idx, obj) {
if (obj.Currency_Code === SelectCurrency) {
$("#CurrencySymbol").val(obj.FontCode2000);
DisplayCurrencySymbol = obj.FontCode2000;
$('#CurrencySymbol').html('Exchange Rate In' + " " + obj.FontCode2000);
$('#RateIn').html('Rate(in' + " " + obj.FontCode2000 + '/Ton)');
$('#EditRateIn').html('Rate(in' + " " + obj.FontCode2000 + '/Ton)');
$('#TotalAmount').html('Basic Value in' + " " + DisplayCurrencySymbol);
$('#EditTotalAmount').html('Basic Value in' + " " + DisplayCurrencySymbol);
}
});
});
var PaymentDate = '<?php echo $PaymentDays; ?>';
$('#Before').change(function () {
PaymentDate = $('#Before').val();
});
$('#After').change(function () {
PaymentDate = $('#After').val();
});
$("#PaymentMethod").change(function () {
if ($('#PaymentMethod').val().trim() == 'PT08') {
$('#otheroptiondiv').show();
} else {
$('#otheroptiondiv').hide();
}
});
$('#drpamendFreight').change(function () {
var FreightType = $('#drpamendFreight').val();
if (FreightType == "PER TRIP") {
$('#AmendTripsValue').show();
$(this).parent().removeClass('col-md-3').addClass('col-md-2');
$('#AmendNOOfTrips').parent().removeClass('col-md-3').addClass('col-md-2');
$('#AmendtxtFreight').parent().removeClass('col-md-3').addClass('col-md-2');
$('#AmendtxtAfterFreight').parent().removeClass('col-md-3').addClass('col-md-2');
} else {
$('#AmendTripsValue').hide();
$(this).parent().removeClass('col-md-2').addClass('col-md-3');
$('#AmendNOOfTrips').parent().removeClass('col-md-2').addClass('col-md-3');
$('#AmendtxtFreight').parent().removeClass('col-md-2').addClass('col-md-3');
$('#AmendtxtAfterFreight').parent().removeClass('col-md-2').addClass('col-md-3');
}
});
$('#EditDiscountType').change(function () {
if ($('#EditCPRate').val() != '') {
selValue = $("#EditDiscountType").val();
$('#txtEditDiscount').val('');
$('#txtEditAfterDiscount').val('');
if (selValue == '<?php echo NILTYPE; ?>') {
$('#txtEditDiscount').attr('readonly', 'true');
$('#txtEditDiscount').val('0.00');
$('#txtEditAfterDiscount').val('0.00');
} else {
$('#txtEditDiscount').removeAttr('readonly', 'true');
$('#txtEditDiscount').val('');
$('#txtEditAfterDiscount').val('');
}
} else {
alert('Please Select MaterialCode and Rate Field Value');
$('#EditDiscountType').val("0");
$('#EditCPRate').focus();
}
EditRatechange();
});
/*
* To calcuate the Discount */
function calculateDiscount(isEdit) {
if (isEdit == '0') {
if ($('#CPRate').val() == '') {
alert('Please Enter the Rate value');
$('#CPRate').focus();
$('#txtDiscount').val('');
return false;
}
if ($('#CPRate').val() != '') {
var basicValue = parseFloat($('#CPTotalAmount').val());
var DiscountType = $("#DiscountType").val();
if (DiscountType == "0") {
alert('Please Select the discount Type');
$('#txtDiscount').val('');
$("#DiscountType").focus();
} else if ($('#txtDiscount').val() != '' && $('#txtDiscount').val() != '0') {
var AfterDiscount = 0.0;
var Discountval = parseFloat($('#txtDiscount').val());
if (DiscountType == '<?php echo PERCENTAGE; ?>') {
AfterDiscount = <?php echo DIS_PERCENTAGE; ?>;
} else if (DiscountType == '<?php echo NILTYPE; ?>') {
AfterDiscount = "0.00";
} else {
AfterDiscount = <?php echo DIS_LUMPSUM; ?>;
}
var discount = parseFloat(AfterDiscount).toFixed(2);
$('#txtAfterDiscount').val(discount);
} else {
$('#txtAfterDiscount').val("0.00");
}
Ratechange();
}
} else {
if ($('#EditCPRate').val() != '') {
var basicValue = parseFloat($('#EditCPTotalAmount').val());
var DiscountType = $("#EditDiscountType").val();
if (DiscountType == "0") {
alert('Please Select the discount Type');
$('#txtEditDiscount').val('');
$("#EditDiscountType").focus();
} else if ($('#txtEditDiscount').val() != '' && $('#txtEditDiscount').val() != '0') {
var AfterDiscount = 0.0;
var Discountval = parseFloat($('#txtEditDiscount').val());
if (DiscountType == '<?php echo PERCENTAGE; ?>') {
AfterDiscount = <?php echo DIS_PERCENTAGE; ?>;
} else if (DiscountType == '<?php echo NILTYPE; ?>') {
AfterDiscount = "0.00";
} else {
AfterDiscount = <?php echo DIS_LUMPSUM; ?>;
}
var discount = parseFloat(AfterDiscount).toFixed(2);
$('#txtEditAfterDiscount').val(discount);
} else {
$('#txtEditAfterDiscount').val("0.00");
}
EditRatechange();
}
}
}
function updateDiscountValuesChange(totAmt, disType, disAmt) {
var basicValue = totAmt;
var DiscountType = disType;
var AfterDiscount = 0.0;
var Discountval = parseFloat(disAmt);
if (DiscountType == '<?php echo PERCENTAGE; ?>') {
AfterDiscount = <?php echo DIS_PERCENTAGE; ?>;
} else if (DiscountType == '<?php echo NILTYPE; ?>') {
AfterDiscount = "0.00";
} else {
AfterDiscount = <?php echo DIS_LUMPSUM; ?>;
}
var discount = parseFloat(AfterDiscount).toFixed(2);
return discount;
}
function calculateFreight(isEdit) { //alert();
if (isEdit == '0') {
if ($('#AfterBasicPriceTax').val() == '') {
alert('Please Enter the Rate value');
$('#CPRate').focus();
$('#txtFreight').val('');
return false;
} else {
var basicValue = parseFloat($('#AfterBasicPriceTax').val());
var FreightType = $("#drpFreight").val();
if (FreightType == "0") {
alert('Please select Freight Type');
$('#txtFreight').val('');
$("#drpFreight").focus();
} else if ($('#txtFreight').val() != "0" && $('#txtFreight').val() != '') {
var FreightValue = parseFloat($('#txtFreight').val());
var Quantity = parseFloat($('#CPQuantity').val());
var AfterFreight = 0.0;
if (FreightType == '<?php echo PERCENTAGE; ?>') {
AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
} else if (FreightType == '<?php echo 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 ($('#NOOfTrips').val() == '') {
alert('Please Enter No of Trip');
$("#NOOfTrips").focus();
$('#txtFreight').val(0)
AfterFreight = 0;
$('#txtAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#NOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#txtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#txtAfterFreight').val(AfterFreightval);
} else {
$('#txtAfterFreight').val("0.00");
}
}
} else if (isEdit == '2') {
if ($('#ViewAfterBasicPriceTax').val() == '') {
alert('Please Enter the Rate value');
$('#ViewCPRate').focus();
$('#txtViewFreight').val('');
return false;
} else {
var basicValue = parseFloat($('#ViewAfterBasicPriceTax').val());
var FreightType = $("#drpViewFreight").val();
if (FreightType == "0") {
alert('Please select Freight Type');
$('#txtViewFreight').val('');
$("#drpViewFreight").focus();
} else if ($('#txtViewFreight').val() != "0" && $('#txtViewFreight').val() != '') {
var FreightValue = parseFloat($('#txtViewFreight').val());
var Quantity = parseFloat($('#ViewCPQuantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
if (FreightType == '<?php echo PERCENTAGE; ?>') {
AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
} else if (FreightType == '<?php echo 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();
$('#txtViewFreight').val(0)
AfterFreight = 0;
$('#txtViewAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#ViewNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#txtViewFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#txtViewAfterFreight').val(AfterFreightval);
} else {
$('#txtViewAfterFreight').val("0.00");
}
}
} else if (isEdit == '3') {
if ($('#EditAfterBasicPriceTax').val() != '') {
var basicValue = parseFloat($('#EditAfterBasicPriceTax').val());
var FreightType = $("#drpamendFreight").val();
if ($('#AmendtxtFreight').val() != "0" && $('#AmendtxtFreight').val() != '') {
var FreightValue = parseFloat($('#AmendtxtFreight').val());
var Quantity = parseFloat($('#EditCPQuantity').val());
var AfterFreight = 0.0;
if (FreightType == '<?php echo PERCENTAGE; ?>') {
AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
} else if (FreightType == '<?php echo NILTYPE; ?>') {
AfterFreight = 0.0;
} else if (FreightType == '<?php echo LUMPSUM; ?>') {
AfterFreight = <?php echo FREIGHT_LUMPSUM; ?>;
} else if (FreightType == '<?php echo PERUOM; ?>') {
AfterFreight = <?php echo FREIGHT_PERUOM; ?>;
} else if (FreightType == '<?php echo PERTRIP; ?>') {
if ($('#AmendNOOfTrips').val() == '') {
alert('Please Enter No of Trip');
$("#AmendNOOfTrips").focus();
$('#AmendtxtFreight').val(0)
AfterFreight = 0;
$('#AmendtxtAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#AmendNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#AmendtxtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#AmendtxtAfterFreight').val(AfterFreightval);
} else {
$('#AmendtxtAfterFreight').val("0.00");
}
}
} else if (isEdit == '4') {
if ($('#EditAfterBasicPriceTax').val() != '') {
var basicValue = parseFloat($('#EditAfterBasicPriceTax').val());
var FreightType = $("#drpEditFreight").val();
if ($('#txtEditFreight').val() != "0" && $('#txtEditFreight').val() != '') {
var FreightValue = parseFloat($('#txtEditFreight').val());
var Quantity = parseFloat($('#EditCPQuantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
if (FreightType == '<?php echo PERCENTAGE; ?>') {
AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
} else if (FreightType == '<?php echo 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();
$('#txtEditFreight').val(0)
AfterFreight = 0;
$('#txtEditAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#EditNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#txtEditFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#txtEditAfterFreight').val(AfterFreightval);
} else {
$('#txtEditAfterFreight').val("0.00");
}
}
} else {
if ($('#EditAfterBasicPriceTax').val() == '') {
alert('Please Enter the Rate value');
$('#EditCPRate').focus();
$('#txtEditFreight').val('');
return false;
} else {
var basicValue = parseFloat($('#EditAfterBasicPriceTax').val());
var FreightType = $("#drpEditFreight").val();
if (FreightType == "0") {
alert('Please select Freight Type');
$('#txtEditFreight').val('');
$("#drpEditFreight").focus();
} else if ($('#txtEditFreight').val() != "0" && $('#txtEditFreight').val() != '') {
var FreightValue = parseFloat($('#txtEditFreight').val());
var Quantity = parseFloat($('#EditCPQuantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
if (FreightType == '<?php echo PERCENTAGE; ?>') {
AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
} else if (FreightType == '<?php echo 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();
$('#txtEditFreight').val(0)
AfterFreight = 0;
$('#txtEditAfterFreight').val("0.00");
return false;
} else {
var noOftrip = $("#EditNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
} else {
AfterFreight = $("#txtEditFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#txtEditAfterFreight').val(AfterFreightval);
} else {
$('#txtEditAfterFreight').val("0.00");
}
}
}
}
$('#drpFreighteditloc').change(function () {
var FreightType = $("#drpFreighteditloc").val();
if (FreightType == '<?php echo PERTRIP; ?>') {
$('#TripsValuelocedit').show();
$(this).parent().removeClass('col-md-3').addClass('col-md-2');
$('#NOOfTripslocedit').parent().removeClass('col-md-3').addClass('col-md-2');
$('#txtFreightlocedit').parent().removeClass('col-md-3').addClass('col-md-2');
$('#txtAfterFreightlocedit').parent().removeClass('col-md-3').addClass('col-md-2');
} else {
$('#TripsValuelocedit').hide();
$(this).parent().removeClass('col-md-2').addClass('col-md-3');
$('#NOOfTripslocedit').parent().removeClass('col-md-2').addClass('col-md-3');
$('#txtFreightlocedit').parent().removeClass('col-md-2').addClass('col-md-3');
$('#txtAfterFreightlocedit').parent().removeClass('col-md-2').addClass('col-md-3');
}
if ($('#EditCPRate').val() != '' && $('#EditMaterialCode').val() != "0") {
selValue = $("#drpFreighteditloc").val();
$('#txtFreightlocedit').val('');
$('#txtAfterFreightlocedit').val('');
var PackagingCalculation = '';
if (selValue == '<?php echo NILTYPE; ?>') {
$('#txtFreightlocedit').attr('readonly', 'true');
$('#txtFreightlocedit').val('0.00');
}
if (selValue == '<?php echo PERCENTAGE; ?>') {
var PackagingCalculation = '';
var secondBackdrop = $('<div class="modal-backdrop fade show"></div>');
secondBackdrop.css('z-index', 1089).addClass('stacked-backdrop');
// Insert the second backdrop before the modal is shown
$('body').append(secondBackdrop);
$('#editpackagingcalmodel').modal('show');
$('#editpackagingcalmodel').on('hidden.bs.modal', function () {
// Remove the custom backdrop class when second modal is hidden
$('.stacked-backdrop').remove();
});
PackagingCalculation = $("input:radio[name='editoptPackaging']:checked").val();
} else {
// $('#txtFreightlocedit').removeAttr( 'readonly','true' );
$('#txtFreightlocedit').val('');
calculateFreightloceditper()
}
} else {
alert('Please Select MaterialCode and Rate Field Value');
$('#drpFreighteditloc').val("0");
$('#Rate').focus();
}
});
function calculateFreightloceditper() {
var Calculation = document.querySelector('input[name = "editoptPackaging"]:checked').value;
var FreightType = $("#drpFreighteditloc").val();
$('#editpackagingcalmodel').modal('hide');
if (FreightType == '<?php echo PERCENTAGE; ?>') {
$('#txtAfterFreightlocedit').val('');
if (Calculation == 0) {
var basicValue = $('#EditCPTotalAmount').val() == '' ? '0.00' : $('#EditCPTotalAmount').val();
var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val();
var AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
var txtAfterFreightloc = parseFloat(AfterFreight).toFixed(2);
$('#txtAfterFreightlocedit').val(txtAfterFreightloc);
} else if (Calculation == 1) {
var basicinrValue = $('#EditCPTotalAmount').val() == '' ? '0.00' : $('#EditCPTotalAmount').val();
var discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val();
var basicValue = basicinrValue - discount;
var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val();
var AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
var txtAfterFreightloc = parseFloat(AfterFreight).toFixed(2);
$('#txtAfterFreightlocedit').val(txtAfterFreightloc);
}
} else if (FreightType == '<?php echo NILTYPE; ?>') {
$('#txtAfterFreightlocedit').val('');
AfterFreight = 0.00;
$('#txtFreightlocedit').val('');
var txtAfterFreightloc = parseFloat(AfterFreight).toFixed(2);
$('#txtAfterFreightlocedit').val(txtAfterFreightloc);
document.getElementById("txtAfterFreightlocedit").readOnly = true;
document.getElementById("txtFreightlocedit").readOnly = true;
} else if (FreightType == '<?php echo LUMPSUM; ?>') {
$('#txtAfterFreightlocedit').val('');
var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val();
AfterFreight = <?php echo FREIGHT_LUMPSUM; ?>;
var txtAfterFreightloc = parseFloat(AfterFreight).toFixed(2);
$('#txtAfterFreightlocedit').val(txtAfterFreightloc);
document.getElementById("txtAfterFreightlocedit").readOnly = true;
} else if (FreightType == '<?php echo PERUOM; ?>') {
$('#txtAfterFreightlocedit').val('');
var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val();
var Quantity = $('#EditCPQuantity').val() == '' ? '0.00' : $('#EditCPQuantity').val();
AfterFreight = <?php echo FREIGHT_PERUOM; ?>;
var txtAfterFreightloc = parseFloat(AfterFreight).toFixed(2);
$('#txtAfterFreightlocedit').val(txtAfterFreightloc);
} else if (FreightType == '<?php echo PERTRIP; ?>') {
$('#txtAfterFreightlocedit').val('');
var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val();
var noOftrip = $('#NOOfTripslocedit').val() == '' ? '0.00' : $('#NOOfTripslocedit').val();
AfterFreight = <?php echo FREIGHT_PERTRIP; ?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
var txtAfterFreightloc = parseFloat(AfterFreight).toFixed(2);
$('#txtAfterFreightlocedit').val(txtAfterFreightloc);
} else {
$('#txtAfterFreightlocedit').val('');
var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val();
var txtAfterFreightloc = parseFloat(FreightValue).toFixed(2);
$('#txtAfterFreightlocedit').val(txtAfterFreightloc);
}
EditRatechange();
}
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 EditCalculateCustomduty() {
var txtbasic = 0;
var txtcustompercentage = 0;
var txthighse = 0;
var txtlandingch = 0;
var sumcustom = 0;
var txtcustomduty = 0;
//var accessible=parseFloat($('#EditAfterAssessable').val());
var accessible = parseFloat($('#EditAfterAssessable').val() == '' ? '0.00' : $('#EditAfterAssessable').val());
// var txtcustompercentage=parseFloat($('#EditCustomduty').val());
var txtcustompercentage = parseFloat($('#EditCustomduty').val() == '' ? '0.00' : $('#EditCustomduty').val());
//sumcustom=txthighse+txtlandingch+txtbasic;
txtcustomduty = <?php echo CUSTOM_DUTY1; ?>;
if (isNaN(txtcustomduty)) {
$('#EditAfterCustomduty').val('');
} else {
$('#EditAfterCustomduty').val(parseFloat(txtcustomduty).toFixed(2));
}
EditCalculateCustomEdcess();
}
function EditCalculateCustomEdcess() {
var txtloading = 0;
var txthighses = 0;
var txtcustomduty1 = 0;
var txtexciseduty = 0;
var txtedexciseduty = 0;
var txtshexcisesess = 0;
var totalval = 0;
var txtedcesspercentage = 0;
//var txtcustomedsess=(totalval*txtedcesspercentage)/100;
var txtcustomedsess = 0;
//txtcustomduty1=parseFloat($('#EditAfterCustomduty').val());
//txtedcesspercentage=parseFloat($('#EditCustomEDcess').val());
//var txtcustomedsess=(totalval*txtedcesspercentage)/100;
txtcustomduty1 = parseFloat($('#EditAfterCustomduty').val() == '' ? '0.00' : $('#EditAfterCustomduty').val());
// txtedcesspercentage=parseFloat($('#CustomEDcess').val());
txtedcesspercentage = parseFloat($('#EditCustomEDcess').val() == '' ? '0.00' : $('#EditCustomEDcess').val());
txtcustomedsess = <?php echo CUSTOM_ED1; ?>;
if (isNaN(txtcustomedsess)) {
$('#EditAfterCustomEDcess').val('');
} else {
$('#EditAfterCustomEDcess').val(parseFloat(txtcustomedsess).toFixed(2));
}
EditCalculateCustomSHcess();
}
function EditCalculateCustomSHcess() { //alert();
var landingch = 0;
var highsesssalles = 0;
var customch = 0;
var excisech = 0;
var exciseedch = 0;
var exciseshch = 0;
var totcustomsh = 0;
var txtshpercentage = 0;
//var totresult=(totcustomsh*txtshpercentage)/100;
var totresult = 0;
var basucprice = 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 = $('#EditIgstInt').val() == '' ? '0.00' : $('#EditIgstInt').val()
var afterigst = <?php echo IGST; ?>;
if (isNaN(tot)) {
$('#EditSubtotal').val('');
} else {
$('#EditSubtotal').val(parseFloat(tot).toFixed(2));
}
if (isNaN(afterigst)) {
$('#EditAfterIgstInt').val('');
} else {
$('#EditAfterIgstInt').val(parseFloat(afterigst).toFixed(2));
}
var grossexp = custom + customsh + customed + afterigst;
var txtgrossduty = <?php echo GROSS_DUTY1; ?>;
;
if (isNaN(txtgrossduty)) {
$('#EditGrossdutypayable').val('');
} else {
$('#EditGrossdutypayable').val(parseFloat(txtgrossduty).toFixed(2));
}
EditCalculateCtable()
}
function EditCalculateCtable() {
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($('#EditAfterIgstInt').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($('#EditCPQuantity').val());
var clearing = $('#EditClearingCharges').val() == '' ? '0.00' : $('#EditClearingCharges').val();
var basicres = <?php echo MATBYQTY; ?>;
var clear = <?php echo CLEARINGQTY; ?>;
//console.log(basicres);
//console.log(clear);
var basicnett = parseFloat(basicres) + parseFloat(clear) + parseFloat(customdutyexp);
//console.log(basicnett);
if (isNaN(basicnett)) {
$('#EditNett').val('');
} else {
$('#EditNett').val((basicnett).toFixed(2));
}
}
</script>