diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 1244b523..da726c96 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -32,7 +32,6 @@ class purchaseorder extends BaseController */ public function index() { - //$this->global['pageTitle'] = 'Resico : AddPO'; $this->global['pageTitle'] = $this->CompanyName.' : AddPO'; $this->loadViews("addPO", $this->global, NULL , NULL); } @@ -42,10 +41,8 @@ class purchaseorder extends BaseController */ function viewfullpurchaseorder() { - //$this->global['pageTitle'] = 'Resico : View Purchase Order'; $this->global['pageTitle'] = $this->CompanyName.' : View Purchase Order'; $this->loadViews("viewfullpurchaseorder", $this->global,Null); - } /** @@ -174,7 +171,6 @@ class purchaseorder extends BaseController { $FYStart =$Fy->StartYear; $FYEnd =$Fy->EndYear; - } } @@ -402,6 +398,7 @@ class purchaseorder extends BaseController } $data['getdata'] = $this->purchaseorder_model->getfunction($PONO); + //$data['billfile'] = $this->purchaseorder_model->getbillfiesr($PONO); $data['MaxPODate'] = $this->purchaseorder_model->getLastReleasedPODate(); $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); @@ -412,7 +409,7 @@ class purchaseorder extends BaseController $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); $data['getdata'] = $this->purchaseorder_model->getfunction($PONO); - + $data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO); $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); //$this->global['pageTitle'] = 'Resico : Edit Service Purchase order form'; $this->global['pageTitle'] = $this->CompanyName.' : Edit Service Purchase order form'; @@ -423,7 +420,8 @@ class purchaseorder extends BaseController $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); + $data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO); //$this->global['pageTitle'] = 'Resico : Edit Revenue Purchase order form'; $this->global['pageTitle'] = $this->CompanyName.' : Edit Revenue Purchase order form'; $this->loadViews("editRevenuepurchaseorder", $this->global, $data, NULL); @@ -450,7 +448,7 @@ class purchaseorder extends BaseController $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - + $data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO); $unicode =''; foreach ($data['CurrencyDetail'] as $Detail) @@ -489,8 +487,9 @@ class purchaseorder extends BaseController $data['POItem'] = $this->purchaseorder_model->getDomesticCapitalPurchaseOrderDetails($PONO); } $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); + $data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO); - + foreach($data['POItem'] as $Rate) { @@ -1079,7 +1078,11 @@ class purchaseorder extends BaseController $PONO =$this->input->post('txtPONO'); $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); - $SupplierID = $this->input->post('drpSupplier'); + $SupplierID = $this->input->post('drpSupplier'); + + $newsup=$this->input->post('newsup'); + $newSupId = split("[ - ]+", $newsup); + $DeliveryAddr = $this->input->post('txtDeliveryAddress'); $dt = $this->input->post('Deliverydt'); @@ -1093,7 +1096,9 @@ class purchaseorder extends BaseController $DeliverySchedule = ''; } - + $b4supplier=$this->input->post('b4supplier'); + $b4date=$this->input->post('b4podate'); + $b4podate = $this->getDateformat($b4date); $Modeofshipment=$this->input->post('editmodeofshipment'); $supplierreference=$this->input->post('editsupplierreference'); @@ -1110,12 +1115,12 @@ class purchaseorder extends BaseController $POType = $this->input->post('POType'); $PoRange = $this->input->post('txtPoRange'); - $BudgetType = $this->input->post('Budget'); + $BudgetType = $this->input->post('Budget'); $SpcialInstruction = $this->input->post('SpcialInstruction'); $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - $POStatus = $this->input->post('txtStatus'); + $POStatus = $this->input->post('txtStatus'); - $updatedBy = $this->session->userdata ( 'userId' ); + $updatedBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); $DeletedRow = $this->input->post('txtDeletedRow'); @@ -1134,14 +1139,36 @@ class purchaseorder extends BaseController $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); $LineItemStatus = REQITEM_NEW; - + if($PODate != $b4podate ) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4podate,'NewValue'=>$PODate,'Entity'=>'PO DateChanged'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + + if(!empty($newSupId[0] )) + { + if($newSupId[0] != $b4supplier) + { + //echo $b4supplier.'-'.$newSupId[0];die; + $logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + } for ($i = 1; $i <= $RowCount; $i++) { $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + + $b4qty=$this->input->post('b4qty'.$i); + $b4rate=$this->input->post('b4rate'.$i); + $itemRate = $this->input->post('itemRate'.$i); $per=$this->input->post('per'.$i); $DiscountType = $this->input->post('DisType'.$i); @@ -1161,14 +1188,31 @@ class purchaseorder extends BaseController $FreightValue = $this->input->post('FreightVal'.$i); $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); $NOOfTrip = $this->input->post('NoOfTrip'.$i); - $revenuedescription = $this->input->post('service_description'.$i); $InsuranceValue = $this->input->post('Insval'.$i); + $revenuedescription = $this->input->post('service_description'.$i); + $InsuranceValue = $this->input->post('Insval'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); $POLineItemNo = $this->input->post('LineItemNo'.$i); $CostCenter = $this->input->post('costCode'.$i); $LineItemNo = ''; - - $SkipInsert = "False"; + if($Quantity != $b4qty) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + + + if($itemRate != $b4rate) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + + $SkipInsert = "False"; if( count($comma_separated) > 0) { for($j = 1; $j < count($comma_separated); $j++) @@ -1184,51 +1228,81 @@ class purchaseorder extends BaseController } } - if($SkipInsert == "False") - { + + $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt); + + + $this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails); + + $recqty=0; + + if($POStatus == SPECIAL_PO) + { + + $recqty= $Quantity; + + $IGRD= $this->purchaseorder_model->getIGRDetails($PONO); + + $j = $i-1; + + $IGRDs = array('QuantityAsPerInvoice'=>$Quantity,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt); + + $this->purchaseorder_model->updateIGR($IGRD[$j]['IGRItemNo'],$IGRDs); + + //$MaterialstockHistoryupdate= array('SupplierID'=>$SupplierID,'Quantity'=>$Quantity,'ItemValue'=>$itemRate,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt); + + //$itemNo = $IGRD[$j]['IGRItemNo']; + + //$this->purchaseorder_model->updateMatStock($itemNo,$MaterialstockHistoryupdate); + + + } + + if($SkipInsert == "False") + { - if(strlen($POLineItemNo) == 0) - { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter); - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - - } - else - { + //if(strlen($POLineItemNo) == 0) + //{ + // $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter); + + // $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + // if(count($POLineItem)>0) + // { + // $LineItemNo = $POLineItem[0]['LineItemNo']; + // } + + //} + //else + //{ - $LineItemNo = $POLineItemNo; - - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter); - - $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); - - } - $isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo); - if(count($isExists) == 0) - { - $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); - - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - - } - else - { + $LineItemNo = $POLineItemNo; + + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'ReceivedQuantity'=>$recqty,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter); + + $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); + + //} + $isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo); + //if(count($isExists) == 0) + // { + // $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); + + // $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + + // } + // else + // { - $RevenueTaxList = array('DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'CreatedBy'=>$updatedBy,'NoOfTrip'=>$NOOfTrip); - - $this->purchaseorder_model->updateRevenueTax($LineItemNo,$RevenueTaxList); - - } - } - - } - - echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; + $RevenueTaxList = array('DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'CreatedBy'=>$updatedBy,'NoOfTrip'=>$NOOfTrip); + + $this->purchaseorder_model->updateRevenueTax($LineItemNo,$RevenueTaxList); + + // } + } + + } + + echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; } /** @@ -1555,11 +1629,6 @@ public function importpoprint($PONO) - - -/** - * This function used to load the Delete the Requistion Items - */ /** * Its handles delete PO Line-item details operation. */ @@ -1802,23 +1871,32 @@ function addNewImportPurchaseOrder() */ function EditImportPurchaseOrder() { - $PONO =$this->input->post('txtPONO'); $POdt = ''; $createddt=''; $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); + + + $newsup=$this->input->post('newsup'); + $newSupId = split("[ - ]+", $newsup); + + + $b4supplier=$this->input->post('b4supplier'); + $b4date=$this->input->post('b4podate'); + $b4podate = $this->getDateformat($b4date); + $DeliveryAddr = $this->input->post('DeliveryAddr'); $dt = $this->input->post('Deliverydt'); $Deliverydt = $this->getDateformat($dt); $POType = $this->input->post('POType'); - + $Exchangerate=$this->input->post('ExchangeRate'); $Edt=$this->input->post('Exchangerateon'); $ExchangeRateCalculatedon=$this->getDateformat($Edt); - + $CurrencyType=$this->input->post('currencytype'); $DeliveryOption = $this->input->post('DateRange'); @@ -1840,12 +1918,11 @@ function addNewImportPurchaseOrder() $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - - $TotalOrder = $this->input->post('txttot'); - - $POStatus = $this->input->post('txtStatus'); - $BudgetType = $this->input->post('Budget'); + $TotalOrder = $this->input->post('txttot'); + $POStatus = $this->input->post('txtStatus'); + + $BudgetType = $this->input->post('Budget'); $CreateBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); @@ -1868,10 +1945,8 @@ function addNewImportPurchaseOrder() $importoption=$this->input->post('Importoption'); - $Insurance=$this->input->post('Insurance'); - if($Insurance=='YES') { @@ -1883,27 +1958,50 @@ function addNewImportPurchaseOrder() { $Insurancenumber=''; $insurestatus='0'; - } - $Qualitycheck=1; - + } + // $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$updateddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms); + $Qualitycheck=1; + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'Import_DispatchDetails'=>$Dispatch,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'Import_PlaceofOrgin'=>$Palaceoforigin,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Shipmentmode,'Supplier_Reference'=>$SupplierRef,'Supplier_Offer_No'=>$SupplierOffer,'Other_Reference'=>$otherRef,'Fincap'=>$finCap,'InsuranceStatus'=>$insurestatus,'InsuranceNumber'=>$Insurancenumber,'POSubType'=>$importoption,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType); $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); - + $LineItemStatus = REQITEM_NEW; + + if($PODate == $b4podate ) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$CreateBy,'OldValue'=>$b4podate,'NewValue'=>$PODate,'Entity'=>'PO DateChanged'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + + if(!empty($newSupId[0] )) + { + if($newSupId[0] != $b4supplier) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$CreateBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + } + + + 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); - - - + $b4qty=$this->input->post('b4qty'.$i); + $b4rate=$this->input->post('b4rate'.$i); + $BasicPriceinmton = $this->input->post('BasicPriceInMTon'.$i); $Productprice = $this->input->post('TotalValue'.$i); $LandingCharge = $this->input->post('LandingCharge'.$i); @@ -1932,7 +2030,7 @@ function addNewImportPurchaseOrder() $AfterAddAdtional = $this->input->post('AfterAddlExciseDuty'.$i); $Grossdutypayable = $this->input->post('Grossdutypayable'.$i); - + $AvailableModvat = $this->input->post('AvailableModvat'.$i); $Grossexpensesduetocustomduty = $this->input->post('Grossexpensesduetocustomduty'.$i); @@ -1950,7 +2048,7 @@ function addNewImportPurchaseOrder() $CostCenter = $this->input->post('costCode'.$i); - + $Totalvalueitem=$this->input->post('TotalValue'.$i); @@ -1961,9 +2059,6 @@ function addNewImportPurchaseOrder() $FreightAmount=$this->input->post('AfterFreightValue'.$i); - - - $AssessableValue=$this->input->post('AssessableValue'.$i); $Subtotal=$this->input->post('SubTotal'.$i); @@ -1973,16 +2068,28 @@ function addNewImportPurchaseOrder() $Clearingcharge=$this->input->post('ClearingCharge'.$i); $Nettvalue=$this->input->post('NetValue'.$i); - - - $specialinstruction=$this->input->post('Addinstruction'.$i); $per=$this->input->post('Per'.$i); - $LineItemNo = ''; - - + +if($Quantity != $b4qty) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$CreateBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + + + if($itemRate != $b4rate) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$CreateBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + $currencytypeID = $this->input->post('currencytype'); $SkipInsert = "False"; if( count($comma_separated) > 0) @@ -1999,6 +2106,12 @@ function addNewImportPurchaseOrder() } } + + $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt); + + + $this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails); + if($SkipInsert == "False") { if(strlen($POLineItemNo) == 0) @@ -2017,28 +2130,26 @@ function addNewImportPurchaseOrder() $LineItemNo = $POLineItemNo; - - + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$specialinstruction); $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); } $isExists = $this->purchaseorder_model->LineItemExistsinImportTax($LineItemNo); - + + + if(count($isExists) == 0) { - - $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$Nosoftrip,'FreightValue'=>$FreightRate,'AfterFreightValue'=>$FreightAmount,'AssessableValue'=>$AssessableValue,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$Dutyimpact,'ClearingCharge'=>$Clearingcharge,'NetValue'=>$Nettvalue); - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); } else { - $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$Nosoftrip,'FreightValue'=>$FreightRate,'AfterFreightValue'=>$FreightAmount,'AssessableValue'=>$AssessableValue,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$Dutyimpact,'ClearingCharge'=>$Clearingcharge,'NetValue'=>$Nettvalue); - + $this->purchaseorder_model->updateImportTax($LineItemNo,$ImportTaxList); @@ -2047,13 +2158,11 @@ function addNewImportPurchaseOrder() } - + echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; } - - - + /* All Function following This command for FINANCE TEAM PO APPROVAL SCREEN*/ /** * For po approval. functionalities handles by Finances dept. @@ -2426,7 +2535,7 @@ function addNewImportPurchaseOrder() /** * To store the new Capital PO datas into DB */ - function EditCapitalPurchaseOrder() + function EditCapitalPurchaseOrder() { @@ -2434,13 +2543,24 @@ function addNewImportPurchaseOrder() $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); + + + $newsup=$this->input->post('newsup'); + $newSupId = split("[ - ]+", $newsup); + + $DeliveryAddr = $this->input->post('DeliveryAddr'); $dt = $this->input->post('Deliverydate'); $POType = $this->input->post('POType'); $PoRange = $this->input->post('txtPoRange'); - + + $b4supplier=$this->input->post('b4supplier'); + $b4date=$this->input->post('b4podate'); + $b4podate = $this->getDateformat($b4date); + + $DeliveryOption = $this->input->post('DateRange'); $DeliverySchedule=''; @@ -2492,7 +2612,7 @@ function addNewImportPurchaseOrder() $TotalOrder = $this->input->post('CapitalToatlOrder'); $POStatus = $this->input->post('txtStatus'); $Palaceoforigin=$this->input->post('PlaceOforigin'); - $ModeOfShipment=$this->input->post('editmodeofshipment'); + $ModeOfShipment=$this->input->post('editmodeofshipment'); $SupplierReference=$this->input->post('editsupplierreference'); $SuppliersOfferNo=$this->input->post('editsupplierofferno'); $OtherReferences=$this->input->post('editotherreference'); @@ -2501,7 +2621,9 @@ function addNewImportPurchaseOrder() $InsuranceNo=$this->input->post('insuranceNo'); $ServiceTypeOptions=$this->input->post('PoTypeOptions'); - $CreateBy = $this->session->userdata ( 'userId' ); + $BudgetType = $this->input->post('Budget'); + + $CreateBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); $DeletedRow = $this->input->post('txtDeletedRow'); @@ -2512,7 +2634,7 @@ function addNewImportPurchaseOrder() $createddt = $dt->format('Y-m-d H:i:s'); $updateddt = $dt->format('Y-m-d H:i:s'); $Qualitycheck=1; - + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID,'DeliverySchedule'=>$DeliverySchedule,'Import_PlaceofOrgin'=>$Palaceoforigin,'Import_DispatchDetails'=>$Dispatch,'DeliveryDate'=>$Deliverydt,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType); @@ -2522,7 +2644,25 @@ function addNewImportPurchaseOrder() $LineItemStatus = REQITEM_NEW; - + if($PODate != $b4podate ) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$CreateBy,'OldValue'=>$b4podate,'NewValue'=>$PODate,'Entity'=>'PO DateChanged'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + + if(!empty($newSupId[0] )) + { + if($newSupId[0] != $b4supplier) + { + + $logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$CreateBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + } for ($i = 1; $i <= $RowCount; $i++) { @@ -2532,6 +2672,9 @@ function addNewImportPurchaseOrder() $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); + $b4qty=$this->input->post('b4qty'.$i); + $b4rate=$this->input->post('b4rate'.$i); + $Exchangerate = $this->input->post('echangeRate'.$i); $BasicPriceinmton = $this->input->post('rateInUs'.$i); $Productprice = $this->input->post('basicvalInINR'.$i); @@ -2607,8 +2750,22 @@ function addNewImportPurchaseOrder() $Freightrateloc=$this->input->post('Fvalue'.$i); $FreightAmountloc=$this->input->post('Afvalue'.$i); - +if($Quantity != $b4qty) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$CreateBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed'); + + + $this->purchaseorder_model->insertlogpo($logpo); + } + + + if($itemRate != $b4rate) + { + $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$CreateBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed'); + + $this->purchaseorder_model->insertlogpo($logpo); + } @@ -2627,6 +2784,12 @@ function addNewImportPurchaseOrder() } } + + $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt); + + + $this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails); + if($SkipInsert == "False") { if(strlen($POLineItemNo) == 0) @@ -2689,13 +2852,12 @@ function addNewImportPurchaseOrder() } - } - + } + echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; - } + } - - /** + /** * To load capital po datas for pdf */ public function CapitalPoPrint($PONO) diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 3e33cb82..35a6a8fb 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -16,19 +16,52 @@ class purchaseorder_model extends CI_Model $this->db->select('PO.PONO'); $this->db->from('T_PurchaseOrder_Master PO'); $this->db->join('T_PurchaseOrder_LineItem Line','PO.PONO = Line.PONO'); - $this->db->join('T_Requestion_Master Req','Req.ReqNo = Line.ReqNo'); - - $this->db->where('PO.POType',SERVICE); - $this->db->where('PO.status',PO_RELEASED); - $this->db->where('Req.RequestedDept',$this->session->userdata('DEPCode')); - - - - $query = $this->db->get(); - - return $query->result(); + $this->db->join('T_Requestion_Master Req','Req.ReqNo = Line.ReqNo'); + $this->db->where('PO.POType',SERVICE); + $this->db->where('PO.status',PO_RELEASED); + $this->db->where('Req.RequestedDept',$this->session->userdata('DEPCode')); + $query = $this->db->get(); + return $query->result(); } + function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){ + $this->db->where('ReqNo',$Reqnumber); + $this->db->where('MaterialCode',$MaterialCode); + // $this->db->where('Quantity',$Quantity); + $this->db->update('T_Requestion_Details',$ReqDetail); + $r = $this->db->affected_rows(); + return $r; + } + + + function getIGRDetails($PONO) + { + + $subQuery ='select IGRM.PONO,IGRD.IGRItemNo,IGRD.IGRNO from +T_IGR_Master IGRM +join T_IGR_Details IGRD on IGRD.IGRNO = IGRM.IGRNO +Where IGRM.PONO = ? '; + + $query = $this->db->query($subQuery,array($PONO)); + + return $query->result_array(); + + + } + + + function updateIGR($IGRItemNo,$IGRDs) //,$MaterialCode, + { + + $this->db->where('IGRItemNo',$IGRItemNo); //,'IGRNO',$IGRNO,'MaterialCode',$MaterialCode); + //$this->db->where('IGRNO',$IGRNO); + // $this->db->where('MaterialCode',$MaterialCode); + $this->db->update('T_IGR_Details',$IGRDs); + + $r = $this->db->affected_rows(); + + return $r; + } function fileupload($myfile) @@ -43,15 +76,63 @@ class purchaseorder_model extends CI_Model function getfunction($pono) { $this->db->distinct(); - $this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType'); + $this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,mstr.MaterialRcvdDate,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType'); $this->db->from('T_PurchaseOrder_BillUpload bill'); $this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left'); $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left'); // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode'); $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO'); $this->db->where('bill.PONO',$pono); - //$this->db->or_where('pom.status',SPECIAL_PO); - $this->db->group_by('bill.BillNo'); + //$this->db->or_where('pom.status',SPECIAL_PO); + $this->db->group_by('bill.BillNo'); + + + + + +// $this->db->select('mstr.PONO,mstr.IGRNO,mstr.DeliveryChellanOrInvoiceNo, +// mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.MaterialRcvdDate, +// mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType'); + +// $this->db->from('T_IGR_Master mstr'); +// $this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left'); +// $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left'); +// // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode'); +// $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO'); +// $this->db->where('mstr.PONO',$pono); + + $query = $this->db->get(); + + return $query->result(); + } + +function getfunctionr($pono) + { + $this->db->distinct(); + // $this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,mstr.MaterialRcvdDate,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType'); + // $this->db->from('T_PurchaseOrder_BillUpload bill'); + // $this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left'); + // $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left'); + // // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode'); + // $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO'); + // $this->db->where('bill.PONO',$pono); + // //$this->db->or_where('pom.status',SPECIAL_PO); + // $this->db->group_by('bill.BillNo'); + + + + + + $this->db->select('mstr.PONO,mstr.IGRNO,mstr.DeliveryChellanOrInvoiceNo, +mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.MaterialRcvdDate, +mstr.CourierNo,pom.Status,pom.POType'); //,bill.BillNo,bill.FilePath, + + $this->db->from('T_IGR_Master mstr'); + //$this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left'); + $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left'); + // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode'); + $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO'); + $this->db->where('mstr.PONO',$pono); $query = $this->db->get(); @@ -59,8 +140,40 @@ class purchaseorder_model extends CI_Model } +function getbillfiesr($pono) + { + $this->db->distinct(); + // $this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,mstr.MaterialRcvdDate,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType'); + // $this->db->from('T_PurchaseOrder_BillUpload bill'); + // $this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left'); + // $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left'); + // // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode'); + // $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO'); + // $this->db->where('bill.PONO',$pono); + // //$this->db->or_where('pom.status',SPECIAL_PO); + // $this->db->group_by('bill.BillNo'); + + + + + $this->db->select('mstr.PONO,mstr.IGRNO,mstr.DeliveryChellanOrInvoiceNo, +mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.MaterialRcvdDate, +mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType'); + + $this->db->from('T_IGR_Master mstr'); + $this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left'); + $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left'); + // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode'); + $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO'); + $this->db->where('mstr.PONO',$pono); + $query = $this->db->get(); + + return $query->result(); + } + + function GetPODetailforBillingServicePO($PONO) { @@ -168,14 +281,13 @@ function purchaseorderListing($forwhat='') function getSupplierName($supID='') { $this->db->select('SupplierID, SupplierName,Address,PaymentID'); - $this->db->from('T_SupplierDetailsN'); - $this->db->where('IsActive', 1); - //$this->db->where('IsActive = 1'); + $this->db->from('T_SupplierDetailsN'); + $this->db->where('IsActive', 1); if($supID != '') { $this->db->where('SupplierID',$supID); } - + //$this->db->where('roleId !=', 1); $query = $this->db->get(); return $query->result(); @@ -195,8 +307,7 @@ function purchaseorderListing($forwhat='') } - - function getqtycheck($PONO) + function getqtycheck($PONO) { $this->db->select('IsQualityChkReqired'); $this->db->from('T_PurchaseOrder_Master'); @@ -217,11 +328,9 @@ function purchaseorderListing($forwhat='') $result ->next_result(); - //print_r($this->db->last_query()); - if ($result->num_rows > 0) { - //echo 'PO Line item Inserted successfully'; + if($IsArray != '') { return $result->result_array(); @@ -235,7 +344,7 @@ function purchaseorderListing($forwhat='') } /** - This Function to get the List of Requistion which require to create PO + *This Function to get the List of Requistion which require to create PO */ function getAllRequistionListToCreatePO() { @@ -566,35 +675,34 @@ function GetPOType($ReqNo) * This function is used to add New Purchase order to the system */ - function addPOMaster($POMaster,$POType,$POSubtype) + function addPOMaster($POMaster,$POType,$POSubtype) { $this->db->trans_start(); - $this->db->insert('T_PurchaseOrder_Master', $POMaster); + $this->db->insert('T_PurchaseOrder_Master', $POMaster); $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); // print_r($this->db->last_query()); if($insert_id>0) { - $subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where POType=? and POSubType=?'; + $subQuery = 'select PONO from T_PurchaseOrder_Master where POType=? and POSubType=? and isnull(ParentPO) order by CreatedDate desc limit 1 '; $query = $this->db->query($subQuery,array($POType,$POSubtype)); - + return $query->result_array(); } } - - + function addAmendPOMaster($POMaster,$CreatedBy,$ParentPO) { - // print_r($POMaster); + $this->db->trans_start(); $this->db->insert('T_PurchaseOrder_Master', $POMaster); $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); - // print_r($this->db->last_query()); + if($insert_id>0) { - $subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where CreatedBy=? and ParentPO=?'; + $subQuery = 'select PONO from T_PurchaseOrder_Master where CreatedBy=? and ParentPO=? order by CreatedDate desc limit 1'; $query = $this->db->query($subQuery,array($CreatedBy,$ParentPO)); @@ -611,7 +719,7 @@ function GetPOType($ReqNo) $this->db->insert('T_PurchaseOrder_LineItem', $POLineItem); $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); - // print_r($this->db->last_query()); + if($insert_id>0) { $subQuery = 'select max(LineItemNo) as LineItemNo from T_PurchaseOrder_LineItem'; @@ -717,7 +825,7 @@ function GetPOType($ReqNo) function GetServicePurchaseOrder($PONO = '') { $this->db->distinct(); - $this->db->select('ReqNo,POMast.PONO,POMast.PaymentTerms,POMast.PaymentOtherDescription,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus,POMast.*,POMast.TotalOrderValue'); + $this->db->select('ReqNo,POMast.PONO,POMast.PaymentTerms,POMast.PaymentOtherDescription,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus,POMast.*,POMast.TotalOrderValue,POMast.BudgetType'); $this->db->from('T_PurchaseOrder_Master POMast'); $this->db->join('T_SupplierDetailsN supp', 'supp.SupplierID = POMast.SupplierID'); $this->db->join('T_Status Stat', 'Stat.StatusCode = POMast.Status'); @@ -738,14 +846,14 @@ function GetPOType($ReqNo) function GetServicePurchaseOrderDetails($PONO = '') { - $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,LineItem.Per,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,LineItem.Quantity,ReceivedQuantity,Rate,LineItem.Status,(LineItem.Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount,Dept.DepartmentName + $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,LineItem.Per,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,LineItem.Quantity,ReceivedQuantity,Rate,LineItem.Status,(LineItem.Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount,Dept.DepartmentName ,TotalValue,CGST,After_CGST,SGST,After_SGST,IGST,After_IGST,otherallowance,LineItem.CostCenterCode,LineItem.ServiceFrequency,LineItem.ServiceMaterialDescription,Req.Schedule_Type,Req.NumberOfService,Req.Service_Period,ReqDet.MaterialDescription FROM T_PurchaseOrder_LineItem LineItem join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode join T_Service_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo - join T_Requestion_Details ReqDet on ReqDet.ReqNo = LineItem.ReqNo and LineItem.MaterialCode = ReqDet.MaterialCode - left join T_Employee_Details emp on Req.Requestedby = emp.EmpID + join T_Requestion_Details ReqDet on ReqDet.ReqNo = LineItem.ReqNo and LineItem.MaterialCode = ReqDet.MaterialCode + left join T_Employee_Details emp on Req.Requestedby = emp.EmpID join T_DepartmentDetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?'; @@ -853,17 +961,6 @@ function GetPOType($ReqNo) function GetImportPurchaseOrderDetailsForPDF($PONO = '') { - // $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName, - // Mat.UOM,Quantity,ReqMas.Requestedby,Rate,ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount, - // ProductPrice,Tax.*,LineItem.CostCenterCode , POMaster.*,sup.SupplierName,sup.Address - // FROM T_PurchaseOrder_LineItem LineItem - // join T_Requestion_Master ReqMas on ReqMas.ReqNo=LineItem.ReqNo - // join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode - // join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo - // join T_PurchaseOrder_Master POMaster on POMaster.PONO = LineItem.PONO - // join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID - // where LineItem.PONO =?'; - $subQuery='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,Import_DispatchDetails,LineItem.Per,LineItem.ServiceMaterialDescription, Mat.UOM,Quantity,ReqMas.Requestedby,Rate,ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount , ProductPrice,Tax.*,LineItem.CostCenterCode ,Date(ReqMast.ReqDate) as ReqDate,POMaster.*,sup.SupplierName,sup.Address,LineItem.AmendedDetails as LineAmend,AdvanceAmount, Pay.PaymentTerms as Pay,ROUND((Quantity *Rate),2 ) as BasicValue,HSNCODE,sup.EmailAddress,sup.SupplierID,sup.PAN,sup.ContactNumber,sup.GSTNO @@ -879,8 +976,7 @@ join T_PaymentTerms Pay on POMaster.PaymentTerms=Pay.PaymentID where LineItem.PONO =?'; $query = $this->db->query($subQuery,array($PONO)); - //print_r($this->db->last_query()); - + return $query->result(); @@ -892,7 +988,6 @@ where LineItem.PONO =?'; $subQuery='SELECT * from T_Currency_Details where Currency_Code=?'; $query=$this->db->query($subQuery,array($Currency)); - //print_r($query); return $query->result(); } @@ -921,8 +1016,7 @@ where LineItem.PONO =?'; { $subQuery='SELECT * from T_Currency_Details where Currency_Code=?'; $query=$this->db->query($subQuery,array($Currencycode)); - //print_r($this->db->last_query()); - return $query->result(); + return $query->result(); } @@ -940,31 +1034,18 @@ where LineItem.PONO =?'; { $subQuery='SELECT PaymentTerms from T_PurchaseOrder_Master where PONO=?'; $query=$this->db->query($subQuery,array($PONO)); - //print_r($query); - return $query->result(); + return $query->result(); } - - - // function getSupplierPayment($Currency='') - // { - - // $subQuery='select distinct PaymentTerms from T_SupplierDetailsN'; - // $query=$this->db->query($subQuery,array($Currency)); - // //print_r($this->db->last_query()); - // return $query->result(); - - // } - function getSupplierPayment($Config_ID='') { // $subQuery='select distinct PaymentTerms from T_SupplierDetailsN'; $subQuery='select ConfigValue from T_ConfigDetails where Config_ID=?'; $query=$this->db->query($subQuery,array($Config_ID)); - //print_r($this->db->last_query()); + return $query->result(); } @@ -973,7 +1054,7 @@ where LineItem.PONO =?'; { $subQuery = 'select ConfigValue from T_ConfigDetails where Config_ID=?'; $query=$this->db->query($subQuery,array($Config_ID)); - //print_r($query); + return $query->result(); } @@ -984,7 +1065,7 @@ where LineItem.PONO =?'; function GetImportPurchaseOrderDetails($PONO = '') { - $subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription, + $subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName, Mat.UOM,Quantity,Rate,Req.Status,ROUND((Quantity *Rate),2 ) as BasicValue,ReceivedQuantity, QuantityRejected,ROUND(Quantity-ReceivedQuantity)as PendingQty,Per, ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess, @@ -1365,7 +1446,7 @@ function GetCurrencytype() $this->db->join('T_PurchaseOrder_LineItem req', 'req.PONO= mast.PONO'); $this->db->join('T_Requestion_Master rmast','rmast.ReqNo=req.ReqNo'); //$this->db->join('T_CostCenter_Budget bud','bud.CostCenterCode = req.CostCenterCode and bud.BudgetType = rmast.ReqType'); - $this->db->join('T_CostCenter_Master ccm','ccm.CostCenterCode = req.CostCenterCode'); + $this->db->join('T_CostCenter_Master ccm','ccm.CostCenterCode = req.CostCenterCode','left'); $this->db->join('tbl_users tbl', 'rmast.createdby=tbl.userid'); $this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid'); $this->db->join('T_DepartmentDetails as Dep','Dep.DEPCode=emp.Departmentcode'); @@ -1447,7 +1528,7 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID function GetCapitalPurchaseOrderDetailsForPDF($PONO = '') { - $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.AmendedDetails as lineamd,ReqNo,Mat.MaterialCode,Mat.MaterialName, + $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.AmendedDetails as lineamd,ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription, Mat.UOM,Mat.HSNCODE,Quantity,Rate,ROUND((Quantity *Rate),2 ) as BasicValue , LineItem.CostCenterCode , POMaster.*,sup.SupplierName,sup.SupplierID,sup.Address,sup.ContactNumber,sup.EmailAddress,sup.PAN,sup.GSTNO,Payment.PaymentID,Payment.PaymentTerms,AdvanceAmount,HSNCODE FROM T_PurchaseOrder_LineItem LineItem @@ -1765,21 +1846,94 @@ function GetRequistionMasterUsingReqNo($Req){ } - function amendpdf($PONO='') { $Amend ='select p.PONO,p.ParentPO,p.Status,p.TotalOrderValue, - m.Status as parentpostatus, - m.TotalOrderValue as partenttotalorder - from T_PurchaseOrder_Master as p - join T_PurchaseOrder_Master as m - on m.PONO = p.ParentPO - where p.PONO = ?'; - - $amendment = $this->db->query($Amend,array($PONO)); + m.Status as parentpostatus, + m.TotalOrderValue as partenttotalorder + from T_PurchaseOrder_Master as p + join T_PurchaseOrder_Master as m + on m.PONO = p.ParentPO + where p.PONO = ?'; + $amendment = $this->db->query($Amend,array($PONO)); return $amendment->result(); } +function updatefile($bill,$Picture,$oldfile) +{ + + // if($oldfile != ''){ + // //unlink("uploads/BillFiles/".$oldfile);//this deletes the file on particular folder too + // } + +$this->db->set('FilePath', $Picture); //value that used to update column +$this->db->where('BillNo', $bill); //which row want to upgrade +$this->db->update('T_PurchaseOrder_BillUpload'); +$afftectedRows = $this->db->affected_rows(); +return $afftectedRows; + +} + + +function insertlogpo($logpo){ + + $this->db->trans_start(); + $this->db->insert('T_POlog_Details',$logpo); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return $insert_id; + +} +function getlogpodtl($PONO){ + +$SQL = "select log.*,sup.SupplierName,emp.FirstName from + T_POlog_Details log + join tbl_users user on user.userId = log.UpdateBy + left join T_Employee_Details emp on emp.EmpID= user.EmpID + left join T_SupplierDetailsN sup on sup.SupplierID = log.OldValue + where PONO ='".$PONO."'"; + + +$logpodtl = $this->db->query($SQL); + + return $logpodtl->result(); +} + + + + + function insertfile($filelist) + { + + $this->db->insert('T_PurchaseOrder_BillUpload',$filelist); + $myfile=$this->db->affected_rows(); + return $myfile; + } + + + +function updateigrM($PONO,$IGRNo,$igrMaster){ + + + $this->db->where('PONO',$PONO); + $this->db->where('IGRNO',$IGRNo); + + $this->db->update('T_IGR_Master',$igrMaster); + + $r = $this->db->affected_rows(); + return $r; +} +function getigrno($bill){ + + $subQuery ='select bill.BillNo,IGR.IGRNO, IGR.PONO FROM T_IGR_Master IGR + join T_PurchaseOrder_BillUpload bill on bill.IGRNO = IGR.IGRNO + where bill.BillNO = ? '; + + $query = $this->db->query($subQuery,array($bill)); + + return $query->result_array(); + } + } diff --git a/application/views/EditservicePurchaseorder.php b/application/views/EditservicePurchaseorder.php index 57f39808..e9474a0f 100755 --- a/application/views/EditservicePurchaseorder.php +++ b/application/views/EditservicePurchaseorder.php @@ -1,10 +1,8 @@ "NO","value"=>"0"),array("name"=>"YES","value"=>"1") -); - $DeliverOption=''; + $insuranceStatus = array( array("name"=>"NO","value"=>"0"),array("name"=>"YES","value"=>"1") ); + $DeliverOption=''; $SupId = ''; - $SupName = ''; + $SupName = ''; $Address = ''; $PODate = ''; @@ -18,7 +16,7 @@ array("name"=>"NO","value"=>"0"),array("name"=>"YES","value"=>"1") $TotalSummary = 0.0; $TotalBasicAmount = 0.0; $ServiceDescription = ''; - $OtherAmt = 0.0; + $OtherAmt = 0.0; $Deliverydt=''; $DeliverSchedule=''; @@ -41,11 +39,9 @@ array("name"=>"NO","value"=>"0"),array("name"=>"YES","value"=>"1") if(!empty($INRSYMBOL)) { - foreach($INRSYMBOL as $INRS) { $INRSYM=$INRS->FontCode2000; - } } @@ -57,19 +53,19 @@ if(!empty($MaxPODate)) } } + if(!empty($POMaster)) { - foreach ($POMaster as $Req) { $SupId = $Req->SupplierID; - $SupName = $Req->SupplierName; + $SupName = $Req->SupplierName; $Address = $Req->Address; $pdt = new DateTime($Req->PODate); $PODate = $pdt->format('d-m-Y'); $DeliverOption = $Req->DeliveryOption; - $DeliverSchedule = $Req->DeliverySchedule; + $DeliverSchedule = $Req->DeliverySchedule; $Ddt = new DateTime($Req->DeliveryDate); $Deliverydt = $Ddt->format('d-m-Y'); @@ -77,19 +73,20 @@ if(!empty($POMaster)) $PONOStatus = $Req->StatusCode; $PONO = $Req->PONO; $ServiceDescription = $Req->ServiceDescription; - $WrkStatus=$Req->ServiceWorkStatus; - $StatusName=$Req->StatusName; - $otherPayment = $Req->PaymentOtherDescription; - $ModeOfShipment=$Req->Mode_Of_Shipment; - $SupplierReference=$Req->Supplier_Reference; - $SuppliersOfferNo=$Req->Supplier_Offer_No; - $OtherReferences=$Req->Other_Reference; - $Fincap=$Req->Fincap; - $InsuranceOptions=$Req->InsuranceStatus; - $InsuranceNo=$Req->InsuranceNumber; - $ServiceTypeOptions=$Req->POSubType; - $DescriptionOfPo = $Req->Description_Of_Service; - $BudgetType = $Req->BudgetType; + + $WrkStatus=$Req->ServiceWorkStatus; + $StatusName=$Req->StatusName; + $otherPayment = $Req->PaymentOtherDescription; + $ModeOfShipment=$Req->Mode_Of_Shipment; + $SupplierReference=$Req->Supplier_Reference; + $SuppliersOfferNo=$Req->Supplier_Offer_No; + $OtherReferences=$Req->Other_Reference; + $Fincap=$Req->Fincap; + $InsuranceOptions=$Req->InsuranceStatus; + $InsuranceNo=$Req->InsuranceNumber; + $ServiceTypeOptions=$Req->POSubType; + $DescriptionOfPo = $Req->Description_Of_Service; + $BudgetType = $Req->BudgetType; } } @@ -97,26 +94,21 @@ if(!empty($POMaster)) if(!empty($RequistionDetails)) { - foreach ($RequistionDetails as $ReqDet) { - // $Reqon=$ReqDet->ReqDate; + $Reqonn=new DateTime($ReqDet->ReqDate); $Reqon=$Reqonn->format('d-m-Y'); $Requestedby=$ReqDet->Requestedby; $RequesterName=$ReqDet->FirstName; - //$Status=$ReqDet->Status; + } } -//echo "$WrkStatus"; if(!empty($AvlBudAmt)) { - - $AvlAmount = number_format($AvlBudAmt, 2, '.', ''); - - + $AvlAmount = number_format($AvlBudAmt, 2, '.', ''); } @@ -125,7 +117,13 @@ foreach ($PaymentTerms as $TER) $Terms=$TER->PaymentTerms; } - +if(!empty($getlogpodtl )) +{ + foreach ($getlogpodtl as $values ) + { + $update=$values->FirstName; + } +} // foreach ($POSTATUS as $PST ) // { @@ -169,69 +167,72 @@ foreach ($PaymentTerms as $TER) statusbar: false, toolbar: false }); - + + + diff --git a/application/views/editCapitalPo.php b/application/views/editCapitalPo.php index 4b1c6c80..f7ae87fa 100644 --- a/application/views/editCapitalPo.php +++ b/application/views/editCapitalPo.php @@ -1,38 +1,39 @@ - "NO","value"=>"0"),array("name"=>"YES","value"=>"1") - ); +"NO","value"=>"0"),array("name"=>"YES","value"=>"1") + ); $requestedBy=$RequistionDetails[0]->FirstName; - $Updateddt = new DateTime($RequistionDetails[0]->ReqDate); - $UpdatedOn=$Updateddt->format('d-m-Y'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $CurrentDate = $dt->format('d-m-Y'); - $res_arr_values = array(); - $DeliverOption=''; - $SupId = ''; + $Updateddt = new DateTime($RequistionDetails[0]->ReqDate); + $UpdatedOn=$Updateddt->format('d-m-Y'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $CurrentDate = $dt->format('d-m-Y'); + $res_arr_values = array(); + $DeliverOption=''; + $SupId = ''; $SupName = ''; - $Address = ''; - $PODate = ''; + $Address = ''; + $PODate = ''; $TotalCgst=''; - $TotalSgst=''; - $TotalIgst=''; - $DeliveryAddress =''; - $POStatus = ''; - $PONO = ''; - $TotalCgst = 0; - $TotalSgst = 0.0; - $TotalIgst = 0.0; - $OtherAmt = 0.0; - $TotalFreightvalue=0.0; + $TotalSgst=''; + $TotalIgst=''; + $DeliveryAddress =''; + $POStatus = ''; + $PONO = ''; + $TotalCgst = 0; + $TotalSgst = 0.0; + $TotalIgst = 0.0; + $OtherAmt = 0.0; + $TotalFreightvalue=0.0; - $totassesable=0; - $totSubtotal=0; - $totigst=0; - - $TotalSummary = 0.0; - $TotalBasicAmount = 0.0; - $ServiceDescription = ''; + + $totassesable=0; + $totSubtotal=0; + $totigst=0; + + $TotalSummary = 0.0; + $TotalBasicAmount = 0.0; + $ServiceDescription = ''; $Import_DispatchDetails=''; $Import_PlaceofOrgin=''; $CapitalRange=''; @@ -69,9 +70,9 @@ $PaymentDays=''; $PayableAT=''; $ExchangeDate=''; - $ExchangeRateOn=''; + $ExchangeRateOn=''; - $CapitalRange=''; + $CapitalRange=''; $PoStatusName=''; $otherPayment=''; $INR=''; @@ -81,7 +82,7 @@ $ExitExchangeRate=''; - $ModeOfShipment=''; + $ModeOfShipment=''; $SupplierReference=''; $SuppliersOfferNo=''; $OtherReferences=''; @@ -106,9 +107,9 @@ if(!empty($MaxPODate)) { foreach ($MaxPODate as $date) { - $MaxPoDate = $date->PODate; - - } + $MaxPoDate = $date->PODate; + + } } if(!empty($POMaster)) { @@ -118,32 +119,32 @@ if(!empty($POMaster)) { - $SupId = $Req->SupplierID; + $SupId = $Req->SupplierID; $SupName = $Req->SupplierName; - $Address = $Req->Address; - $pdt = new DateTime($Req->PODate); - $PODate = $pdt->format('d-m-Y'); - $DeliverOption = $Req->DeliveryOption; + $Address = $Req->Address; + $pdt = new DateTime($Req->PODate); + $PODate = $pdt->format('d-m-Y'); + $DeliverOption = $Req->DeliveryOption; $DeliverSchedule = $Req->DeliverySchedule; - $Ddt = new DateTime($Req->DeliveryDate); - $Deliverydt = $Ddt->format('d-m-Y'); + $Ddt = new DateTime($Req->DeliveryDate); + $Deliverydt = $Ddt->format('d-m-Y'); - $DeliveryAddress =$Req->DeliveryAddress; - $PONOStatus = $Req->StatusCode; - $POStatus = $Req->StatusCode; + $DeliveryAddress =$Req->DeliveryAddress; + $PONOStatus = $Req->StatusCode; + $POStatus = $Req->StatusCode; $PoStatusName=$Req->StatusName; - $PONO = $Req->PONO; - $ServiceDescription = $Req->ServiceDescription; + $PONO = $Req->PONO; + $ServiceDescription = $Req->ServiceDescription; - $Exchangedt = new DateTime($Req->ExchangeRateCalculatedon); + $Exchangedt = new DateTime($Req->ExchangeRateCalculatedon); $ExchangeRateOn=$Exchangedt->format('d-m-Y'); $PaymentTerms=$Req->PaymentTerms; $otherPayment = $Req->PaymentOtherDescription; - + $CapitalRange=$Req->CapitalRange; $Import_DispatchDetails=$Req->Import_DispatchDetails; @@ -158,14 +159,14 @@ if(!empty($POMaster)) $ExitTotalOrderValue=$Req->TotalOrderValue; } - $ModeOfShipment=$Req->Mode_Of_Shipment; - $SupplierReference=$Req->Supplier_Reference; - $SuppliersOfferNo=$Req->Supplier_Offer_No; - $OtherReferences=$Req->Other_Reference; - $Fincap=$Req->Fincap; - $InsuranceOptions=$Req->InsuranceStatus; - $InsuranceNo=$Req->InsuranceNumber; - $ServiceTypeOptions=$Req->POSubType; + $ModeOfShipment=$Req->Mode_Of_Shipment; + $SupplierReference=$Req->Supplier_Reference; + $SuppliersOfferNo=$Req->Supplier_Offer_No; + $OtherReferences=$Req->Other_Reference; + $Fincap=$Req->Fincap; + $InsuranceOptions=$Req->InsuranceStatus; + $InsuranceNo=$Req->InsuranceNumber; + $ServiceTypeOptions=$Req->POSubType; $BudgetType = $Req->BudgetType; } @@ -184,24 +185,33 @@ if(!empty($POItem) && $CapitalRange=='1') $currentPoDiscountedAmt=$currentPoDiscountedAmt+$getTotalAmt->Afterdiscountval; - + } if(!empty($AvlBudAmt)) { - $AvlAmount = number_format($AvlCapitalBudAmt+$currentPoBasicAmt-$currentPoDiscountedAmt, 2, '.', ''); + $AvlAmount = number_format($AvlCapitalBudAmt+$currentPoBasicAmt-$currentPoDiscountedAmt, 2, '.', ''); - + } } else { - $AvlAmount = number_format($AvlCapitalBudAmt+$ExitTotalOrderValue, 2, '.', ''); + $AvlAmount = number_format($AvlCapitalBudAmt+$ExitTotalOrderValue, 2, '.', ''); } +//print_r($getlogpodtl);die; +if(!empty($getlogpodtl)) +{ + +foreach ($getlogpodtl as $values ) +{ + $update=$values->FirstName; +} +} @@ -222,12 +232,12 @@ else { .select2{ width:100% ! important; } - .num{ - text-align:right; - } - .content-wrapper { - min-height:600px ! important; - } + .num{ + text-align:right; + } + .content-wrapper { + min-height:600px ! important; + } @@ -248,7 +258,7 @@ else { z-index: 1080 !important; } - + - - - - - - - - + \ No newline at end of file diff --git a/application/views/editRevenuepurchaseorder.php b/application/views/editRevenuepurchaseorder.php index eda44859..cc213e26 100755 --- a/application/views/editRevenuepurchaseorder.php +++ b/application/views/editRevenuepurchaseorder.php @@ -1,6 +1,6 @@ -format('d-m-Y'); $MaxPoDate = ''; $AvlAmount = 0; @@ -15,90 +15,85 @@ $fincap=''; $revenuesubtype=''; $insurencestatus=''; $insurenceno=''; - if(!empty($MaxPODate)) { - foreach ($MaxPODate as $date) - { - $MaxPoDate = $date->PODate; +foreach ($MaxPODate as $date) +{ + $MaxPoDate = $date->PODate; } } if(!empty($CompanyDetails)) { - foreach ($CompanyDetails as $Req) - { +foreach ($CompanyDetails as $Req) +{ $CompanyAddress = $Req->Address; } } if(!empty($AvlBudAmt)) { - - $AvlAmount = number_format($AvlBudAmt, 2, '.', ''); + + $AvlAmount = number_format($AvlBudAmt, 2, '.', ''); } - if(!empty($INRSYMBOL)) { - foreach($INRSYMBOL as $INRS) { - $INRSYM=$INRS->FontCode2000; - +$INRSYM=$INRS->FontCode2000; } } - -foreach ($PaymentTerms as $TER) +foreach ($PaymentTerms as $TER) { - $Terms=$TER->PaymentTerms; +$Terms=$TER->PaymentTerms; } - + $SupId = ''; - $SupName = ''; +$SupName = ''; $Address = ''; $PODate = ''; - $Deliverydt =''; +$Deliverydt =''; $DeliveryAddress =''; - $PONOStatus = ''; - $PONO = ''; + $PONOStatus = ''; + $PONO = ''; $totBasicAmt = 0; $totDiscountAmt = 0.0; $totPackagingAmt = 0.0; $totCgst = 0.0; - $totSgst = 0.0; - $totIgst = 0.0; +$totSgst = 0.0; +$totIgst = 0.0; $totFreightAmt = 0.0; $totInsuranceAmt = 0.0; $totOrderSummaryAmt = 0.0; $ServiceDescription = ''; - $CapitalRange = ''; - $otherPayment=''; - $BudgetType = ''; +$CapitalRange = ''; +$otherPayment=''; +$BudgetType = ''; if(!empty($POMaster)) { //print_r($POMaster); //print_r($POItem); - foreach ($POMaster as $Req) - { +foreach ($POMaster as $Req) +{ $SupId = $Req->SupplierID; - $SupName = $Req->SupplierName; +$SupName = $Req->SupplierName; $Address = $Req->Address; - $Pdt = new DateTime($Req->PODate); + $Pdt = new DateTime($Req->PODate); $PODate = $Pdt->format('d-m-Y'); $DeliverOption = $Req->DeliveryOption; - $DeliverSchedule = $Req->DeliverySchedule; - - $Ddt = new DateTime($Req->DeliveryDate); +$DeliverSchedule = $Req->DeliverySchedule; + + $Ddt = new DateTime($Req->DeliveryDate); $Deliverydt = $Ddt->format('d-m-Y'); $DeliveryAddress =$Req->DeliveryAddress; - $PONOStatus = $Req->StatusCode; - $PONO = $Req->PONO; + $PONOStatus = $Req->StatusCode; + $PONO = $Req->PONO; $ServiceDescription = $Req->ServiceDescription; $CapitalRange = $Req->CapitalRange; - $StatusName=$Req->StatusName; - $otherPayment = $Req->PaymentOtherDescription; +$StatusName=$Req->StatusName; +$otherPayment = $Req->PaymentOtherDescription; $modeofshipment = $Req->Mode_Of_Shipment; $supplierref = $Req->Supplier_Reference; $suppofferno = $Req->Supplier_Offer_No; @@ -108,39 +103,38 @@ if(!empty($POMaster)) $insurencestatus = $Req->InsuranceStatus; $insurenceno = $Req->InsuranceNumber; $BudgetType = $Req->BudgetType; - // echo $insurenceno; - // echo $otherPayment; - } + } - - - - +} +//echo $BudgetType; if(!empty($RequistionDetails)) { +foreach ($RequistionDetails as $ReqDet) +{ +$Reqonn=new DateTime($ReqDet->ReqDate); +$Reqon=$Reqonn->format('d-m-Y'); - foreach ($RequistionDetails as $ReqDet) - { - $Reqonn=new DateTime($ReqDet->ReqDate); - $Reqon=$Reqonn->format('d-m-Y'); - - // $Pdt = new DateTime($Req->PODate); + // $Pdt = new DateTime($Req->PODate); // $PODate = $Pdt->format('Y-m-d'); - $Requestedby=$ReqDet->Requestedby; - $RequesterName=$ReqDet->FirstName; - //$Status=$ReqDet->Status; - } +$Requestedby=$ReqDet->Requestedby; +$RequesterName=$ReqDet->FirstName; +//$Status=$ReqDet->Status; } - - -// foreach ($POSTATUS as $PST ) +} +// foreach ($POSTATUS as $PST ) // { // $POStatus=$PST->StatusName; // } - +if(!empty($getlogpodtl )) +{ +foreach ($getlogpodtl as $values ) +{ +$update=$values->FirstName; +} +} ?> + - - - - - var DelOpt = ''; - var SchName = ; - var DelDt = ''; - var insurancestatus = ''; - var budgettype=''; - var insuranceno = ''; + +
- 'form-label-left CreatePO ','name' => 'CreatePO','id' => 'CreatePO'); - - echo form_open($this->config->base_url().'/purchaseorder/addPO/',$attributes); ?> - -
-
-
-
- -

-
-
-
-
-
- - 'Selected Requisition Numbers'); - if(!empty($ReqList)) - { - foreach ($ReqList as $SID): - - $options[$SID->ReqNo] = $SID->ReqNo ; - //$ReqType = $SID->ReqType; - endforeach; - } - echo form_multiselect('RequistionNo', $options,set_value('RequistionNo'),'id="RequistionNo"' ,'required="true"' , 'height="400px"' ); - ?> -
-
- -
- 'PODate','value' => set_value('PODate',$PODate),'id'=>'PODate', 'class' => 'form-control num' ,'required' => 'true','onkeypress'=>'return false;'); - echo form_input($data); - ?> -
-
-
-
-
-
- - 'Select Supplier'); - //print_r( $options); - - if(!empty($Suplist)) - { - foreach ($Suplist as $SID): - - - $options[$SID->SupplierID] = $SID->SupplierID.' '.' - '.' '.$SID->SupplierName; - - endforeach; - } - - echo form_dropdown('drpSupplier', $options,set_value('drpSupplier',$SupId),'id="drpSupplier"' ,'required="true"' ,'class="form-control select2'); - - ?> -
-
- -
- - 'POType','value' => set_value('POType',REVENUE),'id'=>'POType', 'class' => 'form-control' ,'readonly' => 'true'); - echo form_input($data); - ?> -
-
-
-
- Select Tax Range
- - - - 'Range', 'value' => '0', 'checked' => ('0' == $CapitalRange) ? TRUE : FALSE, 'id' => 'Local','onchange'=>'SetVatorCST();')); ?> - - - - 'Range', 'value' => '1', 'checked' => ('1' == $CapitalRange) ? TRUE : FALSE, 'id' => 'Inter_state','onchange'=>'SetVatorCST();')); ?> - - - -
- - -
-
- - Select Delivery By*
- - - 'DateRange', 'value' => '0', 'checked' => ('0' == $DeliverOption) ? TRUE : FALSE, 'id' => 'Date')); ?> - - - 'DateRange', 'value' => '1', 'checked' => ('1' == $DeliverOption) ? TRUE : FALSE, 'id' => 'Schedule')); ?> - - - - -
-
-
-
- -
+ 'form-label-left CreatePO ','name' => 'CreatePO','id' => 'CreatePO'); + + echo form_open($this->config->base_url().'/purchaseorder/addPO/',$attributes); ?> + +
+
+
+
+ +

+
+
+
+
+
+ 'SupAddress','value' => set_value('SupAddress',$Address),'id'=>'SupAddress', 'class' => 'form-control' ,'readonly' => 'true' ,'rows' => '3', 'cols' => '40'); - echo Form_textarea($data); - ?> -
-
-
- -
- 'DeliveryAddr','value' => set_value('DeliveryAddr',$DeliveryAddress),'id'=>'DeliveryAddr', 'class' => 'form-control' ,'required' => 'true' ,'rows' => '3', 'cols' => '40'); - echo Form_textarea($data); - ?> -
-
-
- -
- 'Deliverydt','value' => set_value('Deliverydt',$Deliverydt),'id'=>'Deliverydt', 'class' => 'form-control num' ,'required' => 'true','onkeypress'=>'return false;'); - echo form_input($data); - ?> - -
-
- -
-
- - -
-
-
-
- - - -
- + $options = array("0"=>'Selected Requisition Numbers'); + if(!empty($ReqList)) + { + foreach ($ReqList as $SID): + + $options[$SID->ReqNo] = $SID->ReqNo ; + //$ReqType = $SID->ReqType; + endforeach; + } + echo form_multiselect('RequistionNo', $options,set_value('RequistionNo'),'id="RequistionNo"' ,'required="true"' , 'height="400px"' ); + ?> +
+
+ +
'editmodeofshipment','value' => set_value('editmodeofshipment',$modeofshipment),'id'=>'editmodeofshipment', 'class' => 'form-control'); - echo form_input($data); - ?> + $data = array('name' => 'PODate','value' => set_value('PODate',$PODate),'id'=>'PODate', 'class' => 'form-control num' ,'required' => 'true','onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+
- - - -
-
-
-
-
- -
- +
+
+
+ 'editsupplierreference','value' => set_value('editsupplierreference',$supplierref),'id'=>'editsupplierreference', 'class' => 'form-control', 'maxlength'=>'40'); - echo form_input($data); - ?> -
- - - - -
-
-
-
- -
- - 'editsupplierofferno','value' => set_value('editsupplierofferno',$suppofferno),'id'=>'editsupplierofferno', 'class' => 'form-control'); - echo form_input($data); - ?> -
- -
-
-
-
- - -
- - 'editotherreference','value' => set_value('editotherreference',$otherref),'id'=>'editotherreference', 'class' => 'form-control'); - echo form_input($data); - ?> -
-
-
- -
- - 'editfincap','value' => set_value('editfincap',$fincap),'id'=>'editfincap', 'class' => 'form-control'); - echo form_input($data); - ?> -
-
-
-
-
-
- - -
-
-
-
- - - -
- - 'Select Work Status'); - - - if(!empty($PoTypeOptions)) - { - - foreach ($PoTypeOptions as $POpt): - - if($revenuesubtype==$POpt->ConfigValue){ - $optionsPO[$POpt->ConfigValue] = $POpt->ConfigValue; - } - - - endforeach; - foreach ($PoTypeOptions as $POpt1): - - if($revenuesubtype!=$POpt1->ConfigValue){ - $optionsPO[$POpt1->ConfigValue] = $POpt1->ConfigValue; - } - - - endforeach; - - } - - echo form_dropdown('PoTypeOptions', $optionsPO,set_value('PoTypeOptions'),'id="PoTypeOptions"' ,'required="true"' ,'class="form-control select2'); - - - - ?> -
- - - -
-
- - 'Yes','0'=>'No'); - echo form_dropdown('insurancestatus', $optionsnew,set_value('insurancestatus'),'id="insurancestatus"' ,'required="true"' ,'class="form-control select2'); - - ?> -
-
-
-
- -
- 'insuranceno','insuranceno' => set_value('insuranceno',$insurenceno),'id'=>'insuranceno', 'class' => 'form-control' ,'required' => 'true'); - echo form_input($data); - ?> -
-
-
- - - PaymentID] = $pay->PaymentTerms; - - - endforeach; - } - - echo form_dropdown('PaymentTerms', $options6,set_value('PaymentTerms',$Terms),'id="PaymentTerms"' ,'required="true"' ,'class="form-control select2'); - - ?> - - - - -
- -
- -
- - - - -
-
-
- -
- - - - -
- - - - - - - - - -
- -
-
- - - - - - - - - - - - -
- - - - -
- -
-
-
- - -
-
-
- - - 'txtTotBasicAmount','value' => set_value('txtTotBasicAmount',number_format($totBasicAmt, 2, '.', '')),'id'=>'txtTotBasicAmount', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;'); - echo form_input($data); - ?> - - -
-
- - - 'txtTotalDiscount','value' => set_value('txtTotalDiscount',number_format($totDiscountAmt, 2, '.', '')),'id'=>'txtTotalDiscount', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;'); - echo form_input($data); - ?> - -
-
- - - 'txtTotalSGST','value' => set_value('txtTotalSGST',number_format($totSgst, 2, '.', '')),'id'=>'txtTotalSGST', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;'); - echo form_input($data); - ?> - -
- -
- - - 'txtTotalCGST','value' => set_value('txtTotalCGST',number_format($totCgst, 2, '.', '')),'id'=>'txtTotalCGST', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;'); - echo form_input($data); - ?> - -
-
-
- - -
- - - 'txtTotalPackaing','value' => set_value('txtTotalPackaing',number_format($totPackagingAmt, 2, '.', '')),'id'=>'txtTotalPackaing', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;'); - echo form_input($data); - ?> - -
-
- - - 'txtTotalInsurance','value' => set_value('txtTotalInsurance',number_format($totInsuranceAmt, 2, '.', '')),'id'=>'txtTotalInsurance', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;'); - echo form_input($data); - ?> - + + + + +
+ + -
-
- - +
+ + + + + Delivery Challan No + Delivery Challan Date + MaterialReceived Date + Vehicle No + Courier No + + + Action + + + + $gd) + { + + ?> + + + DeliveryChellanOrInvoiceNo?> + DeliveryChellanDate); + echo $date->format('d-m-Y'); ?> + MaterialRcvdDate); + echo $date->format('d-m-Y'); ?> + VehicleNo?> + CourierNo?> + + + + + + + + + + + + + + 'txtTotalFreight','value' => set_value('txtTotalFreight',number_format($totFreightAmt, 2, '.', '')),'id'=>'txtTotalFreight', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;'); - echo form_input($data); - ?> - -
-
- - 'txtTotalOrderValueSummary','value' => set_value('txtTotalOrderValueSummary',number_format($totOrderSummaryAmt, 2, '.', '')),'id'=>'txtTotalOrderValueSummary', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;'); - echo form_input($data); - ?> -
-
- -
-
- 'txtSpcialInstruction','value' => set_value('txtSpcialInstruction',$ServiceDescription),'id'=>'txtSpcialInstruction', 'class' => 'form-control' ); - echo form_textarea($data); + } + } + ?> + + +
+ +
+ + + + + + + + + + + + $gd) + { + if(!empty($gd->BillNo)){ + $index = $row+1; ?> - + + + + + + + - + + + + + + + + + + + + + +
Bill No FileAction
BillNo ?>FilePath))?$gd->FilePath:"No File"; ?> + FilePath)) { ?> + + +
+
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Bill No Delivery Challan NoDelivery Challan DateVehicle NoCourier NoFileAction
BillNo ?>DeliveryChellanOrInvoiceNo?>DeliveryChellanDate); - echo $date->format('d-m-Y'); ?>VehicleNo?>CourierNo?>FilePath?>
-
-
- - - -
-

- - - - - - - - - - - -   Save -   Submit -   Cancel - - -   OK - - - -

-
- -
- -
- - - -
-
- -
-
- - + - + + - + + + + + $("#addmorebutton").click(function(){ + + counter++; + + //var a = document.getElementById("addmorebutton").innerHTML = counter; + var bill = ; + + if(bill.length>=5){ + + swal("No more files to add");//this allows only 5 files; + return false; + } +else{ + + + + var div = document.createElement('div'); + div.id = "divid"; + div.className="row"; + + div.innerHTML='
'+ + // '
'+ + // ''+ + // ''+ + // '
'+ + '
'+ + ''+ + '
'+ + '
'+ + // '
' + // ''+ + // '
'+ + '
'+ + ''+ + '
'+ + '
'+ + + ''; + + $('#newdiv').append(div); + $('#hidecounter').val(counter); + + if(counter>1){ + swal("Add button click here");//this allows only 5 files; + return false; + } + else{ + $('#addmorebutton').hide(); + } + } + + }); + + function addRow() + { + //var file = $('#imag').val(); + + var file = $('#images').val(); + if (file=='') + { + swal('File not found'); + + } + else { + fileupload(counter); + } + } + + + + function Copyfilename(id) + { + var size = $('input[name='+id+']')[0].files[0].size; + + var number = id.replace(/[^0-9]+/ig,""); + if(size > 2100000){ + + swal('Sorry Your File is Large To 2MB'); + removeRow(id); + //$('input[name = browseFiles'+number+']').val(' '); + }else { + var name = $('input[name='+id+']')[0].files[0].name; + + $("#maint_filename"+number).val(name); + } + } + function removeRow(input) { + var number = input.replace(/[^0-9]+/ig,""); + if(counter >= 1){ + counter--; + $("#divid"+number).remove(); + $('#hidecounter').val(counter); + } + } + \ No newline at end of file diff --git a/application/views/editimportpo.php b/application/views/editimportpo.php index fbae730a..2e03d7f7 100644 --- a/application/views/editimportpo.php +++ b/application/views/editimportpo.php @@ -5,19 +5,16 @@ $Value=''; $EXCRATE=0; $parentPO= ''; $ServiceDescription=''; - $Value=$unicode; - $Currencycode=$currencycode; - - $Terms=''; +$Terms=''; $DeliverySchedule=''; - + foreach ($CurrencyDetail as $Detail) { $Cur=$Detail->Currency_Code.' '.' - '.' '.$Detail->Country_and_Currency; } - +//echo $Cur; foreach ($PaymentTerms as $TER) @@ -148,7 +145,7 @@ if(!empty($POMaster)) // $PaymentDays=$Req->PaymentDays; $StatusName=$Req->StatusName; $Currency_Type=$Req->CurrencyType; - $parentPO =$Req->ParentPO; + $parentPO =$Req->ParentPO; $DeliverySchedule=$Req->DeliverySchedule; $Import_DispatchDetails=$Req->Import_DispatchDetails; $Import_PlaceofOrgin=$Req->Import_PlaceofOrgin; @@ -206,6 +203,17 @@ if(!empty($RequistionDetails)) } } + +if(!empty($getlogpodtl)) +{ + + +foreach ($getlogpodtl as $values ) +{ + $update=$values->FirstName; +} +} + ?>