<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";
include "../classes/cls_order.php";
include "../classes/cls_products.php";
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}

if(isset( $_SESSION["sess_adminname"]) and $_SESSION["sess_adminname"]!= ""){
	$adminname = $_SESSION["sess_adminname"];
}else{
	header("Location:login.php");
	exit;
} 
if(isset( $_GET["orderid"]) and $_GET["orderid"]!= ""){
	$orderid = $_GET["orderid"];
}else if(isset( $_POST["orderid"]) and $_POST["orderid"]!= ""){
	$orderid = $_POST["orderid"];
}else{
	header("Location:orders.php");
	exit;
}
$message = '';
if(isset( $_GET["message"])){
	$message = $_GET["message"];
}
if(isset( $_GET["mes"])){
	$success_message = $_GET["mes"];
}


$itemlist = isset($_POST["chkitems"])?$_POST["chkitems"]:'';
$ddlStatus = isset($_POST["ddlStatus"])?$_POST["ddlStatus"]:'';

$btn = '';
foreach ($_POST as $key =>$value){
	if($value == GO){
		$btn = $key;
		break;
	}

}


if(isset($_POST[$btn]) && $_POST[$btn] == GO){ 


	$ar = explode("_",$btn );
	$sid = $ar[1] ;
	$ddl = "ddlStatus_".$sid;
	$status = $_POST[$ddl];
	//echo $ddl;//exit;
	    $sql ="UPDATE  ".$tableprefix."order_details SET
		item_status = '".addslashes($status)."'
		WHERE order_id = '".addslashes($orderid)."' AND artist_id = '".addslashes($sid)."' ";
		
		$res = mysql_query($sql);
		
		// Update Item Delivery Time
		if($status=="4")
		{
		
			   $sql_deliverytime_up	= "UPDATE  ".$tableprefix."order_details SET item_delivery_date =now()
										WHERE order_id = '".addslashes($orderid)."' AND artist_id = '".addslashes($sid)."' ";
								
                            mysql_query($sql_deliverytime_up) or die(mysql_error());
		}
	
		// End 
		
		$orderstatus_new = getArtistOrderStatus($orderid, $sid); 
                
               // Restock Order Quantity if seller order cancellded 
                if($status=="2")
                {
                    $sellerorderItems = Order::getsellerItemsinOrder($orderid,$sid);
                    $productArray   = array();
                    if(!empty($sellerorderItems))
                    {
                        foreach($sellerorderItems as $products)
                        {
                            $updateStock =  Products::updateCancelledQuantityToProductStock($products->product_id,$products->product_option_id,$products->product_quantity);
                        }
                        
                    }
                    $cancelFlag = true;
                    
                    
                    
                    sendOrderStatusChangeMailToBuyer($orderid,$sid,$orderstatus_new,'A',$cancelFlag);
                 
                    sendOrderCancellationMailToSeller($orderid,$sid,$orderstatus_new,$cancelFlag);
                   
                }else{
                   
                    sendOrderStatusChangeMailToBuyer($orderid,$sid,$orderstatus_new,'A');
                 
                    sendOrderCancellationMailToSeller($orderid,$sid,$orderstatus_new);
                }
               
		//echo $_POST["chkStatus"];exit;
		 
                    
                 $message = CHANGES_SAVED_SUCCESSFULLY."<br>";
                
              
                
		header("Location:vieworder.php?orderid=".$orderid."&mes=".$message); 
		exit;
		
} 

if(isset($_POST["btnGo"]) && $_POST["btnGo"] == GO){  
	$message = "";
	 if(!isNotNull($itemlist)){
		$message .= "*".PLEASE_SELECT_ITEMS."! <br>";
	}else{
		$ilist = implode(",",$itemlist );
	} 

	if($message  == ""){ 
		$sql ="UPDATE  ".$tableprefix."order_details SET
		item_status = '".addslashes($ddlStatus)."'
		WHERE 	order_detail_id IN (".addslashes($ilist).")
		";
		$res = mysql_query($sql);
		
		
		if($ddlStatus=="4")
		{
		
			$sql_deliverytime_up = "UPDATE  ".$tableprefix."order_details SET item_delivery_date =now()
							WHERE order_detail_id IN (".addslashes($ilist).")";
			mysql_query($sql_deliverytime_up) or die(mysql_error());				
			
		}

		$success_message = CHANGES_SAVED_SUCCESSFULLY."<br>";  
		header("Location:vieworder.php?orderid=".$orderid);
		exit;
	}else{
		 $message = "<br>".MSG_CORRECT_THE_ERRORS."!<br>" . $message;
	}

} 

if(isset($_GET["msg"]) and $_GET["msg"]!=""){
	$msg = $_GET["msg"];
	switch($msg){
		case "deleted": $success_message = MSG_USER_DELETED;break;
		default:
			;
	} // switch

}

$artistlist = getOrderArtists($orderid);
$artists = explode(",",$artistlist );

$totalshippingcost      =    0;
$select_shipping_cost   = "SELECT sd.vshipping_name, sd.nshipping_cost,sd.nshp_productname
                            FROM ".$tableprefix."shipping_details sd
                           WHERE sd.norder_id = ".$orderid." AND  nshp_status = 'C' order by sd.nshp_productname";
$result_shipping_cost   = mysql_query($select_shipping_cost)or die(mysql_error());

$shipRow                =    mysql_num_rows($result_shipping_cost);

if($shipRow>0) {
        while($shipping_row=mysql_fetch_array($result_shipping_cost))
                {
                    $totalshippingcost+=$shipping_row['nshipping_cost'];
                }   
}     
/*---------Display the shipping cost if available----------*/

/*$sql=" SELECT o.*, u.user_name, u.email, od.artist_id, cm.nexchange_price 
		FROM ".$tableprefix."orders o,".$tableprefix."currency_master cm
		INNER JOIN ".$tableprefix."users u ON o.user_id = u.user_id
		INNER JOIN ".$tableprefix."order_details od ON o.order_id = od.order_id
		WHERE o.vorder_currency = cm.vcurrency_code
		 AND o.order_id = '".addslashes($orderid)."'
		" . $qryopt . " ORDER BY o.order_date DESC ";*/

		
		$sql=" SELECT o.*, u.user_name, u.email, od.artist_id,sum( (od.product_price-(od.product_price*product_discount/100)) * od.product_quantity) as total_price
		FROM ".$tableprefix."orders o
		INNER JOIN ".$tableprefix."users u ON o.user_id = u.user_id
		INNER JOIN ".$tableprefix."order_details od ON o.order_id = od.order_id
		WHERE o.order_id = ".GetSQLValueString($orderid,"text")."
		  ".$qryopt . " GROUP BY o.order_id ORDER BY o.order_date DESC ";
		 
/*echo $sql = "SELECT o. * , u.user_name, u.email, od.artist_id, cm.nexchange_price
		FROM ".$tableprefix."orders o JOIN ".$tableprefix." users u ON o.user_id = u.user_id
		JOIN ".$tableprefix."order_details od ON o.order_id = od.order_id
		JOIN ".$tableprefix."currency_master cm ON o.vorder_currency = cm.vcurrency_code
		WHERE o.order_id  = '".addslashes($orderid)."'" . $qryopt .
		" ORDER BY o.order_date DESC";	*/

$result = mysql_query($sql);
if(mysql_num_rows($result) != 0)
{
	$row = mysql_fetch_array($result);
	$ordernumber = $row["order_id"];
	$username = $row["user_name"];
        $taxrate                =      Order::getorderTaxTotal($row["order_id"]);
        
	//$taxrate=$row["taxrate"];
	$ordertotal=$row["total_price"];
        $couponCodeDiscount=$row["couponCodeDiscount"];
        if($row["nused_gift_amount"] >0 || $couponCodeDiscount>0 ) {

           $giftDiscountAmount           = $row["nused_gift_amount"];

           //$couponCodeDiscountAmount = ($ordertotal*$row["couponCodeDiscount"])/100;
           $couponCodeDiscountAmount = $row["couponCodeDiscount"];

           $TotalDiscount   = $giftDiscountAmount + $couponCodeDiscountAmount;

           $priceafterdiscount=$ordertotal-$TotalDiscount;

           $ordertotal=number_format($priceafterdiscount,2,".","");

        }
	$netTotal=$ordertotal+$taxrate;
	$orderdate = $row["order_date"];
	$orderdate = dateFormat($orderdate,"Y-m-d","m/d/Y");
	$userid = $row["user_id"];
	//$exchange_price = $row["nexchange_price"];
        
         $sql_Shipping="SELECT sum(nshipping_cost)as nShippingcost from ".$tableprefix."shipping_details where norder_id=".$row["order_id"]." AND nshp_status='C' ";
         $rs_shipping=mysql_query($sql_Shipping);
       if(mysql_num_rows($rs_shipping)>0)  {
                $rsShippingObj=mysql_fetch_object($rs_shipping);
                $totalshippingcost =number_format($rsShippingObj->nShippingcost,2,".","");
                $netTotal = $netTotal+$totalshippingcost;
       }
	
} 
$row1 = $row;
$statlist= array();
$statlist[1] = PENDING;
$statlist[2] = CANCELLED;
$statlist[3] = SHIPPED;
$statlist[4] = DELIVERED;

$hide_shipping_display = 0;
$hide_shipping_display = Order::checkShippingBlockRequiredForOrder($orderid);


include "../includes/htmltop.php";

?>
<SCRIPT>
function confirmDelete(){
	if(confirm("<?php echo ARE_YOU_SURE_DELETE_RECORD;?>?") ){
		return true;
	}
	return false;
}
function confirmStatus(){
	if(confirm("<?php echo ARE_YOU_SURE_CHANGE_STATUS;?>?") ){
		return true;
	}
	return false;
}
</SCRIPT>


		
		
		
		
		<body>
		
		<center>
		
		<div align="left" id="layout">
		
		
				
				
				<!--header area start -->
<?php

	include_once("../includes/topheader_admin.php");


?>
				
				<!--header area end -->
				
				
				
				
				<div align="left" class="main_body">
				<!--main body start -->
				
				
				
<?php
		include_once("../includes/admintopmenu.php");

?>		
																					
								
					<div align="left" class="content_area">
					
					<!--content area start -->
							
					<div align="left" class="page_title"><?php echo VW_ORDERDETAILS;?> (#<?php echo $ordernumber;?>)</div>
					 <div align="center" class="text_information grey_tr"><?php echo $message ?></div>
                                         <div align="center" class="text_information_success grey_tr"><?php echo $success_message; ?></div>
            		<br>
											
					<div align="left">																			
		
					<form name="frmFeedback" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
					<input type="hidden" name="orderid" value="<?php echo htmlentities($orderid);?>">
																									
					<table cellpadding="0" cellspacing="0" border="0" width="100%" class="manage_table">
                                             <?php if(checkDigitalOrder($orderid,'')==true) { ?>
                                                            <tr><td align="left" width="20%" ><?php echo ORDER_TYPE;?> &nbsp;</td>
						<td width="2%" >:</td>
						<td width="78%" align="left" class="innertextCopy2"><?php echo DIG_PRO_ORDER;?> </td></tr>
                                                        <?php } ?>
						<tr><td align="left" width="20%" ><?php echo ORDER_NO;?>&nbsp;</td>
						<td width="2%" >:</td>
						<td width="78%" align="left" class="innertextCopy2"><?php echo $ordernumber;?></td></tr>
						<tr><td align="left" ><?php echo ORDER_DATE;?> &nbsp;</td><td >:</td>
						<td align="left" class=""><?php echo $orderdate;?></td></tr>
						<tr><td align="left" ><?php echo ORDER_TOTAL;?>&nbsp;</td><td >:</td>
						<td align="left" class=""><?php echo $adminCurrency['currency_symbol'];?>  <?php echo  number_format($netTotal,2,".","" );?></td></tr>
						<tr><td align="left" valign="top"><?php echo ORDER_BY;?>&nbsp;</td><td >:</td>
						<td align="left" class=""><?php echo $username;?></td></tr>
					</table>
					
					<table cellpadding="0" cellspacing="0" border="0" width="100%" class="manage_table">
					<tr><td colspan="10" class="form_header"><b><?php echo ORDER_PART_DETAILS;?></b></td></tr>
					<tr><td colspan="9"><?php echo Order::showIconTexts($orderid);?></td></tr>
                                        
<?php
if(isNotNull($artists))
{
	echo " ".ORDER_CONTAINS." ".count($artists)." ".SUBORDER;
	$grand_total = 0;
	for($i=0;$i< count($artists);$i++)
	{
		switch (getArtistOrderStatus($orderid,$artists[$i])){
			case 'Pending':$stat=PENDING;
			break;
			case 'Cancelled' :$stat=CANCELLED;
			break;
			case 'Shipped':$stat=SHIPPED;
			break;
			case 'Delivered':$stat=DELIVERED;
			break;
				
		}
?>
									
					<tr>
						<td colspan="9"><?php echo ORDER_PART;?> # <?php echo $i+1;?></td>
					</tr>                                        
					<tr>
						<td colspan="10" align="left">
                                                    <b><?php echo SELLER;?>: <?php echo stripslashes(getArtistName_Location($artists[$i]));?></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<?php echo PARTIAL_ORDER_STATUS;?>:&nbsp;<b><font color='RED'><?php echo $stat; ?></font></b>
						</td>
					</tr>
					<tr class="page_title2">
						<th width='3%' height="34" align="left">#</th>
						<th width='25%' align="left"><?php echo PRODUCT_NAME;?></th>
						<th width='12%' align="left"><?php echo PRODUCT_CODE;?></th>
						<th width="8%" align="left"><?php echo RATE;?></th>
						<th width='8%' align="left"><?php echo QTY;?></th>
						<th width='8%' align="left"><?php echo PRICE;?></th>
						<th width='8%' align="left"><?php echo STATUS;?></th>
                                                <?php /*<th width='11%' align="left"><?php echo SHIPPING_COST;?></th>
                                                <th width='13%' align="left"><?php echo SHIPPING_NAME;?></th>
                                                <th width='13%' align="left"><?php echo PRODUCT_TYPE;?></th>*/?>
					</tr>
													
													
													
<?php
             $sql= "SELECT od.*, o.vorder_currency,o.taxrate,s.order_status,gm.ngift_product_id,gm.vgift_coupon_code
                          FROM ".$tableprefix."order_details od
		    INNER JOIN ".$tableprefix."order_status s ON s.order_status_id = od.item_status
		     LEFT JOIN ".$tableprefix."giftcertificates gm ON gm.ngift_product_id=od.product_id AND gm.ngift_order_id=od.order_id
		     LEFT JOIN ".$tableprefix."orders o ON o.order_id=od.order_id
			 WHERE  od.order_id = '".addslashes($orderid)."'
                           AND  (od.artist_id = '".$artists[$i]."')
                      order by  od.product_name";
             
             
	//echo $sql . "<br>";
	$result1 = mysql_query($sql);
	$k=1;
	$subtotal = 0;
	$ddlStatus = "ddlStatus_".$artists[$i];
	$$ddlStatus = '';
	$sellerCurrency=getSellerCurrencySybol($artists[$i]);
	$ddl = makeDropDownList($ddlStatus,$statlist,$$ddlStatus ,false ,"textbox" , "","" );
	$btnStatus = "btnGo_".$artists[$i];
	$btn = "<input class='button' type='submit' value='".GO."' name='".$btnStatus."' onClick='return confirmStatus();'> ";
	while($rw = mysql_fetch_array($result1))
	{
		$link = "<a class=links href='editmyproduct.php?productid=".$rw["product_id"]."'>";
		$check = "<input type='hidden' name='chkitems[]' value='" . $rw["order_detail_id"] . "' > ";
		$rate = $rw["product_price"];
		$qty = $rw["product_quantity"];
		$artistid = $rw["artist_id"];
	$ddl = makeDropDownList($ddlStatus,$statlist,$rw['item_status'] ,false ,"textbox" , "","" );
	//$btnStatus = "btnGo_".$artists[$i];
	$btn = "<input class='button' type='submit' value='".GO."' name='btnGo_".$artists[$i]."' onClick='return confirmStatus();'> ";
	//$btn = "AAAA";
	$rate=$rw["product_price"];
	$shippingcost=$row1["nshipping_cost"];
	$totaltax=$rw["taxrate"];
	$price = $rate * $qty;
	
        if($rw['digital_product_flag'] == "Y"){           
            $product_shipping_cost = $adminCurrency['currency_symbol'].'&nbsp;0.00';;
            $shippingName = NO_SHIPPING;
            $producttype = DIGITAL_PRODUCT;
        }
        else{
            $product_shipping_cost = ($rw['product_shipping_price']!=0)?$adminCurrency['currency_symbol'].'&nbsp;'.number_format($rw['product_shipping_price'],2,".",""):$adminCurrency['currency_symbol'].'&nbsp;0.00';
            $shippingName = ($rw['product_shipping_price']!=0)?$rw['product_shipping_name']:FREE_SHIP_TEXT;
            $producttype =  ($rw['subscription_product_flag']=='Y')?SUBSCRIPTION_PRODUCT:NORMAL_PRODUCT;
        }
        
		if($rw["product_discount"] !="0"){ 
			$price=$price-($price*(int)$rw["product_discount"]/100);
			//$discountstr="discount(".$rw["product_discount"]."%)";
			
		}
		$subtotal += $price; 
		$rate  = number_format($rate,2,".","" );
		$price = number_format($price,2,".","" );
		switch ($rw["order_status"]){
			case 'Pending':$stat1=PENDING;
			break;
			case 'Cancelled' :$stat1=CANCELLED;
			break;
			case 'Shipped':$stat1=SHIPPED;
			break;
			case 'Delivered':$stat1=DELIVERED;
			break;
				
		}
?>


	
				<tr>
					<td height="32" align="left" valign="top"><?php echo $k; ?> </td>
					<td valign="top" align="left"><?php echo Order::showDigitalItemIcon($rw["digital_product_flag"]).(stripslashes($rw["product_name"]))."<br>".DISCOUNT."(".$rw["product_discount"]."%)".Order::check_free_ship_product_text($rw["product_id"]); ?>
					<br><br><?php if($rw['vgift_coupon_code']!='') {  ?><span class="required"><?php echo GIFT_CERT_CODE;?> : <?php echo $rw['vgift_coupon_code'];?></span><?php } ?>
					</td>
					<td valign="top" align="left"><?php echo htmlentities($rw["product_code"]); ?></td>
					<td align="left" valign="top"><?php echo $adminCurrency['currency_symbol'];?>  <?php echo htmlentities($rate); ?></td>
					<td valign="top" align="left"><?php echo htmlentities($qty); ?></td>
					<td valign="top" align="left"><?php echo $adminCurrency['currency_symbol'];?>  <?php echo htmlentities($price); ?></td>
					<td valign="top" align="left"><?php echo $stat1; ?>&nbsp;</td>
                                        <?php /*<td valign="top" align="left"><?php echo $product_shipping_cost; ?>&nbsp;</td>
                                        <td valign="top" align="left"><?php echo $shippingName; ?>&nbsp;</td>
                                        <td valign="top" align="left"><?php echo $producttype; ?>&nbsp;</td>*/?>
				</tr> 



<?php
	$k++;
}
?>

 <?php if(getArtistOrderStatus($orderid,$artists[$i])!= 'Delivered' &&  getArtistOrderStatus($orderid,$artists[$i])!='Cancelled')
											
    {   ?>                            
<tr>

					<td height="37" colspan="5" align="left"><?php echo CHANGE_STATUS_TO;?>:&nbsp;&nbsp;<?php echo $ddl;?>&nbsp;<span class="btn_gotbl">
					 <!-- <input name="chkStatus" type="checkbox" id="chkStatus" value="Y">
<?php echo INFRM_ORDERTO_BUYER;?> </span>-->&nbsp;<?php echo $btn;?><span class="btn_gotbl">
		    </span> </td>
					<td class="text_information"><b>&nbsp;</b></td>
				</tr>
 <?php } ?>                               

<?php
	 $grand_total+=$subtotal;
	}
}// echo "AAA"; exit();


	?>
													


<tr><td colspan="10"> <table width="100%" cellpadding="0" cellspacing="0" border="0" >
            
            <tr>

					<td height="37" align="right" width="70%"><strong><?php echo ITEM_PRICE_TOTAL;?>: </strong></td>
					<td width="30%"><b><?php echo $adminCurrency['currency_symbol'];?> &nbsp;<?php echo number_format($grand_total,2,".","" ); ?></b></td>
				</tr>
                                
            				</tr>
<?php 
if($row1['vgiftcertificate_code']!='' && $row1['nused_gift_amount']!=0 ){
?>
                                        
                                        
<tr>
  <td height="37" align="right" class="specialmessage"><strong>
   
    <strong> <?php echo GC_AMOUNT;?></strong> : </td>	
					<td class="specialmessage"><b><?php echo $adminCurrency['currency_symbol'];?> &nbsp; <?php echo number_format($row1['nused_gift_amount'],2,".","" ); ?></b></td>
</tr>
<tr>
  <td height="37" align="right" class="specialmessage"><strong><?php echo GIFT_CERT_CODE;?> :</strong></td>	
					<td class="specialmessage"><b>&nbsp; <?php echo $row1['vgiftcertificate_code']; ?></b></td>
</tr>
<?php  } ?>

<?php 
if($row1['couponCodeDiscount']>0){
     $couponCodeDiscountAmount = $row1["couponCodeDiscount"];
   
   
?>

 <tr>
  <td height="37" align="right" class="specialmessage">
    <strong> <?php echo COUPON_CODE_TEXT1;?> &nbsp;<?php echo $row1['couponCode']?> &nbsp; <?php echo DISCOUNT_TEXT1;?> </strong> : </td>	
					<td class="specialmessage" width="40%"><b><?php echo $adminCurrency['currency_symbol'];?> &nbsp; <?php echo number_format($couponCodeDiscountAmount,2,".","" ); ?>  </b></td>
</tr>
<?php  } ?>

<?php 
 if($row1["nused_gift_amount"]>0 || $row1['couponCodeDiscount']>0 ) {
        $giftDiscountAmount           = $row1["nused_gift_amount"];
                                                                                                   
        $couponCodeDiscountAmount       =   $row1['couponCodeDiscount'];
        $TotalDiscount                  =   $giftDiscountAmount + $couponCodeDiscountAmount;
        $priceafterdiscount             =   $grand_total-$TotalDiscount;
        $grand_total=number_format($priceafterdiscount,2,".","");
     
 ?>    
 
 <tr>
  <td height="37" align="right" class="specialmessage">
   
    <strong> <?php echo PRODUCT_TOT_TEXT_DISCOUNT;?> &nbsp; </strong> : </td>	
					<td class="specialmessage"><b><?php echo $adminCurrency['currency_symbol'];?> &nbsp; <?php echo number_format($grand_total,2,".","" ); ?>  </b></td>
</tr>
 <?php } ?>

<?php

if(!empty($totalshippingcost))
{
?>
<tr><td height="31" align="right"><b><?php echo TOTAL_SHP_COST;?>  :</b> </td> <td ><?php echo $adminCurrency['currency_symbol'];?> <?php echo number_format($totalshippingcost,2,".","" ); ?> </b></td>
</tr>
<?php } ?>
<?php
$carttotal=$grand_total;
if(!empty($totalshippingcost))
{

	$carttotal=$carttotal+$totalshippingcost;
}

if(!empty($totaltax))
{
	$carttotal=$carttotal+$totaltax;
?>

<tr>
				  <td height="31" align="right"><b><?php echo TAX_RATE;?>:&nbsp;</b></td>
				  <td><b><?php echo $adminCurrency['currency_symbol'];?>  <?php echo number_format($totaltax,2,".","" ); ?></b></td>
				  </tr>

<?php } ?>				  

				<tr>
				  <td height="37" align="right" class="text_information"><strong><?php echo ORDER_TOTAL;?> :</strong></td>	
					<td class="text_information"><b><?php echo $adminCurrency['currency_symbol'];?> &nbsp;<?php echo number_format($carttotal,2,".","" ); ?></b></td>

		
				
			<tr><td height="37" align="right" class="text_information"><strong><?php echo AMOUNT_PAID;?></strong> : </td>	
					<td class="text_information"><b><?php echo $adminCurrency['currency_symbol'];?> &nbsp;<?php echo number_format($row1['namount_paid'],2,".","" ); ?></b></td>
				</tr>	
				
</table></td></tr>				

<tr><td  colspan="7"> <table width="100%" cellpadding="0" cellspacing="0" >
<?php


    $select_shipping_cost = "SELECT sd.vshipping_name, sd.nshipping_cost,CONCAT(ar.first_name,' ',ar.last_name)as artist_name
                            FROM ".$tableprefix."shipping_details sd
                           INNER JOIN ".$tableprefix."artists ar ON ar.artist_id = sd.seller_id              
                           WHERE sd.norder_id = ".$orderid." AND  nshp_status = 'C' order by ar.artist_name";
    $result_shipping_cost = mysql_query($select_shipping_cost);

?>						
				
				<tr><td colspan="3">&nbsp;</td></tr>
				<tr class="grey_tr"><td class="page_title2" colspan="7"><strong><?php echo SHIPPING_DETAILS;?></strong></td></tr>
				<tr><td colspan="3">&nbsp;</td></tr>
                                
                                
      
     <tr><td colspan="3">
	<table width="100%" border="0" cellpadding="3" cellspacing="3" class="manage_table">
	<tr><td> <b><?php echo SELLER_NAME;?></b> </td> <td><b><?php echo SHIPPING_TYPE;?></b> </td><td><b><?php echo SHIPPING_COST;?></b></td></tr>
	<?php
								
if(mysql_num_rows($result_shipping_cost) > 0)
{
	while($shipping_row=mysql_fetch_array($result_shipping_cost))
	{
	   // $totalshippingcost+=$shipping_row['nshipping_cost'];		
?>	
<tr>
<td><?php echo stripslashes($shipping_row['artist_name']); ?></td>
<td><?php echo stripslashes($shipping_row['vshipping_name']); ?></td>
<td><?php echo $adminCurrency['currency_symbol'];?> <?php echo number_format($shipping_row['nshipping_cost'],2,".","" ); ?></td>
</tr>
<?php 
    } // end while 
} // end if number of rows
else
{
?>
<tr align="center"><td colspan="3" class="text_information"> <?php echo NO_SHIPPING_FOUND;?> .</td>
</tr>
<tr><td colspan="3">&nbsp; </td></tr>
<?php

} // ens else
?>
	</table>


</td></tr>
				
<?php 
	if($row["prefered_shippin_method"] !="")
	{	
?>

				 <tr  ><td width="37%" height="43" align="left" class="maintext" ><strong><?php echo SHIPPING_METHOD;?>&nbsp;</strong></td>
					 <td width="1%" >&nbsp;</td>
					 <td class="maintext" width="62%" align="left" ><b><?php echo htmlentities($row1["prefered_shippin_method"]);?></b></td>
				 </tr>

<?php 
	} 	
?>
				<tr ><td align="left" width="37%" ><strong><?php echo FNAME;?>&nbsp;</strong></td>
				<td width="1%" >:</td>
				<td width="62%" align="left"><strong><?php echo ($row1["shipping_first_name"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo LNAME;?> &nbsp;</strong></td>
				<td >:</td>
				<td align="left" ><strong><?php echo ($row1["shipping_last_name"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo ADDRESS;?> 1&nbsp;</strong></td>
				<td >:</td>
				<td align="left"><strong><?php echo htmlentities($row1["shipping_address1"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo ADDRESS;?> 2&nbsp;</strong></td>
				<td >:</td>
				<td align="left"><strong><?php echo htmlentities($row1["shipping_address2"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo CITY;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left"><strong><?php echo htmlentities($row1["shipping_city"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo STATE;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left"><strong><?php echo htmlentities($row1["shipping_state"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo COUNTRY;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left"><strong><?php echo htmlentities($row1["shipping_country"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo ZIP;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left"><strong><?php echo htmlentities($row1["shipping_zip"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo PHONE;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left"><strong><?php echo htmlentities($row1["shipping_phone"]);?></strong></td>
				</tr>				
				<tr><td align="left" ><strong><?php echo EMAIL;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left"><strong><?php echo htmlentities($row1["shipping_email"]);?></strong></td>
				</tr>
				
				
		

<?php if($row1['buyer_comments']!='') { ?>


                <tr><td colspan="3">
                        <br>

                        <div class="border_bgclr">
                            <table cellpadding="2" cellspacing="2" width="100%">
                                <tr><td class="page_title2"> <b><?php echo BUYER_COMMENTS;?> </b> </td></tr>
                                   <tr><td> <?php echo stripslashes($row1['buyer_comments']) ;?></td></tr>
                            </table>
                        </div>
                    </td></tr>

                <?php  } ?>
				
				<tr><td colspan="3">&nbsp;</td>
				</tr>
				<tr class="grey_tr"><td colspan="7" class="page_title2"><strong><?php echo BILLING_DETAILS;?></strong></td>
				</tr>
				<tr><td colspan="3">&nbsp;</td>
				</tr>
				
				
				<tr><td align="left" width="37%" ><strong><?php echo FNAME;?>&nbsp;</strong></td>
				<td width="1%" >:</td>
				<td width="62%" align="left" class="innertextCopy2"><strong><?php echo ($row1["billing_first_name"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo LNAME;?> &nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo ($row1["billing_last_name"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo ADDRESS;?> 1&nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo htmlentities($row1["billing_address1"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo ADDRESS;?> 2&nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo htmlentities($row1["billing_address2"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo CITY;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo htmlentities($row1["billing_city"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo STATE;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo htmlentities($row1["billing_state"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo COUNTRY;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo htmlentities($row1["billing_country"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo ZIP;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo htmlentities($row1["billing_zip"]);?></strong></td>
				</tr>
				<tr><td align="left" ><strong><?php echo PHONE;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo htmlentities($row1["billing_phone"]);?></strong></td>
				</tr>
				
				<tr><td align="left" ><strong><?php echo EMAIL;?>&nbsp;</strong></td>
				<td >:</td>
				<td align="left" class="innertextCopy2"><strong><?php echo htmlentities($row1["billing_email"]);?></strong></td>
				</tr>
				
								
				<tr><td colspan="3">&nbsp;</td></tr>
				<tr>
					<td colspan="7" align="center"><input type="button"  value="<?php echo BACK_ORDER;?>" onClick="window.location.href='orders.php'" class='button'></td>
				</tr>
				
			</table>
			
			</td></tr></table>
			</form>
			</div>
						
						
				<!--content area end-->
								
				</div>
				
								
					<div align="left" class="clear_float"><img src="<?php echo $imagefolder;?>/clear.gif" alt="" width="1" height="1" /></div>
				<!--main body end -->
				</div>
				
				
<?php
	include "../includes/footer.php";

?>