diff --git a/css/transactions.css b/css/transactions.css
index 2ad5380..dba7b0a 100644
--- a/css/transactions.css
+++ b/css/transactions.css
@@ -68,11 +68,11 @@ input[value=Save]:focus, input[value=Close]:focus {
}
/* errors */
-#current_shop, #date_error,
+#current_shop > a, #date_error,
#transaction_start_error,
#sold_by_error, #sold_to_error,
#description_error, #check_number_error,
#payment_error, #payment_type_error,
#quantity_error, #anonymous_error {
- color: red;
+ color: red;
}
\ No newline at end of file
diff --git a/include_header.html b/include_header.html
index fa5bd19..3a55f9f 100644
--- a/include_header.html
+++ b/include_header.html
@@ -22,10 +22,10 @@ function resetTimer()
YBDB
+
-
diff --git a/js/transaction.js b/js/transaction.js
index 65a7435..ec7c227 100644
--- a/js/transaction.js
+++ b/js/transaction.js
@@ -4,10 +4,10 @@
$(function() {
-
+
$.ajaxSetup({async:false}); // best to do this in $.ajax,
// but all ajax needs to be synchronous in this program because of the use of mysql
-
+
$("#transaction_type").attr("tabindex",1);
$("#transaction_type").focus();
$("input[value='Create Transaction']").attr("tabindex",2);
@@ -17,7 +17,7 @@ $(function() {
// use .paid parent and hover & classes
// If page has not been reloaded after a shop period ends, prevent edit from working.
- // Note: create transaction covered via a mysql_error()), but with a reload.
+ // Note: create transaction covered via a mysql_error()), but with a reload - header("Refresh:0;")
$('[href*="trans_id="]').click(function(e){
var remember_me;
$.post("json/transaction.php", {shop_exist: 1}, function(data) {
@@ -50,11 +50,11 @@ $(function() {
}
});
if (remember_me == "unbind") {
- $('#save_transaction').on('click');
- }
- else {
+ $('#save_transaction').on('click');
+ }
+ else {
e.preventDefault();
- }
+ }
} );
// Does a current shop exist?
@@ -448,7 +448,6 @@ $(function() {
$("select[name='sold_by']").attr("tabindex",11);
$("input[value='Save']").attr("tabindex",12);
$("input[value='Close']").attr("tabindex",13);
-
// common ids
var transaction_id = $("input[name='transaction_id']").val();
@@ -551,6 +550,26 @@ $(function() {
} else {
transaction_error.hide();
}
+
+ // store the transaction's history
+ var transaction_history = {
+ transaction_id: $("input[name='transaction_id']").val(),
+ date_startstorage: $("#date_startstorage").val(),
+ date: $("#date").val(),
+ transaction_type: $("#transaction_type").val(),
+ amount: $("#amount").val(),
+ description: $("#description").val(),
+ sold_to: $("#sold_to").val(),
+ sold_by: $("[name='sold_by']").val(),
+ quantity: $("#quantity").val(),
+ shop_id: $("#shop_id").val(),
+ payment_type: $("#payment_type").val(),
+ check_number: $("#check_number").val(),
+ anonymous: $("#anonymous").val()
+ };
+
+ console.dir(transaction_history);
+
});
// error handler for edited transactions
@@ -568,9 +587,11 @@ $(function() {
}
if (trans_error) {
- event.preventDefault();
+ event.preventDefault();
}
- return trans_error;
+
+ return trans_error;
+
}
@@ -581,7 +602,7 @@ $(function() {
if (obj.sold_to) {
var obj = $.parseJSON(data);
sold_to.replaceWith("" + obj.full_name +
- "");
+ "");
}
} );
}
@@ -635,6 +656,16 @@ $(function() {
when a full date (yyyy-mm-dd) is entered. */
if ( $("#date_startstorage").length ) {
+ var date_startstorage = $("#date_startstorage").val();
+
+ // If storage start date has changed since original shop trans, show the original shop day.
+ $.post("json/transaction.php",{date_startstorage: date_startstorage,
+ transaction_id: $("input[name='transaction_id']").val() }, function(data) {
+ if (data) {
+ $("#original_shop_date").html("(transaction date: " + data + ")");
+ }
+ });
+
// require that values be filled in a particular fashion
$("#date_startstorage").mask("0000-00-00", {placeholder: "yyyy-mm-dd" });
@@ -690,20 +721,12 @@ $(function() {
// If storage date is NULL, update to 0000-00-00 on save
$("#save_transaction").click(function(e) {
-
- /*
- var span_or_select = $("[name='sold_to']").is("span"), err0;
- if(span_or_select) {
- err0 = error_handler(span_or_select, date_error, true, "*Patron must be signed in to complete this transaction.",e);
- }
- */
if ( !$("#date").val().length ) {
- //if (err0 != 1) {
- $("#date").val("0000-00-00");
- //}
+ $("#date").val("0000-00-00");
}
+
});
} // end testing for storage presentation
diff --git a/json/transaction.php b/json/transaction.php
index 007d8bf..a40da25 100644
--- a/json/transaction.php
+++ b/json/transaction.php
@@ -89,6 +89,16 @@ $change_fund = CHANGE_FUND;
}
}
+ // check if start storage date has been changed since original shop date
+ if(isset($_POST['date_startstorage'])) {
+ $query = 'SELECT shops.date FROM transaction_log, shops WHERE transaction_id=' . $_POST['transaction_id'] .
+ ' AND transaction_log.shop_id = shops.shop_id;';
+ $sql = mysql_query($query, $YBDB) or die(mysql_error());
+ $result = mysql_fetch_assoc($sql);
+ if ($result['date'] != $_POST['date_startstorage']) {
+ echo $result['date'];
+ }
+ }
// reset payment_type && amount for storage transaction
if(isset($_POST['storage_payment_reset'])) {
diff --git a/transaction_log.php b/transaction_log.php
index fd2767e..023c2d7 100644
--- a/transaction_log.php
+++ b/transaction_log.php
@@ -286,6 +286,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_PO
$trans_id = $transaction_id;
header(sprintf("Location: %s",$editFormAction . "?trans_id={$trans_id}&" . $search_state)); //$editFormAction
+
}
//Form Edit Record Delete ===============================================================================
@@ -441,7 +442,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
|
- |
+