diff --git a/application/controllers/amendmentpurchaseorder.php b/application/controllers/amendmentpurchaseorder.php index 4fd450f4..bfe2c17a 100755 --- a/application/controllers/amendmentpurchaseorder.php +++ b/application/controllers/amendmentpurchaseorder.php @@ -17,53 +17,53 @@ class amendmentpurchaseorder extends BaseController public function __construct() { parent::__construct(); - $this->load->model('purchaseorder_model'); + $this->load->model('purchaseorder_model'); $this->load->library('session'); $this->load->library('form_validation'); $this->isLoggedIn(); - } - + } + /** * Index Page for this controller(default function of the class) */ public function index() { - $this->load->library('pagination'); - $forwhat='amendment'; - $data['POData'] = $this->purchaseorder_model->purchaseorderListing($forwhat); + $this->load->library('pagination'); + $forwhat='amendment'; + $data['POData'] = $this->purchaseorder_model->purchaseorderListing($forwhat); $this->global['pageTitle'] = 'Siddharth : Amendment Purchase Order'; - $this->loadviews('AmendPOlist',$this->global,$data,NULL); + $this->loadviews('AmendPOlist',$this->global,$data,NULL); } - - /** + + /** * For editing purpose and it has oldest all released po. */ - function EditAmendPurchaseOrder() - { - $PONO = $_GET['PONO']; - $ReqType = $_GET['ReqType']; - - $Req = $this->purchaseorder_model->getRequistionNoFromPO($PONO); - $data['ReqList'] = $Req ; - $result = array(); - $ReqArray = array(); - $Status = ''; - - foreach ($Req as $SID): - $ReqArray[] = $SID->ReqNo ; - $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); - - endforeach; - $data['MaterialList'] = $result; - $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); - $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); - $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); - /* Cost code from Requisition - Client Review Fix - Start here */ - $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); - $data['RequistionDetails'] = $ReqDetails; - + function EditAmendPurchaseOrder() + { + $PONO = $_GET['PONO']; + $ReqType = $_GET['ReqType']; + + $Req = $this->purchaseorder_model->getRequistionNoFromPO($PONO); + $data['ReqList'] = $Req ; + $result = array(); + $ReqArray = array(); + $Status = ''; + + foreach ($Req as $SID): + $ReqArray[] = $SID->ReqNo ; + $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); + + endforeach; + $data['MaterialList'] = $result; + $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); + $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); + $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); + /* Cost code from Requisition - Client Review Fix + Start here */ + $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); + $data['RequistionDetails'] = $ReqDetails; + foreach ($data['RequistionDetails'] as $ReqDet) { @@ -76,126 +76,126 @@ class amendmentpurchaseorder extends BaseController { $Status=$POST->StatusName; } - $CostCode = ''; - $this->load->model('costcenter_model'); - - $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - - if(!empty($FiscalYear)) - { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; - } - } - - $FYdt = $FYStart." - ".$FYEnd ; + $CostCode = ''; + $this->load->model('costcenter_model'); + + $FYStart = ''; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + + if(!empty($FiscalYear)) + { + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; + } + } + + $FYdt = $FYStart." - ".$FYEnd ; foreach ($ReqDetails as $Rs): $CostCode = $Rs->CostCenterCode; endforeach; - $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); + $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } - /* End Here */ - - $data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO); - $data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate(); - $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); - $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); + if(count($AvlBudget)>0) + { + $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; + } + /* End Here */ + + $data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO); + $data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate(); + $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); + $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - if($ReqType == SERVICE) - { - - $data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetails($PONO); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); - $this->global['pageTitle'] = 'Siddharth : Edit Service Purchase order form'; - $this->loadViews("editServiceAmendPO", $this->global, $data, NULL); - } - else if($ReqType == REVENUE) - { - - $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($PONO); - $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $this->global['pageTitle'] = 'Siddharth : Edit Revenue Purchase order form'; - $this->loadViews("editRevenueAmendPO", $this->global, $data, NULL); - } - else if($ReqType == IMPORT) + if($ReqType == SERVICE) + { + + $data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetails($PONO); + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); + $this->global['pageTitle'] = 'Siddharth : Edit Service Purchase order form'; + $this->loadViews("editServiceAmendPO", $this->global, $data, NULL); + } + else if($ReqType == REVENUE) + { + + $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($PONO); + $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + $this->global['pageTitle'] = 'Siddharth : Edit Revenue Purchase order form'; + $this->loadViews("editRevenueAmendPO", $this->global, $data, NULL); + } + else if($ReqType == IMPORT) { - $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$ReqType); - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } + $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$ReqType); + if(count($AvlBudget)>0) + { + $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; + } - $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); - $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); + $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - foreach($data['POMaster'] as $CUR) - { - $Currency=$CUR->CurrencyType; - } + foreach($data['POMaster'] as $CUR) + { + $Currency=$CUR->CurrencyType; + } - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); + $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); - $unicode =''; - foreach ($data['CurrencyDetail'] as $Detail) - { - $unicode=$Detail->FontCode2000; - } + $unicode =''; + foreach ($data['CurrencyDetail'] as $Detail) + { + $unicode=$Detail->FontCode2000; + } - foreach ($data['CurrencyDetail'] as $Detail) - { - $currencycode=$Detail->Currency_Code; - } + foreach ($data['CurrencyDetail'] as $Detail) + { + $currencycode=$Detail->Currency_Code; + } - $data['unicode']=$unicode; - $data['currencycode']=$currencycode; - $this->global['pageTitle'] = 'Siddharth : Edit Import Purchase order form'; - $this->loadViews("editImportAmendPO", $this->global, $data, NULL); + $data['unicode']=$unicode; + $data['currencycode']=$currencycode; + $this->global['pageTitle'] = 'Siddharth : Edit Import Purchase order form'; + $this->loadViews("editImportAmendPO", $this->global, $data, NULL); } - else if($ReqType == CAPITAL) + else if($ReqType == CAPITAL) { $CapitalRange = $_GET['CapitalRange']; $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - - if(count($CapitalAvlBudget)>0) - { - $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; - } + + if(count($CapitalAvlBudget)>0) + { + $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; + } if($CapitalRange=='0'){ $data['POItem'] = $this->purchaseorder_model->getCapitalPurchaseOrderDetails($PONO); - } + } else if($CapitalRange=='1'){ $data['POItem'] = $this->purchaseorder_model->getDomesticCapitalPurchaseOrderDetails($PONO); - } + } $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); - $CapitalRange=''; + $CapitalRange=''; foreach($data['POItem'] as $Rate) { - $exRate=$Rate->ExchangeRate; + $exRate=$Rate->ExchangeRate; $CapitalRange=$Rate->CapitalRange; - } + } foreach($data['POItem'] as $CUR) { $Currency=$CUR->CurrencyType; - } + } if($CapitalRange=='0'){ @@ -210,82 +210,82 @@ class amendmentpurchaseorder extends BaseController $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); } - $this->global['pageTitle'] = 'Siddharth : Edit Capital Purchase order form'; + $this->global['pageTitle'] = 'Siddharth : Edit Capital Purchase order form'; $this->loadViews("editCapitalAmendPO", $this->global, $data, NULL); } - - } - - /** - * To Store release Revenue Po values after edit - */ - function EditRevenuePurchaseOrder() - { - - $NewPO=''; - $MAD=''; - $PONO =$this->input->post('txtPONO'); - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); + + } + + /** + * To Store release Revenue Po values after edit + */ + function EditRevenuePurchaseOrder() + { + + $NewPO=''; + $MAD=''; + $PONO =$this->input->post('txtPONO'); + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); - $POType = $this->input->post('POType'); - $DeliveryAddr = $this->input->post('txtDeliveryAddress'); - $dt = $this->input->post('Deliverydt'); - $predeliverydate=$this->input->post('beforeDeliverydt'); - $preschedule=$this->input->post('beforeScheduleby'); - $DeliverySchedule1 = $this->input->post('Scheduleby'); - $DeliveryOption = $this->input->post('DateRange'); + $POType = $this->input->post('POType'); + $DeliveryAddr = $this->input->post('txtDeliveryAddress'); + $dt = $this->input->post('Deliverydt'); + $predeliverydate=$this->input->post('beforeDeliverydt'); + $preschedule=$this->input->post('beforeScheduleby'); + $DeliverySchedule1 = $this->input->post('Scheduleby'); + $DeliveryOption = $this->input->post('DateRange'); - if($DeliveryOption==1){ - $Deliverydt=null; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; - } - - $Modeofshipment=$this->input->post('addmodeofshipment'); - $supplierreference=$this->input->post('amendsupplierreference'); - $supplieroffno=$this->input->post('amendsupplierofferno'); - $otherreference=$this->input->post('amendotherreference'); - $fincap=$this->input->post('amendfincap'); - $revenuetype=$this->input->post('PoTypeOptions'); - $insurancestatus=$this->input->post('insurancestatus'); - if($insurancestatus == 1){ - $insuranceno=$this->input->post('insuranceno'); - }else{ - $insuranceno=""; - } - - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('Range'); - $PaymentTermsText=$this->input->post('beforePaymentTermsText'); - $PaymentTerms=$this->input->post('PaymentTerms'); - $Otherpayment=$this->input->post('Otherpayment'); - $Otherpaymentamend=$this->input->post('Otherpayment'); - $prePaymentTerms=$this->input->post('beforePaymentTerms'); - $preTotalOdervalue=$this->input->post('preTotalOdervalue'); - $MAD.="Current TotalOrder Value:  :" . $preTotalOdervalue ."
"; - $testdate=date("Y-m-d"); + if($DeliveryOption==1){ + $Deliverydt=null; + $DeliverySchedule = $this->input->post('Scheduleby'); + } + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; + } + + $Modeofshipment=$this->input->post('addmodeofshipment'); + $supplierreference=$this->input->post('amendsupplierreference'); + $supplieroffno=$this->input->post('amendsupplierofferno'); + $otherreference=$this->input->post('amendotherreference'); + $fincap=$this->input->post('amendfincap'); + $revenuetype=$this->input->post('PoTypeOptions'); + $insurancestatus=$this->input->post('insurancestatus'); + if($insurancestatus == 1){ + $insuranceno=$this->input->post('insuranceno'); + }else{ + $insuranceno=""; + } + + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('Range'); + $PaymentTermsText=$this->input->post('beforePaymentTermsText'); + $PaymentTerms=$this->input->post('PaymentTerms'); + $Otherpayment=$this->input->post('Otherpayment'); + $Otherpaymentamend=$this->input->post('Otherpayment'); + $prePaymentTerms=$this->input->post('beforePaymentTerms'); + $preTotalOdervalue=$this->input->post('preTotalOdervalue'); + $MAD.="Current TotalOrder Value:  :" . $preTotalOdervalue ."
"; + $testdate=date("Y-m-d"); if($PaymentTerms!=$prePaymentTerms) - { - if($prePaymentTerms != 'PT08'){ $Otherpaymentamend='';} - $MAD.="Current PaymentTerms :  ". $PaymentTermsText . $Otherpaymentamend ."
"; - } - - if(($dt != $predeliverydate)|| ($DeliverySchedule1 != $preschedule)) - { - $MAD.='Current Delivery Option :    ' . $predeliverydate . $preschedule . '
' ; - } - - $SpecialInstruction = $this->input->post('txtSpcialInstruction'); - $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - $POStatus = $this->input->post('txtStatus'); + { + if($prePaymentTerms != 'PT08'){ $Otherpaymentamend='';} + $MAD.="Current PaymentTerms :  ". $PaymentTermsText . $Otherpaymentamend ."
"; + } + + if(($dt != $predeliverydate)|| ($DeliverySchedule1 != $preschedule)) + { + $MAD.='Current Delivery Option :    ' . $predeliverydate . $preschedule . '
' ; + } + + $SpecialInstruction = $this->input->post('txtSpcialInstruction'); + $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); + $POStatus = $this->input->post('txtStatus'); $updatedBy = $this->session->userdata ( 'userId' ); - $RowCount = $this->input->post('txtRowCount'); - $dtt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updateddt = $dtt->format('Y-m-d H:i:s'); + $RowCount = $this->input->post('txtRowCount'); + $dtt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $updateddt = $dtt->format('Y-m-d H:i:s'); $qtycheck = $this->purchaseorder_model->getqtycheck($PONO); $qtycheckresult=''; @@ -294,33 +294,33 @@ class amendmentpurchaseorder extends BaseController $qtycheckresult= $qty->IsQualityChkReqired; } - if(empty($Deliverydt)) - { - $Deliverydt=null; - } - - if($PaymentTerms != 'PT08'){ - $Otherpayment=''; - - } - - $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID,'POType'=>$POType,'PORange'=>$PoRange,'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>PO_RELEASED,'PaymentTerms'=>$PaymentTerms,'PaymentOtherDescription'=>$Otherpayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Reference'=>$supplierreference,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'InsuranceNumber'=>$insuranceno,'POSubType'=>$revenuetype,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpecialInstruction,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'AmendedDetails'=>$MAD,'IsQualityChkReqired'=>$qtycheckresult); - $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$updatedBy,$PONO); - if(count($LastPO)>0) - { - $NewPO = $LastPO[0]['PONO']; - } - - $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - - $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - - $LineItemStatus = REQITEM_NEW; + if(empty($Deliverydt)) + { + $Deliverydt=null; + } + + if($PaymentTerms != 'PT08'){ + $Otherpayment=''; + + } + + $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID,'POType'=>$POType,'PORange'=>$PoRange,'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>PO_RELEASED,'PaymentTerms'=>$PaymentTerms,'PaymentOtherDescription'=>$Otherpayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Reference'=>$supplierreference,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'InsuranceNumber'=>$insuranceno,'POSubType'=>$revenuetype,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpecialInstruction,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'AmendedDetails'=>$MAD,'IsQualityChkReqired'=>$qtycheckresult); + $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$updatedBy,$PONO); + if(count($LastPO)>0) + { + $NewPO = $LastPO[0]['PONO']; + } + + $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS + + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); + + $LineItemStatus = REQITEM_NEW; - $igrvalue = $this->purchaseorder_model->selectigrmaster($PONO); + $igrvalue = $this->purchaseorder_model->selectigrmaster($PONO); $po = ''; @@ -333,7 +333,7 @@ class amendmentpurchaseorder extends BaseController // } foreach ($igrvalue as $value) { - + $igrno = $value->IGRNO; $po =$value->PONO; @@ -350,302 +350,281 @@ foreach ($igrvalue as $value) { } + for ($i = 1; $i <= $RowCount; $i++) + { + + $CAD=''; + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $preqty=$this->input->post('beforeqty'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $itemRate = $this->input->post('itemRate'.$i); + $preitemrate=$this->input->post('beforeitemRate'.$i); + $per=$this->input->post('per'.$i); + $servicematerialdescription=$this->input->post('service_description'.$i); + + $DiscountType = $this->input->post('DisType'.$i); + $beforeDiscountType = $this->input->post('beforeDisType'.$i); + $DiscountValue = $this->input->post('DisVal'.$i); + $preDiscountValue = $this->input->post('beforeDisVal'.$i); + $AfterDiscount = $this->input->post('AfterDisVal'.$i); + $beforeAfterDiscount = $this->input->post('beforeAfterDisVal'.$i); + + $PackagingOption = $this->input->post('PackOption'.$i); + $PackagingType = $this->input->post('PackType'.$i); + $beforePackagingType = $this->input->post('beforePackType'.$i); + $PackagingValue = $this->input->post('PackVal'.$i); + $prePackagingValue = $this->input->post('beforePackVal'.$i); + $AfterPackagingValue = $this->input->post('AfterPackVal'.$i); + $beforeAfterPackagingValue = $this->input->post('beforeAfterPackVal'.$i); + + + $VatValue = $this->input->post('VatVal'.$i);//SGST + $preVatValue = $this->input->post('beforeVatVal'.$i); + $AfterVatValue = $this->input->post('AfterVatVal'.$i); + $beforeAfterVatValue = $this->input->post('beforeAfterVatVal'.$i); + + $GSTValue = $this->input->post('GSTVal'.$i);//CGST + $preGSTValue = $this->input->post('beforeGSTVal'.$i); + $AfterGSTValue = $this->input->post('AfterGSTVal'.$i); + $beforeAfterGSTValue = $this->input->post('beforeAfterGSTVal'.$i); + + $OtherTaxValue = $this->input->post('OtherTaxVal'.$i);//IGST + $preOtherTaxValue = $this->input->post('beforeOtherTaxVal'.$i); + $AfterOtherTaxValue = $this->input->post('AfterOtherTaxVal'.$i); + $beforeAfterOtherTaxValue = $this->input->post('beforeAfterOtherTaxVal'.$i); + + $FreightType = $this->input->post('FreightType'.$i); + $beforeFreightType = $this->input->post('beforeFreightType'.$i); + $FreightValue = $this->input->post('FreightVal'.$i); + $preFreightValue = $this->input->post('beforeFreightVal'.$i); + $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); + $beforeAfterFreightValue = $this->input->post('beforeAfterFreightVal'.$i); + + $NoofTrips = $this->input->post('Nooftrips'.$i); + $beforeNoofTrips = $this->input->post('beforeNooftrips'.$i); + + $InsuranceValue = $this->input->post('Insval'.$i); + $preInsuranceValue = $this->input->post('beforeInsval'.$i); + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $POLineItemNo = $this->input->post('LineItemNo'.$i); + $CostCenter = $this->input->post('costCode'.$i); + $ServiceFrequency=$this->input->post('Frequency'.$i); + $LineItemNo = ''; + $RecQtyvalue=0.00; + $rowspanvalue=0; + + if(($Quantity-$preqty)!=0) + { + $rowspanvalue++; + $CAD.="Current Quantity : ".$preqty ."Revised Qty : ".$Quantity.""; + } + if(($itemRate-$preitemrate)!=0) + { + $rowspanvalue++; + $CAD.="Current Rate : " . $preitemrate."Revised Item Rate : ".$itemRate.""; + } + if($DiscountType != $beforeDiscountType){ + $rowspanvalue++; + $CAD.="Current DiscountType : " . $beforeDiscountType."Revised DiscountType : ".$DiscountType.""; + } + if(($DiscountValue-$preDiscountValue)!=0) + { + $rowspanvalue++; + $CAD.="Current Discount : ". $preDiscountValue ."Revised Discount : ".$DiscountValue.""; + } + if(($AfterDiscount-$beforeAfterDiscount)!=0) + { + $rowspanvalue++; + $CAD.="Current Discount Value : ". $beforeAfterDiscount ."Revised Discount Value : ".$AfterDiscount.""; + } + if($PackagingType != $beforePackagingType){ + $rowspanvalue++; + $CAD.="Current Packaging Type : ". $beforePackagingType ."Revised Packaging Type : ".$PackagingType.""; + } + if(($PackagingValue-$prePackagingValue)!=0) + { + $rowspanvalue++; + $CAD.="Current Package Value : ". $prePackagingValue."Revised Package Value : ".$PackagingValue.""; + } + if(($AfterPackagingValue-$beforeAfterPackagingValue)!=0) + { + $rowspanvalue++; + $CAD.="Current Package Value : ". $beforeAfterPackagingValue."Revised Package Value : ".$AfterPackagingValue.""; + } + if(($VatValue-$preVatValue)!=0)//SGST + { + $rowspanvalue++; + $CAD.="Current SGST : ". $preVatValue."Revised SGST : ".$VatValue.""; + } + if(($AfterVatValue-$beforeAfterVatValue)!=0)//SGST + { + $rowspanvalue++; + $CAD.="Current SGST value : ". $beforeAfterVatValue."Revised SGST Value : ".$AfterVatValue.""; + } + if(($GSTValue-$preGSTValue)!=0)//CGST + { + $rowspanvalue++; + $CAD.="Current CGST : ". $preGSTValue."Revised CGST : ".$GSTValue.""; + } + if(($AfterGSTValue-$beforeAfterGSTValue)!=0)//CGST + { + $rowspanvalue++; + $CAD.="Current CGST Value : ". $beforeAfterGSTValue."Revised CGST Value : ".$AfterGSTValue.""; + } + if(($OtherTaxValue-$preOtherTaxValue)!=0)//IGST + { + $rowspanvalue++; + $CAD.="Current IGST : ". $preOtherTaxValue."Revised IGST : ".$OtherTaxValue.""; + } + if(($AfterOtherTaxValue-$beforeAfterOtherTaxValue)!=0)//IGST + { + $rowspanvalue++; + $CAD.="Current IGST : ". $beforeAfterOtherTaxValue."Revised IGST : ".$AfterOtherTaxValue.""; + } + if($FreightType != $beforeFreightType){ + $rowspanvalue++; + $CAD.="Current Freight Type : ". $beforeFreightType."Revised Freight Type : ".$FreightType.""; + } + if(($FreightType=="PER TRIP") || ($beforeFreightType=="PER TRIP")){ + if($NoofTrips != $beforeNoofTrips) + { + $rowspanvalue++; + $CAD.="Current No of Trips : ". $beforeNoofTrips."Revised No of Trips : ".$NoofTrips.""; + } + } + + if(($FreightValue-$preFreightValue)!=0) + { + $rowspanvalue++; + $CAD.="Current Freight : ". $preFreightValue."Revised Freight : ".$FreightValue.""; + } - - - for ($i = 1; $i <= $RowCount; $i++) - { - - $CAD=''; - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); - $preqty=$this->input->post('beforeqty'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); - $itemRate = $this->input->post('itemRate'.$i); - $preitemrate=$this->input->post('beforeitemRate'.$i); - $per=$this->input->post('per'.$i); - $servicematerialdescription=$this->input->post('service_description'.$i); - - $DiscountType = $this->input->post('DisType'.$i); - $beforeDiscountType = $this->input->post('beforeDisType'.$i); - $DiscountValue = $this->input->post('DisVal'.$i); - $preDiscountValue = $this->input->post('beforeDisVal'.$i); - $AfterDiscount = $this->input->post('AfterDisVal'.$i); - $beforeAfterDiscount = $this->input->post('beforeAfterDisVal'.$i); - - $PackagingOption = $this->input->post('PackOption'.$i); - $PackagingType = $this->input->post('PackType'.$i); - $beforePackagingType = $this->input->post('beforePackType'.$i); - $PackagingValue = $this->input->post('PackVal'.$i); - $prePackagingValue = $this->input->post('beforePackVal'.$i); - $AfterPackagingValue = $this->input->post('AfterPackVal'.$i); - $beforeAfterPackagingValue = $this->input->post('beforeAfterPackVal'.$i); - - - $VatValue = $this->input->post('VatVal'.$i);//SGST - $preVatValue = $this->input->post('beforeVatVal'.$i); - $AfterVatValue = $this->input->post('AfterVatVal'.$i); - $beforeAfterVatValue = $this->input->post('beforeAfterVatVal'.$i); - - $GSTValue = $this->input->post('GSTVal'.$i);//CGST - $preGSTValue = $this->input->post('beforeGSTVal'.$i); - $AfterGSTValue = $this->input->post('AfterGSTVal'.$i); - $beforeAfterGSTValue = $this->input->post('beforeAfterGSTVal'.$i); - - $OtherTaxValue = $this->input->post('OtherTaxVal'.$i);//IGST - $preOtherTaxValue = $this->input->post('beforeOtherTaxVal'.$i); - $AfterOtherTaxValue = $this->input->post('AfterOtherTaxVal'.$i); - $beforeAfterOtherTaxValue = $this->input->post('beforeAfterOtherTaxVal'.$i); - - $FreightType = $this->input->post('FreightType'.$i); - $beforeFreightType = $this->input->post('beforeFreightType'.$i); - $FreightValue = $this->input->post('FreightVal'.$i); - $preFreightValue = $this->input->post('beforeFreightVal'.$i); - $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); - $beforeAfterFreightValue = $this->input->post('beforeAfterFreightVal'.$i); - - $NoofTrips = $this->input->post('Nooftrips'.$i); - $beforeNoofTrips = $this->input->post('beforeNooftrips'.$i); - - $InsuranceValue = $this->input->post('Insval'.$i); - $preInsuranceValue = $this->input->post('beforeInsval'.$i); - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - $POLineItemNo = $this->input->post('LineItemNo'.$i); - $CostCenter = $this->input->post('costCode'.$i); - $ServiceFrequency=$this->input->post('Frequency'.$i); - $LineItemNo = ''; - $RecQtyvalue=0.00; - $rowspanvalue=0; - - if(($Quantity-$preqty)!=0) - { - $rowspanvalue++; - $CAD.="Current Quantity : ".$preqty ."Revised Qty : ".$Quantity.""; - } - if(($itemRate-$preitemrate)!=0) - { - $rowspanvalue++; - $CAD.="Current Rate : " . $preitemrate."Revised Item Rate : ".$itemRate.""; - } - if($DiscountType != $beforeDiscountType){ - $rowspanvalue++; - $CAD.="Current DiscountType : " . $beforeDiscountType."Revised DiscountType : ".$DiscountType.""; - } - if(($DiscountValue-$preDiscountValue)!=0) - { - $rowspanvalue++; - $CAD.="Current Discount : ". $preDiscountValue ."Revised Discount : ".$DiscountValue.""; - } - if(($AfterDiscount-$beforeAfterDiscount)!=0) - { - $rowspanvalue++; - $CAD.="Current Discount Value : ". $beforeAfterDiscount ."Revised Discount Value : ".$AfterDiscount.""; - } - if($PackagingType != $beforePackagingType){ - $rowspanvalue++; - $CAD.="Current Packaging Type : ". $beforePackagingType ."Revised Packaging Type : ".$PackagingType.""; - } - if(($PackagingValue-$prePackagingValue)!=0) - { - $rowspanvalue++; - $CAD.="Current Package Value : ". $prePackagingValue."Revised Package Value : ".$PackagingValue.""; - } - if(($AfterPackagingValue-$beforeAfterPackagingValue)!=0) - { - $rowspanvalue++; - $CAD.="Current Package Value : ". $beforeAfterPackagingValue."Revised Package Value : ".$AfterPackagingValue.""; - } - if(($VatValue-$preVatValue)!=0)//SGST - { - $rowspanvalue++; - $CAD.="Current SGST : ". $preVatValue."Revised SGST : ".$VatValue.""; - } - if(($AfterVatValue-$beforeAfterVatValue)!=0)//SGST - { - $rowspanvalue++; - $CAD.="Current SGST value : ". $beforeAfterVatValue."Revised SGST Value : ".$AfterVatValue.""; - } - if(($GSTValue-$preGSTValue)!=0)//CGST - { - $rowspanvalue++; - $CAD.="Current CGST : ". $preGSTValue."Revised CGST : ".$GSTValue.""; - } - if(($AfterGSTValue-$beforeAfterGSTValue)!=0)//CGST - { - $rowspanvalue++; - $CAD.="Current CGST Value : ". $beforeAfterGSTValue."Revised CGST Value : ".$AfterGSTValue.""; - } - if(($OtherTaxValue-$preOtherTaxValue)!=0)//IGST - { - $rowspanvalue++; - $CAD.="Current IGST : ". $preOtherTaxValue."Revised IGST : ".$OtherTaxValue.""; - } - if(($AfterOtherTaxValue-$beforeAfterOtherTaxValue)!=0)//IGST - { - $rowspanvalue++; - $CAD.="Current IGST : ". $beforeAfterOtherTaxValue."Revised IGST : ".$AfterOtherTaxValue.""; - } - if($FreightType != $beforeFreightType){ - $rowspanvalue++; - $CAD.="Current Freight Type : ". $beforeFreightType."Revised Freight Type : ".$FreightType.""; - } - if(($FreightType=="PER TRIP") || ($beforeFreightType=="PER TRIP")){ - if($NoofTrips != $beforeNoofTrips) - { - $rowspanvalue++; - $CAD.="Current No of Trips : ". $beforeNoofTrips."Revised No of Trips : ".$NoofTrips.""; - } - } - - if(($FreightValue-$preFreightValue)!=0) - { - $rowspanvalue++; - $CAD.="Current Freight : ". $preFreightValue."Revised Freight : ".$FreightValue.""; - } - - if(($AfterFreightValue-$beforeAfterFreightValue)!=0) - { - $rowspanvalue++; - $CAD.="Current Freight Value : ". $beforeAfterFreightValue."Revised Freight Value : ".$AfterFreightValue.""; - } - - if(($InsuranceValue-$preInsuranceValue)!=0) - { - $rowspanvalue++; - $CAD.="Current Insurance Value : ". $preInsuranceValue."Revised Insurance Value : ".$InsuranceValue.""; - } - if($rowspanvalue>0) - { - $rowspanvalue++; - $CAD2=''; - $CAD2=$CAD; - $CAD=''; - $CAD="".$MaterialCode.""; - $CAD.=$CAD2; - } - $ReceivedQty = $this->purchaseorder_model->GetLineItemReceivedQty($PONO,$MaterialCode); + if(($AfterFreightValue-$beforeAfterFreightValue)!=0) + { + $rowspanvalue++; + $CAD.="Current Freight Value : ". $beforeAfterFreightValue."Revised Freight Value : ".$AfterFreightValue.""; + } + + if(($InsuranceValue-$preInsuranceValue)!=0) + { + $rowspanvalue++; + $CAD.="Current Insurance Value : ". $preInsuranceValue."Revised Insurance Value : ".$InsuranceValue.""; + } + if($rowspanvalue>0) + { + $rowspanvalue++; + $CAD2=''; + $CAD2=$CAD; + $CAD=''; + $CAD="".$MaterialCode.""; + $CAD.=$CAD2; + } + + $ReceivedQty = $this->purchaseorder_model->GetLineItemReceivedQty($PONO,$MaterialCode); if(count($ReceivedQty)>0) { $RecQtyvalue = $ReceivedQty[0]['ReceivedQuantity']; } - - $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'ReceivedQuantity'=>$RecQtyvalue,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$servicematerialdescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'AmendedDetails'=>$CAD); - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - - - $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType,'NoOfTrip'=>$NoofTrips,'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'SGST'=>$VatValue,'AfterSGST'=>$AfterVatValue,'CGST'=>$GSTValue,'AfterCGST'=>$AfterGSTValue,'IGST'=>$OtherTaxValue,'AfterIGST'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); - - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'ReceivedQuantity'=>$RecQtyvalue,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$servicematerialdescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'AmendedDetails'=>$CAD); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + + + $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType,'NoOfTrip'=>$NoofTrips,'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'SGST'=>$VatValue,'AfterSGST'=>$AfterVatValue,'CGST'=>$GSTValue,'AfterCGST'=>$AfterGSTValue,'IGST'=>$OtherTaxValue,'AfterIGST'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); + + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + + + } + $qty = $this->purchaseorder_model->getpolineqty($NewPO); - // if($Quantity == $RecQtyvalue ) - // { - - // $Newstatus = array('Status'=>IGR_CREATED); - // $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); - // $Newstat = array('Status'=>IGR_CREATED); - // $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); + + $ordqty =''; + $recqty =''; + // $POno=''; + // sum(Quantity)as Qty,sum(ReceivedQuantity)as rec - // } - // else if($Quantity != $RecQtyvalue ) - // { - // $Newstatus = array('Status'=>POLINEITEM_IGRPARTIAL_CREATED); - // $this->purchaseorder_model->POLineItemsupdatestatus($NewPO,$Newstatus); - // $Newstat = array('Status'=>PO_RELEASED); - // $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); + // foreach ($qty as $qtyvalue) + // { + $ordqty = $qty[0]->Qty; + $recqty = $qty[0]->rec; + // $POno = $qtyvalue->PONO; - // } - - - } + if($ordqty == $recqty) + { + + $Newstatus = array('Status'=>IGR_CREATED); + $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); + + $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus); - $qty = $this->purchaseorder_model->getpolineqty($NewPO); - - - $ordqty =''; - $recqty =''; - // $POno=''; - // sum(Quantity)as Qty,sum(ReceivedQuantity)as rec - - // foreach ($qty as $qtyvalue) - // { - $ordqty = $qty[0]->Qty; - $recqty = $qty[0]->rec; - // $POno = $qtyvalue->PONO; - - if($ordqty == $recqty) - { - - $Newstatus = array('Status'=>IGR_CREATED); - $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); - - $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus); - - } - - - echo 'Purchase Order Amended Successfully! PO Number Is: '.$PONO .'- New PO Number is'.$NewPO; - } + } + + + echo 'Purchase Order Amended Successfully! PO Number Is: '.$PONO .'- New PO Number is'.$NewPO; + } /** - * To Store release Service Po values after edit - */ - function UpdateAmendServicePurchaseOrder() - { + * To Store release Service Po values after edit + */ + function UpdateAmendServicePurchaseOrder() + { - $PONO =$this->input->post('txtPONO'); - - $MAD=''; - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); - + $PONO =$this->input->post('txtPONO'); + + $MAD=''; + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); + $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('txtDeliveryAddress'); - $dt = $this->input->post('Deliverydt'); - $DeliveryOption = $this->input->post('DateRange'); - - if($DeliveryOption==1){ - $Deliverydt =null; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; - } - - $ddate=$this->input->post('Deliverydt'); - $beforeddate=$this->input->post('beforeDeliverydt'); - $testdate=date("Y-m-d"); - $dschedule=$this->input->post('Scheduleby'); - $beforedschedule=$this->input->post('beforeScheduleby'); - $preTotalordervalue=$this->input->post('preTotalordervalue'); - $MAD.="Current TotalOrder Value:  " . $preTotalordervalue . "
"; - - if(($ddate != $beforeddate)||($dschedule != $beforedschedule)) - { - $MAD.="Current DeliveryOption :  " . $beforeddate . $beforedschedule."
"; - } - - $PaymentTermsText=$this->input->post('beforePaymentTermsText'); + $DeliveryAddr = $this->input->post('txtDeliveryAddress'); + $dt = $this->input->post('Deliverydt'); + $DeliveryOption = $this->input->post('DateRange'); + + if($DeliveryOption==1){ + $Deliverydt =null; + $DeliverySchedule = $this->input->post('Scheduleby'); + } + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; + } + + $ddate=$this->input->post('Deliverydt'); + $beforeddate=$this->input->post('beforeDeliverydt'); + $testdate=date("Y-m-d"); + $dschedule=$this->input->post('Scheduleby'); + $beforedschedule=$this->input->post('beforeScheduleby'); + $preTotalordervalue=$this->input->post('preTotalordervalue'); + $MAD.="Current TotalOrder Value:  " . $preTotalordervalue . "
"; + + if(($ddate != $beforeddate)||($dschedule != $beforedschedule)) + { + $MAD.="Current DeliveryOption :  " . $beforeddate . $beforedschedule."
"; + } + + $PaymentTermsText=$this->input->post('beforePaymentTermsText'); $PaymentTerms=$this->input->post('PaymentTerms'); - $Otherpayment=$this->input->post('Otherpayment'); - $Otherpaymentamend=$this->input->post('Otherpayment'); - $beforePaymentTerms=$this->input->post('beforePaymentTerms'); - - if($PaymentTerms != $beforePaymentTerms) - { - if($beforePaymentTerms != 'PT08'){ $Otherpaymentamend='';} - $MAD.="Current PaymentTerms :  ". $PaymentTermsText . $Otherpaymentamend."
"; - } - - $POType = $this->input->post('POType'); - $ModeOfShipment=$this->input->post('addmodeofshipment'); + $Otherpayment=$this->input->post('Otherpayment'); + $Otherpaymentamend=$this->input->post('Otherpayment'); + $beforePaymentTerms=$this->input->post('beforePaymentTerms'); + + if($PaymentTerms != $beforePaymentTerms) + { + if($beforePaymentTerms != 'PT08'){ $Otherpaymentamend='';} + $MAD.="Current PaymentTerms :  ". $PaymentTermsText . $Otherpaymentamend."
"; + } + + $POType = $this->input->post('POType'); + $ModeOfShipment=$this->input->post('addmodeofshipment'); $SupplierReference=$this->input->post('amendsupplierreference'); $SuppliersOfferNo=$this->input->post('amendsupplierofferno'); $OtherReferences=$this->input->post('amendotherreference'); @@ -653,17 +632,17 @@ foreach ($igrvalue as $value) { $InsuranceOptions=$this->input->post('insuranceStatus'); $InsuranceNo=$this->input->post('insuranceNo'); $ServiceTypeOptions=$this->input->post('PoTypeOptions'); - $DescriptionOfPo = $this->input->post('amenddescofpo'); - $scopeofwork = $this->input->post('ScopeofWork'); - $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - $POStatus = $this->input->post('txtStatus'); + $DescriptionOfPo = $this->input->post('amenddescofpo'); + $scopeofwork = $this->input->post('ScopeofWork'); + $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); + $POStatus = $this->input->post('txtStatus'); $updatedBy = $this->session->userdata ( 'userId' ); - $RowCount = $this->input->post('txtRowCount'); - - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updateddt = $dt->format('Y-m-d H:i:s'); - $WorkStatus=$this->input->post('workstatus'); + $RowCount = $this->input->post('txtRowCount'); + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $updateddt = $dt->format('Y-m-d H:i:s'); + $WorkStatus=$this->input->post('workstatus'); $qtycheck = $this->purchaseorder_model->getqtycheck($PONO); $qtycheckresult=''; @@ -672,33 +651,33 @@ foreach ($igrvalue as $value) { $qtycheckresult= $qty->IsQualityChkReqired; } - // PO Master - if(empty($Deliverydt)) - { - $Deliverydt=null; - } - if($PaymentTerms != 'PT08'){ - $Otherpayment=''; - } - $POMaster = array('ParentPO'=>$PONO,'POType'=>$POType,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>PO_RELEASED,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$scopeofwork,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'PaymentOtherDescription'=>$Otherpayment,'ServiceWorkStatus'=>$WorkStatus,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'AmendedDetails'=>$MAD,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions,'IsQualityChkReqired'=>$qtycheckresult); - - $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$updatedBy,$PONO); - - $NewPO = ''; - if(count($LastPO)>0) - { - $NewPO = $LastPO[0]['PONO']; - } - - - $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - - $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - - $LineItemStatus = REQITEM_NEW; + // PO Master + if(empty($Deliverydt)) + { + $Deliverydt=null; + } + if($PaymentTerms != 'PT08'){ + $Otherpayment=''; + } + $POMaster = array('ParentPO'=>$PONO,'POType'=>$POType,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>PO_RELEASED,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$scopeofwork,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'PaymentOtherDescription'=>$Otherpayment,'ServiceWorkStatus'=>$WorkStatus,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'AmendedDetails'=>$MAD,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions,'IsQualityChkReqired'=>$qtycheckresult); + + $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$updatedBy,$PONO); + + $NewPO = ''; + if(count($LastPO)>0) + { + $NewPO = $LastPO[0]['PONO']; + } + + + $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS + + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); + + $LineItemStatus = REQITEM_NEW; - $igrvalue = $this->purchaseorder_model->selectigrmaster($PONO); + $igrvalue = $this->purchaseorder_model->selectigrmaster($PONO); $po = ''; @@ -711,7 +690,7 @@ foreach ($igrvalue as $value) { // } foreach ($igrvalue as $value) { - + $igrno = $value->IGRNO; $po =$value->PONO; @@ -731,196 +710,196 @@ foreach ($igrvalue as $value) { } - - - for ($i = 1; $i <= $RowCount; $i++) - { - $CAD=''; - $MaterialCode = $this->input->post('materialCode'.$i); - $MaterialName=$this->input->post('materialName'.$i); - $Quantity = $this->input->post('quantity'.$i); - $beforeQuantity = $this->input->post('beforequantity'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); - $itemRate = $this->input->post('itemRate'.$i); - $beforeitemRate = $this->input->post('beforeitemRate'.$i); - $Per = $this->input->post('per'.$i); - $AfterSGST = $this->input->post('AfterSgst'.$i); - $beforeSGSTvalue = $this->input->post('beforeSgstvalue'.$i); - $AfterCGST = $this->input->post('AfterCgst'.$i); - $beforeCGSTvalue = $this->input->post('beforeCgstvalue'.$i); - $AfterIGST = $this->input->post('AfterIgst'.$i); - $beforeIGSTvalue = $this->input->post('beforeIgstvalue'.$i); - $SGST = $this->input->post('Sgst'.$i); - $beforeSGST = $this->input->post('beforeSgst'.$i); - $CGST = $this->input->post('Cgst'.$i); - $beforeCGST = $this->input->post('beforeCgst'.$i); - $IGST = $this->input->post('Igst'.$i); - $beforeIGST = $this->input->post('beforeIgst'.$i); - $otherallowance = $this->input->post('otherallowance'.$i); - $beforeotherallowance = $this->input->post('beforeotherallowance'.$i); - $servicematerialdescription = $this->input->post('servicematerialdescription'.$i); - $CostCenter = $this->input->post('costCode'.$i); - $POLineItemNo = $this->input->post('LineItemNo'.$i); - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - $ServiceFrequency=$this->input->post('Frequency'.$i); - $LineItemNo = ''; - $RecQtyvalue=0.00; - $rowspanvalue=0; - $ReceivedQty = $this->purchaseorder_model->GetLineItemReceivedQty($PONO,$MaterialCode); - - if(count($ReceivedQty)>0) - { - $RecQtyvalue = $ReceivedQty[0]['ReceivedQuantity']; - } - - if($Quantity != $beforeQuantity) - { - $rowspanvalue++; - $CAD.="Current Qty : " . $beforeQuantity ."Revised Qty : " . $Quantity . ""; - } - if($itemRate != $beforeitemRate) - { - $rowspanvalue++; - $CAD.="Current Rate : " . $beforeitemRate ."Revised Rate : " . $itemRate . ""; - } - - if(($SGST != $beforeSGST) && ($AfterSGST != $beforeSGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Current SGST% : " . $beforeSGST ."Revised SGST% : " . $SGST . "Current SGST value : " . $beforeSGSTvalue ."Revised SGST value: " . $AfterSGST . ""; - } - if(($CGST != $beforeCGST) && ($AfterCGST != $beforeCGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Current CGST% : " . $beforeCGST ."Revised CGST% : " . $CGST . "Current CGST value : " . $beforeCGSTvalue ."Revised CGST value: " . $AfterCGST . ""; - } - if(($IGST != $beforeIGST) && ($AfterIGST != $beforeIGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Current IGST% : " . $beforeIGST ."Revised IGST% : " . $IGST . "Current IGST value : " . $beforeIGSTvalue ."Revised IGST value: " . $AfterIGST . ""; - } - if($otherallowance != $beforeotherallowance) - { - $rowspanvalue++; - $CAD.="Current OtherAllowances : " . $beforeotherallowance ."Revised OtherAllowances : " . $otherallowance . ""; - } - if($rowspanvalue>0) - { - $rowspanvalue++; - $CAD2=''; - $CAD2=$CAD; - $CAD=''; - $CAD="".$MaterialCode."-".$MaterialName.""; - $CAD.=$CAD2; + + + for ($i = 1; $i <= $RowCount; $i++) + { + $CAD=''; + $MaterialCode = $this->input->post('materialCode'.$i); + $MaterialName=$this->input->post('materialName'.$i); + $Quantity = $this->input->post('quantity'.$i); + $beforeQuantity = $this->input->post('beforequantity'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $itemRate = $this->input->post('itemRate'.$i); + $beforeitemRate = $this->input->post('beforeitemRate'.$i); + $Per = $this->input->post('per'.$i); + $AfterSGST = $this->input->post('AfterSgst'.$i); + $beforeSGSTvalue = $this->input->post('beforeSgstvalue'.$i); + $AfterCGST = $this->input->post('AfterCgst'.$i); + $beforeCGSTvalue = $this->input->post('beforeCgstvalue'.$i); + $AfterIGST = $this->input->post('AfterIgst'.$i); + $beforeIGSTvalue = $this->input->post('beforeIgstvalue'.$i); + $SGST = $this->input->post('Sgst'.$i); + $beforeSGST = $this->input->post('beforeSgst'.$i); + $CGST = $this->input->post('Cgst'.$i); + $beforeCGST = $this->input->post('beforeCgst'.$i); + $IGST = $this->input->post('Igst'.$i); + $beforeIGST = $this->input->post('beforeIgst'.$i); + $otherallowance = $this->input->post('otherallowance'.$i); + $beforeotherallowance = $this->input->post('beforeotherallowance'.$i); + $servicematerialdescription = $this->input->post('servicematerialdescription'.$i); + $CostCenter = $this->input->post('costCode'.$i); + $POLineItemNo = $this->input->post('LineItemNo'.$i); + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $ServiceFrequency=$this->input->post('Frequency'.$i); + $LineItemNo = ''; + $RecQtyvalue=0.00; + $rowspanvalue=0; + $ReceivedQty = $this->purchaseorder_model->GetLineItemReceivedQty($PONO,$MaterialCode); + + if(count($ReceivedQty)>0) + { + $RecQtyvalue = $ReceivedQty[0]['ReceivedQuantity']; + } + + if($Quantity != $beforeQuantity) + { + $rowspanvalue++; + $CAD.="Current Qty : " . $beforeQuantity ."Revised Qty : " . $Quantity . ""; + } + if($itemRate != $beforeitemRate) + { + $rowspanvalue++; + $CAD.="Current Rate : " . $beforeitemRate ."Revised Rate : " . $itemRate . ""; + } + + if(($SGST != $beforeSGST) && ($AfterSGST != $beforeSGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Current SGST% : " . $beforeSGST ."Revised SGST% : " . $SGST . "Current SGST value : " . $beforeSGSTvalue ."Revised SGST value: " . $AfterSGST . ""; + } + if(($CGST != $beforeCGST) && ($AfterCGST != $beforeCGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Current CGST% : " . $beforeCGST ."Revised CGST% : " . $CGST . "Current CGST value : " . $beforeCGSTvalue ."Revised CGST value: " . $AfterCGST . ""; + } + if(($IGST != $beforeIGST) && ($AfterIGST != $beforeIGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Current IGST% : " . $beforeIGST ."Revised IGST% : " . $IGST . "Current IGST value : " . $beforeIGSTvalue ."Revised IGST value: " . $AfterIGST . ""; + } + if($otherallowance != $beforeotherallowance) + { + $rowspanvalue++; + $CAD.="Current OtherAllowances : " . $beforeotherallowance ."Revised OtherAllowances : " . $otherallowance . ""; + } + if($rowspanvalue>0) + { + $rowspanvalue++; + $CAD2=''; + $CAD2=$CAD; + $CAD=''; + $CAD="".$MaterialCode."-".$MaterialName.""; + $CAD.=$CAD2; } - - $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'ServiceMaterialDescription'=>$servicematerialdescription,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ReceivedQuantity'=>$RecQtyvalue,'AmendedDetails'=>$CAD,'Per'=>$Per); - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - - $ServiceTaxList = array('LineItemNo'=>$LineItemNo,'CGST'=>$CGST,'After_CGST'=>$AfterCGST,'SGST'=>$SGST,'After_SGST'=>$AfterSGST,'IGST'=>$IGST,'After_IGST'=>$AfterIGST,'otherallowance'=>$otherallowance, 'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); - $ServiceList =$this->purchaseorder_model->addServiceTax($ServiceTaxList); - + + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'ServiceMaterialDescription'=>$servicematerialdescription,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ReceivedQuantity'=>$RecQtyvalue,'AmendedDetails'=>$CAD,'Per'=>$Per); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + + $ServiceTaxList = array('LineItemNo'=>$LineItemNo,'CGST'=>$CGST,'After_CGST'=>$AfterCGST,'SGST'=>$SGST,'After_SGST'=>$AfterSGST,'IGST'=>$IGST,'After_IGST'=>$AfterIGST,'otherallowance'=>$otherallowance, 'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); + $ServiceList =$this->purchaseorder_model->addServiceTax($ServiceTaxList); + // if($Quantity == $RecQtyvalue ) - // { - - // $Newstatus = array('Status'=>IGR_CREATED); - // $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); - // $Newstat = array('Status'=>IGR_CREATED); - // $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); + // { + + // $Newstatus = array('Status'=>IGR_CREATED); + // $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); + // $Newstat = array('Status'=>IGR_CREATED); + // $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); - // } - // else if($Quantity != $RecQtyvalue ) - // { - // $Newstatus = array('Status'=>POLINEITEM_IGRPARTIAL_CREATED); - // $this->purchaseorder_model->POLineItemsupdatestatus($NewPO,$Newstatus); - // $Newstat = array('Status'=>PO_RELEASED); - // $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); + // } + // else if($Quantity != $RecQtyvalue ) + // { + // $Newstatus = array('Status'=>POLINEITEM_IGRPARTIAL_CREATED); + // $this->purchaseorder_model->POLineItemsupdatestatus($NewPO,$Newstatus); + // $Newstat = array('Status'=>PO_RELEASED); + // $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); - // } - + // } + - } + } $qty = $this->purchaseorder_model->getpolineqty($NewPO); - - $ordqty =''; - $recqty =''; - // $POno=''; - // sum(Quantity)as Qty,sum(ReceivedQuantity)as rec + + $ordqty =''; + $recqty =''; + // $POno=''; + // sum(Quantity)as Qty,sum(ReceivedQuantity)as rec - // foreach ($qty as $qtyvalue) - // { - $ordqty = $qty[0]->Qty; - $recqty = $qty[0]->rec; - // $POno = $qtyvalue->PONO; + // foreach ($qty as $qtyvalue) + // { + $ordqty = $qty[0]->Qty; + $recqty = $qty[0]->rec; + // $POno = $qtyvalue->PONO; - if($ordqty == $recqty) - { - - $Newstatus = array('Status'=>IGR_CREATED); - $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); - - $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus); + if($ordqty == $recqty) + { + + $Newstatus = array('Status'=>IGR_CREATED); + $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); + + $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus); - } - - echo 'PO Number is'.$PONO . ' is Amended Successfully! - New Amended PO Number is '.$NewPO; - } - - /** - * To Store Capital Po values after edit - */ - function EditAmendCapitalPurchaseOrder() + } + + echo 'PO Number is'.$PONO . ' is Amended Successfully! - New Amended PO Number is '.$NewPO; + } + + /** + * To Store Capital Po values after edit + */ + function EditAmendCapitalPurchaseOrder() { $PONO =$this->input->post('txtPONO'); - $MAD=''; - $DeliverySchedule = ''; + $MAD=''; + $DeliverySchedule = ''; $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); + $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('DeliveryAddr'); - $dt = $this->input->post('Deliverydate'); - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('capitalType'); - $DeliveryOption = $this->input->post('DateRange'); - $Deliverydt = ''; + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydate'); + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('capitalType'); + $DeliveryOption = $this->input->post('DateRange'); + $Deliverydt = ''; if(($DeliveryOption==1)||($DeliveryOption==2)){ $Deliverydt = null; - - if($DeliveryOption==1){ + + if($DeliveryOption==1){ $DeliverySchedule = $this->input->post('Scheduleby');} } else{ $Deliverydt = $this->getDateformat($dt); $DeliverySchedule = ''; } - - $predispatch=$this->input->post('beforeDisins'); - $curdispatch=$this->input->post('Dispatch'); - $PaymentMethod = $this->input->post('PaymentMethod'); - $prePaymentmethod=$this->input->post('beforePaymentmethod'); - $prePaymentmethodtext=$this->input->post('beforePaymentTermsText'); - - $DeliverySchedule1 = $this->input->post('Scheduleby'); - $preDeliverySchedule = $this->input->post('beforeSchedule'); - $PlaceOforigin = $this->input->post('PlaceOforigin'); - - $preDate = $this->input->post('beforeDate'); - $Date = $this->input->post('Deliverydate'); - $Otherpayment=$this->input->post('Otherpayment'); - $Otherpaymentamend=$this->input->post('Otherpayment'); - $PreServiceTotalorder = $this->input->post('preServiceTotalorderValue');//For Domestic Pre Total Value - $Totalserviceorder = $this->input->post('Totalservicesummary');//For Domestic Revised Total value - $TotalCapitalorder= $this->input->post('CapitalToatlOrder');//For International total CapitalOrder - $preTotalCapitalorder= $this->input->post('preinterTotalorderValue');//For International pre total CapitalOrder + + $predispatch=$this->input->post('beforeDisins'); + $curdispatch=$this->input->post('Dispatch'); + $PaymentMethod = $this->input->post('PaymentMethod'); + $prePaymentmethod=$this->input->post('beforePaymentmethod'); + $prePaymentmethodtext=$this->input->post('beforePaymentTermsText'); + + $DeliverySchedule1 = $this->input->post('Scheduleby'); + $preDeliverySchedule = $this->input->post('beforeSchedule'); + $PlaceOforigin = $this->input->post('PlaceOforigin'); + + $preDate = $this->input->post('beforeDate'); + $Date = $this->input->post('Deliverydate'); + $Otherpayment=$this->input->post('Otherpayment'); + $Otherpaymentamend=$this->input->post('Otherpayment'); + $PreServiceTotalorder = $this->input->post('preServiceTotalorderValue');//For Domestic Pre Total Value + $Totalserviceorder = $this->input->post('Totalservicesummary');//For Domestic Revised Total value + $TotalCapitalorder= $this->input->post('CapitalToatlOrder');//For International total CapitalOrder + $preTotalCapitalorder= $this->input->post('preinterTotalorderValue');//For International pre total CapitalOrder $ModeOfShipment=$this->input->post('addmodeofshipment'); $SupplierReference=$this->input->post('amendsupplierreference'); $SuppliersOfferNo=$this->input->post('amendsupplierofferno'); @@ -929,93 +908,93 @@ foreach ($igrvalue as $value) { $InsuranceOptions=$this->input->post('insuranceStatus'); $InsuranceNo=$this->input->post('insuranceNo'); $ServiceTypeOptions=$this->input->post('PoTypeOptions'); - - if($PoRange==1){ - $MAD.="Current TotalOrder Value:  " . $PreServiceTotalorder . "
"; - }else if($PoRange==0){ - $MAD.="Current TotalOrder Value:  " . $preTotalCapitalorder . "
"; - } - - if($PaymentMethod != $prePaymentmethod) - { - if($prePaymentmethod != 'PT08'){ $Otherpaymentamend='';} - $MAD.="Current Paymemnt Terms :  " .$prePaymentmethodtext."
"; - } - if($predispatch != $curdispatch) - { - $MAD.="Current Delivery Option :  " .$predispatch.$preDeliverySchedule.$preDate."
"; - } - if($DeliverySchedule1!= $preDeliverySchedule) - { - $MAD.="Current DeliveyOption :  " .$preDeliverySchedule.$preDate.$predispatch."
"; - } - if($preDate != $Date) - { - $MAD.="Current DeliveyOption :  " .$preDate.$preDeliverySchedule."
"; - } - + + if($PoRange==1){ + $MAD.="Current TotalOrder Value:  " . $PreServiceTotalorder . "
"; + }else if($PoRange==0){ + $MAD.="Current TotalOrder Value:  " . $preTotalCapitalorder . "
"; + } + + if($PaymentMethod != $prePaymentmethod) + { + if($prePaymentmethod != 'PT08'){ $Otherpaymentamend='';} + $MAD.="Current Paymemnt Terms :  " .$prePaymentmethodtext."
"; + } + if($predispatch != $curdispatch) + { + $MAD.="Current Delivery Option :  " .$predispatch.$preDeliverySchedule.$preDate."
"; + } + if($DeliverySchedule1!= $preDeliverySchedule) + { + $MAD.="Current DeliveyOption :  " .$preDeliverySchedule.$preDate.$predispatch."
"; + } + if($preDate != $Date) + { + $MAD.="Current DeliveyOption :  " .$preDate.$preDeliverySchedule."
"; + } + $capitalType = $this->input->post('capitalType'); $currencytypeID = $this->input->post('currencytype'); if($capitalType=='1'){ $CapitalRange = '1'; $ExchangeRateOn = ''; - $ExchangeRate=''; + $ExchangeRate=''; } else{ $CapitalRange = '0'; $ExchangeRateOn = $this->input->post('ExchangeRateOn'); - $ExchangeRateOn = $this->getDateformat($ExchangeRateOn); + $ExchangeRateOn = $this->getDateformat($ExchangeRateOn); $ExchangeRate=$this->input->post('ExchangeRt'); } - - $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - - if($PoRange==1){ - $FinalTotalOrder = $Totalserviceorder; - }else if($PoRange==0) - { - $FinalTotalOrder=$TotalCapitalorder; - } + + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + + if($PoRange==1){ + $FinalTotalOrder = $Totalserviceorder; + }else if($PoRange==0) + { + $FinalTotalOrder=$TotalCapitalorder; + } - $POStatus = $this->input->post('txtStatus'); - $CreateBy = $this->session->userdata ( 'userId' ); - $RowCount = $this->input->post('txtRowCount'); - - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $createddt = $dt->format('Y-m-d H:i:s'); - $updateddt = $dt->format('Y-m-d H:i:s'); + $POStatus = $this->input->post('txtStatus'); + $CreateBy = $this->session->userdata ( 'userId' ); + $RowCount = $this->input->post('txtRowCount'); + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $updateddt = $dt->format('Y-m-d H:i:s'); - $qtycheck = $this->purchaseorder_model->getqtycheck($PONO); + $qtycheck = $this->purchaseorder_model->getqtycheck($PONO); $qtycheckresult=''; foreach($qtycheck as $qty) { $qtycheckresult= $qty->IsQualityChkReqired; } - - if(empty($Deliverydt)){ - $Deliverydt=null; - } - - if($PaymentMethod != 'PT08'){ - $Otherpayment=''; - } - $updatedBy = $this->session->userdata ( 'userId' ); - $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$FinalTotalOrder,'POType'=>$POType,'PODate'=>$PODate,'Status'=>PO_RELEASED,'CapitalRange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'PaymentOtherDescription'=>$Otherpayment,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID,'AmendedDetails'=>$MAD,'Import_DispatchDetails'=>$curdispatch,'Import_PlaceofOrgin'=>$PlaceOforigin,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions,'IsQualityChkReqired'=>$qtycheckresult); - $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); - - foreach($LastPO as $PO): - $NewPO=$PO['PONO']; - endforeach; - - $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - - $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - - - $LineItemStatus = REQITEM_NEW; + + if(empty($Deliverydt)){ + $Deliverydt=null; + } + + if($PaymentMethod != 'PT08'){ + $Otherpayment=''; + } + $updatedBy = $this->session->userdata ( 'userId' ); + $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$FinalTotalOrder,'POType'=>$POType,'PODate'=>$PODate,'Status'=>PO_RELEASED,'CapitalRange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'PaymentOtherDescription'=>$Otherpayment,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID,'AmendedDetails'=>$MAD,'Import_DispatchDetails'=>$curdispatch,'Import_PlaceofOrgin'=>$PlaceOforigin,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions,'IsQualityChkReqired'=>$qtycheckresult); + $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); + + foreach($LastPO as $PO): + $NewPO=$PO['PONO']; + endforeach; + + $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS + + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); + + + $LineItemStatus = REQITEM_NEW; - $igrvalue = $this->purchaseorder_model->selectigrmaster($PONO); + $igrvalue = $this->purchaseorder_model->selectigrmaster($PONO); $po = ''; @@ -1028,7 +1007,7 @@ foreach ($igrvalue as $value) { // } foreach ($igrvalue as $value) { - + $igrno = $value->IGRNO; $po =$value->PONO; @@ -1047,57 +1026,57 @@ foreach ($igrvalue as $value) { } - - for ($i = 1; $i <= $RowCount; $i++) - { - - $CAD=''; - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); - $preQuantity = $this->input->post('beforequantity'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); - $preitemRate = $this->input->post('itemRate'.$i); - $itemRate = $this->input->post('rateInUs'.$i); + + for ($i = 1; $i <= $RowCount; $i++) + { + + $CAD=''; + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $preQuantity = $this->input->post('beforequantity'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $preitemRate = $this->input->post('itemRate'.$i); + $itemRate = $this->input->post('rateInUs'.$i); $Per = $this->input->post('per'.$i); - $Exchangerate = $this->input->post('echangeRate'.$i); - $BasicPriceinmton = $this->input->post('rateInUs'.$i); - $Productprice = $this->input->post('basicvalInINR'.$i); - $LandingCharge = $this->input->post('beforeLanding'.$i); - $AfterLandingCharge = $this->input->post('landingCharge'.$i); - + $Exchangerate = $this->input->post('echangeRate'.$i); + $BasicPriceinmton = $this->input->post('rateInUs'.$i); + $Productprice = $this->input->post('basicvalInINR'.$i); + $LandingCharge = $this->input->post('beforeLanding'.$i); + $AfterLandingCharge = $this->input->post('landingCharge'.$i); + - $CustomDuty = $this->input->post('beforeCustomDuty'.$i); - $AfterCustomDuty = $this->input->post('CustomDuty'.$i); + $CustomDuty = $this->input->post('beforeCustomDuty'.$i); + $AfterCustomDuty = $this->input->post('CustomDuty'.$i); - $CustomEd= $this->input->post('beforeCustomEDCess'.$i); - $AfterCustomEd= $this->input->post('CustomEDCess'.$i); + $CustomEd= $this->input->post('beforeCustomEDCess'.$i); + $AfterCustomEd= $this->input->post('CustomEDCess'.$i); - $CustomSH = $this->input->post('beforeCustomSHCess'.$i); - $AfterCustomSH = $this->input->post('CustomSHCess'.$i); + $CustomSH = $this->input->post('beforeCustomSHCess'.$i); + $AfterCustomSH = $this->input->post('CustomSHCess'.$i); - + - $Grossdutypayable = $this->input->post('GrossDutyPayable'.$i); - - $purchaseratePerKG = $this->input->post('purchaseRate'.$i); - $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpenses'.$i); - - $QuantityKG = $this->input->post('PurQuantity'.$i); + $Grossdutypayable = $this->input->post('GrossDutyPayable'.$i); + + $purchaseratePerKG = $this->input->post('purchaseRate'.$i); + $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpenses'.$i); + + $QuantityKG = $this->input->post('PurQuantity'.$i); - - $Totalvalueitem=$this->input->post('PerKgExpense'.$i); + + $Totalvalueitem=$this->input->post('PerKgExpense'.$i); $Assable=$this->input->post('AssessableValue'.$i); - $beforeAssable=$this->input->post('beforeAssessableValue'.$i); + $beforeAssable=$this->input->post('beforeAssessableValue'.$i); - $Subtotal=$this->input->post('SubTotal'.$i); - $beforeSubtotal=$this->input->post('beforeSubTotal'.$i); + $Subtotal=$this->input->post('SubTotal'.$i); + $beforeSubtotal=$this->input->post('beforeSubTotal'.$i); @@ -1112,29 +1091,29 @@ foreach ($igrvalue as $value) { $DutyImpact=$this->input->post('DutyImpact'.$i); - $CostCenter = $this->input->post('CPCostCode'.$i); + $CostCenter = $this->input->post('CPCostCode'.$i); - $SGST = $this->input->post('SGST'.$i); - $preSGST = $this->input->post('beforeSGST'.$i); - $CGST = $this->input->post('CGST'.$i); - $preCGST = $this->input->post('beforeCGST'.$i); - $IGST = $this->input->post('IGST'.$i); - $preIGST = $this->input->post('beforeIGST'.$i); - - $SGSTvalue=$this->input->post('afterSGST'.$i); - $preSGSTvalue=$this->input->post('beforeSGSTvalue'.$i); - $CGSTvalue=$this->input->post('afterCGST'.$i); - $preCGSTvalue=$this->input->post('beforeCGSTvalue'.$i); - $IGSTvalue=$this->input->post('afterIGST'.$i); - $preIGSTvalue=$this->input->post('beforeIGSTvalue'.$i); - $otherallowance=$this->input->post('otherallowance'.$i); - $preotherallowance=$this->input->post('beforeotherallowance'.$i); + $SGST = $this->input->post('SGST'.$i); + $preSGST = $this->input->post('beforeSGST'.$i); + $CGST = $this->input->post('CGST'.$i); + $preCGST = $this->input->post('beforeCGST'.$i); + $IGST = $this->input->post('IGST'.$i); + $preIGST = $this->input->post('beforeIGST'.$i); + + $SGSTvalue=$this->input->post('afterSGST'.$i); + $preSGSTvalue=$this->input->post('beforeSGSTvalue'.$i); + $CGSTvalue=$this->input->post('afterCGST'.$i); + $preCGSTvalue=$this->input->post('beforeCGSTvalue'.$i); + $IGSTvalue=$this->input->post('afterIGST'.$i); + $preIGSTvalue=$this->input->post('beforeIGSTvalue'.$i); + $otherallowance=$this->input->post('otherallowance'.$i); + $preotherallowance=$this->input->post('beforeotherallowance'.$i); $DiscountType = $this->input->post('DisType'.$i); - $DiscountValue = $this->input->post('DisVal'.$i); - $AfterDiscount = $this->input->post('AfterDisVal'.$i); + $DiscountValue = $this->input->post('DisVal'.$i); + $AfterDiscount = $this->input->post('AfterDisVal'.$i); $preDiscountType = $this->input->post('beforeDisType'.$i); - $preDiscountValue = $this->input->post('beforeDisVal'.$i); - $preAfterDiscount = $this->input->post('beforeAfterDisVal'.$i); + $preDiscountValue = $this->input->post('beforeDisVal'.$i); + $preAfterDiscount = $this->input->post('beforeAfterDisVal'.$i); $TotalServiceOrderValue = $this->input->post('totalservicevalue'.$i); $CapitalItemDescrition = $this->input->post('CapitalItemDescrition'.$i); $FreightType = $this->input->post('FreightType'.$i); @@ -1153,170 +1132,170 @@ foreach ($igrvalue as $value) { $beforeFreightrateloc=$this->input->post('beforeFvalue'.$i); $beforeFreightAmountloc=$this->input->post('beforeAfvalue'.$i); - $rowspanvalue=0; + $rowspanvalue=0; - if($Quantity != $preQuantity) - { - $rowspanvalue++; - $CAD.="Current Qty : " . $preQuantity ."Revised Qty : " . $Quantity . ""; - } - if($itemRate != $preitemRate) - { - $rowspanvalue++; - $CAD.="Current Rate : " . $preitemRate ."Revised Rate : " . $itemRate . ""; - } - - if($PoRange==1){ + if($Quantity != $preQuantity) + { + $rowspanvalue++; + $CAD.="Current Qty : " . $preQuantity ."Revised Qty : " . $Quantity . ""; + } + if($itemRate != $preitemRate) + { + $rowspanvalue++; + $CAD.="Current Rate : " . $preitemRate ."Revised Rate : " . $itemRate . ""; + } + + if($PoRange==1){ if(($DiscountValue!=$preDiscountValue) && ($AfterDiscount!=$preAfterDiscount)){ $rowspanvalue+=2; - $CAD.="Current Discount : " . $preDiscountValue ."Revised Discount : " . $DiscountValue . "Current Discount value : " . $preAfterDiscount ."Revised Discount value: " . $AfterDiscount . ""; + $CAD.="Current Discount : " . $preDiscountValue ."Revised Discount : " . $DiscountValue . "Current Discount value : " . $preAfterDiscount ."Revised Discount value: " . $AfterDiscount . ""; } - if(($SGST != $preSGST) && ($SGSTvalue != $preSGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Current SGST% : " . $preSGST ."Revised SGST% : " . $SGST . "Current SGST value : " . $preSGSTvalue ."Revised SGST value: " . $SGSTvalue . ""; - } - if(($CGST != $preCGST) && ($CGSTvalue != $preCGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Current CGST% : " . $preCGST ."Revised CGST% : " . $CGST . "Current CGST value : " . $preCGSTvalue ."Revised CGST value: " . $CGSTvalue . ""; - } - if(($IGST != $preIGST) && ($IGSTvalue != $preIGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Current IGST% : " . $preIGST ."Revised IGST% : " . $IGST . "Current IGST value : " . $preIGSTvalue ."Revised IGST value: " . $IGSTvalue . ""; - } - if($otherallowance != $preotherallowance) - { - $rowspanvalue++; - $CAD.="Current OtherAllowances : " . $preotherallowance ."Revised OtherAllowances : " . $otherallowance . ""; - } - if($FreightTypeloc != $beforeFreightTypeloc) - { - $rowspanvalue++; - $CAD.="Current Freight Type : " . $beforeFreightTypeloc ."Revised Qty : " . $FreightTypeloc . ""; - } - if($FreightNoofTriploc != $beforeFreightNoofTriploc) - { - $rowspanvalue++; - $CAD.="Current Freight Nooftrips : " . $beforeFreightNoofTriploc ."Revised Freight Nooftrips: " . $FreightNoofTriploc . ""; - } - if($Freightrateloc != $beforeFreightrateloc) - { - $rowspanvalue++; - $CAD.="Current Freight Rate : " . $beforeFreightrateloc ."Revised Freight Rate: " . $Freightrateloc . ""; - } + if(($SGST != $preSGST) && ($SGSTvalue != $preSGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Current SGST% : " . $preSGST ."Revised SGST% : " . $SGST . "Current SGST value : " . $preSGSTvalue ."Revised SGST value: " . $SGSTvalue . ""; + } + if(($CGST != $preCGST) && ($CGSTvalue != $preCGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Current CGST% : " . $preCGST ."Revised CGST% : " . $CGST . "Current CGST value : " . $preCGSTvalue ."Revised CGST value: " . $CGSTvalue . ""; + } + if(($IGST != $preIGST) && ($IGSTvalue != $preIGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Current IGST% : " . $preIGST ."Revised IGST% : " . $IGST . "Current IGST value : " . $preIGSTvalue ."Revised IGST value: " . $IGSTvalue . ""; + } + if($otherallowance != $preotherallowance) + { + $rowspanvalue++; + $CAD.="Current OtherAllowances : " . $preotherallowance ."Revised OtherAllowances : " . $otherallowance . ""; + } + if($FreightTypeloc != $beforeFreightTypeloc) + { + $rowspanvalue++; + $CAD.="Current Freight Type : " . $beforeFreightTypeloc ."Revised Qty : " . $FreightTypeloc . ""; + } + if($FreightNoofTriploc != $beforeFreightNoofTriploc) + { + $rowspanvalue++; + $CAD.="Current Freight Nooftrips : " . $beforeFreightNoofTriploc ."Revised Freight Nooftrips: " . $FreightNoofTriploc . ""; + } + if($Freightrateloc != $beforeFreightrateloc) + { + $rowspanvalue++; + $CAD.="Current Freight Rate : " . $beforeFreightrateloc ."Revised Freight Rate: " . $Freightrateloc . ""; + } - if($FreightAmountloc != $beforeFreightAmountloc) - { - $rowspanvalue++; - $CAD.="Current Freight Amount : " .$beforeFreightAmountloc ."Revised Freight Amount: " . $FreightAmountloc . ""; - } + if($FreightAmountloc != $beforeFreightAmountloc) + { + $rowspanvalue++; + $CAD.="Current Freight Amount : " .$beforeFreightAmountloc ."Revised Freight Amount: " . $FreightAmountloc . ""; + } - if(($Assable-$beforeAssable)!=0) - { - - $rowspanvalue++; - $CAD=$CAD."Current Assessable : ".$beforeAssable ."Revised CustomDuty:".$Assable.""; - } + if(($Assable-$beforeAssable)!=0) + { + + $rowspanvalue++; + $CAD=$CAD."Current Assessable : ".$beforeAssable ."Revised CustomDuty:".$Assable.""; + } - if(($Subtotal-$beforeSubtotal)!=0) - { - - $rowspanvalue++; - $CAD=$CAD."Current Subtotal : ".$beforeSubtotal ."Revised Subtotal:".$Subtotal.""; - } + if(($Subtotal-$beforeSubtotal)!=0) + { + + $rowspanvalue++; + $CAD=$CAD."Current Subtotal : ".$beforeSubtotal ."Revised Subtotal:".$Subtotal.""; + } - if(($Igst-$beforeIgst)!=0) - { - - $rowspanvalue++; - $CAD=$CAD."Current IGST Percentage : ".$beforeIgst ."Revised IGST Percentage:".$Igst.""; - } + if(($Igst-$beforeIgst)!=0) + { + + $rowspanvalue++; + $CAD=$CAD."Current IGST Percentage : ".$beforeIgst ."Revised IGST Percentage:".$Igst.""; + } - } - if($rowspanvalue>0) - { - $rowspanvalue++; - $CAD2=''; - $CAD2=$CAD; - $CAD=''; - $CAD="".$MaterialCode.""; - $CAD.=$CAD2; - } - - $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD,'Per'=>$Per,'ServiceMaterialDescription'=>$CapitalItemDescrition); - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - $LineItemNo = ''; - - foreach($POLineItem as $line): - $LineItemNo = $line['LineItemNo']; - endforeach; - - - if(trim($POType) == CAPITAL ) - { + } + if($rowspanvalue>0) + { + $rowspanvalue++; + $CAD2=''; + $CAD2=$CAD; + $CAD=''; + $CAD="".$MaterialCode.""; + $CAD.=$CAD2; + } + + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD,'Per'=>$Per,'ServiceMaterialDescription'=>$CapitalItemDescrition); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + $LineItemNo = ''; + + foreach($POLineItem as $line): + $LineItemNo = $line['LineItemNo']; + endforeach; + + + 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,'FreightType'=>$FreightTypeloc,'NoOfTrip'=>$FreightNoofTriploc,'FreightValue'=>$Freightrateloc,'AfterFreightValue'=>$FreightAmountloc); + $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); - } - else if($capitalType=='0'){ - $ImportTaxList = array('LineItemNo'=>$LineItemNo, 'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$NOOfTrip,'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'AssessableValue'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge); - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); - } - } - - } + } + else if($capitalType=='0'){ + $ImportTaxList = array('LineItemNo'=>$LineItemNo, 'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$NOOfTrip,'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'AssessableValue'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge); + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + } + } + + } - $qty = $this->purchaseorder_model->getpolineqty($NewPO); + $qty = $this->purchaseorder_model->getpolineqty($NewPO); - - $ordqty =''; - $recqty =''; - // $POno=''; - // sum(Quantity)as Qty,sum(ReceivedQuantity)as rec + + $ordqty =''; + $recqty =''; + // $POno=''; + // sum(Quantity)as Qty,sum(ReceivedQuantity)as rec - // foreach ($qty as $qtyvalue) - // { - $ordqty = $qty[0]->Qty; - $recqty = $qty[0]->rec; - // $POno = $qtyvalue->PONO; + // foreach ($qty as $qtyvalue) + // { + $ordqty = $qty[0]->Qty; + $recqty = $qty[0]->rec; + // $POno = $qtyvalue->PONO; - if($ordqty == $recqty) - { - - $Newstatus = array('Status'=>IGR_CREATED); - $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); - - $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus); + if($ordqty == $recqty) + { + + $Newstatus = array('Status'=>IGR_CREATED); + $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); + + $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus); - } - - - echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ; - } + } + + + echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ; + } /** - * To Store release import Po values after edit - */ - function EditAmendImportPO() + * To Store release import Po values after edit + */ + function EditAmendImportPO() { - $MAD=''; - $PONO =$this->input->post('txtPONO'); - - $POdt = ''; - $createddt=''; + $MAD=''; + $PONO =$this->input->post('txtPONO'); + + $POdt = ''; + $createddt=''; - $PODate = $this->getDateformat($POdt); + $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('DeliveryAddr'); - $dt = $this->input->post('Deliverydt'); - $Deliverydt = $this->getDateformat($dt); - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydt'); + $Deliverydt = $this->getDateformat($dt); + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('txtPoRange'); $updatedBy = $this->session->userdata ( 'userId' ); @@ -1324,11 +1303,11 @@ foreach ($igrvalue as $value) { $Edt=$this->input->post('Exchangerateon'); $ExchangeRateCalculatedon=$this->getDateformat($Edt); - $CurrencyType=$this->input->post('currencytype'); - $DeliveryOption = $this->input->post('DateRange'); + $CurrencyType=$this->input->post('currencytype'); + $DeliveryOption = $this->input->post('DateRange'); - $DeliverySchedule=''; + $DeliverySchedule=''; $Dispatch=''; if($DeliveryOption==1) { @@ -1342,27 +1321,27 @@ foreach ($igrvalue as $value) { $Dispatch = $this->input->post('Dispatch'); $DeliverySchedule = ''; } - - $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - $TotalOrder = $this->input->post('txttot'); - $AmendTotal=$this->input->post('txttotamend'); - $MAD.="Current Total Order Value:  :" . $AmendTotal ."
"; - $POStatus = $this->input->post('txtStatus'); + $TotalOrder = $this->input->post('txttot'); + $AmendTotal=$this->input->post('txttotamend'); + $MAD.="Current Total Order Value:  :" . $AmendTotal ."
"; + $POStatus = $this->input->post('txtStatus'); $CreateBy = $this->session->userdata ( 'userId' ); - $RowCount = $this->input->post('txtRowCount'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $createddt = $dt->format('Y-m-d H:i:s'); - $updateddt = $dt->format('Y-m-d H:i:s'); - - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updateddt = $dt->format('Y-m-d H:i:s'); + $RowCount = $this->input->post('txtRowCount'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $updateddt = $dt->format('Y-m-d H:i:s'); + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $updateddt = $dt->format('Y-m-d H:i:s'); - $PaymentTerms=$this->input->post('PaymentTerms'); - $beforePaymentTerms=$this->input->post('beforePaymentterms'); + $PaymentTerms=$this->input->post('PaymentTerms'); + $beforePaymentTerms=$this->input->post('beforePaymentterms'); - $Shipmentmode=$this->input->post('addmodeofshipment'); + $Shipmentmode=$this->input->post('addmodeofshipment'); $SupplierRef=$this->input->post('amendsupplierreference'); $SupplierOffer=$this->input->post('amendsupplierofferno'); $otherRef=$this->input->post('amendotherreference'); @@ -1391,40 +1370,40 @@ foreach ($igrvalue as $value) { $Insurancenumber=''; $insurestatus='0'; } - $importoption=$this->input->post('Importoption'); + $importoption=$this->input->post('Importoption'); - if($PaymentTerms!=$beforePaymentTerms) - { - - $MAD.="Current Payment Terms  " . $beforePaymentTerms."
"; - } - - $Palaceoforigin=$this->input->post('PlaceOforigin'); - $beforePalaceoforigin=$this->input->post('beforePlaceOforigin'); + if($PaymentTerms!=$beforePaymentTerms) + { + + $MAD.="Current Payment Terms  " . $beforePaymentTerms."
"; + } + + $Palaceoforigin=$this->input->post('PlaceOforigin'); + $beforePalaceoforigin=$this->input->post('beforePlaceOforigin'); - if($Palaceoforigin!=$beforePalaceoforigin) - { - - $MAD.=$MAD."Current Place of Origin:  " . $beforePalaceoforigin."
"; - } - - $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'POType'=>$POType,'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'Import_DispatchDetails'=>$Dispatch,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'Import_PlaceofOrgin'=>$Palaceoforigin,'Mode_Of_Shipment'=>$Shipmentmode,'Supplier_Reference'=>$SupplierRef,'Supplier_Offer_No'=>$SupplierOffer,'Other_Reference'=>$otherRef,'Fincap'=>$finCap,'AmendedDetails'=>$MAD,'PaymentOtherDescription'=>$OtherPayment,'InsuranceStatus'=>$insurestatus,'InsuranceNumber'=>$Insurancenumber,'POSubType'=>$importoption,'IsQualityChkReqired'=>$qtycheckresult); - $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); - $NewPO = ''; - if(count($LastPO)>0) - { - $NewPO = $LastPO[0]['PONO']; - } - - $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - - $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - - $LineItemStatus = REQITEM_NEW; + if($Palaceoforigin!=$beforePalaceoforigin) + { + + $MAD.=$MAD."Current Place of Origin:  " . $beforePalaceoforigin."
"; + } + + $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'POType'=>$POType,'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'Import_DispatchDetails'=>$Dispatch,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'Import_PlaceofOrgin'=>$Palaceoforigin,'Mode_Of_Shipment'=>$Shipmentmode,'Supplier_Reference'=>$SupplierRef,'Supplier_Offer_No'=>$SupplierOffer,'Other_Reference'=>$otherRef,'Fincap'=>$finCap,'AmendedDetails'=>$MAD,'PaymentOtherDescription'=>$OtherPayment,'InsuranceStatus'=>$insurestatus,'InsuranceNumber'=>$Insurancenumber,'POSubType'=>$importoption,'IsQualityChkReqired'=>$qtycheckresult); + $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); + $NewPO = ''; + if(count($LastPO)>0) + { + $NewPO = $LastPO[0]['PONO']; + } + + $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS + + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); + + $LineItemStatus = REQITEM_NEW; - $igrvalue = $this->purchaseorder_model->selectigrmaster($PONO); + $igrvalue = $this->purchaseorder_model->selectigrmaster($PONO); $po = ''; @@ -1437,7 +1416,7 @@ foreach ($igrvalue as $value) { // } foreach ($igrvalue as $value) { - + $igrno = $value->IGRNO; $po =$value->PONO; @@ -1457,57 +1436,57 @@ foreach ($igrvalue as $value) { } - - for ($i = 1; $i <= $RowCount; $i++) - { - $CAD=''; - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); - $beforeQuantity=$this->input->post('beforequantity'.$i); + + for ($i = 1; $i <= $RowCount; $i++) + { + $CAD=''; + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $beforeQuantity=$this->input->post('beforequantity'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); - $itemRate = $this->input->post('itemRate'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $itemRate = $this->input->post('itemRate'.$i); $beforeitemRate=$this->input->post('beforeitemRate'.$i); - - $BasicPriceinmton = $this->input->post('BasicPriceInMTon'.$i); - $Productprice = $this->input->post('ProductPrice'.$i); - $LandingCharge = $this->input->post('LandingCharge'.$i); - $beforeLandingCharge = $this->input->post('beforeLandingCharge'.$i); - - $AfterLandingCharge = $this->input->post('AfterLandingCharge'.$i); - - $CustomDuty = $this->input->post('CustomDuty'.$i); + + $BasicPriceinmton = $this->input->post('BasicPriceInMTon'.$i); + $Productprice = $this->input->post('ProductPrice'.$i); + $LandingCharge = $this->input->post('LandingCharge'.$i); + $beforeLandingCharge = $this->input->post('beforeLandingCharge'.$i); + + $AfterLandingCharge = $this->input->post('AfterLandingCharge'.$i); + + $CustomDuty = $this->input->post('CustomDuty'.$i); - $beforeCustomDuty=$this->input->post('beforeCustomDuty'.$i); + $beforeCustomDuty=$this->input->post('beforeCustomDuty'.$i); - $AfterCustomDuty = $this->input->post('AfterCustomDuty'.$i); + $AfterCustomDuty = $this->input->post('AfterCustomDuty'.$i); - $CustomEd= $this->input->post('CustomEdCess1'.$i); - $beforeCustomEd=$this->input->post('beforeCustomEdCess'.$i); - - $AfterCustomEd= $this->input->post('AfterCustomEdCess1'.$i); + $CustomEd= $this->input->post('CustomEdCess1'.$i); + $beforeCustomEd=$this->input->post('beforeCustomEdCess'.$i); + + $AfterCustomEd= $this->input->post('AfterCustomEdCess1'.$i); - $CustomSH = $this->input->post('CustomSHCess'.$i); - $beforeCustomSH=$this->input->post('beforeCustomSHCess'.$i); - - $AfterCustomSH = $this->input->post('AfterCustomSHCess'.$i); + $CustomSH = $this->input->post('CustomSHCess'.$i); + $beforeCustomSH=$this->input->post('beforeCustomSHCess'.$i); + + $AfterCustomSH = $this->input->post('AfterCustomSHCess'.$i); - $Grossdutypayable = $this->input->post('Grossdutypayable1'.$i); - $beforeGrossdutypayable = $this->input->post('beforeGrossdutypayable'.$i); + $Grossdutypayable = $this->input->post('Grossdutypayable1'.$i); + $beforeGrossdutypayable = $this->input->post('beforeGrossdutypayable'.$i); - $Assable=$this->input->post('AssessableValue'.$i); - $beforeAssable=$this->input->post('beforeAssessableValue'.$i); + $Assable=$this->input->post('AssessableValue'.$i); + $beforeAssable=$this->input->post('beforeAssessableValue'.$i); - $Subtotal=$this->input->post('SubTotal'.$i); - $beforeSubtotal=$this->input->post('beforeSubTotal'.$i); + $Subtotal=$this->input->post('SubTotal'.$i); + $beforeSubtotal=$this->input->post('beforeSubTotal'.$i); $Igst=$this->input->post('IGST'.$i); $beforeIgst=$this->input->post('beforeIGST'.$i); $AfterIgst=$this->input->post('AfterIGST'.$i); - - $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpensesPerKG'.$i); - $beforeCustomDutyExpensesPerKG = $this->input->post('beforeCustomDutyExpensesPerKG'.$i); + + $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpensesPerKG'.$i); + $beforeCustomDutyExpensesPerKG = $this->input->post('beforeCustomDutyExpensesPerKG'.$i); $FreightType=$this->input->post('FreightType'.$i); $NoOfTrip=$this->input->post('NoOfTrip'.$i); @@ -1526,176 +1505,176 @@ foreach ($igrvalue as $value) { $ClearingCharge = $this->input->post('ClearingCharge'.$i); $NetValue = $this->input->post('NetValue'.$i); $DutyImpact=$this->input->post('DutyImpact'.$i); - - $specialinstruction=$this->input->post('Addinstruction'.$i); - $CostCenter = $this->input->post('costCode'.$i); - - $Totalvalueitem=$this->input->post('txtTotalorderValue'); - $RecQtyvalue=0; - $rowspanvalue=0; - $LineItemNo = ''; + + $specialinstruction=$this->input->post('Addinstruction'.$i); + $CostCenter = $this->input->post('costCode'.$i); + + $Totalvalueitem=$this->input->post('txtTotalorderValue'); + $RecQtyvalue=0; + $rowspanvalue=0; + $LineItemNo = ''; - if(($itemRate-$beforeitemRate)!=0) - { - $rowspanvalue++; - $CAD=$CAD."Current Rate : ".$beforeitemRate ."Revised Rate:".$itemRate.""; - } + if(($itemRate-$beforeitemRate)!=0) + { + $rowspanvalue++; + $CAD=$CAD."Current Rate : ".$beforeitemRate ."Revised Rate:".$itemRate.""; + } - if(($Quantity-$beforeQuantity)!=0) - { - $rowspanvalue++; - $CAD=$CAD."Current Quantity : ".$beforeQuantity ."Revised Quantity:".$Quantity.""; - } + if(($Quantity-$beforeQuantity)!=0) + { + $rowspanvalue++; + $CAD=$CAD."Current Quantity : ".$beforeQuantity ."Revised Quantity:".$Quantity.""; + } - if(($LandingCharge-$beforeLandingCharge)!=0) - { - - $rowspanvalue++; - $CAD=$CAD."Current Landing percentage : ".$beforeLandingCharge ."Revised Landing Percentage:".$LandingCharge.""; - } - - if(($CustomDuty-$beforeCustomDuty)!=0) - { - + if(($LandingCharge-$beforeLandingCharge)!=0) + { + + $rowspanvalue++; + $CAD=$CAD."Current Landing percentage : ".$beforeLandingCharge ."Revised Landing Percentage:".$LandingCharge.""; + } + + if(($CustomDuty-$beforeCustomDuty)!=0) + { + $rowspanvalue++; - $CAD=$CAD."Current CustomDuty : ".$beforeCustomDuty ."Revised CustomDuty:".$CustomDuty.""; - } + $CAD=$CAD."Current CustomDuty : ".$beforeCustomDuty ."Revised CustomDuty:".$CustomDuty.""; + } - if($CustomEd-$beforeCustomEd) - { - $rowspanvalue++; + if($CustomEd-$beforeCustomEd) + { + $rowspanvalue++; $CAD=$CAD."Current CustomEd : ".$beforeCustomEd ."Revised CustomEd:".$CustomEd.""; } if($CustomSH-$beforeCustomSH) - { - $rowspanvalue++; + { + $rowspanvalue++; $CAD=$CAD."Current CustomSH : ".$beforeCustomSH ."Revised CustomSH:".$CustomSH.""; - } + } - if($FreightType!=$beforeFreightType) - { + if($FreightType!=$beforeFreightType) + { - $rowspanvalue++; - $CAD=$CAD."Current Freight Type: ".$beforeFreightType ."Revised Freight Type:".$FreightType.""; - } + $rowspanvalue++; + $CAD=$CAD."Current Freight Type: ".$beforeFreightType ."Revised Freight Type:".$FreightType.""; + } - if($NoOfTrip-$beforeNoOfTrip) - { + if($NoOfTrip-$beforeNoOfTrip) + { - $rowspanvalue++; - $CAD=$CAD."Current No of Trip: ".$beforeNoOfTrip ."Revised Additional Excise duty:".$NoOfTrip.""; - } + $rowspanvalue++; + $CAD=$CAD."Current No of Trip: ".$beforeNoOfTrip ."Revised Additional Excise duty:".$NoOfTrip.""; + } - if($Freightrate-$beforeFreightrate) - { + if($Freightrate-$beforeFreightrate) + { - $rowspanvalue++; - $CAD=$CAD."Current Freightrate: ".$beforeFreightrate ."Revised Freightrate:".$Freightrate.""; - } + $rowspanvalue++; + $CAD=$CAD."Current Freightrate: ".$beforeFreightrate ."Revised Freightrate:".$Freightrate.""; + } - if($Freightamount-$beforeFreightamount) - { + if($Freightamount-$beforeFreightamount) + { - $rowspanvalue++; - $CAD=$CAD."Current Freight Amount: ".$beforeFreightamount ."Revised Freight Amount:".$Freightamount.""; - } + $rowspanvalue++; + $CAD=$CAD."Current Freight Amount: ".$beforeFreightamount ."Revised Freight Amount:".$Freightamount.""; + } - if($per!=$beforeper) - { - $rowspanvalue++; - $CAD=$CAD."Current Per Value: ".$beforeper ."Revised Per Value:".$per.""; - } + if($per!=$beforeper) + { + $rowspanvalue++; + $CAD=$CAD."Current Per Value: ".$beforeper ."Revised Per Value:".$per.""; + } - if(($Assable-$beforeAssable)!=0) - { - $rowspanvalue++; - $CAD=$CAD."Current Assessable : ".$beforeAssable ."Revised CustomDuty:".$Assable.""; - } + if(($Assable-$beforeAssable)!=0) + { + $rowspanvalue++; + $CAD=$CAD."Current Assessable : ".$beforeAssable ."Revised CustomDuty:".$Assable.""; + } - if(($Subtotal-$beforeSubtotal)!=0) - { + if(($Subtotal-$beforeSubtotal)!=0) + { $rowspanvalue++; - $CAD=$CAD."Current Subtotal : ".$beforeSubtotal ."Revised Subtotal:".$Subtotal.""; - } + $CAD=$CAD."Current Subtotal : ".$beforeSubtotal ."Revised Subtotal:".$Subtotal.""; + } if(($Igst-$beforeIgst)!=0) - { + { $rowspanvalue++; - $CAD=$CAD."Current IGST Percentage : ".$beforeIgst ."Revised IGST Percentage:".$Igst.""; - } + $CAD=$CAD."Current IGST Percentage : ".$beforeIgst ."Revised IGST Percentage:".$Igst.""; + } if(($Grossdutypayable-$beforeGrossdutypayable)!=0) - { + { $rowspanvalue++; - $CAD=$CAD."Current Gross Duty Payable : ".$beforeGrossdutypayable ."Revised Gross Duty Payable:".$Grossdutypayable.""; - } - - if($rowspanvalue>0) - { - $rowspanvalue++; - $CAD2=''; - $CAD2=$CAD; - $CAD=''; - $CAD="".$MaterialCode.""; - $CAD.=$CAD2; - } - - $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD,'Per'=>$per,'ServiceMaterialDescription'=>$specialinstruction); - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - - $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$NoOfTrip,'FreightValue'=>$Freightrate,'AfterFreightValue'=>$Freightamount,'AssessableValue'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge); - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); - - } + $CAD=$CAD."Current Gross Duty Payable : ".$beforeGrossdutypayable ."Revised Gross Duty Payable:".$Grossdutypayable.""; + } + + if($rowspanvalue>0) + { + $rowspanvalue++; + $CAD2=''; + $CAD2=$CAD; + $CAD=''; + $CAD="".$MaterialCode.""; + $CAD.=$CAD2; + } + + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD,'Per'=>$per,'ServiceMaterialDescription'=>$specialinstruction); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + + $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$NoOfTrip,'FreightValue'=>$Freightrate,'AfterFreightValue'=>$Freightamount,'AssessableValue'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge); + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + + } - $qty = $this->purchaseorder_model->getpolineqty($NewPO); + $qty = $this->purchaseorder_model->getpolineqty($NewPO); - - $ordqty =''; - $recqty =''; - // $POno=''; - // sum(Quantity)as Qty,sum(ReceivedQuantity)as rec + + $ordqty =''; + $recqty =''; + // $POno=''; + // sum(Quantity)as Qty,sum(ReceivedQuantity)as rec - // foreach ($qty as $qtyvalue) - // { - $ordqty = $qty[0]->Qty; - $recqty = $qty[0]->rec; - // $POno = $qtyvalue->PONO; + // foreach ($qty as $qtyvalue) + // { + $ordqty = $qty[0]->Qty; + $recqty = $qty[0]->rec; + // $POno = $qtyvalue->PONO; - if($ordqty == $recqty) - { - - $Newstatus = array('Status'=>IGR_CREATED); - $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); - - $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus); + if($ordqty == $recqty) + { + + $Newstatus = array('Status'=>IGR_CREATED); + $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); + + $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus); - } - - echo 'Purchase Order is'.$PONO.'Amended Successfully! New PO Number is: '.$NewPO ; - } - + } + + echo 'Purchase Order is'.$PONO.'Amended Successfully! New PO Number is: '.$NewPO ; + } + /** * To convert the dateformat (date with time) and store to DB */ - function getDateformat($Val) - { - $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); - $retDate = $date->format('Y-m-d H:i:s'); - return $retDate; - } - + function getDateformat($Val) + { + $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); + $retDate = $date->format('Y-m-d H:i:s'); + return $retDate; + } + } diff --git a/application/controllers/inwardgateregister.php b/application/controllers/inwardgateregister.php index 4c5752f4..2930bb08 100644 --- a/application/controllers/inwardgateregister.php +++ b/application/controllers/inwardgateregister.php @@ -37,7 +37,7 @@ class inwardgateregister extends BaseController function viewIGRDetails() { - $this->load->model('inwardgateregister_model'); + $this->global['pageTitle'] = 'Siddharth : Inward Gate Register Details'; $data['IGR']= $this->inwardgateregister_model->igrListing(); @@ -280,7 +280,7 @@ class inwardgateregister extends BaseController function addloadfile() { - + $upfiles = ''; $pono= $this->input->post('PONO'); $igr= $this->input->post('igr'); diff --git a/application/views/viewIGRDetails.php b/application/views/viewIGRDetails.php index af7928e3..59550a5a 100755 --- a/application/views/viewIGRDetails.php +++ b/application/views/viewIGRDetails.php @@ -96,9 +96,10 @@ + + + @@ -497,7 +498,8 @@ $("#hiddenPONO").val(po); Filename = item.file; FilePath =item.file; } - + if(item.BillNo != null) + { i=i+1; trHTML += '' + '' + i + '' + @@ -509,7 +511,7 @@ $("#hiddenPONO").val(po); '' + ''; - + } }); $("#tblefile").empty(); @@ -657,7 +659,7 @@ counter++; // alert(bil_count); // alert(file_count); - if(bil_count>=5){ + if(bil_count>=6){ alert("You have to upload five files only");//this allows only 5 files; return false; @@ -745,7 +747,7 @@ counter++; function fileupload(counter) { - // alert(counter); + //alert(counter); var formData = new FormData(); @@ -776,7 +778,7 @@ counter++; success:function(data) { if(data){ alert(data); - //window.location.reload(); + $('.content').loader('hide'); // $('#spl').find('td').eq(5).text(filename[2]); $('#billModel').modal('hide'); diff --git a/uploads/Igrfiles/po.png b/uploads/Igrfiles/po.png deleted file mode 100644 index e5285504..00000000 Binary files a/uploads/Igrfiles/po.png and /dev/null differ