Example #1
0
 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => get_exchange_name($this->exchange));
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Price"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Value"));
     $data = array();
     $q = db()->prepare("SELECT * FROM ticker_recent WHERE exchange=:exchange AND currency1=:currency1 AND currency2=:currency2");
     $q->execute(array('exchange' => $this->exchange, 'currency1' => $this->currency1, 'currency2' => $this->currency2));
     if ($ticker = $q->fetch()) {
         $last_updated = $ticker['created_at'];
         $data[] = array('Bid', currency_format($this->currency1, $ticker['bid'], 4));
         $data[] = array('Ask', currency_format($this->currency1, $ticker['ask'], 4));
     } else {
         throw new GraphException(t("No recent rates found for :exchange :pair", $this->getTitleArgs()));
     }
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'no_header' => true);
 }
Example #2
0
 /**
  * We need to transpose the returned data, both data and columns.
  */
 public function getData($days)
 {
     $original = parent::getData($days);
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Total :currency"), 'args' => array(':currency' => get_currency_abbr($this->currency)), 'heading' => true);
     $data = array();
     $total = 0;
     foreach ($original['data'] as $key => $row) {
         foreach ($row as $i => $value) {
             $data[] = array($original['columns'][$i]['title'], currency_format($this->currency, $value, 4));
             $total += $value;
         }
     }
     // 'Total BTC' column
     $columns[] = array('type' => 'string', 'title' => currency_format($this->currency, $total, 4));
     // save for later
     $this->total = $total;
     return array('key' => $original['key'], 'columns' => $columns, 'data' => $data, 'last_updated' => $original['last_updated']);
 }
Example #3
0
 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => ct("Currency"));
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Currency"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Total"));
     // a table of each currency
     // get all balances
     $balances = get_all_summary_instances($this->getUser());
     $summaries = get_all_summary_currencies($this->getUser());
     $currencies = get_all_currencies();
     $last_updated = find_latest_created_at($balances, "total");
     // create data
     $data = array();
     foreach ($currencies as $c) {
         if (isset($summaries[$c])) {
             $balance = isset($balances['total' . $c]) ? $balances['total' . $c]['balance'] : 0;
             $data[] = array("<span title=\"" . htmlspecialchars(get_currency_name($c)) . "\">" . get_currency_abbr($c) . "</span>", currency_format($c, demo_scale($balance), 4));
         }
     }
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'add_more_currencies' => true, 'no_header' => true);
 }
 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => ct("Currency"));
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Exchange"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Converted fiat"));
     // a table of each crypto2xxx value
     // get all balances
     $currencies = get_crypto_conversion_summary_types($this->getUser());
     $last_updated = false;
     // create data
     $data = array();
     foreach ($currencies as $key => $c) {
         $q = db()->prepare("SELECT * FROM summary_instances WHERE user_id=? AND summary_type=? AND is_recent=1");
         $q->execute(array($this->getUser(), "crypto2" . $key));
         if ($balance = $q->fetch()) {
             $data[] = array($c['short_title'], currency_format($c['currency'], demo_scale($balance['balance']), 4));
             $last_updated = max($last_updated, strtotime($balance['created_at']));
         }
     }
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'add_more_currencies' => true, 'no_header' => true);
 }
 public function getData($days)
 {
     $columns = array();
     $key_column = array('type' => 'string', 'title' => ct("Key"));
     $columns[] = array('type' => 'string', 'title' => ct("Exchange"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Price"));
     $columns[] = array('type' => 'string', 'title' => ct("Volume"));
     $q = db()->prepare("SELECT * FROM ticker_recent WHERE currency1=? AND currency2=? ORDER BY volume DESC");
     $q->execute(array($this->currency1, $this->currency2));
     $tickers = $q->fetchAll();
     $q = db()->prepare("SELECT * FROM average_market_count WHERE currency1=? AND currency2=?");
     $q->execute(array($this->currency1, $this->currency2));
     $market_count = $q->fetch();
     $average = false;
     foreach ($tickers as $ticker) {
         if ($ticker['exchange'] == 'average') {
             $average = $ticker;
         }
     }
     if (!$average) {
         throw new RenderGraphException(t("Could not find any average data"));
     }
     $volume_currency = $average['currency2'];
     // generate the table of data
     $data = array();
     foreach ($tickers as $ticker) {
         if ($ticker['exchange'] == "average") {
             continue;
         }
         if ($ticker['volume'] == 0) {
             continue;
         }
         $id = $ticker['exchange'] . "_" . $ticker['currency1'] . $ticker['currency2'] . "_daily";
         $data[$ticker['exchange']] = array("<a href=\"" . htmlspecialchars(url_for('historical', array('id' => $id, 'days' => 180))) . "\">" . get_exchange_name($ticker['exchange']) . "</a>", $this->average_currency_format_html($ticker['last_trade'], $ticker['last_trade']), currency_format($volume_currency, $ticker['volume'], 0) . " (" . ($average['volume'] == 0 ? "-" : number_format($ticker['volume'] * 100 / $average['volume']) . "%") . ")");
     }
     $last_updated = $average['created_at'];
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'h1' => get_currency_abbr($average['currency1']) . "/" . get_currency_abbr($average['currency2']) . ": " . currency_format($average['currency1'], $average['last_trade']), 'h2' => "(" . number_format($average['volume']) . " " . get_currency_abbr($volume_currency) . " total volume)");
 }
">
				<div class="featured-menu">
					<div class="menu-thumb">
						<img src="<?php 
    echo $menu['menu_photo'];
    ?>
" alt="" />
					</div>
					<div class="menu-content">
						<div class="content-show">
							<h4><?php 
    echo $menu['menu_name'];
    ?>
</h4>
							<span><?php 
    echo currency_format($menu['menu_price']);
    ?>
</span>
						</div>
						<div class="content-hide">
							<p><?php 
    echo $menu['menu_description'];
    ?>
</p>
						</div>
					</div>
				</div>
			</div>
		<?php 
}
?>
Example #7
0
if ($invoiceID) {
    $invoice = $ISL->FetchInvoiceDetails($invoiceID);
    $client = $ISL->FetchClientDetails($invoice['clientid']);
    $admin = $ISL->FetchAdminDetails($client['parentclientid']);
    $invoice['show_tax'] = $invoice['calc_tax'] > 0 ? true : false;
    $invoice['show_tax2'] = $invoice['calc_tax2'] > 0 ? true : false;
    $invoice['show_shipping'] = $invoice['shipping'] > 0 ? true : false;
    $invoice['terms'] = $invoice['terms'] ? $invoice['terms'] : ($client['def_terms'] ? $client['def_terms'] : ($admin['def_terms'] ? $admin['def_terms'] : $lang['terms']));
    $invoice['comments'] = $invoice['comments'] ? $invoice['comments'] : ($client['def_comments'] ? $client['def_comments'] : ($admin['def_comments'] ? $admin['def_comments'] : ''));
    $invoice['due_date'] = date($SYSTEM["regional"]["invoicedate"], $invoice['due_date']);
    $invoice['issue_date'] = date($SYSTEM["regional"]["invoicedate"], $invoice['issue_date']);
    $invoice['calc_tax'] = currency_format($invoice['calc_tax']);
    $invoice['calc_tax2'] = currency_format($invoice['calc_tax2']);
    $invoice['shipping'] = currency_format($invoice['shipping']);
    $invoice['cost'] = currency_format($invoice['cost']);
    $invoice['total'] = currency_format($invoice['total']);
    $emailSendID = $ISL->addEmailSend($invoice['clientid'], $invoiceID, $client['email'], 1);
    $e = new Emailer();
    $e->setMainFile('forms/email_invoice.tpl');
    $e->setFrom($SYSTEM['email']['from']);
    $e->setFromName($SYSTEM['email']['fromName']);
    $e->setSubject($lang['eml_subj_invoice']);
    $e->set('SYSTEM', $SYSTEM);
    $e->set('invoice', $invoice);
    $e->set('client', $client);
    $e->set('admin', $admin);
    $ispayed = strtolower($invoice['curr_status']) == 'fully paid' ? true : false;
    $e->set('ispayed', $ispayed);
    $e->fetchMessage();
    $e->appendMessage('<img src="' . HTTP_ROOT . 'isop.php?sid=' . $emailSendID . '" width="1" height="1">');
    $e->setRecipient($client['email']);
Example #8
0
                ?>
        <?php 
                _e($key);
                ?>
        <?php 
            } else {
                ?>
        <?php 
                print $key;
                ?>
        <?php 
            }
            ?>
:</small>
        <?php 
            print currency_format($v);
            ?>
      </span>
    </div>
<?php 
        }
    }
    ?>
</div>
<?php 
}
?>

<module type="custom_fields" data-content-id="<?php 
print intval($for_id);
?>
Example #9
0
 private function precision()
 {
     $format = currency_format();
     return $format['precision'];
 }
     $reward_points += $components_reward_points;
     $product_params["base_reward_points"] = $reward_points;
     if ($reward_type) {
         $t->set_var("reward_points", number_format($reward_points, $points_decimals));
         $t->parse("reward_points_block", false);
     } else {
         $t->set_var("reward_points_block", "");
     }
 }
 // show reward credits
 if ($credit_system && $reward_credits_details && ($reward_credits_users == 0 || $reward_credits_users == 1 && $user_id)) {
     $reward_credits = calculate_reward_credits($credit_reward_type, $credit_reward_amount, $item_price, $buying_price);
     $reward_credits += $components_reward_credits;
     $product_params["base_reward_credits"] = $reward_credits;
     if ($credit_reward_type) {
         $t->set_var("reward_credits", currency_format($reward_credits));
         $t->parse("reward_credits_block", false);
     } else {
         $t->set_var("reward_credits_block", "");
     }
 }
 $recent_price = 0;
 $product_params["pe"] = 0;
 if ($display_products != 2 || strlen($user_id)) {
     set_quantity_control($quantity_limit, $stock_level, $quantity_control, $min_quantity, $max_quantity, $quantity_increment);
     // calculate recent price
     $recent_price = calculate_price($price, $is_sales, $sales_price);
     $recent_price += $properties_price;
     $base_price = calculate_price($price, $is_sales, $sales_price);
     $product_params["base_price"] = $base_price;
     if ($is_price_edit) {
Example #11
0
        } else {
            ?>
										<td>
										<?php 
            $duration = $report['consultation_duration'];
            $hours = floor($duration / 3600);
            $minutes = floor($duration / 60 % 60);
            $seconds = $duration % 60;
            echo "{$hours}:{$minutes}:{$seconds}";
            ?>
										</td>
										<?php 
        }
        ?>
										<!--td class="right"><?php 
        echo currency_format($report['collection_amount']);
        if ($currency_postfix) {
            echo $currency_postfix['currency_postfix'];
        }
        ?>
</td-->
									</tr>
								
								<?php 
        $i++;
        ?>
								<?php 
    }
    ?>
							</tbody>
							<?php 
Example #12
0
    }
}
?>
        <?php 
echo $title;
?>
 - <span><?php 
echo $description;
?>
</span>
    </label>
    <?php 
if ($minimum_order_total >= $order_total) {
    ?>
        <br /><span class="text-info"><?php 
    echo sprintf(lang('alert_min_order_total'), currency_format($minimum_order_total));
    ?>
</span>
    <?php 
}
?>
</div>
<div id="stripe-payment" class="wrap-horizontal" style="<?php 
echo $payment === 'authorize_net_aim' ? 'display: block;' : 'display: none;';
?>
">
	<?php 
if (!empty($stripe_token)) {
    ?>
		<input type="hidden" name="stripe_token" value="<?php 
    echo $stripe_token;
Example #13
0
                ?>
</td>
              </tr>
              <?php 
            }
            ?>
              <tr class="mw-ui-table-footer">
                <td colspan="3" style="padding-top: 37px;">&nbsp;</td>
                <td class="mw-ui-table-green">
                  <strong><?php 
            _e("Total");
            ?>
:</strong>
                </td>
                <td class="nowrap"><b><?php 
            print currency_format($grandtotal);
            ?>
</b></td>
              </tr>
            </tbody>
          </table>
          <?php 
        } else {
            ?>
          <h2>
            <?php 
            _e("The cart is empty");
            ?>
          </h2>
          <?php 
        }
									<?php 
        $bill_date = date('d-m-Y', strtotime($report['bill_date']));
        ?>
									<td><?php 
        echo $bill_date;
        ?>
</td>
                                    <td><?php 
        echo currency_format($report['total_amount']);
        if ($currency_postfix) {
            echo $currency_postfix['currency_postfix'];
        }
        ?>
</td>
									<td><?php 
        echo currency_format($report['due_amount']);
        if ($currency_postfix) {
            echo $currency_postfix['currency_postfix'];
        }
        ?>
</td>
                                </tr>
								<?php 
    }
    ?>
								<script>
									$(window).load(function() {
										$('#bill_table').dataTable();
									});
								</script>
								
Example #15
0
function check_add_coupons($auto_apply, $new_coupon_code, &$new_coupon_error)
{
    global $db, $site_id, $table_prefix, $date_show_format;
    global $currency;
    $shopping_cart = get_session("shopping_cart");
    $order_coupons = get_session("session_coupons");
    $user_info = get_session("session_user_info");
    $user_id = get_setting_value($user_info, "user_id", "");
    $user_type_id = get_setting_value($user_info, "user_type_id", "");
    $user_tax_free = get_setting_value($user_info, "tax_free", 0);
    $user_discount_type = get_session("session_discount_type");
    $user_discount_amount = get_session("session_discount_amount");
    if (!is_array($shopping_cart) || sizeof($shopping_cart) < 1) {
        return;
    }
    // check basic product prices before any further checks
    foreach ($shopping_cart as $cart_id => $item) {
        $item_id = $item["ITEM_ID"];
        $properties_more = $item["PROPERTIES_MORE"];
        if (!$item_id || $properties_more > 0) {
            continue;
        }
        $item_type_id = $item["ITEM_TYPE_ID"];
        $properties = $item["PROPERTIES"];
        $quantity = $item["QUANTITY"];
        $tax_id = $item["TAX_ID"];
        $tax_free = $item["TAX_FREE"];
        $discount_applicable = $item["DISCOUNT"];
        $buying_price = $item["BUYING_PRICE"];
        $price = $item["PRICE"];
        $is_price_edit = $item["PRICE_EDIT"];
        $properties_price = $item["PROPERTIES_PRICE"];
        $properties_percentage = $item["PROPERTIES_PERCENTAGE"];
        $properties_buying = $item["PROPERTIES_BUYING"];
        $properties_discount = $item["PROPERTIES_DISCOUNT"];
        $components = $item["COMPONENTS"];
        if ($discount_applicable) {
            if (!$is_price_edit) {
                if ($user_discount_type == 1) {
                    $price -= round($price * $user_discount_amount / 100, 2);
                } else {
                    if ($user_discount_type == 2) {
                        $price -= round($user_discount_amount, 2);
                    } else {
                        if ($user_discount_type == 3) {
                            $price -= round($price * $user_discount_amount / 100, 2);
                        } else {
                            if ($user_discount_type == 4) {
                                $price -= round(($price - $buying_price) * $user_discount_amount / 100, 2);
                            }
                        }
                    }
                }
            }
        }
        if ($properties_percentage && $price) {
            $properties_price += round($price * $properties_percentage / 100, 2);
        }
        if ($properties_discount > 0) {
            $properties_price -= round($properties_price * $properties_discount / 100, 2);
        }
        if ($discount_applicable) {
            if ($user_discount_type == 1) {
                $properties_price -= round($properties_price * $user_discount_amount / 100, 2);
            } else {
                if ($user_discount_type == 4) {
                    $properties_price -= round(($properties_price - $properties_buying) * $user_discount_amount / 100, 2);
                }
            }
        }
        $price += $properties_price;
        // add components prices
        if (is_array($components) && sizeof($components) > 0) {
            foreach ($components as $property_id => $component_values) {
                foreach ($component_values as $property_item_id => $component) {
                    $component_price = $component["price"];
                    $component_tax_id = $component["tax_id"];
                    $component_tax_free = $component["tax_free"];
                    if ($user_tax_free) {
                        $component_tax_free = $user_tax_free;
                    }
                    $sub_item_id = $component["sub_item_id"];
                    $sub_quantity = $component["quantity"];
                    if ($sub_quantity < 1) {
                        $sub_quantity = 1;
                    }
                    $sub_type_id = $component["item_type_id"];
                    if (!strlen($component_price)) {
                        $sub_price = $component["base_price"];
                        $sub_buying = $component["buying"];
                        $sub_user_price = $component["user_price"];
                        $sub_user_action = $component["user_price_action"];
                        $sub_prices = get_product_price($sub_item_id, $sub_price, $sub_buying, 0, 0, $sub_user_price, $sub_user_action, $user_discount_type, $user_discount_amount);
                        $component_price = $sub_prices["base"];
                    }
                    // add to the item price component price
                    $price += $component_price;
                }
            }
        }
        $shopping_cart[$cart_id]["BASIC_PRICE"] = $price;
        // basic price to calculate discount amount for product coupons
        $shopping_cart[$cart_id]["DISCOUNTED_PRICE"] = $price;
        // product price with all coupon discounts
    }
    // end of product prices check
    // check if any product coupons should be removed
    $exclusive_applied = false;
    $new_coupons_total = 0;
    $coupons_total = 0;
    foreach ($shopping_cart as $cart_id => $item) {
        $item_id = $item["ITEM_ID"];
        $properties_more = $item["PROPERTIES_MORE"];
        if (!$item_id || $properties_more > 0) {
            continue;
        }
        $item_type_id = $item["ITEM_TYPE_ID"];
        $basic_price = $item["BASIC_PRICE"];
        $discounted_price = $item["DISCOUNTED_PRICE"];
        $quantity = $item["QUANTITY"];
        // product coupons
        if (isset($item["COUPONS"]) && is_array($item["COUPONS"])) {
            foreach ($item["COUPONS"] as $coupon_id => $coupon_info) {
                if ($auto_apply && $coupon_info["AUTO_APPLY"]) {
                    // always remove auto-apply coupons
                    unset($shopping_cart[$cart_id]["COUPONS"][$coupon_id]);
                } else {
                    $sql = " SELECT * FROM " . $table_prefix . "coupons ";
                    $sql .= " WHERE coupon_id=" . $db->tosql($coupon_id, INTEGER);
                    $db->query($sql);
                    if ($db->next_record()) {
                        $discount_type = $db->f("discount_type");
                        $coupon_discount = $db->f("discount_amount");
                        $min_quantity = $db->f("min_quantity");
                        $max_quantity = $db->f("max_quantity");
                        $minimum_amount = $db->f("minimum_amount");
                        $maximum_amount = $db->f("maximum_amount");
                        $is_exclusive = $db->f("is_exclusive");
                        // check cart fields and total values
                        $min_cart_quantity = $db->f("min_cart_quantity");
                        $max_cart_quantity = $db->f("max_cart_quantity");
                        $min_cart_cost = $db->f("min_cart_cost");
                        $max_cart_cost = $db->f("max_cart_cost");
                        $cart_items_all = $db->f("cart_items_all");
                        $cart_items_ids = $db->f("cart_items_ids");
                        $cart_items_types_ids = $db->f("cart_items_types_ids");
                        check_cart_totals($cart_quantity, $cart_cost, $shopping_cart, $cart_items_all, $cart_items_ids, $cart_items_types_ids);
                        if ($quantity < $min_quantity || $basic_price < $minimum_amount || $max_quantity && $max_quantity < $quantity || $maximum_amount && $maximum_amount < $basic_price || $cart_quantity < $min_cart_quantity || $cart_cost < $min_cart_cost || $max_cart_quantity && $max_cart_quantity < $cart_quantity || $max_cart_cost && $max_cart_cost < $cart_cost) {
                            unset($shopping_cart[$cart_id]["COUPONS"][$coupon_id]);
                        } else {
                            // descrease product price for coupon discount
                            $discount_amount = $coupon_info["DISCOUNT_AMOUNT"];
                            $discounted_price -= $discount_amount;
                            $shopping_cart[$cart_id]["DISCOUNTED_PRICE"] = $discounted_price;
                            if ($is_exclusive) {
                                $exclusive_applied = true;
                            }
                            $coupons_total++;
                        }
                    } else {
                        unset($shopping_cart[$cart_id]["COUPONS"][$coupon_id]);
                    }
                }
            }
        }
    }
    // check if any order coupons should be removed
    // cart_quantity and cart_cost variable is used to check order coupons
    if (is_array($order_coupons)) {
        foreach ($order_coupons as $coupon_id => $coupon_info) {
            if ($auto_apply && $coupon_info["AUTO_APPLY"]) {
                // always remove auto-apply coupons
                unset($order_coupons[$coupon_id]);
            } else {
                $sql = " SELECT c.* FROM ";
                if (isset($site_id)) {
                    $sql .= "(";
                }
                $sql .= $table_prefix . "coupons c";
                if (isset($site_id)) {
                    $sql .= " LEFT JOIN  " . $table_prefix . "coupons_sites s ON s.coupon_id=c.coupon_id)";
                }
                $sql .= " WHERE c.coupon_id=" . $db->tosql($coupon_id, INTEGER);
                if (isset($site_id)) {
                    $sql .= " AND (c.sites_all=1 OR s.site_id=" . $db->tosql($site_id, INTEGER, true, false) . ")";
                } else {
                    $sql .= " AND c.sites_all=1 ";
                }
                $sql .= " ORDER BY c.apply_order ";
                $db->query($sql);
                if ($db->next_record()) {
                    $discount_type = $db->f("discount_type");
                    $coupon_discount = $db->f("discount_amount");
                    $is_exclusive = $db->f("is_exclusive");
                    // check cart fields and cart totals
                    $min_cart_quantity = $db->f("min_cart_quantity");
                    $max_cart_quantity = $db->f("max_cart_quantity");
                    $min_cart_cost = $db->f("min_cart_cost");
                    $max_cart_cost = $db->f("max_cart_cost");
                    check_cart_totals($cart_quantity, $cart_cost, $shopping_cart, 1, "", "");
                    if ($cart_quantity < $min_cart_quantity || $cart_cost < $min_cart_cost || $max_cart_quantity && $max_cart_quantity < $cart_quantity || $max_cart_cost && $max_cart_cost < $cart_cost) {
                        unset($order_coupons[$coupon_id]);
                    } else {
                        if ($is_exclusive) {
                            $exclusive_applied = true;
                        }
                        $coupons_total++;
                    }
                } else {
                    unset($order_coupons[$coupon_id]);
                }
            }
        }
    }
    // check if new coupons could be added
    $new_coupons = array();
    $coupon_title = "";
    if (strlen($new_coupon_code)) {
        $sql = " SELECT c.* FROM (" . $table_prefix . "coupons c";
        if (isset($site_id)) {
            $sql .= " LEFT JOIN  " . $table_prefix . "coupons_sites s ON s.coupon_id=c.coupon_id)";
        } else {
            $sql .= ")";
        }
        $sql .= " WHERE c.coupon_code=" . $db->tosql($new_coupon_code, TEXT);
        if (isset($site_id)) {
            $sql .= " AND (c.sites_all=1 OR s.site_id=" . $db->tosql($site_id, INTEGER, true, false) . ")";
        } else {
            $sql .= " AND c.sites_all=1 ";
        }
        $sql .= " ORDER BY c.apply_order ";
        $db->query($sql);
        if ($db->next_record()) {
            $new_coupon_id = $db->f("coupon_id");
            $start_date_db = $db->f("start_date", DATETIME);
            $expiry_date_db = $db->f("expiry_date", DATETIME);
            $coupon_title = $db->f("coupon_title");
            $new_coupons[$new_coupon_id] = $db->Record;
            $new_coupons[$new_coupon_id]["start_date_db"] = $start_date_db;
            $new_coupons[$new_coupon_id]["expiry_date_db"] = $expiry_date_db;
        }
    }
    $discount_types = array("3,4", "1,2", "5");
    // check products coupons, then order coupons and only then vouchers
    if ($auto_apply) {
        for ($dt = 0; $dt < sizeof($discount_types); $dt++) {
            $sql = " SELECT c.* FROM ";
            if (isset($site_id)) {
                $sql .= " ( ";
            }
            $sql .= $table_prefix . "coupons c";
            if (isset($site_id)) {
                $sql .= " LEFT JOIN  " . $table_prefix . "coupons_sites s ON s.coupon_id=c.coupon_id)";
            }
            $sql .= " WHERE c.is_auto_apply=1 ";
            $sql .= " AND c.discount_type IN (" . $discount_types[$dt] . ") ";
            if (isset($site_id)) {
                $sql .= " AND (c.sites_all=1 OR s.site_id=" . $db->tosql($site_id, INTEGER, true, false) . ")";
            } else {
                $sql .= " AND c.sites_all=1 ";
            }
            $sql .= " ORDER BY c.apply_order ";
            $db->query($sql);
            while ($db->next_record()) {
                $new_coupon_id = $db->f("coupon_id");
                $start_date_db = $db->f("start_date", DATETIME);
                $expiry_date_db = $db->f("expiry_date", DATETIME);
                $new_coupons[$new_coupon_id] = $db->Record;
                $new_coupons[$new_coupon_id]["start_date_db"] = $start_date_db;
                $new_coupons[$new_coupon_id]["expiry_date_db"] = $expiry_date_db;
            }
        }
    }
    // check if new coupons could be added
    if (sizeof($new_coupons) > 0) {
        foreach ($new_coupons as $new_coupon_id => $data) {
            $coupon_error = "";
            $is_active = $data["is_active"];
            $new_coupon_id = $data["coupon_id"];
            $coupon_auto_apply = $data["is_auto_apply"];
            $coupon_code = $data["coupon_code"];
            $coupon_title = $data["coupon_title"];
            $discount_type = $data["discount_type"];
            $discount_quantity = $data["discount_quantity"];
            $coupon_discount = $data["discount_amount"];
            $free_postage = $data["free_postage"];
            $coupon_tax_free = $data["coupon_tax_free"];
            $coupon_order_tax_free = $data["order_tax_free"];
            $items_all = $data["items_all"];
            $items_ids = $data["items_ids"];
            $items_types_ids = $data["items_types_ids"];
            $search_items_ids = explode(",", $items_ids);
            $search_items_types_ids = explode(",", $items_types_ids);
            $cart_items_all = $data["cart_items_all"];
            $cart_items_ids = $data["cart_items_ids"];
            $cart_items_types_ids = $data["cart_items_types_ids"];
            $users_all = $data["users_all"];
            $users_use_limit = $data["users_use_limit"];
            $users_ids = $data["users_ids"];
            $users_types_ids = $data["users_types_ids"];
            $search_users_ids = explode(",", $users_ids);
            $search_users_types_ids = explode(",", $users_types_ids);
            $expiry_date = "";
            $is_expired = false;
            $expiry_date_db = $data["expiry_date_db"];
            if (is_array($expiry_date_db)) {
                $expiry_date = va_date($date_show_format, $expiry_date_db);
                $expiry_date_ts = mktime(0, 0, 0, $expiry_date_db[MONTH], $expiry_date_db[DAY], $expiry_date_db[YEAR]);
                $current_date_ts = va_timestamp();
                if ($current_date_ts > $expiry_date_ts) {
                    $is_expired = true;
                }
            }
            $start_date = "";
            $is_upcoming = false;
            $start_date_db = $data["start_date_db"];
            if (is_array($start_date_db)) {
                $start_date = va_date($date_show_format, $start_date_db);
                $start_date_ts = mktime(0, 0, 0, $start_date_db[MONTH], $start_date_db[DAY], $start_date_db[YEAR]);
                $current_date_ts = va_timestamp();
                if ($current_date_ts < $start_date_ts) {
                    $is_upcoming = true;
                }
            }
            // check number how many times user can use coupon
            $user_not_limited = false;
            if ($users_use_limit && $user_id) {
                if ($discount_type == 3 || $discount_type == 4) {
                    $sql = " SELECT COUNT(*) FROM " . $table_prefix . "orders_items oi ";
                    $sql .= " WHERE oi.user_id=" . $db->tosql($user_id, INTEGER);
                    $sql .= " AND (oi.coupons_ids=" . $db->tosql($new_coupon_id, TEXT);
                    $sql .= " OR oi.coupons_ids LIKE '" . $db->tosql($new_coupon_id, INTEGER) . ",%'";
                    $sql .= " OR oi.coupons_ids LIKE '%," . $db->tosql($new_coupon_id, INTEGER) . "'";
                    $sql .= " OR oi.coupons_ids LIKE '%," . $db->tosql($new_coupon_id, INTEGER) . ",%') ";
                } else {
                    $sql = " SELECT COUNT(*) FROM (" . $table_prefix . "orders o ";
                    $sql .= " INNER JOIN " . $table_prefix . "orders_coupons oc ON o.order_id=oc.order_id) ";
                    $sql .= " WHERE o.user_id=" . $db->tosql($user_id, INTEGER);
                    $sql .= " AND oc.coupon_id=" . $db->tosql($new_coupon_id, INTEGER);
                }
                $user_uses = get_db_value($sql);
                if ($users_use_limit > $user_uses) {
                    $user_not_limited = true;
                }
            }
            // check goods cost limits
            $orders_period = $data["orders_period"];
            $orders_interval = $data["orders_interval"];
            $orders_min_goods = $data["orders_min_goods"];
            $orders_max_goods = $data["orders_max_goods"];
            $orders_goods_coupon = false;
            if ($user_id && ($orders_min_goods || $orders_max_goods)) {
                // check if user buy something in the past
                $sql = " SELECT SUM(o.goods_total) FROM (" . $table_prefix . "orders o ";
                $sql .= " INNER JOIN " . $table_prefix . "order_statuses os ON o.order_status=os.status_id) ";
                $sql .= " WHERE o.user_id=" . $db->tosql($user_id, INTEGER);
                $sql .= " AND os.paid_status=1 ";
                if ($orders_period && $orders_interval) {
                    $cd = va_time();
                    if ($orders_period == 1) {
                        $od = mktime(0, 0, 0, $cd[MONTH], $cd[DAY] - $orders_interval, $cd[YEAR]);
                    } elseif ($orders_period == 2) {
                        $od = mktime(0, 0, 0, $cd[MONTH], $cd[DAY] - $orders_interval * 7, $cd[YEAR]);
                    } elseif ($orders_period == 3) {
                        $od = mktime(0, 0, 0, $cd[MONTH] - $orders_interval, $cd[DAY], $cd[YEAR]);
                    } else {
                        $od = mktime(0, 0, 0, $cd[MONTH], $cd[DAY], $cd[YEAR] - $orders_interval);
                    }
                    $sql .= " AND order_placed_date>=" . $db->tosql($od, DATETIME);
                }
                $user_goods_cost = get_db_value($sql);
                if ($user_goods_cost >= $orders_min_goods && ($user_goods_cost <= $orders_max_goods || !strlen($orders_max_goods))) {
                    $orders_goods_coupon = true;
                }
            }
            // check for friends coupons
            $friends_coupon = false;
            $friends_discount_type = $data["friends_discount_type"];
            $friends_all = $data["friends_all"];
            $friends_ids = $data["friends_ids"];
            $friends_types_ids = $data["friends_types_ids"];
            $friends_period = $data["friends_period"];
            $friends_interval = $data["friends_interval"];
            $friends_min_goods = $data["friends_min_goods"];
            $friends_max_goods = $data["friends_max_goods"];
            $search_friends_ids = explode(",", $friends_ids);
            $search_friends_types_ids = explode(",", $friends_types_ids);
            if ($friends_discount_type == 1) {
                // check if user friends buy something
                $user_friends_goods = 0;
                if ($user_id) {
                    $sql = " SELECT SUM(o.goods_total) FROM (" . $table_prefix . "orders o ";
                    $sql .= " INNER JOIN " . $table_prefix . "order_statuses os ON o.order_status=os.status_id) ";
                    $sql .= " WHERE o.friend_user_id=" . $db->tosql($user_id, INTEGER);
                    $sql .= " AND os.paid_status=1 ";
                    if ($friends_period && $friends_interval) {
                        $cd = va_time();
                        if ($friends_period == 1) {
                            $od = mktime(0, 0, 0, $cd[MONTH], $cd[DAY] - $friends_interval, $cd[YEAR]);
                        } elseif ($friends_period == 2) {
                            $od = mktime(0, 0, 0, $cd[MONTH], $cd[DAY] - $friends_interval * 7, $cd[YEAR]);
                        } elseif ($friends_period == 3) {
                            $od = mktime(0, 0, 0, $cd[MONTH] - $friends_interval, $cd[DAY], $cd[YEAR]);
                        } else {
                            $od = mktime(0, 0, 0, $cd[MONTH], $cd[DAY], $cd[YEAR] - $friends_interval);
                        }
                        $sql .= " AND order_placed_date>=" . $db->tosql($od, DATETIME);
                    }
                    $user_friends_goods = get_db_value($sql);
                }
                if ($user_friends_goods >= $friends_min_goods && ($user_friends_goods <= $friends_max_goods || !strlen($friends_max_goods))) {
                    $friends_coupon = true;
                }
            } elseif ($friends_discount_type == 2) {
                $friend_code = get_session("session_friend");
                $friend_user_id = get_friend_info();
                $friend_type_id = get_session("session_friend_type_id");
                // check whose friends could use coupon
                if ($friends_all && $friend_user_id || $friend_user_id && in_array($friend_user_id, $search_friends_ids) || $friend_type_id && in_array($friend_type_id, $search_friends_types_ids)) {
                    $friends_coupon = true;
                }
            }
            // global options
            $is_exclusive = $data["is_exclusive"];
            $quantity_limit = $data["quantity_limit"];
            $coupon_uses = $data["coupon_uses"];
            // check cart total values
            $min_cart_quantity = $data["min_cart_quantity"];
            $max_cart_quantity = $data["max_cart_quantity"];
            $min_cart_cost = $data["min_cart_cost"];
            $max_cart_cost = $data["max_cart_cost"];
            if ($discount_type <= 2) {
                $cart_items_all = 1;
            }
            // for order coupons always use all cart products to calculate totals
            check_cart_totals($cart_quantity, $cart_cost, $shopping_cart, $cart_items_all, $cart_items_ids, $cart_items_types_ids);
            // product specific fields
            $min_quantity = $data["min_quantity"];
            $max_quantity = $data["max_quantity"];
            $minimum_amount = $data["minimum_amount"];
            $maximum_amount = $data["maximum_amount"];
            // check if coupon can be applied
            if (!$is_active) {
                $coupon_error = COUPON_NON_ACTIVE_MSG;
            } elseif ($quantity_limit > 0 && $coupon_uses >= $quantity_limit) {
                $coupon_error = COUPON_USED_MSG;
            } elseif ($is_expired) {
                $coupon_error = COUPON_EXPIRED_MSG;
            } elseif ($is_upcoming) {
                $coupon_error = COUPON_UPCOMING_MSG;
            } elseif (($exclusive_applied || $is_exclusive && $coupons_total > 0) && $discount_type != 5 && !is_only_gift_certificate()) {
                //Customization by Vital - allow gift cert. with other coupons
                $coupon_error = COUPON_EXCLUSIVE_MSG;
            } elseif ($discount_type <= 4 && $min_cart_cost > $cart_cost) {
                $coupon_error = str_replace("{cart_amount}", currency_format($min_cart_cost), MIN_CART_COST_ERROR);
            } elseif ($discount_type <= 4 && $max_cart_cost && $max_cart_cost < $cart_cost) {
                $coupon_error = str_replace("{cart_amount}", currency_format($max_cart_cost), MAX_CART_COST_ERROR);
            } elseif ($discount_type <= 4 && $min_cart_quantity > $cart_quantity) {
                $coupon_error = str_replace("{min_quantity}", $min_cart_quantity, COUPON_MIN_QTY_ERROR);
            } elseif ($discount_type <= 4 && $max_cart_quantity && $max_cart_quantity < $cart_quantity) {
                $coupon_error = str_replace("{max_quantity}", $max_cart_quantity, COUPON_MAX_QTY_ERROR);
            } elseif (!($users_all || $user_id && in_array($user_id, $search_users_ids) || $user_type_id && in_array($user_type_id, $search_users_types_ids))) {
                $coupon_error = COUPON_CANT_BE_USED_MSG;
                // coupon can't be used for current user
            } elseif ($users_use_limit && !$user_not_limited) {
                // coupon can't be used more times
                if ($users_use_limit == 1) {
                    $coupon_error = COUPON_CAN_BE_USED_ONCE_MSG;
                } else {
                    $coupon_error = str_replace("{use_limit}", $users_use_limit, COUPON_SAME_USE_LIMIT_MSG);
                }
            } elseif ($friends_discount_type > 0 && !$friends_coupon) {
                $coupon_error = COUPON_CANT_BE_USED_MSG;
                // coupon has friends options which can't be used for current user
            } elseif (($orders_min_goods || $orders_max_goods) && !$orders_goods_coupon) {
                $coupon_error = COUPON_CANT_BE_USED_MSG;
                // the sum of user purchased goods doesn't match with goods values for this coupon
            }
            // end coupons checks
            if (!$coupon_error) {
                // check products coupons
                $coupon_items = false;
                foreach ($shopping_cart as $cart_id => $item) {
                    $item_id = $item["ITEM_ID"];
                    $item_type_id = $item["ITEM_TYPE_ID"];
                    $properties_more = $item["PROPERTIES_MORE"];
                    //Customization by Vital
                    $properties_info_array = $item["PROPERTIES_INFO"];
                    $properties_info_array = reset($properties_info_array);
                    $coupon_size_applies = array();
                    if (preg_match('#\\((.*?)\\)#', $coupon_title, $sizes)) {
                        //get all sizes
                        $sizes[1] = strtolower(str_replace(" ", "", $sizes[1]));
                        //remove spaces and lowercase it
                        $coupon_size_applies = explode(",", $sizes[1]);
                        //place them in array
                    }
                    //place them in array
                    $size_does_not_apply = false;
                    $item_size = "";
                    if (count($coupon_size_applies) != 0 && strcasecmp($properties_info_array["NAME"], "size") == 0) {
                        $sql = "SELECT property_value FROM va_items_properties_values WHERE item_property_id=" . $properties_info_array["VALUES"][0];
                        $db->query($sql);
                        if ($db->next_record()) {
                            $item_size = strtolower($db->f("property_value"));
                        }
                        $size_does_not_apply = !in_array($item_size, $coupon_size_applies);
                    }
                    //Check if the coupon applies for the item size
                    if (strcasecmp($properties_info_array["NAME"], "size") == 0 && !$items_all) {
                        $sql = "SELECT COUNT(*) FROM va_coupons_sizes WHERE coupon_id=" . $new_coupon_id . " AND item_id=" . $item_id . " AND item_size_id=" . $properties_info_array["VALUES"][0];
                        $size_is_in = get_db_value($sql);
                        $sql = "SELECT COUNT(*) FROM va_coupons_sizes WHERE coupon_id=" . $new_coupon_id . " AND item_id=" . $item_id;
                        $other_sizes = get_db_value($sql);
                        $size_does_not_apply = $size_is_in == 0 && $other_sizes != 0 ? true : false;
                    }
                    //$coupon_error = $size_does_not_apply."  ".$coupon_size_applies;
                    //if (!$item_id || $properties_more > 0) { //original line
                    if (!$item_id || $properties_more > 0 || $size_does_not_apply) {
                        //EDN customization
                        // ignore the products which has options to be added first
                        continue;
                    }
                    $quantity = $item["QUANTITY"];
                    $basic_price = $item["BASIC_PRICE"];
                    $discounted_price = $item["DISCOUNTED_PRICE"];
                    // add a new coupon
                    if ($discount_type == 3 || $discount_type == 4) {
                        if ($basic_price >= $minimum_amount && $quantity >= $min_quantity && (!$maximum_amount || $basic_price <= $maximum_amount) && (!$max_quantity || $quantity <= $max_quantity) && ($items_all || in_array($item_id, $search_items_ids) || in_array($item_type_id, $search_items_types_ids))) {
                            // add coupon to products
                            $coupon_items = true;
                            if ($discount_type == 3) {
                                $discount_amount = round($basic_price / 100 * $coupon_discount, 2);
                            } else {
                                $discount_amount = $coupon_discount;
                            }
                            if ($discount_amount > $discounted_price) {
                                $discount_amount = $discounted_price;
                            }
                            $shopping_cart[$cart_id]["DISCOUNTED_PRICE"] -= $discount_amount;
                            if (!isset($shopping_cart[$cart_id]["COUPONS"][$new_coupon_id])) {
                                // calculate number of new applied coupons
                                $new_coupons_total++;
                            }
                            $shopping_cart[$cart_id]["COUPONS"][$new_coupon_id] = array("COUPON_ID" => $new_coupon_id, "EXCLUSIVE" => $is_exclusive, "DISCOUNT_QUANTITY" => $discount_quantity, "DISCOUNT_AMOUNT" => $discount_amount, "AUTO_APPLY" => $coupon_auto_apply);
                            if ($is_exclusive) {
                                $exclusive_applied = true;
                            }
                            $coupons_total++;
                        }
                    }
                }
                if (($discount_type == 3 || $discount_type == 4) && !$coupon_items) {
                    $coupon_error = COUPON_PRODUCTS_MSG;
                }
                // end products checks
                // check order coupons
                if ($discount_type <= 2 || $discount_type == 5) {
                    if (!isset($order_coupons[$new_coupon_id])) {
                        $new_coupons_total++;
                    }
                    // add new coupon to system
                    $order_coupons[$new_coupon_id] = array("COUPON_ID" => $new_coupon_id, "DISCOUNT_TYPE" => $discount_type, "EXCLUSIVE" => $is_exclusive, "COUPON_TAX_FREE" => $coupon_tax_free, "MIN_QUANTITY" => $min_cart_quantity, "MAX_QUANTITY" => $max_cart_quantity, "MIN_AMOUNT" => $min_cart_cost, "MAX_AMOUNT" => $max_cart_cost, "ORDER_TAX_FREE" => $coupon_order_tax_free, "AUTO_APPLY" => $coupon_auto_apply);
                    if ($is_exclusive) {
                        $exclusive_applied = true;
                    }
                    $coupons_total++;
                }
                // end order coupons checks
            }
            if (strtolower($coupon_code) == strtolower($new_coupon_code) && $coupon_error) {
                $new_coupon_error = $coupon_error;
            }
        }
    }
    // end check a new coupons and auto-applied coupons
    // update shopping cart and order coupons
    set_session("shopping_cart", $shopping_cart);
    set_session("session_coupons", $order_coupons);
    // return number of applied coupons
    return $new_coupons_total;
}
							<thead>
								<tr>
									<th></th>									
									<th></th>
									<th></th>
									<th></th>
									<th></th>									
									<th><?php 
echo currency_format($bill_amt);
if ($currency_postfix) {
    echo $currency_postfix['currency_postfix'];
}
?>
</th>
									<th><?php 
echo currency_format($pay_amt);
if ($currency_postfix) {
    echo $currency_postfix['currency_postfix'];
}
?>
</th>
								</tr>
							</thead>
						</table>
					</div>	
				</div>
			</div>
		</div>
	</div>
</div>
Example #17
0
                                  </td>
                                  <td class="mw-order-item-id"><?php 
                    print $cart_item['title'];
                    ?>
</td>
                                  <td class="mw-order-item-amount"><?php 
                    print $cart_item['price'];
                    ?>
</td>
                                  <td class="mw-order-item-amount"><?php 
                    print $cart_item['qty'];
                    ?>
</td>
                                  <td class="mw-order-item-count"><?php 
                    print currency_format($cart_item['price'] * $cart_item['qty'], $item['currency']);
                    ?>
</td>
                                </tr>
                              <?php 
                }
                ?>
                            </tbody>
                          </table>
                        <?php 
            } else {
                ?>
                        <?php 
                _e("Cannot get order's items");
                ?>
                      <?php 
Example #18
0
        }
        ?>
</td>
        <td><input type="number" min="1" class="input-mini form-control input-sm" value="<?php 
        print $item['qty'];
        ?>
" onchange="mw.cart.qty('<?php 
        print $item['id'];
        ?>
', this.value);" /></td>
        <?php 
        /*<td><?php print currency_format($item['price']); ?></td>*/
        ?>

        <td class="mw-cart-table-price"><?php 
        print currency_format($item['price'] * $item['qty']);
        ?>
</td>
        <td><a title="<?php 
        _e("Remove");
        ?>
" class="icon-trash" href="javascript:mw.cart.remove('<?php 
        print $item['id'];
        ?>
');"></a></td>
      </tr>
      <?php 
    }
    ?>
    </tbody>
  </table>
Example #19
0
</th>
                    <th class="amount"><?php 
echo currency_format(number_format((double) $total, 2, '.', ''));
if ($currency_postfix) {
    echo $currency_postfix['currency_postfix'];
}
?>
</th>
                </tr>
                <tr>
                    <th class="particular" colspan="3"><?php 
echo $this->lang->line('paid') . " " . $this->lang->line('amount');
?>
</th>
                    <th class="amount"><?php 
echo currency_format($paid_amount);
if ($currency_postfix) {
    echo $currency_postfix['currency_postfix'];
}
?>
</th>
                </tr>
            </table>
            <span class="alignleft"><?php 
echo $this->lang->line('thanks');
?>
</span>
            <span class="alignright"><?php 
echo $this->lang->line('for');
?>
 <?php 
Example #20
0
?>
" disabled  type="text" class="mw-ui-invisible-field" />
<?php 
if (isset($payment_currency) and !in_array(strtoupper($cur), $curencies)) {
    ?>
<label class="mw-ui-label">
	<?php 
    _e("Equals to");
    ?>
	(rate: <?php 
    print $payment_currency_rate;
    ?>
	<?php 
    _e("or");
    ?>
	<?php 
    print currency_format(100, $cur);
    ?>
=<?php 
    print currency_format(100 * $payment_currency_rate, $payment_currency);
    ?>
 )</label>
<input  value="<?php 
    print currency_format($num * $payment_currency_rate, $payment_currency);
    ?>
" disabled  type="text" class="mw-ui-invisible-field" />
<?php 
}
?>

        ?>
</td>
                            <td><?php 
        echo $row->kd_barang;
        ?>
</td>
                            <td><?php 
        echo $row->nm_barang;
        ?>
</td>
                            <td><?php 
        echo $row->qty;
        ?>
</td>
                            <td><?php 
        echo currency_format($row->harga);
        ?>
</td>
                        </tr>
                    <?php 
    }
}
?>
                </tbody>
            </table>

            <div class="form-actions">
                <a href="<?php 
echo site_url('penjualan');
?>
" class="btn btn-inverse">
Example #22
0
$totals['tax2'] = 0;
$totals['shipping'] = 0;
$totals['cost'] = 0;
foreach ($invoices as $key => $inv) {
    $totals['tax'] += $inv['tax'];
    $totals['tax2'] += $inv['tax2'];
    $totals['shipping'] += $inv['shipping'];
    $totals['cost'] += $inv['cost'];
    $invoices[$key]['issue_date'] = date($SYSTEM["regional"]["invoicedate"], $invoices[$key]['issue_date']);
    $invoices[$key]['due_date'] = date($SYSTEM["regional"]["invoicedate"], $invoices[$key]['due_date']);
    $invoices[$key]['tax'] = currency_format($inv['tax']);
    $invoices[$key]['tax2'] = currency_format($inv['tax2']);
    $invoices[$key]['shipping'] = currency_format($inv['shipping']);
    $invoices[$key]['cost'] = currency_format($inv['cost']);
    $invoices[$key]['total'] = currency_format($inv['total']);
}
$totals['total'] = $totals['cost'] + $totals['tax'] + $totals['tax2'] + $totals['shipping'];
$totals['cost'] = currency_format($totals['cost']);
$totals['tax'] = currency_format($totals['tax']);
$totals['tax2'] = currency_format($totals['tax2']);
$totals['shipping'] = currency_format($totals['shipping']);
$totals['total'] = currency_format($totals['total']);
$tpl->set('item', $item);
$tpl->set('value', $value);
$tpl->set('param', $param);
$tpl->set('search', $search);
$tpl->set('invoices', $invoices);
$tpl->set('message', $message);
$tpl->set('totals', $totals);
$tpl->display();
releaseConnection($db);
Example #23
0
    ?>
</td>
                <td class="mw-ui-table-green"><?php 
    print currency_format($ord['shipping'], $ord['currency']);
    ?>
</td>
              </tr>
              <tr class="mw-ui-table-footer last">
                <td colspan="2">&nbsp;</td>
                <td class="mw-ui-table-green"><strong>
                  <?php 
    _e("Total:");
    ?>
                  </strong></td>
                <td class="mw-ui-table-green"><strong><?php 
    print currency_format($grandtotal, $ord['currency']);
    ?>
</strong></td>
              </tr>
            </tbody>
          </table>
          <?php 
} else {
    ?>
          <h2>
            <?php 
    _e("The cart is empty");
    ?>
          </h2>
          <?php 
}
 if ($admin_notification && $admin_mail_type && strpos($admin_message, "{basket}") !== false) {
     $t->set_file("basket", "email_basket.html");
     $items_text = show_order_items($order_id, true, "");
     $t->parse("basket", false);
 }
 if ($admin_notification && !$admin_mail_type && strpos($admin_message, "{basket}") !== false || $admin_sms && !$items_text && strpos($admin_sms_message, "{basket}") !== false) {
     $t->set_file("basket", "email_basket.txt");
     $items_text = show_order_items($order_id, true, "");
     $t->parse("basket", false);
 }
 $sql = "SELECT * FROM " . $table_prefix . "orders WHERE order_id=" . $db->tosql($order_id, INTEGER);
 $db->query($sql);
 $db->next_record();
 $t->set_vars($db->Record);
 $t->set_var("goods_total", currency_format($db->f("goods_total")));
 $t->set_var("shipping_cost", currency_format($db->f("shipping_cost")));
 $t->set_var("tax_percent", number_format($db->f("tax_percent"), 2) . "%");
 $order_placed_date = $db->f("order_placed_date", DATETIME);
 $order_placed_date_string = va_date($datetime_show_format, $order_placed_date);
 $t->set_var("order_placed_date", $order_placed_date_string);
 $company_id = $db->f("company_id");
 $state_id = $db->f("state_id");
 $country_id = $db->f("country_id");
 $delivery_company_id = $db->f("delivery_company_id");
 $delivery_state_id = $db->f("delivery_state_id");
 $delivery_country_id = $db->f("delivery_country_id");
 $company_select = get_db_value("SELECT company_name FROM " . $table_prefix . "companies WHERE company_id=" . $db->tosql($company_id, INTEGER));
 $delivery_company_select = get_db_value("SELECT company_name FROM " . $table_prefix . "companies WHERE company_id=" . $db->tosql($delivery_company_id, INTEGER));
 $state = get_db_value("SELECT state_name FROM " . $table_prefix . "states WHERE state_id=" . $db->tosql($state_id, INTEGER, true, false));
 $delivery_state = get_db_value("SELECT state_name FROM " . $table_prefix . "states WHERE state_id=" . $db->tosql($delivery_state_id, INTEGER, true, false));
 $country = get_db_value("SELECT country_name FROM " . $table_prefix . "countries WHERE country_id=" . $db->tosql($country_id, INTEGER, true, false));
Example #25
0
								</li>
								
								
							  </ul>
							<div class="clearfix"></div>
					</div>						
				</div> 
				  <div class="desc1 span_3_of_2">
				  
					<h4><?php 
    echo $row['judul'];
    ?>
</h4>
				<div class="cart-b">
					<div class="left-n "><?php 
    echo currency_format($row['harga']);
    ?>
</div>
				    <a class="now-get get-cart-in" href="#">ADD TO CART</a> 
				    <div class="clearfix"></div>
				 </div>
				 <h6>Stock :<?php 
    echo $row['jumlah'];
    ?>
</h6>
				 <h6>Merk :<?php 
    echo $row['merk'];
    ?>
</h6>
				  <h6>Di Update :<?php 
    echo date('d M Y H:i:s', strtotime($row['tgl_input_pro']));
Example #26
0
</td>
              </tr>
              <?php 
    }
    ?>
              
              
              <tr class="mw-ui-table-footer last">
                <td colspan="2">&nbsp;</td>
                <td class="mw-ui-table-green"><strong>
                  <?php 
    _e("Total:");
    ?>
                  </strong></td>
                <td class="mw-ui-table-green"><strong><?php 
    print currency_format($ord['amount'], $ord['currency']);
    ?>
</strong></td>
              </tr>
            </tbody>
          </table>
          <?php 
} else {
    ?>
          <h2>
            <?php 
    _e("The cart is empty");
    ?>
          </h2>
          <?php 
}
Example #27
0
        ?>


                     <div class="product-price-holder clearfix">
        <?php 
        if ($show_fields == false or in_array('price', $show_fields)) {
            ?>
        <?php 
            if (isset($item['prices']) and is_array($item['prices'])) {
                ?>
 <?php 
                $vals2 = array_values($item['prices']);
                $val1 = array_shift($vals2);
                ?>
        <span class="sidebar-price"><?php 
                print currency_format($val1);
                ?>
</span>        <?php 
            } else {
                ?>

        <?php 
            }
            ?>
        <?php 
        }
        ?>
        <?php 
        if ($show_fields == false or in_array('add_to_cart', $show_fields)) {
            ?>
        <?php 
Example #28
0
        
        
        
        <tr>
          <td></td>
          <td><label>
              <?php 
        _e("Total Price");
        ?>
              :</label></td>
          <td  class="cell-shipping-total">
          <?php 
        $print_total = cart_total();
        ?>
          <span class="total_cost"><?php 
        print currency_format($print_total);
        ?>
</span>
          
          </td>
        </tr>
      </tbody>
    </table>
  </div>
  <?php 
    }
    ?>
  <?php 
    if (!isset($params['checkout-link-enabled'])) {
        $checkout_link_enanbled = get_option('data-checkout-link-enabled', $params['id']);
    } else {
Example #29
0
    echo htmlspecialchars(get_currency_name($currency));
    ?>
</span></th>
  <td class="prices">
    <?php 
    if (get_site_config('premium_' . $currency . '_discount')) {
        ?>
    <div class="discounted"><?php 
        echo t(":cost1 per month, or :cost2 per year", array(':cost1' => currency_format($currency, get_site_config('premium_' . $currency . '_monthly')), ':cost2' => currency_format($currency, get_site_config('premium_' . $currency . '_yearly'))));
        ?>
</div>
    <?php 
    }
    ?>
    <?php 
    echo t(":cost1 per month, or :cost2 per year", array(':cost1' => currency_format($currency, get_premium_price($currency, 'monthly')), ':cost2' => currency_format($currency, get_premium_price($currency, 'yearly'))));
    ?>
  </td>
  <td class="buttons">
    <form action="<?php 
    echo htmlspecialchars(url_for('purchase'));
    ?>
" method="post">
      <input type="hidden" name="currency" value="<?php 
    echo htmlspecialchars($currency);
    ?>
">
      <input type="submit" value="<?php 
    echo ht("Purchase");
    ?>
">
Example #30
0
 /**
  * Returns formatted currency string
  * Or unformatted if payments is not installed
  *
  * @param int $params['cur_id'] currency id
  * @param string $params['cur_gid'] currency gid
  * @param int $params['value'] amount
  * @param string $params['template']&nbsp;[abbr][value|dec_part:2|dec_sep:.|gr_sep:&nbsp;]
  * @param bool $params['no_tags']
  * @return string
  */
 function currency_format_output($params = array())
 {
     // {block name=currency_format_output module=payments value=30 cur_gid=RUR}
     $CI =& get_instance();
     if ($CI->pg_module->is_module_installed('payments')) {
         $CI->load->helper('payments');
         return currency_format($params);
     } elseif (empty($params['no_tags'])) {
         return '<span dir="ltr">' . (double) $params['value'] . '&nbsp;USD</span>';
     } else {
         return (double) $params['value'] . '&nbsp;USD';
     }
 }