function getParentCustomer($idUser) { $ret = "<ul>"; $query = mysql_query("\n\t\t\tSELECT u.id, u.name FROM users u WHERE u.id = {$idUser}\n\t\t") or die("function view_tree ERROR DATABASE"); while ($row = mysql_fetch_array($query)) { $ret .= "<li id=" . $row['id'] . ">" . $row['name'] . "</li>"; $ret .= str_replace("<ul></ul>", "", getSubCustomers($idUser, "")); } return $ret . "</ul>"; }
$billers = getActiveBillers(); $customers = getActiveCustomers(); $taxes = getActiveTaxes(); $products = getActiveProducts(); $preferences = getActivePreferences(); $defaults = getSystemDefaults(); if ($billers == null or $customers == null or $taxes == null or $products == null or $preferences == null) { $first_run_wizard = true; $smarty->assign("first_run_wizard", $first_run_wizard); } $defaults['biller'] = isset($_GET['biller']) ? $_GET['biller'] : $defaults['biller']; $defaults['customer'] = isset($_GET['customer']) ? $_GET['customer'] : $defaults['customer']; $defaults['preference'] = isset($_GET['preference']) ? $_GET['preference'] : $defaults['preference']; $defaultTax = getDefaultTax(); $defaultPreference = getDefaultPreference(); $sub_customers = getSubCustomers($defaults['customer']); if (!empty($_GET['line_items'])) { $dynamic_line_items = $_GET['line_items']; } else { $dynamic_line_items = $defaults['line_items']; } for ($i = 1; $i <= 4; $i++) { $show_custom_field[$i] = show_custom_field("invoice_cf{$i}", '', "write", '', "details_screen", '', '', ''); } $smarty->assign("billers", $billers); $smarty->assign("customers", $customers); $smarty->assign("sub_customers", $sub_customers); $smarty->assign("taxes", $taxes); $smarty->assign("products", $products); $smarty->assign("preferences", $preferences); $smarty->assign("dynamic_line_items", $dynamic_line_items);
* Last edited: * 2007-07-19 * * License: * GPL v2 or above * * Website: * http://www.simpleinvoices.org */ //stop the direct browsing to this file - let index.php handle which files get displayed checkLogin(); #get the invoice id $customer_id = $_GET['id']; $customer = getCustomer($customer_id); $customer['wording_for_enabled'] = $customer['enabled'] == 1 ? $LANG['enabled'] : $LANG['disabled']; $sub_customers = getSubCustomers($customer_id); //TODO: Perhaps possible a bit nicer? $stuff = null; $stuff['total'] = calc_customer_total($customer['id']); #amount paid calc - start $stuff['paid'] = calc_customer_paid($customer['id']); #amount paid calc - end #amount owing calc - start $stuff['owing'] = $stuff['total'] - $stuff['paid']; #get custom field labels $customFieldLabel = getCustomFieldLabels(); $invoices = getCustomerInvoices($customer_id); $parent_customers = getActiveCustomers(); $smarty->assign('parent_customers', $parent_customers); //$customFieldLabel = getCustomFieldLabels("biller"); $smarty->assign("stuff", $stuff);