diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 1a89c03f..c2663468 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -1739,28 +1739,48 @@ $createddt=''; } } /* Add capital Po*/ - function addNewCapitalPurchaseOrder() + function addNewCapitalPurchaseOrder() { +//echo "sxscd"; +//die(); - - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('DeliveryAddr'); - $dt = $this->input->post('Deliverydt'); - - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydt'); + + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('txtPoRange'); - $DeliveryOption = $this->input->post('DateRange'); - if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; - } + //$DeliveryOption = $this->input->post('DateRange'); + // if($DeliveryOption==1){ + // $Deliverydt = ''; + // $DeliverySchedule = $this->input->post('Scheduleby'); + // } + //else{ + //$Deliverydt = $this->getDateformat($dt); + //$DeliverySchedule = ''; + // } + + $DeliveryOption = $this->input->post('DateRange'); + + //echo $DeliveryOption; + //die(); + $DeliverySchedule=''; + $Dispatch=''; + if($DeliveryOption==1) + { + $Dispatch=''; + $DeliverySchedule = $this->input->post('Scheduleby'); + } + + + else + { + $Dispatch = $this->input->post('Dispatch'); + $DeliverySchedule = ''; + } $capitalType = $this->input->post('capitalType'); if($capitalType=='Domestic'){ $CapitalRange = '1'; @@ -1776,142 +1796,153 @@ $createddt=''; $PaymentMethod = $this->input->post('PaymentMethod'); $PayableAT = $this->input->post('PayableAT'); + $Palaceoforigin=$this->input->post('PlaceOforigin'); - $PaymentDate=$this->input->post('PaymentDate'); - $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - $TotalOrder = $this->input->post('CapitalToatlOrder'); - $POStatus = $this->input->post('txtStatus'); - + $PaymentDate=$this->input->post('PaymentDate'); + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + $TotalOrder = $this->input->post('CapitalToatlOrder'); + $POStatus = $this->input->post('txtStatus'); + $CreateBy = $this->session->userdata ( 'userId' ); - $RowCount = $this->input->post('txtRowCount'); + $RowCount = $this->input->post('txtRowCount'); - $DeletedRow = $this->input->post('txtDeletedRow'); - - $comma_separated = explode(':', $DeletedRow); - - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $createddt = $dt->format('Y-m-d H:i:s'); - $currencytypeID = $this->input->post('currencytype'); + $DeletedRow = $this->input->post('txtDeletedRow'); + + $comma_separated = explode(':', $DeletedRow); + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $currencytypeID = $this->input->post('currencytype'); - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'ExchangeRate'=>$ExchangeRate,'PaymentTerms'=>$PaymentMethod,'PaymentDays'=>$PaymentDate,'PayableAt'=>$PayableAT,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CapitalRange'=>$CapitalRange,'POType'=>$POType,'CurrencyType'=>$currencytypeID); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'ExchangeRate'=>$ExchangeRate,'PaymentTerms'=>$PaymentMethod,'PaymentDays'=>$PaymentDate,'PayableAt'=>$PayableAT,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CapitalRange'=>$CapitalRange,'POType'=>$POType,'CurrencyType'=>$currencytypeID,'DeliverySchedule'=>$DeliverySchedule,'Import_PlaceofOrgin'=>$Palaceoforigin,'Import_DispatchDetails'=>$Dispatch); + + // $POList = array('SupplierID'=>$SupplierID, '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,'POType'=>$POType,'Import_PlaceofOrgin'=>$Palaceoforigin); - - $POMaster = $this->purchaseorder_model->addPOMaster($POList); - - $PONO = ''; - if(count($POMaster)>0) - { - $PONO = $POMaster[0]['PONO']; - } - - $LineItemStatus = REQITEM_NEW; - - for ($i = 1; $i <= $RowCount; $i++) - { - - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); - $itemRate = $this->input->post('itemRate'.$i); + + $POMaster = $this->purchaseorder_model->addPOMaster($POList); + + $PONO = ''; + if(count($POMaster)>0) + { + $PONO = $POMaster[0]['PONO']; + } + + $LineItemStatus = REQITEM_NEW; + + for ($i = 1; $i <= $RowCount; $i++) + { + + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $itemRate = $this->input->post('itemRate'.$i); + //echo $itemRate; + //die(); - - $BasicPriceinmton = $this->input->post('rateInUs'.$i); - $Productprice = $this->input->post('basicvalInINR'.$i); - $LandingCharge = $this->input->post('beforeLanding'.$i); - $AfterLandingCharge = $this->input->post('landingCharge'.$i); - $HighSeas = $this->input->post('beforeHighSeasSalesCharge'.$i); - $AfterHighSeas = $this->input->post('HighSeasSalesCharge'.$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); + $HighSeas = $this->input->post('beforeHighSeasSalesCharge'.$i); + $AfterHighSeas = $this->input->post('HighSeasSalesCharge'.$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); - $ExciseDuty = $this->input->post('beforeExciseDuty'.$i); - $AfterExciseDuty = $this->input->post('ExciseDuty'.$i); - $ExciseDutyEd = $this->input->post('beforeExciseDutyEDCess'.$i); - $AfterExciseDutyEd = $this->input->post('ExciseDutyEDCess'.$i); + $ExciseDuty = $this->input->post('beforeExciseDuty'.$i); + $AfterExciseDuty = $this->input->post('ExciseDuty'.$i); + $ExciseDutyEd = $this->input->post('beforeExciseDutyEDCess'.$i); + $AfterExciseDutyEd = $this->input->post('ExciseDutyEDCess'.$i); - $ExciseDutySH = $this->input->post('beforeExciseDutySHCess'.$i); - $AfterExciseDutySH = $this->input->post('ExciseDutySHCess'.$i); + $ExciseDutySH = $this->input->post('beforeExciseDutySHCess'.$i); + $AfterExciseDutySH = $this->input->post('ExciseDutySHCess'.$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); - $AddAdtional = $this->input->post('beforeAdditionalExciseDuty'.$i); - $AfterAddAdtional = $this->input->post('AdditionalExciseDuty'.$i); + $AddAdtional = $this->input->post('beforeAdditionalExciseDuty'.$i); + $AfterAddAdtional = $this->input->post('AdditionalExciseDuty'.$i); - $Grossdutypayable = $this->input->post('GrossDutyPayable'.$i); - $AvailableModvat = $this->input->post('AvailableModvat'.$i); - $Grossexpensesduetocustomduty = $this->input->post('GrossExpensesDuetoCustom'.$i); - $purchaseratePerKG = $this->input->post('purchaseRate'.$i); - $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpenses'.$i); - $RMCIncludingCustomersPerKG = $this->input->post('RMCIncludingCustomers'.$i); - $QuantityKG = $this->input->post('PurQuantity'.$i); + $Grossdutypayable = $this->input->post('GrossDutyPayable'.$i); + $AvailableModvat = $this->input->post('AvailableModvat'.$i); + $Grossexpensesduetocustomduty = $this->input->post('GrossExpensesDuetoCustom'.$i); + $purchaseratePerKG = $this->input->post('purchaseRate'.$i); + $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpenses'.$i); + $RMCIncludingCustomersPerKG = $this->input->post('RMCIncludingCustomers'.$i); + $QuantityKG = $this->input->post('PurQuantity'.$i); - - $Totalvalueitem=$this->input->post('PerKgExpense'.$i); + + $Totalvalueitem=$this->input->post('PerKgExpense'.$i); - //echo $BasicPriceinmton; - $CostCenter = $this->input->post('CPCostCode'.$i); - $ServiceTax = $this->input->post('AfterServiceTax'.$i); - $EduCess = $this->input->post('AfterEduCess'.$i); - $SecHighTax = $this->input->post('AfterSecHighTax'.$i); - $KrishiTax = $this->input->post('AfterKrishiTax'.$i); - $SwachhTax = $this->input->post('AfterSwachhTax'.$i); - - - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - - $SkipInsert = "False"; - if( count($comma_separated) > 0) - { - for($j = 1; $j < count($comma_separated); $j++) - { - $deletedRow = $comma_separated[$j] ; - - if($deletedRow == $i ) - { - $SkipInsert = "True"; - break; - } - - } - } - if($SkipInsert == "False") - { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - $LineItemNo = ''; - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - //echo $LineItemNo; - - if(trim($POType) == CAPITAL ) - { - $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); + //echo $BasicPriceinmton; + $CostCenter = $this->input->post('CPCostCode'.$i); + $ServiceTax = $this->input->post('AfterServiceTax'.$i); + $EduCess = $this->input->post('AfterEduCess'.$i); + $SecHighTax = $this->input->post('AfterSecHighTax'.$i); + $KrishiTax = $this->input->post('AfterKrishiTax'.$i); + $SwachhTax = $this->input->post('AfterSwachhTax'.$i); + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + + $SkipInsert = "False"; + if( count($comma_separated) > 0) + { + for($j = 1; $j < count($comma_separated); $j++) + { + $deletedRow = $comma_separated[$j] ; + + if($deletedRow == $i ) + { + $SkipInsert = "True"; + break; + } + + } + } + if($SkipInsert == "False") + { + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + + $LineItemNo = ''; + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + //echo $LineItemNo; + + if(trim($POType) == CAPITAL ) + { + $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); - $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); - if($CapitalRange=='0'){ - $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); - - - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); + } + + if($CapitalRange=='0') + { + //echo "dsc"; + //die(); + $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); + + //print_r( $ImportTaxList); + //die(); + + + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); } - - } - } - - } - echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; + + //} + } + + } + echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; } @@ -1919,27 +1950,50 @@ $createddt=''; function EditCapitalPurchaseOrder() { + echo "scsdc"; + die(); + $PONO =$this->input->post('txtPONO'); + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); + $SupplierID = $this->input->post('drpSupplier'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydt'); + + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('txtPoRange'); - $PONO =$this->input->post('txtPONO'); - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); - $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('DeliveryAddr'); - $dt = $this->input->post('Deliverydt'); - - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); + // $DeliveryOption = $this->input->post('DateRange'); + // if($DeliveryOption==1){ + // $Deliverydt = ''; + // $DeliverySchedule = $this->input->post('Scheduleby'); + // } + // else{ + // $Deliverydt = $this->getDateformat($dt); + // $DeliverySchedule = ''; + // } - $DeliveryOption = $this->input->post('DateRange'); - if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; - } - + + $DeliveryOption = $this->input->post('DateRange'); + + //echo $DeliveryOption; + //die(); + $DeliverySchedule=''; + $Dispatch=''; + if($DeliveryOption==1) + { + $Dispatch=''; + $DeliverySchedule = $this->input->post('Scheduleby'); + } + + + else + { + $Dispatch = $this->input->post('Dispatch'); + $DeliverySchedule = ''; + } + + + $capitalType = $this->input->post('capitalType'); $currencytypeID = $this->input->post('currencytype'); if($capitalType=='1'){ @@ -1958,164 +2012,172 @@ $createddt=''; $PayableAT = $this->input->post('PayableAT'); - $PaymentDate=$this->input->post('PaymentDate'); - $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - $TotalOrder = $this->input->post('CapitalToatlOrder'); - $POStatus = $this->input->post('txtStatus'); - + $PaymentDate=$this->input->post('PaymentDate'); + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + $TotalOrder = $this->input->post('CapitalToatlOrder'); + $POStatus = $this->input->post('txtStatus'); + $Palaceoforigin=$this->input->post('PlaceOforigin'); + $CreateBy = $this->session->userdata ( 'userId' ); - $RowCount = $this->input->post('txtRowCount'); + $RowCount = $this->input->post('txtRowCount'); - $DeletedRow = $this->input->post('txtDeletedRow'); - - $comma_separated = explode(':', $DeletedRow); - - $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'); - - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'PaymentDays'=>$PaymentDate,'PayableAt'=>$PayableAT,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID); - - - $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); - - $LineItemStatus = REQITEM_NEW; - - - - - for ($i = 1; $i <= $RowCount; $i++) - { - - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); - $itemRate = $this->input->post('itemRate'.$i); + $DeletedRow = $this->input->post('txtDeletedRow'); + + $comma_separated = explode(':', $DeletedRow); + + $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'); + + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'PaymentDays'=>$PaymentDate,'PayableAt'=>$PayableAT,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID,'DeliverySchedule'=>$DeliverySchedule,'Import_PlaceofOrgin'=>$Palaceoforigin,'Import_DispatchDetails'=>$Dispatch); - $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); - $HighSeas = $this->input->post('beforeHighSeasSalesCharge'.$i); - $AfterHighSeas = $this->input->post('HighSeasSalesCharge'.$i); + // $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'ExchangeRate'=>$ExchangeRate,'PaymentTerms'=>$PaymentMethod,'PaymentDays'=>$PaymentDate,'PayableAt'=>$PayableAT,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CapitalRange'=>$CapitalRange,'POType'=>$POType,'CurrencyType'=>$currencytypeID,'DeliverySchedule'=>$DeliverySchedule,'Import_PlaceofOrgin'=>$Palaceoforigin,'Import_DispatchDetails'=>$Dispatch); + print_r($POList); + die(); - $CustomDuty = $this->input->post('beforeCustomDuty'.$i); - $AfterCustomDuty = $this->input->post('CustomDuty'.$i); + + + $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); + + $LineItemStatus = REQITEM_NEW; + + + + + for ($i = 1; $i <= $RowCount; $i++) + { + + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $itemRate = $this->input->post('itemRate'.$i); - $ExciseDuty = $this->input->post('beforeExciseDuty'.$i); - $AfterExciseDuty = $this->input->post('ExciseDuty'.$i); - $ExciseDutyEd = $this->input->post('beforeExciseDutyEDCess'.$i); - $AfterExciseDutyEd = $this->input->post('ExciseDutyEDCess'.$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); + $HighSeas = $this->input->post('beforeHighSeasSalesCharge'.$i); + $AfterHighSeas = $this->input->post('HighSeasSalesCharge'.$i); - $ExciseDutySH = $this->input->post('beforeExciseDutySHCess'.$i); - $AfterExciseDutySH = $this->input->post('ExciseDutySHCess'.$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); + $ExciseDuty = $this->input->post('beforeExciseDuty'.$i); + $AfterExciseDuty = $this->input->post('ExciseDuty'.$i); + $ExciseDutyEd = $this->input->post('beforeExciseDutyEDCess'.$i); + $AfterExciseDutyEd = $this->input->post('ExciseDutyEDCess'.$i); - $CustomSH = $this->input->post('beforeCustomSHCess'.$i); - $AfterCustomSH = $this->input->post('CustomSHCess'.$i); + $ExciseDutySH = $this->input->post('beforeExciseDutySHCess'.$i); + $AfterExciseDutySH = $this->input->post('ExciseDutySHCess'.$i); - $AddAdtional = $this->input->post('beforeAdditionalExciseDuty'.$i); - $AfterAddAdtional = $this->input->post('AdditionalExciseDuty'.$i); + $CustomEd= $this->input->post('beforeCustomEDCess'.$i); + $AfterCustomEd= $this->input->post('CustomEDCess'.$i); - $Grossdutypayable = $this->input->post('GrossDutyPayable'.$i); - $AvailableModvat = $this->input->post('AvailableModvat'.$i); - $Grossexpensesduetocustomduty = $this->input->post('GrossExpensesDuetoCustom'.$i); - $purchaseratePerKG = $this->input->post('purchaseRate'.$i); - $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpenses'.$i); - $RMCIncludingCustomersPerKG = $this->input->post('RMCIncludingCustomers'.$i); - $QuantityKG = $this->input->post('PurQuantity'.$i); + $CustomSH = $this->input->post('beforeCustomSHCess'.$i); + $AfterCustomSH = $this->input->post('CustomSHCess'.$i); - - $Totalvalueitem=$this->input->post('PerKgExpense'.$i); + $AddAdtional = $this->input->post('beforeAdditionalExciseDuty'.$i); + $AfterAddAdtional = $this->input->post('AdditionalExciseDuty'.$i); - //echo $BasicPriceinmton; - $CostCenter = $this->input->post('CPCostCode'.$i); - $ServiceTax = $this->input->post('AfterServiceTax'.$i); - $EduCess = $this->input->post('AfterEduCess'.$i); - $SecHighTax = $this->input->post('AfterSecHighTax'.$i); - $KrishiTax = $this->input->post('AfterKrishiTax'.$i); - $SwachhTax = $this->input->post('AfterSwachhTax'.$i); - + $Grossdutypayable = $this->input->post('GrossDutyPayable'.$i); + $AvailableModvat = $this->input->post('AvailableModvat'.$i); + $Grossexpensesduetocustomduty = $this->input->post('GrossExpensesDuetoCustom'.$i); + $purchaseratePerKG = $this->input->post('purchaseRate'.$i); + $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpenses'.$i); + $RMCIncludingCustomersPerKG = $this->input->post('RMCIncludingCustomers'.$i); + $QuantityKG = $this->input->post('PurQuantity'.$i); - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - $POLineItemNo = $this->input->post('LineItemNo'.$i); + + $Totalvalueitem=$this->input->post('PerKgExpense'.$i); + + //echo $BasicPriceinmton; + $CostCenter = $this->input->post('CPCostCode'.$i); + $ServiceTax = $this->input->post('AfterServiceTax'.$i); + $EduCess = $this->input->post('AfterEduCess'.$i); + $SecHighTax = $this->input->post('AfterSecHighTax'.$i); + $KrishiTax = $this->input->post('AfterKrishiTax'.$i); + $SwachhTax = $this->input->post('AfterSwachhTax'.$i); + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $POLineItemNo = $this->input->post('LineItemNo'.$i); - $SkipInsert = "False"; - if( count($comma_separated) > 0) - { - for($j = 1; $j < count($comma_separated); $j++) - { - $deletedRow = $comma_separated[$j] ; - - if($deletedRow == $i) - { - $SkipInsert = "True"; - break; - } - - } - } - if($SkipInsert == "False") - { - if(strlen($POLineItemNo) == 0) - { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - $LineItemNo = ''; - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - //echo $LineItemNo; - - if(trim($POType) == CAPITAL ) - { - $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); + $SkipInsert = "False"; + if( count($comma_separated) > 0) + { + for($j = 1; $j < count($comma_separated); $j++) + { + $deletedRow = $comma_separated[$j] ; + + if($deletedRow == $i) + { + $SkipInsert = "True"; + break; + } + + } + } + if($SkipInsert == "False") + { + if(strlen($POLineItemNo) == 0) + { + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + + $LineItemNo = ''; + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + //echo $LineItemNo; + + if(trim($POType) == CAPITAL ) + { + $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); - $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); - $ImportTaxList = array('LineItemNo'=>$LineItemNo, 'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); - //print_r($ImportTaxList); - //die(); - - - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); - - } - - } - else - { - $LineItemNo = $POLineItemNo; + $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); + + $ImportTaxList = array('LineItemNo'=>$LineItemNo, 'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); + //print_r($ImportTaxList); + //die(); + + + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + + } + + } + else + { + $LineItemNo = $POLineItemNo; - - - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); - $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$LineItemNo,$POLineItemList); - $ServiceTaxList = array('ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt); - - $ServiceTax = $this->purchaseorder_model->updateServiceTax($LineItemNo,$ServiceTaxList); - $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); - $ImportList= $this->purchaseorder_model->updateImportTax($LineItemNo,$ImportTaxList); - - } - - } - - } - - echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; + + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$LineItemNo,$POLineItemList); + + $ServiceTaxList = array('ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt); + + $ServiceTax = $this->purchaseorder_model->updateServiceTax($LineItemNo,$ServiceTaxList); + + $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); + + + $ImportList= $this->purchaseorder_model->updateImportTax($LineItemNo,$ImportTaxList); + + } + + } + + } + + echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; } /* capital po print/pdf*/ - public function CapitalPoPrint($PONO) + public function CapitalPoPrint($PONO) { diff --git a/application/views/capitalpurchaseorder.php b/application/views/capitalpurchaseorder.php index 40394163..18fbd214 100755 --- a/application/views/capitalpurchaseorder.php +++ b/application/views/capitalpurchaseorder.php @@ -24,9 +24,32 @@ if(!empty($AvlBudAmt)) { - $AvlAmount = $AvlBudAmt; + $AvlAmount = $AvlBudAmt; } + + // if(!empty($AvlimportBudAmt)) + // { + + // $AvlAmount = $AvlimportBudAmt; + + // } + + + +$INR=''; +$INRSYM=''; +if(!empty($INRSYMBOL)) +{ + foreach ($INRSYMBOL as $INR) + { + $INRSYM=$INR->Currency_Code; + $INR=$INR->FontCode2000; + } +} + +// echo $INRSYM; +// echo $INR; ?>