ria-edit po changes

This commit is contained in:
venbatechnologies@gmail.com 2018-06-12 18:21:05 +05:30
parent 0daef48532
commit 175ec7e1b8
6 changed files with 9117 additions and 7873 deletions

View File

@ -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)

View File

@ -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();
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff