ria/application/controllers/servicepurchaseorder.php
venbatechnologies@gmail.com 8effb72313 issues fixes in ria
2018-06-25 16:11:50 +05:30

678 lines
25 KiB
PHP

<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : servicepurchaseorder (Service Purchase Order Details - Controller)
* servicepurchaseorder Class to control all service po related operations.
* @author : Venba Info Tech -
* @version : 1.1
* @since : 15 November 2017
*/
class servicepurchaseorder extends BaseController
{
/**
* default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->load->model('purchaseorder_model');
$this->load->library('session');
$this->load->library('form_validation');
$this->load->model('requistion_model');
$this->isLoggedIn();
$this->CompanyName = $this->global['CompanyName'];
}
/**
* To load Service PO Billing
*/
function viewServicePOReportForBilling()
{
//$this->global['pageTitle'] = 'Resico : Service Purchase Order for Billing';
$this->global['pageTitle'] = $this->CompanyName.': Service Purchase Order';
$data["Billing"] = $this->purchaseorder_model->GetServicePOListforBilling();
$this->loadViews("serviceporeport", $this->global,$data,null);
}
/**
* To Change Status of Service PO.
*/
function UpdateServicePOStatus()
{
// $this->global['pageTitle'] = 'Resico : Update Service PO Status';
$this->global['pageTitle'] = $this->CompanyName.' : Update Service PO Status';
$data['PO'] = $this->purchaseorder_model->GetServicePOListforStatusUpdate();
$data['WorkStatus']=$this->purchaseorder_model->getStatus(7);
$this->loadViews("statusofservicepurchaseorder", $this->global,$data,Null);
}
/**
* To Get Po details for Service PO Billing
*/
function getPODetails()
{
$PONO = $this->input->post('id');
$PO=$PONO;
$result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO);
$HTML="";
for ($i = 0; $i < count($result); $i++)
{
$SNo = $i + 1;
$ReqNo = $result[$i]['ReqNo'];
$Reqedby = $result[$i]['FirstName'];
$ReqDate = $result[$i]['ReqDate'];
$SupplierID = $result[$i]['SupplierName'];
$Workstatus = $result[$i]['WorkStatus'];
$MaterialCode = $result[$i]['MaterialCode'];
$Description = $result[$i]['ServiceMaterialDescription'];
$UOM = $result[$i]['UOM'];
$Quantity = $result[$i]['Quantity'];
$Rate = $result[$i]['Rate'];
$rdate = new dateTime($result[$i]['ReqDate']);
$ReqDate = $rdate->format('d-m-Y');
$HTML.="<tr id='".$SNo."'>
<td align='left'>". $ReqNo."</td>
<td align='left'>".$Reqedby."</td>
<td align='left'>".$ReqDate."</td>
<td align='left'>".$SupplierID."</td>
<td align='left'>".$MaterialCode."</td>
<td align='left' >".$Description."</td>
<td align='left'>".$UOM."</td>
<td align='left'>".$Quantity."</td>
<td align='left'>".$Rate."</td>
<td align='left'>".$Workstatus."</td>
</tr>";
}
echo $HTML;
}
/**
* To Update Service PO Status
*/
function UpdateServiceStatus()
{
$PONO = $this->input->post('PONO');
$WorkStatus = $this->input->post('WorkStatus');
$Remarks = $this->input->post('Remarks');
$updatedBy = $this->session->userdata ( 'userId' );
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updateddt = $dt->format('Y-m-d H:i:s');
if($WorkStatus== SERVICE_COMPLETED ){
$POStatus=PO_SERVICE_COMPLETED;
$POList = array('UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'ServiceWorkStatusRemarks'=>$Remarks,'ServiceWorkStatus'=>$WorkStatus,'Status'=>$POStatus);
$PO=$PONO;
$result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO);
for ($i = 0; $i < count($result); $i++)
{
$MaterialCode = $result[$i]['MaterialCode'];
$ReqList = $this->purchaseorder_model->updateReqDetail($PONO,$POStatus,$MaterialCode);
}
$this->purchaseorder_model->UpdateReceivedQtyforServicePO($PONO,$updateddt,$updatedBy);
}
else{
$POList = array('UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'ServiceWorkStatusRemarks'=>$Remarks,'ServiceWorkStatus'=>$WorkStatus);
}
$POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList);
$this->UpdateServicePOStatus();
echo "<script>alert('Successfully Updated the workStatus of the PO ".$PONO."')</script>";
}
/**
* To get the available Budget Amount
**/
function AvilBudgetAmount()
{
$this->load->model('costcenter_model');
$CostCode = $this->input->post('id');
$ReqType = $_GET['ReqType'];
$FYStart = '';
$FYEnd = '';
$FiscalYear = $this->costcenter_model->getFiscalYear();
if(!empty($FiscalYear))
{
foreach ($FiscalYear as $Fy)
{
$FYStart =$Fy->StartYear;
$FYEnd =$Fy->EndYear;
}
}
$FYdt = $FYStart." - ".$FYEnd ;
$this->load->model('purchaseorder_model');
$result = array();
if($ReqType== CAPITAL)
{
$result = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType);
}
else if($ReqType== IMPORT)
{
$result = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$ReqType);
}
else
{
$result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType);
}
$AvilBudAmt = '0';
if(count($result)>0)
{
$AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue'];
}
print_r($AvilBudAmt);
}
/**
* To convert the dateformat (date with time) and store to DB
*/
function getDateformat($Val)
{
$date = new DateTime($Val,new DateTimeZone('Asia/Kolkata'));
$retDate = $date->format('Y-m-d H:i:s');
return $retDate;
}
/**
* To Create Service Purchase Order
*/
function addNewServicePurchaseOrder()
{
$POdt =$this->input->post('PODate');
$PODate = $this->getDateformat($POdt);
$SupplierID = $this->input->post('drpSupplier');
$DeliveryAddr = $this->input->post('DeliveryAddr');
$dt = $this->input->post('Deliverydt');
//$Deliverydt = $this->getDateformat($dt);
$DeliveryOption = $this->input->post('DateRange');
if($DeliveryOption==1)
{
$Deliverydt = '';
$DeliverySchedule = $this->input->post('Scheduleby');
}
else{
$Deliverydt = $this->getDateformat($dt);
$DeliverySchedule = '';
}
$ModeOfShipment=$this->input->post('addmodeofshipment');
$SupplierReference=$this->input->post('addsupplierreference');
$SuppliersOfferNo=$this->input->post('addsupplierofferno');
$OtherReferences=$this->input->post('addotherreference');
$Fincap=$this->input->post('addfincap');
$InsuranceOptions=$this->input->post('insuranceStatus');
$InsuranceNo=$this->input->post('insuranceNo');
$ServiceTypeOptions=$this->input->post('PoTypeOptions');
$DescriptionOfPo = $this->input->post('descofpo');
$PaymentTerms=$this->input->post('PaymentTerms');
$OtherPayment=$this->input->post('Otherpayment');
$POType = $this->input->post('POType');
$BudgetType = $this->input->post('Budget');
$SpcialInstruction = $this->input->post('ScopeOfWork');
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
$POStatus = $this->input->post('txtStatus');
$CreateBy = $this->session->userdata ( 'userId' );
$RowCount = $this->input->post('txtRowCount');
$DeletedRow = $this->input->post('txtDeletedRow');
$comma_separated = explode(':', $DeletedRow);
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s');
$WorkStatus=$this->input->post('workstatus');
// PO Master
$POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus, 'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption, 'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'ServiceWorkStatus'=>$WorkStatus,'POType'=>$POType,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions,'BudgetType'=>$BudgetType);
$POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$ServiceTypeOptions);
$PONO = '';
if(count($POMaster)>0)
{
$PONO = $POMaster[0]['PONO'];
}
// PO Line Items
$LineItemStatus = REQITEM_NEW;
for ($i = 1; $i <= $RowCount; $i++)
{
$Per = $this->input->post('per'.$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);
$Cgst = $this->input->post('Cgst'.$i);
$Sgst = $this->input->post('Sgst'.$i);
$Igst = $this->input->post('Igst'.$i);
$AfterCgst = $this->input->post('AfterCgst'.$i);
$AfterSgst = $this->input->post('AfterSgst'.$i);
$AfterIgst = $this->input->post('AfterIgst'.$i);
$CostCenter = $this->input->post('costCode'.$i);
$ServiceFrequency=$this->input->post('Frequency'.$i);
$ItemDescription = $this->input->post('ItemDescription'.$i);
$OtherAmt = $this->input->post('OtherAmt'.$i);
$TotalOrderValue = $this->input->post('TotalOrderValue'.$i);
$SkipInsert = "False";
if( count($comma_separated) > 0)
{
for($j = 1; $j < count($comma_separated); $j++)
{
$deletedRow = $comma_separated[$j] ;
if($deletedRow == $i )
{
$SkipInsert = "True";
break;
}
}
}
if($SkipInsert == "False")
{
$this->load->model('requistion_model');
$RetItemNo = $this->requistion_model->getItemNumber($Reqnumber,$MaterialCode);
$ItemNo = '';
if(count($RetItemNo)>0)
{
$ItemNo = $RetItemNo[0]['ItemNo'];
}
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ServiceMaterialDescription'=>$ItemDescription,'Per'=>$Per,'ItemNo'=>$ItemNo);
$POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
$LineItemNo = '';
if(count($POLineItem)>0)
{
$LineItemNo = $POLineItem[0]['LineItemNo'];
}
if(trim($POType) == SERVICE )
{
// echo 'Success';
$ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'otherallowance'=>$OtherAmt);
$ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList);
}
}
}
echo 'Service Purchase Order Created Successfully!The PO NO Is: '.$PONO;
}
//update service po
function UpdateServicePurchaseOrder()
{
$PONO =$this->input->post('txtPONO');
$newsup=$this->input->post('newsup');
// $newSupId = split("[ - ]+", $newsup);
$newSupId = preg_split('[-]',$newsup);
$POdt =$this->input->post('PODate');
$PODate = $this->getDateformat($POdt);
$b4supplier=$this->input->post('b4supplier');
$b4date=$this->input->post('b4podate');
$b4podate = $this->getDateformat($b4date);
$SupplierID = $this->input->post('drpSupplier');
$DeliveryAddr = $this->input->post('txtDeliveryAddress');
$dt = $this->input->post('Deliverydt');
$DeliveryOption = $this->input->post('DateRange');
if($DeliveryOption==1){
$Deliverydt = '';
$DeliverySchedule = $this->input->post('Scheduleby');
}
else{
$Deliverydt = $this->getDateformat($dt);
$DeliverySchedule = '';
}
$ModeOfShipment=$this->input->post('editmodeofshipment');
$SupplierReference=$this->input->post('editsupplierreference');
$SuppliersOfferNo=$this->input->post('editsupplierofferno');
$OtherReferences=$this->input->post('editotherreference');
$Fincap=$this->input->post('editfincap');
$InsuranceOptions=$this->input->post('insuranceStatus');
$InsuranceNo=$this->input->post('insuranceNo');
$ServiceTypeOptions=$this->input->post('PoTypeOptions');
$DescriptionOfPo = $this->input->post('editdescofpo');
$PaymentTerms=$this->input->post('PaymentTerms');
$OtherPayment=$this->input->post('Otherpayment');
$POType = $this->input->post('POType');
$BudgetType = $this->input->post('Budget');
$SpcialInstruction = $this->input->post('ScopeofWork');
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
$POStatus = $this->input->post('txtStatus');
$updatedBy = $this->session->userdata ( 'userId' );
$RowCount = $this->input->post('txtRowCount');
$DeletedRow = $this->input->post('txtDeletedRow');
$comma_separated = explode(':', $DeletedRow);
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updateddt = $dt->format('Y-m-d H:i:s');
$WorkStatus=$this->input->post('workstatus');
// PO Master
$POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'ServiceWorkStatus'=>$WorkStatus,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions,'BudgetType'=>$BudgetType);
$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)
{
$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);
$b4qty=$this->input->post('b4qty'.$i);
$b4rate=$this->input->post('b4rate'.$i);
$Reqnumber = $this->input->post('Reqnumber'.$i);
$itemRate = $this->input->post('itemRate'.$i);
$Cgst = $this->input->post('Cgst'.$i);
$Sgst = $this->input->post('Sgst'.$i);
$Igst = $this->input->post('Igst'.$i);
$AfterCgst = $this->input->post('AfterCgst'.$i);
$AfterSgst = $this->input->post('AfterSgst'.$i);
$AfterIgst = $this->input->post('AfterIgst'.$i);
$CostCenter = $this->input->post('costCode'.$i);
$ServiceFrequency=$this->input->post('Frequency'.$i);
$POLineItemNo = $this->input->post('LineItemNo'.$i);
$TotalOrderValue = $this->input->post('TotalOrderValue'.$i);
$ItemDescription = $this->input->post('ItemDescription'.$i);
$OtherAmt = $this->input->post('OtherAmt'.$i);
$Per = $this->input->post('per'.$i);
$ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt);
$this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails);
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);
}
$POLineItem = array();
$LineItemNo = '';
$SkipInsert = "False";
if( count($comma_separated) > 0)
{
for($j = 1; $j < count($comma_separated); $j++)
{
$deletedRow = $comma_separated[$j] ;
if($deletedRow == $i )
{
$SkipInsert = "True";
break;
}
}
}
if($SkipInsert == "False")
{
if(strlen($POLineItemNo) == 0)
{
$this->load->model('requistion_model');
$RetItemNo = $this->requistion_model->getItemNumber($Reqnumber,$MaterialCode);
$ItemNo = '';
if(count($RetItemNo)>0)
{
$ItemNo = $RetItemNo[0]['ItemNo'];
}
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ServiceMaterialDescription'=>$ItemDescription,'Per'=>$Per,'ItemNo'=>$ItemNo);
$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,'ServiceMaterialDescription'=>$ItemDescription,'Per'=>$Per);
$POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList);
}
if(trim($POType) == SERVICE )
{
$isExists = $this->purchaseorder_model->LineItemExists($LineItemNo);
if(count($isExists) == 0)
{
$ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'otherallowance'=>$OtherAmt);
$this->purchaseorder_model->addServiceTax($ServiceTaxList);
}
else
{
$ServiceTaxList1 = array('CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'otherallowance'=>$OtherAmt);
$this->purchaseorder_model->updateServiceTax($LineItemNo,$ServiceTaxList1);
}
}
}
}
echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO;
}
function uploadfile()
{
$bill= $this->input->post('param1');
$oldfile= $this->input->post('param2');
// $new_file_name =$_FILES['file']['name'];
$new_file_name =$_FILES['file']['name'];
$new_file_name = str_replace(" ","",$new_file_name);
if(!empty($new_file_name))
{
$Picture = $this->add();
}
$uploadfile = $this->purchaseorder_model->updatefile($bill,$Picture,$oldfile);
if($uploadfile > 0){
echo "file updated successfully!";
}
else{
echo "file not updated!";
}
}
function add()
{
$picture = '';
if(!empty($_FILES['file']['name']))
{
$config['upload_path'] = 'uploads/BillFiles/';
$config['allowed_types'] = 'docx|pdf|doc|png|jpg';
//$config['file_name'] = $_FILES['file']['name'];
$config['file_name'] = str_replace(" ","",$_FILES['file']['name']);
//print_r($config) ;
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload('file'))
{
$uploadData = $this->upload->data();
$picture = $uploadData['file_name'];
}
else
{
$error = array('error' => $this->upload->display_errors());
$picture = '';
}
}
else
{
$picture = '';
}
return $picture ;
}
/*-----------------------------------*/
function addfileuplod()
{
$pono= $this->input->post('PONO');
$new_file_name =$_FILES['file']['name'];
$new_file_name = str_replace(" ","",$new_file_name);
$files = $this->purchaseorder_model->getfies($pono);
$fcount = 0;
foreach ($files as $value)
{
$lastfile = $value->FilePath;
if($lastfile == $new_file_name)
{
$fcount++;
}
}
$upfile='';
if($fcount == 0)
{
if(!empty($new_file_name))
{
$Picture = $this->adfile();
$filelist =array('PONO'=>$pono,'FilePath'=>$Picture);
$upfile = $this->purchaseorder_model->insertfile($filelist);
}
}
if($upfile > 0){
echo "file updated successfully!";
}
else{
echo " No File Choose or File name already Exist";
}
}
function adfile()
{
$picture = '';
if(!empty($_FILES['file']['name']))
{
$config['upload_path'] = 'uploads/BillFiles/';
$config['allowed_types'] = 'docx|pdf|doc|png|jpg';
// $config['file_name'] = $_FILES['file']['name'];
$config['file_name'] = str_replace(" ","",$_FILES['file']['name']);
//print_r($config);die;
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload('file'))
{
$uploadData = $this->upload->data();
$picture = $uploadData['file_name'];
}
else
{
$error = array('error' => $this->upload->display_errors());
$picture = '';
}
}
else
{
$picture = '';
}
return $picture ;
}
function pageNotFound()
{
//$this->global['pageTitle'] = 'Resico : 404 - Page Not Found';
$this->global['pageTitle'] = $this->CompanyName.' : Edit Service Purchase order form';
$this->loadViews("404", $this->global, NULL, NULL);
}
}
?>