function create_dummy($deptid, $cusnum) { # Get selected customer info db_connect(); $sql = "SELECT * FROM customers WHERE cusnum = '{$cusnum}' AND div = '" . USER_DIV . "'"; $custRslt = db_exec($sql) or errDie("Unable to get customer information"); $cust = pg_fetch_array($custRslt); $curr = getSymbol($cust['fcid']); $xrate = getRate($cust['fcid']); $trans_date_setting = getCSetting("USE_TRANSACTION_DATE"); if (isset($trans_date_setting) and $trans_date_setting == "yes") { $trans_date_value = getCSetting("TRANSACTION_DATE"); $date_arr = explode("-", $trans_date_value); $date_year = $date_arr[0]; $date_month = $date_arr[1]; $date_day = $date_arr[2]; } else { $date_year = date("Y"); $date_month = date("m"); $date_day = date("d"); } $odate = "{$date_year}-{$date_month}-{$date_day}"; db_connect(); # Insert purchase to DB $sql = "\n\t\tINSERT INTO nons_invoices (\n\t\t\tcusname, cusaddr, cusvatno, chrgvat, fcid, currency, \n\t\t\txrate, odate, sdate, subtot, balance, vat, total, done, username, prd, invnum, typ, ctyp, \n\t\t\ttval, location, div\n\t\t) VALUES (\n\t\t\t'{$cust['cusname']} {$cust['surname']}', '{$cust['addr1']}', '{$cust['vatnum']}', 'yes', '{$cust['fcid']}', '{$curr['symbol']}', \n\t\t\t'{$xrate}', '{$odate}', CURRENT_DATE, 0, 0, 0, 0, 'n', '" . USER_NAME . "', '" . PRD_DB . "', 0, 'inv', 's', \n\t\t\t'{$cusnum}', 'int', '" . USER_DIV . "'\n\t\t)"; $rslt = db_exec($sql) or errDie("Unable to create template Non-Stock Invoice.", SELF); # Get next ordnum $invid = lastinvid(); return $invid; }
function create_dummy($deptid, $supid) { # Get selected supplier info db_connect(); $sql = "SELECT * FROM suppliers WHERE supid = '{$supid}' AND div = '" . USER_DIV . "'"; $supRslt = db_exec($sql) or errDie("Unable to get supplier information"); $sup = pg_fetch_array($supRslt); # Dummy Vars $remarks = ""; $supaddr = ""; $terms = "0"; $total = 0; $subtot = 0; // $pdate = date("Y-m-d"); $ddate = date("Y-m-d"); $shipchrg = "0.00"; $fcid = $sup['fcid']; $curr = getSymbol($fcid); $xrate = getRate($fcid); $purnum = divlastid("pur", USER_DIV); $trans_date_setting = getCSetting("USE_TRANSACTION_DATE"); if (isset($trans_date_setting) and $trans_date_setting == "yes") { $trans_date_value = getCSetting("TRANSACTION_DATE"); $date_arr = explode("-", $trans_date_value); $date_year = $date_arr[0]; $date_month = $date_arr[1]; $date_day = $date_arr[2]; } else { $date_year = date("Y"); $date_month = date("m"); $date_day = date("d"); } $pdate = "{$date_year}-{$date_month}-{$date_day}"; # Insert Order to DB $sql = "\n\t\tINSERT INTO nons_purch_int (\n\t\t\tdeptid, supid, supplier, supaddr, terms, pdate, ddate, shipchrg, xrate, fcid, \n\t\t\tcurr, subtot, total, balance, tax, remarks, received, done, prd, \n\t\t\tdiv, purnum\n\t\t) VALUES (\n\t\t\t'{$deptid}', '{$supid}', '', '{$supaddr}', '{$terms}', '{$pdate}', '{$ddate}', '{$shipchrg}', '{$xrate}', '{$fcid}', \n\t\t\t'{$curr['symbol']}', '{$subtot}', '{$total}', '{$total}', '0', '{$remarks}', 'n', 'n', '" . PRD_DB . "', \n\t\t\t'" . USER_DIV . "', '{$purnum}'\n\t\t)"; $rslt = db_exec($sql) or errDie("Unable to insert Non-Stock Order to Cubit.", SELF); # Get next ordnum $purid = pglib_lastid("nons_purch_int", "purid"); return $purid; }
</div> </div> <div class="row"> <div class="col-md-12 col-sm-12"> <div class="panel panel-default"> <div class="panel-heading"> My Accounts </div> <div class="panel-body"> <?php $rate = getRate($_SESSION['package_id']); $q = mysql_query("SELECT * FROM tbl_cycle WHERE account_link='" . $_SESSION['accounts_id'] . "' AND cycle_count=1"); ?> <div class="table-responsive"> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Account #</th> <th>Cycle 1</th> <th>Cycle 2</th> <th>Cycle 3</th> </tr> </thead> <tbody> <?php while ($row = mysql_fetch_array($q)) {
if ($moderator) { $HTMLOUT .= tr("{$lang['details_banned']}", $torrents["banned"]); } if ($torrents["nuked"] == "yes") { $HTMLOUT .= "<tr><td class='rowhead'><b>Nuked</b></td><td align='left'><img src='{$INSTALLER09['pic_base_url']}nuked.gif' alt='Nuked' title='Nuked' /></td></tr>\n"; } if (!empty($torrents["nukereason"])) { $HTMLOUT .= "<tr><td class='rowhead'><b>Nuke-Reason</b></td><td align='left'>" . htmlsafechars($torrents["nukereason"]) . "</td></tr>\n"; } $torrents['cat_name'] = htmlsafechars($change[$torrents['category']]['name']); if (isset($torrents["cat_name"])) { $HTMLOUT .= tr("{$lang['details_type']}", htmlsafechars($torrents["cat_name"])); } else { $HTMLOUT .= tr("{$lang['details_type']}", "None"); } $HTMLOUT .= tr("Rating", getRate($id, "torrent"), 1); $HTMLOUT .= tr("{$lang['details_last_seeder']}", "{$lang['details_last_activity']}" . get_date($l_a['lastseed'], '', 0, 1)); $HTMLOUT .= tr("{$lang['details_size']}", mksize($torrents["size"]) . " (" . number_format($torrents["size"]) . " {$lang['details_bytes']})"); $HTMLOUT .= tr("{$lang['details_added']}", get_date($torrents['added'], "{$lang['details_long']}")); $HTMLOUT .= tr("{$lang['details_views']}", (int) $torrents["views"]); $HTMLOUT .= tr("{$lang['details_hits']}", (int) $torrents["hits"]); $XBT_Or_Default = XBT_TRACKER == true ? 'snatches_xbt.php?id=' : 'snatches.php?id='; $HTMLOUT .= tr("{$lang['details_snatched']}", $torrents["times_completed"] > 0 ? "<a href='{$INSTALLER09["baseurl"]}/{$XBT_Or_Default}{$id}'>{$torrents['times_completed']} {$lang['details_times']}</a>" : "0 {$lang['details_times']}", 1); $HTMLOUT .= "<tr><td class='rowhead'>Status update</td><td><input type='button' onclick='status_showbox(\"{$CURUSER['username']} is viewing details for torrent {$INSTALLER09['baseurl']}/details.php?id=" . (int) $torrents['id'] . "\")' value='do it!'/></td></tr>"; $HTMLOUT .= "</table>\n<table align='center' class='table table-bordered span9'>"; //==Report Torrent Link $HTMLOUT .= tr("Report Torrent", "<form action='report.php?type=Torrent&id={$id}' method='post'><input class='btn btn-primary' type='submit' name='submit' value='Report This Torrent' /> <strong><em class='label label-primary'>For breaking the <a href='rules.php'>rules</a></em></strong></form>", 1); //== Tor Reputation by pdq if ($torrent_cache['rep']) { $torrents = array_merge($torrents, $torrent_cache['rep']); $member_reputation = get_reputation($torrents, 'torrents', $torrents['anonymous']);
function ageage($cusnum, $age, $fcid, $loc) { $rate = getRate($fcid); $bal = "balance"; if ($loc == 'int') { $bal = "fbalance"; $rate = 1; } if ($rate == 0) { $rate = 1; } # Get the current oustanding $sql = "SELECT sum({$bal}) FROM invoices WHERE cusnum = '{$cusnum}' AND printed = 'y' AND age = '{$age}' AND div = '" . USER_DIV . "'"; $rs = db_exec($sql) or errDie("Unable to access database"); $sum = pg_fetch_array($rs); # Get the current oustanding on transactions $sql = "SELECT sum({$bal}) FROM custran WHERE cusnum = '{$cusnum}' AND age = '{$age}' AND div = '" . USER_DIV . "'"; $rs = db_exec($sql) or errDie("Unable to access database"); $sumb = pg_fetch_array($rs); # Take care of nasty zero return sprint($sum['sum'] + $sumb['sum'] + 0); }
function write($_POST) { # Get vars extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($cusnum, "num", 1, 20, "Invalid Customer, Please select a customer."); $v->isOk($invid, "num", 1, 20, "Invalid Invoice Number."); $v->isOk($cordno, "string", 0, 20, "Invalid Customer Order Number."); if (!isset($ria)) { $ria = ""; } $v->isOk($ria, "string", 0, 20, "Invalid stock code(fist letters)."); $v->isOk($comm, "string", 0, 255, "Invalid Comments."); $v->isOk($docref, "string", 0, 20, "Invalid Document Reference No."); $v->isOk($ordno, "num", 0, 20, "Invalid sales order number."); $v->isOk($chrgvat, "string", 1, 4, "Invalid charge vat option."); $v->isOk($terms, "num", 1, 20, "Invalid terms."); $v->isOk($salespn, "string", 1, 255, "Invalid sales person."); $v->isOk($o_day, "num", 1, 2, "Invalid Invoice Date day."); $v->isOk($o_month, "num", 1, 2, "Invalid Invoice Date month."); $v->isOk($o_year, "num", 1, 5, "Invalid Invoice Date year."); $odate = $o_year . "-" . $o_month . "-" . $o_day; if (!checkdate($o_month, $o_day, $o_year)) { $v->isOk($odate, "num", 1, 1, "Invalid Invoice Date."); } $v->isOk($traddisc, "float", 0, 20, "Invalid Trade Discount."); if ($traddisc > 100) { $v->isOk($traddisc, "float", 0, 0, "Error : Trade Discount cannot be more than 100 %."); } $v->isOk($delchrg, "float", 0, 20, "Invalid Delivery Charge."); $v->isOk($SUBTOT, "float", 0, 20, "Invalid Delivery Charge."); # used to generate errors $error = "asa@"; # check if duplicate serial number selected, remove blanks if (isset($sernos)) { if (!ext_isUnique(ext_remBlnk($sernos))) { $v->isOk($error, "num", 0, 0, "Error : Serial Numbers must be unique per line item."); } } # check is serai no was selected if (isset($stkids)) { foreach ($stkids as $keys => $stkid) { # check if serial is selected if (ext_isSerial("stock", "stkid", $stkid) && !isset($sernos[$keys])) { $v->isOk($error, "num", 0, 0, "Error : Missing serial number for product number : <b>" . ($keys + 1) . "</b>"); } elseif (ext_isSerial("stock", "stkid", $stkid) && !(strlen($sernos[$keys]) > 0)) { $v->isOk($error, "num", 0, 0, "Error : Missing serial number for product number : <b>" . ($keys + 1) . "</b>"); } } } # check quantities if (isset($qtys)) { foreach ($qtys as $keys => $qty) { $discp[$keys] += 0; $disc[$keys] += 0; $v->isOk($qty, "float", 1, 15, "Invalid Quantity for product number : <b>" . ($keys + 1) . "</b>"); $v->isOk($disc[$keys], "float", 0, 20, "Invalid Discount for product number : <b>" . ($keys + 1) . "</b>."); if ($disc[$keys] > $unitcost[$keys]) { $v->isOk($disc[$keys], "float", 0, 0, "Error : Discount for product number : <b>" . ($keys + 1) . "</b> is more than the unitcost."); } $v->isOk($discp[$keys], "float", 0, 20, "Invalid Discount Percentage for product number : <b>" . ($keys + 1) . "</b>."); if ($discp[$keys] > 100) { $v->isOk($discp[$keys], "float", 0, 0, "Error : Discount for product number : <b>" . ($keys + 1) . "</b> is more than 100 %."); } $unitcost[$keys] += 0; $cunitcost[$keys] += 0; $v->isOk($unitcost[$keys], "float", 1, 20, "Invalid Unit Price for product number : <b>" . ($keys + 1) . "</b>."); $v->isOk($cunitcost[$keys], "float", 1, 20, "Invalid Unit Price for product number : <b>" . ($keys + 1) . "</b>."); if ($qty < 1) { $v->isOk($qty, "num", 0, 0, "Error : Item Quantity must be at least one. Product number : <b>" . ($keys + 1) . "</b>"); } } } # check whids if (isset($whids)) { foreach ($whids as $keys => $whid) { $v->isOk($whid, "num", 1, 10, "Invalid Store number, please enter all details."); } } # check stkids if (isset($stkids)) { foreach ($stkids as $keys => $stkid) { $v->isOk($stkid, "num", 1, 10, "Invalid Stock number, please enter all details."); } } # check amt if (isset($amt)) { foreach ($amt as $keys => $amount) { $v->isOk($amount, "float", 1, 20, "Invalid Amount, please enter all details."); } } # display errors, if any $err = ""; if ($v->isError()) { $errors = $v->getErrors(); foreach ($errors as $e) { $err .= "<li class='err'>" . $e["msg"] . "</li>"; } return details($_POST, $err); } # Get invoice info db_connect(); $sql = "SELECT * FROM invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'"; $invRslt = db_exec($sql) or errDie("Unable to get invoice information"); if (pg_numrows($invRslt) < 1) { return "<li>- Invoice Not Found</li>"; } $inv = pg_fetch_array($invRslt); $inv['traddisc'] = $traddisc; $inv['chrgvat'] = $chrgvat; # check if invoice has been printed if ($inv['printed'] == "y") { $error = "<li class='err'> Error : Invoice number <b>{$invid}</b> has already been printed.</li>"; $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>"; return $error; } db_connect(); if (isset($printdel)) { $Sl = "SELECT * FROM settings WHERE constant='Delivery Note'"; $Ri = db_exec($Sl) or errDie("Unable to get settings."); if (pg_num_rows($Ri) < 1) { $Sl = "INSERT INTO settings (constant,value,div) VALUES ('Delivery Note','Yes','" . USER_DIV . "')"; $Ri = db_exec($Sl); } else { $Sl = "UPDATE settings SET value='Yes' WHERE constant='Delivery Note' AND div='" . USER_DIV . "'"; $Ri = db_exec($Sl); } } else { $Sl = "UPDATE settings SET value='No' WHERE constant='Delivery Note' AND div='" . USER_DIV . "'"; $Ri = db_exec($Sl); } # Get selected customer info db_connect(); $sql = "SELECT * FROM customers WHERE cusnum = '{$cusnum}' AND div = '" . USER_DIV . "'"; $custRslt = db_exec($sql) or errDie("Unable to get customer information"); if (pg_numrows($custRslt) < 1) { $sql = "SELECT * FROM inv_data WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'"; $custRslt = db_exec($sql) or errDie("Unable to get customer information data"); $cust = pg_fetch_array($custRslt); $cust['cusname'] = $cust['customer']; $cust['surname'] = ""; $cust['addr1'] = ""; # currency $currs = getSymbol($inv['fcid']); } else { $cust = pg_fetch_array($custRslt); # If customer was just selected/changed, get the following if ($inv['cusnum'] != $cusnum) { $traddisc = $cust['traddisc']; $terms = $cust['credterm']; $xrate = getRate($cust['fcid']); } # currency $currs = getSymbol($cust['fcid']); } # get department db_conn("exten"); $sql = "SELECT * FROM departments WHERE deptid = '{$inv['deptid']}' AND div = '" . USER_DIV . "'"; $deptRslt = db_exec($sql); if (pg_numrows($deptRslt) < 1) { $dept['deptname'] = "<i class=err>Not Found</i>"; } else { $dept = pg_fetch_array($deptRslt); } # fix those nasty zeros $xrate += 0; if ($xrate == 0) { $xrate = 1; } $traddisc += 0; $delchrg += 0; $vatamount = 0; $showvat = TRUE; # insert invoice to DB db_connect(); # begin updating pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF); /* -- Start remove old items -- */ # get selected stock in this invoice $sql = "SELECT * FROM inv_items WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'"; $stktRslt = db_exec($sql); while ($stkt = pg_fetch_array($stktRslt)) { # update stock(alloc + qty) $sql = "UPDATE stock SET alloc = (alloc - '{$stkt['qty']}') WHERE stkid = '{$stkt['stkid']}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.", SELF); if (strlen($stkt['serno']) > 0) { ext_unresvSer($stkt['serno'], $stkt['stkid']); } } # remove old items $sql = "DELETE FROM inv_items WHERE invid='{$invid}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update invoice items in Cubit.", SELF); /* -- End remove old items -- */ $taxex = 0; if (isset($qtys)) { foreach ($qtys as $keys => $value) { if (isset($remprod) && in_array($keys, $remprod)) { // if(isset($remprod)){ // if(in_array($keys, $remprod)){ // # skip product (wonder if $keys still align) // $amt[$keys] = 0; // continue; // }else{ // # get selamt from selected stock // $sql = "SELECT * FROM stock WHERE stkid = '$stkids[$keys]' AND div = '".USER_DIV."'"; // $stkRslt = db_exec($sql); // $stk = pg_fetch_array($stkRslt); // // $t=$cunitcost[$keys]; // // # Calculate the unitcost // if($cunitcost[$keys] > 0 && $unitcost[$keys] == 0){ // $unitcost[$keys] = ($cunitcost[$keys] * $xrate); // }else{ // $cunitcost[$keys] = ($unitcost[$keys]/$xrate); // } // // # Calculate the Discount discount // if($disc[$keys] < 1){ // if($discp[$keys] > 0){ // $disc[$keys] = (($discp[$keys]/100) * $t); // } // }else{ // $discp[$keys] = (($disc[$keys] * 100) / $t); // } // // # Calculate amount // $funitcost[$keys] = $unitcost[$keys]; // $famt[$keys] = ($qtys[$keys] * ($funitcost[$keys])); // // # Calculate amount // // $amt[$keys] = ($qtys[$keys] * ($unitcost[$keys] - $disc[$keys])); // $unitcost[$keys] = sprint($funitcost[$keys]/$xrate); // $amt[$keys] = sprint($famt[$keys]/$xrate-($disc[$keys])); // // $Sl="SELECT * FROM vatcodes WHERE id='$vatcodes[$keys]'"; // $Ri=db_exec($Sl); // // if(pg_num_rows($Ri)<1) { // return details($_POST, "<li class=err>Please select the vatcode for all your items.</li>"); // } // $vd=pg_fetch_array($Ri); // // # Check Tax Excempt // if($stk['exvat'] == 'yes'||$vd['zero']=="Yes"){ // $taxex += $amt[$keys]; // } // // # insert invoice items // $sql = "INSERT INTO inv_items(invid, whid, stkid, qty, unitcost, funitcost, amt, famt, disc, discp, serno, div,vatcode,del) VALUES('$invid', '$whids[$keys]', '$stkids[$keys]', '$qtys[$keys]', '$unitcost[$keys]', '$funitcost[$keys]', '$amt[$keys]', '$famt[$keys]', '$disc[$keys]', '$discp[$keys]', '$sernos[$keys]', '".USER_DIV."','$vatcodes[$keys]','0')"; // $rslt = db_exec($sql) or errDie("Unable to insert invoice items to Cubit.",SELF); // // if(strlen($stkt['serno']) > 0) // ext_resvSer($stkt['serno'], $stk['stkid']); // // # update stock(alloc + qty) // $sql = "UPDATE stock SET alloc = (alloc + '$qtys[$keys]') WHERE stkid = '$stkids[$keys]' AND div = '".USER_DIV."'"; // $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.",SELF); // } } else { # Get selamt from selected stock $sql = "SELECT * FROM stock WHERE stkid = '{$stkids[$keys]}' AND div = '" . USER_DIV . "'"; $stkRslt = db_exec($sql); $stk = pg_fetch_array($stkRslt); /*# Calculate the unitcost if($cunitcost[$keys] > 0 && $unitcost[$keys] == 0){ $unitcost[$keys] = ($cunitcost[$keys] * $xrate); }else{ $cunitcost[$keys] = ($unitcost[$keys]/$xrate); }*/ $t = $cunitcost[$keys]; # Calculate the unitcost if ($unitcost[$keys] > 0 && $cunitcost[$keys] == 0) { $cunitcost[$keys] = $unitcost[$keys] / $xrate; } else { $unitcost[$keys] = $cunitcost[$keys] * $xrate; } # Calculate the Discount discount if ($disc[$keys] < 1) { if ($discp[$keys] > 0) { $disc[$keys] = $discp[$keys] / 100 * $t; } } else { $discp[$keys] = $disc[$keys] * 100 / $t; } if ($xrate < 1) { $xrate = 1; } //$disc[$keys]=$disc[$keys]*$xrate; # Calculate amount $funitcost[$keys] = $unitcost[$keys]; $famt[$keys] = $qtys[$keys] * $funitcost[$keys]; //$famt[$keys] = ($qtys[$keys] * ($funitcost[$keys] - $disc[$keys])); # Calculate amount // $amt[$keys] = ($qtys[$keys] * ($unitcost[$keys] - $disc[$keys])); $unitcost[$keys] = sprint($funitcost[$keys] / $xrate); $amt[$keys] = sprint($famt[$keys] / $xrate - $disc[$keys]); //$amt[$keys] = sprint($famt[$keys]/$xrate); $Sl = "SELECT * FROM vatcodes WHERE id='{$vatcodes[$keys]}'"; $Ri = db_exec($Sl); if (pg_num_rows($Ri) < 1) { return details($_POST, "<li class='err'>Please select the vatcode for all your items.</li>"); } $vd = pg_fetch_array($Ri); if ($vd['zero'] == "Yes") { $excluding = "y"; } else { $excluding = ""; } if (TAX_VAT != $vd['vat_amount'] and $vd['vat_amount'] != "0.00") { $showvat = FALSE; } $vr = vatcalc($amt[$keys], $inv['chrgvat'], $excluding, $inv['traddisc'], $vd['vat_amount']); $vrs = explode("|", $vr); $ivat = $vrs[0]; $iamount = $vrs[1]; $vatamount += $ivat; # Check Tax Excempt if ($stk['exvat'] == 'yes' || $vd['zero'] == "Yes") { $taxex += $amt[$keys]; } # insert invoice items $sql = "\n\t\t\t\t\t\tINSERT INTO inv_items (\n\t\t\t\t\t\t\tinvid, whid, stkid, qty, unitcost, \n\t\t\t\t\t\t\tfunitcost, amt, famt, disc, \n\t\t\t\t\t\t\tdiscp, serno, div, vatcode, del\n\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t'{$invid}', '{$whids[$keys]}', '{$stkids[$keys]}', '{$qtys[$keys]}', '{$unitcost[$keys]}', \n\t\t\t\t\t\t\t'{$funitcost[$keys]}', '{$amt[$keys]}', '{$famt[$keys]}', '{$disc[$keys]}', '{$discp[$keys]}', \n\t\t\t\t\t\t\t'{$sernos[$keys]}', '" . USER_DIV . "', '{$vatcodes[$keys]}', '0'\n\t\t\t\t\t\t)"; $rslt = db_exec($sql) or errDie("Unable to insert invoice items to Cubit.", SELF); if (strlen($sernos[$keys]) > 0) { ext_resvSer($sernos[$keys], $stk['stkid']); } # update stock(alloc + qty) $sql = "UPDATE stock SET alloc = (alloc + '{$qtys[$keys]}') WHERE stkid = '{$stkids[$keys]}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.", SELF); } # everything is set place done button $_POST["done"] = " | <input name='doneBtn' type='submit' value='Process'>"; } } else { $_POST["done"] = ""; } db_conn('cubit'); $Sl = "SELECT * FROM vatcodes WHERE id='{$delvat}'"; $Ri = db_exec($Sl); $vd = pg_fetch_array($Ri); // if(pg_num_rows($Ri)>0) { // $taxex += $delchrg; // } if ($vd['zero'] == "Yes") { $excluding = "y"; } else { $excluding = ""; } if (TAX_VAT != $vd['vat_amount'] and $vd['vat_amount'] != "0.00") { $showvat = FALSE; } $_POST['showvat'] = $showvat; $vr = vatcalc($delchrg, $inv['chrgvat'], $excluding, $inv['traddisc'], $vd['vat_amount']); $vrs = explode("|", $vr); $ivat = $vrs[0]; $iamount = $vrs[1]; $vatamount += $ivat; /* --- ----------- Clac --------------------- */ ##----------------------NEW---------------------- $sub = 0.0; if (isset($amt)) { $sub = sprint(array_sum($amt)); } $VATP = TAX_VAT; if ($chrgvat == "exc") { $taxex = sprint($taxex - $taxex * $traddisc / 100); $subtotal = sprint($sub + $delchrg); $traddiscmt = sprint($subtotal * $traddisc / 100); $subtotal = sprint($subtotal - $traddiscmt); // $VAT=sprint(($subtotal-$taxex)*$VATP/100); $VAT = $vatamount; $SUBTOT = $sub; $TOTAL = sprint($subtotal + $VAT); $delexvat = sprint($delchrg); } elseif ($chrgvat == "inc") { $ot = $taxex; $taxex = sprint($taxex - $taxex * $traddisc / 100); $subtotal = sprint($sub + $delchrg); $traddiscmt = sprint($subtotal * $traddisc / 100); $subtotal = sprint($subtotal - $traddiscmt); //$VAT=sprint(($subtotal-$taxex)*$VATP/(100+$VATP)); $VAT = $vatamount; $SUBTOT = sprint($sub); $TOTAL = sprint($subtotal); $delexvat = sprint($delchrg); $traddiscmt = sprint($traddiscmt); } else { $subtotal = sprint($sub + $delchrg); $traddiscmt = sprint($subtotal * $traddisc / 100); $subtotal = sprint($subtotal - $traddiscmt); $VAT = sprint(0); $SUBTOT = $sub; $TOTAL = $subtotal; $delexvat = sprint($delchrg); } /* --- ----------- Clac --------------------- */ ##----------------------END---------------------- /* --- ----------- Clac --------------------- # calculate subtot $SUBTOT = 0.00; if(isset($amt)) $SUBTOT = array_sum($amt); $SUBTOT -= $taxex; # duplicate $SUBTOTAL = $SUBTOT; $VATP = TAX_VAT; if($chrgvat == "exc"){ $SUBTOTAL = $SUBTOTAL; $delexvat= ($delchrg); }elseif($chrgvat == "inc"){ $SUBTOTAL = sprint(($SUBTOTAL * 100)/(100 + $VATP)); $delexvat = sprint(($delchrg * 100)/($VATP + 100)); }else{ $SUBTOTAL = ($SUBTOTAL); $delexvat = ($delchrg); } $SUBTOT = $SUBTOTAL; $EXVATTOT = $SUBTOT; $EXVATTOT += $delexvat; # Minus trade discount from taxex if($traddisc > 0){ $traddiscmtt = (($traddisc/100) * $taxex); }else{ $traddiscmtt = 0; } $taxext = ($taxex - $traddiscmtt); if($traddisc > 0) { $traddiscmt = ($EXVATTOT * ($traddisc/100)); }else{ $traddiscmt = 0; } $EXVATTOT -= $traddiscmt; // $EXVATTOT -= $taxex; $traddiscmt = sprint($traddiscmt + $traddiscmtt); if($chrgvat != "nov"){ $VAT = sprint($EXVATTOT * ($VATP/100)); }else{ $VAT = 0; } $TOTAL = sprint($EXVATTOT + $VAT + $taxext); $SUBTOT += $taxex; /* --- ----------- Clac --------------------- */ $FTOTAL = sprint($TOTAL * $xrate); /* --- ----------- Clac --------------------- */ # insert invoice to DB $sql = "\n\t\t\tUPDATE invoices \n\t\t\tSET delvat='{$delvat}', cusnum = '{$cusnum}', deptname = '{$dept['deptname']}', cusacc = '{$cust['accno']}', \n\t\t\t\tcusname = '{$cust['cusname']}', surname = '{$cust['surname']}', cusaddr = '{$cust['addr1']}', \n\t\t\t\tcusvatno = '{$cust['vatnum']}', cordno = '{$cordno}', ordno = '{$ordno}', chrgvat = '{$chrgvat}', docref = '{$docref}', \n\t\t\t\tterms = '{$terms}', salespn = '{$salespn}', fcid = '{$cust['fcid']}', currency = '{$currs['symbol']}', xrate = '{$xrate}', \n\t\t\t\todate = '{$odate}', traddisc = '{$traddisc}', delchrg = '{$delchrg}', subtot = '{$SUBTOT}', vat = '{$VAT}', \n\t\t\t\ttotal = '{$TOTAL}', balance = '{$FTOTAL}', fbalance = '{$TOTAL}', comm = '{$comm}', location = '{$cust['location']}', \n\t\t\t\tserd = 'y', discount='{$traddiscmt}', delivery='{$delexvat}' \n\t\t\tWHERE invid = '{$invid}'"; $rslt = db_exec($sql) or errDie("Unable to update invoice in Cubit.", SELF); # remove old data $sql = "DELETE FROM inv_data WHERE invid='{$invid}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update invoice data in Cubit.", SELF); # pu in new data $sql = "INSERT INTO inv_data(invid, dept, customer, addr1, div) VALUES('{$invid}', '{$dept['deptname']}', '{$cust['cusname']} {$cust['surname']}', '{$cust['addr1']}', '" . USER_DIV . "')"; $rslt = db_exec($sql) or errDie("Unable to insert invoice data to Cubit.", SELF); # commit updating pglib_transaction("COMMIT") or errDie("Unable to commit a database transaction.", SELF); if (strlen($bar) > 0) { $Sl = "SELECT * FROM possets WHERE div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to add supplier to the system.", SELF); if (pg_numrows($Rs) < 1) { return details($_POST, "<a href='pos-set.php'>Please set the point of sale setting by clicking here.</a>"); } $Dets = pg_fetch_array($Rs); if ($Dets['opt'] == "No") { switch (substr($bar, strlen($bar) - 1, 1)) { case "0": $tab = "ss0"; break; case "1": $tab = "ss1"; break; case "2": $tab = "ss2"; break; case "3": $tab = "ss3"; break; case "4": $tab = "ss4"; break; case "5": $tab = "ss5"; break; case "6": $tab = "ss6"; break; case "7": $tab = "ss7"; break; case "8": $tab = "ss8"; break; case "9": $tab = "ss9"; break; default: return details($_POST, "The code you selected is invalid"); } db_conn('cubit'); pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF); $stid = barext_dbget($tab, 'code', $bar, 'stock'); if (!($stid > 0)) { return details($_POST, "The bar code you selected is not in the system or is not available."); } $Sl = "SELECT * FROM stock WHERE stkid = '{$stid}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl); $s = pg_fetch_array($Rs); # put scanned-in product into invoice db $sql = "\n\t\t\t\tINSERT INTO inv_items (\n\t\t\t\t\tinvid, whid, stkid, qty, unitcost, amt, disc, discp,ss, div, del\n\t\t\t\t) VALUES (\n\t\t\t\t\t'{$invid}', '{$s['whid']}', '{$stid}', '1', '{$s['selamt']}', '{$s['selamt']}', '0', '0', '{$bar}', '" . USER_DIV . "', '0'\n\t\t\t\t)"; $rslt = db_exec($sql) or errDie("Unable to insert invoice items to Cubit.", SELF); # update stock(alloc + qty) $sql = "UPDATE stock SET alloc = (alloc + '1') WHERE stkid = '{$stid}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.", SELF); $Sl = "UPDATE " . $tab . " SET active = 'no' WHERE code = '{$bar}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl); pglib_transaction("COMMIT") or errDie("Unable to commit a database transaction.", SELF); } else { db_conn('cubit'); pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF); $stid = ext_dbget('stock', 'bar', $bar, 'stkid'); if (!($stid > 0)) { return details($_POST, "The bar code you selected is not in the system or is not available."); } $Sl = "SELECT * FROM stock WHERE stkid = '{$stid}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl); $s = pg_fetch_array($Rs); # put scanned-in product into invoice db $sql = "\n\t\t\t\tINSERT INTO inv_items (\n\t\t\t\t\tinvid, whid, stkid, qty, unitcost, amt, disc, discp,ss, div, del\n\t\t\t\t) VALUES (\n\t\t\t\t\t'{$invid}', '{$s['whid']}', '{$stid}', '1', '{$s['selamt']}', '{$s['selamt']}', '0', '0','{$bar}', '" . USER_DIV . "', '0'\n\t\t\t\t)"; $rslt = db_exec($sql) or errDie("Unable to insert invoice items to Cubit.", SELF); # update stock(alloc + qty) $sql = "UPDATE stock SET alloc = (alloc + '1') WHERE stkid = '{$stid}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.", SELF); pglib_transaction("COMMIT") or errDie("Unable to commit a database transaction.", SELF); } } /* --- Start button Listeners --- */ if (isset($doneBtn)) { # Check if stock was selected(yes = put done button) db_connect(); $sql = "SELECT stkid FROM inv_items WHERE invid = '{$inv['invid']}' AND div = '" . USER_DIV . "'"; $crslt = db_exec($sql); if (pg_numrows($crslt) < 1) { $error = "<li class='err'> Error : Invoice number has no items.</li>"; return details($_POST, $error); } # Insert quote to DB $sql = "UPDATE invoices SET done = 'y' WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update invoice status in Cubit.", SELF); $Sl = "SELECT * FROM settings WHERE constant='Delivery Note'"; $Ri = db_exec($Sl) or errDie("Unable to get settings."); $data = pg_fetch_array($Ri); if ($data['value'] == "Yes") { # Print the invoice $OUTPUT = "<script>nhprinter('invoice-delnote.php?invid={$invid}','Delivery Note');printer('intinvoice-print.php?invid={$invid}');move('main.php');</script>"; } else { # Print the invoice $OUTPUT = "<script>printer('intinvoice-print.php?invid={$invid}');move('main.php');</script>"; } require "template.php"; } elseif (isset($saveBtn)) { // Final Laytout $write = "\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>New International Invoice Saved</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>International Invoice for customer <b>{$cust['cusname']} {$cust['surname']}</b> has been saved.</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='invoice-view.php'>View Invoices</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>"; return $write; } else { if (isset($wtd)) { $_POST['wtd'] = $wtd; } if (strlen($ria) > 0) { $_POST['ria'] = $ria; } return details($_POST); } }
function method($_POST, $err = "") { # get vars extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($supid, "num", 1, 10, "Invalid supplier number."); $v->isOk($bankid, "num", 1, 10, "Invalid Bank Account number."); # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>" . $e["msg"] . "</li>"; } $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>"; return $confirm; } db_connect(); # Supplier name $sql = "SELECT * FROM suppliers WHERE supid = '{$supid}' AND div = '" . USER_DIV . "'"; $supRslt = db_exec($sql); $sup = pg_fetch_array($supRslt); $currs = getSymbol($sup['fcid']); $rate = getRate($sup['fcid']); # Get bank account name db_connect(); $sql = "SELECT * FROM bankacct WHERE bankid = '{$bankid}' AND div = '" . USER_DIV . "'"; $bankRslt = db_exec($sql); $bank = pg_fetch_array($bankRslt); if ($bank['btype'] == 'int') { $bcur = $currs['symbol']; } else { $bcur = CUR; } $alls = "\n\t\t\t<select name='all'>\n\t\t\t\t<option value='0' selected>Auto</option>\n\t\t\t\t<option value='1'>Allocate To Age Analysis</option>\n\t\t\t\t<option value='2'>Allocate To Each invoice</option>\n\t\t\t</select>"; if (!isset($date_day)) { $date_year = date("Y"); $date_month = date("m"); $date_day = date("d"); } // layout $add = "\n\t\t\t<h3>New International Bank Payment</h3>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t\t<input type='hidden' name='key' value='alloc'>\n\t\t\t\t<input type='hidden' name='supid' value='{$supid}'>\n\t\t\t\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t\t\t\t<tr><th colspan='2'>Payment Details</th></tr>\n\t\t\t\t{$err}\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Account</td>\n\t\t\t\t\t<td>{$bank['accname']} - {$bank['bankname']}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Date</td>\n\t\t\t\t\t<td>" . mkDateSelect("date", $date_year, $date_month, $date_day) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Paid To</td>\n\t\t\t\t\t<td valign='center'>({$sup['supno']}) {$sup['supname']}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Description</td>\n\t\t\t\t\t<td valign='center'><textarea col='18' rows='3' name='descript'>{$descript}</textarea></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Cheque Number</td>\n\t\t\t\t\t<td valign='center'><input size='20' name='cheqnum' value='{$cheqnum}'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Amount</td>\n\t\t\t\t\t<td valign='center'>{$bcur} <input type='text' size='13' name='amt' value='{$amt}'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Exchange rate</td>\n\t\t\t\t\t<td valign='center'>" . CUR . " / {$sup['currency']} <input type='text' size='8' name='rate' value='{$rate}'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Allocation</td>\n\t\t\t\t\t<td>{$alls}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td><input type='button' value='< Cancel' onClick='javascript:history.back();'></td>\n\t\t\t\t\t<td valign='center'><input type='submit' value='Allocate >'></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table>"; $printCust = "\n\t\t\t<h3>Creditors Age Analysis</h3>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Current</th>\n\t\t\t\t\t<th>30 days</th>\n\t\t\t\t\t<th>60 days</th>\n\t\t\t\t\t<th>90 days</th>\n\t\t\t\t\t<th>120 days</th>\n\t\t\t\t\t<th>Total Outstanding</th>\n\t\t\t\t</tr>"; $curr = sage($supid, 29); $age30 = sage($supid, 59); $age60 = sage($supid, 89); $age90 = sage($supid, 119); $age120 = sage($supid, 149); $supttot = $curr + $age30 + $age60 + $age90 + $age120; #clean the vars $curr = sprint($curr); $age30 = sprint($age30); $age60 = sprint($age60); $age90 = sprint($age90); $age120 = sprint($age120); $supttot = sprint($supttot); # Alternate bgcolor $printCust .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>{$sup['currency']} " . sprint($curr) . "</td>\n\t\t\t\t\t<td>{$sup['currency']} " . sprint($age30) . "</td>\n\t\t\t\t\t<td>{$sup['currency']} " . sprint($age60) . "</td>\n\t\t\t\t\t<td>{$sup['currency']} " . sprint($age90) . "</td>\n\t\t\t\t\t<td>{$sup['currency']} " . sprint($age120) . "</td>\n\t\t\t\t\t<td>{$sup['currency']} " . sprint($supttot) . "</td>\n\t\t\t\t</tr>"; $printCust .= "<tr><td><br></td></tr></table>"; $OUTPUT = "\n\t\t\t<center>\n\t\t\t<table border='0' width='100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width='65%' align='left'>{$add}</td>\n\t\t\t\t\t<td valign='top' align='center'>\n\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='65%'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td><a href='bank-pay-supp.php'>Add supplier payment</a></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</center>\n\t\t\t{$printCust}"; return $OUTPUT; }
<?php } ?> </td> </tr> <?php } ?> </table> <div class="cart-totals text-right"> Sub-total: <strong> <?php echo getRate(isset($coupon) ? $total_price - $coupon->discount : $total_price); ?> </strong> </div> <?php } else { ?> <h1 style="color:#5BC5C4;font-size:20px;font-weight:bold;">Your cart is currently empty.</h1> <br /> <a href="<?php echo base_url();
<th class="center" style="font-weight:normal;"> <?php echo getRate($row->purchase); ?> </th> <th class="center" style="font-weight:normal;"> Internet </th> <th style="font-weight:normal;text-align:left;" align="left"> <?php echo $row->product_name; ?> </th> </tr> <?php } ?> <tfoot> <tr style="background-color:#4A708B;"> <td colspan="3" style="color:#E5E5E5; font-weight:bold; font-size:15px; text-align:right;">Total</td> <th class="center" style="color:#E5E5E5; font-weight:bold; font-size:15px;"><?php echo getRate($tot); ?> </th> <th colspan="2" class="center" style="color:#E5E5E5; font-weight:bold; font-size:18px;"></th> </tr> </tfoot> </tbody> </table> </body></html>
?> </table> <table class="dashboard-table table"> <tr> <th colspan="3">Recently purchased items</th> </tr> <?php foreach ($recent_items as $item) { ?> <tr> <td><?php echo $item->product_name; ?> </td> <td><?php echo getRate($item->product_price); ?> </td> <td></td> </tr> <?php } ?> </table> </div> <div class="span8" style="width:560px;">
</div> <?php } else { ?> <div class="welcome-cus"> </div> <?php } ?> <div class="cart-item"> <a href="/shop/cart">My Cart : <?php echo isset($tcart) ? $tcart->items : '0'; ?> <?php echo lang('item(s)'); ?> : <?php echo isset($tcart) ? getRate($tcart->gtotal) : getRate(0); ?> </a></div> </div> <div class="claer"></div>
<?php $discount = $billing->discount + $billing->coupon; ?> <?php if ($discount > 0) { ?> <li>Discount <span><?php echo getRate($discount); ?> </span></li> <?php } ?> </ul> <div class="grandtotal"> Grand Total: <?php echo getRate($billing->amount + $billing->shipping + $billing->service + $billing->surcharge + $billing->tax - $discount); ?> </div> </div> </div><!-- My Order Wrapper //--> </div> <!-- main --> <div class="clear"></div> </div> <!-- content --> </div> <!-- content wrapper --> <?php include_once 'footer.php'; ?>
function cycleinc($id) { $user = loadcycle($id); $inc = $user['cycle_count'] + 1; exitlabel($id); $userpackage = getUserPackage($user['account_link']); $rate = getRate($userpackage); totalbalance($user['account_link'], $rate); if ($inc == 4) { addmoney($account_link, $rate * 3); $username = "******" . randid(); $account_link = 1; $cycle_count = 1; $cycle_link = 0; mysql_query("INSERT INTO tbl_cycle SET username='******',account_link='{$account_link}',cycle_count='{$cycle_count}',cycle_link='{$cycle_link}'"); } else { $username = $user['username'] . "-" . $inc; $account_link = $user['account_link']; $cycle_count = $inc; if ($user['cycle_link'] == 0) { $cycle_link = $id; } else { $cycle_link = $user['cycle_link']; } $q = mysql_fetch_assoc(mysql_query("SELECT COUNT(id) as chet FROM tbl_cycle WHERE username='******' AND account_link='{$account_link}' AND cycle_count='{$cycle_count}' AND cycle_link='{$cycle_link}'")); if ($q['chet'] == 0) { mysql_query("INSERT INTO tbl_cycle SET username='******',account_link='{$account_link}',cycle_count='{$cycle_count}',cycle_link='{$cycle_link}'"); } } }
$location_bar = '<a name="top"></a>' . $status_image . ' <a class="altlink" href="index.php">' . $INSTALLER09['site_name'] . '</a> <img src="' . $INSTALLER09['pic_base_url'] . 'arrow_next.gif" alt="►" title="►" /> <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php">Forums</a> ' . $parent_forum_name . ' <img src="' . $INSTALLER09['pic_base_url'] . 'arrow_next.gif" alt="►" title="►" /> <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_forum&forum_id=' . $forum_id . '">' . $forum_name . $child . '</a> <img src="' . $INSTALLER09['pic_base_url'] . 'arrow_next.gif" alt="►" title="►" /> <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_topic&topic_id=' . $topic_id . '">' . $topic_name . '</a> ' . $status_image . '<br />' . $forum_desc . ' <span style="text-align: center;">' . $mini_menu . ($topic_owner == $CURUSER['id'] && $arr['poll_id'] == 0 || $CURUSER['class'] >= UC_STAFF && $arr['poll_id'] == 0 ? ' |<a href="' . $INSTALLER09['baseurl'] . '/forums.php?action=poll&action_2=poll_add&topic_id=' . $topic_id . '" class="altlink"> Add Poll</a>' : '') . '</span><br /><br />'; $HTMLOUT .= ($upload_errors_size > 0 ? $upload_errors_size === 1 ? '<div style="text-align: center;">One file was not uploaded. The maximum file size allowed is. ' . mksize($max_file_size) . '.</div>' : '<div style="text-align: center;">' . $upload_errors_size . ' file were not uploaded. The maximum file size allowed is. ' . mksize($max_file_size) . '.</div>' : '') . ($upload_errors_type > 0 ? $upload_errors_type === 1 ? '<div style="text-align: center;">One file was not uploaded. The accepted formats are zip and rar.</div>' : '<div style="text-align: center;">' . $upload_errors_type . ' files were not uploaded. The accepted formats are zip and rar.</div>' : '') . $location_bar . $topic_poll . '<br />' . $subscription_on_off . '<br /> ' . ($CURUSER['class'] < UC_STAFF ? '' : '<form action="' . $INSTALLER09['baseurl'] . '/forums.php?action=staff_actions" method="post" name="checkme" onsubmit="return SetChecked(this,\'post_to_mess_with\')" enctype="multipart/form-data">') . (isset($_GET['count']) ? ' <div style="text-align: center;">' . intval($_GET['count']) . ' PMs Sent</div>' : '') . ' <!--<table border="0" cellspacing="5" cellpadding="10" width="100%">--> <table border="0" cellspacing="0" cellpadding="4" width="100%"> ' . $the_top_and_bottom . ' <tr><td class="forum_head_dark" align="left" width="100"> <img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="Topic" title="Topic" /> Author</td> <td class="forum_head_dark" align="left" colspan="2"> Topic: ' . $topic_name . ' [ Read ' . $views . ' times ] </td></tr> <tr><td class="three" align="left" colspan="3">Topic rating: ' . getRate($topic_id, "topic") . '</td></tr> <tr><td class="three" align="left" colspan="3">' . $topic_users . '</td></tr>'; //=== lets start the loop \o/ while ($arr = mysqli_fetch_assoc($res)) { //=== change colors $colour = ++$colour % 2; $class = $colour == 0 ? 'one' : 'two'; $class_alt = $colour == 0 ? 'two' : 'one'; $moodname = isset($mood['name'][$arr['mood']]) ? htmlsafechars($mood['name'][$arr['mood']]) : 'is feeling neutral'; $moodpic = isset($mood['image'][$arr['mood']]) ? htmlsafechars($mood['image'][$arr['mood']]) : 'noexpression.gif'; $post_icon = $arr['icon'] !== '' ? '<img src="' . $INSTALLER09['pic_base_url'] . 'smilies/' . htmlsafechars($arr['icon']) . '.gif" alt="icon" title="icon" /> ' : '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="icon" title="icon" /> '; $post_title = $arr['post_title'] !== '' ? ' <span style="font-weight: bold; font-size: x-small;">' . htmlsafechars($arr['post_title'], ENT_QUOTES) . '</span>' : ''; $stafflocked = $arr["staff_lock"] == 1 ? "<img src='{$INSTALLER09['pic_base_url']}locked.gif' border='0' alt='Post Locked' title='Post Locked' />" : ""; $member_reputation = $arr['username'] != '' ? get_reputation($arr, 'posts') : ''; $edited_by = ''; if ($arr['edit_date'] > 0) {
$topic_users_cache['topic_users'] = 'There have been no active users in the last 15 minutes.'; } //$topic_users = ' ('.$topic_users_cache['actcount'].')'; $topic_users = $topic_users_cache['topic_users']; if ($topic_users != '') { $topic_users = 'Currently viewing this topic: ' . $topic_users; } $HTMLOUT .= "<a href='forums.php?action=viewunread' class='button new_reply_button'><span>Show New</span></a> "; if ($maypost) { $HTMLOUT .= "<a href='forums.php?action=reply&topicid=" . $topicid . "' class='button new_reply_button'><span>New Reply</span></a> "; } // $HTMLOUT .="<strong class='float_left' style='padding-right: 10px;'>Thread Rating:</strong>" . (getRate($topicid, "topic")) . ""; $HTMLOUT .= "</div>"; $HTMLOUT .= "<br /><a name='top'></a>"; $HTMLOUT .= "<table border='0' cellspacing='0' cellpadding='5' class='tborder tfixed clear'>"; $HTMLOUT .= "<tr>\n <td class='thead'>\n <div class='float_right'>\n " . getRate($topicid, "topic") . "\n </div>\n <div>\n <span class='smalltext'><strong><a href='{$INSTALLER09['baseurl']}/subscriptions.php?topicid={$topicid}&subscribe=1'><b><font color='red'>Subscribe to Forum</font></b></a><br />\n <span class='smalltext'><strong>{$topic_users}</strong></span> \n</div>\n </td>\n </tr>"; $HTMLOUT .= "\n <script type='text/javascript'>\n /*<![CDATA[*/\n function confirm_att(id)\n {\n if(confirm('Are you sure you want to delete this ?'))\n {\n window.open('{$INSTALLER09['baseurl']}/forums.php?action=attachment&subaction=delete&attachmentid='+id,'attachment','toolbar=no, scrollbars=yes, resizable=yes, width=600, height=250, top=50, left=50');\n window.location.reload(true)\n }\n }\n function popitup(url) {\n newwindow=window.open(url,'./usermood.php','height=335,width=735,resizable=no,scrollbars=no,toolbar=no,menubar=no');\n if (window.focus) {newwindow.focus()}\n return false;\n }\n /*]]>*/\n </script>"; // ------ echo table // $HTMLOUT .= begin_frame(); $res = sql_query("SELECT p.id, p.added, p.user_id, p.added, p.body, p.edited_by, p.edit_date, p.icon, p.anonymous as p_anon, p.user_likes, u.id AS uid, u.username as uusername, u.class, u.avatar, u.offensive_avatar, u.donor, u.title, u.username, u.reputation, u.mood, u.anonymous, u.country, u.enabled, u.warned, u.chatpost, u.leechwarn, u.pirate, u.king, u.uploaded, u.downloaded, u.signature, u.last_access, (SELECT COUNT(id) FROM posts WHERE user_id = u.id) AS posts_count, u2.username as u2_username " . ($Multi_forum['configs']['use_attachment_mod'] ? ", at.id as at_id, at.filename as at_filename, at.postid as at_postid, at.size as at_size, at.downloads as at_downloads, at.owner as at_owner " : "") . ", (SELECT last_post_read FROM read_posts WHERE user_id = " . sqlesc((int) $CURUSER['id']) . " AND topic_id = p.topic_id LIMIT 1) AS last_post_read " . "FROM posts AS p " . "LEFT JOIN users AS u ON p.user_id = u.id " . ($Multi_forum['configs']['use_attachment_mod'] ? "LEFT JOIN attachments AS at ON at.postid = p.id " : "") . "LEFT JOIN users AS u2 ON u2.id = p.edited_by " . "WHERE p.topic_id = " . sqlesc($topicid) . " ORDER BY id LIMIT {$offset}, {$perpage}") or sqlerr(__FILE__, __LINE__); $pc = mysqli_num_rows($res); $pn = 0; while ($arr = mysqli_fetch_assoc($res)) { ++$pn; // --------------- likes start------ $att_str = ''; if (!empty($arr['user_likes'])) { $likes = explode(',', $arr['user_likes']); } else { $likes = ''; }
function write($_POST) { # Get vars extract($_POST); if (isset($noduty)) { $_POST["noduty"] = "yes"; } else { $exd = ""; } # Validate input require_lib("validate"); $v = new validate(); $v->isOk($letters, "string", 0, 5, "Invalid First 3 Letters."); $v->isOk($supid, "num", 1, 20, "Please Select Supplier."); $v->isOk($terms, "num", 1, 5, "Invalid terms days."); $v->isOk($ipur_day, "num", 1, 2, "Invalid Date day."); $v->isOk($ipur_month, "num", 1, 2, "Invalid Date month."); $v->isOk($ipur_year, "num", 1, 5, "Invalid Date year."); $v->isOk($del_day, "num", 1, 2, "Invalid Delivery Date day."); $v->isOk($del_month, "num", 1, 2, "Invalid Delivery Date month."); $v->isOk($del_year, "num", 1, 5, "Invalid Delivery Date year."); //$v->isOk ($curr, "string", 1, 20, "Invalid Foreign currency."); $v->isOk($xrate, "float", 1, 20, "Invalid Exchange Rate."); $v->isOk($tax, "float", 0, 20, "Invalid Tax."); $v->isOk($shipchrg, "float", 0, 20, "Invalid Shipping Charges."); $v->isOk($remarks, "string", 0, 255, "Invalid Remarks."); $pdate = mkdate($ipur_year, $ipur_month, $ipur_day); $v->isOk($pdate, "date", 1, 1, "Invalid purchase date."); $ddate = mkdate($del_year, $del_month, $del_day); $v->isOk($ddate, "date", 1, 1, "Invalid delivery date."); # Used to generate errors $error = "asa@"; # Check quantities if (isset($qtys)) { foreach ($qtys as $keys => $qty) { $v->isOk($qty, "float", 1, 15, "Invalid Quantity for product number : <b>" . ($keys + 1) . "</b>"); $v->isOk($unitcost[$keys], "float", 0, 20, "Invalid Unit Price for product number : <b>" . ($keys + 1) . "</b>."); $v->isOk($cunitcost[$keys], "float", 0, 20, "Invalid Foreign currency Unit Price for product number : <b>" . ($keys + 1) . "</b>."); $v->isOk($duty[$keys], "float", 0, 20, "Invalid Duty Charges for product number : <b>" . ($keys + 1) . "</b>."); $v->isOk($dutyp[$keys], "float", 0, 20, "Invalid Duty Charges Percentage for product number : <b>" . ($keys + 1) . "</b>."); if ($qty < 1) { $v->isOk($qty, "num", 0, 0, "Error : Item Quantity must be at least one. Product number : <b>" . ($keys + 1) . "</b>"); } # Nasty Zeros $unitcost[$keys] += 0; $cunitcost[$keys] += 0; $duty[$keys] += 0; $dutyp[$keys] += 0; } } # Check whids if (isset($whids)) { foreach ($whids as $keys => $whid) { $v->isOk($whid, "num", 1, 10, "Invalid Store number, please enter all details."); } } # Check stkids if (isset($stkids)) { foreach ($stkids as $keys => $stkid) { $v->isOk($stkid, "num", 1, 10, "Invalid Stock number, please enter all details."); } } # Check amt if (isset($amt)) { foreach ($amt as $keys => $amount) { $v->isOk($amount, "float", 1, 20, "Invalid Amount, please enter all details."); } } # Display errors, if any $err = ""; if ($v->isError()) { $errors = $v->getErrors(); foreach ($errors as $e) { $err .= "<li class='err'>" . $e["msg"] . "</li>"; } $_POST['done'] = ""; return details($_POST, $err); } # Get Order info db_connect(); $sql = "SELECT * FROM purch_int WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'"; $purRslt = db_exec($sql) or errDie("Unable to get Order information"); if (pg_numrows($purRslt) < 1) { return "<li>- Order Not Found</li>"; } $pur = pg_fetch_array($purRslt); # check if Order has been printed if ($pur['received'] == "y") { $error = "<li class='err'> Error : Order number <b>{$purid}</b> has already been received.</li>"; $error .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>"; return $error; } # Get selected customer info db_connect(); $sql = "SELECT * FROM suppliers WHERE supid = '{$supid}' AND div = '" . USER_DIV . "'"; $supRslt = db_exec($sql) or errDie("Unable to get customer information"); if (pg_numrows($supRslt) < 1) { // code here } else { $sup = pg_fetch_array($supRslt); } $pur['deptid'] = $sup['deptid']; # If supplier was just selected/changed, get the following if ($pur['supid'] != $supid) { $xrate = getRate($sup['fcid']); } # currency $currs = getSymbol($sup['fcid']); $curr = $currs['symbol']; # get department db_conn("exten"); $sql = "SELECT * FROM departments WHERE deptid = '{$pur['deptid']}' AND div = '" . USER_DIV . "'"; $deptRslt = db_exec($sql); if (pg_numrows($deptRslt) < 1) { $dept['deptname'] = "<i class='err'>Not Found</i>"; } else { $dept = pg_fetch_array($deptRslt); } # fix those nasty zeros $xrate += 0; if ($xrate == 0) { $xrate = 1; } $shipchrg += 0; $tax += 0; # insert Order to DB db_connect(); # begin updating pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF); /* -- Start remove old items -- */ # get selected stock in this Order $sql = "SELECT * FROM purint_items WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'"; $stktRslt = db_exec($sql); while ($stkt = pg_fetch_array($stktRslt)) { # update stock(ordered - qty) $sql = "UPDATE stock SET ordered = (ordered - '{$stkt['qty']}') WHERE stkid = '{$stkt['stkid']}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.", SELF); } # remove old items $sql = "DELETE FROM purint_items WHERE purid='{$purid}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update Order items in Cubit.", SELF); /* -- End remove old items -- */ if (isset($qtys)) { foreach ($qtys as $keys => $value) { if (isset($remprod)) { if (in_array($keys, $remprod)) { # skip product (wonder if $keys still align) $amt[$keys] = 0; continue; } else { # get selamt from selected stock $sql = "SELECT * FROM stock WHERE stkid = '{$stkids[$keys]}' AND div = '" . USER_DIV . "'"; $stkRslt = db_exec($sql); $stk = pg_fetch_array($stkRslt); # Calculate the unitcost if ($cunitcost[$keys] > 0) { $unitcost[$keys] = round($cunitcost[$keys] * $xrate, 2); } else { $cunitcost[$keys] = round($unitcost[$keys] / $xrate, 2); } # Calculate the duty amount if ($duty[$keys] < 1) { if ($dutyp[$keys] > 0) { $duty[$keys] = round($dutyp[$keys] / 100 * $cunitcost[$keys] / $xrate, 2); } } else { if ($unitcost[$keys] > 0) { $dutyp[$keys] = round($duty[$keys] * 100 / $cunitcost[$keys] * $xrate, 2); } else { $dutyp[$keys] = 0; } } # Calculate amount $amt[$keys] = $qtys[$keys] * $cunitcost[$keys] + $duty[$keys]; # insert Order items $sql = "INSERT INTO purint_items(purid, whid, stkid, qty, unitcost, cunitcost, duty, dutyp, amt, ddate, recved, div) VALUES('{$purid}', '{$whids[$keys]}', '{$stkids[$keys]}', '{$qtys[$keys]}', '{$unitcost[$keys]}', '{$cunitcost[$keys]}', '{$duty[$keys]}', '{$dutyp[$keys]}', '{$amt[$keys]}', '{$ddate}', 'n', '" . USER_DIV . "')"; $rslt = db_exec($sql) or errDie("Unable to insert Order items to Cubit.", SELF); # update stock(ordered + qty) $sql = "UPDATE stock SET ordered = (ordered + '{$qtys[$keys]}') WHERE stkid = '{$stkids[$keys]}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.", SELF); } } else { # Get csprice from selected stock $sql = "SELECT * FROM stock WHERE stkid = '{$stkids[$keys]}' AND div = '" . USER_DIV . "'"; $stkRslt = db_exec($sql); $stk = pg_fetch_array($stkRslt); # Calculate the unitcost if ($cunitcost[$keys] > 0) { $unitcost[$keys] = round($cunitcost[$keys] * $xrate, 2); } else { $cunitcost[$keys] = round($unitcost[$keys] / $xrate, 2); } # Calculate the duty amount if ($duty[$keys] < 1) { if ($dutyp[$keys] > 0) { $duty[$keys] = round($dutyp[$keys] / 100 * $unitcost[$keys] / $xrate, 2); } } else { if ($unitcost[$keys] > 0) { $dutyp[$keys] = round($duty[$keys] * 100 / $unitcost[$keys] * $xrate, 2); } else { $dutyp[$keys] = 0; } } # Calculate amount $amt[$keys] = $qtys[$keys] * $cunitcost[$keys] + $duty[$keys]; # Insert Order items $sql = "\n\t\t\t\t\tINSERT INTO purint_items (\n\t\t\t\t\t\tpurid, whid, stkid, qty, unitcost, \n\t\t\t\t\t\tcunitcost, duty, dutyp, amt, ddate, recved, div\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t'{$purid}', '{$whids[$keys]}', '{$stkids[$keys]}', '{$qtys[$keys]}', '{$unitcost[$keys]}', \n\t\t\t\t\t\t'{$cunitcost[$keys]}', '{$duty[$keys]}', '{$dutyp[$keys]}', '{$amt[$keys]}', '{$ddate}', 'n', '" . USER_DIV . "'\n\t\t\t\t\t)"; $rslt = db_exec($sql) or errDie("Unable to insert Order items to Cubit.", SELF); # Update stock(ordered + qty) $sql = "UPDATE stock SET ordered = (ordered + '{$qtys[$keys]}') WHERE stkid = '{$stkids[$keys]}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.", SELF); } # Everything is set place done button $_POST["done"] = " | <input name='doneBtn' type='submit' value='Done'>\n\t\t\t | <input type='submit' name='donePrnt' value='Done, Print and make another'>"; } } else { $_POST["done"] = ""; } /* --- Clac --- */ # Calculate subtot if (isset($amt)) { $SUBTOT = array_sum($amt); } else { $SUBTOT = 0.0; } # shipchrg is in for curr $fshipchrg = $shipchrg; // $shipchrg = ($shipchrg * $xrate); # total $TOTAL = sprint($SUBTOT + $shipchrg + $tax); # total Duty if (isset($duty)) { $dutytot = sprint(array_sum($duty)); } else { $dutytot = "0.00"; } # Local Totals $LTOTAL = sprint($TOTAL * $xrate); $LSUBTOT = sprint($SUBTOT * $xrate); /* --- End Clac --- */ # Insert Order to DB $sql = "\n\t\tUPDATE purch_int \n\t\tSET supid = '{$supid}', supaddr = '{$sup['supaddr']}', terms = '{$terms}', pdate = '{$pdate}', ddate = '{$ddate}',\n\t\t\tfcid = '{$sup['fcid']}', currency = '{$curr}', curr = '{$curr}', tax = '{$tax}', xrate = '{$xrate}', \n\t\t\tfshipchrg = '{$fshipchrg}', shipchrg = '{$shipchrg}', duty = '{$dutytot}', subtot = '{$SUBTOT}',\n\t\t\ttotal = '{$TOTAL}', balance = '{$TOTAL}', fsubtot = '{$LSUBTOT}', fbalance = '{$LTOTAL}', remarks = '{$remarks}',\n\t\t\tjobnum='{$delvat}', deptid = '{$dept['deptid']}' \n\t\tWHERE purid = '{$purid}'"; $rslt = db_exec($sql) or errDie("Unable to update Order in Cubit.", SELF); # Commit updating pglib_transaction("COMMIT") or errDie("Unable to commit a database transaction.", SELF); $lastid = pglib_lastid("purch_int", "purid"); // Was Done, Print and make another selected if (isset($donePrnt)) { $sql = "UPDATE purch_int SET done='y' WHERE purid='{$purid}' AND div='" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update Order status in Cubit."); $OUTPUT = "<script>printer('purch-int-det.php?purid={$lastid}');move('purch-int-new.php');</script>"; return $OUTPUT; } if (!isset($doneBtn)) { return details($_POST); } else { # Insert Order to DB $sql = "UPDATE purch_int SET done = 'y' WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'"; $rslt = db_exec($sql) or errDie("Unable to update Order status in Cubit.", SELF); // Final Laytout $write = "\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan='2'>New International Order</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Order from Supplier <b>{$sup['supname']}</b> has been recorded.</td>\n\t\t\t\t\t<td><a href='purch-int-det.php?purid={$lastid}'>Print Order</a></td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='purch-int-view.php'>View International Orders</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>"; return $write; } }
?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px;"><?php echo getRate($tax); ?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px;"><?php echo getRate($other); ?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px;"><?php echo getRate($total); ?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px;"><?php echo getRate($commission); ?> </th> </tr> </tfoot> </tbody> </table> <p class="text-center">Go To <a href="reports">Report Search</a> </p> <?php } else { ?> <p class="text-center">Sorry No Results Found. Go Back To <a href="reports">Report Search</a></p> <?php
echo $row->product_picture; ?> " style="width:100%;" class="orienta" ></a> </div> <p class="product-name"> <a href="/<?php echo $upath . $row->url; ?> "><?php echo $row->product_name; ?> </a> </p> <p class="product-price"> <?php echo getRate($row->price_value) . ' - ' . $row->product_id; ?> <?php //echo getRate($row->price_value); ?> </p> </div> </td> <?php if ($procount % 2 == 0) { ?> </tr> <?php } ?>
<td><?php echo lang('Tax'); ?> </td> <td class="right"><?php echo getRate($totals['tax']); ?> </td> </tr> <tr> <td class="gtotal"><strong><?php echo lang('Grand Total'); ?> </strong></td> <td class="right"><strong class="lead"><?php echo getRate($totals['grandtotal']); ?> </strong></td> </tr> </table> </div> <div class="span12 offset1"> <h3><?php echo lang('Billing Details'); ?> </h3> <div class="form-warning"> <?php
function add($_POST) { # Get vars extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($bankid, "num", 1, 30, "Invalid Local Bank Account."); $v->isOk($fbankid, "num", 1, 30, "Invalid Foreign Bank Account."); $v->isOk($ttype, "string", 1, 4, "Invalid Transfer type option."); # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>" . $e["msg"] . "</li>"; } $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>"; return $confirm; } # Get bank account name db_connect(); $sql = "SELECT * FROM bankacct WHERE bankid = '{$bankid}' AND div = '" . USER_DIV . "'"; $bankRslt = db_exec($sql); $bank = pg_fetch_array($bankRslt); $sql = "SELECT * FROM bankacct WHERE bankid = '{$fbankid}' AND div = '" . USER_DIV . "'"; $fbankRslt = db_exec($sql); $fbank = pg_fetch_array($fbankRslt); $curr = getsymbol($fbank['fcid']); $rate = getRate($fbank['fcid']); $scurr = $ttype == 'loc' ? CUR : $curr['symbol']; # ttype array $ttypearr = array("loc" => "From Local To Foreign", "int" => "From Foreign To Local"); # layout $add = "\n\t\t<h3>Bank Transfer</h3>\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t\t\t<input type='hidden' name='fbankid' value='{$fbankid}'>\n\t\t\t<input type='hidden' name='ttype' value='{$ttype}'>\n\t\t<table " . TMPL_tblDflts . " width='80%'>\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Local Bank Account</td>\n\t\t\t\t<td valign='center'>{$bank['accname']} - {$bank['bankname']}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Foreign Bank Account</td>\n\t\t\t\t<td valign='center'>{$fbank['accname']} - {$fbank['bankname']}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Date</td>\n\t\t\t\t<td>" . mkDateSelect("date") . " DD-MM-YYYY</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td valign='top'>Description</td>\n\t\t\t\t<td valign='center'><textarea col='18' rows='3' name='descript'></textarea></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Reference</td>\n\t\t\t\t<td><input type='text' size='25' name='reference'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Cheque Number</td>\n\t\t\t\t<td valign='center'><input size='20' name='cheqnum'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Amount</td>\n\t\t\t\t<td valign='center'>{$scurr} <input type='text' size='10' name='amount'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Exchange Rate</td>\n\t\t\t\t<td valign='center'>" . CUR . "/{$curr['symbol']} <input type='text' size='5' name='rate' value='{$rate}'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Tranfer Type</td>\n\t\t\t\t<td valign='center'>{$ttypearr[$ttype]}</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td><input type='button' value='< Cancel' onClick='javascript:history.back();'></td>\n\t\t\t\t<td valign='center'><input type='submit' value='Confirm >'></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>"; # main table (layout with menu) $OUTPUT = "\n\t\t<center>\n\t\t<table width='100%'>\n\t\t\t<tr>\n\t\t\t\t<td width='65%' align='left'>{$add}</td>\n\t\t\t\t<td valign='top' align='center'>\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='65%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>"; return $OUTPUT; }
<tr> <td class="addonrow"> </td> <td class="addonrow"> [<big>+</big>] <?php echo ucfirst(strtolower($addon->addon_name)); ?> (<?php echo getRate($addon->addon_price); ?> ) x <?php echo $addon->addon_quantity; ?> </td> <td class="addonrow"> <?php echo getRate($addon->addon_price * $addon->addon_quantity); ?> </td> </tr> <?php } } ?> </table> <h3><?php echo lang('Payment'); ?> <?php //echo $this->session->userdata('user_firstname').' '.$this->session->userdata('customer_account'); ?> </h3>
<a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_forum&forum_id=' . $forum_id . '">' . $forum_name . $child . '</a> <img src="' . $INSTALLER09['pic_base_url'] . 'arrow_next.gif" alt="►" title="►" /> <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_topic&topic_id=' . $topic_id . '">' . $topic_name . '</a> ' . $status_image . '<br />' . $forum_desc . ' <span style="text-align: center;">' . $mini_menu . ($topic_owner == $CURUSER['id'] && $arr['poll_id'] == 0 || $CURUSER['class'] >= UC_STAFF && $arr['poll_id'] == 0 ? ' |<a href="' . $INSTALLER09['baseurl'] . '/forums.php?action=poll&action_2=poll_add&topic_id=' . $topic_id . '" class="altlink"> ' . $lang['fe_add_poll'] . '</a>' : '') . '</span><br /><br />'; $HTMLOUT .= ($upload_errors_size > 0 ? $upload_errors_size === 1 ? '<div style="text-align: center;">One file was not uploaded. The maximum file size allowed is. ' . mksize($max_file_size) . '.</div>' : '<div style="text-align: center;">' . $upload_errors_size . ' file were not uploaded. The maximum file size allowed is. ' . mksize($max_file_size) . '.</div>' : '') . ($upload_errors_type > 0 ? $upload_errors_type === 1 ? '<div style="text-align: center;">One file was not uploaded. The accepted formats are zip and rar.</div>' : '<div style="text-align: center;">' . $upload_errors_type . ' files were not uploaded. The accepted formats are zip and rar.</div>' : '') . $location_bar . $topic_poll . '<br />' . $subscription_on_off . '<br /> ' . ($CURUSER['class'] < UC_STAFF ? '' : ' <form action="' . $INSTALLER09['baseurl'] . '/forums.php?action=staff_actions" method="post" name="checkme" onsubmit="return SetChecked(this,\'post_to_mess_with\')" enctype="multipart/form-data">') . (isset($_GET['count']) ? '<div style="text-align: center;">' . intval($_GET['count']) . ' PMs Sent</div>' : '') . ' <!--<table border="0" cellspacing="5" cellpadding="10" width="100%">--> <table border="0" cellspacing="0" cellpadding="4" width="100%"> ' . $the_top_and_bottom . ' <tr><td class="forum_head_dark" align="left" width="100"> <img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="' . $lang['fe_topic'] . '" title="' . $lang['fe_topic'] . '" /> ' . $lang['fe_author'] . '</td> <td class="forum_head_dark" align="left" colspan="2"> ' . $lang['fe_topic'] . ': ' . $topic_name . ' [ ' . $lang['fe_read'] . ' ' . $views . ' ' . $lang['fe_times'] . ' ] </td></tr> <tr><td class="three" align="left" colspan="3">' . $lang['fe_topic_rating'] . ': ' . getRate($topic_id, "topic") . '</td></tr> <tr><td class="three" align="left" colspan="3">' . $topic_users . '</td></tr>'; //=== lets start the loop \o/ while ($arr = mysqli_fetch_assoc($res)) { //=== change colors $colour = ++$colour % 2; $class = $colour == 0 ? 'one' : 'two'; $class_alt = $colour == 0 ? 'two' : 'one'; $moodname = isset($mood['name'][$arr['mood']]) ? htmlsafechars($mood['name'][$arr['mood']]) : 'is feeling neutral'; $moodpic = isset($mood['image'][$arr['mood']]) ? htmlsafechars($mood['image'][$arr['mood']]) : 'noexpression.gif'; $post_icon = $arr['icon'] !== '' ? '<img src="' . $INSTALLER09['pic_base_url'] . 'smilies/' . htmlsafechars($arr['icon']) . '.gif" alt="icon" title="icon" /> ' : '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="icon" title="icon" /> '; $post_title = $arr['post_title'] !== '' ? ' <span style="font-weight: bold; font-size: x-small;">' . htmlsafechars($arr['post_title'], ENT_QUOTES) . '</span>' : ''; $stafflocked = $arr["staff_lock"] == 1 ? "<img src='{$INSTALLER09['pic_base_url']}locked.gif' border='0' alt='" . $lang['fe_post_locked'] . "' title='" . $lang['fe_post_locked'] . "' />" : ""; $member_reputation = $arr['username'] != '' ? get_reputation($arr, 'posts', TRUE, (int) $arr['post_id']) : ''; $edited_by = ''; if ($arr['edit_date'] > 0) {
?> " class="radio"> <input type="radio" name="price_id" id="price_<?php echo $prc->price_id; ?> " value="<?php echo $prc->price_id; ?> " <?php echo $ct == 1 ? 'checked="checked"' : ''; ?> /> <strong><?php echo lang($prc->price_name); ?> </strong> (<?php echo getRate($prc->price_value - $prc->price_value * $this->session->userdata('disco')); ?> )</label></li> <?php } ?> </ul><!-- Product Options //--> <div id="selddates"> <h4><?php echo lang('Please select a delivery date'); ?> </h4> <input type="hidden" name="product_id" value="<?php echo $product->product_id;
<th class="right"><?php //echo getRate($totals['service']); ?> </th> </tr>--> <tr> <th> </th> <th class="right">Tax</th> <th class="right"><?php echo getRate($totals['tax']); ?> </th> </tr> <tr> <th> </th> <th class="right">Total</th> <th class="right"><?php echo getRate($totals['grandtotal'] - $totals['service']); ?> </th> </tr> <!--<tr> <th> </th> <th class="right">Commision</th> <th class="right"><?php //echo getRate($totals['subtotal']*0.20); ?> </th> </tr>--> </table>
?> </td> <td style="color:#E5E5E5; font-weight:bold; font-size:18px; text-align:center;"><?php echo getRate($shipping); ?> </td> <td style="color:#E5E5E5; font-weight:bold; font-size:18px; text-align:center;"><?php echo getRate($tax); ?> </td> <td style="color:#E5E5E5; font-weight:bold; font-size:18px; text-align:center;"><?php echo getRate($other); ?> </td> <td style="color:#E5E5E5; font-weight:bold; font-size:18px; text-align:center;"><?php echo getRate($total); ?> </td> </tr> </tfoot> </tbody> </table> <p class="text-center">Go To <a href="reports">Report Search</a> </p> <?php } else { ?> <p class="text-center">Sorry No Results Found. Go Back To <a href="reports">Report Search</a></p> <?php }
function method($_POST) { # get vars extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($cusid, "num", 1, 10, "Invalid Customer number."); $v->isOk($bankid, "num", 1, 10, "Invalid Bank Account number."); # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>" . $e["msg"] . "</li>"; } $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>"; return $confirm; } // customers Drop down selections db_connect(); $sql = "SELECT * FROM customers WHERE cusnum ='{$cusid}' AND div = '" . USER_DIV . "'"; $cusRslt = db_exec($sql); $numrows = pg_numrows($cusRslt); if (empty($numrows)) { return "<li> Invalid Debtor.</li>"; } $cus = pg_fetch_array($cusRslt); $cust = "{$cus['cusname']} {$cus['surname']}"; $currs = getSymbol($cus['fcid']); $rate = getRate($cus['fcid']); if ($bankid != 0) { # Get bank account name db_connect(); $sql = "SELECT * FROM bankacct WHERE bankid = '{$bankid}' AND div = '" . USER_DIV . "'"; $bankRslt = db_exec($sql); $bank = pg_fetch_array($bankRslt); if ($bank['btype'] == 'int') { $bcur = $currs['symbol']; } else { $bcur = CUR; } } else { $bcur = CUR; $bank['accname'] = 'Cash'; $bank['bankname'] = ""; } $alls = "\n\t\t\t<select name='all'>\n\t\t\t\t<option value='0' selected>Auto</option>\n\t\t\t\t<option value='1'>Allocate To Age Analysis</option>\n\t\t\t\t<option value='2'>Allocate To Each invoice</option>\n\t\t\t</select>"; $rate = sprint($rate); // layout $add = "\n\t\t\t<h3>New International Bank Receipt</h3>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t\t<input type='hidden' name='key' value='alloc'>\n\t\t\t\t<input type='hidden' name='cusid' value='{$cusid}'>\n\t\t\t\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan='2'>Receipt Details</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Account</td>\n\t\t\t\t\t<td>{$bank['accname']} - {$bank['bankname']}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Date</td>\n\t\t\t\t\t<td>" . mkDateSelect("date") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Received from</td>\n\t\t\t\t\t<td valign='center'>{$cust}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Description</td>\n\t\t\t\t\t<td valign='center'><textarea col='18' rows='3' name='descript'></textarea></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Cheque Number</td>\n\t\t\t\t\t<td valign='center'><input size='20' name='cheqnum'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Amount</td>\n\t\t\t\t\t<td valign='center'>{$bcur} <input type='text' size='13' name='amt'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Exchange rate</td>\n\t\t\t\t\t<td valign='center'>" . CUR . " / {$cus['currency']} <input type='text' size='8' name='rate' value='{$rate}'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Allocation</td>\n\t\t\t\t\t<td>{$alls}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td><input type='button' value='< Cancel' onClick='javascript:history.back();'></td>\n\t\t\t\t\t<td valign='center'><input type='submit' value='Allocate >'></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table>"; $printCust = "\n\t\t\t<h3>Debtors Age Analysis</h3>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Acc no.</th>\n\t\t\t\t\t<th>Contact Name</th>\n\t\t\t\t\t<th>Tel No.</th>\n\t\t\t\t\t<th>Current</th>\n\t\t\t\t\t<th>30 days</th>\n\t\t\t\t\t<th>60 days</th>\n\t\t\t\t\t<th>90 days</th>\n\t\t\t\t\t<th>120 days</th>\n\t\t\t\t\t<th>Total Outstanding</th>\n\t\t\t\t</tr>"; $curr = sprint(age($cusid, 29)); $age30 = sprint(age($cusid, 59)); $age60 = sprint(age($cusid, 89)); $age90 = sprint(age($cusid, 119)); $age120 = sprint(age($cusid, 149)); # Customer total $custtot = $curr + $age30 + $age60 + $age90 + $age120; $custtot = sprint($custtot); # Alternate bgcolor $printCust .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$cus['accno']}</td>\n\t\t\t\t<td>{$cus['contname']}</td>\n\t\t\t\t<td>{$cus['tel']}</td>\n\t\t\t\t<td>{$cus['currency']} {$curr}</td>\n\t\t\t\t<td>{$cus['currency']} {$age30}</td>\n\t\t\t\t<td>{$cus['currency']} {$age60}</td>\n\t\t\t\t<td>{$cus['currency']} {$age90}</td>\n\t\t\t\t<td>{$cus['currency']} {$age120}</td>\n\t\t\t\t<td>{$cus['currency']} {$custtot}</td>\n\t\t\t</tr>"; $printCust .= "<tr><td><br></td></tr></table>"; $OUTPUT = "\n\t\t\t<center>\n\t\t\t<table border='0' width='100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width='65%' align='left'>{$add}</td>\n\t\t\t\t\t<td valign='top' align='center'>\n\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='65%'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</center>\n\t\t\t{$printCust}"; return $OUTPUT; }
" alt="<?php echo $row->alternate_text; ?> " title="<?php echo $row->alternate_text; ?> " width="186" height="208"/></a> <a class="product-name" href="/<?php echo $upath . $row->url; ?> "><?php echo rightLang($row->product_name, $row->product_name_fr); ?> </a> <br><span class="oprice"></span><?php echo getRate($row->price_value); ?> <br> <span class="shopnow"><a href="/<?php echo $upath . $row->url; ?> "><img border="0" width="59" height="16" src="<?php echo theme_url(); ?> /images/<?php echo imgLang('shopnow59x16-LN.gif'); ?> "></a></span> <div class="delvinfo"> <?php
if ($totals['surcharge'] > 0) { ?> <p> <?php echo getRate($totals['surcharge']); ?> </p> <?php } ?> <p><?php echo getRate($total_tax); ?> </p> <p><strong><?php echo getRate($total_price + $total_shipping + $total_tax); ?> </strong></p> </td> </tr> </table> </td> </tr> </table> </div>
<td><?php echo getRate($order->shipping); ?> </td> </tr> <tr> <td>Tax</td> <td><?php echo getRate($order->tax); ?> </td> </tr> <tr> <td>Grand Total</td> <td><?php echo getRate($order->amount + $order->shipping + $order->tax); ?> </td> </tr> </table> </div> </div><!-- Span6 //--> </div><!-- Row Fluid //--> </div><!-- Tab Pane //--> <?php } ?> </div><!-- Tab Content //--> <script> $(function () {
echo getRate($Mer_total); ?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px; background-color:#4A708B;"><?php echo getRate($Shipping_total); ?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px; background-color:#4A708B;"><?php echo getRate($Tax_total); ?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px; background-color:#4A708B;"><?php echo getRate($Others_total); ?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px; background-color:#4A708B;"><?php echo getRate($Grand_total); ?> </th> <th class="right" style="color:#E5E5E5; font-weight:bold; font-size:18px; background-color:#4A708B;"><?php echo getRate($Commission_total); ?> </th> </tr> </tfoot> </tbody> </table> </body> </html>