function getPrograms($id = '') { if (!$id) { $id = $this->zonedata['id']; } $fields = 'z.program_id AS id, p.program AS program'; $table = 'tblZones AS z, tblPrograms AS p'; $param = sprintf("z.parent_id = '%s' AND p.id = z.program_id", $id); return SQL::getAssoc($table, $fields, $param); }
function getQuestionList($question_list = '') { // Used to preview questionaire in the addSurvey form $ql = SQL::getAssoc('tblSurveyItems', 'id,question', sprintf("FIND_IN_SET(id,'%s')", $question_list)); $question_list = explode(',', $question_list); $preView = "<TABLE cellpadding=0 cellspacing=0><TR><TD><OL>"; for ($i = 0; $i < count($question_list); $i++) { $preView .= "<LI class=n02>" . $ql[$question_list[$i]]; } $preView .= "</OL></TD></TR></TABLE>"; return $preView; }
function loadloans() { $this->data['loans'] = SQL::getAssoc('tblLoansMasterDetails AS lmd, tblLoans AS l', 'l.id, l.status', sprintf('lmd.master_id = %s AND l.id = lmd.loan_id', $this->data['id'])); foreach ($this->data['loans'] as $status) { $this->data['cancelled'] = false; if ($status != 'C') { break; } else { $this->data['cancelled'] = true; } } }
function getAll($status = '') { $status_operator = '='; if (!$status) { $status_operator = 'like'; $status = '%%'; } $fields = 'id, program'; $table = 'tblPrograms'; $param = sprintf("status %s '%s'", $status_operator, $status); return SQL::getAssoc($table, $fields, $param); }
function loadPayments($id = '') { if (!$id) { $id = $this->data['id']; } $fields = 'p.*,l.loan_code,concat(left(c.first,1),"."," ",left(c.last,14)) client'; $param = sprintf("rp.receipt_id = '%s' AND p.id = rp.payment_id AND l.id = p.loan_id AND c.id = l.client_id", $id); $table = 'tblLinkReceiptsPayments AS rp, tblPayments AS p, tblLoans l, tblClients c'; $this->data['payments']['normal'] = SQL::getAssoc($table, $fields, $param); $table = 'tblLinkReceiptsPayments AS rp, tblPaymentsRollback AS p, tblLoans l, tblClients c'; $this->data['payments']['rollback'] = SQL::getAssoc($table, $fields, $param); }
function currencys() { return SQL::getAssoc('tblCurrencys', 'id,currency'); }
function getBusiness() { return SQL::getAssoc("tblBusiness AS b, tblClients as c", "b.id, b.name", sprintf("c.id = '%s' AND FIND_IN_SET(c.id,b.client_list)", $this->data['id'])); }
function getName($userID) { return current(SQL::getAssoc('tblUsers', "id, CONCAT(first, ' ', last)", sprintf("id = '%s'", $userID))); }