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.
|
|
|
<?php
|
|
|
|
|
|
|
|
class ItemLedger extends CI_Model
|
|
|
|
{
|
|
|
|
public $itemcode;
|
|
|
|
public $brCode;
|
|
|
|
public $beginningqty;
|
|
|
|
public $inqty;
|
|
|
|
public $outqty;
|
|
|
|
public $sales;
|
|
|
|
public $adjustment;
|
|
|
|
public $endingqty;
|
|
|
|
public $editDate;
|
|
|
|
public $creationDate;
|
|
|
|
public $remarks;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->load->database();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBranchesByItemcode($itemcode)
|
|
|
|
{
|
|
|
|
return $this->db->get_where("itemledger", array("itemcode"=>$itemcode));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getItemLedgerOfKWHByItemcode($itemcode)
|
|
|
|
{
|
|
|
|
$result = $this->db->get_where("itemledger", array("itemcode"=>$itemcode, "brCode"=>"KWH"));
|
|
|
|
|
|
|
|
if($result->num_rows() > 0)
|
|
|
|
return $result->row();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$itemledger = new ItemLedger();
|
|
|
|
|
|
|
|
$itemledger->itemcode = $itemcode;
|
|
|
|
$itemledger->brCode = "KWH";
|
|
|
|
$itemledger->beginningqty = 0;
|
|
|
|
$itemledger->inqty = 0;
|
|
|
|
$itemledger->outqty = 0;
|
|
|
|
$itemledger->sales = 0;
|
|
|
|
$itemledger->adjustment = 0;
|
|
|
|
$itemledger->endingqty = 0;
|
|
|
|
$itemledger->editDate = date('Y-m-d');
|
|
|
|
$itemledger->creationDate = date('Y-m-d');
|
|
|
|
$itemledger->remarks = "";
|
|
|
|
|
|
|
|
return $itemledger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|