You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.9 KiB
PHP
75 lines
1.9 KiB
PHP
<?php
|
|
|
|
class StoreTransaction extends CI_Model
|
|
{
|
|
public $recordID;
|
|
public $transID;
|
|
public $brCode;
|
|
public $cash;
|
|
public $checque;
|
|
public $dollar;
|
|
public $ccard;
|
|
public $preparedBy;
|
|
public $remarks;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->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("recordID, transID, brCode, (cash + checque + dollar + ccard) AS TotalSales, preparedBy, remarks");
|
|
$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");
|
|
}
|
|
} |