public function listMiscChargesAction() { $visitId = (int) $this->_getParam('visitId'); $rows = array(); if ($visitId > 0) { $visit = new Visit(); $visit->visitId = $visitId; $visit->populate(); $ctr = 1; $iterator = MiscCharge::getIteratorByIds($visit); foreach ($iterator as $result) { $row = array(); $row['id'] = $ctr++; $row['data'] = array(); $row['data'][] = ''; $row['data'][] = $result->note; $amount = number_format((double) $result->amount, 2, '.', ','); $row['data'][] = $amount; $row['data'][] = $amount; $rows[] = $row; } } $data = array(); $data['rows'] = $rows; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }