Ejemplo n.º 1
0
function getCustomers() {
	global $LANG;

    $SI_CUSTOMERS = new SimpleInvoices_Db_Table_Customers();
    $result = $SI_CUSTOMERS->fetchAll();
	
	$customers = array();

    foreach($result as $customer) {
		if ($customer['enabled'] == 1) {
			$customer['enabled'] = $LANG['enabled'];
		} else {
			$customer['enabled'] = $LANG['disabled'];
		}

		#invoice total calc - start
		$customer['total'] = calc_customer_total($customer['id']);
		#invoice total calc - end

		#amount paid calc - start
		$customer['paid'] = calc_customer_paid($customer['id']);
		#amount paid calc - end

		#amount owing calc - start
		$customer['owing'] = $customer['total'] - $customer['paid'];

		#amount owing calc - end
		$customers[] = $customer;
	}

	return $customers;
}