require_once BASE_PATH . '/assets/includes/affiliate.inc.php';
require_once BASE_PATH . '/assets/includes/header.inc.php';
require_once BASE_PATH . '/assets/includes/errors.php';
require_once BASE_PATH . '/assets/classes/invoicetools.php';
require_once BASE_PATH . '/assets/includes/errors.php';
if (!$billID) {
    // Make sure this exists before going on
    die('No billID was passed. Cannot proceed.');
}
$gatewayMode = "publicForm";
/*
 * Get currency info from db
 */
$currency = getCurrencyInfo($config['settings']['defaultcur']);
$invoice = new invoiceTools();
$billInfo = $invoice->getBillDetails($billID);
// Get the bill info using the passed bill ID
$invoiceInfo = $invoice->getInvoiceDetailsViaBillDBID($billInfo['bill_id']);
// Get invoice details
// xxxxxx Check if this is a membership and if so then check to see if tax needs to be added
$parms['noDefault'] = true;
// Do not allow defaults just in case
$cartInfo['orderNumber'] = $invoiceInfo['invoice_number'];
$uniqueOrderID = "bill-{$billID}";
$cartTotals['subtotalMinusDiscounts'] = $invoiceInfo['total'] * 1;
// Round it
$cartTotals['taxTotal'] = 0;
$cartTotals['shippingTotal'] = 0;
$cartTotals['cartGrandTotal'] = $invoiceInfo['total'] * 1;
// Round it
$cartTotals['billGrandTotalLocal'] = getCorrectedPrice($cartTotals['cartGrandTotal'], $parms);
Example #2
0
 $billTotal = new number_formatting();
 // Used to make sure the bills are showing in the admins currency
 $billTotal->set_custom_cur_defaults($config['settings']['defaultcur']);
 $parms['noDefault'] = true;
 if (!$billID and !$orderID) {
     die('No bill/order ID was passed');
 }
 // Just to be safe make sure a bill/order ID was passed
 $invoiceObj = new invoiceTools();
 // Create new invoice object
 $invoiceObj->options = false;
 // Do not select options here
 $adminCurrency = getCurrencyInfo($config['settings']['defaultcur']);
 if ($billID) {
     $invoiceObj->setUBillID($billID);
     if ($billInfo = $invoiceObj->getBillDetails()) {
         $invoice = $invoiceObj->getInvoiceDetailsViaBillDBID($billInfo['bill_id']);
         if ($billInfo['bill_type'] == 2) {
             $ordersResult = mysqli_query($db, "\r\n\t\t\t\t\t\tSELECT * FROM {$dbinfo[pre]}orders \r\n\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}invoices \r\n\t\t\t\t\t\tON {$dbinfo[pre]}orders.order_id = {$dbinfo[pre]}invoices.order_id\r\n\t\t\t\t\t\tWHERE {$dbinfo[pre]}orders.bill_id = {$billInfo[bill_id]}\r\n\t\t\t\t\t\t");
             // Select invoice items
             $invoiceItemsCount = mysqli_num_rows($ordersResult);
             while ($order = mysqli_fetch_array($ordersResult)) {
                 $invoiceItems[$order['order_id']] = $order;
                 $invoiceItems[$order['order_id']]['name'] = "{$lang[order]} {$order[order_number]}";
                 $invoiceItems[$order['order_id']]['quantity'] = 1;
                 if ($invoice['payment_status'] != 2) {
                     $invoiceItems[$order['order_id']]['price_total'] = $billTotal->currency_display($order['total'], 1);
                 } else {
                     $priceTotal = getCorrectedPrice($order['total'], $parms);
                     // Unpaid invoice can show in the members currency
                     $invoiceItems[$order['order_id']]['price_total'] = $priceTotal['display'];