mirror of
https://github.com/fspc/biketree.git
synced 2026-09-16 14:31:36 -04:00
First commit of biketree to github!
This commit is contained in:
Executable
+228
@@ -0,0 +1,228 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
include ("../classes/display.php");
|
||||
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Sales Clerk',$lang);
|
||||
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
|
||||
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$table_bg=$display->sale_bg;
|
||||
$num_items=count($_SESSION['items_in_sale']);
|
||||
|
||||
if($num_items==0)
|
||||
{
|
||||
echo "<b>$lang->youMustSelectAtLeastOneItem</b><br>";
|
||||
echo "<a href=javascript:history.go(-1)>$lang->refreshAndTryAgain</a>";
|
||||
exit();
|
||||
}
|
||||
$customers_table=$cfg_tableprefix.'customers';
|
||||
$items_table=$cfg_tableprefix.'items';
|
||||
$sales_items_table=$cfg_tableprefix.'sales_items';
|
||||
$sales_table=$cfg_tableprefix.'sales';
|
||||
|
||||
//general sale info
|
||||
$paid_with=isset($_POST['paid_with'])?$_POST['paid_with']:'';
|
||||
$comment=isset($_POST['comment'])?$_POST['comment']:'';
|
||||
$customer_name=$dbf->idToField($customers_table,'first_name',$_SESSION['current_sale_customer_id']).' '.$dbf->idToField($customers_table,'last_name',$_SESSION['current_sale_customer_id']);
|
||||
|
||||
//totals
|
||||
$finalTax=$_POST['totalTax'];
|
||||
$sale_total_cost=$_POST['finalTotal'];
|
||||
$temp_total_items_purchased=$_POST['totalItemsPurchased'];
|
||||
|
||||
$amt_tendered=$_POST['amt_tendered'];
|
||||
$amt_change=$amt_tendered-$sale_total_cost;
|
||||
$amt_tendered=number_format($amt_tendered, 2,'.','');
|
||||
$amt_change=number_format($amt_change, 2,'.','');
|
||||
|
||||
$now=date("F j, Y, g:i a");
|
||||
$body.="
|
||||
<center>$now<br>
|
||||
<h4>Order For: $customer_name [$lang->paidWith $paid_with]</h4>
|
||||
|
||||
<table border='0' cellspacing='0' cellpadding='2' bgcolor='$table_bg'>
|
||||
|
||||
<tr>
|
||||
<th><font color='000000'>$lang->itemOrdered</font></th>
|
||||
<th><font color='000000'> || $lang->unitPrice</font></th>
|
||||
<th><font color='000000'> || $lang->quantity</font></th>
|
||||
<th><font color='000000'> || $lang->extendedPrice</font></th>
|
||||
</tr>";
|
||||
|
||||
|
||||
$todaysDate=date("Y-m-d");
|
||||
$subtotal=number_format($sale_total_cost-$finalTax,2,'.', '');
|
||||
$final_tax=number_format($finalTax,2,'.', '');
|
||||
|
||||
$field_names=array('date','customer_id','sale_sub_total','sale_total_cost','paid_with','items_purchased','sold_by','comment');
|
||||
$field_data=array($todaysDate,$_SESSION['current_sale_customer_id'],$subtotal,$sale_total_cost,$paid_with,$temp_total_items_purchased,$_SESSION['session_user_id'],$comment);
|
||||
$dbf->insert($field_names,$field_data,$sales_table,false);
|
||||
$saleID=mysql_insert_id();
|
||||
|
||||
$field_names=array('sale_id','item_id','quantity_purchased','item_unit_price','item_buy_price','item_tax_percent','item_total_tax','item_total_cost');
|
||||
|
||||
$temp_item_id='';
|
||||
$temp_item_name='';
|
||||
$temp_quantity_purchased=0;
|
||||
$temp_item_unit_price=0;
|
||||
$temp_item_buy_price=0;
|
||||
$temp_item_tax_percent=0;
|
||||
$temp_item_tax=0;
|
||||
$temp_item_cost=0;
|
||||
$item_info=array();
|
||||
|
||||
//Add to sales_items table
|
||||
for($k=0;$k<$num_items;$k++)
|
||||
{
|
||||
$item_info=explode(' ',$_SESSION['items_in_sale'][$k]);
|
||||
|
||||
$temp_item_id=$item_info[0];
|
||||
$temp_item_name=$dbf->idToField($items_table,'item_name',$temp_item_id);
|
||||
$temp_quantity_purchased=$item_info[3];
|
||||
$temp_item_unit_price=number_format($item_info[1],2,'.', '');
|
||||
$temp_item_buy_price=number_format($dbf->idToField($items_table,'buy_price',$temp_item_id),2,'.', '');
|
||||
$temp_item_tax_percent=$item_info[2];
|
||||
$temp_item_tax=number_format($temp_item_tax_percent/100*$temp_item_unit_price*$temp_quantity_purchased,2,'.', '');
|
||||
$temp_item_cost=number_format(($temp_item_unit_price*$temp_quantity_purchased)+$temp_item_tax,2,'.', '');
|
||||
|
||||
$field_data=array("$saleID","$temp_item_id","$temp_quantity_purchased","$temp_item_unit_price","$temp_item_buy_price","$temp_item_tax_percent","$temp_item_tax","$temp_item_cost");
|
||||
$new_quantity=$dbf->idToField($items_table,'quantity',$temp_item_id)-$temp_quantity_purchased;
|
||||
$query="UPDATE $items_table SET quantity=\"$new_quantity\" WHERE $temp_item_id=id";
|
||||
mysql_query($query,$dbf->conn);
|
||||
$dbf->insert($field_names,$field_data,$sales_items_table,false);
|
||||
$body .= "<tr><td align='center'><font color='white'>$temp_item_name</font></td>
|
||||
<td align='center'><font color='white'>$cfg_currency_symbol$temp_item_unit_price</font></td>
|
||||
<td align='center'><font color='white'>$temp_quantity_purchased</font></td>
|
||||
<td align='center'><font color='white'>$cfg_currency_symbol$temp_item_cost</font></td>
|
||||
</tr>";
|
||||
|
||||
}
|
||||
|
||||
$body .= "</table><br>
|
||||
<table border='0' align='center'><tr><td><b>$lang->saleSubTotal: $cfg_currency_symbol$subtotal</b></td></tr>";
|
||||
$body .= "<tr><td><b>$lang->tax: $cfg_currency_symbol$final_tax</b></td></tr>";
|
||||
$body .= "<tr><td><b>$lang->saleTotalCost: $cfg_currency_symbol$sale_total_cost</b></td></tr>";
|
||||
|
||||
if($amt_tendered!=0)
|
||||
{
|
||||
$body .= "<tr><td><b>$lang->amtTendered: $cfg_currency_symbol$amt_tendered</b></td></tr>";
|
||||
$body .= "<tr><td><br/><b>$lang->amtChange: $cfg_currency_symbol$amt_change</b><br/></td></tr>";
|
||||
|
||||
}
|
||||
$body .= "<tr><td><b>$lang->saleID: $saleID</b></td></tr></table></table>";
|
||||
|
||||
$sec->closeSale();
|
||||
$dbf->closeDBlink();
|
||||
|
||||
$body .= "<br><br><b>$lang->contact $cfg_company:</b><p>";
|
||||
if($cfg_address!='')
|
||||
{
|
||||
$temp_address=nl2br($cfg_address);
|
||||
$body .= "$lang->address: $temp_address <br>";
|
||||
|
||||
}
|
||||
if($cfg_phone!='')
|
||||
{
|
||||
$body .= "$lang->phoneNumber: $cfg_phone <br>";
|
||||
|
||||
}
|
||||
|
||||
if($cfg_email!='')
|
||||
{
|
||||
$body .= "$lang->email: $cfg_email <br>";
|
||||
|
||||
}
|
||||
|
||||
if($cfg_fax!='')
|
||||
{
|
||||
$body .= "$lang->fax: $cfg_fax <br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($cfg_website!='')
|
||||
{
|
||||
$body .= "$lang->website <a href=$cfg_website>$cfg_website</a> <br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($cfg_other!='')
|
||||
{
|
||||
$body .= "$lang->other: $cfg_other <br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo "$body";
|
||||
|
||||
//EMAIL RECIEPT TO MEMBER!
|
||||
|
||||
// In case any of our lines are larger than 70 characters, we should use wordwrap()
|
||||
$message = wordwrap($body, 70);
|
||||
|
||||
$headers = 'MIME-Version: 1.0' . "\r\n";
|
||||
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
|
||||
$headers .= 'From: mark@goodlifebikes.ca' . "\r\n";
|
||||
|
||||
$message = "<html><body> $message </body></html>";
|
||||
|
||||
echo "$headers";
|
||||
// Send
|
||||
mail('mark@goodlifebikes.ca', "Your Receipt from $cfg_company", $message, $headers);
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<br><br>
|
||||
<SCRIPT Language="Javascript">
|
||||
|
||||
/*
|
||||
This script is written by Eric (Webcrawl@usa.net)
|
||||
For full source code, installation instructions,
|
||||
100's more DHTML scripts, and Terms Of
|
||||
Use, visit dynamicdrive.com
|
||||
*/
|
||||
|
||||
function printit(){
|
||||
if (window.print) {
|
||||
window.print() ;
|
||||
} else {
|
||||
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
|
||||
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
|
||||
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<SCRIPT Language="Javascript">
|
||||
var NS = (navigator.appName == "Netscape");
|
||||
var VERSION = parseInt(navigator.appVersion);
|
||||
if (VERSION > 3) {
|
||||
document.write('<form><input type=button value="Print" name="Print" onClick="printit()"></form>');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+230
@@ -0,0 +1,230 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
include ("../classes/display.php");
|
||||
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Sales Clerk',$lang);
|
||||
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
|
||||
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$table_bg=$display->sale_bg;
|
||||
$num_items=count($_SESSION['items_in_sale']);
|
||||
|
||||
if($num_items==0)
|
||||
{
|
||||
echo "<b>$lang->youMustSelectAtLeastOneItem</b><br>";
|
||||
echo "<a href=javascript:history.go(-1)>$lang->refreshAndTryAgain</a>";
|
||||
exit();
|
||||
}
|
||||
$customers_table=$cfg_tableprefix.'customers';
|
||||
$items_table=$cfg_tableprefix.'items';
|
||||
$sales_items_table=$cfg_tableprefix.'sales_items';
|
||||
$sales_table=$cfg_tableprefix.'sales';
|
||||
|
||||
//general sale info
|
||||
$paid_with=isset($_POST['paid_with'])?$_POST['paid_with']:'';
|
||||
$comment=isset($_POST['comment'])?$_POST['comment']:'';
|
||||
$customer_name=$dbf->idToField($customers_table,'first_name',$_SESSION['current_sale_customer_id']).' '.$dbf->idToField($customers_table,'last_name',$_SESSION['current_sale_customer_id']);
|
||||
|
||||
$customer_email=$dbf->idToField($customers_table,'email',$_SESSION['current_sale_customer_id']);
|
||||
|
||||
//totals
|
||||
$finalTax=$_POST['totalTax'];
|
||||
$sale_total_cost=$_POST['finalTotal'];
|
||||
$temp_total_items_purchased=$_POST['totalItemsPurchased'];
|
||||
|
||||
$amt_tendered=$_POST['amt_tendered'];
|
||||
$amt_change=$amt_tendered-$sale_total_cost;
|
||||
$amt_tendered=number_format($amt_tendered, 2,'.','');
|
||||
$amt_change=number_format($amt_change, 2,'.','');
|
||||
|
||||
$now=date("F j, Y, g:i a");
|
||||
$body.="
|
||||
<center>$now<br>
|
||||
<h4>Order For: $customer_name [$lang->paidWith $paid_with]</h4>
|
||||
|
||||
<table border='0' cellspacing='0' cellpadding='2' bgcolor='$table_bg'>
|
||||
|
||||
<tr>
|
||||
<th><font color='000000'>$lang->itemOrdered</font></th>
|
||||
<th><font color='000000'> || $lang->unitPrice</font></th>
|
||||
<th><font color='000000'> || $lang->quantity</font></th>
|
||||
<th><font color='000000'> || $lang->extendedPrice</font></th>
|
||||
</tr>";
|
||||
|
||||
|
||||
$todaysDate=date("Y-m-d");
|
||||
$subtotal=number_format($sale_total_cost-$finalTax,2,'.', '');
|
||||
$final_tax=number_format($finalTax,2,'.', '');
|
||||
|
||||
$field_names=array('date','customer_id','sale_sub_total','sale_total_cost','paid_with','items_purchased','sold_by','comment');
|
||||
$field_data=array($todaysDate,$_SESSION['current_sale_customer_id'],$subtotal,$sale_total_cost,$paid_with,$temp_total_items_purchased,$_SESSION['session_user_id'],$comment);
|
||||
$dbf->insert($field_names,$field_data,$sales_table,false);
|
||||
$saleID=mysql_insert_id();
|
||||
|
||||
$field_names=array('sale_id','item_id','quantity_purchased','item_unit_price','item_buy_price','item_tax_percent','item_total_tax','item_total_cost');
|
||||
|
||||
$temp_item_id='';
|
||||
$temp_item_name='';
|
||||
$temp_quantity_purchased=0;
|
||||
$temp_item_unit_price=0;
|
||||
$temp_item_buy_price=0;
|
||||
$temp_item_tax_percent=0;
|
||||
$temp_item_tax=0;
|
||||
$temp_item_cost=0;
|
||||
$item_info=array();
|
||||
|
||||
//Add to sales_items table
|
||||
for($k=0;$k<$num_items;$k++)
|
||||
{
|
||||
$item_info=explode(' ',$_SESSION['items_in_sale'][$k]);
|
||||
|
||||
$temp_item_id=$item_info[0];
|
||||
$temp_item_name=$dbf->idToField($items_table,'item_name',$temp_item_id);
|
||||
$temp_quantity_purchased=$item_info[3];
|
||||
$temp_item_unit_price=number_format($item_info[1],2,'.', '');
|
||||
$temp_item_buy_price=number_format($dbf->idToField($items_table,'buy_price',$temp_item_id),2,'.', '');
|
||||
$temp_item_tax_percent=$item_info[2];
|
||||
$temp_item_tax=number_format($temp_item_tax_percent/100*$temp_item_unit_price*$temp_quantity_purchased,2,'.', '');
|
||||
$temp_item_cost=number_format(($temp_item_unit_price*$temp_quantity_purchased)+$temp_item_tax,2,'.', '');
|
||||
|
||||
$field_data=array("$saleID","$temp_item_id","$temp_quantity_purchased","$temp_item_unit_price","$temp_item_buy_price","$temp_item_tax_percent","$temp_item_tax","$temp_item_cost");
|
||||
$new_quantity=$dbf->idToField($items_table,'quantity',$temp_item_id)-$temp_quantity_purchased;
|
||||
$query="UPDATE $items_table SET quantity=\"$new_quantity\" WHERE $temp_item_id=id";
|
||||
mysql_query($query,$dbf->conn);
|
||||
$dbf->insert($field_names,$field_data,$sales_items_table,false);
|
||||
$body .= "<tr><td align='center'><font color='white'>$temp_item_name</font></td>
|
||||
<td align='center'><font color='white'>$cfg_currency_symbol$temp_item_unit_price</font></td>
|
||||
<td align='center'><font color='white'>$temp_quantity_purchased</font></td>
|
||||
<td align='center'><font color='white'>$cfg_currency_symbol$temp_item_cost</font></td>
|
||||
</tr>";
|
||||
|
||||
}
|
||||
|
||||
$body .= "</table><br>
|
||||
<table border='0' align='center'><tr><td><b>$lang->saleSubTotal: $cfg_currency_symbol$subtotal</b></td></tr>";
|
||||
$body .= "<tr><td><b>$lang->tax: $cfg_currency_symbol$final_tax</b></td></tr>";
|
||||
$body .= "<tr><td><b>$lang->saleTotalCost: $cfg_currency_symbol$sale_total_cost</b></td></tr>";
|
||||
|
||||
if($amt_tendered!=0)
|
||||
{
|
||||
$body .= "<tr><td><b>$lang->amtTendered: $cfg_currency_symbol$amt_tendered</b></td></tr>";
|
||||
$body .= "<tr><td><br/><b>$lang->amtChange: $cfg_currency_symbol$amt_change</b><br/></td></tr>";
|
||||
|
||||
}
|
||||
$body .= "<tr><td><b>$lang->saleID: $saleID</b></td></tr></table></table>";
|
||||
|
||||
$sec->closeSale();
|
||||
$dbf->closeDBlink();
|
||||
|
||||
$body .= "<br><br><b>$lang->contact $cfg_company:</b><p>";
|
||||
if($cfg_address!='')
|
||||
{
|
||||
$temp_address=nl2br($cfg_address);
|
||||
$body .= "$lang->address: $temp_address <br>";
|
||||
|
||||
}
|
||||
if($cfg_phone!='')
|
||||
{
|
||||
$body .= "$lang->phoneNumber: $cfg_phone <br>";
|
||||
|
||||
}
|
||||
|
||||
if($cfg_email!='')
|
||||
{
|
||||
$body .= "$lang->email: $cfg_email <br>";
|
||||
|
||||
}
|
||||
|
||||
if($cfg_fax!='')
|
||||
{
|
||||
$body .= "$lang->fax: $cfg_fax <br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($cfg_website!='')
|
||||
{
|
||||
$body .= "$lang->website <a href=$cfg_website>$cfg_website</a> <br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($cfg_other!='')
|
||||
{
|
||||
$body .= "$lang->other: $cfg_other <br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo "$body";
|
||||
|
||||
//EMAIL RECIEPT TO MEMBER!
|
||||
|
||||
$headers = 'MIME-Version: 1.0' . "\r\n";
|
||||
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
|
||||
$headers .= "From: $cfg_emailFromAddress" . "\r\n";
|
||||
|
||||
|
||||
$message = "<html><body><br /><br /><b>Please retain or print this receipt for your records</b><br /> $body </body></html>";
|
||||
|
||||
// In case any of our lines are larger than 70 characters, we should use wordwrap()
|
||||
$message = wordwrap($message, 70);
|
||||
|
||||
// Send
|
||||
mail($customer_email, "Your E-receipt from $cfg_company", $message, $headers);
|
||||
|
||||
echo "<h3>E-Reciept has been sent to <$customer_email></h3>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<br><br>
|
||||
<SCRIPT Language="Javascript">
|
||||
|
||||
/*
|
||||
This script is written by Eric (Webcrawl@usa.net)
|
||||
For full source code, installation instructions,
|
||||
100's more DHTML scripts, and Terms Of
|
||||
Use, visit dynamicdrive.com
|
||||
*/
|
||||
|
||||
function printit(){
|
||||
if (window.print) {
|
||||
window.print() ;
|
||||
} else {
|
||||
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
|
||||
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
|
||||
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<SCRIPT Language="Javascript">
|
||||
var NS = (navigator.appName == "Netscape");
|
||||
var VERSION = parseInt(navigator.appVersion);
|
||||
if (VERSION > 3) {
|
||||
document.write('<form><input type=button value="Print" name="Print" onClick="printit()"></form>');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
<?php session_start(); ob_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Sales Clerk',$lang);
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
if(isset($_GET['action']))
|
||||
{
|
||||
$action=$_GET['action'];
|
||||
switch($action)
|
||||
{
|
||||
case $action=='all':
|
||||
$sec->closeSale();
|
||||
break;
|
||||
case $action=='item':
|
||||
$pos=$_GET['pos'];
|
||||
|
||||
for($k=0;$k<count($_SESSION['items_in_sale']);$k++)
|
||||
{
|
||||
if($k==$pos)
|
||||
{
|
||||
unset($_SESSION['items_in_sale'][$k]);
|
||||
$_SESSION['items_in_sale']=array_values($_SESSION['items_in_sale']);
|
||||
|
||||
if(count($_SESSION['items_in_sale'])==0)
|
||||
{
|
||||
$sec->closeSale();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case $action=='item_search':
|
||||
|
||||
unset($_SESSION['current_item_search']);
|
||||
|
||||
break;
|
||||
|
||||
case $action=='customer_search':
|
||||
unset($_SESSION['current_customer_search']);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
header ("location: sale_ui.php");
|
||||
|
||||
$dbf->closeDBlink();
|
||||
ob_end_flush();
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
|
||||
//creates 3 objects needed for this script.
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Admin',$lang);
|
||||
|
||||
//checks if user is logged in.
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit ();
|
||||
}
|
||||
|
||||
if(isset($_GET['item_id']) and isset($_GET['sale_id']) and isset($_GET['row_id']))
|
||||
{
|
||||
$item_id=$_GET['item_id'];
|
||||
$sale_id=$_GET['sale_id'];
|
||||
$row_id=$_GET['row_id'];
|
||||
}
|
||||
|
||||
$returned_quantity=$dbf->idToField($cfg_tableprefix.'sales_items','quantity_purchased',$row_id);
|
||||
$newQuantity=$dbf->idToField($cfg_tableprefix.'items','quantity',$item_id)+$returned_quantity;
|
||||
$dbf->deleteRow($cfg_tableprefix.'sales_items',$row_id);
|
||||
$dbf->updateItemQuantity($item_id,$newQuantity);
|
||||
$dbf->updateSaleTotals($sale_id);
|
||||
|
||||
?>
|
||||
<br>
|
||||
<a href="manage_sales.php"><?php echo $lang->manageSales ?>--></a>
|
||||
<br>
|
||||
<a href="sale_ui.php"><?php echo $lang->startSale?> --></a>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
|
||||
//creates 3 objects needed for this script.
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Admin',$lang);
|
||||
|
||||
//checks if user is logged in.
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit ();
|
||||
}
|
||||
|
||||
//variables needed globably in this file.
|
||||
$tablename="$cfg_tableprefix".'sales';
|
||||
|
||||
if(isset($_GET['id']))
|
||||
{
|
||||
$id=$_GET['id'];
|
||||
|
||||
}
|
||||
|
||||
$dbf->deleteRow($tablename,$id);
|
||||
|
||||
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
?>
|
||||
<br>
|
||||
<a href="manage_sales.php"><?php echo $lang->manageSales ?>--></a>
|
||||
<br>
|
||||
<a href="sale_ui.php"><?php echo $lang->startSale ?>--></a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,56 @@
|
||||
[10-Mar-2017 00:43:19 America/Toronto] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/variousa/public_html/pos/classes/db_functions.php on line 24
|
||||
[10-Mar-2017 00:43:21 America/Toronto] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/variousa/public_html/pos/classes/db_functions.php on line 24
|
||||
[10-Mar-2017 00:43:23 America/Toronto] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/variousa/public_html/pos/classes/db_functions.php on line 24
|
||||
[10-Mar-2017 00:43:34 America/Toronto] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/variousa/public_html/pos/classes/db_functions.php on line 24
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/variousa/public_html/pos/classes/db_functions.php on line 24
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Warning: number_format() expects parameter 1 to be double, string given in /home/variousa/public_html/pos/sales/addsale.php on line 56
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Deprecated: Function ereg() is deprecated in /home/variousa/public_html/pos/classes/db_functions.php on line 419
|
||||
[10-Mar-2017 00:43:38 America/Toronto] PHP Fatal error: Call to undefined function session_unregister() in /home/variousa/public_html/pos/classes/security_functions.php on line 130
|
||||
[10-Mar-2017 00:43:45 America/Toronto] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/variousa/public_html/pos/classes/db_functions.php on line 24
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
<?php session_start();
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Sales Clerk',$lang);
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit();
|
||||
}
|
||||
/*$today = date("Y-m-d");
|
||||
$result = mysql_query("SELECT * FROM books");
|
||||
$open = 0;
|
||||
while($field = mysql_fetch_array($result)){
|
||||
if($field[date] == $today && $field[event] == "open"){
|
||||
$open = 1;
|
||||
}
|
||||
}
|
||||
if($open == 0){
|
||||
header("location: ../books/openshop.php");
|
||||
exit();
|
||||
}*/
|
||||
echo "
|
||||
<html>
|
||||
<body>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<table border=\"0\" width=\"500\">
|
||||
<tr>
|
||||
<td><img border=\"0\" src=\"../images/sales.gif\" width=\"30\" height=\"31\" valign='top'><font color='#005B7F' size='4'> <b>$lang->sales</b></font><br>
|
||||
<br>
|
||||
<font face=\"Verdana\" size=\"2\">$lang->salesWelcomeMessage</font>
|
||||
<ul>
|
||||
<li><font face=\"Verdana\" size=\"2\"><a href=\"sale_ui.php\">$lang->startSale</a></font></li>
|
||||
<li><font face=\"Verdana\" size=\"2\"><a href=\"manage_sales.php\">$lang->manageSales</a></font></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
|
||||
?>
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
<?
|
||||
phpinfo();
|
||||
|
||||
?>
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<SCRIPT LANGUAGE="Javascript">
|
||||
<!---
|
||||
function decision(message, url)
|
||||
{
|
||||
if(confirm(message) )
|
||||
{
|
||||
location.href = url;
|
||||
}
|
||||
}
|
||||
// --->
|
||||
</SCRIPT>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
include ("../classes/display.php");
|
||||
include ("../classes/form.php");
|
||||
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Admin',$lang);
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit();
|
||||
}
|
||||
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
|
||||
$display->displayTitle("$lang->manageSales");
|
||||
|
||||
$f1=new form('manage_sales.php','POST','sales','450',$cfg_theme,$lang);
|
||||
$f1->createInputField("<b>$lang->searchForSale</b>",'text','search',"$lang->highID".'-'."$lang->lowID",'24','350');
|
||||
$f1->endForm();
|
||||
|
||||
|
||||
if(isset($_POST['search']))
|
||||
{
|
||||
$search=$_POST['search'];
|
||||
$temp_search=explode('-',$search);
|
||||
|
||||
if(!(ereg('-',$search)))
|
||||
{
|
||||
echo '<center><b></b></center>';
|
||||
exit();
|
||||
}
|
||||
$id1=$temp_search[0];
|
||||
$id2=$temp_search[1];
|
||||
|
||||
if($id1 < $id2)
|
||||
{
|
||||
echo "<center><b>$lang->incorrectSearchFormat(ex: $id2-$id1)</b></center>";
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
echo "<center>$lang->searchedForSales id's <b>$id1 $lang->and $id2:</b></center>";
|
||||
$display->displaySaleManagerTable("$cfg_tableprefix",$id2,$id1,'id');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$display->displaySaleManagerTable("$cfg_tableprefix",'','','id');
|
||||
}
|
||||
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+94
@@ -0,0 +1,94 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
|
||||
//creates 3 objects needed for this script.
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Admin',$lang);
|
||||
|
||||
//checks if user is logged in.
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit ();
|
||||
}
|
||||
|
||||
//variables needed globably in this file.
|
||||
$tablename="$cfg_tableprefix".'sales_items';
|
||||
$field_names=null;
|
||||
$field_data=null;
|
||||
$id=-1;
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['quantity_purchased']) and isset($_POST['item_unit_price']) and isset($_POST['item_tax_percent']) and isset($_POST['item_id']) and isset($_POST['sale_id']) and isset($_POST['row_id']) and isset($_POST['old_quantity']))
|
||||
{
|
||||
|
||||
if(!is_numeric($_POST['quantity_purchased']) or !is_numeric($_POST['item_unit_price']) or !is_numeric($_POST['item_tax_percent']))
|
||||
{
|
||||
echo 'You must enter a numeric value for quantity purchased, Unit Price, and Tax.';
|
||||
exit();
|
||||
}
|
||||
$item_id = $_POST['item_id'];
|
||||
$sale_id = $_POST['sale_id'];
|
||||
$row_id = $_POST['row_id'];
|
||||
$old_quantity= $_POST['old_quantity'];
|
||||
|
||||
//gets variables entered by user.
|
||||
$quantity_purchased = $_POST['quantity_purchased'];
|
||||
$item_unit_price = $_POST['item_unit_price'];
|
||||
$item_tax_percent = $_POST['item_tax_percent'];
|
||||
$item_total_tax=($item_unit_price*$quantity_purchased)*($item_tax_percent/100);
|
||||
$item_total_cost=($item_unit_price*$quantity_purchased)+$item_total_tax;
|
||||
|
||||
$item_unit_price=number_format($item_unit_price,2,'.', '');
|
||||
$item_total_tax=number_format($item_total_tax,2,'.', '');
|
||||
$item_total_cost=number_format($item_total_cost,2,'.', '');
|
||||
|
||||
$changeInQuantity=$old_quantity-$quantity_purchased;
|
||||
$currentQuantity=$dbf->idToField($cfg_tableprefix.'items','quantity',$item_id);
|
||||
$newQuantity=$currentQuantity+$changeInQuantity;
|
||||
|
||||
//insure all fields are filled in.
|
||||
if($quantity_purchased=='' or $item_unit_price=='' or $item_tax_percent=='')
|
||||
{
|
||||
echo "$lang->forgottenFields";
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//outputs error message because user did not use form to fill out data.
|
||||
echo "$lang->mustUseForm";
|
||||
exit();
|
||||
}
|
||||
|
||||
$field_names=array('quantity_purchased','item_unit_price','item_tax_percent','item_total_tax','item_total_cost');
|
||||
$field_data=array("$quantity_purchased","$item_unit_price","$item_tax_percent","$item_total_tax","$item_total_cost");
|
||||
$dbf->update($field_names,$field_data,$tablename,$row_id,true);
|
||||
$dbf->updateItemQuantity($item_id,$newQuantity);
|
||||
$dbf->updateSaleTotals($sale_id);
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
?>
|
||||
<br>
|
||||
<a href="manage_sales.php"><?php echo $lang->manageSales ?>--></a>
|
||||
<br>
|
||||
<a href="sale_ui.php"><?php echo $lang->startSale ?>--></a>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
|
||||
//creates 3 objects needed for this script.
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Admin',$lang);
|
||||
|
||||
//checks if user is logged in.
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit ();
|
||||
}
|
||||
|
||||
//variables needed globably in this file.
|
||||
$tablename="$cfg_tableprefix".'sales';
|
||||
$field_names=null;
|
||||
$field_data=null;
|
||||
$id=-1;
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['paid_with']) and isset($_POST['id']))
|
||||
{
|
||||
|
||||
$id = $_POST['id'];
|
||||
|
||||
//gets variables entered by user.
|
||||
$paid_with = $_POST['paid_with'];
|
||||
$comment=$_POST['comment'];
|
||||
|
||||
|
||||
//insure all fields are filled in.
|
||||
if($paid_with=='')
|
||||
{
|
||||
echo "$lang->forgottenFields";
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//outputs error message because user did not use form to fill out data.
|
||||
echo "$lang->mustUseForm";
|
||||
exit();
|
||||
}
|
||||
|
||||
$field_names=array('paid_with','comment');
|
||||
$field_data=array("$paid_with","$comment");
|
||||
|
||||
$dbf->update($field_names,$field_data,$tablename,$id,true);
|
||||
$dbf->closeDBlink();
|
||||
|
||||
?>
|
||||
<br>
|
||||
<a href="manage_sales.php"><?php echo $lang->manageSales ?>--></a>
|
||||
<br>
|
||||
<a href="sale_ui.php"><?php echo $lang->startSale ?>--></a>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+479
@@ -0,0 +1,479 @@
|
||||
<?php session_start();
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
$lang=new language();
|
||||
|
||||
//updating row for an item already in sale.
|
||||
if(isset($_GET['update_item']))
|
||||
{
|
||||
$k=$_GET['update_item'];
|
||||
$new_price=$_POST["price$k"];
|
||||
$new_tax=$_POST["tax$k"];
|
||||
$new_quantity=$_POST["quantity$k"];
|
||||
|
||||
$item_info=explode(' ',$_SESSION['items_in_sale'][$k]);
|
||||
$item_id=$item_info[0];
|
||||
$percentOff=$item_info[4];
|
||||
|
||||
$_SESSION['items_in_sale'][$k]=$item_id.' '.$new_price.' '.$new_tax.' '.$new_quantity.' '.$percentOff;
|
||||
header("location: sale_ui.php");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['discount']))
|
||||
{
|
||||
$discount=$_POST['global_sale_discount'];
|
||||
|
||||
if(is_numeric($discount))
|
||||
{
|
||||
for($k=0;$k<count($_SESSION['items_in_sale']);$k++)
|
||||
{
|
||||
$item_info=explode(' ',$_SESSION['items_in_sale'][$k]);
|
||||
$item_id=$item_info[0];
|
||||
$new_price=$item_info[1]*(1-($discount/100));
|
||||
$tax=$item_info[2];
|
||||
$quantity=$item_info[3];
|
||||
$percentOff=$item_info[4];
|
||||
|
||||
$new_price=number_format($new_price,2,'.', '');
|
||||
|
||||
$_SESSION['items_in_sale'][$k]=$item_id.' '.$new_price.' '.$tax.' '.$quantity.' '.$percentOff;
|
||||
}
|
||||
|
||||
header("location: sale_ui.php?global_sale_discount=$discount");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
include ("../classes/display.php");
|
||||
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Sales Clerk',$lang);
|
||||
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
|
||||
$today = date("Y-m-d");
|
||||
if(cfg_mustOpen && !$sec->isOpen()){
|
||||
header("location: ../books/openshop.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
if(isset($_POST['customer']))
|
||||
{
|
||||
if($cfg_numberForBarcode=="Row ID")
|
||||
{
|
||||
if($dbf->isValidCustomer($_POST['customer']))
|
||||
{
|
||||
$_SESSION['current_sale_customer_id']=$_POST['customer'];
|
||||
}
|
||||
}
|
||||
else//try account_number
|
||||
{
|
||||
$id=$dbf->fieldToid($cfg_tableprefix.'customers','account_number',$_POST['customer']);
|
||||
|
||||
if($dbf->isValidCustomer($id))
|
||||
{
|
||||
$_SESSION['current_sale_customer_id']=$id;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "$lang->customerWithID/$lang->accountNumber ".$_POST['customer'].', '."$lang->isNotValid";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP Point Of Sale</title>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
function customerFocus()
|
||||
{
|
||||
document.scan_customer.customer.focus();
|
||||
updateScanCustomerField();
|
||||
}
|
||||
|
||||
function itemFocus()
|
||||
{
|
||||
document.scan_item.item.focus();
|
||||
updateScanItemField();
|
||||
}
|
||||
|
||||
function updateScanCustomerField()
|
||||
{
|
||||
document.scan_customer.customer.value=document.scan_customer.customer_list.value;
|
||||
}
|
||||
|
||||
function updateScanItemField()
|
||||
{
|
||||
document.scan_item.item.value=document.scan_item.item_list.value;
|
||||
}
|
||||
|
||||
//-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<?php
|
||||
if(isset($_SESSION['current_sale_customer_id']))
|
||||
{
|
||||
?>
|
||||
<body onLoad="itemFocus();">
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<body onLoad="customerFocus();">
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
$table_bg=$display->sale_bg;
|
||||
$items_table="$cfg_tableprefix".'items';
|
||||
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$display->displayTitle("$lang->newSale");
|
||||
|
||||
if(empty($_SESSION['current_sale_customer_id']))
|
||||
{
|
||||
$customers_table="$cfg_tableprefix".'customers';
|
||||
|
||||
if(isset($_POST['customer_search']) and $_POST['customer_search']!='')
|
||||
{
|
||||
$search=$_POST['customer_search'];
|
||||
$_SESSION['current_customer_search']=$search;
|
||||
$customer_result=mysql_query("SELECT first_name,last_name,account_number,id FROM $customers_table WHERE last_name like \"%$search%\" or first_name like \"%$search%\" or id =\"$search\" ORDER by last_name",$dbf->conn);
|
||||
}
|
||||
elseif(isset($_SESSION['current_customer_search']))
|
||||
{
|
||||
$search=$_SESSION['current_customer_search'];
|
||||
$customer_result=mysql_query("SELECT first_name,last_name,account_number,id FROM $customers_table WHERE last_name like \"%$search%\" or first_name like \"%$search%\" or id =\"$search\" ORDER by last_name",$dbf->conn);
|
||||
|
||||
}
|
||||
elseif($dbf->getNumRows($customers_table) >200)
|
||||
{
|
||||
$customer_result=mysql_query("SELECT first_name,last_name,account_number,id FROM $customers_table ORDER by last_name LIMIT 0,200",$dbf->conn);
|
||||
}
|
||||
else
|
||||
{
|
||||
$customer_result=mysql_query("SELECT first_name,last_name,account_number,id FROM $customers_table ORDER by last_name",$dbf->conn);
|
||||
}
|
||||
|
||||
$customer_title=isset($_SESSION['current_customer_search']) ? "<b><font color='white'>$lang->selectCustomer: </font></b>":"<font color='white'>$lang->selectCustomer: </font>";
|
||||
|
||||
echo "<table align='center' cellpadding='2' cellspacing='2' bgcolor='$table_bg'>
|
||||
<form name='select_customer' action='sale_ui.php' method='POST'>
|
||||
<tr><td align='left'><font color='white'>$lang->findCustomer:</font>
|
||||
<input type='text' size='8' name='customer_search'>
|
||||
<input type='submit' value='Go'><a href='delete.php?action=customer_search'><font size='-1' color='white'>[$lang->clearSearch]</font></a>
|
||||
</form></td></tr>
|
||||
|
||||
<form name='scan_customer' action='sale_ui.php' method='POST'>
|
||||
<tr><td align='left'>$customer_title<select name='customer_list' onChange=\"updateScanCustomerField()\";>";
|
||||
|
||||
while($row=mysql_fetch_assoc($customer_result))
|
||||
{
|
||||
if($cfg_numberForBarcode=="Row ID")
|
||||
{
|
||||
$id=$row['id'];
|
||||
}
|
||||
elseif($cfg_numberForBarcode=="Account/Item Number")
|
||||
{
|
||||
$id=$row['account_number'];
|
||||
}
|
||||
if ($cfg_sellToNonMembers == "1"){
|
||||
$display_name=$row['last_name'].', '.$row['first_name'];
|
||||
echo "<option value=$id>$display_name</option></center>";
|
||||
} else {
|
||||
|
||||
//IF config is member only sales, only list them.
|
||||
$today = date('Y-m-d');
|
||||
$membersinquery = "SELECT userID FROM visits WHERE DATE_FORMAT(intime,'%Y-%m-%d')='$today' AND endout IS NULL";
|
||||
$membersinresult = mysql_query("$membersinquery",$dbf->conn);
|
||||
while ($inarray = mysql_fetch_array($membersinresult)){
|
||||
if ($id == $inarray[userID]) {
|
||||
$display_name=$row['last_name'].', '.$row['first_name'];
|
||||
echo "<option value=$id>$display_name</option></center>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
|
||||
echo "</td><br><br>";
|
||||
|
||||
echo "<tr><td align='left'><center><small><font color='white'>($lang->scanInCustomer)</font></small></center>";
|
||||
echo"<font color='white'>$lang->customerID / $lang->accountNumber: </font><input type='text' name='customer' size='6'>
|
||||
<input type='submit'></td></tr>
|
||||
</form>";
|
||||
|
||||
}
|
||||
|
||||
if(isset($_SESSION['current_sale_customer_id']))
|
||||
{
|
||||
if(isset($_POST['item']))
|
||||
{
|
||||
$item=$_POST['item'];
|
||||
$discount='0%';
|
||||
if($cfg_numberForBarcode=="Account/Item Number")
|
||||
{
|
||||
$item=$dbf->fieldToid($items_table,'item_number',$_POST['item']);
|
||||
|
||||
}
|
||||
|
||||
if($dbf->isValidItem($item))
|
||||
{
|
||||
if($dbf->isItemOnDiscount($item))
|
||||
{
|
||||
$discount=$dbf->getPercentDiscount($item).'%';
|
||||
$itemPrice=$dbf->getDiscountedPrice($item);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$itemPrice=$dbf->idToField($items_table,'unit_price',$item);
|
||||
}
|
||||
$itemTax=$dbf->idToField($items_table,'tax_percent',$item);
|
||||
$_SESSION['items_in_sale'][]=$item.' '.$itemPrice.' '.$itemTax.' '.'1'.' '.$discount;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "$lang->itemWithID/$lang->itemNumber ".$_POST['item'].', '."$lang->isNotValid";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isset($_SESSION['items_in_sale']))
|
||||
{
|
||||
$num_items=count($_SESSION['items_in_sale']);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$num_items=0;
|
||||
}
|
||||
$temp_item_name='';
|
||||
$temp_item_id='';
|
||||
$temp_quantity='';
|
||||
$temp_price='';
|
||||
$finalSubTotal=0;
|
||||
$finalTax=0;
|
||||
$finalTotal=0;
|
||||
$totalItemsPurchased=0;
|
||||
|
||||
$item_info=array();
|
||||
|
||||
$customers_table="$cfg_tableprefix".'customers';
|
||||
$order_customer_first_name=$dbf->idToField($customers_table,'first_name',$_SESSION['current_sale_customer_id']);
|
||||
$order_customer_last_name=$dbf->idToField($customers_table,'last_name',$_SESSION['current_sale_customer_id']);
|
||||
$order_customer_name=$order_customer_first_name.' '.$order_customer_last_name;
|
||||
|
||||
echo "<hr><center><a href=delete.php?action=all>[$lang->clearSale]</a></center>";
|
||||
|
||||
|
||||
$items_table="$cfg_tableprefix".'items';
|
||||
$brands_table="$cfg_tableprefix".'brands';
|
||||
|
||||
|
||||
if(isset($_POST['item_search']) and $_POST['item_search']!='')
|
||||
{
|
||||
$search=$_POST['item_search'];
|
||||
$_SESSION['current_item_search']=$search;
|
||||
$item_result=mysql_query("SELECT item_name,unit_price,tax_percent,brand_id,item_number,quantity,id FROM $items_table WHERE item_name like \"%$search%\" or item_number= \"$search\" or id =\"$search\" ORDER by item_name",$dbf->conn);
|
||||
}
|
||||
elseif(isset($_SESSION['current_item_search']))
|
||||
{
|
||||
$search=$_SESSION['current_item_search'];
|
||||
$item_result=mysql_query("SELECT item_name,unit_price,tax_percent,brand_id,item_number,quantity,id FROM $items_table WHERE item_name like \"%$search%\" or item_number= \"$search\" or id =\"$search\" ORDER by item_name",$dbf->conn);
|
||||
|
||||
}
|
||||
elseif($dbf->getNumRows($items_table) >200)
|
||||
{
|
||||
$item_result=mysql_query("SELECT item_name,unit_price,tax_percent,brand_id,item_number,quantity,id FROM $items_table ORDER by item_name LIMIT 0,200",$dbf->conn);
|
||||
}
|
||||
else
|
||||
{
|
||||
$item_result=mysql_query("SELECT item_name,unit_price,tax_percent,brand_id,item_number,quantity,id FROM $items_table ORDER by item_name",$dbf->conn);
|
||||
}
|
||||
|
||||
|
||||
$item_title=isset($_SESSION['current_item_search']) ? "<b><font color='white'>$lang->selectItem: </font></b>":"<font color=white>$lang->selectItem: </font>";
|
||||
echo "<form name='select_item' action='sale_ui.php' method='POST'>
|
||||
<table border='0' bgcolor='$table_bg' align='center'>
|
||||
<tr><td align='left'><font color='white'>$lang->findItem: <input type='text' size='8' name='item_search'></font>
|
||||
<input type='submit' value='Go'><a href='delete.php?action=item_search'><font size='-1' color='white'>[$lang->clearSearch]</font></a></td></tr>";
|
||||
|
||||
echo "</form><tr><td><form name='scan_item' action='sale_ui.php' method='POST'>
|
||||
$item_title <select name='item_list' onChange=\"updateScanItemField()\";>\n";
|
||||
|
||||
while($row=mysql_fetch_assoc($item_result))
|
||||
{
|
||||
if($cfg_numberForBarcode=="Row ID")
|
||||
{
|
||||
$id=$row['id'];
|
||||
|
||||
}
|
||||
elseif($cfg_numberForBarcode=="Account/Item Number")
|
||||
{
|
||||
$id=$row['item_number'];
|
||||
}
|
||||
|
||||
$quantity=$row['quantity'];
|
||||
$brand_id=$row['brand_id'];
|
||||
$brand_name=$dbf->idToField("$brands_table",'brand',"$brand_id");
|
||||
$unit_price=$row['unit_price'];
|
||||
$tax_percent=$row['tax_percent'];
|
||||
$option_value=$id;
|
||||
$display_item="$brand_name".'- '.$row['item_name'];
|
||||
if($quantity <=0)
|
||||
{
|
||||
echo "<option value='$option_value'>$display_item ($lang->outOfStockWarn)</option>\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<option value='$option_value'>$display_item</option>\n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
echo "</select></td></tr>
|
||||
<tr><td><center><small><font color='white'>($lang->scanInItem)</font></small></center>
|
||||
<font color='white'>$lang->itemID / $lang->itemNumber: </font><input type='text' name='item' size='6'>
|
||||
<input type='submit'></form></td></tr>
|
||||
<center>$lang->orderFor: <b>$order_customer_name</b></center><br>
|
||||
|
||||
</table>";
|
||||
|
||||
|
||||
|
||||
echo "<h3 align='center'>$lang->shoppingCart</h3>
|
||||
|
||||
<form name='add_sale' action='addsale.php' method='POST'>";
|
||||
echo "<table border='0' bgcolor='$table_bg' cellspacing='0' cellpadding='2' align='center'>
|
||||
<tr><th><font color=CCCCCC>$lang->remove</font></th>
|
||||
<th><font color=CCCCCC>$lang->itemName</font></th>
|
||||
<th><font color=CCCCCC>$lang->unitPrice</font></th>
|
||||
<th><font color=CCCCCC>$lang->tax %</font></th>
|
||||
<th><font color=CCCCCC>$lang->quantity</font></th>
|
||||
<th><font color=CCCCCC>$lang->extendedPrice</font></th>
|
||||
<th><font color=CCCCCC>$lang->update</font></th>
|
||||
<th><font color=CCCCCC>$lang->percentOff</font></th>
|
||||
</tr>";
|
||||
|
||||
for($k=0;$k<$num_items;$k++)
|
||||
{
|
||||
$item_info=explode(' ',$_SESSION['items_in_sale'][$k]);
|
||||
$temp_item_id=$item_info[0];
|
||||
$temp_item_name=$dbf->idToField($items_table,'item_name',$temp_item_id);
|
||||
$temp_price=$item_info[1];
|
||||
$temp_tax=$item_info[2];
|
||||
$temp_quantity=$item_info[3];
|
||||
$temp_discount=$item_info[4];
|
||||
|
||||
$subTotal=$temp_price*$temp_quantity;
|
||||
$tax=$subTotal*($temp_tax/100);
|
||||
$rowTotal=$subTotal+$tax;
|
||||
$rowTotal=number_format($rowTotal,2,'.', '');
|
||||
|
||||
$finalSubTotal+=$subTotal;
|
||||
$finalTax+=$tax;
|
||||
$finalTotal+=$rowTotal;
|
||||
$totalItemsPurchased+=$temp_quantity;
|
||||
|
||||
echo "<tr><td align='center'><a href=delete.php?action=item&pos=$k><font color=white>[$lang->delete]</font></a></td>
|
||||
<td align='center'><font color='white'><b>$temp_item_name</b></font></td>
|
||||
<td align='center'><input type=text name='price$k' value='$temp_price' size='8'></td>
|
||||
<td align='center'><input type=text name='tax$k' value='$temp_tax' size='3'></td>
|
||||
<td align='center'><input type=text name='quantity$k' value='$temp_quantity' size='3'></td>
|
||||
<td align='center'><font color='white'><b>$cfg_currency_symbol$rowTotal</b></font></td>
|
||||
<td align='center'><input type='button' name='updateQuantity$k' value='$lang->update' onclick=\"document.add_sale.action='sale_ui.php?update_item=$k';document.add_sale.submit();\"></td>
|
||||
<td align='center'><font color='white'><b>$temp_discount $lang->percentOff</b></font></td>
|
||||
<input type='hidden' name='item_id$k' value='$temp_item_id'>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
|
||||
$finalSubTotal=number_format($finalSubTotal,2,'.', '');
|
||||
$finalTax=number_format($finalTax,2,'.', '');
|
||||
$finalTotal=number_format($finalTotal,2,'.', '');
|
||||
|
||||
echo '</table>';
|
||||
|
||||
|
||||
echo "<table align='center' ><br>
|
||||
<tr><td align='left'>$lang->saleSubTotal: $cfg_currency_symbol$finalSubTotal</td></tr>
|
||||
<tr><td align='left'>$lang->tax: $cfg_currency_symbol$finalTax</td></tr>";
|
||||
if(isset($_GET['global_sale_discount']))
|
||||
{
|
||||
$discount=$_GET['global_sale_discount'];
|
||||
echo"<tr><td align='left'>$discount% $lang->percentOff</td></tr>";
|
||||
|
||||
}
|
||||
echo"<tr><td align='left'><b>$lang->saleTotalCost: $cfg_currency_symbol$finalTotal</b></td></tr>";
|
||||
|
||||
echo'</table>';
|
||||
|
||||
echo "<br>
|
||||
<table align='center' bgcolor='$table_bg'><br>
|
||||
<tr><td align='left'><font color='white'>$lang->globalSaleDiscount</font></td>
|
||||
<td align='left'><input type='text' name='global_sale_discount' size='3'></td>
|
||||
<td><input type='button' name='updateQuantity$k' value='$lang->update' onclick=\"document.add_sale.action='sale_ui.php?discount=true';document.add_sale.submit();\"></td></tr>
|
||||
</table><br>";
|
||||
|
||||
echo "<br><table border='0' bgcolor='$table_bg' align='center'>
|
||||
<tr>
|
||||
<td>
|
||||
<font color='white'>$lang->paidWith:</font>
|
||||
</td>
|
||||
<td>
|
||||
<select name='paid_with'>
|
||||
<option value='$lang->cash'>$lang->cash</option>
|
||||
<option value='$lang->check'>$lang->check</option>
|
||||
<option value='$lang->credit'>$lang->credit</option>
|
||||
<option value='$lang->giftCertificate'>$lang->giftCertificate</option>
|
||||
<option value='$lang->account'>$lang->account</option>
|
||||
<option value='$lang->other'>$lang->other</option>
|
||||
</select>
|
||||
<font color='white'>$lang->amtTendered:<input type='text' name='amt_tendered'></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<font color='white'>$lang->saleComment:</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name=comment size=25>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<br>
|
||||
<input type=hidden name='totalItemsPurchased' value='$totalItemsPurchased'>
|
||||
<input type=hidden name='totalTax' value='$finalTax'>
|
||||
<input type=hidden name='finalTotal' value='$finalTotal'>
|
||||
<center><input type='submit' value='Add Sale'></center></form>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
include ("../classes/form.php");
|
||||
include ("../classes/display.php");
|
||||
|
||||
//creates 3 objects needed for this script.
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Admin',$lang);
|
||||
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
|
||||
|
||||
//checks if user is logged in.
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit ();
|
||||
}
|
||||
|
||||
$display->displayTitle("$lang->updateItem");
|
||||
if(isset($_GET['item_id']) and isset($_GET['sale_id']) and isset($_GET['row_id']))
|
||||
{
|
||||
$item_id=$_GET['item_id'];
|
||||
$sale_id=$_GET['sale_id'];
|
||||
$row_id=$_GET['row_id'];
|
||||
$tablename = "$cfg_tableprefix".'sales_items';
|
||||
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$row_id\"",$dbf->conn);
|
||||
|
||||
$row = mysql_fetch_assoc($result);
|
||||
$quantity_purchased_value=$row['quantity_purchased'];
|
||||
$item_unit_price_value=$row['item_unit_price'];
|
||||
$item_tax_percent_value=$row['item_tax_percent'];
|
||||
}
|
||||
|
||||
//creates a form object
|
||||
$f1=new form('process_update_item.php','POST','sale item','335',$cfg_theme,$lang);
|
||||
|
||||
//creates form parts.
|
||||
echo "<br><br><center><b>$lang->updateRowID $row_id</b></center>";
|
||||
$f1->createInputField("<b>$lang->quantityPurchased:</b>",'text','quantity_purchased',"$quantity_purchased_value",'24','160');
|
||||
$f1->createInputField("<b>$lang->unitPrice:</b> ",'text','item_unit_price',"$item_unit_price_value",'24','160');
|
||||
$f1->createInputField("<b>$lang->tax %:</b> ",'text','item_tax_percent',"$item_tax_percent_value",'24','160');
|
||||
|
||||
echo "
|
||||
<input type='hidden' name='row_id' value='$row_id'>
|
||||
<input type='hidden' name='item_id' value='$item_id'>
|
||||
<input type='hidden' name='sale_id' value='$sale_id'>
|
||||
<input type='hidden' name='old_quantity' value='$quantity_purchased_value'>";
|
||||
$f1->endForm();
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../language/$cfg_language");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../classes/security_functions.php");
|
||||
include ("../classes/form.php");
|
||||
include ("../classes/display.php");
|
||||
|
||||
$lang=new language();
|
||||
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
|
||||
$sec=new security_functions($dbf,'Admin',$lang);
|
||||
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
|
||||
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit();
|
||||
}
|
||||
//set default values, these will change if $action==update.
|
||||
$paid_with_value='';
|
||||
$comment_value='';
|
||||
$id=-1;
|
||||
|
||||
//decides if the form will be used to update or add a user.
|
||||
|
||||
|
||||
$display->displayTitle("Update Sale");
|
||||
if(isset($_GET['id']))
|
||||
{
|
||||
$id=$_GET['id'];
|
||||
$tablename = "$cfg_tableprefix".'sales';
|
||||
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
|
||||
|
||||
$row = mysql_fetch_assoc($result);
|
||||
$paid_with_value=$row['paid_with'];
|
||||
$comment_value=$row['comment'];
|
||||
}
|
||||
|
||||
//creates a form object
|
||||
$f1=new form('process_update_sale.php','POST','sale','325',$cfg_theme,$lang);
|
||||
|
||||
//creates form parts.
|
||||
echo "<br><br><center><b>$lang->updateSaleID $id</b></center>";
|
||||
$option_values=array("$paid_with_value",'Cash','Check', 'Credit','Gift Certificate','Account','Other');
|
||||
$option_titles=array("$paid_with_value",$lang->cash,$lang->check,$lang->credit,$lang->giftCertificate,$lang->account,$lang->other);
|
||||
$f1->createSelectField("<b>$lang->paidWith:</b>",'paid_with',$option_values,$option_titles,'130');
|
||||
$f1->createInputField("<b>$lang->saleComment:</b>",'text','comment',"$comment_value",'24','180');
|
||||
echo "
|
||||
<input type='hidden' name='id' value='$id'>";
|
||||
$f1->endForm();
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user