✏️ 正在编辑: Funcionario.php
路径:
/srv/systems_dir/yuppiecred-lidernegocios/application/models/DbTable/Funcionario.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_DbTable_Funcionario extends Core_DbTable { protected $_primary = 'id'; protected $_name = 'tb_fornecedores'; protected static $_viewName = 'vw_fornecedores'; protected $_referenceMap = [ 'Empresa' => [ 'columns' => ['empresa_id'], 'refTableClass' => 'Model_DbTable_Empresa', 'refColumns' => ['id'] ], 'Cargo' => [ 'columns' => ['cargo_id'], 'refTableClass' => 'Model_DbTable_Cargo', 'refColumns' => ['id'] ], 'Setor' => [ 'columns' => ['setor_id'], 'refTableClass' => 'Model_DbTable_Setor', 'refColumns' => ['id'] ], ]; protected $_dependentsTable = [ 'Model_DbTable_Lancamento' ]; public static function getViewName() { return self::$_viewName; } public function fetchAll($where = null, $order = null, $count = null, $offset = null) { if( ($where instanceof Zend_Db_Table_Select ) ){ $strWhere = "{$this->_name}.excluido<>1 AND {$this->_name}.tipo = 'FUNCIONARIO'"; foreach ( $where->getPart(Zend_Db_Table_Select::WHERE) as $w ) { $strWhere .= ' AND ' . $w; } $where->where($strWhere); } elseif( is_array($where) ){ $where[] = "{$this->_name}.excluido<>1 AND {$this->_name}.tipo = 'FUNCIONARIO'"; } elseif( $where != null ){ $where .= " AND {$this->_name}.excluido<>1 AND {$this->_name}.tipo = 'FUNCIONARIO'"; } else { $where = "{$this->_name}.excluido<>1 AND {$this->_name}.tipo = 'FUNCIONARIO'"; } return parent::fetchAll($where, $order, $count, $offset); } public function getAniversariantesDoDia($count = null, $offset = null) { $data = Zend_Date::now(); $where = "excluido<>1 AND DATE_FORMAT(data_nascimento, '%d%m') = '" . $data->get('ddMM') . "'"; // se hoje for sexta-feira, pega aniversariantes do fim de semana também if ($data->get(Zend_Date::WEEKDAY_DIGIT) == 5) { $data->addDay(1); // sábado $where .= " OR DATE_FORMAT(data_nascimento, '%d%m') = '" . $data->get('ddMM') . "'"; $data->addDay(1); // domingo $where .= " OR DATE_FORMAT(data_nascimento, '%d%m') = '" . $data->get('ddMM') . "'"; } $where = "({$where})"; $order = 'nome'; return parent::fetchAll($where, $order, $count, $offset); } }
💾 保存文件
← 返回文件管理器