Exceeding quantity issue in import po
This commit is contained in:
parent
9b07daabe5
commit
8e1e5ac268
@ -303,6 +303,19 @@ class purchaseorder extends BaseController
|
||||
|
||||
// $data[$Rate->ExchangeRate]=$Rate->ExchangeRate;
|
||||
}
|
||||
|
||||
foreach($data['POItem'] as $CUR)
|
||||
{
|
||||
|
||||
//print_r($CUR->CurrencyType);
|
||||
$Currency=$CUR->CurrencyType;
|
||||
|
||||
|
||||
// $data[$Rate->ExchangeRate]=$Rate->ExchangeRate;
|
||||
}
|
||||
//echo "$Currency";
|
||||
$data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency);
|
||||
//print_r($data);
|
||||
$data['ExchangeRate']=$exRate;
|
||||
|
||||
$data['Currency']=$this->purchaseorder_model->GetCurrencytype();
|
||||
|
||||
@ -550,6 +550,16 @@ function GetImportPurchaseOrderDetailsForPDF($PONO = '')
|
||||
|
||||
}
|
||||
|
||||
|
||||
function GetCurrencyDetail($Currency='')
|
||||
{
|
||||
|
||||
$subQuery='SELECT CurrencyCode,CurrencyName from T_Currency_Details where CurrencyCode=?';
|
||||
$query=$this->db->query($subQuery,array($Currency));
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -559,7 +569,7 @@ function GetImportPurchaseOrderDetails($PONO = '')
|
||||
|
||||
$subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,
|
||||
Mat.UOM,Quantity,Rate,Req.Status,ROUND((Quantity *Rate),2 ) as BasicValue ,
|
||||
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((Quantity *Rate)+(RMCIncludingCustomersPerKG*Quantity),2)as TotalOrderValue,ROUND((ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,
|
||||
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((Quantity *Rate)+(RMCIncludingCustomersPerKG*Quantity),2)as TotalOrderValue,ROUND((ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,CurrencyType,
|
||||
|
||||
Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem
|
||||
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
|
||||
|
||||
@ -3,6 +3,7 @@ $AvlAmount = 0;
|
||||
$ReqType ='';
|
||||
|
||||
//echo $ExchangeRate;
|
||||
//echo $Currency;
|
||||
|
||||
|
||||
|
||||
@ -180,7 +181,8 @@ if(!empty($POMaster))
|
||||
<label>Currency Type</label>
|
||||
|
||||
<?php
|
||||
$options = array("0"=>'Select Currency');
|
||||
$options = array("0"=>'Select Currency');
|
||||
|
||||
//print_r( $options);
|
||||
if(!empty($Currency))
|
||||
{
|
||||
@ -196,6 +198,10 @@ if(!empty($POMaster))
|
||||
echo form_dropdown('currencytype', $options,set_value('currencytype'),'id="currencytype"' ,'required="true"' ,'class="form-control select2');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
</div>
|
||||
<!-- <div class="col-md-12">
|
||||
@ -1466,7 +1472,8 @@ if(!empty($POMaster))
|
||||
<input type="hidden" name="<?php echo 'departmentName'.$index ?>" id="<?php echo 'departmentName'.$index ?>" value="<?php echo $record->DepartmentName ; ?>" />
|
||||
|
||||
<!--<input type="hidden" name="<?php echo 'AvlBudAmt'.$index ?>" id="<?php echo 'AvlBudAmt'.$index ?>" value="<?php echo $record->AvlBudAmt ; ?>" /> -->
|
||||
<input type="hidden" name="<?php echo 'AvlBudAmt'.$index ?>" id="<?php echo 'AvlBudAmt'.$index ?>" value="<?php echo "$AvlBudAmt" ; ?>" />
|
||||
<input type="hidden" name="<?php echo 'AvlBudAmt'.$index ?>" id="<?php echo 'AvlBudAmt'.$index ?>" value="<?php echo "$AvlAmount" ; ?>" />
|
||||
|
||||
<input type="hidden" name="<?php echo 'LineItemNo'.$index ?>" id="<?php echo 'LineItemNo'.$index ?>" value="<?php echo $record->LineItemNo ; ?>" />
|
||||
<input type="hidden" name="<?php echo 'costCode'.$index ?>" id="<?php echo 'costCode'.$index ?>" value="<?php echo $record->CostCenterCode ; ?>" />
|
||||
<input type="hidden" name="<?php echo 'materialCode'.$index ?>" id="<?php echo 'materialCode'.$index ?>" value="<?php echo $record->MaterialCode ; ?>" />
|
||||
@ -1789,7 +1796,10 @@ var NilType = '<?php echo NILTYPE;?>';
|
||||
};
|
||||
|
||||
$('#ExchangeRate').val(<?php echo $ExchangeRate;?>);
|
||||
$('#AvlBudAmt').val(<?php echo $AvlAmount; ?>);
|
||||
$('#EditAvlBudAmt').val(<?php echo $AvlAmount; ?>);
|
||||
|
||||
|
||||
|
||||
|
||||
var txtexchangerate=parseFloat($('#ExchangeRate').val());
|
||||
$('#EditExchangeRt').val(txtexchangerate);
|
||||
@ -3119,7 +3129,7 @@ $("#editimportpomodel").on("shown.bs.modal", function(e) {
|
||||
//alert($('#Reqnumber'+userid).val());
|
||||
$('#EditdeptName').val($('#departmentName'+userid).val());
|
||||
$("#EditCostCenter").val($('#costCode'+userid).val());
|
||||
$('#EditAvlBudAmt').val($('#AvilBudget'+userid).val());
|
||||
// $('#EditAvlBudAmt').val($('#AvilBudget'+userid).val());
|
||||
|
||||
$('#EditItemName').val($('#materialName'+userid).val());
|
||||
$('#EditUOM').val($('#uom'+userid).val());
|
||||
|
||||
@ -377,7 +377,7 @@ if(!empty($AvlBudAmt))
|
||||
<label>Quantity</label>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Ratechange()');
|
||||
$data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Ratechange(),ExceedQuantityCheck()');
|
||||
echo form_input($data);
|
||||
|
||||
?>
|
||||
@ -913,7 +913,7 @@ if(!empty($AvlBudAmt))
|
||||
<label>Quantity</label>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Ratechange()');
|
||||
$data = array('name' => 'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Ratechange(),ExceedEditQuantityCheck()');
|
||||
echo form_input($data);
|
||||
|
||||
?>
|
||||
@ -1794,6 +1794,24 @@ function Ratechange(){
|
||||
}
|
||||
}
|
||||
|
||||
function validateEditExceedLimit()
|
||||
{
|
||||
var avalbudAmt = parseFloat($('#EditAvlBudAmt').val());
|
||||
var basicAmountRate = parseFloat($('#txtEditBasicValue').val());
|
||||
var totalAmount = parseFloat($('#EditTotalExp').val());
|
||||
|
||||
if(basicAmountRate > avalbudAmt || totalAmount > avalbudAmt)
|
||||
{
|
||||
alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
|
||||
$('#EditRate').focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Calculateloadingcharge()
|
||||
{
|
||||
@ -1953,6 +1971,43 @@ function EditCalculateCustomduty()
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ExceedQuantityCheck()
|
||||
{
|
||||
// RequistQuantity
|
||||
var EnterQuantity = $("#Quantity").val()== '' ? "0.00" : parseFloat($("#Quantity").val());
|
||||
var ReqQuantity = parseFloat(RequistQuantity);
|
||||
if(EnterQuantity > ReqQuantity)
|
||||
{
|
||||
alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
|
||||
//$('#Quantity').val(RequistQuantity);
|
||||
$('#Quantity').focus();
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ExceedEditQuantityCheck()
|
||||
{
|
||||
// RequistQuantity
|
||||
var EnterQuantity = $("#EditQuantity").val()== '' ? "0.00" : parseFloat($("#EditQuantity").val());
|
||||
var ReqQuantity = parseFloat(RequistQuantity);
|
||||
if(EnterQuantity > ReqQuantity)
|
||||
{
|
||||
alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
|
||||
//$('#Quantity').val(RequistQuantity);
|
||||
$('#EditQuantity').focus();
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function CalculateExciseDuty()
|
||||
{
|
||||
|
||||
@ -2587,7 +2642,7 @@ $('.AddImport').click(function()
|
||||
{
|
||||
|
||||
//alert('out');
|
||||
if(validateImport())
|
||||
if(validateImport()&&ExceedQuantityCheck())
|
||||
{
|
||||
//alert('in');
|
||||
|
||||
@ -2846,7 +2901,7 @@ $('#txttotalavlmodvat').val((parseFloat(TotalAvlmodvat) + parseFloat(AvailableMo
|
||||
$('#txttotalgrossexpense').val((parseFloat(TotalGrossExpense) + parseFloat(Grossexpenses)).toFixed(2) );
|
||||
$('#txtToatlOrder').val((parseFloat(TotalOrder) + parseFloat(totalexp)).toFixed(2) );
|
||||
//alert(JSON.stringify(totalexp));
|
||||
alert(TotalOrder);
|
||||
//alert(TotalOrder);
|
||||
|
||||
|
||||
|
||||
@ -3002,7 +3057,8 @@ $("#editimportpomodel").on("shown.bs.modal", function(e) {
|
||||
|
||||
$('.EditImport').click(function(){
|
||||
//alert('inside edit');
|
||||
|
||||
if(validateEditExceedLimit() && ExceedEditQuantityCheck())
|
||||
{
|
||||
var CostCode = $("#EditCostCenter").val();
|
||||
var AvilBudget = $('#EditAvlBudAmt').val();
|
||||
var editMaterialCode = $("#EditMaterialCode").val();
|
||||
@ -3085,6 +3141,7 @@ $('.EditImport').click(function(){
|
||||
$('#RMCIncludingCustomers'+userid).val(RMC);
|
||||
$('#TotalExp'+userid).val(TotalExp);
|
||||
populateValueMainFormForEditImportTax();
|
||||
}
|
||||
//$('#Grossexpenses'+userid).val(GrossExpense);
|
||||
|
||||
//addHidden(theForm,"taxamt"+temp,taxamt);//RMC
|
||||
|
||||
Loading…
Reference in New Issue
Block a user