load->database(); } public function getStoreTransactionByTransID($transID) { return $this->db->get_where("storetransaction", array("transID"=>$transID)); } public function getNextID($transID) { $nextID = 0; $this->db->select("IFNULL(MAX(CAST(replace(recordID, transID, '') AS UNSIGNED)), 0) + 1 as NextID"); $result = $this->db->get_where("storetransaction", array("transID"=>$transID)); foreach($result->result() as $row) $nextID = $row->NextID; return $nextID; } public function getStoreTransactionSummaryByTransDate($transDate) { $this->db->select("storetransaction.recordID, storetransaction.transID, storetransaction.brCode, branch.brDesc, (storetransaction.cash + storetransaction.checque + storetransaction.dollar + storetransaction.ccard) AS TotalSales, storetransaction.preparedBy, storetransaction.remarks"); $this->db->join('branch', 'branch.brCode = storetransaction.brCode'); $this->db->like('transID', $transDate, 'before'); return $this->db->get('storetransaction'); } public function addStoreTransaction() { return $this->db->insert('storetransaction', $this); } public function updateStoreTransaction() { $this->db->where(array("recordID"=>$this->recordID)); return $this->db->update("storetransaction", array( "cash"=>$this->cash, "checque"=>$this->checque, "dollar"=>$this->dollar, "ccard"=>$this->ccard, "preparedBy"=>$this->preparedBy, "remarks"=>$this->remarks) ); } public function deleteStoreTransactionByTransId($transid) { $this->db->where('transID', $transid); return $this->db->delete("storetransaction"); } }