Costcode error fixed
This commit is contained in:
parent
80c0a833d2
commit
13ee8a66cd
@ -5,9 +5,9 @@ require APPPATH . '/libraries/BaseController.php';
|
|||||||
/**
|
/**
|
||||||
* Class : purchaseorder (PurchaseorderController)
|
* Class : purchaseorder (PurchaseorderController)
|
||||||
* User Class to control all user related operations.
|
* User Class to control all user related operations.
|
||||||
* @author : VenbaMail Mali
|
* @author : Venba InfoTech
|
||||||
* @version : 1.1
|
* @version : 1.1
|
||||||
* @since : 15 Feb 2016
|
* @since : 09/06 Feb 2017
|
||||||
*/
|
*/
|
||||||
class purchaseorder extends BaseController
|
class purchaseorder extends BaseController
|
||||||
{
|
{
|
||||||
@ -37,10 +37,11 @@ class purchaseorder extends BaseController
|
|||||||
|
|
||||||
function requisition()
|
function requisition()
|
||||||
{
|
{
|
||||||
// $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAll$ReqNoReq();
|
|
||||||
$Req_No='';
|
$Req_No='';
|
||||||
$IsArray='';
|
$IsArray='';
|
||||||
$data['stList'] = $this->purchaseorder_model->getStatusListforAllReq();
|
|
||||||
|
$data['stList'] = $this->purchaseorder_model->getStatusListforAllReq();
|
||||||
|
|
||||||
$data['ReqList'] = $this->purchaseorder_model->getRawPOMaterialList($Req_No,$IsArray);
|
$data['ReqList'] = $this->purchaseorder_model->getRawPOMaterialList($Req_No,$IsArray);
|
||||||
|
|
||||||
@ -49,24 +50,7 @@ class purchaseorder extends BaseController
|
|||||||
$this->loadViews("createPOfromRequistion", $this->global, $data,Null);
|
$this->loadViews("createPOfromRequistion", $this->global, $data,Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*function CreateEmergencyPO()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Create Emergency Purchase Order';
|
|
||||||
|
|
||||||
$data['RequestType'] = $this->requistion_model->getConfigValue('C004');
|
|
||||||
|
|
||||||
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
|
||||||
|
|
||||||
$data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq();
|
|
||||||
|
|
||||||
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();
|
|
||||||
|
|
||||||
$data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate();
|
|
||||||
|
|
||||||
$this->loadViews("alterpurchaseorder", $this->global, $data,Null);
|
|
||||||
|
|
||||||
} */
|
|
||||||
/**
|
/**
|
||||||
* This function is used to load the purchaseorder list
|
* This function is used to load the purchaseorder list
|
||||||
*/
|
*/
|
||||||
@ -77,10 +61,10 @@ class purchaseorder extends BaseController
|
|||||||
|
|
||||||
$count = $this->purchaseorder_model->purchaseorderListingCount('');
|
$count = $this->purchaseorder_model->purchaseorderListingCount('');
|
||||||
|
|
||||||
$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 5 );
|
$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 10 );
|
||||||
|
|
||||||
//$this->purchaseorder_model->UpdateRequistItemStatus();
|
$this->purchaseorder_model->UpdateRequistionStatus();
|
||||||
$this->purchaseorder_model->UpdateRequistionStatus();
|
|
||||||
$data['POData'] = $this->purchaseorder_model->purchaseorderListing();
|
$data['POData'] = $this->purchaseorder_model->purchaseorderListing();
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Purchase Orders';
|
$this->global['pageTitle'] = 'Siddharth : Purchase Orders';
|
||||||
@ -109,21 +93,19 @@ class purchaseorder extends BaseController
|
|||||||
|
|
||||||
function CreatePurchaseOrder()
|
function CreatePurchaseOrder()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$this->load->library('form_validation');
|
|
||||||
|
|
||||||
|
|
||||||
$this->form_validation->set_rules('txtReqNo', 'txtReqNo', 'callback_Req_validate');
|
$this->form_validation->set_rules('txtReqNo', 'txtReqNo', 'callback_Req_validate');
|
||||||
|
|
||||||
if($this->form_validation->run() == FALSE)
|
if($this->form_validation->run() == FALSE)
|
||||||
{
|
{
|
||||||
$this->requisition();
|
$this->requisition();
|
||||||
//echo 'Validate method called';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Purchase order form';
|
$this->global['pageTitle'] = 'Siddharth : Purchase order' ;
|
||||||
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
|
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
|
||||||
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
|
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
|
||||||
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
||||||
@ -138,17 +120,34 @@ class purchaseorder extends BaseController
|
|||||||
foreach ($Req as $SID):
|
foreach ($Req as $SID):
|
||||||
$ReqArray[] = $SID->ReqNo ;
|
$ReqArray[] = $SID->ReqNo ;
|
||||||
$result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo);
|
$result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo);
|
||||||
$ReqType = $SID->ReqType;
|
$ReqType = $SID->ReqType;
|
||||||
// echo $SID->ReqNo;
|
|
||||||
|
|
||||||
endforeach;
|
endforeach;
|
||||||
//print_r ($result);
|
|
||||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
|
||||||
$Year = $dt->format('Y');
|
$data['MaterialList'] = $result;
|
||||||
$data['CostList'] = $this->purchaseorder_model->getCostCenterbyRequist('',$Year,$ReqType);
|
/* Cost code from Requisition - Client Review Fix
|
||||||
$data['MaterialList'] = $result; //$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray);
|
Start here */
|
||||||
//print_r ($data['MaterialList']);
|
$ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray);
|
||||||
$data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray);
|
$data['RequistionDetails'] = $ReqDetails;
|
||||||
|
$CostCode = '';
|
||||||
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
|
||||||
|
$Year = $dt->format('Y');
|
||||||
|
|
||||||
|
foreach ($ReqDetails as $Rs):
|
||||||
|
$CostCode = $Rs->CostCenterCode;
|
||||||
|
endforeach;
|
||||||
|
|
||||||
|
$AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType);
|
||||||
|
|
||||||
|
|
||||||
|
if(count($AvlBudget)>0)
|
||||||
|
{
|
||||||
|
$data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue'];
|
||||||
|
}
|
||||||
|
/* End Here */
|
||||||
|
|
||||||
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();
|
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();
|
||||||
$data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate();
|
$data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate();
|
||||||
|
|
||||||
@ -209,11 +208,9 @@ class purchaseorder extends BaseController
|
|||||||
//To View/Update Purchase Order
|
//To View/Update Purchase Order
|
||||||
function EditPurchaseOrder()
|
function EditPurchaseOrder()
|
||||||
{
|
{
|
||||||
$PONO = $_GET['PONO'];
|
$PONO = $_GET['PONO'];
|
||||||
$ReqType = $_GET['ReqType'];
|
$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);
|
$Req = $this->purchaseorder_model->getRequistionNoFromPO($PONO);
|
||||||
$data['ReqList'] = $Req ;
|
$data['ReqList'] = $Req ;
|
||||||
$result = array();
|
$result = array();
|
||||||
@ -222,13 +219,34 @@ class purchaseorder extends BaseController
|
|||||||
$ReqArray[] = $SID->ReqNo ;
|
$ReqArray[] = $SID->ReqNo ;
|
||||||
$result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo);
|
$result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo);
|
||||||
endforeach;
|
endforeach;
|
||||||
$data['MaterialList'] = $result;//$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray);
|
$data['MaterialList'] = $result;//$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray);
|
||||||
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
||||||
$data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray);
|
/* Cost code from Requisition - Client Review Fix
|
||||||
$data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO);
|
Start here */
|
||||||
$data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate();
|
$ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray);
|
||||||
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
|
$data['RequistionDetails'] = $ReqDetails;
|
||||||
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
|
$CostCode = '';
|
||||||
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
|
||||||
|
$Year = $dt->format('Y');
|
||||||
|
|
||||||
|
foreach ($ReqDetails as $Rs):
|
||||||
|
$CostCode = $Rs->CostCenterCode;
|
||||||
|
endforeach;
|
||||||
|
|
||||||
|
$AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType);
|
||||||
|
|
||||||
|
|
||||||
|
if(count($AvlBudget)>0)
|
||||||
|
{
|
||||||
|
$data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue'];
|
||||||
|
}
|
||||||
|
/* End Here */
|
||||||
|
|
||||||
|
$data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO);
|
||||||
|
$data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate();
|
||||||
|
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
|
||||||
|
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
|
||||||
if($ReqType == SERVICE)
|
if($ReqType == SERVICE)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -331,50 +349,47 @@ class purchaseorder extends BaseController
|
|||||||
if(count($result)>0)
|
if(count($result)>0)
|
||||||
{
|
{
|
||||||
$AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue'];
|
$AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// echo 'Test';
|
|
||||||
print_r($AvilBudAmt);
|
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'));
|
||||||
// print_r($date);
|
$retDate = $date->format('Y-m-d H:i:s');
|
||||||
$retDate = $date->format('Y-m-d H:i:s');
|
return $retDate;
|
||||||
return $retDate;
|
|
||||||
}
|
}
|
||||||
/* Method to get the Requistion list based on the search filter*/
|
/* Method to get the Requistion list based on the search filter*/
|
||||||
|
|
||||||
function SearchListofRequistion()
|
function SearchListofRequistion()
|
||||||
{
|
{
|
||||||
$SearchFilter= $this->input->post('id');
|
$SearchFilter= $this->input->post('id');
|
||||||
// $reqDate= $this->input->post('ReqDate');
|
|
||||||
$DEPCode = $SearchFilter[0];
|
$DEPCode = $SearchFilter[0];
|
||||||
$Status = $SearchFilter[1];
|
$Status = $SearchFilter[1];
|
||||||
$rng = $SearchFilter[2];;
|
$rng = $SearchFilter[2];;
|
||||||
// $ToDate = $SearchFilter[3];
|
|
||||||
$FromDate ='';
|
$FromDate ='';
|
||||||
$ToDate = '';
|
$ToDate = '';
|
||||||
// echo $rng;
|
|
||||||
$Dt = explode("-",$rng);
|
$Dt = explode("-",$rng);
|
||||||
// print_r( $Dt);
|
|
||||||
if(count( $Dt)>1)
|
if(count( $Dt)>1)
|
||||||
{
|
{
|
||||||
$FDate = $Dt[0];
|
$FDate = $Dt[0];
|
||||||
$TDate = $Dt[1];
|
$TDate = $Dt[1];
|
||||||
$FromDate = $this->getDateformat($FDate);
|
$FromDate = $this->getDateformat($FDate);
|
||||||
$ToDate = $this->getDateformat($TDate);
|
$ToDate = $this->getDateformat($TDate);
|
||||||
}
|
}
|
||||||
//echo $FromDate;
|
|
||||||
// print_r($Dt);
|
$result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate);
|
||||||
$result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate);
|
|
||||||
|
|
||||||
|
$HTML="";
|
||||||
$HTML="";
|
for ($i = 0; $i < count($result); $i++)
|
||||||
for ($i = 0; $i < count($result); $i++)
|
|
||||||
{
|
{
|
||||||
$SNo = $i + 1;
|
$SNo = $i + 1;
|
||||||
$ReqNo = $result[$i]['ReqNo'];
|
$ReqNo = $result[$i]['ReqNo'];
|
||||||
@ -398,8 +413,7 @@ class purchaseorder extends BaseController
|
|||||||
<td align='left'>".$Designation."</td>
|
<td align='left'>".$Designation."</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
}
|
}
|
||||||
//print_r( $HTML);
|
die(json_encode(array('ReqList' =>$HTML)));
|
||||||
die(json_encode(array('ReqList' =>$HTML)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -443,8 +457,7 @@ class purchaseorder extends BaseController
|
|||||||
$CostCenter .="<option value='".$Code."'>".$Code."-".$Name."</option>";
|
$CostCenter .="<option value='".$Code."'>".$Code."-".$Name."</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//echo $HTML;
|
|
||||||
//echo $CostCenter;
|
|
||||||
die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter)));
|
die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,12 +495,10 @@ class purchaseorder extends BaseController
|
|||||||
{
|
{
|
||||||
$PONO = $POMaster[0]['PONO'];
|
$PONO = $POMaster[0]['PONO'];
|
||||||
}
|
}
|
||||||
//echo $PONO;
|
|
||||||
//echo $POType;
|
|
||||||
// PO Line Items
|
// PO Line Items
|
||||||
$LineItemStatus = REQITEM_NEW;
|
$LineItemStatus = REQITEM_NEW;
|
||||||
//echo ' test:'.REVENUE;
|
|
||||||
//echo $RowCount;
|
|
||||||
for ($i = 1; $i <= $RowCount; $i++)
|
for ($i = 1; $i <= $RowCount; $i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user