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.

58 lines
1.3 KiB
PHTML

2 years ago
<?php
class StockOut extends CI_Model
{
public $recordID;
public $transID;
public $vo;
public $catCode;
public $modelno;
public $qty;
public $transDate;
public $validated;
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function getStockOutByTransID($transID)
{
return $this->db->get_where("stockout", array("transID"=>$transID));
}
public function getStockOutByRecordID($recordID)
{
$result = $this->db->get_where("stockout", array("recordID"=>$recordID));
return $result->row();
}
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("stockout", array("transid"=>$transID));
foreach($result->result() as $row)
$nextID = $row->NextID;
return $nextID;
}
public function addStock()
{
$dateFormatedtransDate = DateTime::createFromFormat('m/d/Y', $this->transDate);
$this->transDate = $dateFormatedtransDate->format('Y-m-d');
return $this->db->insert('stockout', $this);
}
public function deleteStockOut($recordID)
{
return $this->db->delete("stockout", array("recordID"=>$recordID));
}
}