PO
This commit is contained in:
parent
928187cd2b
commit
f37d2ea011
@ -21,7 +21,7 @@ class purchaseorder extends BaseController
|
|||||||
|
|
||||||
$this->load->library('session');
|
$this->load->library('session');
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
|
$this->load->model('requistion_model');
|
||||||
$this->isLoggedIn();
|
$this->isLoggedIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +50,145 @@ class purchaseorder extends BaseController
|
|||||||
$this->loadViews("createPOfromRequistion", $this->global, $data,Null);
|
$this->loadViews("createPOfromRequistion", $this->global, $data,Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used to load the purchaseorder list
|
||||||
|
*/
|
||||||
|
function PurchaseOrderList()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->load->library('pagination');
|
||||||
|
|
||||||
|
$count = $this->purchaseorder_model->purchaseorderListingCount('');
|
||||||
|
|
||||||
|
$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
$data['POData'] = $this->purchaseorder_model->purchaseorderListing();
|
||||||
|
|
||||||
|
|
||||||
|
$this->global['pageTitle'] = 'Siddharth : Purchase Orders';
|
||||||
|
|
||||||
|
$this->loadViews("POlist", $this->global, $data, NULL);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This function used to show the Purchase Order Screen
|
||||||
|
*/
|
||||||
|
|
||||||
|
function CreatePurchaseOrder()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$this->global['pageTitle'] = 'Siddharth : Purchase order form';
|
||||||
|
|
||||||
|
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
|
||||||
|
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
|
||||||
|
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
||||||
|
$SelectedReq = json_decode($this->input->post('txtReqNo'));
|
||||||
|
$Req = $SelectedReq->Req;
|
||||||
|
$data['ReqList'] = $Req ;
|
||||||
|
$ReqArray = array();
|
||||||
|
$ReqType = '';
|
||||||
|
|
||||||
|
foreach ($Req as $SID):
|
||||||
|
$ReqArray[] = $SID->ReqNo ;
|
||||||
|
$ReqType = $SID->ReqType;
|
||||||
|
endforeach;
|
||||||
|
|
||||||
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
$Year = $dt->format('Y');
|
||||||
|
$data['CostList'] = $this->purchaseorder_model->getCostCenterbyRequist('',$Year,$ReqType);
|
||||||
|
$data['MaterialList'] = $this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray);
|
||||||
|
$data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray);
|
||||||
|
$ViewName = '';
|
||||||
|
if($ReqType == REVENUE)
|
||||||
|
{
|
||||||
|
$ViewName = 'Purchaseorder';
|
||||||
|
}
|
||||||
|
else //if($ReqType == SERVICE)
|
||||||
|
{
|
||||||
|
$ViewName = 'servicePurchaseorder';
|
||||||
|
}
|
||||||
|
$this->loadViews($ViewName, $this->global,$data, NULL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//To View/Update Purchase Order
|
||||||
|
function EditPurchaseOrder()
|
||||||
|
{
|
||||||
|
$PONO = $_GET['PONO'];
|
||||||
|
$ReqType = $_GET['ReqType'];
|
||||||
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
$Year = $dt->format('Y');
|
||||||
|
$data['CostList'] = $this->purchaseorder_model->getCostCenterbyRequist('',$Year,$ReqType);
|
||||||
|
$Req = $this->purchaseorder_model->getRequistionNoFromPO($PONO);
|
||||||
|
$data['ReqList'] = $Req ;
|
||||||
|
$ReqArray = array();
|
||||||
|
foreach ($Req as $SID):
|
||||||
|
$ReqArray[] = $SID->ReqNo ;
|
||||||
|
endforeach;
|
||||||
|
$data['MaterialList'] = $this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray);
|
||||||
|
|
||||||
|
$data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray);
|
||||||
|
if($ReqType == SERVICE)
|
||||||
|
{
|
||||||
|
|
||||||
|
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
||||||
|
$data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO);
|
||||||
|
$data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetails($PONO);
|
||||||
|
$this->global['pageTitle'] = 'Siddharth : Edit Service Purchase order form';
|
||||||
|
$this->loadViews("EditservicePurchaseorder", $this->global, $data, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// To get the Material value based on the MaterialCode
|
||||||
|
function getDetailsforReq()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$SearchFilter= $this->input->post('id');
|
||||||
|
// $reqDate= $this->input->post('ReqDate');
|
||||||
|
$DeptCode = $SearchFilter[0];
|
||||||
|
$MatType = $SearchFilter[1];
|
||||||
|
$ReqNo = $SearchFilter[2];
|
||||||
|
// $ReqDetai = $this->purchaseorder_model->getRequistDetails( $EmpID );
|
||||||
|
|
||||||
|
$CostList = $this->requistion_model->GetCostCenterByDept( $DeptCode);
|
||||||
|
|
||||||
|
$HTML = "<option value='-1'>Select Cost center</option>";
|
||||||
|
$BudAmount = "";
|
||||||
|
if(count($CostList) > 0)
|
||||||
|
{
|
||||||
|
for ($j = 0; $j < count($CostList); $j++)
|
||||||
|
{
|
||||||
|
$Code = $CostList[$j]['CostCenterCode'];
|
||||||
|
$Name = $CostList[$j]['CostCenterName'];
|
||||||
|
$HTML .="<option value='".$Code."'>".$Code."-".$Name."</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$MaterialDetails = $this->purchaseorder_model->getRawMaterialListForPO($MatType,$ReqNo);
|
||||||
|
|
||||||
|
$HTML1 = "<option value='-1'>Select Material Type</option>";
|
||||||
|
|
||||||
|
if(count($MaterialDetails) > 0)
|
||||||
|
{
|
||||||
|
for ($j = 0; $j < count($MaterialDetails); $j++)
|
||||||
|
{
|
||||||
|
$Code = $MaterialDetails[$j]['MaterialCode'];
|
||||||
|
$Name = $MaterialDetails[$j]['MaterialName'];
|
||||||
|
$HTML1 .="<option value='".$Code."'>".$Code."-".$Name."</option>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// print_r($HTML1);
|
||||||
|
|
||||||
|
die(json_encode(array('MatDetail' =>$HTML1,'Cost'=> $HTML)));
|
||||||
|
}
|
||||||
/* This method to get the status based on the Department selection in th
|
/* This method to get the status based on the Department selection in th
|
||||||
*/
|
*/
|
||||||
function getStatusByDepartment()
|
function getStatusByDepartment()
|
||||||
@ -72,6 +211,33 @@ class purchaseorder extends BaseController
|
|||||||
die(json_encode(array('depStaus' => $HTML)));
|
die(json_encode(array('depStaus' => $HTML)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To get the available Budget Amount
|
||||||
|
function AvilBudgetAmount()
|
||||||
|
{
|
||||||
|
$SearchFilter= $this->input->post('id');
|
||||||
|
// $reqDate= $this->input->post('ReqDate');
|
||||||
|
$CostCode = $SearchFilter[0];
|
||||||
|
$ReqType = $SearchFilter[1];
|
||||||
|
print_r($SearchFilter);
|
||||||
|
$CostCode= $this->input->post('id');
|
||||||
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
|
||||||
|
$Year = $dt->format('Y');
|
||||||
|
$this->load->model('purchaseorder_model');
|
||||||
|
$result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType);
|
||||||
|
//print_r($result);
|
||||||
|
$AvilBudAmt = '';
|
||||||
|
if(count($result)>0)
|
||||||
|
{
|
||||||
|
$AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo 'Test';
|
||||||
|
print_r($AvilBudAmt);
|
||||||
|
//die(json_encode(array('Cost' => $AvilBudAmt)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getDateformat($Val)
|
function getDateformat($Val)
|
||||||
{
|
{
|
||||||
$date = new DateTime($Val,new DateTimeZone('Asia/Kolkata'));
|
$date = new DateTime($Val,new DateTimeZone('Asia/Kolkata'));
|
||||||
@ -180,7 +346,7 @@ class purchaseorder extends BaseController
|
|||||||
//echo $CostCenter;
|
//echo $CostCenter;
|
||||||
die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter)));
|
die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter)));
|
||||||
}
|
}
|
||||||
|
//This used to Create Revenue Purchase Order
|
||||||
function addNewPurchaseOrder()
|
function addNewPurchaseOrder()
|
||||||
{
|
{
|
||||||
$POdt =$this->input->post('PODate');
|
$POdt =$this->input->post('PODate');
|
||||||
@ -275,360 +441,176 @@ class purchaseorder extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//This used to Create Service Purchase Order
|
||||||
/**
|
function addNewServicePurchaseOrder()
|
||||||
* This function is used to load the purchaseorder list
|
|
||||||
*/
|
|
||||||
function purchaseorderListing()
|
|
||||||
{
|
|
||||||
if($this->isAdmin() == TRUE)
|
|
||||||
{
|
|
||||||
$this->loadThis();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->load->model('purchaseorder_model');
|
|
||||||
|
|
||||||
$searchText = $this->input->post('searchText');
|
|
||||||
$data['searchText'] = $searchText;
|
|
||||||
|
|
||||||
$this->load->library('pagination');
|
|
||||||
|
|
||||||
$count = $this->purchaseorder_model->purchaseorderListingCount($searchText);
|
|
||||||
|
|
||||||
$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 5 );
|
|
||||||
|
|
||||||
$data['userRecords'] = $this->purchaseorder_model->purchaseorderListing($searchText, $returns["page"], $returns["segment"]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : PO Listing';
|
|
||||||
|
|
||||||
$this->loadViews("POlist", $this->global, $data, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function ViewPurchaseOrder()
|
|
||||||
{
|
|
||||||
if($this->isAdmin() == TRUE)
|
|
||||||
{
|
|
||||||
$this->loadThis();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$data = $_GET['PONO'];
|
|
||||||
|
|
||||||
$this->load->model('purchaseorder_model');
|
|
||||||
$result['PODetail'] = $this->purchaseorder_model->getPurchaseOrder($data);
|
|
||||||
$result['POLineItem'] = $this->purchaseorder_model->getPOLineItem($data);
|
|
||||||
$this->loadViews("EditPurchaseOrder", $this->global, $result, NULL);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function used to show the Purchase Order Screen
|
|
||||||
*/
|
|
||||||
|
|
||||||
function CreatePurchaseOrder()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Purchase order form';
|
|
||||||
|
|
||||||
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
|
|
||||||
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
|
|
||||||
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
|
||||||
$SelectedReq = json_decode($this->input->post('txtReqNo'));
|
|
||||||
$Req = $SelectedReq->Req;
|
|
||||||
$data['ReqList'] = $Req ;
|
|
||||||
$ReqArray = array();
|
|
||||||
$ReqType = '';
|
|
||||||
|
|
||||||
foreach ($Req as $SID):
|
|
||||||
$ReqArray[] = $SID->ReqNo ;
|
|
||||||
$ReqType = $SID->ReqType;
|
|
||||||
endforeach;
|
|
||||||
|
|
||||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
|
||||||
$Year = $dt->format('Y');
|
|
||||||
$data['CostList'] = $this->purchaseorder_model->getCostCenterbyRequist('',$Year,$ReqType);
|
|
||||||
$data['MaterialList'] = $this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray);
|
|
||||||
$data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray);
|
|
||||||
//$data['FormulaList'] = $this->purchaseorder_model->getFormula();
|
|
||||||
|
|
||||||
|
|
||||||
$this->loadViews("Purchaseorder", $this->global,$data, NULL);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is used to load the add new PO */
|
|
||||||
function addPO()
|
|
||||||
{
|
|
||||||
|
|
||||||
if($this->isAdmin() == TRUE)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->loadThis();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->load->helper('form');
|
|
||||||
|
|
||||||
$this->load->model('purchaseorder_model');
|
|
||||||
$data['users'] = $this->purchaseorder_model->getusers();
|
|
||||||
$data['SupplierName'] = $this->purchaseorder_model->getSupplierName();
|
|
||||||
$data['RawMaterials'] = $this->purchaseorder_model->getRawMaterialList();
|
|
||||||
$data['UOM'] = $this->purchaseorder_model->getUOM();
|
|
||||||
$data['POType'] = $this->purchaseorder_model->getPOType();
|
|
||||||
$data['PurchasingCategory'] = $this->purchaseorder_model->getPurchasingCategory();
|
|
||||||
|
|
||||||
$data['EmpList'] = $this->purchaseorder_model->getEmployeeList();
|
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'siddharth : AddNew PO';
|
|
||||||
|
|
||||||
$this->loadViews("addPO", $this->global, $data, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function UpdatePO()
|
|
||||||
{
|
{
|
||||||
$PONO = $this->session->userdata('PONO');
|
$POdt =$this->input->post('PODate');
|
||||||
|
$PODate = $this->getDateformat($POdt);
|
||||||
$DiscountType = $this->input->post('DiscountType');
|
$SupplierID = $this->input->post('drpSupplier');
|
||||||
$DiscountValue = $this->input->post('txtDiscount');
|
$DeliveryAddr = $this->input->post('DeliveryAddr');
|
||||||
$PackagingType = $this->input->post('PackagingType');
|
$dt = $this->input->post('Deliverydt');
|
||||||
$PackagingValue = $this->input->post('txtPackaging');
|
$Deliverydt = $this->getDateformat($dt);
|
||||||
$Exciseduty = $this->input->post('Exciseduty');
|
$POType = $this->input->post('POType');
|
||||||
$Vat = $this->input->post('txtVat');
|
|
||||||
$Freight = $this->input->post('txtFreight');
|
$SpcialInstruction = $this->input->post('txtSpcialInstruction');
|
||||||
$TotalOrderValue = $this->input->post('txtOrderValue');
|
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
|
||||||
|
$POStatus = $this->input->post('txtStatus');
|
||||||
echo $PONO ;
|
|
||||||
echo $DiscountType;
|
|
||||||
echo $PackagingType;
|
|
||||||
|
|
||||||
$this->load->model('purchaseorder_model');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This function is used to add new user to the system
|
|
||||||
*/
|
|
||||||
function addNewPO()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
if($this->isAdmin() == TRUE)
|
|
||||||
{
|
|
||||||
$this->loadThis();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
$POType = $this->input->post('PO_Type');
|
|
||||||
$PODate = $this->input->post('PO_Date');
|
|
||||||
$SupplierID = $this->input->post('SupplierID');
|
|
||||||
$SpecialOrder = $this->input->post('SpecialOrder');
|
|
||||||
$role = $this->input->post('role');
|
|
||||||
$re_email = $this->input->post('re_email');
|
|
||||||
$re_phone = $this->input->post('re_phone');
|
|
||||||
$re_Date = $this->input->post('re_Date');
|
|
||||||
$bud_manager =$this->input->post('bud_manager');
|
|
||||||
$bud_manager_de = $this->input->post('BudgetManagerDepartment');
|
|
||||||
$Pur_category = $this->input->post('Pur_category');
|
|
||||||
$Justification = $this->input->post('Justification');
|
|
||||||
$SupplierAddress = $this->input->post('SupplierAddress');
|
|
||||||
$CreatedBy= $this->session->userdata('role');
|
|
||||||
$DiscountType = $this->input->post('DiscountType');
|
|
||||||
$txtDiscount = $this->input->post('txtDiscount');
|
|
||||||
$PackagingType = $this->input->post('PackagingType');
|
|
||||||
$txtPackaging = $this->input->post('txtPackaging');
|
|
||||||
$Exciseduty = $this->input->post('Exciseduty');
|
|
||||||
$txtVat = $this->input->post('txtVat');
|
|
||||||
$txtFreight = $this->input->post('txtFreight');
|
|
||||||
$txtOrderValue = $this->input->post('txtOrderValue');
|
|
||||||
$BasicValue = $this->input->post('BasicValue');
|
|
||||||
$AfterDiscount = $this->input->post('AfterDiscount');
|
|
||||||
$AfterPackaging = $this->input->post('AfterPackaging');
|
|
||||||
$AferExciseduty = $this->input->post('AferExciseduty');
|
|
||||||
$txtAfterVat = $this->input->post('txtAfterVat');
|
|
||||||
|
|
||||||
|
|
||||||
$PODate = date('m-d-Y H:i:s', strtotime(str_replace('/', '-', $PODate)));
|
|
||||||
$re_Date = date('m-d-Y H:i:s', strtotime(str_replace('/', '-', $re_Date)));
|
|
||||||
|
|
||||||
$this->load->model('purchaseorder_model');
|
|
||||||
|
|
||||||
$data['PONO'] = $this->purchaseorder_model->addNewPO($POType,$PODate, $SupplierID,$SpecialOrder,$role,$re_email,$re_phone,
|
|
||||||
$re_Date,$bud_manager,$bud_manager_de,$Pur_category, $Justification,$CreatedBy,$BasicValue,$DiscountType,$txtDiscount,$PackagingType,$txtPackaging,$Exciseduty,$txtVat,$txtFreight,$AfterDiscount,$AfterPackaging,$AferExciseduty,$txtAfterVat,$txtOrderValue);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$data = array_shift($data);
|
$CreateBy = $this->session->userdata ( 'userId' );
|
||||||
|
$RowCount = $this->input->post('txtRowCount');
|
||||||
$PO = $data[0]['PONO'];
|
|
||||||
|
|
||||||
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
$RowCount = $this->input->post('txtRowCount');
|
$createddt = $dt->format('Y-m-d H:i:s');
|
||||||
|
// PO Master
|
||||||
// Inserting PO Line item
|
$POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt );
|
||||||
|
|
||||||
|
$POMaster = $this->purchaseorder_model->addPOMaster($POList);
|
||||||
|
|
||||||
|
$PONO = '';
|
||||||
|
if(count($POMaster)>0)
|
||||||
|
{
|
||||||
|
$PONO = $POMaster[0]['PONO'];
|
||||||
|
}
|
||||||
|
//echo $PONO;
|
||||||
|
//echo $POType;
|
||||||
|
// PO Line Items
|
||||||
|
$LineItemStatus = REQITEM_NEW;
|
||||||
|
//echo ' test:'.REVENUE;
|
||||||
|
//echo $RowCount;
|
||||||
|
for ($i = 1; $i <= $RowCount; $i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
$MaterialCode = $this->input->post('materialCode'.$i);
|
||||||
for ($i = 1; $i <= $RowCount; $i++)
|
$Quantity = $this->input->post('quantity'.$i);
|
||||||
{
|
$Reqnumber = $this->input->post('Reqnumber'.$i);
|
||||||
$Material_ID = $this->input->post('ProductDescription'.$i);
|
$itemRate = $this->input->post('itemRate'.$i);
|
||||||
$UOM = $this->input->post('UOM'.$i);
|
$ServiceTax = $this->input->post('ServiceTax'.$i);
|
||||||
$Quantity = $this->input->post('Quantity'.$i);
|
$EduCess = $this->input->post('EduCess'.$i);
|
||||||
$UnitPrice = $this->input->post('UnitPrice'.$i);
|
$SecHighTax = $this->input->post('SecHighTax'.$i);
|
||||||
$data['POLineItem']= $this->purchaseorder_model-> addNewPOLineItem($PO,$Material_ID,$UOM,$Quantity,$UnitPrice);
|
$KrishiTax = $this->input->post('KrishiTax'.$i);
|
||||||
|
$SwachhTax = $this->input->post('SwachhTax'.$i);
|
||||||
}
|
$CostCenter = $this->input->post('costCode'.$i);
|
||||||
|
|
||||||
Print_r($PO);
|
$TotalOrderValue = $this->input->post('TotalOrderValue'.$i);
|
||||||
return $PO;
|
|
||||||
|
|
||||||
}
|
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter);
|
||||||
}
|
|
||||||
|
$POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
|
||||||
|
|
||||||
/**
|
$LineItemNo = '';
|
||||||
* This function is used load user edit information
|
|
||||||
* @param number $userId : Optional : This is user id
|
if(count($POLineItem)>0)
|
||||||
*/
|
{
|
||||||
function editOldPO($PO = NULL)
|
$LineItemNo = $POLineItem[0]['LineItemNo'];
|
||||||
{
|
}
|
||||||
if($this->isAdmin() == TRUE || $PO == 1)
|
//echo $LineItemNo;
|
||||||
{
|
|
||||||
$this->loadThis();
|
if(trim($POType) == SERVICE )
|
||||||
}
|
{
|
||||||
else
|
// echo 'Success';
|
||||||
{
|
$ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt);
|
||||||
if($PO == null)
|
|
||||||
{
|
$ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList);
|
||||||
redirect('purchaseorderListing');
|
echo 'Service tax Success';
|
||||||
}
|
}
|
||||||
|
echo 'Successfully Created the Record';
|
||||||
$data['SupplierName'] = $this->purchaseorder_model->getSupplierName();
|
}
|
||||||
$data['users'] = $this->purchaseorder_model->getusers();
|
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Edit User';
|
|
||||||
|
|
||||||
$this->loadViews("editOldPO", $this->global, $data, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is used to edit the user information
|
|
||||||
*/
|
|
||||||
function editPO()
|
|
||||||
{
|
|
||||||
if($this->isAdmin() == TRUE)
|
|
||||||
{
|
|
||||||
$this->loadThis();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->load->library('form_validation');
|
|
||||||
|
|
||||||
$PO = $this->input->post('PO');
|
|
||||||
|
|
||||||
$this->form_validation->set_rules('POType','PO Type','trim|required|');
|
|
||||||
$this->form_validation->set_rules('PODate','PO Date','trim|required|');
|
|
||||||
$this->form_validation->set_rules('SupplierID','SupplierID','trim|required|');
|
|
||||||
$this->form_validation->set_rules('SpecialOrder','Special Requirement of order','|max_length[20]');
|
|
||||||
$this->form_validation->set_rules('role','UserID','trim||numeric');
|
|
||||||
$this->form_validation->set_rules('reemail','Requester email','trim|valid_email|xss_clean|max_length[128]');
|
|
||||||
$this->form_validation->set_rules('rephone','Requester ph','required|min_length[10]|xss_clean');
|
|
||||||
$this->form_validation->set_rules('reDate','Requested Date','required');
|
|
||||||
$this->form_validation->set_rules('budmanager','Budget Manager');
|
|
||||||
$this->form_validation->set_rules('budmanagerde','Budget Manager Department','trim');
|
|
||||||
$this->form_validation->set_rules('PurchasingCategory','Purchasing Category','trim');
|
|
||||||
|
|
||||||
if($this->form_validation->run() == FALSE)
|
|
||||||
{
|
|
||||||
$this->editPO();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$POType = ucwords(strtolower($this->input->post('POType')));
|
|
||||||
$PODate = $this->input->post('PODate');
|
|
||||||
$SupplierID = $this->input->post('SupplierID');
|
|
||||||
$SpecialOrder = $this->input->post('SpecialOrder');
|
|
||||||
$role = $this->input->post('role');
|
|
||||||
$reemail = $this->input->post('reemail');
|
|
||||||
$rephone = $this->input->post('rephone');
|
|
||||||
$reDate = $this->input->post('reDate');
|
|
||||||
$budmanager = $this->input->post('budmanager');
|
|
||||||
$budmanagerde = $this->input->post('budmanagerde');
|
|
||||||
$Purcategory = $this->input->post('PurchasingCategory');
|
|
||||||
|
|
||||||
|
|
||||||
$POInfo = array('POType'=>$POType, 'PODate'=>$PODate, 'SupplierID'=>$SupplierID, 'SpecialOrder'=> $SpecialOrder,'UserID'=>$role,'RequestedDate'=>$reDate,'RequesterEmail'=>$reemail,'RequesterPh'=>$rephone, 'PurchasingCategory'=>$Purcategory,'BudgetManager'=>$budmanager,'BudgetManagerDepartment'=>$budmanagerde,'createdBy'=>$this->vendorId, 'createdDtm'=>date('Y-m-d H:i:sa'));
|
|
||||||
|
|
||||||
$POInfo = array();
|
|
||||||
|
|
||||||
$result = $this->purchaseorder_model->editPO($POInfo, $PO);
|
|
||||||
|
|
||||||
if($result == true)
|
|
||||||
{
|
|
||||||
$this->session->set_flashdata('success', 'PO updated successfully');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->session->set_flashdata('error', 'PO updation failed');
|
|
||||||
}
|
|
||||||
|
|
||||||
redirect('purchaseorderListing');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetSupplier()
|
|
||||||
{
|
|
||||||
$id = $this->input->post('id');
|
|
||||||
|
|
||||||
$this->load->model('supplier_model');
|
|
||||||
|
|
||||||
$result['Address'] = $this->supplier_model->GetSupplierAddress($id );
|
|
||||||
|
|
||||||
$result = array_shift($result);
|
|
||||||
|
|
||||||
$Address = $result[0]['Address'];
|
|
||||||
|
|
||||||
|
|
||||||
print $Address;
|
|
||||||
return $Address;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function UpdateServicePurchaseOrder()
|
||||||
function GetBudgetManagerDepartment()
|
|
||||||
{
|
{
|
||||||
$id = $this->input->post('id');
|
$PONO =$this->input->post('txtPONO');
|
||||||
|
|
||||||
$this->load->model('Employeedetails_model');
|
|
||||||
|
|
||||||
$result['DepartmentName'] = $this->Employeedetails_model->GetEmployeeDepartment($id );
|
|
||||||
|
|
||||||
$result = array_shift($result);
|
|
||||||
|
|
||||||
$DepartmentName = $result[0]['DepartmentName'];
|
|
||||||
|
|
||||||
|
$POdt =$this->input->post('PODate');
|
||||||
print $DepartmentName;
|
$PODate = $this->getDateformat($POdt);
|
||||||
return $DepartmentName;
|
|
||||||
|
$SupplierID = $this->input->post('drpSupplier');
|
||||||
|
$DeliveryAddr = $this->input->post('DeliveryAddr');
|
||||||
|
$dt = $this->input->post('Deliverydt');
|
||||||
|
$Deliverydt = $this->getDateformat($dt);
|
||||||
|
|
||||||
|
$POType = $this->input->post('POType');
|
||||||
|
|
||||||
|
$SpcialInstruction = $this->input->post('txtSpcialInstruction');
|
||||||
|
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
|
||||||
|
$POStatus = $this->input->post('txtStatus');
|
||||||
|
|
||||||
|
$updatedBy = $this->session->userdata ( 'userId' );
|
||||||
|
$RowCount = $this->input->post('txtRowCount');
|
||||||
|
|
||||||
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
$updateddt = $dt->format('Y-m-d H:i:s');
|
||||||
|
// PO Master
|
||||||
|
$POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt );
|
||||||
|
|
||||||
|
$POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList);
|
||||||
|
|
||||||
|
$LineItemStatus = REQITEM_NEW;
|
||||||
|
//echo ' test:'.REVENUE;
|
||||||
|
//echo $RowCount;
|
||||||
|
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);
|
||||||
|
$ServiceTax = $this->input->post('ServiceTax'.$i);
|
||||||
|
$EduCess = $this->input->post('EduCess'.$i);
|
||||||
|
$SecHighTax = $this->input->post('SecHighTax'.$i);
|
||||||
|
$KrishiTax = $this->input->post('KrishiTax'.$i);
|
||||||
|
$SwachhTax = $this->input->post('SwachhTax'.$i);
|
||||||
|
$CostCenter = $this->input->post('costCode'.$i);
|
||||||
|
$LineItemNo = $this->input->post('LineItemNo'.$i);
|
||||||
|
$TotalOrderValue = $this->input->post('TotalOrderValue'.$i);
|
||||||
|
|
||||||
|
$POLineItem = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(strlen($LineItemNo) == 0)
|
||||||
|
{
|
||||||
|
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter);
|
||||||
|
$POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$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,$LineItemNo,$POLineItemList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$LineItemNo = '';
|
||||||
|
|
||||||
|
if(count($POLineItem)>0)
|
||||||
|
{
|
||||||
|
$LineItemNo = $POLineItem[0]['LineItemNo'];
|
||||||
|
}
|
||||||
|
//echo $LineItemNo;
|
||||||
|
|
||||||
|
if(trim($POType) == SERVICE )
|
||||||
|
{
|
||||||
|
$isExists = $this->purchaseorder_model->LineItemExists($LineItemNo);
|
||||||
|
// echo 'Success';
|
||||||
|
if(count($isExists) == 0)
|
||||||
|
{
|
||||||
|
$ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt);
|
||||||
|
|
||||||
|
$ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt);
|
||||||
|
$this->purchaseorder_model->updateServiceTax($ServiceTaxList);
|
||||||
|
}
|
||||||
|
echo 'Service tax Success';
|
||||||
|
}
|
||||||
|
echo 'Successfully updated the Record';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageNotFound()
|
function pageNotFound()
|
||||||
{
|
{
|
||||||
$this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
|
$this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user