From 2d9a57a77eafcf8095b0f9748e3f4281eeca9106 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 19 Jun 2017 11:25:35 +0530 Subject: [PATCH] import po --- application/config/constants.php | 2 +- application/controllers/purchaseorder.php | 6 +++++- application/models/purchaseorder_model.php | 23 ++++++++++++++++++++++ application/views/importpo.php | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/application/config/constants.php b/application/config/constants.php index c06a3056..7835550e 100755 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -172,7 +172,7 @@ define('GROSS_DUTY', 'landingcha+highsesssalless+customcha+excisecha+exciseedc define('PURCHASE_RATE', 'txtbasicinrprice/txtCtablequantity'); define('CUSTOMDUTY_EXP', 'txtgrossexp/txtCtablequantity'); define('RMC_CAL', 'txtpurchaserate+txtcustomdutyexp'); -define('CALCULATE_TOTAL', 'txtrmc+basicamt'); +define('CALCULATE_TOTAL', '(txtrmc*quantity)+basicprice'); diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 4ff8d3ba..c3bd4d08 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -864,6 +864,10 @@ public function importpoprint($PONO) { $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); } + else If($POType == IMPORT) + { + $this->purchaseorder_model->DeletePOImportTax($LineItemNo); + } $this->purchaseorder_model->DeletePOLineItem($LineItemNo , $ReqNo,$MaterialCode); echo "Successfully Deleted the Line item".$LineItemNo; @@ -1140,7 +1144,7 @@ public function importpoprint($PONO) $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); } - $isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo); + $isExists = $this->purchaseorder_model->LineItemExistsinImportTax($LineItemNo); if(count($isExists) == 0) { $ImportTaxList = array('LineItemNo'=>$LineItemNo, 'ExchangeRate'=>$Exchangerate,'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,'CurrencyType'=>$currencytypeID); diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index dbeccd64..1c4ba21c 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -633,6 +633,19 @@ function GetCurrencytype() return $query->result_array(); } } + + + function LineItemExistsinImportTax($LineItemNo) + { + $this->db->select('LineItemNo'); + $this->db->from('T_Import_Tax'); + $this->db->where('LineItemNo ',$LineItemNo ); + $query = $this->db->get(); + + if ($query->num_rows > 0) { + return $query->result_array(); + } + } // To Update the PO Line Item function updatePOLineItem($PONO,$LineItemNo,$PODetails) { @@ -664,6 +677,16 @@ function GetCurrencytype() return TRUE; } + + function updateImportTax($LineItemNo,$PODetails) + { + $this->db->where('LineItemNo', $LineItemNo); + $this->db->update('T_Import_Tax', $PODetails); + + // print_r($this->db->last_query()); + + return TRUE; + } function getLastInsertedPO() { diff --git a/application/views/importpo.php b/application/views/importpo.php index a5d25ab9..323ce0b1 100644 --- a/application/views/importpo.php +++ b/application/views/importpo.php @@ -2532,6 +2532,7 @@ function CalculateCtable() $('#RMCIncludingCustomers').val(Math.round(txtrmc)); } quantity=parseFloat($('#Quantity').val()); + basicprice=parseFloat($('#txtBasicValue').val()); total=; if(isNaN(total)) {