<?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: class_sales.inc.php
  Description: Sales Class
  New in v2.0
 
  ++++++++++++++++++++++++++++++++++++++++*/


class sales extends genericOptions {

var $prefix;

// Get order data..
function getOrder($id,$array)
{
  $q_sale = mysql_query("SELECT *,DATE_FORMAT(pay_date,'".$array->mysql_date."') AS s_date 
                         FROM ".$this->prefix."ipndata 
                         WHERE id = '{$id}'
                         LIMIT 1
                         ") or die(mysql_error());
  return mysql_fetch_object($q_sale);
}

// Delete sales..
function delete($DATA)
{
  // Split data..
  $split = explode("##",$DATA);
  // Clear sale..
  mysql_query("DELETE FROM ".$this->prefix."ipndata WHERE id = '{$split[0]}' LIMIT 1") or die(mysql_error());
  // Clear purchases..
  mysql_query("DELETE FROM ".$this->prefix."purchases WHERE cartID = '{$split[1]}'") or die(mysql_error());
}

// Change order status..
function changeOrderStatus($id,$status)
{
  mysql_query("UPDATE ".$this->prefix."ipndata SET
               status    = '{$status}'
               WHERE id  = '{$id}'
               LIMIT 1
               ") or die(mysql_error());
}

}

?>
