✏️ 正在编辑: FolhaPontoFolgas.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/models/DbTable/FolhaPontoFolgas.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_DbTable_FolhaPontoFolgas extends Core_DbTable { protected $_primary = 'id'; protected $_name = 'tb_folha_ponto_folgas'; protected $_referenceMap = [ 'Funcionario' => [ 'columns' => ['funcionario_id'], 'refTableClass' => 'Model_DbTable_Usuario', 'refColumns' => ['id'] ], ]; public function listarFolgas($fields) { $select = $this->getAdapter()->select()->from(['folgas' => 'tb_folha_ponto_folgas']) ->joinLeft(['funcionarios' => 'tb_fornecedores'], 'folgas.funcionario_id = funcionarios.id',['nome']) ->where("folgas.excluido <> 1"); if (!empty($fields['funcionario_id'])) { $select->where("folgas.funcionario_id IN(?)", $fields['funcionario_id']); } if (!empty($fields['data_inicial'])) { $select->where("STR_TO_DATE(?, '%d/%m/%Y') <= data_inicial", $fields['data_inicial']); } if (!empty($fields['data_final'])) { $select->where("STR_TO_DATE(?, '%d/%m/%Y') >= data_final", $fields['data_final']); } if (!empty($fields['descricao'])) { $select->where( "descricao LIKE ?", '%' . $fields['descricao'] . '%'); } return $this->getAdapter()->fetchAll($select); } public function selectDiaFolga($data, $funcionarioId) { $select = $this->getAdapter()->select()->from(['folgas' => 'tb_folha_ponto_folgas']) ->where("funcionario_id = ? OR funcionario_id = 0", $funcionarioId) ->where("STR_TO_DATE(?, '%Y-%m-%d') >= data_inicial", $data) ->where("STR_TO_DATE(?, '%Y-%m-%d') <= data_final", $data) ->where("folgas.excluido <> 1"); return $this->getAdapter()->fetchAll($select); } /** * @param string $mesAno * @param int $funcionario * @return array|null */ public function findFolgas(string $mesAno, int $funcionario): ?array { $select = $this->getAdapter() ->select() ->from(['folga' => 'tb_folha_ponto_folgas']) ->where('(MONTH(data_inicial) = ? AND MONTH(data_final) = ?)', substr($mesAno, 0, 2)) ->where('(YEAR(data_inicial) = ? AND YEAR(data_final) = ?)', substr($mesAno, 3, 4)) ->where('funcionario_id = ?', $funcionario) ->where('folga.excluido <> 1') ->group(['data_inicial', 'data_final']) ; return $this->getAdapter()->fetchAll($select); } }
💾 保存文件
← 返回文件管理器