<?
session_start();
include("../includes/common.php");
/*getting data*/
$curr_from = 0;
$curr_to = 0;
$amount = 0;
if(isset($_POST['submit'])){
$curr_from = $_POST['curr_from']+0;
$curr_to = $_POST['curr_to']+0;
$amount = $_POST['amount']+0;
$user_email = trim($_POST['user_email']);
}
else{
$error = urlencode("Ошибка при передаче данных.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
/* checking data*/
if(!isset($_POST["verify"]) || empty($_POST["verify"]) || $_POST["verify"] != $_SESSION["VERIFY_IMG_STR"])
{
$error = urlencode("Введённый контрольный код неверен.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
else
{
unset($_SESSION["VERIFY_IMG_STR"]);
}
if(!(is_numeric($curr_from)&&is_numeric($curr_to)&&is_numeric($amount)&&$curr_from > 0&&$curr_to > 0&&$amount > 0)){
$error = urlencode("Ошибка при передаче данных.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
$ex_row = mysql_fetch_object(mysql_query("select * from ex_exchanges where ex_currency1_id = $curr_from and ex_currency2_id = $curr_to and status =1"));
if($ex_row->id==""|| $amount > $ex_row->max_amount){
$error = urlencode("Ошибка при передаче данных.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
$ex_course = $ex_row->course;
$row_from = mysql_fetch_object(mysql_query("select * from ex_currencies where id = $curr_from and status =1"));
$row_to = mysql_fetch_object(mysql_query("select * from ex_currencies where id = $curr_to and status =1"));
if($row_from->id==""||$row_to->id==""){
$error = urlencode("Ошибка при передаче данных.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
if($row_from->type == "pincode" && $row_to->type == "pincode")
{
$error = urlencode("Обмен ПИН-кода на ПИН-код невозможен.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
/* amounts array */
$values_arr = CountOut($amount,$curr_from,$curr_to);
$real_course = $values_arr['cource'];
$tmp_amount = $row_to->metal_id>0?round($row_to->amount*GetMetalPrice($row_to->metal_id),2):$row_to->amount;
if ("pincode" != $row_to->type)
{
if($tmp_amount < $values_arr['out_amount'])
{
$error = urlencode("На системном счете недостаточно средств.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
}
else
{
$row = @mysql_fetch_object(@mysql_query("SELECT COUNT(*) as cnt FROM pincodes
WHERE
`collection_id`='".$row_to->pincode_collection_id."'
AND `status` = 'valid'"));
if (0 >= intval($row->cnt))
{
$error = urlencode("На системном счете недостаточно средств.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
}
/* STARTING CHECK OF ALL DATA*/
$error = "";
/* PERSONAL CHECK*/
if($row_from->type == "pincode")
{
$pincode = $_POST["pincode"];
if(empty($pincode))
{
$error = urlencode("Вы не ввели ПИН-код.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
else
{
$pincode = str_replace(" ", "", $pincode);
if(!ereg("[0-9]+", $pincode))
{
$error = urlencode("Вы ввели ПИН-код неправильно.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
}
}
if($row_to->transfare_type == "manual")
{
$account = $_POST["account"];
if(empty($account))
{
$error = urlencode("Вы не ввели эккаунт для получения платежа.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
}
elseif($row_to->code == "WMR"||$row_to->code == "WMZ"||$row_to->code == "WME"||$row_to->code == "WMU"){
if($row_to->code == "WMR"){
$purse = "R";
}
elseif($row_to->code == "WMZ"){
$purse = "Z";
}
elseif($row_to->code == "WME"){
$purse = "E";
}
elseif($row_to->code == "WMU"){
$purse = "U";
}
$wm_purse = $_POST[strtolower($purse)."_wm_purse"];
$wm_id = trim($_POST["wm_id"]);
if(!eregi("^".strtolower($purse)."[0-9]{12}$",strtolower($wm_purse))){
$error .= "Вы указали неверный кошелек-получатель.<br>\n";
}
else{
/* SETTING COOKIES */
setcookie(strtolower($purse)."_wm_purse", $wm_purse , time()+24*3600*365,"/",".".$_SERVER["SERVER_NAME"]);
}
if($wm_id!=""&&!eregi("^[0-9]{12}$",$wm_id)){
$error .= "Вы указали несуществующий WM идентификатор.<br>\n";
}
elseif($wm_id!=""){
/* checcking WM2PURSE */
if(!WMCheckPurse($wm_id,$wm_purse)){
$error .= "Указанный кошелек не принадлежит WM идентификатору $wm_id.<br>\n";
}
/* SETTING COOKIES */
setcookie("wm_id", $wm_id, time()+24*3600*365,"/",".".$_SERVER["SERVER_NAME"]);
}
}
elseif($row_to->code == "YMR"||$row_to->code == "PCE"||$row_to->code == "PCD"||$row_to->code == "PCH"||$row_to->code == "PCL"){
$var_name = strtolower($row_to->code)."_account";
$ym_account = $_POST[$var_name];
if(!eregi("^[0-9]{10,20}$",$ym_account)){
$error .= "Вы указали неверный номер счета.<br>\n";
}
else{
/* SETTING COOKIES */
setcookie($var_name, $ym_account , time()+24*3600*365,"/",".".$_SERVER["SERVER_NAME"]);
}
}
elseif($row_to->code == "EPD"){
$eport_serial = $_POST["eport_serial"];
$eport_number = $_POST["eport_number"];
if(!eregi("^[0-9]{6}$",$eport_serial)||!eregi("^[0-9]{5}$",$eport_number)){
$error .= "Вы указали неверный номер E-Port карты.<br>\n";
}
else{
/* SETTING COOKIES */
setcookie("eport_serial", $eport_serial , time()+24*3600*365,"/",".".$_SERVER["SERVER_NAME"]);
setcookie("eport_number", $eport_number , time()+24*3600*365,"/",".".$_SERVER["SERVER_NAME"]);
}
}
elseif($row_to->code == "EGOLD"||$row_to->code == "ESILVER"||$row_to->code == "EPLATINUM"||$row_to->code == "EPALLADIUM"){
$egold_account = $_POST["egold_account"];
if(!eregi("^[0-9]+$",$egold_account)){
$error .= "Вы указали неверный номер счета в E-Gold.<br>\n";
}
else{
/* SETTING COOKIES */
setcookie("egold_account", $egold_account , time()+24*3600*365,"/",".".$_SERVER["SERVER_NAME"]);
}
}
elseif($row_to->code == "EBGOLD"||$row_to->code == "EBSILVER"||$row_to->code == "EBCURRENCYUSD"){
$ebullion_account = $_POST["ebullion_account"];
if(!eregi("^[A-Z]{1}[0-9]+$",$ebullion_account)){
$error .= "Вы указали неверный счет в E-Bullion.<br>\n";
}
else{
/* SETTING COOKIES */
setcookie("ebullion_account", $ebullion_account , time()+24*3600*365,"/",".".$_SERVER["SERVER_NAME"]);
}
}
if($row_to->type == "pincode")
{
if(empty($user_email))
{
$error = urlencode("Вы не ввели e-mail для получения ПИН-кода.");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
}
if($user_email!=""&&validateEmail($user_email)){
setcookie("user_email",$user_email, time()+24*3600*365,"/",".".$_SERVER["SERVER_NAME"]);
}
elseif($user_email!=""){
$error .= "Указан неверный e-mail адрес пользователя.<br>\n";
}
if($error!=""){
header("Location: $SITE_URL/exchange.php?from=$curr_from&to=$curr_to&amount_in=$amount&error=".urlencode($error));
exit;
}
/* CREATING ORDER */
/* getting array of count values */
$amount = $values_arr['in_amount'];
$out_amount = $values_arr['out_amount'];
$ex_from_comission = $values_arr['ex_from_com'];
$ex_to_comission = $values_arr['ex_to_com'];
$sys_comission = $values_arr['sys_com'];
/* METAL COMISSIONS */
$metal_amount_from = $row_from->metal_id > 0?round($amount/GetMetalPrice($row_from->metal_id),6):0;
$metal_amount_to = $row_to->metal_id>0?round($out_amount/GetMetalPrice($row_to->metal_id),6):0;
$metal_from_comission = $row_from->metal_id > 0?round($ex_from_comission/GetMetalPrice($row_from->metal_id),6):0;
$metal_to_comission = $row_to->metal_id>0?round($ex_to_comission/GetMetalPrice($row_to->metal_id),6):0;
$metal_sys_comission = $row_from->metal_id>0?round($sys_comission/GetMetalPrice($row_from->metal_id),6):0;
/* END METAL COMISSIONS */
/* REAL INVOICE AMOUNT & COMMENTS */
$real_invoice ="";
/* ORDER OF PAYMENT SYSTEM */
/* FROM ORDER -- client pays to US */
if($row_from->code == "WMR"||$row_from->code == "WMZ"||$row_from->code == "WME"||$row_from->code == "WMU"){
if($row_from->code == "WMR"){
$purse = $WM['r_purse'];
}
elseif($row_from->code == "WMZ"){
$purse = $WM['z_purse'];
}
elseif($row_from->code == "WME"){
$purse = $WM['e_purse'];
}
elseif($row_from->code == "WMU"){
$purse = $WM['u_purse'];
}
$query = "INSERT INTO `wm_orders` (`payer_purse` , `payer_wm` , `payee_purse` , `payee_wm` , `sys_invs_no` , `sys_trans_no` , `sys_trans_date` ,`type` ,`status` ) VALUES ('', '', '$purse', '".$WM['id']."', '', '', '',0,1);";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from wm_orders"));
//echo mysql_error();
$from_order_id = $tmp_row[0];
/* FROM CONTENT */
$real_invoice = "";//"счет будет выставлен на ".($values_arr["in_amount"]-$values_arr["ex_from_com"])." $row_from->name для компенсации комиссии за перевод";
}
elseif($row_from->code == "YMR"||$row_from->code == "PCE"||$row_from->code == "PCD"||$row_from->code == "PCH"||$row_from->code == "PCL"){
if($row_from->code == "YMR"){
$curr_code = "rur";
}
elseif($row_from->code == "PCE"){
$curr_code = "eur";
}
elseif($row_from->code == "PCD"){
$curr_code = "usd";
}
elseif($row_from->code == "PCH"){
$curr_code = "uah";
}
elseif($row_from->code == "PCL"){
$curr_code = "lvl";
}
$query = "INSERT INTO `yandex_orders` (`shop_user_id` , `shop_user_name` , `shop_cypher` , `payer_account_id` , `payer_account` , `payer_bank` , `payee_account_id` , `payee_account` , `payee_bank` , `paymentid` , `paymentcurrency` , `contractdatetime` , `authorizationtime` , `type` , `status` )VALUES ('".$YM[$curr_code.'_user_id']."', '".$YM[$curr_code.'_user_name']."', '".$YM[$curr_code.'_cypher']."', '', '', '', '', '".$YM[$curr_code.'_account']."', '".$YM[$curr_code.'_bank']."', '', '".$YM[$curr_code.'_currency']."', '', '', '0', '1');";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from yandex_orders"));
$from_order_id = $tmp_row[0];
}
elseif($row_from->code == "EPD"){
$query = "INSERT INTO `eport_orders` (`shop_id` , `payer_account` , `payee_account` , `eport_order_id` , `sum_eye` , `sum_rur` , `type` , `status` ) VALUES ('".$EPORT['shop_id']."', '', '".$EPORT['account']."', '', '$amount', '0.00', '0', '1');";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from eport_orders"));
$from_order_id = $tmp_row[0];
$real_invoice = "счет будет выставлен на меньшую сумму для компенсации комиссии за перевод";
}
elseif($row_from->code == "EGOLD"||$row_from->code == "ESILVER"||$row_from->code == "EPLATINUM"||$row_from->code == "EPALLADIUM"){
if($row_from->code == "EGOLD"){
$metal_id = 1;
}
elseif($row_from->code == "ESILVER"){
$metal_id = 2;
}
elseif($row_from->code == "EPLATINUM"){
$metal_id = 3;
}
elseif($row_from->code == "EPALLADIUM"){
$metal_id = 4;
}
$query = "INSERT INTO `egold_orders` (`payee_account` , `payment_metal_id` , `payment_batch_num`, `payer_account` , `actual_payment_ounces` , `usd_per_ounce` , `feeweight` , `timestampgmt` , `error` , `type` , `status` ) VALUES ('".$EGOLD['id']."', '$metal_id', '', '', '0.000000', '0.00', '0.000000', '0', '', '0', '1');";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from egold_orders"));
$from_order_id = $tmp_row[0];
/* FROM CONTENT */
// $real_invoice = "в системе E-Gold с вас будет снята комиссия за получение средств";
}
elseif($row_from->code == "EBGOLD"||$row_from->code == "EBSILVER"||$row_from->code == "EBCURRENCYUSD")
{
if($row_from->code == "EBGOLD"){
$metal = 1;
}
elseif($row_from->code == "EBSILVER"){
$metal = 2;
}
elseif($row_from->code == "EBCURRENCYUSD"){
$metal = 3;
}
$query = "INSERT INTO `ebullion_orders` (`payee_account` , `payer_account` , `transaction_id` , `metal` , `exchange` , `timestamp` , `type` , `status` ) VALUES ('".EB_ACCOUNT."', '', '', '$metal', '', '', '0', '1');";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from ebullion_orders"));
$from_order_id = $tmp_row[0];
}
elseif($row_from->type == "pincode")
{
$query = "INSERT INTO `pincode_orders` (`pincode` ,`type` ,`status` ) VALUES ('$pincode',0,1);";
mysql_query($query);
$from_order_id = mysql_insert_id();
}
elseif($row_from->transfare_type == "manual")
{
$query = "INSERT INTO `manual_orders` (`account` ,`type` ,`status` ) VALUES ('',0,1);";
mysql_query($query);
$from_order_id = mysql_insert_id();
}
/* TO ORDER -- WE pay to client */
if($row_to->code == "WMR"||$row_to->code == "WMZ"||$row_to->code == "WME"||$row_to->code == "WMU"){
if($row_to->code == "WMR"){
$purse = $WM['r_purse'];
}
elseif($row_to->code == "WMZ"){
$purse = $WM['z_purse'];
}
elseif($row_to->code == "WME"){
$purse = $WM['e_purse'];
}
elseif($row_to->code == "WMU"){
$purse = $WM['u_purse'];
}
$query = "INSERT INTO `wm_orders` (`payer_purse` , `payer_wm` , `payee_purse` , `payee_wm` , `sys_invs_no` , `sys_trans_no` , `sys_trans_date` ,`type` ,`status` ) VALUES ('$purse', '".$WM['id']."', '$wm_purse', '$wm_id', '', '', '',1,1);";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from wm_orders"));
$to_order_id = $tmp_row[0];
}
elseif($row_to->code == "YMR"||$row_to->code == "PCD"||$row_to->code == "PCE"||$row_to->code == "PCH"||$row_to->code == "PCL"){
if($row_to->code == "YMR"){
$curr_code = "rur";
}
elseif($row_to->code == "PCE"){
$curr_code = "eur";
}
elseif($row_to->code == "PCD"){
$curr_code = "usd";
}
elseif($row_to->code == "PCH"){
$curr_code = "uah";
}
elseif($row_to->code == "PCL"){
$curr_code = "lvl";
}
$query = "INSERT INTO `yandex_orders` (`shop_user_id` , `shop_user_name` , `shop_cypher` , `payer_account_id` , `payer_account` , `payer_bank` , `payee_account_id` , `payee_account` , `payee_bank` , `paymentid` , `paymentcurrency` , `contractdatetime` , `authorizationtime` , `type` , `status` )VALUES ('".$YM[$curr_code.'_user_id']."', '".$YM[$curr_code.'_user_name']."', '".$YM[$curr_code.'_cypher']."', '', '".$YM[$curr_code.'_account']."', '".$YM[$curr_code.'_bank']."', '', '".$ym_account."', '', '', '".$YM[$curr_code.'_currency']."', '', '', '1', '1');";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from yandex_orders"));
$to_order_id = $tmp_row[0];
}
elseif($row_to->code == "EPD"){
$query = "INSERT INTO `eport_orders` (`shop_id` , `payer_account` , `payee_account` , `eport_order_id` , `sum_eye` , `sum_rur` , `type` , `status` ) VALUES ('".$EPORT['shop_id']."', '".$EPORT['account']."', '$eport_serial-$eport_number', '', '$out_amount', '0.00', '1', '1');";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from eport_orders"));
$to_order_id = $tmp_row[0];
}
elseif($row_to->code == "EGOLD"||$row_to->code == "ESILVER"||$row_to->code == "EPLATINUM"||$row_to->code == "EPALLADIUM"){
if($row_to->code == "EGOLD"){
$metal_id = 1;
}
elseif($row_to->code == "ESILVER"){
$metal_id = 2;
}
elseif($row_to->code == "EPLATINUM"){
$metal_id = 3;
}
elseif($row_to->code == "EPALLADIUM"){
$metal_id = 4;
}
$query = "INSERT INTO `egold_orders` (`payee_account` , `payment_metal_id` , `payment_batch_num`, `payer_account` , `actual_payment_ounces` , `usd_per_ounce` , `feeweight` , `timestampgmt` , `error` , `type` , `status` ) VALUES ('$egold_account', '$metal_id', '', '".$EGOLD['id']."', '0.000000', '0.00', '0.000000', '0', '', '1', '1');";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from egold_orders"));
$to_order_id = $tmp_row[0];
/* TO CONTENT */
$real_invoice_to = "учтите, что система E-Gold снимает доп. комиссию с получателя средств";
}
elseif($row_to->code == "EBGOLD"||$row_to->code == "EBSILVER"||$row_to->code == "EBCURRENCYUSD")
{
if($row_to->code == "EBGOLD"){
$metal = 1;
}
elseif($row_to->code == "EBSILVER"){
$metal = 2;
}
elseif($row_to->code == "EBCURRENCYUSD"){
$metal = 3;
}
$query = "INSERT INTO `ebullion_orders` (`payee_account` , `payer_account` , `transaction_id` , `metal` , `exchange` , `timestamp`, `type` , `status` ) VALUES ('".$ebullion_account."', '', '', '$metal', '', '', '1', '1');";
mysql_query($query);
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from ebullion_orders"));
$to_order_id = $tmp_row[0];
}
elseif($row_to->type == "pincode")
{
$query = "INSERT INTO `pincode_orders` (`pincode` ,`type` ,`status` ) VALUES ('',1,1);";
mysql_query($query);
$to_order_id = mysql_insert_id();
}
elseif($row_to->transfare_type == "manual")
{
$query = "INSERT INTO `manual_orders` (`account` ,`type` ,`status` ) VALUES ('$account',1,1);";
mysql_query($query);
$to_order_id = mysql_insert_id();
}
$partner_id = -1;
$partner_amount = 0;
$partner_currency_id = 0;
if (isset($_COOKIE['PARTNER_CLICK']) && ($_COOKIE['PARTNER_CLICK']>0) && (is_numeric($_COOKIE['PARTNER_CLICK'])))
{
$q_ = "select partners.id as partner_id, partners.currency_id as
partner_currency_id
from partners inner join partner_clicks on
partners.id=partner_clicks.partner_id where
partner_clicks.id = ".$_COOKIE['PARTNER_CLICK'];
$r_ = mysql_fetch_object(mysql_query($q_));
$partner_id = $r_->partner_id;
if (($partner_id > 0) && (is_numeric($partner_id)) && ($partner_id!=''))
{
$partner_currency_id = $r_->partner_currency_id;
$q_ = "select currency_id from ex_currencies where id = $curr_from";
$r_ = mysql_fetch_object(mysql_query($q_));
$from_currency_id = $r_->currency_id;
$q_ = "select `payout_perc` from `partners` where `id` = '$partner_id'";
$r_ = mysql_fetch_object(mysql_query($q_));
$partner_payout_percent = (float)( $r_ -> payout_perc );
$partner_amount = $sys_comission *
GetCourseByID($from_currency_id, $partner_currency_id)
* $partner_payout_percent;
$partner_amount = round($partner_amount, 4);
}
else
{
$partner_id = -1;
$partner_amount = 0;
$partner_currency_id = 0;
}
}
$query = "INSERT INTO `orders` (
`partner_id`, `partner_amount`,`partner_currency_id`,
`from_order_id` , `to_order_id` , `email` ,
`ip` , `ex_currency_from_id` , `ex_currency_to_id` ,
`amount_from` , `amount_to` , `sys_comission` ,
`ex_currency_from_comission` , `ex_currency_to_comission` ,
`metal_amount_from` , `metal_amount_to` , `metal_sys_comission` ,
`metal_ex_currency_from_comission` , `metal_ex_currency_to_comission` ,
`from_info` , `to_info` , `batch_from` , `batch_to` , `regdate` , `type` ,
`from_status` , `to_status` , `status` , `ex_course`, `real_course` )
VALUES (
'$partner_id', '$partner_amount', '$partner_currency_id',
'$from_order_id' ,'$to_order_id','$user_email',
'".$_SERVER["REMOTE_ADDR"]."', '$curr_from', '$curr_to',
'$amount', '".$out_amount."', '$sys_comission', '$ex_from_comission',
'$ex_to_comission', '$metal_amount_from', '$metal_amount_to',
'$metal_sys_comission', '$metal_from_comission', '$metal_to_comission',
'', '', '', '', '".time()."','1','1', '1', '1','$ex_course','$real_course');";
if(!@mysql_query($query)){
$error = urlencode("Системная ошибка!");
header("Location: $SITE_URL/error.php?error=$error");
exit;
}
/*
$query = "select max(id) as max_id from orders";
$row = mysql_fetch_object(mysql_query($query));
$order_id = $row->max_id;
$query = "insert into partner_clicks2orders (`click_id`, `order_id`) values
('".$_COOKIE['PARTNER_CLICK']."', '$order_id')";
*/
$tmp_row = mysql_fetch_row(mysql_query("select max(id) from orders"));
$order_id = $tmp_row[0];
/* session variables */
session_unregister("EX_ORDER_ID");
$_SESSION["EX_ORDER_ID"] = $order_id;
/* end session variables */
/* hashes */
$query = "INSERT INTO `hashes` (`owner_id` , `type` , `hash` , `regdate` ) VALUES ('$order_id', '1', '".GenRandom(60)."', '".time()."');";
@mysql_query($query);
/* TO CONTENT */
if($row_to->code == "WMR"||$row_to->code == "WMZ"||$row_to->code == "WME"||$row_to->code == "WMU"){
if($row_to->code == "WMR"){
$purse = "R";
}
elseif($row_to->code == "WMZ"){
$purse = "Z";
}
elseif($row_to->code == "WME"){
$purse = "E";
}
elseif($row_to->code == "WMU"){
$purse = "U";
}
}
/*
elseif($row_to->code == "YMR"||$row_to->code == "PCE"||$row_to->code == "PCD"||$row_to->code == "PCL"||$row_to->code == "PCH"){
$out_content = '';
}*//*
elseif($row_to->code == "EPD"){
$out_content = '';
}*//*
elseif($row_to->code == "EGOLD"||$row_to->code == "ESILVER"||$row_to->code == "EPLATINUM"||$row_to->code == "EPALLADIUM"){
$out_content = '';
}*/
if ($row_from->metal_id > 0)
{
$grams = (round($amount/GetMetalPrice($row_from->metal_id),6));
}
if ($row_to->metal_id>0)
{
$grams_get = round($values_arr['out_amount']/GetMetalPrice($row_to->metal_id),6);
}
$smarty->assign("grams", $grams);
$smarty->assign("grams_get", $grams_get);
$smarty->assign("wm_purse",$wm_purse);
$smarty->assign("wm_id",$wm_id);
$smarty->assign("ym_account",$ym_account);
$smarty->assign("eport_serial",$eport_serial);
$smarty->assign("eport_number",$eport_number);
$smarty->assign("egold_account",$egold_account);
$smarty->assign("account",$account);
$smarty->assign("pincode",$pincode);
if($row_from->type == "pincode")
{
$comment = "В течение дня оператор отработает ваш заказ и в случае успешной активации ПИН-кода выплатит исходящий платёж.";
}
if($row_from->transfare_type == "manual")
{
$payto = "Вам необходимо оплатить указанную сумму на эккаунт: <b>$row_from->manual_properties</b>. При этом обязательно укажите в назначении (комментарии) платежа идентификатор вашего заказа: <b>$order_id:$from_order_id-$to_order_id</b>.<br>В течение дня после получения платежа оператор обработает ваш заказ.";
}
$smarty->assign("payto",$payto);
$smarty->assign("comment",$comment);
$smarty->assign("user_email",$user_email);
$smarty->assign("amount", $amount);
$smarty->assign("out_amount", $out_amount);
$smarty->assign("real_invoice", $real_invoice);
$smarty->assign("real_invoice_to", $real_invoice_to);
$smarty->assign("row_from", $row_from);
$smarty->assign("row_to", $row_to);
$smarty->assign("purchase_form", GenPurchaseForm($order_id));
$smarty->assign("title", $SETTINGS['site_name']);
$smarty->assign("info", "Оплатите счет и получите деньги!");
$smarty->assign("ex_currencies", $ex_currencies);
$smarty->assign("main_class", "header1");
$smarty->assign("money_cources", get_currency_cources());
$smarty->assign("metal_cources", get_metal_cources());
$smarty->display("smartex_order.tpl");
/*
<font color=red><?=$real_invoice!=""?"*":""?> <small><?=$real_invoice!=""?$real_invoice:""?></small></font>
<br>
<font color=red><?=$real_invoice_to!=""?"*":""?> <small><?=$real_invoice_to!=""?$real_invoice_to:""?></small></font>
*/
?>