extranet/library/Application/Model/RapportsGiants.php
2014-03-07 08:46:01 +00:00

47 lines
1.3 KiB
PHP

<?php
class Application_Model_RapportsGiants extends Zend_Db_Table_Abstract
{
protected $_name = 'rapports_giants';
public function getReportById($companyId, $Language)
{
$sql = $this->select()
->where('companyId = ?', $companyId)
->where('lang = ?', $Language);
$result = $this->getAdapter()->fetchAll($sql);
return ($result);
}
public function getReportByIdAndType($companyId, $type, $Language)
{
if($type == 'CR') {
$where = 'type="FU" OR type="CO" OR type="CR"';
}else if ($type == 'CO') {
$where = 'type="FU" OR type="CO"';
}
else $where = 'type = "FU"';
$sql = $this->select()
->where('companyId = ?', $companyId)
->where($where)
->where('lang = ?', $Language);
$result = $this->getAdapter()->fetchRow($sql);
/*if($type == 'FU') {
$where = $this->getAdapter()->quoteInto('companyId = ? AND type = "CR" OR type = "CO"' , $companyId);
//var_dump($where);exit;
$this->delete($where);
} else if($type == 'CO') {
$where = $this->getAdapter()->quoteInto('companyId = ? and type = "CR"', $companyId);
$this->delete($where);
}*/
return ($result['report']);
}
public function getReportDate($companyId, $type)
{
$sql = $this->select('date')
->where('companyId = ?', $companyId)
->where('type = ?', $type);
$result = $this->getAdapter()->fetchAll($sql);
return ($result);
}
}
?>