# Get Returned Variables $merchant_order_id = $_POST["merchant_order_id"]; $razorpay_payment_id = $_POST["razorpay_payment_id"]; # Checks invoice ID is a valid invoice number or ends processing $merchant_order_id = checkCbInvoiceID($merchant_order_id, $GATEWAY["name"]); # Checks transaction number isn't already in the database and ends processing if it does checkCbTransID($razorpay_payment_id); # Fetch invoice to get the amount $result = mysql_fetch_assoc(select_query('tblinvoices', 'total', array("id" => $merchant_order_id))); $amount = $result['total']; # Check if amount is INR, convert if not. $currency = getCurrency(); if ($currency['code'] !== 'INR') { $result = mysql_fetch_array(select_query("tblcurrencies", "id", array("code" => 'INR'))); $inr_id = $result['id']; $converted_amount = convertCurrency($amount, $currency['id'], $inr_id); } else { $converted_amount = $amount; } # Amount in Paisa $converted_amount = 100 * $converted_amount; $success = true; $error = ""; try { $url = 'https://api.razorpay.com/v1/payments/' . $razorpay_payment_id . '/capture'; $fields_string = "amount={$converted_amount}"; //cURL Request $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERPWD, $key_id . ":" . $key_secret);
/** * * @ WHMCS FULL DECODED & NULLED * * @ Version : 5.2.15 * @ Author : MTIMER * @ Release on : 2013-12-24 * @ Website : http://www.mtimer.cn * **/ function affiliateActivate($userid) { global $CONFIG; $result = select_query("tblclients", "currency", array("id" => $userid)); $data = mysql_fetch_array($result); $clientcurrency = $data['currency']; $bonusdeposit = convertCurrency($CONFIG['AffiliateBonusDeposit'], 1, $clientcurrency); $result = select_query("tblaffiliates", "id", array("clientid" => $userid)); $data = mysql_fetch_array($result); $affiliateid = $data['id']; if (!$affiliateid) { $affiliateid = insert_query("tblaffiliates", array("date" => "now()", "clientid" => $userid, "balance" => $bonusdeposit)); } logActivity("Activated Affiliate Account - Affiliate ID: " . $affiliateid . " - User ID: " . $userid, $userid); run_hook("AffiliateActivation", array("affid" => $affiliateid, "userid" => $userid)); }
/** * * @ WHMCS FULL DECODED & NULLED * * @ Version : 5.2.15 * @ Author : MTIMER * @ Release on : 2013-12-24 * @ Website : http://www.mtimer.cn * **/ function tcoconvertcurrency($amount, $currency, $invoiceid) { $result = select_query("tblcurrencies", "id", array("code" => $currency)); $data = mysql_fetch_array($result); $currencyid = $data['id']; if (!$currencyid) { logTransaction($GATEWAY['name'], $_POST, "Unrecognised Currency"); exit; } $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid)); $data = mysql_fetch_array($result); $userid = $data['userid']; $total = $data['total']; $currency = getCurrency($userid); if ($currencyid != $currency['id']) { $amount = convertCurrency($amount, $currencyid, $currency['id']); if ($total < $amount + 1 && $amount - 1 < $total) { $amount = $total; } } return $amount; }
function calculateAffiliateCommission($affid, $relid, $lastpaid = "") { global $CONFIG; static $AffCommAffiliatesData = array(); $percentage = $fixedamount = ""; $result = select_query("tblproducts", "tblproducts.affiliateonetime,tblproducts.affiliatepaytype,tblproducts.affiliatepayamount,tblhosting.amount,tblhosting.firstpaymentamount,tblhosting.billingcycle,tblhosting.userid,tblclients.currency", array("tblhosting.id" => $relid), "", "", "", "tblhosting ON tblhosting.packageid=tblproducts.id INNER JOIN tblclients ON tblclients.id=tblhosting.userid"); $data = mysql_fetch_array($result); $userid = $data['userid']; $billingcycle = $data['billingcycle']; $affiliateonetime = $data['affiliateonetime']; $affiliatepaytype = $data['affiliatepaytype']; $affiliatepayamount = $data['affiliatepayamount']; $clientscurrency = $data['currency']; $amount = $lastpaid == "0000-00-00" || $billingcycle == "One Time" || $affiliateonetime ? $data['firstpaymentamount'] : $data['amount']; if ($affiliatepaytype == "none") { return "0.00"; } if ($affiliatepaytype) { if ($affiliatepaytype == "percentage") { $percentage = $affiliatepayamount; } else { $fixedamount = $affiliatepayamount; } } if (isset($AffCommAffiliatesData[$affid])) { $data = $AffCommAffiliatesData[$affid]; } else { $result = select_query("tblaffiliates", "clientid,paytype,payamount,(SELECT currency FROM tblclients WHERE id=clientid) AS currency", array("id" => $affid)); $data = mysql_fetch_array($result); $AffCommAffiliatesData[$affid] = $data; } $affuserid = $data['clientid']; $paytype = $data['paytype']; $payamount = $data['payamount']; $affcurrency = $data['currency']; if ($paytype) { $percentage = $fixedamount = ""; if ($paytype == "percentage") { $percentage = $payamount; } else { $fixedamount = $payamount; } } if (!$fixedamount && !$percentage) { $percentage = $CONFIG['AffiliateEarningPercent']; } $commission = $fixedamount ? convertCurrency($fixedamount, 1, $affcurrency) : convertCurrency($amount, $clientscurrency, $affcurrency) * ($percentage / 100); run_hook("CalcAffiliateCommission", array("affid" => $affid, "relid" => $relid, "amount" => $amount, "commission" => $commission)); $commission = format_as_currency($commission); return $commission; }
$pdf->AddCol('item', '50%', 'Item', 'L'); $pdf->AddCol('pr_qty', '15%', 'Quantity', 'R'); $pdf->AddCol('pr_rate', '15%', 'Rate', 'R'); $pdf->AddCol('amt', '15%', 'Amount', 'R'); $pdf->Table($data, $prop); $_cMargin = $pdf->cMargin; $pdf->cMargin = $prop['padding']; $pdf->SetFont($prop['thfont'][0], $prop['thfont'][1], $prop['thfont'][2]); $width = $pdf->w - $pdf->lMargin - $pdf->rMargin; $cellSize = 0.01 * $width; $pdf->Cell($cellSize * 45, 6, 'Total', 0, 0, 'C', false); $pdf->Cell($cellSize * 20, 6, number_format($total['qty']), 0, 0, 'R', false); $pdf->Cell($cellSize * 15, 6, '', 0, 0, 'L', false); $pdf->Cell($cellSize * 20, 6, number_format($total['amt']), 0, 0, 'R', false); $pdf->Ln(); $pdf->Cell($cellSize * 100, 5, convertCurrency($total['amt'], getCurrencySymbol($_SESSION['company_id'])) . " only", 0, 0, 'L'); $pdf->Ln(); $pdf->cMargin = $_cMargin; } $mysqli->close(); $pdf->Output("purchase_return.pdf", "D"); } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="shortcut icon" href="../images/logo_icon.gif"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="../stylesheets/style.css" rel="stylesheet" type="text/css" /> <title><?php echo $_SESSION['companyname'];
$md5_hash = $_REQUEST['md5_hash']; checkCbTransID($transid); $ourhash = md5($GATEWAY['md5hash'] . $GATEWAY['loginid'] . $transid . $amount); if ($ourhash != $md5_hash) { logTransaction("Quantum Gateway", $_REQUEST, "MD5 Hash Failure"); echo "Hash Failure. Please Contact Support."; exit; } $callbacksuccess = false; $invoiceid = checkCbInvoiceID($invoiceid, "Quantum Gateway"); if ($GATEWAY['convertto']) { $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid)); $data = mysql_fetch_array($result); $userid = $data['userid']; $total = $data['total']; $currency = getCurrency($userid); $amount = convertCurrency($amount, $GATEWAY['convertto'], $currency['id']); if ($total < $amount + 1 && $amount - 1 < $total) { $amount = $total; } } if ($transresult == "APPROVED") { addInvoicePayment($invoiceid, $transid, $amount, "", "quantumgateway", "on"); logTransaction("Quantum Gateway", $_REQUEST, "Approved"); sendMessage("Credit Card Payment Confirmation", $invoiceid); $callbacksuccess = true; } else { logTransaction("Quantum Gateway", $_REQUEST, "Declined"); sendMessage("Credit Card Payment Failed", $invoiceid); } callback3DSecureRedirect($invoiceid, $callbacksuccess);
} } $result = select_query("tblcurrencies", "id", array("code" => $currency)); $data = mysql_fetch_array($result); $currencyid = $data['id']; if (!$currencyid) { logTransaction("Moneybookers", $_REQUEST, "Unrecognised Currency"); exit; } if ($GATEWAY['convertto']) { $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid)); $data = mysql_fetch_array($result); $userid = $data['userid']; $total = $data['total']; $currency = getCurrency($userid); $amount = convertCurrency($amount, $currencyid, $currency['id']); if ($total < $amount + 1 && $amount - 1 < $total) { $amount = $total; } } if ($_POST['status'] == "2") { $invoiceid = checkCbInvoiceID($invoiceid, "Moneybookers"); if ($invoiceid) { addInvoicePayment($invoiceid, $transid, $amount, "", "moneybookers"); logTransaction("Moneybookers", $_REQUEST, "Successful"); return 1; } logTransaction("Moneybookers", $_REQUEST, "Error"); return 1; } logTransaction("Moneybookers", $_REQUEST, "Unsuccessful");
<?php session_start(); require_once '../includes/connecti.php'; require_once '../includes/funcs.inc.php'; if (isset($_GET['report']) && $_GET['report'] == 'true') { $MAX_LIMIT = 8; require_once '../includes/fpdf.php'; $pdf = new FPDF('L', 'cm', array(7.7, 15.9)); $pdf->SetAuthor("*****@*****.**"); $pdf->SetSubject("Cheque"); $pdf->SetTitle("Cheque"); $pdf->SetCreator("Imran Zahid"); $pdf->AddPage(); $pdf->SetFont('Arial', '', 12); $amt = explode(' ', convertCurrency($_GET['amount']) . " Only."); $str1 = ""; $sep = ""; $w = 0; $counter = 0; do { $temp = $str1 . $sep . $amt[$counter]; $w = $pdf->GetStringWidth($temp); if ($w < $MAX_LIMIT) { $str1 .= $sep . $amt[$counter]; $sep = " "; $counter++; } if ($counter > count($amt)) { break; }
use_class('products_minierp'); $class_sp = new jng_sp(); $class_pm = new products_minierp(); //BEFORE DOING ANYTHING, FIRST WE NEED TO SET MATEXP AND COGS OF NEW ORDERS $timestamp_new_orders_checker = strtotime('-2 days'); $jg_counter = 0; $sp_counter = 0; $q = "SELECT * FROM ((" . " SELECT" . " 0 AS jng_sp_id," . " op.orders_products_id AS item_id," . " o.date_purchased AS order_date," . " op.products_id," . " op.products_model AS products_code," . " op.material_expenses AS item_matexp," . " op.cogs AS item_cogs," . " p.material_expenses" . " FROM orders o" . " INNER JOIN orders_products op ON op.orders_id = o.orders_id" . " LEFT JOIN products p ON p.products_id = op.products_id" . " WHERE (op.material_expenses = 0 OR op.cogs = 0)" . " AND op.orders_products_id > 0" . " AND p.material_expenses > 0" . ") UNION ALL (" . " SELECT" . " jo.jng_sp_id," . " joi.jng_sp_orders_items_id AS item_id," . " jo.order_date," . " joi.products_id," . " joi.article_number AS products_code," . " joi.material_expenses AS item_matexp," . " joi.cogs AS item_cogs," . " p.material_expenses" . " FROM jng_sp_orders jo" . " INNER JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id = jo.jng_sp_orders_id" . " LEFT JOIN products p ON p.products_id = joi.products_id" . " WHERE (joi.material_expenses = 0 OR joi.cogs = 0)" . " AND joi.jng_sp_orders_items_id > 0" . " )) temp_table" . " ORDER BY item_id"; //" LIMIT 10000"; $r = tep_db_query($q); while ($row = tep_db_fetch_array($r)) { $order_date_timestamp = strtotime($row['order_date']); $p = new Product($row['products_id']); //By default we will always use the current material expense and cogs //it needs to be converted to local currency $matexp = convertCurrency($row['material_expenses'], CURRENCY_CODE_EURO, CURRENCY_DEFAULT); $cogs = $p->getProductCOGSValue(); if ($order_date_timestamp < $timestamp_new_orders_checker) { $matexp = Product::getClosestMaterialExpensesOnSpecificDate($row['products_id'], $row['order_date'], $matexp); $cogs = Product::getClosestCOGSOnSpecificDate($row['products_id'], $row['order_date'], $cogs); } //echo $row['jng_sp_id'] . ' - ' . $row['item_id'] . ' - ' . //$row['products_code'] . ' - ' . $matexp; if ($matexp > 0 && $cogs > 0) { $sda = array(); if ($row['item_matexp'] == 0) { $sda['material_expenses'] = $matexp; } if ($row['item_cogs'] == 0) { $sda['cogs'] = $cogs; }
header('HTTP/1.1 400 Bad Request'); exit('Your request could not be completed'); break; } if ($gateway['instantpaid'] == on) { # The "Instant Activation" option is enabled, so we need to mark now # convert currency where necessary (GoCardless only handles GBP) $aCurrency = getCurrency($res['userid']); if ($gateway['convertto'] && $aCurrency['id'] != $gateway['convertto']) { # the users currency is not the same as the GoCardless currency, convert to the users currency $oBill->amount = convertCurrency($oBill->amount, $gateway['convertto'], $aCurrency['id']); $oBill->gocardless_fee = convertCurrency($oBill->gocardless_fee, $gateway['convertto'], $aCurrency['id']); # currency conversion on the setup fee bill if (isset($oSetupBill)) { $oSetupBill->amount = convertCurrency($oBill->amount, $gateway['convertto'], $aCurrency['id']); $oSetupBill->gocardless_fee = convertCurrency($oBill->gocardless_fee, $gateway['convertto'], $aCurrency['id']); } } # check if we are handling a preauth setup fee # if we are then we need to add it to the total bill if (isset($oSetupBill)) { addInvoicePayment($invoiceID, $oSetupBill->id, $oSetupBill->amount, $oSetupBill->gocardless_fees, $gateway['paymentmethod']); logTransaction($gateway['paymentmethod'], 'Setup fee of ' . $oSetupBill->amount . ' raised and logged for invoice ' . $invoiceID . ' with GoCardless ID ' . $oSetupBill->id, 'Successful'); } # Log the payment for the amount of the main bill against the inovice addInvoicePayment($invoiceID, $oBill->id, $oBill->amount, $oBill->gocardless_fees, $gateway['paymentmethod']); logTransaction($gateway['paymentmethod'], 'Bill of ' . $oBill->amount . ' raised and logged for invoice ' . $invoiceID . ' with GoCardless ID ' . $oBill->id, 'Successful'); } else { # Instant activation isn't enabled, so we will log in the Gateway Log but will not put anything on the invoice if (isset($oSetupBill)) { logTransaction($gateway['paymentmethod'], 'Setup fee bill ' . $oSetupBill->id . ' (' . $oSetupBill->amount . ') and bill ' . $oBill->id . ' (' . $oBill->amount . ') raised with GoCardless for invoice ' . $invoiceID . ', but not marked on invoice.', 'Pending');
case "Pagamento": break; case "Pagamento Online": $Taxa = $ProdValor * 2.9 / 100 + 0.4; break; case "Cartro de Crndito": $Taxa = $ProdValor * 6.4 / 100 + 0.4; } $result = select_query("tblinvoices", "userid,status", array("id" => $invoiceid)); $payments = mysql_fetch_array($result); $userid = $payments['userid']; $status = $payments['status']; if ($GATEWAY['convertto']) { $currency = getCurrency($userid); $ProdValor = convertCurrency($ProdValor, $GATEWAY['convertto'], $currency['id']); $Taxa = convertCurrency($Taxa, $GATEWAY['convertto'], $currency['id']); } if ($GATEWAY['email'] != $VendedorEmail) { logTransaction("PagSeguro", $_REQUEST, "Invalid Vendor Email"); return 1; } if ($StatusTransacao == "Aprovado") { if ($status == "Unpaid") { addInvoicePayment($invoiceid, $TransacaoID, $ProdValor, $Taxa, "pagseguro"); } logTransaction("PagSeguro", $_REQUEST, "Incomplete"); redirSystemURL("id=" . $invoiceid . "&paymentsuccess=true", "viewinvoice.php"); return 1; } if ($StatusTransacao == "Completo") { $result = select_query("tblinvoices", "status", array("id" => $invoiceid));
function addItem($elements_id, $supplier_code, $qty, $qty_unit, $unit_multiplier, $unit_price, $unit_price_currency, $username) { use_class('element'); $e = new element($elements_id); if (is_null($this->orders_id) && !is_null($this->suppliers_id)) { $this->createNew($unit_price_currency, $username); } $unit_price_order_currency = $this->detail['currency'] == $unit_price_currency ? $unit_price : convertCurrency($unit_price, $unit_price_currency, $this->detail['currency']); $sda = array(); $sda['elements_orders_id'] = $this->orders_id; $sda['elements_id'] = $elements_id; $sda['elements_weight'] = $e->detail['weight']; $sda['item_number'] = $supplier_code; $sda['quantity_request'] = $qty; $sda['quantity'] = '0'; $sda['quantity_unit'] = $qty_unit; $sda['unit_multiplier'] = $unit_multiplier; $sda['unit_price'] = $unit_price; $sda['unit_price_currency'] = $unit_price_currency; $sda['unit_price_order_currency'] = $unit_price_order_currency; $sda['add_date'] = date('Y-m-d'); $sda['add_by'] = $username; tep_db_perform('elements_orders_items', $sda); $this->loadItems(); }
public function getProducts($gid, $inclconfigops = false, $inclbundles = false) { global $currency; if (!$gid) { $result = select_query("tblproductgroups", "id", array("hidden" => ""), "order", "ASC"); $data = mysql_fetch_array($result); $gid = $data[0]; } $tmparray = array(); $result = select_query("tblproducts", "", array("gid" => $gid, "hidden" => ""), "order` ASC,`name", "ASC"); while ($data = mysql_fetch_array($result)) { $id = $data['id']; $type = $data['type']; $name = $data['name']; $description = $data['description']; $paytype = $data['paytype']; $freedomain = $data['freedomain']; $stockcontrol = $data['stockcontrol']; $qty = $data['qty']; $freedomainpaymentterms = $data['freedomainpaymentterms']; $sortorder = $data['order']; $freedomainpaymentterms = explode(",", $freedomainpaymentterms); $desc = $this->formatProductDescription($description); $product = array(); $product['pid'] = $id; $product['type'] = $type; $product['name'] = $name; $product['description'] = $desc['original']; $product['features'] = $desc['features']; $product['featuresdesc'] = $desc['featuresdesc']; $product['paytype'] = $paytype; $product['pricing'] = getPricingInfo($id, $inclconfigops); $product['freedomain'] = $freedomain; $product['freedomainpaymentterms'] = $freedomainpaymentterms; if ($stockcontrol) { $product['qty'] = $qty; } $tmparray[$sortorder][] = $product; } if ($inclbundles) { $result = select_query("tblbundles", "", array("showgroup" => "1", "gid" => $gid)); while ($data = mysql_fetch_array($result)) { $description = $data['description']; $desc = $this->formatProductDescription($description); $displayprice = $data['displayprice']; $displayprice = 0 < $displayprice ? formatCurrency(convertCurrency($displayprice, 1, $currency['id'])) : ""; $tmparray[$data['sortorder']][] = array("bid" => $data['id'], "name" => $data['name'], "description" => $desc['original'], "features" => $desc['features'], "featuresdesc" => $desc['featuresdesc'], "displayprice" => $displayprice); } } ksort($tmparray); $productsarray = array(); foreach ($tmparray as $sort => $items) { foreach ($items as $item) { $productsarray[] = $item; } } return $productsarray; }
logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Failure 3 (Transaction not open)'); header('HTTP/1.1 500 Transaction not open'); exit; } // Get user and transaction currencies $userCurrency = getCurrency($transaction['userid']); $transactionCurrency = select_query('tblcurrencies', '', array('id' => $transaction['currencyid'])); $transactionCurrency = mysql_fetch_assoc($transactionCurrency); // Check payment $mollie = new Mollie_API_Client(); $mollie->setApiKey($_GATEWAY['key']); $payment = $mollie->payments->get($_POST['id']); if ($payment->isPaid()) { // Add conversion, when there is need to. WHMCS only supports currencies per user. WHY?! if ($transactionCurrency['id'] != $userCurrency['id']) { $transaction['amount'] = convertCurrency($transaction['amount'], $transaction['currencyid'], $userCurrency['id']); } // Check invoice $invoiceid = checkCbInvoiceID($transaction['invoiceid'], $_GATEWAY['paymentmethod']); checkCbTransID($transaction['paymentid']); // Add invoice addInvoicePayment($invoiceid, $transaction['paymentid'], $transaction['amount'], '', $_GATEWAY['paymentmethod']); update_query('gateway_mollie', array('status' => 'paid', 'updated' => date('Y-m-d H:i:s', time())), array('id' => $transaction['id'])); logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Paid)'); header('HTTP/1.1 200 OK'); exit; } else { if ($payment->isOpen() == FALSE) { update_query('gateway_mollie', array('status' => 'closed', 'updated' => date('Y-m-d H:i:s', time())), array('id' => $transaction['id'])); logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Closed)'); header('HTTP/1.1 200 OK');
$newline = 0; } $pdf->Cell($cw, $line_height, $ctitle[$cwkey], 1, $newline, 'C', true); } } $counter++; $xpos = $margin_left + $cwidth[0]; $img_file = basename(webImageSource($e_detail->image, '', '80', '80')); $img = $img_path . $img_file; if ($img != $img_path) { $test = getimagesize($img); if ($test[2] == 2) { $pdf->Image($img, $xpos + $img_boxpad, $ypos + $img_boxpad, $img_size, $img_size); } } $unit_price = convertCurrency($e['unit_price'], $e['unit_price_currency'], $currency); $qty_price = $e['quantity'] * $unit_price; $qty_weight = $e['quantity'] * $e['unit_multiplier'] * $e['elements_weight']; $total_price += $qty_price; $cellcontent = array(); $cellcontent[] = $counter; $cellcontent[] = ''; $cellcontent[] = $e['elements_id']; $cellcontent[] = $e['item_number']; $cellcontent[] = $e['quantity'] . ' ' . $e['quantity_unit'] . ($e['approved_by'] == '' ? ' *' : ''); $cellcontent[] = displayCurrency($currency, $unit_price) . "\n(" . $e['elements_weight'] . ' gram)'; $cellcontent[] = displayCurrency($currency, $qty_price) . "\n(" . $qty_weight . ' gram)'; if ($eo->suppliers_id == '2') { $cellcontent[] = ''; $cellcontent[] = ''; }
$_SESSION["locate"] = $selected_val; $_SESSION["image_selected"] = $print_hair_res; $_SESSION["set_price"] = $print_hair_price; $_SESSION["set_style"] = $print_hair; } if ($selected_val == "paris") { $print_hair_price = convertCurrency("" . $print_hair_price . "", "GBP", "FRF"); $print_hair_price = " " . $print_hair_price . " franc</p>"; echo $print_hair_price; $_SESSION["locate"] = $selected_val; $_SESSION["image_selected"] = $print_hair_res; $_SESSION["set_price"] = $print_hair_price; $_SESSION["set_style"] = $print_hair; } else { if ($selected_val == "new york") { $print_hair_price = convertCurrency("" . $print_hair_price . "", "GBP", "USD"); $print_hair_price = " " . $print_hair_price . " dollars</p>"; echo $print_hair_price; $_SESSION["locate"] = $selected_val; $_SESSION["image_selected"] = $print_hair_res; $_SESSION["set_price"] = $print_hair_price; $_SESSION["set_style"] = $print_hair; } } echo '<input type="image" title="Make a Booking" value="' . $print_hair_res . '" src="../assets/fab.png" alt="fab" style="width:20%;position: absolute; right: 0; bottom: 0; " name="button"><br/> </form> </div> ';
case "web_accept": if ($payment_status != "Completed") { logTransaction("PayPal", $orgipn, "Incomplete"); exit; } } $result = select_query("tblinvoices", "", array("id" => $idnumber)); $data = mysql_fetch_array($result); $invoiceid = $data['id']; $userid = $data['userid']; if ($invoiceid) { logTransaction("PayPal", $orgipn, "Successful"); $currency = getCurrency($userid); if ($paypalcurrencyid != $currency['id']) { $mc_gross = convertCurrency($mc_gross, $paypalcurrencyid, $currency['id']); $mc_fee = convertCurrency($mc_fee, $paypalcurrencyid, $currency['id']); $result = select_query("tblinvoices", "total", array("id" => $invoiceid)); $data = mysql_fetch_array($result); $total = $data['total']; if ($total < $mc_gross + 1 && $mc_gross - 1 < $total) { $mc_gross = $total; } } addInvoicePayment($invoiceid, $txn_id, $mc_gross, $mc_fee, "paypal"); $result = select_query("tblinvoiceitems", "", array("invoiceid" => $invoiceid, "type" => "Hosting")); $data = mysql_fetch_array($result); $relid = $data['relid']; update_query("tblhosting", array("subscriptionid" => $subscr_id), array("id" => $relid)); exit; } if ($txn_type == "subscr_payment") {
$pdf->AddCol('sno', '5%', 'S.No.', 'L'); if ($showcat === true) { $pdf->AddCol('barcode', '12%', 'BarCode', 'L'); $pdf->AddCol('description', '18%', 'Item', 'L'); } else { $pdf->AddCol('description', '30%', 'Item', 'L'); } $pdf->AddCol('raw_qty', '8%', 'Quantity', 'R'); $pdf->AddCol('packing_desc', '12%', 'Packing', 'L'); $pdf->AddCol('unit', '6%', 'Unit', 'L'); $pdf->AddCol('sales_rate', '8%', 'Rate', 'R'); $pdf->AddCol('amount', '11%', 'Amount', 'R'); $pdf->AddCol('discount_value', '9%', 'Discount', 'R'); $pdf->AddCol('net', '11%', 'Net', 'R'); $pdf->Table($ddata, $prop); $currency = convertCurrency($net) . " only"; $pdf->cMargin = $cMargin; } $mysqli->close(); $fileName = "estimates"; if (isset($_GET['invoice']) && strlen($_GET['invoice']) > 0) { $fileName .= "_{$_GET['invoice']}"; } else { if (isset($_GET['party']) && strlen($_GET['party']) > 0) { $fileName .= "_{$_GET['party']}"; } } $pdf->Output("{$fileName}.pdf", "D"); } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
/** * Get past material expense closest to the specified date.<br /> * <b>IMPORTANT NOTICE:</b> It is grabbed from order data, * therefore it is already converted in local currency * @param Int $products_id Product ID * @param String $date Date to be searched * @param Float $current_matexp Current material expense * @return Float */ public static function getClosestMaterialExpensesOnSpecificDate($products_id, $date, $current_matexp = null) { $date = date('Y-m-d', strtotime($date)); $date_start = date('Y-m-d', strtotime($date . ' -10 days')); $date_end = date('Y-m-d', strtotime($date . ' +10 days')); $q2 = "SELECT material_expenses FROM jng_sp_orders_items" . " WHERE products_id = {$products_id}" . " AND shipping_window_open >= '{$date_start}'" . " AND shipping_window_open <= '{$date_end}'" . " AND material_expenses > 0" . " ORDER BY RAND() LIMIT 1"; $r2 = tep_db_query($q2); if (tep_db_num_rows($r2) > 0) { $row2 = tep_db_fetch_array($r2); $matexp = $row2['material_expenses']; } else { //check latest order after $q3 = "SELECT material_expenses FROM jng_sp_orders_items" . " WHERE products_id = {$products_id}" . " AND shipping_window_open >= '{$date_start}'" . " AND material_expenses > 0" . " ORDER BY shipping_window_open ASC LIMIT 1"; $r3 = tep_db_query($q3); if (tep_db_num_rows($r3) > 0) { $row3 = tep_db_fetch_array($r3); $matexp = $row3['material_expenses']; } else { //check previous order before $q4 = "SELECT material_expenses FROM jng_sp_orders_items" . " WHERE products_id = {$products_id}" . " AND shipping_window_open <= '{$date_start}'" . " AND material_expenses > 0" . " ORDER BY shipping_window_open DESC LIMIT 1"; $r4 = tep_db_query($q4); if (tep_db_num_rows($r4) > 0) { $row4 = tep_db_fetch_array($r4); $matexp = $row4['material_expenses']; } else { if (is_null($current_matexp)) { $p = self::getOldProductFunction()->retrieveDetail($products_id, 'p'); $matexp = convertCurrency($p['p']['material_expenses'], CURRENCY_CODE_EURO, CURRENCY_DEFAULT); } else { $matexp = $current_matexp; } } } } return $matexp; }
function bundlesGetProductPriceOverride($type, $key) { global $currency; $proddata = $_SESSION['cart'][$type . "s"][$key]; $prodbundleddomain = false; if (!isset($proddata['bnum']) && $type == "domain") { $domain = $proddata['domain']; if (is_array($_SESSION['cart']['prodbundleddomains'][$domain])) { $proddata['bnum'] = $_SESSION['cart']['prodbundleddomains'][$domain][0]; $proddata['bitem'] = $_SESSION['cart']['prodbundleddomains'][$domain][1]; } } if (!isset($proddata['bnum'])) { return false; } $bid = $_SESSION['cart']['bundle'][$proddata['bnum']]['bid']; if (!$bid) { return false; } $bundlewarnings = $_SESSION['cart']['bundle'][$proddata['bnum']]['warnings']; if ($bundlewarnings) { return false; } $data = get_query_vals("tblbundles", "", array("id" => $bid)); $itemdata = $data['itemdata']; $itemdata = unserialize($itemdata); if ($type == "product" && $itemdata[$proddata['bitem']]['priceoverride']) { return convertCurrency($itemdata[$proddata['bitem']]['price'], 1, $currency['id']); } if ($type == "domain" && $itemdata[$proddata['bitem']]['dompriceoverride']) { return convertCurrency($itemdata[$proddata['bitem']]['domprice'], 1, $currency['id']); } return false; }
$signups = $data[0]; $result = select_query("tblaffiliatespending", "SUM(tblaffiliatespending.amount)", array("affiliateid" => $id), "clearingdate", "DESC", "", "tblaffiliatesaccounts ON tblaffiliatesaccounts.id=tblaffiliatespending.affaccid INNER JOIN tblhosting ON tblhosting.id=tblaffiliatesaccounts.relid INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid INNER JOIN tblclients ON tblclients.id=tblhosting.userid"); $data = mysql_fetch_array($result); $pendingcommissions = $data[0]; $conversionrate = round($signups / $visitors * 100, 2); $smarty->assign("affiliateid", $id); $smarty->assign("referrallink", $CONFIG['SystemURL'] . "/aff.php?aff=" . $id); $smarty->assign("date", $date); $smarty->assign("visitors", $visitors); $smarty->assign("signups", $signups); $smarty->assign("conversionrate", $conversionrate); $smarty->assign("pendingcommissions", formatCurrency($pendingcommissions)); $smarty->assign("balance", formatCurrency($balance)); $smarty->assign("withdrawn", formatCurrency($withdrawn)); $affpayoutmin = $CONFIG['AffiliatePayout']; $affpayoutmin = convertCurrency($affpayoutmin, 1, $currency['id']); if ($affpayoutmin <= $balance) { $smarty->assign("withdrawlevel", "true"); if ($action == "withdrawrequest") { $deptid = ""; if ($CONFIG['AffiliateDepartment']) { $deptid = get_query_val("tblticketdepartments", "id", array("id" => $CONFIG['AffiliateDepartment'])); } if (!$deptid) { $deptid = get_query_val("tblticketdepartments", "id", array("hidden" => ""), "order", "ASC"); } $message = "Affiliate Account Withdrawal Request. Details below:\n\nClient ID: " . $_SESSION['uid'] . ("\nAffiliate ID: " . $id . "\nBalance: " . $balance); $ticketdetails = openNewTicket($_SESSION['uid'], $_SESSION['cid'], $deptid, "Affiliate Withdrawal Request", $message, "Medium"); redir("withdraw=1"); } }
$pdf->AddCol('item', '50%', 'Item', 'L'); $pdf->AddCol('pr_qty', '15%', 'Quantity', 'R'); $pdf->AddCol('pr_rate', '15%', 'Rate', 'R'); $pdf->AddCol('amt', '15%', 'Amount', 'R'); $pdf->Table($data, $prop); $_cMargin = $pdf->cMargin; $pdf->cMargin = $prop['padding']; $pdf->SetFont($prop['thfont'][0], $prop['thfont'][1], $prop['thfont'][2]); $width = $pdf->w - $pdf->lMargin - $pdf->rMargin; $cellSize = 0.01 * $width; $pdf->Cell($cellSize * 45, 6, 'Total', 0, 0, 'C', false); $pdf->Cell($cellSize * 20, 6, number_format($total['qty']), 0, 0, 'R', false); $pdf->Cell($cellSize * 15, 6, '', 0, 0, 'L', false); $pdf->Cell($cellSize * 20, 6, number_format($total['amt']), 0, 0, 'R', false); $pdf->Ln(); $pdf->Cell($cellSize * 100, 5, convertCurrency($total['amt']) . " only", 0, 0, 'L'); $pdf->Ln(); $pdf->cMargin = $_cMargin; } $mysqli->close(); $pdf->Output("purchase_return.pdf", "D"); } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="shortcut icon" href="../images/logo_icon.gif"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="../stylesheets/style.css" rel="stylesheet" type="text/css" /> <title><?php echo $_SESSION['companyname'];
$voyages = array(); $voyages = Catalog::get_catalog(); ?> <br> <div class="ui four stackable cards"> <?php foreach ($voyages as $key => $value) { $images = array(); $cover_image = $value['cover_image']; if (!empty($cover_image)) { $images['feature_image'] = $cover_image->feature_image; $images['gallery'] = $cover_image->gallery; } if ($value['price']) { $price = convertCurrency($value['price'], $value['currency'], Helpers::get_currency()) . ' ' . Helpers::get_currency(); } else { $price = __('Not available', 'sage'); } $title = $value['title']; $excerpt = $value['excerpt']; $mailto = 'mailto:' . Helpers::get_email() . '?subject= Offre ' . $value['title']; $contact = ["mail" => $mailto, "modal" => "modal-card-details"]; $website_url = $value['website']; $website_name = $value['website_name']; Card::display_card_full(false, $title, $images, $excerpt, $price, $website_url, $website_name, $contact, [], $value); } ?> </div> <br>
$pdf->printHeader(); $cMargin = $pdf->cMargin; $pdf->cMargin = $prop['padding']; $pdf->AddCol('sno', '6%', 'S.No.', 'L'); $pdf->AddCol('cno', '6%', 'Cno', 'L'); $pdf->AddCol('manufacturer_no', '15%', 'Part No', 'L'); $pdf->AddCol('i_name', '40%', 'Description', 'L'); $pdf->AddCol('raw_qty', '7%', 'Qty', 'R'); $pdf->AddCol('sales_rate', '8%', 'Rate', 'R'); $pdf->AddCol('discount_value', '8%', 'Discount', 'R'); $pdf->AddCol('net', '10%', 'Amount', 'R'); $pdf->Table($ddata, $prop); $pdf->SetFont($prop['thfont'][0], $prop['thfont'][1], $prop['thfont'][2]); $cellSize = 1 / 100 * $pdf->TableWidth; $pdf->SetX($pdf->lMargin); $pdf->Cell($cellSize * 75, 5, convertCurrency($net, getCurrencySymbol($_SESSION['company_id'])) . " only", 0, 0, 'L'); $pdf->Cell($cellSize * 25, 5, number_format($net, 0), 0, 0, 'R'); $pdf->Ln(); $pdf->cMargin = $cMargin; } } $mysqli->close(); $fileName = "sales_invoice"; if (isset($_GET['invoice']) && strlen($_GET['invoice']) > 0) { $fileName .= "_{$_GET['invoice']}"; } else { if (isset($_GET['party']) && strlen($_GET['party']) > 0) { $fileName .= "_{$_GET['party']}"; } } $pdf->Output("{$fileName}.pdf", "D");
$invoiceID = mysql_result(full_query("SELECT `invoiceid` FROM `mod_gocardless` WHERE `resource_id` = '" . mysql_real_escape_string($aBill['id']) . "' OR `setup_id` = '" . mysql_real_escape_string($aBill['id']) . "'"), 0, 0); # verify we have been able to get the invoice ID if ($invoiceID) { # get the userID to process the currency $userID = mysql_result(select_query('tblinvoices', 'userid', array('id' => $invoiceID)), 0, 0); # verify the invoice ID (to ensure it exists) and transaction ID to ensure it is unique checkCBInvoiceID($invoiceID, $gateway['paymentmethod']); checkCBTransID($aBill['id']); # calculate GoCardless fees $aBill['fees'] = $aBill['amount'] - $aBill['amount_minus_fees']; # convert the currency where necessary $aCurrency = getCurrency($userID); if ($gateway['convertto'] && $aCurrency['id'] != $gateway['convertto']) { # the users currency is not the same as the GoCardless currency, convert to the users currency $aBill['amount'] = convertCurrency($aBill['amount'], $gateway['convertto'], $aCurrency['id']); $aBill['fees'] = convertCurrency($aBill['fees'], $gateway['convertto'], $aCurrency['id']); } # if we get to this point, we have verified the callback and performed sanity checks # add a payment to the invoice and create a transaction log addInvoicePayment($invoiceID, $aBill['id'], $aBill['amount'], $aBill['fees'], $gateway['paymentmethod']); logTransaction($gateway['paymentmethod'], 'Bill payment completed (' . $aBill['id'] . '). Invoice #' . $invoiceID, 'Successful'); # clean up for next loop unset($invoiceID, $userID); } else { header('HTTP/1.1 400 Bad Request'); logTransaction($gateway['paymentmethod'], 'Could not find invoice with ID. callback.php ' . __LINE__ . $invoiceID, 'Failed'); exit(__LINE__ . ': Could not get invoice ID for ' . htmlentities($aBill['id'])); } } break; case 'failed':
$pdf->printHeader(); $cMargin = $pdf->cMargin; $pdf->cMargin = $prop['padding']; $pdf->AddCol('sno', '6%', 'S.No.', 'L'); $pdf->AddCol('cno', '6%', 'Cno', 'L'); $pdf->AddCol('manufacturer_no', '19%', 'Part No', 'L'); $pdf->AddCol('i_name', '28%', 'Description', 'L'); $pdf->AddCol('model', '16%', 'Model', 'L'); $pdf->AddCol('raw_qty', '7%', 'Qty', 'R'); $pdf->AddCol('sales_rate', '8%', 'Rate', 'R'); $pdf->AddCol('amount', '10%', 'Amount', 'R'); $pdf->Table($ddata, $prop); $pdf->SetFont($prop['thfont'][0], $prop['thfont'][1], $prop['thfont'][2]); $cellSize = 1 / 100 * $pdf->TableWidth; $pdf->SetX($pdf->lMargin); $pdf->Cell($cellSize * 75, 5, convertCurrency($amt) . " only", 0, 0, 'L'); $pdf->Cell($cellSize * 25, 5, number_format($amt, 0), 0, 0, 'R'); $pdf->Ln(); $pdf->cMargin = $cMargin; } $mysqli->close(); $fileName = "sales_invoice"; if (isset($_GET['invoice']) && strlen($_GET['invoice']) > 0) { $fileName .= "_{$_GET['invoice']}"; } else { if (isset($_GET['party']) && strlen($_GET['party']) > 0) { $fileName .= "_{$_GET['party']}"; } } $pdf->Output("{$fileName}.pdf", "D"); } else {
} if (!isset($elements_void[$oid][$eid])) { $elements_void[$oid][$eid] = 0; } $elements[$oid][$eid] += $row['quantity']; $elements_received[$oid][$eid] += $row['qty_received']; $elements_void[$oid][$eid] += $row['qty_void']; if ($row['price_confirmed'] == 1 && !in_array($eid, $elements_confpri[$oid])) { $elements_confpri[$oid][] = $eid; } if ($row['wax_confirmed'] == 1 && !in_array($eid, $elements_confwax[$oid])) { $elements_confwax[$oid][] = $eid; } $eoi_qty_after_void = $row['quantity'] - $row['qty_void']; $weight = $eoi_qty_after_void * $row['unit_multiplier'] * $row['elements_weight']; $price = $eoi_qty_after_void * convertCurrency($row['unit_price'], $row['unit_price_currency'], $row['currency']); $total_weight[$oid] += $weight; $total_price[$oid] += $price; } $otable = array(); $ot = array(); $ot['r'] = 'Supplier'; $ot['d'] = 'Processed Date'; $ot['id1'] = 'Manobo ID'; $ot['o'] = 'Supplier PO #'; $ot['email'] = 'Update Elements Price'; $ot['id2'] = 'Total Weight'; $ot['id3'] = 'Total Price'; $ot['dr'] = 'Date Received'; //$ot['t'] = 'Payment Price'; $ot['sp'] = 'Paid';
exit; } if ($info['ap_status'] == "Success") { $_REQUEST = $info; $id = checkCbInvoiceID($info['apc_1'], "Payza"); checkCbTransID($info['ap_referencenumber']); $amount = $info['ap_totalamount']; $fees = $info['ap_feeamount']; $result = select_query("tblinvoices", "userid,total", array("id" => $id)); $data = mysql_fetch_array($result); $userid = $data['userid']; $total = $data['total']; $currency = getCurrency($userid); if ($currencyid != $currency['id']) { $amount = convertCurrency($amount, $currencyid, $currency['id']); $fees = convertCurrency($fees, $currencyid, $currency['id']); if ($total < $amount + 1 && $amount - 1 < $total) { $amount = $total; } } addInvoicePayment($info['apc_1'], $info['ap_referencenumber'], $amount, $fees, "Payza"); logTransaction("Payza", $response, "Successful"); exit; return 1; } logTransaction("Payza", $response, "Unsuccessful"); exit; return 1; } logTransaction("Payza", $response, "No response received from Payza"); exit;
/** * Create widget of Actual Silver and Gold Price * @return string */ function widgetActualGoldSilverPrice() { $box = '<div id="widget-gold-silver-price" class="ui-corner-all">'; $i_info = '<small>'; //$i_info .= '<strong>Manobo Current Rate:</strong>'; //$i_info .= '<br/>» 1 EUR = ' . displayCurrency('IDR', convertCurrency(1, 'EUR', 'IDR')); //$i_info .= '<br/>» 1 USD = ' . displayCurrency('IDR', convertCurrency(1, 'USD', 'IDR')); //$i_info .= '<br/>» 1 USD = ' . displayCurrency('EUR', convertCurrency(1, 'USD', 'EUR')); $i_info .= '1 ounce = 31.1 gram'; $i_info .= '</small>'; $box .= '<span class="ui-icon ui-icon-info help float-right" title="' . $i_info . '"></span>'; $box .= '<h3>Gold and Silver Actual Price</h3>'; $row = array(); $row['k tac w200'] = 'Carat'; $row['u tac'] = 'USD<sub><small>/gram</small></sub>'; $row['e tac'] = 'EUR<sub><small>/gram</small></sub>'; $table[] = $row; //Draw 925 Silver Prices $sign = ''; $sign_title = ''; $silver_price_data = getGoldSilverPriceData(); $silver_price_data_ounce = getGoldSilverPriceData('ounce'); if ($silver_price_data['price'] > $silver_price_data['price_old']) { $sign = 'icon-value-increase.gif'; $sign_title = 'Increase ' . displayCurrency('USD /ounce', $silver_price_data_ounce['price'] - $silver_price_data_ounce['price_old']); } elseif ($silver_price_data['price'] < $silver_price_data['price_old']) { $sign = 'icon-value-decrease.gif'; $sign_title = 'Decrease ' . displayCurrency('USD /ounce', $silver_price_data_ounce['price_old'] - $silver_price_data_ounce['price']); } if ($sign != '') { $sign = '<img title="' . $sign_title . '" src="images/' . $sign . '" /> '; } $silver_price_usd = number_format($silver_price_data['price'], 2); $silver_price_eur = number_format(convertCurrency($silver_price_data['price'], 'USD', 'EUR'), 2); $row = array(); $row['k tac'] = $sign . '<a style="color:#000;" target="_blank" title="' . $silver_price_data_ounce['price'] . ' USD /ounce" href="http://www.gold.de/silberkurs-silberpreis.html">925</a>'; $row['u tac'] = $silver_price_usd; $row['e tac'] = $silver_price_eur; $table[] = $row; //Draw 24K Gold Prices $sign = ''; $sign_title = ''; $gold_price_data = getGoldSilverPriceData('gram', true); $gold_price_data_ounce = getGoldSilverPriceData('ounce', true); if ($gold_price_data['price'] > $gold_price_data['price_old']) { $sign = 'icon-value-increase.gif'; $sign_title = 'Increase ' . displayCurrency('USD /ounce', $gold_price_data_ounce['price'] - $gold_price_data_ounce['price_old']); } if ($gold_price_data['price'] < $gold_price_data['price_old']) { $sign = 'icon-value-decrease.gif'; $sign_title = 'Decrease ' . displayCurrency('USD /ounce', $gold_price_data_ounce['price_old'] - $gold_price_data_ounce['price']); } if ($sign != '') { $sign = '<img title="' . $sign_title . '" src="images/' . $sign . '" /> '; } $gold_price_usd = number_format($gold_price_data['price'], 2); $gold_price_eur = number_format(convertCurrency($gold_price_data['price'], 'USD', 'EUR'), 2); $row = array(); $row['k tac w150'] = $sign . '<a style="color:#000;" target="_blank" title="' . $gold_price_data_ounce['price'] . ' USD /ounce" href="http://www.gold.de/goldkurs-goldpreis.html">1000 <small>(24K)</small></a>'; $row['u tac w100'] = $gold_price_usd; $row['e tac w100'] = $gold_price_eur; $table[] = $row; $gold_price_per_carat = $gold_price_data['price'] / 24; //Draw 14K/585 Gold Prices $gold_price_585 = $gold_price_per_carat * 14; $gold_price_585_usd = number_format($gold_price_585, 2); $gold_price_585_eur = number_format(convertCurrency($gold_price_585, 'USD', 'EUR'), 2); $row = array(); $row['k tac w150'] = $sign . '<a style="color:#000;" target="_blank" title="' . $gold_price_data_ounce['price'] . ' USD /ounce" href="http://www.gold.de/goldkurs-goldpreis.html">585 <small>(14K)</small></a>'; $row['u tac w100'] = $gold_price_585_usd; $row['e tac w100'] = $gold_price_585_eur; $table[] = $row; //Draw 9K/375 Gold Prices $gold_price_375 = $gold_price_per_carat * 9; $gold_price_375_usd = number_format($gold_price_375, 2); $gold_price_375_eur = number_format(convertCurrency($gold_price_375, 'USD', 'EUR'), 2); $row = array(); $row['k tac w150'] = $sign . '<a style="color:#000;" target="_blank" title="' . $gold_price_data_ounce['price'] . ' USD /ounce" href="http://www.gold.de/goldkurs-goldpreis.html">375 <small>(9K)</small></a>'; $row['u tac w100'] = $gold_price_375_usd; $row['e tac w100'] = $gold_price_375_eur; $table[] = $row; $box .= tep_draw_table('', $table); $box .= '</div>'; return $box; }
/** * Create outsource orders, multiple quantity will be kept as 1 order * @param Int $segments_id * @param Int $products_id * @param Int $articles_id * @param String $products_ean * @param Int $qty * @param Int $suppliers_id * @param Float $suppliers_price * @param String $suppliers_price_currency * @return Int New depot_orders_id created */ function newOrderOutsourced($segments_id, $products_id, $articles_id, $products_ean, $qty, $suppliers_id, $suppliers_price, $suppliers_price_currency, $is_non_refill = false) { if ($qty > 0) { use_class('elements_suppliers'); $class_pm = new products_minierp(); $supplier = new elements_suppliers($suppliers_id); if ($is_non_refill) { $trans_type = self::TRANS_TYPE_NON_REFILL; $trans_id = self::NONREFILL_OUTSOURCED_ID; } else { $trans_type = self::TRANS_TYPE_MANUAL_REFILL; $trans_id = self::MANUAL_REFILL_OUTSOURCED; } $items_id = $this->newOrder($segments_id, $products_id, $articles_id, $products_ean, $qty, null, $trans_type, $trans_id, 'Outsourcing: ' . $supplier->name); $sda = array(); $sda['depot_orders_id'] = $items_id; $sda['suppliers_id'] = $suppliers_id; $sda['price_idr'] = convertCurrency($suppliers_price, $suppliers_price_currency, CURRENCY_CODE_RUPIAH); $sda['price_eur'] = convertCurrency($suppliers_price, $suppliers_price_currency, CURRENCY_CODE_EURO); $sda['price_usd'] = convertCurrency($suppliers_price, $suppliers_price_currency, CURRENCY_CODE_DOLLAR_US); $sda['price_hkd'] = convertCurrency($suppliers_price, $suppliers_price_currency, CURRENCY_CODE_DOLLAR_HK); $sda['price_default'] = $suppliers_price_currency; tep_db_perform('depot_orders_outsourced', $sda); $pdata = $class_pm->retrieveDetail($products_id, 'p'); $this->updateStars($items_id, $pdata['p']['stars']); $this->updateStatus($items_id, '22', 'auto-set', false); } else { $items_id = 0; } return $items_id; }