mirror of
				https://github.com/fspc/Yellow-Bike-Database.git
				synced 2025-11-04 01:15:35 -05:00 
			
		
		
		
	Provides anonymous capability for transactions.
This commit is contained in:
		
							parent
							
								
									9f5c338738
								
							
						
					
					
						commit
						c1a33b7076
					
				@ -178,6 +178,22 @@ $(function() {
 | 
			
		||||
		$transaction_id = $("input[name='transaction_id']").val();
 | 
			
		||||
		//var check_number = $("#check_number").on("input");
 | 
			
		||||
	
 | 
			
		||||
		// Anonymous Transaction?
 | 
			
		||||
		if ($("#anonymous").prop("checked")) { // on reload
 | 
			
		||||
			$("select[name='sold_to']").hide();
 | 
			
		||||
		} else {
 | 
			
		||||
			$("select[name='sold_to']").show();
 | 
			
		||||
		} 
 | 
			
		||||
		$("#anonymous").click(function() { // on click
 | 
			
		||||
			if ($(this).prop("checked")) { 
 | 
			
		||||
				$("select[name='sold_to']").hide();
 | 
			
		||||
				$.post("json/transaction.php",{ anonymous: 1, transaction_id: $transaction_id } );
 | 
			
		||||
			} else {
 | 
			
		||||
				$("select[name='sold_to']").show();
 | 
			
		||||
				$.post("json/transaction.php",{ anonymous: 0, transaction_id: $transaction_id } );
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		
 | 
			
		||||
		// what type of payment? cash, credit or check?
 | 
			
		||||
		$("input[name='payment_type']").click(function() { 
 | 
			
		||||
			if ($(this).prop("checked")) { 
 | 
			
		||||
 | 
			
		||||
@ -60,6 +60,21 @@ $change_fund = CHANGE_FUND;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// Anonymous transaction - save and communicate back settings
 | 
			
		||||
	if(isset($_POST['anonymous'])) {
 | 
			
		||||
		
 | 
			
		||||
		if ($_POST['anonymous'] == 1) {
 | 
			
		||||
			$query = 'UPDATE transaction_log SET anonymous=1, sold_to=NULL WHERE transaction_id="' . 
 | 
			
		||||
						$_POST['transaction_id'] . '";';
 | 
			
		||||
			$result = mysql_query($query, $YBDB) or die(mysql_error());
 | 
			
		||||
		} else {
 | 
			
		||||
			$query = 'UPDATE transaction_log SET anonymous=0 WHERE transaction_id="' . 
 | 
			
		||||
						$_POST['transaction_id'] . '";';
 | 
			
		||||
			$result = mysql_query($query, $YBDB) or die(mysql_error());		
 | 
			
		||||
		}
 | 
			
		||||
	} 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// reset payment_type && amount for storage transaction
 | 
			
		||||
	if(isset($_POST['storage_payment_reset'])) {
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
@ -36,10 +36,10 @@ DELETE FROM shop_user_roles;
 | 
			
		||||
INSERT INTO shop_user_roles (
 | 
			
		||||
  shop_user_role_id, hours_rank, volunteer, sales, paid
 | 
			
		||||
) VALUES 
 | 
			
		||||
  ("Coordinator",0,0,1,0), 
 | 
			
		||||
  ("Coordinator",0,1,1,0), 
 | 
			
		||||
  ("Personal",0,0,0,0), 
 | 
			
		||||
  ("Volunteer",0,1,0,0), 
 | 
			
		||||
  ("Greeter",0,0,1,0),
 | 
			
		||||
  ("Greeter",0,1,1,0),
 | 
			
		||||
  ("Staff",0,0,1,1),
 | 
			
		||||
  ("Student Volunteer",0,0,0,0),
 | 
			
		||||
  ("Shopping",0,0,0,0);
 | 
			
		||||
@ -76,7 +76,7 @@ INSERT INTO contacts (
 | 
			
		||||
-- This is object orienteed like :)
 | 
			
		||||
--
 | 
			
		||||
-- 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.
 | 
			
		||||
-- Although, there are some clear advantages to this approach.
 | 
			
		||||
-- NOTE - (:colon is appended by default:)
 | 
			
		||||
--
 | 
			
		||||
-- fieldname_date: text field for the day the transaction transpires, e.g. "Sale Date"
 | 
			
		||||
@ -86,12 +86,16 @@ INSERT INTO contacts (
 | 
			
		||||
-- show_soldto_location: while not a presentation, without it, previous field is useless. (Also, see discussion about location) 
 | 
			
		||||
-- fieldname_description: text field for description text area, e.g. "Description"
 | 
			
		||||
--
 | 
			
		||||
-- 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 donation locations.  However, there is an
 | 
			
		||||
-- option in transaction_log.php that would show current shop users that was 
 | 
			
		||||
-- 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.
 | 
			
		||||
-- (Developers) DISCUSSION ABOUT LOCATIONS - In transaction_log.php 
 | 
			
		||||
-- "show_soldto_location" is now used to show patrons. The probable history of this name is 
 | 
			
		||||
-- that YBP was using it to keep track of donation locations (ignore the "sold" word).  However, there is an
 | 
			
		||||
-- option in transaction_log.php that was meant to show current shop users that was 
 | 
			
		||||
-- commented out, basically, things were still being developed.  
 | 
			
		||||
-- The usefullness of location_add_edit_select.php (inserts new records into contact table) is that it allows
 | 
			
		||||
-- donors to be added who are not present at the shop, usually locations like Department stores, etc. without a password.
 | 
			
		||||
-- It looks like the end result was a compromise with list_donation_locations_withheader() for unlogged donors/patrons
 | 
			
		||||
-- being used for everything, rather than list_CurrentShopUsers_select when appropriate.  However, associating
 | 
			
		||||
-- certain types transactions with different behavior makes good sense .. just needs some renaming.
 | 
			
		||||
--
 | 
			
		||||
-- USELESS or RESERVED FIELDS
 | 
			
		||||
-- show_soldto and show_soldby currently do not do anything, 
 | 
			
		||||
@ -115,48 +119,60 @@ INSERT INTO contacts (
 | 
			
		||||
--  show_startdate - is used by transactions where an item (usually a bicycle) is stored for
 | 
			
		||||
--  a defined period before it is purchased.  If this is set,
 | 
			
		||||
--  the behavior is to hide price (show_amount) and payment types (show_payment)
 | 
			
		||||
--  until a date (label defined by fieldname_date) is entered.
 | 
			
		||||
--  until a date (label defined by fieldname_date) is entered.  When the transaction is complete,
 | 
			
		||||
--  it rises to the current shop day, and is assigned the most recent transaction id.
 | 
			
		||||
--
 | 
			
		||||
-- Storage period may be defined in Connections/database_functions.php - STORAGE_PERIOD
 | 
			
		||||
--  Storage period may be defined in Connections/database_functions.php - STORAGE_PERIOD
 | 
			
		||||
--
 | 
			
		||||
-- DEPOSITS
 | 
			
		||||
-- Deposit (transaction_type_id) is a special transaction type that behaves differently in the log
 | 
			
		||||
-- for a good reason.
 | 
			
		||||
--
 | 
			
		||||
-- DONATIONS (or option to allow an anonymous transactions)
 | 
			
		||||
-- Anonymous (transaction_type_id) provides a checkbox if show_soldto_location is set to allow donations and other types
 | 
			
		||||
-- of desired transactions to be anonymous.
 | 
			
		||||
--
 | 
			
		||||
-- "show_payment" shows cash, credit, and check payment types if selected.
 | 
			
		||||
-- "anonymous" allows anonymous transactions with a check box.
 | 
			
		||||
 | 
			
		||||
ALTER TABLE transaction_types ADD show_payment tinyint(1) NOT NULL DEFAULT '1';
 | 
			
		||||
ALTER TABLE transaction_types ADD anonymous tinyint(1) NOT NULL DEFAULT '0';
 | 
			
		||||
INSERT INTO transaction_types 
 | 
			
		||||
  (transaction_type_id, rank, 
 | 
			
		||||
   active, community_bike, show_transaction_id, show_type, show_startdate, 
 | 
			
		||||
   show_amount, show_description, show_soldto, show_soldby, 
 | 
			
		||||
   fieldname_date, fieldname_soldby, message_transaction_id, 
 | 
			
		||||
   fieldname_soldto, show_soldto_location, fieldname_description, 
 | 
			
		||||
   accounting_group, show_payment
 | 
			
		||||
   accounting_group, show_payment, anonymous
 | 
			
		||||
) VALUES 
 | 
			
		||||
  ("Build Your Own Bike", 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Bicycles", 2, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Non-inventory Parts", 3, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Trade-ups/Ins", 4, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Helmets", 5, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Donations", 6, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1),     
 | 
			
		||||
  ("Memberships", 7, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Inventory Parts", 8, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Cargo Related", 9, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Car Racks", 10, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("DIY Repairs", 11, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1),
 | 
			
		||||
  ("Accounts Receivable Invoice", 12, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 0), 
 | 
			
		||||
  ("Accounts Receivable Payment", 13, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1), 
 | 
			
		||||
  ("Deposit", 14, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Deposit Date", "Deposited By"," ", "", 0, "Description", "Sales", 0),
 | 
			
		||||
  ("Metrics - Completed Mechanic Operation Bike", 15, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1),
 | 
			
		||||
  ("Metrics - Completed Mechanic Operation Wheel", 16, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1),
 | 
			
		||||
  ("Metrics - New Parts on a Completed Bike", 17, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1),
 | 
			
		||||
  ("Sale - Used Parts", 18, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1),
 | 
			
		||||
  ("Sale - New Parts", 19, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1),
 | 
			
		||||
  ("Sale - Complete Bike", 20, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1),
 | 
			
		||||
  ("Giveaway", 21, 1, 0, 1, 1, 0, 0, 1, 1, 1, "Sale Date", "Given By"," ", "Given To", 1, "Description", "Sales", 0);
 | 
			
		||||
  ("Build Your Own Bike", 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Bicycles", 2, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Non-inventory Parts", 3, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Trade-ups/Ins", 4, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Helmets", 5, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Donations", 6, 1, 0, 1, 1, 0, 0, 1, 1, 1, "Sale Date", "Received by"," ", "Given by", 1, "Description", "Sales", 0, 1),
 | 
			
		||||
  ("Monentary Donations", 7, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Received by"," ", "Given by", 1, "Description", "Sales", 1, 1),     
 | 
			
		||||
  ("Memberships", 8, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Inventory Parts", 9, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Cargo Related", 10, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Car Racks", 11, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("DIY Repairs", 12, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0),
 | 
			
		||||
  ("Accounts Receivable Invoice", 13, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 0, 0), 
 | 
			
		||||
  ("Accounts Receivable Payment", 14, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0), 
 | 
			
		||||
  ("Deposit", 15, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Deposit Date", "Deposited By"," ", "", 0, "Description", "Sales", 0, 0),
 | 
			
		||||
  ("Metrics - Completed Mechanic Operation Bike", 16, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0),
 | 
			
		||||
  ("Metrics - Completed Mechanic Operation Wheel", 17, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0),
 | 
			
		||||
  ("Metrics - New Parts on a Completed Bike", 18, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0),
 | 
			
		||||
  ("Sale - Used Parts", 19, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0),
 | 
			
		||||
  ("Sale - New Parts", 20, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0),
 | 
			
		||||
  ("Sale - Complete Bike", 21, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0),
 | 
			
		||||
  ("Giveaway", 22, 1, 0, 1, 1, 0, 0, 1, 1, 1, "Sale Date", "Given By"," ", "Given To", 1, "Description", "Sales", 0, 0);
 | 
			
		||||
 | 
			
		||||
-- transaction_log - added paid or not
 | 
			
		||||
--                 - added payment_type (cash, check or cc)
 | 
			
		||||
--						 - added check_number (Check#)
 | 
			
		||||
--						 - added change_fund to keep track of changes in the fund
 | 
			
		||||
--						 - added anonymous to store whether set or not for a transaction
 | 
			
		||||
-- transaction_id, date_startstorage, date,transaction_type, amount,
 | 
			
		||||
-- description, sold_to, sold_by, quantity, shop_id, paid
 | 
			
		||||
 | 
			
		||||
@ -164,3 +180,4 @@ ALTER TABLE transaction_log ADD paid tinyint(1) NOT NULL DEFAULT '0';
 | 
			
		||||
ALTER TABLE transaction_log ADD payment_type varchar(6) DEFAULT NULL;
 | 
			
		||||
ALTER TABLE transaction_log ADD check_number int(10) unsigned DEFAULT NULL;
 | 
			
		||||
ALTER TABLE transaction_log ADD change_fund float DEFAULT NULL;
 | 
			
		||||
ALTER TABLE transaction_log ADD anonymous tinyint(1) NOT NULL DEFAULT '0';
 | 
			
		||||
 | 
			
		||||
@ -122,7 +122,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormNew")) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// gets newest transaction ID
 | 
			
		||||
	mysql_select_db($database_YBDB, $YBDB);
 | 
			
		||||
	//mysql_select_db($database_YBDB, $YBDB);
 | 
			
		||||
	$query_Recordset4 = "SELECT MAX(transaction_id) as newtrans FROM transaction_log;";
 | 
			
		||||
	$Recordset4 = mysql_query($query_Recordset4, $YBDB) or die(mysql_error());
 | 
			
		||||
	$row_Recordset4 = mysql_fetch_assoc($Recordset4);
 | 
			
		||||
@ -143,7 +143,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormNew")) {
 | 
			
		||||
					   );
 | 
			
		||||
					   
 | 
			
		||||
	//echo $insertSQL; 
 | 
			
		||||
	mysql_select_db($database_YBDB, $YBDB);
 | 
			
		||||
	//mysql_select_db($database_YBDB, $YBDB);
 | 
			
		||||
	$Result1 = mysql_query($insertSQL, $YBDB) or die(mysql_error());	
 | 
			
		||||
	
 | 
			
		||||
	$LoadPage = $_SERVER['PHP_SELF'] . "?trans_id={$newtrans}";
 | 
			
		||||
@ -182,15 +182,15 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_PO
 | 
			
		||||
	$sql = mysql_query($query, $YBDB) or die(mysql_error());
 | 
			
		||||
	$result = mysql_fetch_assoc($sql);
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
	// percolate transaction_id for completed storage transactions		
 | 
			
		||||
	if($date_startstorage) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		$new_transaction_id = $result['ti'] + 1;		
 | 
			
		||||
		
 | 
			
		||||
		// If startstorage >= current date (transaction_id stays the same)
 | 
			
		||||
		// If startstorage < current date (transaction_id becomes > than last)
 | 
			
		||||
		if ($current_date > $storage_date[0] && $storage_date[0] != $transaction_date[0]) {
 | 
			
		||||
		// If startstorage > current date (transaction_id stays the same)
 | 
			
		||||
		// If startstorage =< current date (transaction_id becomes > than last)
 | 
			
		||||
		// not necessary - && $storage_date[0] != $transaction_date[0]
 | 
			
		||||
		if ($current_date >= $storage_date[0] ) {
 | 
			
		||||
			if($_POST['amount'] != "" && $_POST['payment_type'] != "") {			
 | 
			
		||||
				$query = 'UPDATE transaction_log SET transaction_id="' . $new_transaction_id . 
 | 
			
		||||
				'" WHERE transaction_id="' . $_POST['transaction_id'] . '";';
 | 
			
		||||
@ -204,8 +204,32 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_PO
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// keep the order
 | 
			
		||||
	$updateSQL = sprintf("UPDATE transaction_log SET transaction_type=%s, date_startstorage=%s,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	$query = 'SELECT anonymous FROM transaction_log WHERE transaction_id="' . $transaction_id . '";';
 | 
			
		||||
	$sql = mysql_query($query, $YBDB) or die(mysql_error());
 | 
			
		||||
	$result = mysql_fetch_assoc($sql);
 | 
			
		||||
	
 | 
			
		||||
	if($result['anonymous']) {
 | 
			
		||||
 | 
			
		||||
		// keep the order
 | 
			
		||||
		$updateSQL = sprintf("UPDATE transaction_log SET transaction_type=%s, date_startstorage=%s,
 | 
			
		||||
																	 date=%s, amount=%s, quantity=%s, description=%s, 
 | 
			
		||||
																	 sold_by=%s, 
 | 
			
		||||
																	 shop_id=%s, check_number=%s WHERE transaction_id=%s",
 | 
			
		||||
						   GetSQLValueString($_POST['transaction_type'], "text"),
 | 
			
		||||
						   GetSQLValueString($date_startstorage, "date"),
 | 
			
		||||
						   GetSQLValueString($date, "date"),
 | 
			
		||||
						   GetSQLValueString($_POST['amount'], "double"),
 | 
			
		||||
						   GetSQLValueString($_POST['quantity'], "int"),
 | 
			
		||||
						   GetSQLValueString($description, "text"),
 | 
			
		||||
						   GetSQLValueString($sold_by, "int"),
 | 
			
		||||
						   GetSQLValueString($_POST['shop_id'], "int"),
 | 
			
		||||
						   GetSQLValueString($check_number, "text"),
 | 
			
		||||
						   GetSQLValueString($transaction_id, "int")
 | 
			
		||||
						   );
 | 
			
		||||
	} else {
 | 
			
		||||
		$updateSQL = sprintf("UPDATE transaction_log SET transaction_type=%s, date_startstorage=%s,
 | 
			
		||||
																	 date=%s, amount=%s, quantity=%s, description=%s, 
 | 
			
		||||
																	 sold_to=%s, sold_by=%s, 
 | 
			
		||||
																	 shop_id=%s, check_number=%s WHERE transaction_id=%s",
 | 
			
		||||
@ -221,10 +245,9 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_PO
 | 
			
		||||
						   GetSQLValueString($check_number, "text"),
 | 
			
		||||
						   GetSQLValueString($transaction_id, "int")
 | 
			
		||||
						   );	
 | 
			
		||||
						   //"2006-10-12 18:15:00"
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	mysql_select_db($database_YBDB, $YBDB);
 | 
			
		||||
	//mysql_select_db($database_YBDB, $YBDB);
 | 
			
		||||
	$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());	
 | 
			
		||||
	
 | 
			
		||||
	$trans_id = $transaction_id;
 | 
			
		||||
@ -311,7 +334,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
 | 
			
		||||
	  $trans_type = $row_Recordset2['transaction_type'];  //This field is used to set edit box preferences
 | 
			
		||||
	  
 | 
			
		||||
	  // gets preferences of edit based on Transaction Type
 | 
			
		||||
	  mysql_select_db($database_YBDB, $YBDB);
 | 
			
		||||
	  //mysql_select_db($database_YBDB, $YBDB);
 | 
			
		||||
	  $query_Recordset3 = "SELECT * FROM transaction_types WHERE transaction_type_id = \"$trans_type\";";
 | 
			
		||||
	  $Recordset3 = mysql_query($query_Recordset3, $YBDB) or die(mysql_error());
 | 
			
		||||
	  $row_Recordset3 = mysql_fetch_assoc($Recordset3);
 | 
			
		||||
@ -433,15 +456,28 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
 | 
			
		||||
				if($row_Recordset3['show_soldto_location']){ // if location show row?>
 | 
			
		||||
                <tr><td> </td>
 | 
			
		||||
		  	  <td><label><?php echo $row_Recordset3['fieldname_soldto']; ?>:</label></td>
 | 
			
		||||
		  	  <td><?php
 | 
			
		||||
		  	 
 | 
			
		||||
		  	 <?php  // Patron
 | 
			
		||||
			if($row_Recordset3['show_soldto_location']){				
 | 
			
		||||
				// list_donation_locations_withheader('sold_to', $row_Recordset2['sold_to']); 
 | 
			
		||||
				// list_donation_locations_withheader('sold_to', $row_Recordset2['sold_to']); - not required to be signed in.
 | 
			
		||||
				echo "<td>";				
 | 
			
		||||
				list_CurrentShopUsers_select('sold_to', $row_Recordset2['sold_to']);		
 | 
			
		||||
				$record_trans_id = $row_Recordset2['transaction_id'];
 | 
			
		||||
				if ($row_Recordset3['anonymous']) {
 | 
			
		||||
					echo "<span id='anon' style='display:show;'><label for='anonymous' id='anonymous_label'>Anonymous:</label>";
 | 
			
		||||
					if ($row_Recordset2['anonymous']) {					
 | 
			
		||||
							echo "<input type='checkbox' id='anonymous' checked>";
 | 
			
		||||
					} else {
 | 
			
		||||
							echo "<input type='checkbox' id='anonymous'>";
 | 
			
		||||
					}
 | 
			
		||||
					echo "</span>";
 | 
			
		||||
				} else {				
 | 
			
		||||
					echo "<span id='anon' style='display:none;'><label for='anonymous' id='anonymous_label'>Anonymous:</label></span>";
 | 
			
		||||
				}
 | 
			
		||||
				echo "</td>"; 
 | 
			
		||||
				// echo " <a href=\"location_add_edit.php?trans_id={$record_trans_id}&contact_id=new_contact\">Create New Location</a> | <a href=\"location_add_edit_select.php?trans_id={$record_trans_id}&contact_id=new_contact\">Edit Existing Location</a>";
 | 
			
		||||
			} else {
 | 
			
		||||
				//list_CurrentShopUsers_select('sold_to', $row_Recordset2['sold_to']);
 | 
			
		||||
			}  ?></td>
 | 
			
		||||
			}  ?>
 | 
			
		||||
			
 | 
			
		||||
		  	  </tr> <?php } //end if show location row ?>
 | 
			
		||||
                <tr><td> </td>
 | 
			
		||||
			  <td><label><?php echo $row_Recordset3['fieldname_soldby']; ?>:</label></td>
 | 
			
		||||
@ -514,7 +550,20 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
 | 
			
		||||
          <td><?php echo $row_Recordset1['shop_id']; ?></td>
 | 
			
		||||
		  <td><?php echo $row_Recordset1['date_wday']; ?></td>
 | 
			
		||||
		  <td><?php echo $row_Recordset1['transaction_type']; ?></td>
 | 
			
		||||
		  <td><?php echo $row_Recordset1['full_name']; ?> </td>
 | 
			
		||||
		  
 | 
			
		||||
		  <td><?php  // Patron or Anonymous	  
 | 
			
		||||
		  
 | 
			
		||||
		  			$query = 'SELECT anonymous FROM transaction_log WHERE transaction_id="' . $row_Recordset1['transaction_id'] . '";';
 | 
			
		||||
					$sql = mysql_query($query, $YBDB) or die(mysql_error());
 | 
			
		||||
					$result = mysql_fetch_assoc($sql);	
 | 
			
		||||
		  
 | 
			
		||||
		  			if($result['anonymous']) {
 | 
			
		||||
					  echo  "Anonymous"; 
 | 
			
		||||
		  			} else {
 | 
			
		||||
		  				echo $row_Recordset1['full_name'];
 | 
			
		||||
		  			}
 | 
			
		||||
		  ?> </td>
 | 
			
		||||
 | 
			
		||||
		  <td><?php echo $row_Recordset1['description_with_locations']; ?> </td>
 | 
			
		||||
		  <td><?php echo $row_Recordset1['payment_type']; ?> </td>
 | 
			
		||||
		  <td><?php echo $row_Recordset1['format_amount']; ?> </td>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user