Nothing to see here'; require_once("footer.php"); exit(); } $row = mysqli_fetch_array($sql); $invoice_id = intval($row['invoice_id']); $invoice_prefix = nullable_htmlentities($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $invoice_scope = nullable_htmlentities($row['invoice_scope']); $invoice_status = nullable_htmlentities($row['invoice_status']); $invoice_date = nullable_htmlentities($row['invoice_date']); $invoice_due = nullable_htmlentities($row['invoice_due']); $invoice_amount = floatval($row['invoice_amount']); $invoice_currency_code = nullable_htmlentities($row['invoice_currency_code']); $invoice_note = nullable_htmlentities($row['invoice_note']); $invoice_url_key = nullable_htmlentities($row['invoice_url_key']); $invoice_created_at = nullable_htmlentities($row['invoice_created_at']); $category_id = intval($row['invoice_category_id']); $client_id = intval($row['client_id']); $client_name = nullable_htmlentities($row['client_name']); $location_address = nullable_htmlentities($row['location_address']); $location_city = nullable_htmlentities($row['location_city']); $location_state = nullable_htmlentities($row['location_state']); $location_zip = nullable_htmlentities($row['location_zip']); $contact_email = nullable_htmlentities($row['contact_email']); $contact_phone = formatPhoneNumber($row['contact_phone']); $contact_extension = nullable_htmlentities($row['contact_extension']); $contact_mobile = formatPhoneNumber($row['contact_mobile']); $client_website = nullable_htmlentities($row['client_website']); $client_currency_code = nullable_htmlentities($row['client_currency_code']); $client_net_terms = intval($row['client_net_terms']); if ($client_net_terms == 0) { $client_net_terms = $config_default_net_terms; } $sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1"); $row = mysqli_fetch_array($sql); $company_id = intval($row['company_id']); $company_name = nullable_htmlentities($row['company_name']); $company_country = nullable_htmlentities($row['company_country']); $company_address = nullable_htmlentities($row['company_address']); $company_city = nullable_htmlentities($row['company_city']); $company_state = nullable_htmlentities($row['company_state']); $company_zip = nullable_htmlentities($row['company_zip']); $company_phone = formatPhoneNumber($row['company_phone']); $company_email = nullable_htmlentities($row['company_email']); $company_website = nullable_htmlentities($row['company_website']); $company_logo = nullable_htmlentities($row['company_logo']); if (!empty($company_logo)) { $company_logo_base64 = base64_encode(file_get_contents("uploads/settings/$company_logo")); } $sql_history = mysqli_query($mysqli, "SELECT * FROM history WHERE history_invoice_id = $invoice_id ORDER BY history_id DESC"); $sql_payments = mysqli_query($mysqli, "SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC"); //Add up all the payments for the invoice and get the total amount paid to the invoice $sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id"); $row = mysqli_fetch_array($sql_amount_paid); $amount_paid = floatval($row['amount_paid']); $balance = $invoice_amount - $amount_paid; //check to see if overdue if ($invoice_status !== "Paid" && $invoice_status !== "Draft" && $invoice_status !== "Cancelled") { $unixtime_invoice_due = strtotime($invoice_due) + 86400; if ($unixtime_invoice_due < time()) { $invoice_overdue = "Overdue"; } } //Set Badge color based off of invoice status $invoice_badge_color = getInvoiceBadgeColor($invoice_status); //Product autocomplete $products_sql = mysqli_query($mysqli, "SELECT product_name AS label, product_description AS description, product_price AS price FROM products WHERE product_archived_at IS NULL"); if (mysqli_num_rows($products_sql) > 0) { while ($row = mysqli_fetch_array($products_sql)) { $products[] = $row; } $json_products = json_encode($products); } ?>
" alt="Company logo">

Invoice

Date
Due
>
Item Description Qty Price Tax Total
Notes
0) { ?> 0) { ?>
Subtotal
Tax
Paid
Balance

History
Date Status Description
Payments
">
Date Amount Reference Account