diff --git a/js/transaction.js b/js/transaction.js
index ddc88f7..0e040a8 100644
--- a/js/transaction.js
+++ b/js/transaction.js
@@ -4,50 +4,42 @@
$(function() {
+ $("select[name='transaction_type']").attr("tabindex",1);
+ $("select[name='transaction_type']").focus();
+ $("input[value='Create Transaction']").attr("tabindex",2);
+
// paid or not?
+ $(":checked").parent("td").prev().children().hide();
$(".paid").click(function() {
if ($(this).prop("checked")) {
- $(this).closest("tr").css("background-color","#E6E7E6");
+ $(this).closest("tr").css("background-color","#E6E7E6");
+ $('[href$="' + this.name + '"]').hide();
+ console.log(this.name);
$.post("json/transaction.php",{ paid: 1, transaction_id: this.name } );
}
else {
- $(this).closest("tr").css("background-color","transparent");
+ $(this).closest("tr").css("background-color","transparent");
+ $('[href$="' + this.name + '"]').show();
$.post("json/transaction.php",{ paid: 0, transaction_id: this.name } );
}
});
// Deposit Calculator
if ( $(".paid").length ) { // any transactions?
- var deposit_length = $(".deposit").length;
- if ( deposit_length && deposit_length == 1 ) { // one transaction - maybe can do 1 or more with a sort
-
- $(".paid").each( function() {
-
- if (this.value == 1) { /* Calculate using only the transactions that have been checked
- as paid before the deposit
- */
- var deposit_number = $(".deposit input").attr("name");
- if ( this.name < deposit_number ) { // use database at this point
-
- // find out the Payment Type
- console.log(this.name)
- }
-
- }
-
- });
+ $(".deposit input").each(function(){ console.log(this.name);});
+
+ var deposit_length = $(".deposit").length;
+ if ( deposit_length == 1 ) { // one visible deposit could be 1 or more invisible
+ var deposit_number = $(".deposit input").attr("name");
+ //console.log(deposit_number);
}
- else if ( deposit_length && deposit_length > 1) { /* more than one transaction
- use a range of deposits closest to visible transactions
- */
- //console.log("greater than one deposit");
-
- }
+
}
+
// editing a transaction
if ( $("input[name='shop_id']").length ) {
diff --git a/json/transaction.php b/json/transaction.php
index b7d5da9..2ea40c2 100644
--- a/json/transaction.php
+++ b/json/transaction.php
@@ -29,4 +29,45 @@ mysql_select_db($database_YBDB, $YBDB);
}
+ /*
+ transaction_id, date_startstorage, date,transaction_type, amount, description, sold_to, sold_by, quantity, shop_id, paid
+
+ Always do transactions from the first visible Deposit to the next Deposit.
+ Variations:
+
+ Based on the results of ..
+ SELECT COUNT(transaction_type) FROM transaction_log WHERE transaction_type="Deposit";
+
+ However, if there are no invisible deposits go to the end from the last visible deposit, so do a comparison with
+ visible deposits, to find out if there is 1 unique non-visible deposit.
+
+ COUNT == 1
+ 1. Just beginning to use YBDB: Calculation for 1 visible Deposit all the way to the first existing transaction
+
+ SELECT SUM(IF(payment_type="check", amount, 0.00)) AS "Check",
+ SUM(IF(payment_type="credit", amount, 0.00)) AS "Credit",
+ SUM(IF(payment_type="cash", amount, 0.00)) AS "Cash"
+ FROM transaction_log WHERE paid=1 AND transaction_id < 74;
+ (return sum)
+
+ COUNT > 1
+ 2. Calculation for 1 or more visible Deposits to next non-visible Deposit or no non-visible Deposit
+
+ If no hidden, loop for visible deposits (#2)) ($v) with last one to end (#1 logic, except use $v variable); else;
+ loop for visible deposits to the next hidden deposit (#2).
+
+ foreach ( my $v in @visible_deposits ) {
+
+ SELECT SUM(IF(payment_type="check", amount, 0.00)) AS "Check",
+ SUM(IF(payment_type="credit", amount, 0.00)) AS "Credit",
+ SUM(IF(payment_type="cash", amount, 0.00)) AS "Cash"
+ FROM transaction_log WHERE paid=1 AND transaction_id < $v AND transaction_id >
+ (SELECT transaction_id FROM transaction_log WHERE transaction_type="Deposit" ORDER BY transaction_id LIMIT 1);
+
+ push @sum, answer;
+
+ }
+
+ */
+
?>
\ No newline at end of file
diff --git a/sql/populate.sql b/sql/populate.sql
index 7dffa27..ed8f67d 100644
--- a/sql/populate.sql
+++ b/sql/populate.sql
@@ -40,7 +40,8 @@ INSERT INTO shop_user_roles (
("Volunteer",0,1,0,0),
("Greeter",0,0,1,0),
("Staff",0,0,1,1),
- ("Student Volunteer",0,0,0,0);
+ ("Student Volunteer",0,0,0,0),
+ ("Shopping",0,0,0,0);
-- Add some projects to projects
@@ -73,7 +74,8 @@ INSERT INTO contacts (
-- Set-up transaction types
-- This is object orienteed like :)
--
--- SILLY TEXT FIELDS (some presentation logic that is in the business logic, rather than kept cleanly separated from it)
+-- TEXT FIELDS (some presentation logic that is in the business logic, rather than kept cleanly separated from it)
+-- Although, there are some advantages to this approach.
-- NOTE - (:colon is appended by default:)
--
-- fieldname_date: text field for the day the transaction transpires, e.g. "Sale Date"
@@ -85,10 +87,10 @@ INSERT INTO contacts (
--
-- DISCUSSION ABOUT LOCATIONS in transaction_log.php
-- show_soldto_location is now used to show patrons. The history of this name is
--- that YBP was using it to keep track of donations and locations. However, there is an
+-- that YBP was using it to keep track of donation locations. However, there is an
-- option in transaction_log.php that would show current shop users that was
--- commented out, but never developed to work.
--- More than 1 shop with its own accounting? Run a different instance of YBDB.
+-- commented out. Not sure what the usefullness of location_add_edit_select.php is yet.
+-- With that thought, need more than 1 shop with its own accounting? Run a different instance of YBDB.
--
-- USELESS or RESERVED FIELDS
-- show_soldto and show_soldby currently do not do anything,
diff --git a/transaction_log.php b/transaction_log.php
index 62f5356..e1f1805 100644
--- a/transaction_log.php
+++ b/transaction_log.php
@@ -210,13 +210,13 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
|
- Bike and Sale Log |
+ Bike and Sale Log |
-1 ) { ?>
|