public function GestionDetialsByClinetId(Gyuser_Model_Cobranzas $obj) { $table = $this->getDbTable(); $select = $table->select(); $select->setIntegrityCheck(false); $client_id = $obj->getId(); $select->from(array('cob' => 'cobranzas'), array('id', 'operation_id', 'cheque_id', 'date_paid', 'paid_amount', 'previous_balance', 'current_balance', 'payment_type')); $select->joinLeft(array('cqu' => 'cheques'), 'cob.cheque_id = cqu.id', array('check_n', 'amount', 'rejected_cost')); $select->where('cob.client_id = ?', $client_id); $select->order('cob.id ASC'); $resultSet = $table->fetchAll($select); $entries = array(); foreach ($resultSet as $row) { $entry = array('id' => $row->id, 'operation_id' => $row->operation_id, 'cheque_id' => $row->cheque_id, 'date_paid' => date("d/m/Y", strtotime($row->date_paid)), 'paid_amount' => $row->paid_amount, 'previous_balance' => $row->previous_balance, 'current_balance' => $row->current_balance, 'payment_type' => $row->payment_type, 'check_n' => $row->check_n, 'amount' => $row->amount, 'rejected_cost' => $row->rejected_cost); $entries[] = $entry; } return $entries; }
public function getgestiondetailsajaxAction() { try { $request = $this->getRequest(); if ($this->getRequest()->isPost()) { $clientid = $request->client_id; $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $cObj = new Gyuser_Model_Cheques(); $cObj->setId($clientid); $cMapper = new Gyuser_Model_ChequesDataMapper(); $cList = $cMapper->GestionDetialsByClinetId($cObj); $cbObj = new Gyuser_Model_Cobranzas(); $cbObj->setId($clientid); $coMapper = new Gyuser_Model_CobranzasDataMapper(); $cbList = $coMapper->GestionDetialsByClinetId($cbObj); if ($cList || $cbList) { $result = array('grcList' => $cList, 'gccList' => $cbList); echo json_encode($result); } else { echo "f"; } } } catch (Exception $e) { echo $e; } }