/** * Show archive page * * @param void * @return null */ function index() { $this->smarty->assign('invoiced_companies', Invoices::findInvoicedCompaniesInfo(array(INVOICE_STATUS_BILLED, INVOICE_STATUS_CANCELED))); }
/** * Show invoicing archive * * @param void * @return null */ function archive() { $companies = Invoices::findInvoicedCompaniesInfo(array(INVOICE_STATUS_BILLED, INVOICE_STATUS_CANCELED)); if (is_foreachable($companies)) { $company_ids = array(); foreach ($companies as $company) { $company_ids[] = $company['id']; } // foreach $sums = Invoices::sumsByCompanies($company_ids, array(INVOICE_STATUS_BILLED)); $company_count = count($companies); for ($x = 0; $x < $company_count; $x++) { $companies[$x]['sums'] = array_var($sums, $companies[$x]['id'], 0); } // if } // if $this->smarty->assign('invoiced_companies', $companies); }