extranet/application/models/RapportsGiants.php
2011-09-06 12:40:31 +00:00

43 lines
1.3 KiB
PHP

<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class Application_Model_RapportsGiants extends Zend_Db_Table_Abstract
{
protected $_name = 'rapports_giants';
public function getReportById($companyId)
{
$sql = $this->select('report')
->where('companyId = ?', $companyId);
$result = $this->getAdapter()->fetchAll($sql);
return ($result);
}
public function getReportByIdAndType($companyId, $type)
{
if($type == 'CR') {
$where = 'type = ? or type="FU" or type="CO"';
} else $where = 'type = ? or type ="FU"';
$sql = $this->select()
->where('companyId = ?', $companyId)
->where($where, $type);
$result = $this->getAdapter()->fetchRow($sql);
if($type == 'FU') {
$where = $this->getAdapter()->quoteInto('CompanyId = ? and type = "CR" or type="CO"', $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);
}
}
?>