session = session(); // $this->supplier_model = new Supplier_model(); helper('form'); //$this->load->library('form_validation'); $this->isLoggedIn(); } /** * This function used to load the first screen of the user */ public function index() { $this->global['pageTitle'] = 'Store Status'; $this->loadViews("storestatus", $this->global, NULL, NULL); } /** * This function is used to load the Supplier list */ function storeavailability() { //$data['userRecords'] = $this->supplier_model->supplierlisting(); $this->global['pageTitle'] = 'Store Status'; //viewStock $data['Stock'] = $this->store_model->viewStock(); // print_r($data['Stock']); $data['MaterialList'] = $this->store_model->GetAllMaterialList(); $data['StockStatus'] = $this->store_model->GetConfigValue('C021'); $this->loadViews("storestatus", $this->global, $data, null); } /** * This function is used to load the Supplier list */ function AddStock() { $MaterialCode = $this->request->getPost('MaterialCode'); $AvailableQty = $this->request->getPost('AddAvailableStock'); $AvailbilityStatus = $this->request->getPost('StockAvail'); $Remarks = $this->request->getPost('Remarks'); $CreatedBy = $this->session->get('EmpID'); $createddt = get_current_date_time(); $Status = 1; if (trim($AvailbilityStatus) == 'YES') { $Status = 0; } //this array to store the value in master table.. $Stockdetails = array('MaterialCode' => $MaterialCode, 'Quantity' => $AvailableQty, 'Status' => $Status, 'Remarks' => $Remarks, 'CreatedBy' => $CreatedBy, 'Createdon' => $createddt); $data['Stock'] = $this->store_model->addStock($Stockdetails); echo 'Stock Added successfully'; } function UpdateStock() { $MaterialCode = $this->request->getPost('EditMaterialCode'); $AvailableQty = $this->request->getPost('EditAvailableStock'); $AvailbilityStatus = $this->request->getPost('EditStockAvail'); $Remarks = $this->request->getPost('EditRemarks'); $CreatedBy = $this->session->get('EmpID'); $createddt = get_current_date_time(); $Status = 1; if (trim($AvailbilityStatus) == 'YES') { $Status = 0; } //this array to store the value in master table.. $Stockdetails = array('Quantity' => $AvailableQty, 'Status' => $Status, 'Remarks' => $Remarks, 'UpdatedBy' => $CreatedBy, 'updatedOn' => $createddt); $data['Stock'] = $this->store_model->UpdateStock($Stockdetails, $MaterialCode); echo 'Stock updated successfully'; } function viewStockHistory() { $MaterialCode = $this->request->getPost('id'); $result = $this->store_model->GetStockHisory($MaterialCode); $TotalStock = 0; $HTML = ""; for ($i = 0; $i < count($result); $i++) { $SNo = $i + 1; $AvailableQty = $result[$i]['Quantity']; $UpdatedStock = $result[$i]['ActualQuantity']; $Remarks = $result[$i]['Remarks']; $Updatedon = new DateTime($result[$i]['updatedOn']); $HTML .= "