From dca4426e0e674e7947b1d42ab26efd4bad200d0b Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 7 Sep 2017 13:14:42 +0530 Subject: [PATCH] add import freight type --- application/controllers/purchaseorder.php | 12 +- application/views/importpo.php | 196 ++++++++++++++++++---- 2 files changed, 175 insertions(+), 33 deletions(-) diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index d6278aa2..2326d5af 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -1420,6 +1420,16 @@ function addNewImportPurchaseOrder() //echo $BasicPriceinmton; $CostCenter = $this->input->post('costCode'.$i); + + + + $FreightType=$this->input->post('FreightType'.$i); + $nooftrip=$this->input->post('NoofTrip'.$i); + $Freightrate=$this->input->post('FreightRate'.$i); + $Freightamount=$this->input->post('AfterFreightRate'.$i); + + + $SkipInsert = "False"; if( count($comma_separated) > 0) @@ -1456,7 +1466,7 @@ function addNewImportPurchaseOrder() if(trim($POType) == IMPORT ) { // echo 'Success'; - $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,'CreatedDate'=>$createddt,'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,'CreatedDate'=>$createddt,'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'=>$nooftrip,'FreightValue'=>$Freightrate,'AfterFreightValue'=>$Freightamount); //print_r($ImportTaxList); //die(); diff --git a/application/views/importpo.php b/application/views/importpo.php index 9c41c000..17871388 100755 --- a/application/views/importpo.php +++ b/application/views/importpo.php @@ -1735,7 +1735,7 @@ else if($('#addsupplierreference').val()=='')
'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); ?>
@@ -1744,7 +1744,7 @@ else if($('#addsupplierreference').val()=='')
'txtEditFreight','value' => set_value('txtEditFreight'),'id'=>'txtEditFreight', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateFreight(0);'); + $data = array('name' => 'txtEditFreight','value' => set_value('txtEditFreight'),'id'=>'txtEditFreight', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateFreight(1);'); echo form_input($data); ?>
@@ -1754,7 +1754,7 @@ else if($('#addsupplierreference').val()=='')
'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); ?>
@@ -3611,7 +3611,8 @@ function calculateFreight(isEdit) } else { - var basicValue = parseFloat($('#txtBasicValue').val()); + // var basicValue = parseFloat($('#txtBasicValue').val()); + var basicValue = parseFloat($('#INRBasicvalue').val()); var FreightType =$("#drpFreight").val(); if(FreightType == "0") { @@ -3644,24 +3645,28 @@ function calculateFreight(isEdit) } else if(FreightType == '') { - if($('#NOOfTrips').val()==''){ - alert('Please Enter No of Trip'); + 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 = ; - AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2); - } + $("#NOOfTrips").focus(); + $('#txtFreight').val(0) + AfterFreight=0; + $('#txtAfterFreight').val("0.00"); + return false; + } + else + { + var noOftrip = $("#NOOfTrips").val(); + AfterFreight = ; + AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2); + } } - else { + + else + { AfterFreight = $("#txtFreight").val(); } var AfterFreightval = parseFloat(AfterFreight).toFixed(2); @@ -3678,6 +3683,8 @@ function calculateFreight(isEdit) } else { + + //alert(); if($('#EditMaterialCode').val() == "0") { alert('Please Select the Material Code'); @@ -3694,13 +3701,13 @@ function calculateFreight(isEdit) } else { - var basicValue = parseFloat($('#txtEditBasicValue').val()); - var FreightType =$("#drpEditFreight").val(); + var basicValue = parseFloat($('#EditINRBasicvalue').val()); + var FreightType =$("#drpeditFreight").val(); if(FreightType == "0") { alert('Please select Freight Type'); $('#txtEditFreight').val(''); - $("#drpEditFreight").focus(); + $("#drpeditFreight").focus(); } else if( $('#txtEditFreight').val() != "0" && $('#txtEditFreight').val() != '') { @@ -3727,17 +3734,17 @@ function calculateFreight(isEdit) } else if(FreightType == '') { - if($('#EditNOOfTrips').val()==''){ + if($('#editNOOfTrips').val()==''){ alert('Please Enter No of Trip'); - $("#EditNOOfTrips").focus(); + $("#editNOOfTrips").focus(); $('#txtEditFreight').val(0) AfterFreight=0; - $('#txtEditAfterFreight').val("0.00"); + $('#edittxtAfterFreight').val("0.00"); return false; } else{ - var noOftrip = $("#EditNOOfTrips").val(); + var noOftrip = $("#editNOOfTrips").val(); AfterFreight = ; AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2); } @@ -3747,11 +3754,11 @@ function calculateFreight(isEdit) } var AfterFreightval = parseFloat(AfterFreight).toFixed(2); - $('#txtEditAfterFreight').val(AfterFreightval); + $('#edittxtAfterFreight').val(AfterFreightval); } else { - $('#txtEditAfterFreight').val("0.00"); + $('#edittxtAfterFreight').val("0.00"); } } @@ -3830,6 +3837,19 @@ $('.AddImport').click(function() var purate=$("#purchaserate").val(); var CustomDutyExpense=$("#CustomDutyExpenses").val(); var RMCIncluderate=$("#RMCIncludingCustomers").val(); + var FreightType=$('#drpFreight').val(); + var Nooftrip=$('#NOOfTrips').val(); + var Freightrate=$('#txtFreight').val(); + var AfterFreightAmount=$('#txtAfterFreight').val(); + //var Nooftrip=$('#NOOfTrips').val(); + + + + // console.log(FreightType); + // console.log(Nooftrip); + // console.log(Freightrate); + // console.log(AfterFreightAmount); + var receivedqty=''; var rejectedqty=''; var pendingqty=''; @@ -3908,10 +3928,25 @@ $('.AddImport').click(function() addHidden(theForm,"AvilableModvat"+temp,Avlmodvat); addHidden(theForm,"TotalExp"+temp,totalexp); addHidden(theForm,"TotalValue"+temp,BasicAmt); - // alert(JSON.stringify(totalexp)); - - + addHidden(theForm,"FreightType"+temp,FreightType); + addHidden(theForm,"NoofTrip"+temp,Nooftrip); + addHidden(theForm,"FreightRate"+temp,Freightrate); + addHidden(theForm,"AfterFreightRate"+temp,AfterFreightAmount); + // alert(JSON.stringify(totalexp)); + + // var a=$('#FreightType'+temp).val(); + // var b=$('#NoofTrip'+temp).val(); + // var c=$('#FreightRate'+temp).val(); + // var d=$('#AfterFreightRate'+temp).val(); + + + // console.log(a); + // console.log(b); + // console.log(c); + // console.log(d); + + // addHidden(theForm,"AfterBasicPriceTax"+temp,AfterBasicPriceTax); //addHidden(theForm,"AfterBasicPriceTax"+temp,AfterBasicPriceTax); @@ -4083,6 +4118,14 @@ function clearTaxField() $('#purchaserate').val(''); $('#CustomDutyExpenses').val(''); $('#RMCIncludingCustomers').val(''); + + $('#drpFreight').val(''); + + $('#NOOfTrips').val(''); + + $('#txtFreight').val(''); + + $('#txtAfterFreight').val(''); } @@ -4114,7 +4157,7 @@ $("#editimportpomodel").on("shown.bs.modal", function(e) { $('#EditRate').val(editrate); //$('#EditRate').val($('#itemRate'+userid).val()); var basic=parseFloat($('#BasicAmt'+userid).val()).toFixed(2); - console.log(basic); + //console.log(basic); //$('#EdittxtBasicValue').val($('#BasicAmt'+userid).val()); //$('#EditimBasicPrice').val($("#BasicAmt"+userid).val()); @@ -4156,6 +4199,24 @@ $("#editimportpomodel").on("shown.bs.modal", function(e) { $('#EditAfterBasicPriceTax').val(basicinr); $('#EditAvailableModvat').val($("#AvilableModvat"+userid).val()); $('#EditTotalExp').val($("#TotalExp"+userid).val()); + + + $('#drpeditFreight').val($('#FreightType'+userid).val()); + $('#editNOOfTrips').val($('#NoofTrip'+userid).val()); + $('#txtEditFreight').val($('#FreightRate'+userid).val()); + $('#edittxtAfterFreight').val($('#AfterFreightRate'+userid).val()); + + var FreightType = $('#drpeditFreight').val(); + if (FreightType == "PER TRIP") + { + + $('#editTripsValue').show(); + } + + + + + $('#EditTotalOrderValue').val(cellval[8].innerHTML); $("#EditMaterialCode").empty(); var Material = ; @@ -4245,7 +4306,26 @@ $('.EditImport').click(function(){ var CustomDutyExpense=$("#EditCustomDutyExpenses").val(); var RMC=$("#EditRMCIncludingCustomers").val(); var TotalExp=$('#EditTotalExp').val(); - //console.log(TotalExp); + + + + var FreightType=$('#drpeditFreight').val(); + var FreightRate=$('#txtEditFreight').val(); + var FreightRateAmount=$('#edittxtAfterFreight').val(); + var Nooftrip=$('#editNOOfTrips').val(); + + + var FreightTypename = $('#drpeditFreight').val(); +if (FreightTypename != "PER TRIP") + { + + Nooftrip=''; + } + + // console.log(FreightType); + // console.log(FreightRate); + // console.log(FreightRateAmount); + // console.log(Nooftrip); var tr= document.getElementById(userid); @@ -4294,6 +4374,28 @@ $('.EditImport').click(function(){ $('#TotalExp'+userid).val(TotalExp); $('#AvilableModvat'+userid).val(AvailaleModvat); $('#TotalValue'+userid).val(TotalExp); + + $('#FreightType'+userid).val(FreightType); + + $('#NoofTrip'+userid).val(Nooftrip); + + $('#FreightRate'+userid).val(FreightRate); + + $('#AfterFreightRate'+userid).val(FreightRateAmount); + + + // var a=$('#FreightType'+userid).val(); + // var b=$('#NoofTrip'+userid).val(); + // var c=$('#FreightRate'+userid).val(); + // var d=$('#AfterFreightRate'+userid).val(); + + + // console.log(a); + // console.log(b); + // console.log(c); + // console.log(d); + + populateValueMainFormForEditImportTax(); } //$('#Grossexpenses'+userid).val(GrossExpense); @@ -4684,6 +4786,36 @@ if (FreightType == "PER TRIP") $('#editTripsValue').hide(); } + + + 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); + });