<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2010 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts EasyCart                      |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<?php echo $javascript->link('jquery.js'); ?>
<?php echo $javascript->link('alphanumeric.js'); ?>
<script language="javascript" type="text/javascript">
	function submi(){
		document.sts.submit();
	}

        function submitpayment(){
		document.py.submit();
	}

</script>
<div align="center" class="subheading">
 <div align="left">ORDER DETAILS</div>
</div>
<br />
<div align="left" id="item_details_admin">
<?php if($session->check('Message.flash')) { ?><div id="okbox"><font color="#446423"><?php $session->flash(); ?></font></div><?php } ?>
<!--items display area start -->
<table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
  <tr>
    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
		   
      <tr>
        <td class="boxtopheader">Order Details </td>
        </tr>
    </table>
    <table width="100%"  border="0" cellspacing="1" cellpadding="6">
      <tr align="left" valign="middle" id="list_admin_top">
          <td width="10%">Order Id </td>
        <td width="38%">Order Status </td>
        <td width="15%">Order Date</td>
        <td width="24%">User Name</td>
        <td width="13%" align="center">Currency</td>
        </tr>
      <tr align="left" valign="middle" id="list_admin">
          <td>
              <?php echo $odr["Order"]['id'];?>
          </td>
        <td><form name="sts" id="sts" action="<?php echo '../change_status/'.$odr["Order"]["id"];?>" method="POST">
			<select name="order_status" id="order_status" onChange="submi();">
			<?php
			foreach($osts as $field => $val){
			?>
			<option value="<?php echo $field; ?>" <?php if($field == $odr["Order"]["order_status_id"]){ echo "selected"; }?> > <?php echo $val; ?></option>
			<?php }
			?>
			</select>
			</form></td>
        <td><?php
			$dt	= strtotime($odr["Order"]['date']);
			$edt = strtotime($odr["Order"]['exp_time']);
			echo date("m-d-Y",$dt );
			 ?></td>
        <td><?php echo $odr["User"]["uname"]; ?></td>
        <td align="center"><?php echo $odr["Order"]["currency_type"]; ?></td>
        </tr>
    </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
<br />

 <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
  <tr>
    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td class="boxtopheader">Items Details </td>
      </tr>
    </table>
	 <form name="editbill" action="<?php echo '../editorder/'.$odr["Order"]["id"].'/qty';?>" method="POST">
    <table width="100%"  border="0" cellspacing="1" cellpadding="6">
      <tr align="left" valign="middle" id="list_admin_top">
        <td width="15%">ProductName</td>
        <td width="9%" align="center">Skuno</td>
		<?php  if($cmbtype_flag == 'yes') { ?> 
        <td width="18%" align="center">Combination</td>
		<?php } ?>
        <td width="10%" align="center">Quantity</td>
        <td width="10%" align="center">Unit Price </td>
        <td width="11%" align="center">Additional cost </td>
		 <td width="11%" align="center">Discount</td>
         <td width="11%" align="center">Price </td>      
		  <?php  if($ptype_flag == 'Digital') { ?> 
        <td width="9%">Download </td>      
        <td width="7%">Expiry Time</td>
		<?php } ?>
      </tr>

 <?php 
  $amt=0; 
  $cnt=1;
  $odtp	=	"Non-digital";  
  if(count($odr["OrderDetail"])>0)
  {       
    foreach($odr["OrderDetail"] as $det){ 
	 $price=0;
   $dis_amnt=0;
  	if($det["prodtype"] == "Digital"){
	 	$odtp	=	"Digital";
	?>	
      <tr align="left" valign="middle" id="list_admin">
        <td align="center"><?php echo $det["Product"]; ?></td>
        <td align="center"><?php if(isset($det["skuno"])) echo $det["skuno"]; else echo "-"; ?> </td>
        <td align="center"><?php if(isset($det["combinations"])) echo $det["combinations"]; else echo "-";?></td>
        <td align="center">
		<label id="oqty<?php echo $cnt;?>"><?php echo $det["quantity"]; ?></label>
		<label id="edit_oqty<?php echo $cnt;?>" style="display:none;">
		<input type="text" name="edit_qty<?php echo $cnt;?>" value="<?php echo $det["quantity"]; ?>"  size="4"/>
		<input type="hidden" name="row_id<?php echo $cnt;?>" value="<?php echo $det["id"]; ?>"/>
		</label>
		</td>
        <td align="center"><?php echo $curlogo;?><?php echo $det["product_price"]; ?></td>
        <td align="center"><?php echo $curlogo;?><?php echo $det["extra_price"]; ?></td>
		<td align="center">
		<?php 		
		if($det["discount_type"]=='per' && $det["discount"] > 0)
		$dis_amnt=(($det["product_price"] + $det["extra_price"])*$det["discount"])/100;
		else if($det["discount_type"]=='amnt' && $det["discount"] > 0)
		$dis_amnt=$det["discount"];		
		$disc_amnt=($dis_amnt)*($det["quantity"]);
		echo $curlogo.number_format($disc_amnt,2,'.','');
		?>
		</td>
        <td align="center">
		<?php		
		  $combined_price=$det['product_price']+$det['extra_price'];  		
		  if($det["discount_type"]=='per')
			 {		
				  if($det['discount'] > 0 && $det['discount'] <> '')
					{
						$discounted_price=($combined_price-(($combined_price * $det['discount'])/100));
						$price=($discounted_price)*($det['quantity']);							
						$amt+= $price;	
					}
					else
					{
					  $amt+=($combined_price)*($det['quantity']);	
					  $price+=($combined_price)*($det['quantity']);	
					} 			
			 }
			 else if($det["discount_type"]=='amnt')
			 {			   
				 if($det['discount'] > 0 && $det['discount'] <> '')
					{
						$discounted_price=($combined_price-$det['discount']);
						$price=($discounted_price)*($det['quantity']);	
						$amt+= $price;						
					}	
					else
					{
					  $amt+=($combined_price)*($det['quantity']);	
					  $price+=($combined_price)*($det['quantity']);	
					} 					 
			 }		
			else
			{
				
				$price = ($combined_price)*($det['quantity']);
				$amt+= $price;	
			}      
		   echo $curlogo.number_format($price,2,'.','');		  
		  ?>
	</td>       
        <td align="center">
		<?php if($det["prodtype"] == "Digital"){ $odtp	=	"Digital";?>
		<a href='<?php echo FULL_BASE_URL. $cnfg["sitebasefolder"]."/Orders/pdctdownload/".$det["order_id"]."/".$det['product_id']."/" ;?> '>Download Now</a>
		<?php } else{?>N/A <?php } ?>
		</td>       
        <td align="center"><?php if($det["prodtype"] == "Digital"){?><?php echo date('m-d-Y H:i:s',$edt ); } ?></td>
      </tr>
        <?php 
		$cnt++;
		}else{ ?>
		
      <tr align="left" valign="middle" id="list_admin">
	     
        <td><?php echo $det["Product"]; ?></td> 
		<td align="center" ><?php if(isset($det["skuno"])) echo $det["skuno"]; else echo "-"; ?> </td>  
		<?php  if($cmbtype_flag == 'yes') { ?> 
        <td align="center">
		<?php if(isset($det["combinations"])) echo $det["combinations"]; else echo "-";?>
		</td>     
		<?php } ?>
        <td align="center">
		<label id="oqty<?php echo $cnt;?>"><?php echo $det["quantity"]; ?></label>
		<label id="edit_oqty<?php echo $cnt;?>" style="display:none;">
		<input type="text" name="edit_qty<?php echo $cnt;?>" value="<?php echo $det["quantity"]; ?>"  size="4"/>
		<input type="hidden" name="row_id<?php echo $cnt;?>" value="<?php echo $det["id"]; ?>"/>
		</label>
		</td>
        <td align="center"><?php echo $curlogo;?><?php echo $det["product_price"]; ?></td>
        <td align="center"><?php echo $curlogo;?><?php echo $det["extra_price"]; ?></td>
		 <td align="center">
		 <?php 
		if($det["discount_type"]=='per' && $det["discount"] > 0)
		$dis_amnt=(($det["product_price"] + $det["extra_price"])*$det["discount"])/100;
		else if($det["discount_type"]=='amnt' && $det["discount"] > 0)
		$dis_amnt=$det["discount"];		
		$disc_amnt=($dis_amnt)*($det["quantity"]);
		echo $curlogo.number_format($disc_amnt,2,'.','');
		?>
		 </td>
        <td align="center">
		<?php		
		  $combined_price=$det['product_price']+$det['extra_price'];  
		  if($det["discount_type"]=='per')
			 {		
				  if($det['discount'] > 0 && $det['discount'] <> '')
					{
						$discounted_price=($combined_price-(($combined_price * $det['discount'])/100));
						$price=($discounted_price)*($det['quantity']);							
						$amt+= $price;	
					}
                                        else
					{
					  $amt+=($combined_price)*($det['quantity']);
					  $price+=($combined_price)*($det['quantity']);
					}



			 }
			 else if($det["discount_type"]=='amnt')
			 {
			   	 if($det['discount'] > 0 && $det['discount'] <> '')
					{
						$discounted_price=($combined_price-$det['discount']);
						$price=($discounted_price)*($det['quantity']);	
						$amt+= $price;	
					}
                                        else
					{
					  $amt+=($combined_price)*($det['quantity']);
					  $price+=($combined_price)*($det['quantity']);
					}
			 }		
			else
			{
				$price = ($combined_price)*($det['quantity']);
				$amt+= $price;	
			}      
		   echo $curlogo.number_format($price,2,'.','');		  
		  ?>
		</td> 
		 <?php  if($ptype_flag == 'Digital') { ?>         
		<td align="center">N/A</td>     
        <td align="center">N/A</td>
		<?php } ?>
      </tr>
       <?php 
	   $cnt++;
	   } } } else { ?>	 
	    <tr align="left" valign="middle" id="list_admin">
        <td colspan="10" align="center">No Details Found.</td>     
        </tr>
	   <?php } ?>
	   <?php if(count($odr["OrderDetail"])>0) { ?>
	   <tr align="left" valign="middle" id="list_admin">
        <td colspan="10" align="right">
		<input id="qty_editbtn" type="button" class="buttn_admin" onClick="javascript:return editQty('<?php echo count($odr["OrderDetail"]);?>');" value="Edit" />
		<input id="qty_updbtn" type="submit" style="display:none;" class="buttn_admin" value="Update" />
		<input id="hidtotcnt" name="hidtotcnt" type="hidden" value="<?php echo count($odr["OrderDetail"]);?>" />
		</td>     
        </tr>
		<?php } ?>
    </table>
	</form>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
<br />
 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
   <tr>
     <td width="47%" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
       <tr>
         <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
             <tr>
               <td class="boxtopheader">Transaction Details </td>
             </tr>
           </table>
		   <table width="100%"  border="0" cellspacing="1" cellpadding="6">
               <?php if($odtp <> "Digital"){ ?>
			    <tr align="left" valign="middle" id="list_admin_top">
                 <td width="12%">Products Type</td>
                 <td width="7%">Non Digital products</td>
               </tr>
			     <tr align="left" valign="middle" id="list_admin">
                 <td>Shipping Method </td>
                 <td><?php echo $odr["Order"]["shipping_method"]; ?></td>
               </tr>
               <tr align="left" valign="middle" id="list_admin_top">
                 <td>Shipping Service</td>
                 <td><?php echo html_entity_decode($odr["Order"]["shipping_service"]); ?></td>
               </tr>
			    <?php }else{ ?>
			   <tr align="left" valign="middle" id="list_admin_top">




                 <td width="12%">Products Type</td>
                 <td width="7%">Digital products</td>
               </tr>
			    <?php } ?>
               <tr align="left" valign="middle" id="list_admin">
                 <td>Payment Method </td>
                 <td>
                     <?php
                        if($odr["Order"]['order_type']=='P' || $odr["Order"]["payment_method"]=='') {
                     ?>
                     <form name="py" id="py" action="<?php echo '../save_paymentmethod/'.$odr["Order"]["id"];?>" method="POST">
                         <select name="payment_method" id="payment_method" onChange="submitpayment();">
                             <option value=""<?php echo ($odr["Order"]["payment_method"]=='') ? ' selected="selected"' : ''; ?>>--Select--</option>
                             <option value="Cheque"<?php echo ($odr["Order"]["payment_method"]=='Cheque') ? ' selected="selected"' : ''; ?>>Cheque</option>
                             <option value="Demand Draft"<?php echo ($odr["Order"]["payment_method"]=='Demand Draft') ? ' selected="selected"' : ''; ?>>Demand Draft</option>
                         </select>
                     </form>
                     <?php
                        } else {
                             echo $odr["Order"]["payment_method"];
                        }
                     ?>
                 </td>
               </tr>
               <?php if(isset($odr["Order"]["transaction_id"]) && $odr["Order"]["transaction_id"] <> 0 && $odr["Order"]["transaction_id"] <>'') { ?>
               <tr align="left" valign="middle" id="list_admin">
                 <td>Transaction Id</td>
                 <td><?php  echo $odr["Order"]["transaction_id"]; ?></td>
               </tr>
			   <?php } ?>
			    <?php if(isset($odr["Coupon"]["id"]) && $odr["Coupon"]["id"] <> 0 && isset($odr["Coupon"]["code"]) && $odr["Coupon"]["code"] <> ''){ ?>
               <tr align="left" valign="middle" id="list_admin">
                 <td>Promo Code </td>
                 <td><?php echo $odr["Coupon"]["code"]; ?></td>
               </tr>
			   <?php } ?>					
             </table>
             
             <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
               <tr>
                 <td>&nbsp;</td>
               </tr>
           </table></td>
       </tr>
     </table>
	 <br />
	    <?php if($odtp <> "Digital" && $odr["Order"]["ship_fname"] <> ''){ ?>
       <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
       <tr>
         <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
             <tr>
               <td class="boxtopheader">Shipping Address</td>
             </tr>
           </table>
             <table width="100%"  border="0" cellspacing="1" cellpadding="6">
               <tr align="left" valign="middle" id="list_admin">
                 <td>
				 <div id="ship_addr1">
				 <?php echo $odr["Order"]["ship_fname"]."&nbsp;&nbsp; ".$odr["Order"]["ship_lname"]; ?><br />
				 <?php echo $odr["Order"]["ship_address"]; ?><br />
				 <?php echo $odr["Order"]["ship_city"]."&nbsp;&nbsp;".$odr["Order"]["ship_state"]."&nbsp;&nbsp;".$odr["Order"]["ship_zip"]; ?><br />
				 <?php echo $odr["Order"]["ship_country"]; ?><br />
				 <strong>Phone &nbsp; : </strong>&nbsp;<?php echo $odr["Order"]["ship_phone"]; ?><br />
				 <strong>Mobile &nbsp; : &nbsp;</strong><?php echo $odr["Order"]["ship_mobile"]; ?><br />
				 <strong>Fax &nbsp; : &nbsp;</strong><?php echo $odr["Order"]["ship_fax"]; ?><br />
				 <br />
				 <input name="button" type="button" class="buttn_admin" onClick="javascript:return editShip();" value="Edit" />
				 </div>
				 <div id="ship_addr2" style="display:none;">
				 <form  name="editship"  action="<?php echo '../editorder/'.$odr["Order"]["id"].'/ship';?>" method="POST">
				 <table width="269">
				 <tr><td width="96">First Name</td><td width="161"><input type="text" id="editship_fname" name="editship_fname" value="<?php echo $odr["Order"]["ship_fname"];?>" /></td></tr>
				 <tr><td>Last Name</td><td><input type="text" id="editship_lname"  name="editship_lname" value="<?php echo $odr["Order"]["ship_lname"];?>"  /></td></tr>				
				 <tr><td>Address</td><td><input type="text" id="editship_address"  name="editship_address" value="<?php echo $odr["Order"]["ship_address"];?>"  /></td></tr>				
				 <tr><td>City</td><td><input type="text" id="editship_city"  name="editship_city" value="<?php echo $odr["Order"]["ship_city"];?>" /></td></tr>
				 <tr><td>State</td><td><input type="text" id="editship_state"  name="editship_state" value="<?php echo $odr["Order"]["ship_state"];?>" /></td></tr>
				 <tr><td>Zip code</td><td><input type="text" id="editship_zip"  name="editship_zip" value="<?php echo $odr["Order"]["ship_zip"];?>" /></td></tr>
			     <tr><td>Country</td><td><input type="text" id="editship_country"  name="editship_country" value="<?php echo $odr["Order"]["ship_country"];?>" /></td></tr>
				 <tr><td>Phone</td><td><input type="text" id="editship_phone"  name="editship_phone" value="<?php echo $odr["Order"]["ship_phone"];?>" /></td></tr>
				 <tr><td>Mobile</td><td><input type="text" id="editship_mobile"  name="editship_mobile" value="<?php echo $odr["Order"]["ship_mobile"];?>" /></td></tr>
				 <tr><td>Fax</td><td><input type="text" id="editship_fax"  name="editship_fax" value="<?php echo $odr["Order"]["ship_fax"];?>" /></td></tr>
				  <tr><td>&nbsp;</td><td><input type="submit" class="buttn_admin" value="Update" /></td></tr>	
				</table>	
				 </form>
				 </div>
				 </td>
                </tr>               
             </table>
             <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
               <tr>
                 <td>&nbsp;</td>
               </tr>
           </table></td>
       </tr>
     </table>
	 <?php }else{ ?>
       <br />
       <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
         <tr>
           <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
               <tr>
                 <td class="boxtopheader">Reset Download Expiry Date</td>
               </tr>
             </table>
               <table width="100%"  border="0" cellspacing="1" cellpadding="6">
                 <tr align="left" valign="middle" id="list_admin">
                   <td colspan="2"><a href='<?php echo FULL_BASE_URL. $cnfg["sitebasefolder"]."/Orders/reset_exp_date/".$odr["Order"]["id"]."/";?> '>Reset Now</a></td>
                 </tr>
               </table>
               <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
                 <tr>
                   <td>&nbsp;</td>
                 </tr>
             </table></td>
         </tr>
       </table>
       <br />
	    <?php } ?>
	   <?php if(isset($allow_fedexlabel) && $allow_fedexlabel == "Y"  && $odr["Order"]["shipping_method"] == 'FEDEX'){ ?>
	    <br />
       <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
         <tr>
           <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
               <tr>
                 <td class="boxtopheader">FEDEX SHIPPING LABEL </td>
               </tr>
             </table>
			  <form name="fedex" id="fedex" action="<?php echo '../fedexlabel/'.$odr["Order"]["id"];?>" method="POST">
               <table width="100%"  border="0" cellspacing="1" cellpadding="6">
			   
			    <tr align="left" valign="middle" id="list_admin">
                   <td width="16%"><strong>Width</strong></td>
				   <td width="33%"><input type="text" size="6" id="fed_width" name="fed_width"></td>
				   <td width="15%"><strong>Height</strong></td>				   
                   <td width="36%"><input type="text" size="6" id="fed_height" name="fed_height"></td>
			    </tr>
				 <tr align="left" valign="middle" id="list_admin">
                   <td><strong>Length</strong></td>
				   <td><input type="text" size="6" id="fed_length" name="fed_length"></td>
				   <td width="15%"><strong>Units</strong></td>				   
                   <td width="36%"><input type="text" size="6" id="fed_units" name="fed_units"></td>
				 </tr>
				  <tr align="left" valign="middle" id="list_admin">
                   <td><strong>Weight</strong></td>
				   <td><input type="text" size="6" id="fed_weight" name="fed_weight"></td>
				   <td>&nbsp;</td>				   
                   <td>&nbsp;</td>
				  </tr>
				 
				 <?php
				 if($odr["Order"]["tracking_no"] <> '' && $odr["Order"]["label_pdf"] <> '') { ?>
				  <tr align="left" valign="middle" id="list_admin">
                   <td colspan="3"><strong>Tracking No</strong>: <?php echo $odr["Order"]["tracking_no"];?></td>
				   <td> <?php  echo $html->link('Download Label','/orders/dwnldlabel/'.$odr["Order"]["label_pdf"]); ?></td>
				  </tr>
				  <?php } ?>
				 
				  <tr align="left" valign="middle" id="list_admin">
                   <td colspan="4">
				   <?php
				   if($odr["Order"]["shipping_method"]=='FEDEX')
				   {
					 $fedxurl='../fedexlabel/'.$odr["Order"]["id"];
					 ?>
					  <input name="button" type="button" class="buttn_user" id="fed_btn" onClick="javascript:return fedexLabel(document.fedex);" 
					  value="Generate Fedex Label" />
					 <?php } ?>	
					 <label id="fed_load" style="display:none;padding-left:160px;">
					 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
					 <strong>Please Wait</strong>&nbsp;&nbsp;<?php echo $html->image('/img/load.gif');?></label>
					 </td>
			     </tr>        
				 
               </table>
		      </form>
               <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
                 <tr>
                   <td>&nbsp;</td>
                 </tr>
             </table></td>
         </tr>
       </table>
       <br />
	   <?php } ?>
	    <form name="not" id="not" action="<?php echo '../addnote/'.$odr["Order"]["id"];?>" method="POST">
       <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
         <tr>
           <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
               <tr>
                 <td class="boxtopheader">Remarks</td>
               </tr>
             </table>
			
               <table width="100%"  border="0" cellspacing="1" cellpadding="6">
                 <tr align="left" valign="middle" id="list_admin">
                   <td width="31%">Order note </td>
                   <td width="69%">	
				   <textarea name="note" id="note" class="box2_admin"><?php echo $odr["Order"]["note"]; ?></textarea></td>
                 </tr>
               </table>
               <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
                 <tr>
                   <td align="left">&nbsp;&nbsp;&nbsp;<input name="Submit" type="submit" class="buttn_admin" value="Save" /></td>
                 </tr>
             </table></td>
         </tr>
       </table>
	   </form>
      </td>
     <td width="2%" align="left" valign="top">&nbsp;</td>
     <td width="51%" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
       <tr>
         <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
             <tr>
               <td class="boxtopheader">Price Details</td>
             </tr>
           </table>
             <table width="100%"  border="0" cellspacing="1" cellpadding="6">
               <tr align="left" valign="middle" id="list_admin">
                 <td width="44%">Total Price</td>
                 <td width="56%"><?php echo $curlogo;?><?php echo number_format($amt,2,'.',''); ?></td>
               </tr>
			            <tr align="left" valign="middle" id="list_admin">
                 <td>Tax Name </td>
                 <td><?php echo $odr["Order"]["tax_name"]; ?></td>
               </tr>
 

               <tr align="left" valign="middle" id="list_admin">
                 <td>Tax</td>
                 <td><?php echo $curlogo;?><?php echo $odr["Order"]["tax_price"]; ?></td>
               </tr>
			   
			    <tr align="left" valign="middle" id="list_admin">
                 <td>Promo Code Discount </td>
                 <td>
				 <?php echo $curlogo;?>
				 <?php 
				 if($odr["Order"]["discount"] > $amt)				
				 echo number_format($amt,2,'.','');
				 else
				 echo number_format($odr["Order"]["discount"],2,'.',''); ?></td>
               </tr>    
                <?php
                    if($odr["Order"]["gift_card_discount"]>0) { ?>
               <tr align="left" valign="middle" id="list_admin">
                 <td>Gift Card Discount </td>
                 <td>
				 <?php echo $curlogo;?>
				 <?php 
				 
				 echo number_format($odr["Order"]["gift_card_discount"],2,'.',''); ?></td>
               </tr>    
               <?php } ?>
			   
			    <?php if($odtp <> "Digital" && $odr["Order"]["shipping_price"] <> ''){ ?>
               <tr align="left" valign="middle" id="list_admin">
                 <td>Shipping</td>
                 <td><?php echo $curlogo;?><?php echo $odr["Order"]["shipping_price"]; ?></td>
               </tr>
			   <?php } ?>
               <?php
                    if(!empty($specialsArr)){
                        foreach($specialsArr as $specials){
               ?>
               <tr align="left" valign="middle" id="list_admin">
                 <td><?php echo $specials->note; ?></td>
                 <td><?php echo $curlogo;?><?php echo number_format($specials->cost,2,'.',''); ?></td>
               </tr>
               <?php
                        }
                    }
                ?>
                      
             </table>
             <table width="100%"  border="0" cellspacing="0" cellpadding="3" id="admin_bottom">
               <tr>
                 <td width="44%">Grand Total</td>
                 <td width="55%" class="toplinks"><?php echo $curlogo;?><?php echo $odr["Order"]["total_price"]; ?></td>
               </tr>
           </table></td>
       </tr>
     </table>
       <br />
	   
       <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
         <tr>
           <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
               <tr>
                 <td class="boxtopheader">Billing Address</td>
               </tr>
             </table>
               <table width="100%"  border="0" cellspacing="1" cellpadding="6">
                 <tr align="left" valign="middle" id="list_admin">
                   <td>
				   <div id="bill_addr1">
				   <?php echo $odr["Order"]["bill_fname"]."&nbsp;&nbsp;".$odr["Order"]["bill_lname"]; ?><br />
				   <?php echo $odr["Order"]["bill_address"]; ?><br />
				   <?php echo $odr["Order"]["bill_city"]."&nbsp;&nbsp;".$odr["Order"]["bill_state"]."&nbsp;&nbsp;".$odr["Order"]["bill_zip"]; ?><br />
				   <?php echo $odr["Order"]["bill_country"]; ?><br />
					<strong>Phone :</strong> <?php echo $odr["Order"]["bill_phone"]; ?><br />
				   <strong> Mobile :</strong> <?php echo $odr["Order"]["bill_mobile"]; ?><br />
					<strong>Fax :</strong> <?php echo $odr["Order"]["bill_fax"]; ?><br />
					 <br />
				   <input id="bill_editbtn" type="button" class="buttn_admin" onClick="javascript:return editBill();" value="Edit" />				 
					</div>
					
			      <div id="bill_addr2" style="display:none;">
				 <form name="editbill" action="<?php echo '../editorder/'.$odr["Order"]["id"].'/bill';?>" method="POST">
				 <table width="269">
				 <tr><td width="96">First Name</td><td width="161"><input type="text" id="editbill_fname" name="editbill_fname" value="<?php echo $odr["Order"]["bill_fname"];?>" /></td></tr>
				 <tr><td>Last Name</td><td><input type="text" id="editbill_lname"  name="editbill_lname" value="<?php echo $odr["Order"]["bill_lname"];?>"  /></td></tr>				
				 <tr><td>Address</td><td><input type="text" id="editbill_address"  name="editbill_address" value="<?php echo $odr["Order"]["bill_address"];?>"  /></td></tr>				
				 <tr><td>City</td><td><input type="text" id="editbill_city"  name="editbill_city" value="<?php echo $odr["Order"]["bill_city"];?>" /></td></tr>
				 <tr><td>State</td><td><input type="text" id="editbill_state"  name="editbill_state" value="<?php echo $odr["Order"]["bill_state"];?>" /></td></tr>
				 <tr><td>Zip code</td><td><input type="text" id="editbill_zip"  name="editbill_zip" value="<?php echo $odr["Order"]["bill_zip"];?>" /></td></tr>
                                 <tr><td>Country</td><td><input type="text" id="editbill_country"  name="editbill_country" value="<?php echo $odr["Order"]["bill_country"];?>" /></td></tr>
				 <tr><td>Phone</td><td><input type="text" id="editbill_phone"  name="editbill_phone" value="<?php echo $odr["Order"]["bill_phone"];?>" /></td></tr>
				 <tr><td>Mobile</td><td><input type="text" id="editbill_mobile"  name="editbill_mobile" value="<?php echo $odr["Order"]["bill_mobile"];?>" /></td></tr>
				 <tr><td>Fax</td><td><input type="text" id="editbill_fax"  name="editbill_fax" value="<?php echo $odr["Order"]["bill_fax"];?>" /></td></tr>
				 <tr><td>&nbsp;</td><td><input type="submit" class="buttn_admin" value="Update" /></td></tr>	
				 </table>						 
				 </form>
				 </div>					
				   </td>
                 </tr>
               </table>
               <table width="100%"  border="0" cellspacing="0" cellpadding="3" id="admin_bottom">
                 <tr>
                   <td>&nbsp;</td>
                 </tr>
             </table></td>
         </tr>
       </table>
	   <br />
	   <form name="not" id="not" action="<?php echo '../addcomment/'.$odr["Order"]["id"];?>" method="POST">
       <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
         <tr>
           <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
               <tr>
                 <td class="boxtopheader">Comments For Customer</td>
               </tr>
             </table>
			
               <table width="100%"  border="0" cellspacing="1" cellpadding="6">
                 <tr align="left" valign="middle" id="list_admin">
                   <td width="31%">Comments</td>
                   <td width="69%">	
				   <textarea name="comment" id="comment" class="box2_admin"><?php echo $odr["Order"]["comments"]; ?></textarea></td>
                 </tr>
               </table>
               <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
                 <tr>
                   <td align="left">&nbsp;&nbsp;&nbsp;<input name="Submit" type="submit" class="buttn_admin" value="Save" /></td>
                 </tr>
             </table></td>
         </tr>
       </table>
	   </form>
	   
      </td>
   </tr>
 </table>

<?php
if(isset($labelimage)){
?>
<table width="100%"  border="0" cellspacing="0" cellpadding="5">
    <tr>
        <td class="boxtopheader">Shipping Label</td>
    </tr>
    <tr>
        <td align="left">
            <?php echo $html->image($labelimage,array("height"=>70,"width"=>70,"id"=>"labelid"));?></td>
    </tr>
    <tr>
        <td>
            <input type="button" name="printlabel" id="printlabel" value="Print" class="btn-usr01" onclick="printLable('<?php echo FULL_BASE_URL . $cnfg["sitebasefolder"] . "/app/webroot/".$labelimage;?>')">
        </td>
    </tr>
</table>
 <?php
}
?>
 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td align="right" style="padding-left:10px;">
         <input name="button" type="button" class="buttn_admin" onClick="javascript:history.go(-1);" value="Back" />   
   </tr> 
    <tr>
     <td align="left" style="padding-left:10px;">&nbsp; </td>
   </tr>
   
   
 </table>
 <br /></div>
<div align="left" class="float_clear1"></div>

<script>

function  redirectUrl(url)
{
 window.location = url;
 
}

$('#fed_width').numeric();
$('#fed_height').numeric();
$('#fed_length').numeric();
$('#fed_units').numeric();
$('#fed_weight').numeric();
function  fedexLabel(thisform)
{
// window.location = url;

     var i=0;
	 var j=0;
	 var fcs_fld=new Array();
	 var errorstr = '';
	 var msgstr = "Please enter missing information enclosed below to generate the Fedex Shipping Label.\n\n";
	  if($.trim($('#fed_width').val())=='') { errorstr += "- Please enter the Width.\n"; fcs_fld[i]='fed_width'; i++; }
	  if($.trim($('#fed_width').val())!='') {
	  if($.trim($('#fed_width').val()) < 1 ) { errorstr += "- Please enter a Width greater than 0.\n"; fcs_fld[i]='fed_width'; i++; }
	  }
	  
	  
	  if($.trim($('#fed_height').val())=='') { errorstr += "- Please enter the Height.\n"; fcs_fld[i]='fed_height'; i++; }
	  if($.trim($('#fed_height').val())!='') {
	  if($.trim($('#fed_height').val()) < 1) { errorstr += "- Please enter a height greater than 0.\n"; fcs_fld[i]='fed_height'; i++; }
	  }
	  
	  if($.trim($('#fed_length').val())=='') { errorstr += "- Please enter the Length.\n"; fcs_fld[i]='fed_length'; i++; }	
	  if($.trim($('#fed_length').val())!='') {
	  if($.trim($('#fed_length').val()) < 1 ) { errorstr += "- Please enter the Length greater than 0.\n"; fcs_fld[i]='fed_length'; i++; }		
	  }
	  
	 
	  if($.trim($('#fed_units').val())=='') { errorstr += "- Please enter the Units.\n"; fcs_fld[i]='fed_units'; i++; }		 
	  if($.trim($('#fed_units').val())!='') {
	  if($.trim($('#fed_units').val()) < 1 ) { errorstr += "- Please enter a Unit greater than 0.\n"; fcs_fld[i]='fed_units'; i++; }
	  }
	  
	  if($.trim($('#fed_weight').val())=='') { errorstr += "- Please enter Weight.\n"; fcs_fld[i]='fed_weight'; i++; }	
	  if($.trim($('#fed_weight').val())!='') {
	  if($.trim($('#fed_weight').val()) < 1) { errorstr += "- Please enter Weight greater than 0.\n"; fcs_fld[i]='fed_weight'; i++; }			 
	  }
		 
		if (errorstr != '')
		{
		  msgstr = msgstr + errorstr;
		  alert(msgstr);		
		  $('#'+fcs_fld[0]+'').focus();$('#'+fcs_fld[0]+'').select();
		  $('#fed_btn').show();
		  return false;
		}
	    else
	    {
		  $('#fed_btn').hide();
		  $('#fed_load').show();
		  thisform.submit();
		}
 
}
function editShip()
{
 $('#ship_addr1').hide();
 $('#ship_addr2').show();
}
function editBill()
{ 
 $('#bill_addr1').hide();
 $('#bill_addr2').show();
}
function editQty(totcnt)
{ 
   $('#qty_editbtn').hide();
   $('#qty_updbtn').show();
  for(i=1;i<=totcnt;i++)
  {
     $('#oqty'+i+'').hide();
     $('#edit_oqty'+i+'').show();
  }	 
}
</script>
<script type="text/javascript">

    function printLable(trial){
        
        var mywindow = window.open('', 'basicmodalcontent', 'height=400,width=600'); 
        mywindow.document.write('<html><head><title>print</title></head>');
        mywindow.document.write('<body >'); 
        mywindow.document.write("<img src='"+trial+"' rel='stylesheet' type='text/css' />") 
        mywindow.document.write('</body></html>'); 
        mywindow.document.close(); 
        mywindow.print(); 
        return true; 

    }

</script>
