<?php

/* FIRESHOP: Advanced Content Market System                         */

/* ============================================                         */

/*                                                                      */

/* Copyright (c) 2012 by Mohamad Porhaji                                */

/* http://Firedesign.ir                                                   */

/*                                                                      */

/* This program is free software.  */

/************************************************************************/

/* $Id: order.php,v 1.0.0.1 2012/02/18 By Mohamad Porhaji $ */
@session_start();
define('ORDER_FILE', true);
require_once("mainfile.php");
global $db;


$title_page_over="ثبت سفارش";
$page_title = "ثبت سفارش";


function content()

{

global $db;

if(@$_SESSION['BUY_AGAINE'] == true)
{
$order_id=$_SESSION['order_id'];
}
echo"
<div class=\"slider\">
<div class=\"slider_top\">&nbsp;&nbsp;&nbsp; فاكتور</div>
<div class=\"slider_bg\">
<div class=\"content_slider\">
";

$ip = @$_SERVER['REMOTE_ADDR'];
echo"<div align='center' dir='rtl' style='padding:8px;'>
<table style='background-color: #333333; font-family: tahoma; font-size: 11px; text-decoration: none; color: #CCCCCC'>
<tr>
<td style='width: 390px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>
عنوان</td>
<td style='width: 75px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>
مبلغ واحد</td>
<td style='width: 37px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>

تعداد</td>
<td style='width: 76px;'>

قابل پرداخت</td>

</tr>
</table>";
$query = $db->sql_query("SELECT * FROM `fireshop_buy_session` WHERE ip='$ip' AND  order_id='$order_id'");
while($row=$db->sql_fetchrow($query)){

$id_i= $row['id'];
$pro_id= $row['pro_id'];
$num_pro= $row['num_pro'];
$ip= $row['ip'];
$pro_title= $row['pro_title'];
$pro_price= $row['pro_price'];
$pro_price_s= number_format($pro_price, 0);
$total_price_num = ($pro_price*$num_pro);
$total_price_num_s  = number_format($total_price_num, 0);
$subtotal+=$total_price_num;
$subtotal_s= number_format($subtotal, 0);


echo"

<table style='background-color: #CCCCCC; font-family: tahoma; font-size: 11px; text-decoration: none; color: #333333'>
<tr>
<td style='width: 390px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>

$pro_title</td>
<td style='width: 75px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>

$pro_price_s</td>
<td style='width: 37px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>
$num_pro
</td>
<td style='width: 76px;'>

$total_price_num_s</td>





</tr>
</table>


";
}


echo"

<div  style='margin-left:32px;'  align='left'>
<table  style='background-color: #333333; font-family: tahoma; font-size: 11px; text-decoration: none; color: #cccccc' align='left' >
<tr>
<td valign='top'>

جمع كل :
</td>
<td valign='top'>

$subtotal_s  تومان
</td>
</tr>
</table></div>
<br/><br/><form action='buy.php' method='post'><div style='margin-left:30px;' align='left'><input type='submit' name='refrash' value='بازگشت و ويرايش'/></div></form></div>";

echo"</div></div>
<div class=\"slider_bt\"></div>

</div>\n";


echo"<form action='pay_order.php' method='post'><br/>
<input type='hidden' name='subtotal' value='$subtotal'/>
<input type='hidden' name='order_id' value='$order_id'/>



<div class=\"slider\">
<div class=\"slider_top\">&nbsp;&nbsp;&nbsp; ثبت نهايي سفارش</div>
<div class=\"slider_bg\">
<div class=\"content_slider\">
<br/>
<div align='center' dir='rtl' style='padding:10px'>
<table style='background-color: #333333; font-family: tahoma; font-size: 11px; text-decoration: none; color: #CCCCCC'>
<tr>
<td style='width: 390px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>
طريقه ارسال <span style='color: red'>*</span></td>
<td style='width: 80px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>
ماليات</td>
<td style='width: 80px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>

هزينه پستي</td>
<td style='width: 80px;'>

قابل پرداخت</td>

</tr>
</table>";

$sql = $db->sql_query("SELECT * FROM fireshop_sendway Where is_active=1");
while ($row = $db->sql_fetchrow($sql)) {
$id = $row['id'];
$title = $row['title'];
$maliyat=$row['maliyat'];
$hazine=$row['hazine'];
$maliyat_s= number_format($maliyat, 0);
$hazine_s= number_format($hazine, 0);
$total_price_send=($subtotal+$maliyat+$hazine);
$total_price_send_s= number_format($total_price_send, 0);
echo"
<table style='background-color: #CCCCCC; font-family: tahoma; font-size: 11px; text-decoration: none; color: #333333'>
<tr>
<td style='width: 390px; border-left-style: solid; border-left-width: 1px; border-left-color: #ffffff;border-top-style: solid; border-top-width: 1px; border-top-color: #ffffff;'>

<input type='radio' name='sendway' value='$id'/>      $title</td>
<td style='width: 80px; border-left-style: solid; border-left-width: 1px; border-left-color: #ffffff;border-top-style: solid; border-top-width: 1px; border-top-color: #ffffff;'>

$maliyat_s  تومان</td>
<td style='width: 80px; border-left-style: solid; border-left-width: 1px; border-left-color: #ffffff;border-top-style: solid; border-top-width: 1px; border-top-color: #ffffff;'>
$hazine_s تومان
</td>
<td style='width: 80px; border-top-style: solid; border-top-width: 1px; border-top-color: #ffffff;'>
$total_price_send_s تومان
</td>





</tr>
</table>
";
}

echo"




<div align='right'>
<br/><br/>
<div style='float:right;width:110px' for=\"name\">نام و نام خانوادگي : <span style='color: red'>*</span></div>
<div style='float:right;'><input type='text' name=\"name\" size='30' style='height: 20px'/></div><div class='clear'></div><br/>
<div style='float:right;width:110px' for=\"name\">تلفن محل كار : </div>
<div style='float:right;'><input type='text' name='kar_tel' size='30' style='height: 18px'/></div><div class='clear'></div><br/>

<div style='float:right;width:110px' for=\"name\">تلفن منزل : <span style='color: red'>*</span></div>
<div style='float:right;'><input type='text' name='home_tel' size='30' style='height: 18px'/> لطفا تلفن خود را به همراه پیش شماره شهر خود وارد کنید .</div><div class='clear'></div><br/>

<div style='float:right;width:110px' for=\"name\">تلفن همراه  : <span style='color: red'>*</span></div>
<div style='float:right;'><input type='text' name='mobile' size='30' style='height: 18px'/></div><div class='clear'></div><br/>

<div style='float:right;width:110px' for=\"name\">ايميل  : </div>
<div style='float:right;'><input type='text' name='email' size='30' style='height: 18px'/></div><div class='clear'></div><br/>

<div style='float:right;width:110px' for=\"name\">استان  : <span style='color: red'>*</span></div>
<div style='float:right;'><select name='ostan'>
<option value=''>استان خود را انتخاب کنید</option>";
$sql = $db->sql_query("SELECT * FROM fireshop_zone");
while ($row = $db->sql_fetchrow($sql)) {
$id = $row['id'];
$title = $row['title'];

echo"<option value='$id'>$title</option>";
}
echo"</select></div><div class='clear'></div><br/>

<div style='float:right;width:110px' for=\"name\">كد پستي  : <span style='color: red'>*</span></div>
<div style='float:right;'><input type='text' name='code_post' size='30' style='height: 18px'/></div><div class='clear'></div><br/>

<div style='float:right;width:110px' for=\"name\">آدرس پستي  : <span style='color: red'>*</span></div>
<div style='float:right;'><textarea type='text' name='adress'  style='width: 250px; height: 80px'></textarea>  لطفا آدرس کامل پستی خود را همراه با جزئیات به دقت وارد نمایید</div><div class='clear'></div><br/>

<div style='float:right;width:110px' for=\"name\">توضيحات  : </div>
<div style='float:right;'><textarea type='text' name='des'  style='width: 250px; height: 80px'></textarea></div><div class='clear'></div><br/>

<div style='float:right;width:110px' for=\"name\">كد امنيتي  : <span style='color: red'>*</span> </div>
<div style='float:right;'><img id='imagerash' border='0' src='img.php'>  <input type='text' name='RashCMS' size='27' style='height: 18px'/></div><div class='clear'></div><br/><br/>

<input type='submit' name='s_order' value='ثبت نهايي سفارش' />
</div></form>

</div></div></div>
<div class=\"slider_bt\"></div>

</div>\n";



}
theme();
?>