load->model('MStocks'); $this->load->helper('form'); // checkLogin(); } public function _remap($alias = "", $params = array()) { // echo "
"; var_dump($alias = "", $params = array()); die(); // echo ""; var_dump($alias,$this->input->post('fromDate'),$this->input->post('stocklocations_id'),$this->input->post('toDate')); die(); // var_dump(($_POST['stocklocations_id']));die(); $data['dataValue'] = $this->session; $data['pageTitle'] = "Inventory Stock"; switch ($alias) { case 'add': if (isset($_POST['submit'])) { $TableData = array( 'stocklocations_id' => filter_var($_POST['stocklocations_id']), 'title' => filter_var($_POST['title']), 'items_id' => filter_var($_POST['items_id']), 'qty' => filter_var($_POST['qty']), 'price' => filter_var($_POST['price']), 'display_order' => filter_var($_POST['display_order']), 'status' => 1, 'remarks' => filter_var($_POST['remarks']), 'created_on' => date('Y-m-d H:i:s'), 'created_by' => 'admin', ); $this->db->insert('tbl_stocks', $TableData); redirect("inventory/stocks/list"); } loadView("inventory/stocks/add", $data); break; case 'edit': if (isset($_POST['submit'])) { $id = $this->uri->segment(4); $TableData = array( 'stocklocations_id' => filter_var($_POST['stocklocations_id']), 'title' => filter_var($_POST['title']), 'items_id' => filter_var($_POST['items_id']), 'qty' => filter_var($_POST['qty']), 'price' => filter_var($_POST['price']), 'display_order' => filter_var($_POST['display_order']), 'status' => 1, 'remarks' => filter_var($_POST['remarks']), 'created_on' => date('Y-m-d H:i:s'), 'created_by' => 'admin', ); $this->db->where('stock_id', $id); $this->db->update('tbl_stocks', $TableData); redirect("inventory/stocks/list"); } $id = $this->uri->segment(4); $this->db->where('stock_id', $id); $data['stock'] = $this->db->get("tbl_stocks")->row(); loadView("inventory/stocks/add", $data); break; case 'summary': if (!isset($_POST['stocklocations_id'])) { $data['stocklocations_id'] = null; } if (!isset($_POST['fromDate'])) { $data['fromDate'] = null; } if (!isset($_POST['toDate'])) { $data['toDate'] = null; } if (isset($_POST)) { $data = $_POST; } $data['pageTitle'] = "Inventory Stock"; $data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from); $data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to); $data['StockRecords'] = $this->MStocks->getStockSummary($data); loadView("inventory/stocks/summary", $data); break; case 'delete': $id = $this->uri->segment(4); $this->db->where('stock_id', $id); $this->db->delete('tbl_stocks'); redirect("inventory/stocks/list"); break; default: // var_dump("hello"); // die(); // echo ''; // var_dump($_POST['fromDate'], $_POST['toDate']); // die(); $data['StockRecords'] = $this->MStocks->getStockRecords(); loadView("inventory/stocks/list", $data); } } // public function summary() // { // var_dump("hello"); // die(); // echo ''; // var_dump($_POST['stocklocations_id'], $_POST['fromDate'], $_POST['toDate']); // die(); // $data['StockRecords'] = $this->MStocks->getStockSummary($_POST['stocklocations_id'] = 0, $_POST['fromDate'], $_POST['toDate']); // // echo "", var_dump($data['StockRecords']); die(); // loadView("inventory/stocks/summary", $data); // } }