/** * */ public function editStatementAction() { $this->_helper->layout()->disableLayout(); $id = $this->_getParam('id'); $formStatement = new Fefop_Form_BankStatement(); $formStatement->setAction($this->_helper->url('save')); $transaction = $this->_mapper->detail($id); $data = $transaction->toArray(); $data['date_statement'] = $this->view->date($data['date_statement']); $formStatement->populate($data); //$formStatement->getElement( 'fk_id_fefop_type_transaction' )->setAttrib( 'readonly', true ); $dbTypeTransaction = App_Model_DbTable_Factory::get('FEFOPTypeTransaction'); $rows = $dbTypeTransaction->fetchAll(array('type = ?' => 'F')); $contractTransactions = array(); foreach ($rows as $row) { $contractTransactions[] = $row->id_fefop_type_transaction; } // If the statement is related with contracts if (in_array($data['fk_id_fefop_type_transaction'], $contractTransactions)) { // Contracts $contracts = $this->_mapper->groupContracts($id); $this->view->contracts = $contracts; $canEdit = true; foreach ($contracts as $contract) { if (!$contract['can-delete']) { $canEdit = false; break; } } if (!$canEdit) { $formStatement->getElement('fk_id_fefop_type_transaction')->setAttrib('readonly', true); $formStatement->getElement('operation')->setAttrib('readonly', true); } $formStatement->getElement('amount')->setAttrib('readonly', true); } $this->view->form = $formStatement; $this->_helper->viewRenderer->setRender('new-statement'); }
/** * * @return array */ public function bankTransactionReport() { $mapperBankStatement = new Fefop_Model_Mapper_BankStatement(); $select = $mapperBankStatement->getSelect(); $dbBankStatement = App_Model_DbTable_Factory::get('FEFOPBankStatements'); if (!empty($this->_data['fk_id_fefop_type_transaction'])) { $select->where('bs.fk_id_fefop_type_transaction IN(?)', $this->_data['fk_id_fefop_type_transaction']); } if (!empty($this->_data['fk_id_fefopfund'])) { $select->where('bs.fk_id_fefopfund IN(?)', $this->_data['fk_id_fefopfund']); } if (!empty($this->_data['status'])) { $select->where('bs.status IN(?)', $this->_data['status']); } if (!empty($this->_data['bank_payment'])) { if ('C' == $this->_data['bank_payment']) { $select->where('bsc.id_fefop_bank_contract IS NOT NULL'); } else { $select->where('bs.fk_id_fefopfund IS NOT NULL'); } } //PerĂodo $select->where("bs.date_statement >= STR_TO_DATE(?, '%d/%m/%Y')", $this->_data['date_start']); $select->where("bs.date_statement <= STR_TO_DATE(?, '%d/%m/%Y')", $this->_data['date_finish']); return array('rows' => $dbBankStatement->fetchAll($select)); }
/** * * @param array $bank_statements * @return Zend_Db_Table_Rowset */ public function listBankStatementsIn($bank_statements) { $mapperBankStatements = new Fefop_Model_Mapper_BankStatement(); $select = $mapperBankStatements->getSelect(); $select->where('bsc.id_fefop_bank_contract IN (?)', $bank_statements)->reset(Zend_Db_Select::GROUP); return $this->_dbTable->fetchAll($select); }