From 65b0c1ec559888d73bc1b887f781e562374fbc1b Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 6 Oct 2017 16:52:07 +0530 Subject: [PATCH] freight in capital --- .../controllers/amendmentpurchaseorder.php | 63 +- application/controllers/purchaseorder.php | 43 +- application/models/purchaseorder_model.php | 4 +- application/views/capitalpurchaseorder.php | 698 +++++++++- application/views/editCapitalAmendPO.php | 403 +++++- application/views/editCapitalPo.php | 1131 ++++++++++++++++- 6 files changed, 2293 insertions(+), 49 deletions(-) diff --git a/application/controllers/amendmentpurchaseorder.php b/application/controllers/amendmentpurchaseorder.php index 3d0d89c6..1c4e8bc6 100755 --- a/application/controllers/amendmentpurchaseorder.php +++ b/application/controllers/amendmentpurchaseorder.php @@ -1032,6 +1032,28 @@ function UpdateAmendServicePurchaseOrder() $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); $NOOfTrip = $this->input->post('NoOfTrip'.$i); $POLineItemNo = $this->input->post('LineItemNo'.$i); + + + $FreightTypeloc=$this->input->post('Ftype'.$i); + $FreightNoofTriploc=$this->input->post('NoTrip'.$i); + $Freightrateloc=$this->input->post('Fvalue'.$i); + $FreightAmountloc=$this->input->post('Afvalue'.$i); + + + + $beforeFreightTypeloc=$this->input->post('beforeFtype'.$i); + $beforeFreightNoofTriploc=$this->input->post('beforeNoTrip'.$i); + $beforeFreightrateloc=$this->input->post('beforeFvalue'.$i); + $beforeFreightAmountloc=$this->input->post('beforeAfvalue'.$i); + + + + + + + + + $rowspanvalue=0; if($Quantity != $preQuantity) @@ -1070,6 +1092,39 @@ function UpdateAmendServicePurchaseOrder() $rowspanvalue++; $CAD.="Amended OtherAllowances : " . $preotherallowance ."Current OtherAllowances : " . $otherallowance . ""; } + + + if($FreightTypeloc != $beforeFreightTypeloc) + { + $rowspanvalue++; + $CAD.="Amended Freight Type : " . $beforeFreightTypeloc ."Current Qty : " . $FreightTypeloc . ""; + } + + + + + if($FreightNoofTriploc != $beforeFreightNoofTriploc) + { + $rowspanvalue++; + $CAD.="Amended Freight Nooftrips : " . $beforeFreightNoofTriploc ."Current Freight Nooftrips: " . $FreightNoofTriploc . ""; + } + + + + if($Freightrateloc != $beforeFreightrateloc) + { + $rowspanvalue++; + $CAD.="Amended Freight Rate : " . $beforeFreightrateloc ."Current Freight Rate: " . $Freightrateloc . ""; + } + + + if($FreightAmountloc != $beforeFreightAmountloc) + { + $rowspanvalue++; + $CAD.="Amended Freight Amount : " .$beforeFreightAmountloc ."Current Freight Amount: " . $FreightAmountloc . ""; + } + + } if($rowspanvalue>0) { @@ -1097,10 +1152,10 @@ function UpdateAmendServicePurchaseOrder() if(trim($POType) == CAPITAL ) { - if($capitalType=='1'){ - $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$CGST,'After_CGST'=>$CGSTvalue,'SGST'=>$SGST,'After_SGST'=>$SGSTvalue,'IGST'=>$IGST,'After_IGST'=>$IGSTvalue, 'otherallowance'=>$otherallowance,'TotalValue'=>$TotalServiceOrderValue,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount); + if($capitalType=='1'){ + $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$CGST,'After_CGST'=>$CGSTvalue,'SGST'=>$SGST,'After_SGST'=>$SGSTvalue,'IGST'=>$IGST,'After_IGST'=>$IGSTvalue, 'otherallowance'=>$otherallowance,'TotalValue'=>$TotalServiceOrderValue,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount,'FreightType'=>$FreightTypeloc,'NoOfTrip'=>$FreightNoofTriploc,'FreightValue'=>$Freightrateloc,'AfterFreightValue'=>$FreightAmountloc); - $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); + $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); } //echo "Service"; else if($capitalType=='0'){ //print_r($ServiceTax); $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'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue); @@ -1115,6 +1170,8 @@ function UpdateAmendServicePurchaseOrder() echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ; } + + function EditAmendImportPO() { diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index d528bacb..14b728f0 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -2304,6 +2304,15 @@ function addNewImportPurchaseOrder() $DiscountValue = $this->input->post('DisVal'.$i); $AfterDiscount = $this->input->post('AfterDisVal'.$i); $OtherAmt = $this->input->post('OtherAmt'.$i); + + $FreightTypeloc=$this->input->post('FreightTypeloc'.$i); + $FreightNoofTriploc=$this->input->post('NoofTriploc'.$i); + $Freightrateloc=$this->input->post('FreightRateloc'.$i); + $FreightAmountloc=$this->input->post('AfterFreightRateloc'.$i); + + + + $TaxtotalOrderValue = $itemRate*$Quantity+$OtherAmt+$AfterCgst+$AfterSgst+$AfterIgst-$AfterDiscount; $CapitalItemDescription = $this->input->post('CapitalItemDescrition'.$i); @@ -2340,7 +2349,11 @@ function addNewImportPurchaseOrder() { if($CapitalRange=='1') { - $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TaxtotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount); + $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TaxtotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount,'FreightType'=>$FreightTypeloc,'NoOfTrip'=>$FreightNoofTriploc,'FreightValue'=>$Freightrateloc,'AfterFreightValue'=>$FreightAmountloc); + + + + $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); @@ -2364,6 +2377,7 @@ function addNewImportPurchaseOrder() } + /*Edit Capital po*/ function EditCapitalPurchaseOrder() { @@ -2548,6 +2562,28 @@ function addNewImportPurchaseOrder() $FreightValue = $this->input->post('FreightVal'.$i); $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); $NOOfTrip = $this->input->post('NoOfTrip'.$i); + + + + + $FreightTypeloc=$this->input->post('Ftype'.$i); + $FreightNoofTriploc=$this->input->post('NoTrip'.$i); + $Freightrateloc=$this->input->post('Fvalue'.$i); + $FreightAmountloc=$this->input->post('Afvalue'.$i); + + // echo $FreightTypeloc; + // echo 'n'; + // echo $FreightNoofTriploc; + // echo 'n'; + // echo $Freightrateloc; + // echo 'n'; + // echo $FreightAmountloc; + + // die(); + + + + $SkipInsert = "False"; if( count($comma_separated) > 0) { @@ -2582,7 +2618,7 @@ function addNewImportPurchaseOrder() { if($capitalType=='1') { - $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TaxtotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount); + $ServiceTaxList = array('LineItemNo'=>$LineItemNo,'FreightType'=>$FreightTypeloc,'NoOfTrip'=>$FreightNoofTriploc,'FreightValue'=>$Freightrateloc,'AfterFreightValue'=>$FreightAmountloc ,'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TaxtotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount); $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); } @@ -2607,7 +2643,7 @@ function addNewImportPurchaseOrder() $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$LineItemNo,$POLineItemList); if($capitalType=='1') { - $ServiceTaxList = array('CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TaxtotalOrderValue, 'UpdateBY'=>$CreateBy,'UpdatedOn'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount); + $ServiceTaxList = array('CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TaxtotalOrderValue, 'UpdateBY'=>$CreateBy,'UpdatedOn'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount,'FreightType'=>$FreightTypeloc,'NoOfTrip'=>$FreightNoofTriploc,'FreightValue'=>$Freightrateloc,'AfterFreightValue'=>$FreightAmountloc); $ServiceTax = $this->purchaseorder_model->updateServiceTax($LineItemNo,$ServiceTaxList); } @@ -2627,6 +2663,7 @@ function addNewImportPurchaseOrder() echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; } + /* capital po print/pdf*/ public function CapitalPoPrint($PONO) diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 01df9622..488e3f0a 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -1402,13 +1402,13 @@ join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode // get domestic capital po list - function getDomesticCapitalPurchaseOrderDetails($PONO = '') + function getDomesticCapitalPurchaseOrderDetails($PONO = '') { $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.ServiceMaterialDescription,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,LineItem.ServiceFrequency, Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,ROUND((ServiceTax.After_CGST + ServiceTax.After_SGST + ServiceTax.After_IGST),2) as ServiceTaxamount ,ServiceTax.TotalValue,ServiceTax.CGST,ServiceTax.After_CGST,ServiceTax.SGST,ServiceTax.After_SGST,ServiceTax.IGST,ServiceTax.After_IGST,ServiceTax.otherallowance,ServiceTax.discount,ServiceTax.discountval,ServiceTax.Afterdiscountval, - POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,ROUND((POMast.TotalOrderValue),2) as BasicINRValue,POMast.CurrencyType, + POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,ROUND((POMast.TotalOrderValue),2) as BasicINRValue,POMast.CurrencyType,FreightType as Ftype,NoOfTrip as NoTrip,FreightValue as Fvalue,AfterFreightValue as Afvalue, Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem join T_PurchaseOrder_Master POMast on POMast.PONO = LineItem.PONO diff --git a/application/views/capitalpurchaseorder.php b/application/views/capitalpurchaseorder.php index 614cdfc2..a110e829 100755 --- a/application/views/capitalpurchaseorder.php +++ b/application/views/capitalpurchaseorder.php @@ -91,6 +91,19 @@ if(!empty($INRSYMBOL)) margin-top:200px; z-index: 1080 !important; } + + +#packagingcalmodel { + margin-top:200px; + z-index: 1080 !important; +} + + + +#editpackagingcalmodel { + margin-top:200px; + z-index: 1080 !important; +} @@ -716,6 +729,80 @@ function vaildateBeforeOpenModal() + + + + + + + + + + + + + + + + + +
@@ -945,6 +1032,64 @@ function vaildateBeforeOpenModal() ?>
+ +
+
+ +
+ 'Select Freight Type'); + //print_r( $options); + + if(!empty($FreightType)) + { + foreach ($FreightType as $SID): + + + $options[$SID->ConfigValue] = $SID->ConfigValue; + + endforeach; + } + + echo form_dropdown('drpFreightloc', $options,set_value('drpFreightloc'),'id="drpFreightloc"' ,'class="form-control "'); + + ?> +
+
+ +
+ +
+ 'txtFreightloc','value' => set_value('txtFreightloc'),'id'=>'txtFreightloc', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateFreightlocaddper();'); + echo form_input($data); + ?> +
+
+ +
+ +
+ 'txtAfterFreightloc','value' => set_value('txtAfterFreightloc'),'id'=>'txtAfterFreightloc', 'class' => 'form-control num' ,'readonly' => 'true'); + echo form_input($data); + ?> +
+
+ +
+ + + +
@@ -1647,6 +1792,65 @@ function vaildateBeforeOpenModal()
+ +
+
+ +
+ 'Select Freight Type'); + //print_r( $options); + + 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 "'); + + ?> +
+
+ +
+ +
+ 'txtFreightlocedit','value' => set_value('txtFreightlocedit'),'id'=>'txtFreightlocedit', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateFreightloceditper();'); + echo form_input($data); + ?> +
+
+ +
+ +
+ 'txtAfterFreightlocedit','value' => set_value('txtAfterFreightlocedit'),'id'=>'txtAfterFreightlocedit', 'class' => 'form-control num' ,'readonly' => 'true'); + echo form_input($data); + ?> +
+
+ +
+ + + + +
@@ -2225,6 +2429,18 @@ function vaildateBeforeOpenModal() ?>
+ +
+ + 'TotalFreight','value' => set_value('TotalFreight'),'id'=>'TotalFreight', 'class' => 'form-control num' ,'readonly' => 'true'); + echo form_input($data); + ?> + +
+ + +
@@ -2831,25 +3047,32 @@ EditRatechange(); } var discountedValue = parseFloat($('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val()).toFixed(2); + + + var Freight=parseFloat($('#txtAfterFreightloc').val() == '' ? '0.00' : $('#txtAfterFreightloc').val()).toFixed(2); txtExchangeRate = 1; - BasicInINR=Tot * txtExchangeRate - discountedValue; + BasicInINR=(Tot * txtExchangeRate - discountedValue); } - + var CPtotal=parseFloat(BasicInINR)+parseFloat(Freight); + + //console.log(CPtotal); $('#CPTotalAmount').val(parseFloat(Tot).toFixed(2)); $('#AfterBasicPriceTax').val(parseFloat(BasicInINR).toFixed(2)); + // var a=$('#AfterBasicPriceTax').val(); + // console.log(a); //ExceedBudget($('#CPTotalAmount').val(),$('#CapitalbudAmt').val()); if(ExceedBudget($('#CPTotalAmount').val(),$('#CapitalbudAmt').val())){ //Service Tax calculation - $('#AfterCgst').val(calculateCgstTax($('#AfterBasicPriceTax').val(),$("#Cgst").val()== '' ? "0.00" : $('#Cgst').val())); - $('#AfterSgst').val(calculateSgstTax($('#AfterBasicPriceTax').val(),$("#Sgst").val()== '' ? "0.00" : $('#Sgst').val())); - $('#AfterIgst').val(calculateIgstTax($('#AfterBasicPriceTax').val(),$("#Igst").val()== '' ? "0.00" : $('#Igst').val())); + $('#AfterCgst').val(calculateCgstTax(CPtotal,$("#Cgst").val()== '' ? "0.00" : $('#Cgst').val())); + $('#AfterSgst').val(calculateSgstTax(CPtotal,$("#Sgst").val()== '' ? "0.00" : $('#Sgst').val())); + $('#AfterIgst').val(calculateIgstTax(CPtotal,$("#Igst").val()== '' ? "0.00" : $('#Igst').val())); if($('#LandingCharge').val()!='' && $('#AfterBasicPriceTax').val()!=''){ $('#AfterLandingCharge').val(calculateLandingCharge($('#LandingCharge').val(),$('#AfterBasicPriceTax').val())); @@ -3390,6 +3613,22 @@ var purchaseRate = $('#purchaserate').val(); var FreightVal = $("#txtFreight").val(); var AfterFreightVal = $("#txtAfterFreight").val(); var NoOfTrip = $("#NOOfTrips").val(); + + + var FreightTypeloc=$('#drpFreightloc').val(); + var Nooftriploc=$('#NOOfTripsloc').val(); + + + var Freightrateloc=$('#txtFreightloc').val(); + var AfterFreightAmountloc=$('#txtAfterFreightloc').val(); + + + // console.log(FreightTypeloc); + // console.log(Nooftriploc); + // console.log(Freightrateloc); + // console.log(AfterFreightAmountloc); + + var Total = (parseFloat(basicval)+parseFloat(AfterCgst)+parseFloat(AfterSgst)+parseFloat(AfterIgst)+parseFloat(OtherAmt)-parseFloat(AfterDisVal)).toFixed(2); @@ -3398,6 +3637,10 @@ var purchaseRate = $('#purchaserate').val(); var TotalTaxValue = calculateTaxValue(); var basicvalInINR=$('#AfterBasicPriceTax').val(); var CapitalDescription =$('#ItemDescription').val(); + + + + $('#MaterialCode option[value='+materialCode+']').remove(); @@ -3476,6 +3719,8 @@ var purchaseRate = $('#purchaserate').val(); addHidden(theForm,"Igst"+temp,Igst); addHidden(theForm,"AfterIgst"+temp,AfterIgst); addHidden(theForm,"OtherAmt"+temp,OtherAmt); + + addHidden(theForm,"FreightType"+temp,FreightType); addHidden(theForm,"FreightVal"+temp,FreightVal); addHidden(theForm,"AfterFreightVal"+temp,AfterFreightVal); @@ -3486,6 +3731,14 @@ var purchaseRate = $('#purchaserate').val(); addHidden(theForm,"DisVal"+temp,DisVal); addHidden(theForm,"AfterDisVal"+temp,AfterDisVal); $('#txtRowCount').val(temp); + + addHidden(theForm,"FreightTypeloc"+temp,FreightTypeloc); + addHidden(theForm,"NoofTriploc"+temp,Nooftriploc); + addHidden(theForm,"FreightRateloc"+temp,Freightrateloc); + addHidden(theForm,"AfterFreightRateloc"+temp,AfterFreightAmountloc); + + // var a=parseFloat($('#NoofTriploc'+temp).val()); + // console.log(Nooftriploc); clearCapitalModalFields(); @@ -3666,6 +3919,11 @@ var purchaseRate = $('#purchaserate').val(); var purchaseRate = $('#purchaserate').val() == '' ? '0.00' : $('#purchaserate').val(); var CustomDutyExpenses = $('#CustomDutyExpenses').val() == '' ? '0.00' : $('#CustomDutyExpenses').val(); var RMCIncludingCustomers = $('#RMCIncludingCustomers').val() == '' ? '0.00' : $('#RMCIncludingCustomers').val(); + + + + + var AfterFreight = $('#txtAfterFreightloc').val() == '' ? '0.00' : $('#txtAfterFreightloc').val(); // var totvalue = $('#txtTotalOrderValue').val() == '' ? '0.00' : $('#txtTotalOrderValue').val(); var totvalue = (parseFloat(AfterCgst)+parseFloat(AfterSgst)+parseFloat(AfterIgst)).toFixed(2); @@ -3676,6 +3934,10 @@ var purchaseRate = $('#purchaserate').val(); var TotSgst = $('#txtTotSgst').val() == '' ? '0.00' : $('#txtTotSgst').val(); var TotalIgst = $('#txtTotIgst').val() == '' ? '0.00' : $('#txtTotIgst').val(); var TotalAllowance = $('#TotalOtherAllowances').val() == '' ? '0.00' : $('#TotalOtherAllowances').val(); + + + + var totfreight=$('#TotalFreight').val() == '' ? '0.00' : $('#TotalFreight').val(); var TotLanding = $('#txttotallanding').val() == '' ? '0.00' : $('#txttotallanding').val(); var TotHighseas = $('#txttotalhighseas').val() == '' ? '0.00' : $('#txttotalhighseas').val(); @@ -3698,6 +3960,14 @@ var purchaseRate = $('#purchaserate').val(); $('#txtTotIgst').val((parseFloat(TotalIgst) + parseFloat(AfterIgst)).toFixed(2) ); $('#TotalOtherAllowances').val((parseFloat(TotalAllowance) + parseFloat(OtherAmt)).toFixed(2) ); + + + + $('#TotalFreight').val((parseFloat(totfreight) + parseFloat(AfterFreight)).toFixed(2) ); + + + + $('#txttotallanding').val((parseFloat(TotLanding) + parseFloat(landingCharge)).toFixed(2) ); $('#txttotalhighseas').val((parseFloat(TotHighseas) + parseFloat(HighSeasSalesCharge)).toFixed(2) ); $('#txttotalcustom').val((parseFloat(TotCustom) + parseFloat(CustomDuty)).toFixed(2) ); @@ -3786,6 +4056,12 @@ $('#PurQuantity').val(''); $("#DiscountType").val('0'); $("#txtDiscount").val(''); $("#txtAfterDiscount").val(''); + + $("#drpFreightloc").val('0'); + $("#NOOfTripsloc").val(''); + $("#txtFreightloc").val(''); + $("#txtAfterFreightloc").val(''); + } @@ -4111,6 +4387,26 @@ function DeleteRow(rowid) $('#txtEditAfterFreight').val($('#AfterFreightVal'+userid).val()); $('#EditNOOfTrips').val($('#NoOfTrip'+userid).val()); $("#drpEditFreight").val($('#FreightType'+userid).val()); + + + $("#drpFreighteditloc").val($('#FreightTypeloc'+userid).val()); + $("#NOOfTripslocedit").val($('#NoofTriploc'+userid).val()); + $("#txtFreightlocedit").val($('#FreightRateloc'+userid).val()); + $("#txtAfterFreightlocedit").val($('#AfterFreightRateloc'+userid).val()); + + + var FreightTypeloc=$('#FreightTypeloc'+userid).val(); + + if (FreightTypeloc == '') + { + $('#TripsValuelocedit').show(); + } + else + { + $('#TripsValuelocedit').hide(); + } + + var FreightType =$('#FreightType'+userid).val(); @@ -4389,11 +4685,14 @@ function clearAfterAddLineItemAdd(){ $('#txtEditAfterDiscount').val(updateDiscountValuesChange(parseFloat(Tot).toFixed(2),$("#EditDiscountType").val(),$('#txtEditDiscount').val())); } var discountedValue = parseFloat($('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val()).toFixed(2); + + var Freight=parseFloat($('#txtAfterFreightlocedit').val() == '' ? '0.00' : $('#txtAfterFreightlocedit').val()).toFixed(2); txtExchangeRate=1; var BasicInINR=Tot * txtExchangeRate - discountedValue; } - + var editCPtotal=parseFloat(BasicInINR)+parseFloat(Freight); + $('#EditCPTotalAmount').val(parseFloat(Tot).toFixed(2)); $('#EditAfterBasicPriceTax').val(Math.round(BasicInINR)); //ExceedBudget($('#CPTotalAmount').val(),$('#CapitalbudAmt').val()); @@ -4402,9 +4701,9 @@ function clearAfterAddLineItemAdd(){ //Service Tax calculation - $('#EditAfterCgst').val(calculateCgstTax($('#EditAfterBasicPriceTax').val(),$("#EditCgst").val()== '' ? "0.00" : $('#EditCgst').val())); - $('#EditAfterSgst').val(calculateSgstTax($('#EditAfterBasicPriceTax').val(),$("#EditSgst").val()== '' ? "0.00" : $('#EditSgst').val())); - $('#EditAfterIgst').val(calculateIgstTax($('#EditAfterBasicPriceTax').val(),$("#Editigst").val()== '' ? "0.00" : $('#EditIgst').val())); + $('#EditAfterCgst').val(calculateCgstTax(editCPtotal,$("#EditCgst").val()== '' ? "0.00" : $('#EditCgst').val())); + $('#EditAfterSgst').val(calculateSgstTax(editCPtotal,$("#EditSgst").val()== '' ? "0.00" : $('#EditSgst').val())); + $('#EditAfterIgst').val(calculateIgstTax(editCPtotal,$("#Editigst").val()== '' ? "0.00" : $('#EditIgst').val())); // This is for import basic price @@ -4622,6 +4921,15 @@ function clearAfterAddLineItemAdd(){ var basicvalInINR=$('#EditAfterBasicPriceTax').val(); var EditCapitalDescription = $("#EditItemDescription").val(); + + var FreightTypeloc=$('#drpFreighteditloc').val(); + var FreightRateloc=$('#txtFreightlocedit').val(); + var FreightRateAmountloc=$('#txtAfterFreightlocedit').val(); + var Nooftriploc=$('#NOOfTripslocedit').val(); + + + + var DisType = $("#EditDiscountType").val(); var DisVal = $("#txtEditDiscount").val(); @@ -4700,6 +5008,12 @@ function clearAfterAddLineItemAdd(){ $('#AfterFreightVal'+userid).val(AfterFreightVal); $('#CapitalItemDescrition'+userid).val(EditCapitalDescription); + + $('#FreightTypeloc'+userid).val(FreightTypeloc); + $('#NoofTriploc'+userid).val(Nooftriploc); + $('#FreightRateloc'+userid).val(FreightRateloc); + $('#AfterFreightRateloc'+userid).val(FreightRateAmountloc); + cellval[2].innerHTML = materialCode; cellval[3].innerHTML = materialName; @@ -4904,6 +5218,7 @@ function validateEditCapitalTax() var TotFreight =0; var TotDiscount=0; var TotBasicAmt =0; + var TotaFreight =0; for (var i = 1; i < rows; i++) { var TotalOrderValueSummaryI = $('#ServiceTotalOrderValue'+i).val() == '' ? '0.00' : $('#ServiceTotalOrderValue'+i).val(); @@ -4912,6 +5227,10 @@ function validateEditCapitalTax() var TotalSgstI = $('#AfterSgst'+i).val() == '' ? '0.00' : $('#AfterSgst'+i).val(); var TotalIgstI = $('#AfterIgst'+i).val() == '' ? '0.00' : $('#AfterIgst'+i).val(); var TotOtherI = $('#OtherAmt'+i).val() == '' ? '0.00' : $('#OtherAmt'+i).val(); + + var TotalFreight = $('#AfterFreightRateloc'+i).val() == '' ? '0.00' : $('#AfterFreightRateloc'+i).val(); + //console.log(TotalFreight); + var discountedRateValue = $('#AfterDisVal'+i).val() == '' ? '0.00' : $('#AfterDisVal'+i).val(); var TotLandingI = $('#landingCharge'+i).val() == '' ? '0.00' : $('#landingCharge'+i).val(); var TotHighseasI = $('#HighSeasSalesCharge'+i).val() == '' ? '0.00' : $('#HighSeasSalesCharge'+i).val(); @@ -4931,22 +5250,25 @@ function validateEditCapitalTax() var CapitalToatlOrderI = $('#basicval'+i).val() == '' ? '0.00' : $('#basicval'+i).val(); CapitalToatlOrderI = CapitalToatlOrderI - discountedRateValue; var TotBasicAmtI=parseFloat(CapitalToatlOrderI) + parseFloat(discountedRateValue); - TotCgst = parseFloat(TotCgst) + parseFloat(TotalCgstI); + TotCgst = parseFloat(TotCgst) + parseFloat(TotalCgstI); TotSgst = parseFloat(TotSgst) + parseFloat(TotalSgstI); TotIgst = parseFloat(TotIgst) + parseFloat(TotalIgstI); TotOther = parseFloat(TotOther) + parseFloat(TotOtherI); + TotaFreight=parseFloat(TotaFreight)+parseFloat(TotalFreight); + + // console.log(TotaFreight); TotLanding = parseFloat(TotLanding) + parseFloat(TotLandingI); - TotHighseas = parseFloat(TotHighseas) + parseFloat(TotHighseasI); + TotHighseas = parseFloat(TotHighseas) + parseFloat(TotHighseasI); TotCustom = parseFloat(TotCustom) + parseFloat(TotCustomI); TotExcise = parseFloat(TotExcise) + parseFloat(TotExciseI); TotExciseED = parseFloat(TotExciseED) + parseFloat(TotExciseEDI); TotExciseSH = parseFloat(TotExciseSH) + parseFloat(TotExciseSHI); TotCustomED = parseFloat(TotCustomED) + parseFloat(TotCustomEDI); - TotCustomSH = parseFloat(TotCustomSH) + parseFloat(TotCustomSHI); - TotAdditionalExciseduty = parseFloat(TotAdditionalExciseduty) + parseFloat(TotAdditionalExcisedutyI); - TotGrossduty = parseFloat(TotGrossduty) + parseFloat(TotGrossdutyI); - TotAvlmodvat = parseFloat(TotAvlmodvat) + parseFloat(TotAvlmodvatI); + TotCustomSH = parseFloat(TotCustomSH) + parseFloat(TotCustomSHI); + TotAdditionalExciseduty = parseFloat(TotAdditionalExciseduty) + parseFloat(TotAdditionalExcisedutyI); + TotGrossduty = parseFloat(TotGrossduty) + parseFloat(TotGrossdutyI); + TotAvlmodvat = parseFloat(TotAvlmodvat) + parseFloat(TotAvlmodvatI); TotGrossexpense = parseFloat(TotGrossexpense) + parseFloat(TotGrossexpenseI); TotalOrderValueSummary = parseFloat(TotalOrderValueSummary) + parseFloat(TotalOrderValueSummaryI); @@ -4961,6 +5283,7 @@ function validateEditCapitalTax() $('#txtTotSgst').val(parseFloat(TotSgst).toFixed(2) ); $('#txtTotIgst').val(parseFloat(TotIgst).toFixed(2) ); $('#TotalOtherAllowances').val(parseFloat(TotOther).toFixed(2) ); + $('#TotalFreight').val(parseFloat(TotaFreight).toFixed(2) ); $('#txttotallanding').val((parseFloat(TotLanding) ).toFixed(2) ); $('#txttotalhighseas').val((parseFloat(TotHighseas) ).toFixed(2) ); @@ -5068,7 +5391,14 @@ function SetCapitalPo() function calculateCgstTax(varBasicValue,Cgst) { - var basicValue = parseFloat(varBasicValue); + var basicValue1 = parseFloat(varBasicValue); + + var Freight=parseFloat($('#txtAfterFreightloc').val() == '' ? '0.00' : $('#txtAfterFreightloc').val()).toFixed(2); + + var basicValue=basicValue1; + + + var Cgst = parseFloat(Cgst); var ServiceTaxValue = 0.0; @@ -5733,6 +6063,342 @@ function updateDiscountValuesChange(totAmt,disType,disAmt){ var discount = parseFloat(AfterDiscount).toFixed(2); return discount; } + + + + + +$('#drpFreightloc').change(function() +{ + var FreightType =$("#drpFreightloc").val(); + + if (FreightType == "PER TRIP") + { + + $('#TripsValueloc').show(); + } + else { + + $('#TripsValueloc').hide(); + } + + + if($('#Rate').val() != '' && $('#MaterialCode').val() != "0" ) + { + selValue = $("#drpFreightloc").val() ; + + + $('#txtFreightloc').val(''); + $('#txtAfterFreight').val(''); + var PackagingCalculation=''; + + if (selValue == '') + { + + $('#txtFreightloc').attr('readonly', 'true'); + $('#txtFreightloc').val('0.00'); + + } + + + + if(selValue == '') + { + var PackagingCalculation = ''; + $('#packagingcalmodel').modal('show'); + //PackagingCalculation = $("input:radio[name='optPackaging']:checked").val(); + + } + + else + { + $('#txtFreightloc').removeAttr( 'readonly','true' ); + $('#txtFreightloc').val(''); + + calculateFreightlocaddper() + + } + + } + else + { + alert('Please Select MaterialCode and Rate Field Value'); + $('#drpFreightloc').val("0"); + $('#Rate').focus(); + } + +}); + + + +function calculateFreightlocaddper() +{ + +var Calculation = document.querySelector('input[name = "optPackaging"]:checked').value; + var FreightType =$("#drpFreightloc").val(); + $('#packagingcalmodel').modal('hide'); + + + if(FreightType=='') + { + + $('#txtAfterFreightloc').val(''); + if(Calculation==0) + { + var basicValue = $('#CPTotalAmount').val() == '' ? '0.00' : $('#CPTotalAmount').val(); + var FreightValue = $('#txtFreightloc').val() == '' ? '0.00' : $('#txtFreightloc').val(); + var AfterFreight = ; + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightloc').val(txtAfterFreightloc); + + } + + else if(Calculation==1) + { + + var basicinrValue=$('#CPTotalAmount').val() == '' ? '0.00' : $('#CPTotalAmount').val(); + var discount=$('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(); + var basicValue=basicinrValue-discount; + var FreightValue = $('#txtFreightloc').val() == '' ? '0.00' : $('#txtFreightloc').val(); + var AfterFreight = ; + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightloc').val(txtAfterFreightloc); + + } + } + + else if(FreightType == '') + { + $('#txtAfterFreightloc').val(''); + AfterFreight = 0.00; + $('#txtFreightloc').val(''); + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightloc').val(txtAfterFreightloc); + document.getElementById("txtAfterFreightloc").readOnly = true; + document.getElementById("txtFreightloc").readOnly = true; + } + + + else if(FreightType == '') + { + $('#txtAfterFreightloc').val(''); + var FreightValue = $('#txtFreightloc').val() == '' ? '0.00' : $('#txtFreightloc').val(); + AfterFreight = ; + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightloc').val(txtAfterFreightloc); + document.getElementById("txtAfterFreightloc").readOnly = true; + + + } + + + else if(FreightType == '') + { + $('#txtAfterFreightloc').val(''); + var FreightValue = $('#txtFreightloc').val() == '' ? '0.00' : $('#txtFreightloc').val(); + var Quantity= $('#CPQuantity').val() == '' ? '0.00' : $('#CPQuantity').val(); + AfterFreight = ; + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightloc').val(txtAfterFreightloc); + } + + + else if(FreightType == '') + { + $('#txtAfterFreightloc').val(''); + var FreightValue = $('#txtFreightloc').val() == '' ? '0.00' : $('#txtFreightloc').val(); + var noOftrip = $('#NOOfTripsloc').val() == '' ? '0.00' : $('#NOOfTripsloc').val(); + + AfterFreight = ; + + AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2); + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightloc').val(txtAfterFreightloc); + + } + + else + { + + $('#txtAfterFreightloc').val(''); + var FreightValue = $('#txtFreightloc').val() == '' ? '0.00' : $('#txtFreightloc').val(); + var txtAfterFreightloc= parseFloat(FreightValue).toFixed(2); + $('#txtAfterFreightloc').val(txtAfterFreightloc); + + } + + +} + + + + + +$('#drpFreighteditloc').change(function() +{ + var FreightType =$("#drpFreighteditloc").val(); + + if (FreightType == "PER TRIP") + { + + $('#TripsValuelocedit').show(); + } + else { + + $('#TripsValuelocedit').hide(); + } + + + if($('#EditCPRate').val() != '' && $('#EditMaterialCode').val() != "0" ) + { + selValue = $("#drpFreighteditloc").val() ; + + + $('#txtFreightlocedit').val(''); + $('#txtAfterFreightlocedit').val(''); + var PackagingCalculation=''; + + if (selValue == '') + { + + $('#txtFreightlocedit').attr('readonly', 'true'); + $('#txtFreightlocedit').val('0.00'); + + } + + + + if(selValue == '') + { + var PackagingCalculation = ''; + $('#editpackagingcalmodel').modal('show'); + //PackagingCalculation = $("input:radio[name='optPackaging']: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=='') + { + + $('#txtAfterFreightlocedit').val(''); + if(Calculation==0) + { + var basicValue = $('#EditCPTotalAmount').val() == '' ? '0.00' : $('#EditCPTotalAmount').val(); + var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val(); + var AfterFreight = ; + 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 = ; + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightlocedit').val(txtAfterFreightloc); + + } + } + + else if(FreightType == '') + { + $('#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 == '') + { + $('#txtAfterFreightlocedit').val(''); + var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val(); + AfterFreight = ; + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightlocedit').val(txtAfterFreightloc); + document.getElementById("txtAfterFreightlocedit").readOnly = true; + + + } + + + else if(FreightType == '') + { + $('#txtAfterFreightlocedit').val(''); + var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val(); + var Quantity= $('#EditCPQuantity').val() == '' ? '0.00' : $('#EditCPQuantity').val(); + AfterFreight = ; + var txtAfterFreightloc= parseFloat(AfterFreight).toFixed(2); + $('#txtAfterFreightlocedit').val(txtAfterFreightloc); + } + + + else if(FreightType == '') + { + $('#txtAfterFreightlocedit').val(''); + var FreightValue = $('#txtFreightlocedit').val() == '' ? '0.00' : $('#txtFreightlocedit').val(); + var noOftrip = $('#NOOfTripslocedit').val() == '' ? '0.00' : $('#NOOfTripslocedit').val(); + + AfterFreight = ; + + 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(); +} + + + + diff --git a/application/views/editCapitalAmendPO.php b/application/views/editCapitalAmendPO.php index eaa88e08..d825615c 100755 --- a/application/views/editCapitalAmendPO.php +++ b/application/views/editCapitalAmendPO.php @@ -25,6 +25,8 @@ $TotalIGST = 0.0; $Totalotherallowances = 0.0; $TotalDiscountedAmt=0.0; + + $TotalFreightvalue=0.0; $TotalSummary = 0.0; $TotalBasicAmount = 0.0; @@ -216,6 +218,13 @@ else { .content-wrapper { min-height:600px ! important; } + + + +#editpackagingcalmodel { + margin-top:200px; + z-index: 1080 !important; + } diff --git a/application/views/editCapitalPo.php b/application/views/editCapitalPo.php index 4b8481a2..c99d03c8 100755 --- a/application/views/editCapitalPo.php +++ b/application/views/editCapitalPo.php @@ -21,6 +21,7 @@ $TotalSgst = 0.0; $TotalIgst = 0.0; $OtherAmt = 0.0; + $TotalFreightvalue=0.0; $TotalSummary = 0.0; $TotalBasicAmount = 0.0; @@ -217,6 +218,25 @@ else { .content-wrapper { min-height:600px ! important; } + + + + #packagingcalmodel { + margin-top:200px; + z-index: 1080 !important; + } + + + #editpackagingcalmodel { + margin-top:200px; + z-index: 1080 !important; + } + + + #viewpackagingcalmodel { + margin-top:200px; + z-index: 1080 !important; + }