public function loadModel() { if ($this->_model == null) { if (isset($_GET['id'])) { $condition = ''; $this->_model = currency::model()->findByPk($_GET['id'], $condition); } if ($this->_model == null) { throw new CHttpException(404, "The requested page does not exist!"); } } return $this->_model; }
public function actionChangeCurrency() { $new_currency = $_POST['id']; if ($new_currency and currency::model()->findByPk($new_currency)) { $cart = cart::model()->findByPk(Yii::app()->user->getState('cart_ID')); $cart->cart_currency_ID = $new_currency; $cart->save(); Yii::app()->user->setState('currency_ID', $new_currency); Yii::app()->user->updateCookie(); die(1); } else { die(0); } }
public static function corn_quote($from = 'quote_xe', &$message = '') { $currencies = Mycurrency::instance()->currencies(); foreach ($currencies as $key => $rs) { if (strlen($rs['code']) == 3) { $currency_data = array(); $rate = currency::quote_xe($rs['code']); $currency_data['conversion_rate'] = round(1 / $rate, 5); $currency = Mycurrency::instance($rs['id'])->edit($currency_data); $message = ''; if ($currency) { $message .= $rs['code'] . ' 汇率更新成功<br>'; } } } return true; }
<option value="">Select One</option> <?php $statelist = $objjobtype->getstatelist(); foreach ($statelist as $data) { echo "<option value='" . $data['id'] . "'>" . $data['name'] . "</option>\r\n\t\t\t\t\t"; } ?> </select><span class="checkStatus"></span> </td> </tr> <tr> <th valign="top"><label for="title">Salary</label></th> <td><select id="salary_currency" name="salary_currency" style="width:200px;"> <option value="" class="vldnoblank">Currency type</option> <?php $objcurrency = new currency(); $currency = $objcurrency->getall(); foreach ($currency as $data) { echo "<option value='" . $data['id'] . "'>" . stripslashes($data['full_name']) . "</option>\r\n\t\t\t\t\t"; } ?> </select> <select id="salary_basis" name="salary_basis" class="vldnoblank"> <option value="">Period</option> <option value="weekly">Weekly</option> <option value="monthly">Monthly</option> <option value="yearly">Yearly</option> </select><span class="checkStatus"></span><br /> <table>
function initialize($loaded_modules) { global $db, $messageStack, $currencies; // load the latest currency exchange rates if (web_connected(false) && AUTO_UPDATE_CURRENCY && ENABLE_MULTI_CURRENCY) { gen_pull_language('phreedom', 'admin'); require_once DIR_FS_MODULES . 'phreedom/classes/currency.php'; $currency = new currency(); $currency->btn_update(); } // Fix for change to audit log for upgrade to R3.6 causes perpertual crashing when writing audit log if (!db_field_exists(TABLE_AUDIT_LOG, 'stats')) { $db->Execute("ALTER TABLE " . TABLE_AUDIT_LOG . " ADD stats VARCHAR(32) NOT NULL AFTER ip_address"); } // load installed modules and initialize them if (is_array($loaded_modules)) { foreach ($loaded_modules as $module) { if ($module == 'phreedom') { continue; } // skip this module require_once DIR_FS_MODULES . $module . '/classes/install.php'; $install_class = $module . '_admin'; $mod_init = new $install_class(); if (constant('MODULE_' . strtoupper($module) . '_STATUS') != constant('MODULE_' . strtoupper($module) . '_VERSION')) { // add any new constants if (sizeof($mod_init->keys) > 0) { foreach ($mod_init->keys as $key => $value) { if (!defined($key)) { write_configure($key, $value); } } } admin_install_dirs($mod_init->dirlist, DIR_FS_MY_FILES . $_SESSION['company'] . '/'); if (method_exists($mod_init, 'update')) { $mod_init->update($module); } } if (method_exists($mod_init, 'initialize')) { $mod_init->initialize($module); } } } if (web_connected(false) && CFG_AUTO_UPDATE_CHECK && SECURITY_ID_CONFIGURATION > 3) { // check for software updates $revisions = @file_get_contents(VERSION_CHECK_URL); if ($revisions) { $versions = xml_to_object($revisions); $latest = $versions->Revisions->Phreedom->Current; $current = MODULE_PHREEDOM_VERSION; if ($latest > $current) { $messageStack->add_session(sprintf(TEXT_VERSION_CHECK_NEW_VER, $current, $latest), 'caution'); } foreach ($loaded_modules as $mod) { // check rest of modules if ($mod == 'phreedom') { continue; } // skip this module $latest = $versions->Revisions->Modules->{$mod}->Current; $current = constant('MODULE_' . strtoupper($mod) . '_VERSION'); if ($latest > $current) { $messageStack->add_session(sprintf(TEXT_VERSION_CHECK_NEW_MOD_VER, $mod, $current, $latest), 'caution'); } } } } // Make sure the install directory has been moved/removed if (is_dir(DIR_FS_ADMIN . 'install')) { $messageStack->add_session(TEXT_INSTALL_DIR_PRESENT, 'caution'); } }
private static function loadItems() { self::$_items = array(); $models = self::model()->findAll(array('condition' => 'deleted=2')); foreach ($models as $model) { self::$_items[$model->name] = $model->conversion_rate; } }
if (checkBoxArr.length == 0) { alert("No Users Selected"); return false; } var arv = checkBoxArr.toString(); document.getElementById('selectcheck').value=arv; return confirm("Are You Sure ?"); } </script> <?php $currency = new currency(); if ($_GET['wtdo'] == 'add_currency' && $_POST['name'] != "" && $_POST['fullname'] != "") { if (!is_array($currency->check_currency($_POST))) { $add = $currency->add_currency($_POST); } else { ?> <table align="center"> <tr> <td> <b><font>Error: </font></b><b><font color="#CC3333"><?php echo "Duplicate Entry of Currency"; ?> </font></b> </td> </tr> </table>
public static function parseMoneyFromString($string, $occurences = 0) { $results = []; $currencies = currency::getExistingCurrencies(); foreach ($currencies as $currencyName => $currency) { $currency['leftSymbol'] = isset($currency['leftSymbol']) ? '\\' . $currency['leftSymbol'] : ''; $currency['rightSymbol'] = isset($currency['rightSymbol']) ? '\\' . $currency['rightSymbol'] : ''; $pattern = '|' . $currency['leftSymbol'] . '([\\ ]*)([0-9]{1,8})([\\.\\,]?)([0-9]{0,3})([\\ ]*)' . $currency['rightSymbol'] . '|Si'; preg_match_all($pattern, $string, $matches); $matches = array_filter($matches); if (count($matches) > 1) { $results[] = $matches; } } return $results; }
public function validateOrder($cart_ID, $order_status, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false) { $cart = cart::model()->findByPk(intval($cart_cart)); if ($cart and !$cart->orderExists()) { $order = new order_entity(); $customer = customer_entity::model()->findByPk($cart->cart_customer_ID); $currency = currency::model()->findByPK($cart->cart_currency_ID); $order->order_carrier_ID = intval($cart->cart_carrier_ID); $order->order_address_ID = intval($cart->cart_address_ID); $order->order_cart_ID = intval($cart->cart_ID); $order->order_currency_ID = intval($cart->cart_currency_ID); $order->order_customer_ID = intval($cart->cart_customer_ID); $order->order_salt = $customer->customer_salt; $order->order_payment_method = $paymentMethod; $amountPaid = !$dont_touch_amount ? round(floatval($amountPaid), 2) : $amountPaid; $order->order_total_paid = $amountPaid; $order->order_total_discount = product_entity::decoratePrice($cart->getOrderTotal(2)); $order->order_total_products = product_entity::decoratePrice($cart->getOrderTotal(1)); $order->order_total_shipping = product_entity::decoratePrice($cart->getOrderShippingCost()); $order->order_grand = product_entity::decoratePrice($cart->getOrderTotal()); $order->order_delivery_ID = 0; $order->order_payment_date = date('Y-m-d H:i:s'); $order->order_delivery_date = '0000-00-00 00:00:00'; if ($order->order_total_paid < $order->order_grand) { $order_status = order_entity::PaymentError; } $order->order_status = $order_status; $res = $order->save(); if ($res and $order->order_ID) { //order detail foreach ($cart->products as $product) { $quantity = $cart->containProduct($row->product_ID); $orderDetail = new order_detail(); $orderDetail->detail_order_ID = $order->order_ID; $orderDetail->detail_product_ID = $product->product_ID; $orderDetail->detail_product_name = $product->product_name; if ($quantity['quantity'] > 1) { $discount_ID = discount_quantity::validateQuantityDiscount($product->product_ID, $quantity['quantity']); if ($discount_ID) { $discountQuantity = discount_quantity::model()->findByPk($discount_ID); $orderDetail->detail_quantity_discount = $currency->convert($product->product_price - $discountQuantity->applyRule($product->product_price)); $orderDetail->detail_quantity_discount_applied = 1; $orderDetail->detail_reducetion_percent = 0; $orderDetail->detail_reducetion_amount = 0; $orderDetail->detail_product_price = $currency->convert($product->product_price - $orderDetail->detail_quantity_discount); } } else { if ($product->isReduction()) { if ($product->product_reducetion_percent) { $orderDetail->detail_reducetion_percent = $currency->convert(floatval($product->product_price) * floatval($product->product_reducetion_percent / 100), 2); $orderDetail->detail_reducetion_amount = 0; $orderDetail->detail_quantity_discount = 0; $orderDetail->detail_quantity_discount_applied = 2; $orderDetail->detail_product_price = $currency->convert($product->product_price - $orderDetail->detail_reducetion_percent); } else { $orderDetail->detail_reducetion_amount = $currency->convert($product->product_reducetion_amount); $orderDetail->detail_reducetion_percent = 0; $orderDetail->detail_quantity_discount = 0; $orderDetail->detail_quantity_discount_applied = 2; $orderDetail->detail_product_price = $currency->convert($product->product_price - $orderDetail->detail_reducetion_amount); } } else { $orderDetail->detail_reducetion_amount = 0; $orderDetail->detail_reducetion_percent = 0; $orderDetail->detail_quantity_discount = 0; $orderDetail->detail_quantity_discount_applied = 2; $orderDetail->detail_product_price = $currency->convert($product->product_price); } } $orderDetail->order_weight = floatval($product->product_weight); $orderDetail->save(); //update product info if ($order->order_status != order_entity::PaymentError and $order->order_status != order_entity::Canceled) { $product->product_quantity -= $quantity['quantity']; $product->save(); } } //order_discount if (sizeof($discounts = cart_discount::items($cart->cart_ID)) >= 1) { foreach ($discounts as $discount) { $orderDiscount = new order_discount(); $orderDiscount->order_ID = $order->order_ID; $orderDiscount->discount_ID = $discount['discount_ID']; $orderDiscount->discount_name = $discount['discount_name']; if ($discount['discount_type'] == 3) { $orderDiscount->discount_value = 0; } else { if ($discount['discount_type'] == 2) { $orderDiscount->discount_value = $currency->convert($discount['discount_value']); } else { if ($discounts['discount_type'] == 1) { $orderDiscount->discount_value = $currency->convert($order->order_total_products * ($discount['discount_value'] / 100)); } } } } } /** * To do list * 1.Email confirm * 2.Product sales * 3.Order message * 4.order History * */ } } }
public static function decoratePrice($price, $sign = false) { $id_currency = Yii::app()->user->getState('currency_ID'); if (!$id_currency) { return $sign ? '$' . round(floatval($price), 2) : round(floatval($price), 2); } if (!($currency = currency::model()->findByPk($id_currency))) { return $sign ? '$' . round(floatval($price), 2) : round(floatval($price), 2); } if ($currency->iso_code == 'USD') { return $sign ? '$' . round(floatval($price), 2) : round(floatval($price), 2); } return $sign ? $currency->sign . round(floatval($price) * $currency->conversion_rate, 2) : round(floatval($price) * $currency->conversion_rate, 2); }
$grandTotal = $cart->getOrderTotal(); if (!$cart->isFreeshipping()) { $remain = product_entity::decoratePrice(configuration::item('SHIPPING', 'SHIPPING_FREE_PRICE') - $grandTotal, true); echo " <p style='margin-top: 3px; display: inline;'>Remaining amount to be added to your cart in order to obtain free shipping: <span class='green'>{$remain}</span></p>"; if ($cart->cart_carrier_ID && $cart->cart_address_ID) { $shippingFee = product_entity::decoratePrice($cart->getOrderTotal(5), true); echo " <strong class='t_c1'>Total Shipping:<span class='red'>{$shippingFee}</span></strong>"; } } else { echo "<p style='margin-top: 3px; display: inline;'>You have obtain free shipping</p>"; } ?> </div> <div class="ar t_count"> <?php echo CHtml::dropDownList('currency', Yii::app()->user->getState('currency_ID'), currency::getCurrencies()); ?> <strong class="t_c1">GrandTotal:<span class="red"><?php echo product_entity::decoratePrice($grandTotal, true); ?> </span></strong> </div> <div class="fl mt_10"><a href="/">« continue to shopping</a></div> <p class="ar"><input type="button" value="" id="check_btn" class="button ubutton button_checkstep " /></p> </div> <div class="fix"></div> </div> </div>
$line = @file(NEW_VERSION_CHECKUP_URL); $latest_version = trim($line[0]); // Determine the Program patch level include DIR_FS_ADMIN . 'includes/version.php'; $installed_version = PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR; if ($latest_version > $installed_version) { $messageStack->add_session(sprintf(TEXT_VERSION_CHECK_NEW_VER, $installed_version, $latest_version), 'success'); } } } // load the latest currency exchange rates if (AUTO_UPDATE_CURRENCY && ENABLE_MULTI_CURRENCY) { if (web_connected($silent = false)) { require DIR_FS_MODULES . 'setup/classes/currency.php'; require DIR_FS_MODULES . 'setup/language/' . $_SESSION['language'] . '/modules/currency.php'; $exchange_rates = new currency(); $exchange_rates->btn_update(); } } if (AUTO_UPDATE_PERIOD) { gen_auto_update_period(); } gen_add_audit_log(GEN_LOG_LOGIN . $admin_name); // check for session timeout to reload to requested page $get_params = ''; if (isset($_SESSION['pb_cat'])) { $get_params = 'cat=' . $_SESSION['pb_cat']; $get_params .= '&module=' . $_SESSION['pb_module']; if (isset($_SESSION['pb_jID'])) { $get_params .= '&jID=' . $_SESSION['pb_jID']; }
function currency_main($use_headers = True, $return_output = FALSE) { ob_start(); try { $page = array(); $currency = new currency($GLOBALS['currency_db_base'], $GLOBALS['currency_db_user'], $GLOBALS['currency_db_password']); if (!isset($_GET['command'])) { $command = 'get_note'; } else { $command = $_GET['command']; } if (!isset($_GET['id'])) { $id = 0; } else { $id = $_GET['id']; } if ($command == 'get_note') { if (isset($_GET['count'])) { $count = $_GET['count']; } else { $count = 1; } $autocommit = FALSE; if (isset($_GET['autocommit'])) { $autocommit = $_GET['autocommit']; } for ($i = 0; $i < $count; $i++) { if ($autocommit == 'yes') { $note = $currency->_get_note($_GET['value'], 'y', $id); } else { $note = $currency->get_note($_GET['value'], $id); } array_push($page, join("\t", $note)); } } elseif ($command == 'merge_notes') { if (isset($_GET['values'])) { if ($_GET['values'] == '') { $_GET['values'] = array(); } } else { $_GET['values'] = FALSE; } $notes = $currency->merge_notes_columns($_GET['serial'], $_GET['name'], $_GET['value'], $id, $_GET['values']); foreach ($notes as $note) { array_push($page, join("\t", $note)); } } elseif ($command == 'break_note') { if (isset($_GET['values'])) { if ($_GET['values'] == '') { $_GET['values'] = array(); } } else { $_GET['values'] = FALSE; } $notes = $currency->break_note($_GET['serial'], $_GET['name'], $_GET['value'], $id, $_GET['values']); foreach ($notes as $note) { array_push($page, join("\t", $note)); } } elseif ($command == 'change_note') { $note = $currency->change_note($_GET['serial'], $_GET['name'], $_GET['value'], $id); array_push($page, join("\t", $note)); } elseif ($command == 'check_note') { $note = $currency->check_note($_GET['serial'], $_GET['name'], $_GET['value'], $id); array_push($page, join("\t", $note)); } elseif ($command == 'commit') { array_push($page, $currency->commit($_GET['transaction_id'])); } elseif ($command == 'put_note') { $currency->put_note($_GET['serial'], $_GET['name'], $_GET['value']); array_push($page, "OK"); } else { throw new Exception("unknown command " . $command); } print join("\n", $page); $status = true; } catch (Exception $error) { print $error->getMessage(); $status = FALSE; } if ($use_headers) { if ($status) { header('Content-type: text/plain'); } else { header('HTTP/1.0 500 Internal Server Error'); error_log(ob_get_contents()); } } if ($return_output) { $status = ob_get_contents(); error_log($status); ob_end_clean(); } else { ob_end_flush(); } return $status; }
<?php require dirname(__FILE__) . '/../dbConnection.php'; require dirname(__FILE__) . '/../lib/auth.class.php'; require dirname(__FILE__) . '/../lib/currency.class.php'; require dirname(__FILE__) . '/../lib/user.class.php'; $auth = new auth(); $currency = new currency(); $user = new user(); $auth_session_hash = $_COOKIE["auth_session"]; $authSession = $auth->sessioninfo($auth_session_hash); $authUserId = $authSession['uid']; $user = $user->retriveUser($authUserId); $userCurrency = $currency->retrieveCurrency($user['currency']); $userInfo = array(); $userInfo['username'] = $auth->sessioninfo($auth_session_hash)['username']; $userInfo['uid'] = $auth->sessioninfo($auth_session_hash)['uid']; if ($result = $mysqli->query("SELECT totalMoney, isAdmin FROM users WHERE id=" . $userInfo['uid'])) { /* fetch object array */ $obj = $result->fetch_object(); $userInfo['isAdmin'] = $obj->isAdmin; $userInfo['totalMoney'] = $obj->totalMoney; $result->close(); } echo json_encode($userInfo);
* @version 5 * * @copyright Copyright (C) 2006 - 2014 Critter BVBA All rights reserved. * @license GNU General Public License version 3 or later; see license.txt * * showitem.currency.php * * showitem.currency dialog * */ // enable or disable logging error_reporting(E_ALL); ini_set('display_errors', '1'); // 0 - disabled; 1 - enabled // $o = new currency($data->data->id); $o->details(); ?> <div class="title"><?php echo ucwords($o->get("id") == -1 ? CURRENCY_NEW_CURRENCY : CURRENCY_EDIT_CURRENCY); ?> </div> <div class="form"> <div class="column"> <div class="row name"> <div class="caption"><?php echo ucwords(CURRENCY_NAME); ?> <input type="hidden" id="id" value="<?php echo $o->get('id'); ?>
<?php include "header.php"; require_once "../common/class/currency.class.php"; $currency = new currency("currency"); if ($_GET['action'] == "delete" && $_GET['id'] == "") { $midarray = explode(",", $_POST['selectcheck']); foreach ($midarray as $w) { $currency->delete_currency($w, $table); } echo "<script>alert('currency Deleted ...'); window.location='currency_management.php';</script>"; } else { $currency->delete_currency($_GET['id'], $table); echo "<script>alert('currency Deleted ...'); window.location='currency_management.php';</script>"; } ?>
function VoucherCreate($VoucherId) { $voucher = new voucher(); $customer = new customer(); $currency = new currency(); $voucher->setVoucherId($VoucherId); $voucher->extractor($voucher->getVoucherById()); $systemSetting = new systemSetting(); $common = new common(); $systemSetting->extractor($systemSetting->getSettings()); $customer->setCustomerId($voucher->voucherCustomerId()); $customer->extractor($customer->getCustomerById()); $filename = $systemSetting->sySettingDocumentName() . 'voucher_' . $voucher->voucherId() . '.pdf'; $subject = $systemSetting->sySettingCompanyName() . ' - New Discount Voucher received from ' . $voucher->voucherFromName() . '!!!'; $EmailMessage = '<table width="785" border="0" cellpadding="20" cellspacing="0"> <tr> <td width="-34" bgcolor="#333333" style="font-family:Arial, Helvetica, sans-serif; font-size:20px; color:#000; padding:4px 0 4px 5px;"> </td> <td width="699" align="left" bgcolor="#333333"><img src="' . DOC_ROOT . 'uplode-img/company-logo/' . $systemSetting->sySettingCompanyLogo() . '" /></td> </tr> <tr> <td colspan="2" bgcolor="#f0f0f0" style=" font-family:arial; font-size:13px;"> <br> Dear <strong> Mr/Miss/Mrs ' . $voucher->voucherToName() . '</strong>, <br/><br/> We are pleased to inform you that <strong>' . $voucher->voucherFromName() . '</strong> has gifted you a voucher worth <strong>' . $currency->convetNumberFormatDefault($voucher->voucherAmount()) . ' </strong>.<br> Your Voucher Code ..<br/><br/> <strong>#</strong> <span style="color:#F00"><strong> ' . $voucher->voucherCode() . '</strong> </span><br/> <br/><br/> br> <p> Thanking you for taking the time in shopping online with us. <br/> ' . $systemSetting->sySettingCompanyName() . '<br/><br/> Best Regards,<br/> Web Administrator<br/> <strong>' . $systemSetting->sySettingCompanyName() . ' - on ' . date('Y-m-d h:i a') . '</strong><br/> </p> <hr/> <span style="color:#666; font-size:11px; font-family:Arial, Helvetica, sans-serif;">You are receiving this email, because an account has been registered at the ' . $systemSetting->sySettingCompanyName() . ' Online Shoping cart portal. If you have not made any registration or unaware of the same, please email administrator at ' . $systemSetting->sySettingCompanyEmail() . ' to remove you from this panel.</span> </td> </tr> </table> '; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = $systemSetting->sySettingHost(); // sets GMAIL as the SMTP server $mail->Port = $systemSetting->sySettingPort(); // set the SMTP port $mail->Username = $systemSetting->sySettingSmtpUsername(); // GMAIL username $mail->Password = $systemSetting->sySettingSmtpPassword(); // GMAIL password $mail->From = $systemSetting->sySettingSmtpUsername(); $mail->FromName = $systemSetting->sySettingFromName(); $mail->Subject = $subject; $mail->WordWrap = 50; // set word wrap $mail->MsgHTML($EmailMessage); $mail->AddAddress($voucher->voucherToEmail(), $systemSetting->sySettingCompanyName()); $mail->AddCC($customer->customerEmail(), $systemSetting->sySettingCompanyName()); $mail->IsHTML(true); // send as HTML $mail->Send(); return true; }
<?php include "header.php"; require_once "../common/class/currency.class.php"; $currency = new currency(); $name = $currency->getbyid($_GET['id']); ?> <table align="center" width="100%"> <tr align="center"> <td align="center" bgcolor="#66CCFF">Edit Currency</td> </tr> </table> <form name="frmaddcategory" action="currency_management.php?wtdo=edit_currency&id=<?php echo $_GET['id']; ?> " method="post" onSubmit="if(validateForm(this)) return true; else return false;"> <table> <tr> <td><label for="tags"><strong>Name</strong></label></td> <td><input type="text" id="name" name="name" value="<?php echo $name['name']; ?> " class="vldnoblank textWidth" /> <span class="checkStatus"></span> </td> </tr> <tr> <td><label for="tags"><strong>Full Name</strong></label></td>