I have some Data coming out of my DB Model. What I want to do is get the total amount of the PAYMENTS_total and then times it by VAT (0.20)
I'm assuming I need to creat some sort of FOR loop somewhere, But not too sure where?
My Code for the controller is :
function vat_list()
{
if(isset($_POST['search_date']))
{
$search_date = $this->input->post('search_date', TRUE);
}
else
{
$search_date = date('D j M Y', strtotime('today - 7 days')) . ' to ' . date('D j M Y');
}
$my_result_data = $this->Invoices_model->read_vat($this->viewinguser->BUSINESSES_id, $search_date);
$my_results = $my_result_data->result();
$vat_total = $my_results[0]->PAYMENTS_total;
$vat_total = number_format($my_results[0]->PAYMENTS_total, 2, '.', '') * 0.20;
$this->template->set('title', 'View VAT Reports');
$this->template->set('subtitle', $search_date);
$this->template->set('vat_items', $my_results);
$this->template->set('vat_total', $vat_total);
$this->template->build('accounts/invoices/vat_list');
}
Thanks