[eluser]jblack199[/eluser]
I have 2 functions inside my controller which are:
Code:
function debt_picture() {
$data['total_monthly'] = '';
$data['total_debt'] = '';
$data['total_rdebt'] = '';
$data['power_down'] = '';
$data['total_months'] = '';
$query = $this->db
->where('p_id', $this->uri->segment(1))
->order_by('id', 'act')
->get('debts');
if ($query->num_rows > 0) {
$data['total_count'] = $query->num_rows();
$data['result'] = $query->result_array();
foreach($data['result'] as $row) {
$data['total_monthly'] += $row['month_payment'];
$data['total_debt'] += $row['principal_debt'];
$data['total_rdebt'] += $row['real_debt'];
$data['total_months'] += $row['months_remain'];
}
$data['total_interest'] = $data['total_rdebt'] - $data['total_debt'];
$query = $this->db
->where('id', $this->uri->segment(1))
->get('plans');
$data['plan'] = $query->result_array();
$html = $this->load->view('templates/debt_report', $data, true);
$data = pdf_create($html, '', false);
force_download('true_debt_report.pdf', $data);
}
}
and (more in next post)