mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-22 17:03:22 -05:00
Improvements to saving search state.
This commit is contained in:
parent
9e314551f9
commit
2593c6fe9b
@ -36,34 +36,42 @@ if($_GET['delete_trans_id']>0){
|
|||||||
} else {
|
} else {
|
||||||
$delete_trans_id =-1;}
|
$delete_trans_id =-1;}
|
||||||
|
|
||||||
//shop_date
|
//shop_date ($trans_date => SQL) ($trans_date_state => state)
|
||||||
if($_GET['trans_date']>0){
|
if($_GET['trans_date']>0){
|
||||||
$trans_date = "AND date <= ADDDATE('{$_GET['trans_date']}',1)" ;
|
$trans_date = "AND date <= ADDDATE('{$_GET['trans_date']}',1)" ;
|
||||||
|
$trans_date_state = $_GET['trans_date'];
|
||||||
} else {
|
} else {
|
||||||
$datetoday = current_date();
|
$datetoday = current_date();
|
||||||
|
$trans_date_state = $datetoday;
|
||||||
$trans_date ="AND date <= ADDDATE('{$datetoday}',1)";
|
$trans_date ="AND date <= ADDDATE('{$datetoday}',1)";
|
||||||
$trans_date = ""; }
|
$trans_date = "";
|
||||||
|
}
|
||||||
//dayname
|
|
||||||
|
//dayname ($shop_dayname => SQL) ($shop_dayname_state => state)
|
||||||
if($_GET['shop_dayname']=='alldays'){
|
if($_GET['shop_dayname']=='alldays'){
|
||||||
$shop_dayname = '';
|
$shop_dayname = '';
|
||||||
|
$shop_dayname_state = 'alldays';
|
||||||
} elseif(isset($_GET['shop_dayname'])) {
|
} elseif(isset($_GET['shop_dayname'])) {
|
||||||
$shop_dayname = "AND DAYNAME(date) = '" . $_GET['shop_dayname'] . "'";
|
$shop_dayname = "AND DAYNAME(date) = '" . $_GET['shop_dayname'] . "'";
|
||||||
|
$shop_dayname_state = $_GET['shop_dayname'];
|
||||||
} else {
|
} else {
|
||||||
$shop_dayname = '';
|
$shop_dayname = '';
|
||||||
|
$shop_dayname_state = 'alldays';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Transaction_type
|
//Transaction_type ($trans_type => SQL) ($trans_type_state => state)
|
||||||
if($_GET['trans_type']=='all_types'){
|
if($_GET['trans_type']=='all_types'){
|
||||||
$trans_type = '';
|
$trans_type = '';
|
||||||
|
$trans_type_state = 'all_types';
|
||||||
} elseif(isset($_GET['trans_type'])) {
|
} elseif(isset($_GET['trans_type'])) {
|
||||||
$trans_type = "AND transaction_log.transaction_type = '" . $_GET['trans_type'] . "'";
|
$trans_type = "AND transaction_log.transaction_type = '" . $_GET['trans_type'] . "'";
|
||||||
|
$trans_type_state = $_GET['trans_type'];
|
||||||
} else {
|
} else {
|
||||||
$trans_type = '';
|
$trans_type = '';
|
||||||
|
$trans_type_state = 'all_types';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//record_count (state)
|
||||||
//record_count
|
|
||||||
if($_GET['record_count']>0){
|
if($_GET['record_count']>0){
|
||||||
$record_count = $_GET['record_count'];
|
$record_count = $_GET['record_count'];
|
||||||
$number_of_transactions = $record_count;
|
$number_of_transactions = $record_count;
|
||||||
@ -71,6 +79,24 @@ if($_GET['record_count']>0){
|
|||||||
$record_count = $number_of_transactions;
|
$record_count = $number_of_transactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create a string to remember state
|
||||||
|
$search_state_array = array(
|
||||||
|
"trans_date" => $trans_date_state,
|
||||||
|
"trans_type" => $trans_type_state,
|
||||||
|
"shop_dayname" => $shop_dayname_state,
|
||||||
|
"record_count" => $record_count
|
||||||
|
);
|
||||||
|
$count = count($search_state_array);
|
||||||
|
$c = 1;
|
||||||
|
foreach ( $search_state_array as $key => $value ) {
|
||||||
|
if (isset($value)) {
|
||||||
|
$search_state .= $key . "=" . $value;
|
||||||
|
if ($c < $count) {
|
||||||
|
$search_state = $search_state . "&";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
|
||||||
// This is the recordset for the list of logged transactions
|
// This is the recordset for the list of logged transactions
|
||||||
// What is seen on the main page.
|
// What is seen on the main page.
|
||||||
@ -160,9 +186,8 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormNew")) {
|
|||||||
|
|
||||||
// Form Close Record
|
// Form Close Record
|
||||||
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_POST["EditSubmit"] == "Close")) {
|
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_POST["EditSubmit"] == "Close")) {
|
||||||
|
|
||||||
header(sprintf("Location: %s",$editFormAction . "?record_count=$record_count")); //$editFormAction
|
header(sprintf("Location: %s",$editFormAction . "?" . $search_state)); //$editFormAction
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Form Edit Record ===============================================================================
|
//Form Edit Record ===============================================================================
|
||||||
@ -258,16 +283,15 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_PO
|
|||||||
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
|
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
|
||||||
|
|
||||||
$trans_id = $transaction_id;
|
$trans_id = $transaction_id;
|
||||||
|
|
||||||
|
header(sprintf("Location: %s",$editFormAction . "?trans_id={$trans_id}&" . $search_state)); //$editFormAction
|
||||||
header(sprintf("Location: %s",$editFormAction . "?trans_id={$trans_id}&record_count=$record_count")); //$editFormAction
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Form Edit Record Delete ===============================================================================
|
//Form Edit Record Delete ===============================================================================
|
||||||
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_POST["EditSubmit"] == "Delete")) {
|
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_POST["EditSubmit"] == "Delete")) {
|
||||||
|
|
||||||
$trans_id = $_POST['transaction_id'];
|
$trans_id = $_POST['transaction_id'];
|
||||||
header(sprintf("Location: %s",$editFormAction . "?delete_trans_id={$trans_id}" )); //$editFormAction
|
header(sprintf("Location: %s",$editFormAction . "?delete_trans_id={$trans_id}&" . $search_state )); //$editFormAction
|
||||||
}
|
}
|
||||||
|
|
||||||
//Form Confirm Delete ===============================================================================
|
//Form Confirm Delete ===============================================================================
|
||||||
@ -278,12 +302,12 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ConfirmDelete") &&
|
|||||||
mysql_select_db($database_YBDB, $YBDB);
|
mysql_select_db($database_YBDB, $YBDB);
|
||||||
$Result1 = mysql_query($insertSQL, $YBDB) or die(mysql_error());
|
$Result1 = mysql_query($insertSQL, $YBDB) or die(mysql_error());
|
||||||
|
|
||||||
header(sprintf("Location: %s", PAGE_SALE_LOG )); //$editFormAction
|
header(sprintf("Location: %s", PAGE_SALE_LOG . "?" . $search_state)); //$editFormAction
|
||||||
|
|
||||||
//Cancel and go back to transaction ================================================================
|
//Cancel and go back to transaction ================================================================
|
||||||
} elseif ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ConfirmDelete") && ($_POST["DeleteConfirm"] == "Cancel")) {
|
} elseif ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ConfirmDelete") && ($_POST["DeleteConfirm"] == "Cancel")) {
|
||||||
$delete_trans_id = $_POST['delete_trans_id'];
|
$delete_trans_id = $_POST['delete_trans_id'];
|
||||||
header(sprintf("Location: %s", PAGE_SALE_LOG . "?trans_id={$delete_trans_id}" )); //$editFormAction
|
header(sprintf("Location: %s", PAGE_SALE_LOG . "?trans_id={$delete_trans_id}&" . $search_state )); //$editFormAction
|
||||||
}
|
}
|
||||||
|
|
||||||
//Change Date isset($_POST["MM_update"]) =========================================================
|
//Change Date isset($_POST["MM_update"]) =========================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user