Example #1
0
    }
}
$vat = 20;
// NEEDS TO BE SET TO AN ADMIN OPTION
if ($auction) {
    // get auction data
    $query = "SELECT w.id, w.winner, w.closingdate As date, a.id AS auc_id, a.title, a.shipping_cost, a.shipping_cost_additional, a.shipping, a.shipping_terms, w.bid, w.qty, a.user As seller_id, a.tax, a.taxinc\n\t\t\tFROM " . $DBPrefix . "auctions a\n\t\t\tLEFT JOIN " . $DBPrefix . "winners w ON (a.id = w.auction)\n\t\t\tWHERE a.id = " . intval($_POST['pfval']) . " AND w.id = " . intval($_POST['pfwon']);
} else {
    // get fee data
    $query = "SELECT * FROM " . $DBPrefix . "useraccounts WHERE useracc_id = " . intval($_GET['id']);
}
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
// check its real
if (mysql_num_rows($res) < 1) {
    invaildinvoice();
}
$data = mysql_fetch_assoc($res);
if ($auction) {
    // sort out auction data
    $seller = getSeller($data['seller_id']);
    $winner = getAddressWinner($data['winner']);
    $vat = getTax(true, $winner['country'], $seller['country']);
    $title = $system->SETTINGS['sitename'] . ' - ' . $data['title'];
    $additional_shipping = $data['shipping_cost_additional'] * ($data['qty'] - 1);
    $shipping_cost = $shipping == 1 ? $data['shipping_cost'] + $additional_shipping : 0;
    $payvalue = $data['bid'] * $data['qty'] + $shipping_cost;
    $payvalueperitem = $data['bid'];
    $paysubtotal = $data['bid'] * $data['qty'];
    $shipping_cost = $data['shipping'] == 1 ? $data['shipping_cost'] : 0;
    // build winners address
Example #2
0
 *   (at your option) any later version. Although none of the code may be
 *   sold. If you have been sold this script, get a refund.
 ***************************************************************************/
include 'common.php';
include $include_path . 'functions_invoices.php';
// If user is not logged in redirect to login page
if (!$user->is_logged_in()) {
    header('location: user_login.php');
    exit;
}
$sender = getSeller($user->user_data['id']);
$query = "SELECT w.id, w.winner, w.closingdate, a.id AS auc_id, a.title, w.qty,\tw.seller As uid \n\t\tFROM " . $DBPrefix . "auctions a\n\t\tLEFT JOIN " . $DBPrefix . "winners w ON (a.id = w.auction)\n\t\tWHERE a.id = " . intval($_POST['pfval']) . " AND w.id =" . intval($_POST['pfwon']);
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
// check its real
if (mysql_num_rows($res) < 1) {
    invaildinvoice(true);
}
$data = mysql_fetch_assoc($res);
$winner = getAddresswinner($data['winner']);
// build winners address
$winner_address = '';
$winner_address .= !empty($winner['address']) ? '<br>' . $winner['address'] : '';
$winner_address .= !empty($winner['city']) ? '<br>' . $winner['city'] : '';
$winner_address .= !empty($winner['prov']) ? '<br>' . $winner['prov'] : '';
$winner_address .= !empty($winner['country']) ? '<br>' . $winner['country'] : '';
$winner_address .= !empty($winner['zip']) ? '<br>' . $winner['zip'] : '';
$title = $system->SETTINGS['sitename'] . ' - ' . $data['title'];
$template->assign_vars(array('DOCDIR' => $DOCDIR, 'LOGO' => $system->SETTINGS['siteurl'] . 'themes/' . $system->SETTINGS['theme'] . '/' . $system->SETTINGS['logo'], 'CHARSET' => $CHARSET, 'LANGUAGE' => $language, 'SENDER' => $sender['nick'], 'WINNER_NICK' => $winner['nick'], 'WINNER_ADDRESS' => $winner_address, 'AUCTION_TITLE' => strtoupper($title), 'AUCTION_ID' => $data['auc_id'], 'SHIPPING_METHOD' => "N/A", 'PAYMENT_METHOD' => "N/A", 'CLOSING_DATE' => ArrangeDateNoCorrection($data['closingdate']), 'PAYMENT' => $data['payment'], 'ITEM_QUANTITY' => $data['qty'], 'B_INVOICE' => true));
$template->set_filenames(array('body' => 'order_packingslip.tpl'));
$template->display('body');