i done emergency service po
This commit is contained in:
parent
5b84f0fa2c
commit
e9e22b46d6
@ -65,6 +65,7 @@ define('REQITEM_DELIVERED', 'ST011');
|
|||||||
define('REQ_DELETED', 'ST013');
|
define('REQ_DELETED', 'ST013');
|
||||||
define('REQITEM_POCREATED', 'ST022');
|
define('REQITEM_POCREATED', 'ST022');
|
||||||
define('REQITEM_PARTIALLY_PO_CREATED', 'ST023');
|
define('REQITEM_PARTIALLY_PO_CREATED', 'ST023');
|
||||||
|
define('REQITEM_Emergency_PO_CREATED', 'ST024');
|
||||||
|
|
||||||
|
|
||||||
define('REQUISTSTATUS', '0');
|
define('REQUISTSTATUS', '0');
|
||||||
|
|||||||
@ -25,29 +25,234 @@ class emergencypurchaseorder extends BaseController
|
|||||||
$this->isLoggedIn();
|
$this->isLoggedIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function used to load the first screen of the user
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->global['pageTitle'] = 'Siddharth : AddPO';
|
||||||
|
|
||||||
|
$this->loadViews("addPO", $this->global, NULL , NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
function requisition()
|
||||||
|
{
|
||||||
|
$data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq();
|
||||||
|
|
||||||
|
$data['stList'] = $this->purchaseorder_model->getStatusListforAllReq();
|
||||||
|
|
||||||
|
$data['ReqList'] = $this->purchaseorder_model->getRequistionListbySearch();
|
||||||
|
$this->global['pageTitle'] = 'Siddharth : Create PO from Requisition List';
|
||||||
|
|
||||||
|
$this->loadViews("createPOfromRequistion", $this->global, $data,Null);
|
||||||
|
}
|
||||||
|
|
||||||
function CreateEmergencyPO()
|
function CreateEmergencyPO()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Create Emergency Purchase Order';
|
$this->global['pageTitle'] = 'Siddharth : Create Emergency Purchase Order';
|
||||||
|
|
||||||
$data['RequestType'] = $this->requistion_model->getConfigValue('C004');
|
$data['RequestType'] = $this->requistion_model->getConfigValue('C004');
|
||||||
|
|
||||||
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
$data['Suplist'] = $this->purchaseorder_model->getSupplierName();
|
||||||
|
|
||||||
$data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq();
|
$data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq();
|
||||||
|
|
||||||
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();
|
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();
|
||||||
|
|
||||||
$data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate();
|
$data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate();
|
||||||
|
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
|
||||||
|
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
|
||||||
|
|
||||||
$this->loadViews("alterpurchaseorder", $this->global, $data, Null);
|
$this->loadViews("alterpurchaseorder", $this->global, $data, Null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* this function used for get all material code using request type
|
||||||
|
*/
|
||||||
|
function getMaterialCode(){
|
||||||
|
$reqType = $this->input->post('input');
|
||||||
|
$materialList = $this->requistion_model->GetMaterialCode($reqType);
|
||||||
|
echo json_encode($materialList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*This function is used for get cost center list using department code*/
|
||||||
|
function getCostCenterName(){
|
||||||
|
$CostList='';
|
||||||
|
$DeptCode = $this->input->post('id');
|
||||||
|
$CostList = $this->requistion_model->GetCostCenterByDept($DeptCode);
|
||||||
|
// print_r($CostList);
|
||||||
|
echo json_encode($CostList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//This used 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');
|
||||||
|
$CostCenterName = $this->input->post('CostCenterName');
|
||||||
|
$Deliverydt = $this->getDateformat($dt);
|
||||||
|
$POType = $this->input->post('POType');
|
||||||
|
|
||||||
|
$SpcialInstruction = $this->input->post('TextSpcialInstruction');
|
||||||
|
$TotalOrderValueSummary = $this->input->post('TextTotalOrderValueSummaryService');
|
||||||
|
|
||||||
|
$POStatus = $this->input->post('TextStatus');
|
||||||
|
$CreateBy = $this->session->userdata ('userId');
|
||||||
|
$RequestedBy = $this->session->userdata ('EmpID');
|
||||||
|
$ReqStatus = REQITEM_Emergency_PO_CREATED;
|
||||||
|
|
||||||
|
$RowCount = $this->input->post('TextRowCount');
|
||||||
|
|
||||||
|
$DeletedRow = $this->input->post('TextDeletedRowCount');
|
||||||
|
|
||||||
|
$comma_separated = explode(':', $DeletedRow);
|
||||||
|
|
||||||
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
|
||||||
|
$createddt = $dt->format('Y-m-d H:i:s');
|
||||||
|
//create T_Requestion_Master
|
||||||
|
$Request = array('ReqType'=>$POType, 'Requestedby'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$SpcialInstruction,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy);
|
||||||
|
|
||||||
|
$Req = $this->requistion_model->addRequistion($Request);
|
||||||
|
|
||||||
|
$RegNo='';
|
||||||
|
if(count($Req)>0)
|
||||||
|
{
|
||||||
|
$RegNo = $Req[0]['ReqNo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// PO Master
|
||||||
|
$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'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$RegDetailsStatus=REQITEM_POCREATED;
|
||||||
|
|
||||||
|
// PO Line Items
|
||||||
|
$LineItemStatus = REQITEM_POCREATED;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
$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")
|
||||||
|
{
|
||||||
|
|
||||||
|
//add requistion details
|
||||||
|
$ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt);
|
||||||
|
|
||||||
|
|
||||||
|
$ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter);
|
||||||
|
$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, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt);
|
||||||
|
|
||||||
|
$ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($POStatus == REQ_DRAFT)
|
||||||
|
{
|
||||||
|
echo 'Emergency Service Purchase Order Saved Successfully!The PO NO Is: '.$PONO;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo 'Emergency Service Purchase Order Created Successfully!The PO NO Is: '.$PONO;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 );
|
||||||
|
|
||||||
|
//$this->purchaseorder_model->UpdateRequistItemStatus();
|
||||||
|
$this->purchaseorder_model->UpdateRequistionStatus();
|
||||||
|
$data['POData'] = $this->purchaseorder_model->purchaseorderListing();
|
||||||
|
|
||||||
|
$this->global['pageTitle'] = 'Siddharth : Purchase Orders';
|
||||||
|
|
||||||
|
$this->loadViews("POlist", $this->global, $data, NULL);
|
||||||
|
|
||||||
|
}
|
||||||
|
function Req_validate($selectValue)
|
||||||
|
{
|
||||||
|
//echo 'select_validate method called';
|
||||||
|
// 'none' is the first option and the text says something like "-Choose one-"
|
||||||
|
if(strlen($selectValue) == 0)
|
||||||
|
{
|
||||||
|
$this->form_validation->set_message('Req_validate', 'Please Select Requisition Number to Create PO.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else // user picked something
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function used to show the Purchase Order Screen
|
* This function used to show the Purchase Order Screen
|
||||||
@ -74,7 +279,6 @@ class emergencypurchaseorder extends BaseController
|
|||||||
$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();
|
||||||
$SelectedReq = json_decode($this->input->post('txtReqNo'));
|
$SelectedReq = json_decode($this->input->post('txtReqNo'));
|
||||||
|
|
||||||
$Req = $SelectedReq->Req;
|
$Req = $SelectedReq->Req;
|
||||||
$data['ReqList'] = $Req ;
|
$data['ReqList'] = $Req ;
|
||||||
$ReqArray = array();
|
$ReqArray = array();
|
||||||
|
|||||||
@ -78,7 +78,8 @@ class Login extends CI_Controller
|
|||||||
'DEPCode'=>$res->DEPCode,
|
'DEPCode'=>$res->DEPCode,
|
||||||
'HeadDept'=>$res->HeadDept,
|
'HeadDept'=>$res->HeadDept,
|
||||||
'DepartmentName'=>$res->DepartmentName,
|
'DepartmentName'=>$res->DepartmentName,
|
||||||
'isLoggedIn' => TRUE
|
'isLoggedIn' => TRUE,
|
||||||
|
'EmpID' => $res->EmpID
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->session->set_userdata($sessionArray);
|
$this->session->set_userdata($sessionArray);
|
||||||
@ -253,3 +254,4 @@ class Login extends CI_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ class BaseController extends CI_Controller {
|
|||||||
protected $HeadDept = '';
|
protected $HeadDept = '';
|
||||||
protected $DepartmentName = '';
|
protected $DepartmentName = '';
|
||||||
protected $roleText = '';
|
protected $roleText = '';
|
||||||
|
protected $EmpID = '';
|
||||||
protected $global = array ();
|
protected $global = array ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,10 +49,13 @@ class BaseController extends CI_Controller {
|
|||||||
$this->DEPCode = $this->session->userdata ( 'DEPCode' );
|
$this->DEPCode = $this->session->userdata ( 'DEPCode' );
|
||||||
$this->HeadDept = $this->session->userdata ( 'HeadDept' );
|
$this->HeadDept = $this->session->userdata ( 'HeadDept' );
|
||||||
$this->DepartmentName = $this->session->userdata ( 'DepartmentName' );
|
$this->DepartmentName = $this->session->userdata ( 'DepartmentName' );
|
||||||
|
$this->EmpID = $this->session->userdata ( 'EmpID' );
|
||||||
|
|
||||||
$this->global ['name'] = $this->name;
|
$this->global ['name'] = $this->name;
|
||||||
$this->global ['role'] = $this->role;
|
$this->global ['role'] = $this->role;
|
||||||
$this->global ['role_text'] = $this->roleText;
|
$this->global ['role_text'] = $this->roleText;
|
||||||
$this->global ['DEPCode'] = $this->DEPCode;
|
$this->global ['DEPCode'] = $this->DEPCode;
|
||||||
|
$this->global ['EmpID'] = $this->EmpID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class Login_model extends CI_Model
|
|||||||
*/
|
*/
|
||||||
function loginMe($email, $password)
|
function loginMe($email, $password)
|
||||||
{
|
{
|
||||||
$this->db->select('BaseTbl.userId, BaseTbl.password, Emp.FirstName,Emp.Designation, BaseTbl.roleId, Roles.role,DEPT.DEPCode,DEPT.DepartmentName,DEPT.HeadDept');
|
$this->db->select('BaseTbl.userId, BaseTbl.password, Emp.EmpID,Emp.FirstName,Emp.Designation, BaseTbl.roleId, Roles.role,DEPT.DEPCode,DEPT.DepartmentName,DEPT.HeadDept');
|
||||||
$this->db->from('tbl_users as BaseTbl');
|
$this->db->from('tbl_users as BaseTbl');
|
||||||
$this->db->join('tbl_roles as Roles','Roles.roleId = BaseTbl.roleId');
|
$this->db->join('tbl_roles as Roles','Roles.roleId = BaseTbl.roleId');
|
||||||
$this->db->join('T_Employee_Details as Emp','BaseTbl.EmpID = Emp.EmpID');
|
$this->db->join('T_Employee_Details as Emp','BaseTbl.EmpID = Emp.EmpID');
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user