edit import freight type

This commit is contained in:
venbatechnologies@gmail.com 2017-09-07 16:51:45 +05:30
parent b4a6342f45
commit 584a0bef6b
3 changed files with 370 additions and 8 deletions

View File

@ -1655,6 +1655,13 @@ function addNewImportPurchaseOrder()
//$ExciseDutySH = $this->input->post('ExcisedutySH'.$i);
$Totalvalueitem=$this->input->post('TotalValue'.$i);
$FreightType=$this->input->post('FreightType'.$i);
$Nosoftrip=$this->input->post('NoOfTrip'.$i);
$FreightRate=$this->input->post('FreightValue'.$i);
$FreightAmount=$this->input->post('AfterFreightValue'.$i);
// echo $Totalvalueitem;
//die();
$LineItemNo = '';
@ -1708,10 +1715,10 @@ function addNewImportPurchaseOrder()
//die();
if(count($isExists) == 0)
{
print_r(count($isExists));
// print_r(count($isExists));
//echo $isExists;
//die();
$ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem);
$ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$Nosoftrip,'FreightValue'=>$FreightRate,'AfterFreightValue'=>$FreightAmount);
//print_r($ImportTaxList);
@ -1723,7 +1730,7 @@ function addNewImportPurchaseOrder()
{
//echo "xxcx";
//die();
$ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem);
$ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$Nosoftrip,'FreightValue'=>$FreightRate,'AfterFreightValue'=>$FreightAmount);
//echo "cxvc ";
//die();
//print_r($ImportTaxList);

View File

@ -865,7 +865,7 @@ function GetImportPurchaseOrderDetails($PONO = '')
Mat.UOM,Quantity,Rate,Req.Status,ROUND((Quantity *Rate),2 ) as BasicValue,ReceivedQuantity,
QuantityRejected,ROUND(Quantity-ReceivedQuantity)as PendingQty,
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.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),2)as TotalOrderValue,ROUND((POMast.ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,CurrencyType,ReceivedQuantity,
AfterCustomEdCess,ROUND((Quantity *Rate),2)as TotalOrderValue,ROUND((POMast.ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,CurrencyType,ReceivedQuantity,Tax.*,
Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem
join T_PurchaseOrder_Master POMast on POMast.PONO = LineItem.PONO

View File

@ -1841,11 +1841,11 @@ if($PONOStatus == PO_RELEASED)
?>
</div>
</div>
<div class="col-md-3" id="EditTripsValue" style="display:none;">
<div class="col-md-3" id="EditTripsValue" style="display:block;">
<span>NO Of Trips</span>
<div class="form-group">
<?php
$data = array('name' => 'editNOOfTrips','value' => set_value('editNOOfTrips'),'id'=>'editNOOfTrips', 'class' => 'form-control num','onchange'=>'calculateFreight(0);' );
$data = array('name' => 'editNOOfTrips','value' => set_value('editNOOfTrips'),'id'=>'editNOOfTrips', 'class' => 'form-control num','onchange'=>'calculateFreight(1);' );
echo form_input($data);
?>
</div>
@ -1854,7 +1854,7 @@ if($PONOStatus == PO_RELEASED)
<span>Freight Rate </span>
<div class="form-group">
<?php
$data = array('name' => 'edittxtFreight','value' => set_value('txtFreight'),'id'=>'txtFreight', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateFreight(0);');
$data = array('name' => 'edittxtFreight','value' => set_value('edittxtFreight'),'id'=>'edittxtFreight', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateFreight(1);');
echo form_input($data);
?>
</div>
@ -1864,7 +1864,7 @@ if($PONOStatus == PO_RELEASED)
<span>Freight Amt In INR</span>
<div class="form-group">
<?php
$data = array('name' => 'edittxtAfterFreight','value' => set_value('txtAfterFreight'),'id'=>'txtAfterFreight', 'class' => 'form-control num' ,'readonly' => 'true');
$data = array('name' => 'edittxtAfterFreight','value' => set_value('edittxtAfterFreight'),'id'=>'edittxtAfterFreight', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
@ -2720,6 +2720,17 @@ if($PONOStatus == PO_RELEASED)
<input type="hidden" name="<?php echo 'CustomEDcess'.$index ?>" id="<?php echo 'CustomEDcess'.$index ?>" value="<?php echo $record->CustomEdCess; ?>" />
<input type="hidden" name="<?php echo 'FreightType'.$index ?>" id="<?php echo 'FreightType'.$index ?>" value="<?php echo $record->FreightType; ?>" />
<input type="hidden" name="<?php echo 'NoOfTrip'.$index ?>" id="<?php echo 'NoOfTrip'.$index ?>" value="<?php echo $record->NoOfTrip; ?>" />
<input type="hidden" name="<?php echo 'FreightValue'.$index ?>" id="<?php echo 'FreightValue'.$index ?>" value="<?php echo $record->FreightValue; ?>" />
<input type="hidden" name="<?php echo 'AfterFreightValue'.$index ?>" id="<?php echo 'AfterFreightValue'.$index ?>" value="<?php echo $record->AfterFreightValue; ?>" />
<?php
if($PONOStatus != PO_RELEASED)
@ -4495,6 +4506,18 @@ $('.AddImport').click(function()
var purate=$("#purchaserate").val();
var CustomDutyExpense=$("#CustomDutyExpenses").val();
var RMCIncluderate=$("#RMCIncludingCustomers").val();
var FreightType=$('#drpaddFreight').val();
var Nooftrip=$('#addNOOfTrips').val();
var Freightrate=$('#addtxtFreight').val();
var AfterFreightAmount=$('#addtxtAfterFreight').val();
// console.log(FreightType);
// console.log(Nooftrip);
// console.log(Freightrate);
// console.log(AfterFreightAmount);
var receivedqty='';
var rejectedqty='';
var pendingqty='';
@ -4575,6 +4598,12 @@ $('.AddImport').click(function()
addHidden(theForm,"BasicPriceInMTon"+temp,Basicpriceinus);
addHidden(theForm,"BasicINRValue"+temp,AfterBasicPrice);
addHidden(theForm,"FreightType"+temp,FreightType);
addHidden(theForm,"NoOfTrip"+temp,Nooftrip);
addHidden(theForm,"FreightValue"+temp,Freightrate);
addHidden(theForm,"AfterFreightValue"+temp,AfterFreightAmount);
//var a=parseFloat($('#AfterCustomEDcess').val());
//console.log(a);
@ -4954,6 +4983,16 @@ function clearTaxField()
$('#purchaserate').val('');
$('#CustomDutyExpenses').val('');
$('#RMCIncludingCustomers').val('');
$('#drpaddFreight').val('');
$('#addNOOfTrips').val('');
$('#addtxtFreight').val('');
$('#addtxtAfterFreight').val('');
}
@ -5043,6 +5082,28 @@ $("#editimportpomodel").on("shown.bs.modal", function(e) {
$('#EditTotalExp').val($("#TotalValue"+userid).val());
//$('#EditINRBasicvalue').val($("#BasicINRValue"+userid).val());
$('#drpeditFreight').val($("#FreightType"+userid).val());
$('#editNOOfTrips').val($("#NoOfTrip"+userid).val());
$('#edittxtFreight').val($("#FreightValue"+userid).val());
$('#edittxtAfterFreight').val($("#AfterFreightValue"+userid).val());
var FreightType = $('#drpeditFreight').val();
if (FreightType == "PER TRIP")
{
$('#editTripsValue').show();
}
else
{
$('#editTripsValue').hide();
}
$('#EditTotalOrderValue').val(cellval[6].innerHTML);
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
@ -5136,6 +5197,25 @@ if(validateEditExceedLimit() && ExceedEditQuantityCheck()&&EditQtyZerocheck())
//console.log(GrossDuty);
var FreightType=$('#drpeditFreight').val();
var FreightRate=$('#edittxtFreight').val();
var FreightRateAmount=$('#edittxtAfterFreight').val();
var Nooftrip=$('#editNOOfTrips').val();
var FreightTypename = $('#drpeditFreight').val();
if (FreightTypename != "PER TRIP")
{
Nooftrip='';
}
// console.log(FreightType);
// console.log(Nooftrip);
// console.log(FreightRate);
// console.log(FreightRateAmount);
var tr= document.getElementById(userid);
var cellval = tr.cells;
@ -5183,8 +5263,25 @@ if(validateEditExceedLimit() && ExceedEditQuantityCheck()&&EditQtyZerocheck())
$('#RMCIncludingCustomersPerKG'+userid).val(RMC);
$('#TotalValue'+userid).val(TotalExp);
$('#AvailableModvat'+userid).val(AvailaleModvat);
$('#FreightType'+userid).val(FreightType);
$('#NoOfTrip'+userid).val(Nooftrip);
$('#FreightValue'+userid).val(FreightRate);
$('#AfterFreightValue'+userid).val(FreightRateAmount);
// var a=parseFloat($('#ProductPrice'+userid).val());
// console.log(a);
// var a=$('#FreightType'+userid).val();
// var b=$('#NoOfTrip'+userid).val();
// var c=$('#FreightValue'+userid).val();
// var d=$('#AfterFreightValue'+userid).val();
// console.log(a);
// console.log(b);
// console.log(c);
// console.log(d);
populateValueMainFormForEditImportTax();
}
@ -5670,8 +5767,13 @@ if (FreightType == "PER TRIP")
}
});
$('#drpeditFreight').change(function(){
var FreightType = $('#drpeditFreight').val();
if (FreightType == "PER TRIP")
{
@ -5682,8 +5784,45 @@ if (FreightType == "PER TRIP")
$('#EditTripsValue').hide();
}
$('#editNOOfTrips').val('');
$('#edittxtFreight').val('');
$('#edittxtAfterFreight').val('');
if($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0" )
{
selValue = $("#drpEditFreight").val() ;
$('#txtEditFreight').val('');
$('#edittxtAfterFreight').val('');
if (selValue == NilType)
{
$('#txtEditFreight').attr('readonly', 'true');
$('#txtEditFreight').val('0.00');
}
else
{
$('#txtEditFreight').removeAttr( 'readonly','true' );
$('#txtEditFreight').val('');
}
}
else
{
alert('Please Select MaterialCode and Rate Field Value');
$('#drpEditFreight').val("0");
$('#EditRate').focus();
}
calculateFreight(1);
});
$('#drpaddFreight').change(function(){
//alert();
var FreightType = $('#drpaddFreight').val();
if (FreightType == "PER TRIP")
{
@ -5695,7 +5834,223 @@ if (FreightType == "PER TRIP")
$('#AddTripsValue').hide();
}
if($('#Rate').val() != '' && $('#MaterialCode').val() != "0" )
{
selValue = $("#drpaddFreight").val() ;
$('#txtFreight').val('');
$('#txtAfterFreight').val('');
if (selValue == NilType)
{
$('#txtFreight').attr('readonly', 'true');
$('#txtFreight').val('0.00');
}
else
{
$('#txtFreight').removeAttr( 'readonly','true' );
$('#txtFreight').val('');
}
}
else
{
alert('Please Select MaterialCode and Rate Field Value');
$('#drpaddFreight').val("0");
$('#Rate').focus();
}
calculateFreight(0);
});
function calculateFreight(isEdit)
{
//alert();
if(isEdit == '0')
{ //alert();
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
$('#txtFreight').val('') ;
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#Rate').focus();
$('#addtxtFreight').val('') ;
return false;
}
else
{
// var basicValue = parseFloat($('#txtBasicValue').val());
var basicValue = parseFloat($('#INRBasicvalue').val());
var FreightType =$("#drpaddFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
$('#addtxtFreight').val('');
$("#drpaddFreight").focus();
}
else if( $('#addtxtFreight').val() != "0" && $('#addtxtFreight').val() != '')
{
var FreightValue = parseFloat($('#addtxtFreight').val());
var UOM = parseFloat($('#UOM').val());
var Quantity = parseFloat($('#Quantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
if(FreightType == PercentageType)
{
AfterFreight = <?php echo FREIGHT_PERCENTAGE;?>;
}
else if(FreightType == NilType)
{
AfterFreight = 0.0;
}
else if(FreightType == '<?php echo LUMPSUM;?>')
{
AfterFreight = <?php echo FREIGHT_LUMPSUM;?>;
}
else if(FreightType == '<?php echo PERUOM;?>')
{
AfterFreight = <?php echo FREIGHT_PERUOM;?>;
}
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#addNOOfTrips').val()=='')
{
alert('Please Enter No of Trip');
$("#addNOOfTrips").focus();
$('#addtxtFreight').val(0)
AfterFreight=0;
$('#addtxtAfterFreight').val("0.00");
return false;
}
else
{
var noOftrip = $("#addNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP;?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
}
else
{
AfterFreight = $("#addtxtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#addtxtAfterFreight').val(AfterFreightval);
}
else
{
$('#addtxtAfterFreight').val("0.00");
}
}
// calculateTotalValue();
}
else
{
// alert('af');
if($('#EditMaterialCode').val() == '')
{
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
$('#edittxtFreight').val('');
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
$('#edittxtFreight').val('');
return false;
}
else
{
var basicValue = parseFloat($('#EditINRBasicvalue').val());
var FreightType =$("#drpeditFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
$('#edittxtFreight').val('');
$("#drpeditFreight").focus();
}
else if( $('#edittxtFreight').val() != "0" && $('#edittxtFreight').val() != '')
{
var FreightValue = parseFloat($('#edittxtFreight').val());
var UOM = parseFloat($('#EditUOM').val());
var Quantity = parseFloat($('#EditQuantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
if(FreightType == PercentageType)
{
AfterFreight = <?php echo FREIGHT_PERCENTAGE;?>;
}
else if(FreightType == NilType)
{
AfterFreight = 0.0;
}
else if(FreightType == '<?php echo LUMPSUM;?>')
{
AfterFreight = <?php echo FREIGHT_LUMPSUM;?>;
}
else if(FreightType == '<?php echo PERUOM;?>')
{
AfterFreight = <?php echo FREIGHT_PERUOM;?>;
}
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#editNOOfTrips').val()==''){
alert('Please Enter No of Trip');
$("#editNOOfTrips").focus();
$('#edittxtFreight').val(0)
AfterFreight=0;
$('#edittxtAfterFreight').val("0.00");
return false;
}
else{
var noOftrip = $("#editNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP;?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
}
else {
AfterFreight = $("#edittxtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#edittxtAfterFreight').val(AfterFreightval);
}
else
{
$('#edittxtAfterFreight').val("0.00");
}
}
// calculateEditTotalValue();
}
}
</script>