<?php

/*++++++++++++++++++++++++++++++++++++++++

  Script: Maian Gallery v2.0
  Written by: David Ian Bennett
  E-Mail: support@maianscriptworld.co.uk
  Website: http://www.maianscriptworld.co.uk

  ++++++++++++++++++++++++++++++++++++++++
  
  This File: change_status.php
  Description: Change Order Status
  New in v2.0

  ++++++++++++++++++++++++++++++++++++++++*/

// Make sure that this file is being called from parent file
if (!defined('INCLUDE_FILES')) {
  accessDenied($msg_script18,$msg_script19);
  exit;
}

$q_sale = mysql_query("SELECT *,DATE_FORMAT(pay_date,'".$SETTINGS->mysql_date."') AS s_date  
                       FROM ".$database['prefix']."ipndata 
                       WHERE id = '{$_GET['status']}'
                       LIMIT 1
                       ") or die(mysql_error());
$SALE = mysql_fetch_object($q_sale);

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $msg_charset; ?>">
<title><?php echo $msg_sales15; ?></title>
<link href="css/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
body {
  margin:0;
  padding:0;
}
</style>
<script type="text/javascript" src="js/js_code.js"></script>
</head>

<body>
<form method="post" action="index.php?cmd=sales">
<input type="hidden" name="update_status" value="1">
<input type="hidden" name="id" value="<?php echo $SALE->id; ?>">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td align="left" style="padding:5px;background-color:#1EB5DD;color:#FFFFFF">
    <table cellpadding="0" cellspacing="0" width="100%" class="menutable">
    <tr>
     <td align="left" class="leftPad">&raquo; <b><?php echo strtoupper($msg_sales15); ?></b></td>
    </tr>
    <tr>
     <td style="padding:5px;border-right:1px solid #083253;border-left:1px solid #083253;border-bottom:1px solid #083253">
     <b><?php echo $msg_sales7; ?></b>: <?php echo cleanData($SALE->first_name.' '.$SALE->last_name); ?><br>
     <b><?php echo $msg_sales11; ?></b>: <?php echo $SALE->s_date; ?> / <?php echo cleanData($SALE->invoice); ?><br>
     <b><?php echo $msg_sales16; ?></b>: 
     <?php
      switch ($SALE->status) {
        case '0': echo $msg_sales12; break;
        case '1': echo $msg_sales13; break;
        case '2': echo $msg_sales14; break;
      }
      ?>
      <br>
     </td>
    </tr> 
    </table>
    <table cellpadding="0" cellspacing="0" width="100%" style="margin-bottom:2px">
    <?php
    if (isset($_GET['updated'])) {
    ?>
    <tr>
     <td style="border:1px solid #FFFFFF;padding:5px;text-align:center;background-color:#083253;color:#FFFFFF"><b><?php echo str_replace("{id}",$SALE->id,$msg_sales20); ?></b></td>
    </tr>
    <?php
    } else {
    ?>
    <tr>
     <td style="border:1px solid #FFFFFF;border-right:0;padding:5px;text-align:center;width:33%;background-color:#083253;color:#FFFFFF"><?php echo $msg_sales12; ?> <input type="radio" name="status" value="1"<?php echo ($SALE->status=='0' ? ' checked' : ''); ?>></td>
     <td style="border:1px solid #FFFFFF;border-right:0;padding:5px;text-align:center;width:33%;background-color:#083253;color:#FFFFFF"><?php echo $msg_sales13; ?> <input type="radio" name="status" value="2"<?php echo ($SALE->status=='1' ? ' checked' : ''); ?>></td>
     <td style="border:1px solid #FFFFFF;padding:5px;text-align:center;width:33%;background-color:#083253;color:#FFFFFF"><?php echo $msg_sales14; ?> <input type="radio" name="status" value="3"<?php echo ($SALE->status=='2' ? ' checked' : ''); ?>></td>
    </tr>
    <?php
    }
    ?>
    </table>
    <table cellpadding="0" cellspacing="0" width="100%" style="margin-bottom:2px">
    <tr>
     <td style="text-align:center;padding:5px;border:1px solid #083253;border-bottom:0">
     <span style="display:block;text-align:left;padding-left:5px;margin-bottom:5px"><?php echo $msg_sales19; ?>:</span>
     <textarea name="comments" rows="7" cols="40" style="width:98%"></textarea>
     </td>
    </tr>
    <tr>
     <td style="border:1px solid #083253;border-top:0;text-align:left;padding:0px 5px 5px 11px"><input type="checkbox" name="email" value="1" checked> <?php echo $msg_sales18; ?></td>
    </tr> 
    </table>
    <p align="center"><input type="submit" class="formbutton" value="<?php echo $msg_sales17; ?>" title="<?php echo $msg_sales17; ?>"></p> 
    </td>
</tr>
</table>    
</form>
</body>
</html>
