1
0
mirror of https://github.com/fspc/Yellow-Bike-Database.git synced 2025-04-04 09:33:24 -04:00

Compare commits

...

40 Commits
2.0 ... devel

Author SHA1 Message Date
Jonathan Rosenbaum
fa728818c4 Closes #87 2019-04-17 07:38:28 +00:00
Jonathan Rosenbaum
70c8a37e48 Removes phpconsole test! :) 2019-03-14 06:36:30 +00:00
Jonathan Rosenbaum
4f26664388 Closes #86 using regexp solution.
Should work well as long as the network doesn't change. I considered doing a straight-out IP swap during the 24hr period for such an unusual scenario, however, that would not allow for any separation of location if a shop is opened somewhere else.
2019-03-14 06:31:00 +00:00
Jonathan Rosenbaum
3c3e4a0bf3 Adds if( !defined( '*' ) ) to avoid E_NOTICE and redefining.
* Improves error output when using phpconsole (transaction.log) to stop output of E_DEPRECATED.

* The main objective is to better view phpconsole's output. E_NOTICE and E_WARNING are important, regardless.
2019-03-14 05:12:16 +00:00
Jonathan Rosenbaum
824435a35f This fixes a minor bug that occurs if there is only 1 deposit for previous year.
If no min is found this makes it the same as max, only a problem for non transaction_log pages using transaction.js if there is only one deposit for the last year, not sure what will happen with 0 deposits for the last year.
2019-01-22 06:30:38 +00:00
Jonathan Rosenbaum
db93ad1103 Closes #85
Also, counts returned transactions for both stats_monthlysalestax.php and stats_shoptransactiontotals.php .. no more guessing required.
2019-01-22 06:25:40 +00:00
Jonathan Rosenbaum
288521ce2e Fixes #84 - show only paid 2018-12-29 04:51:07 +00:00
Jonathan Rosenbaum
85011402a5 This adds more detail (title) for volunteers in the member metric report.
* Could be modifed further.
* Currently shows color when all hours redeemed.
2018-12-22 06:08:54 +00:00
Jonathan Rosenbaum
306a09fc58 This improves the explanation in the notes about the history of the eab equity. 2018-12-22 04:27:35 +00:00
Jonathan Rosenbaum
2380d6a6d4 This closes #78 and closes #80.
What I thought was a desired equitable behavior for eab was actually a bug.  Now behavior is predictable. Only checks for 0.00 and 0, so 0.0 would create an issue, but unlikely to happen.
2018-12-21 07:26:42 +00:00
Jonathan Rosenbaum
ca4085109c This closes #83 adding probation status to shop_log for contact_id. 2018-12-20 22:04:55 +00:00
Jonathan Rosenbaum
23ce8ffaca Cleans up the code in relation to ec886a9 . 2018-10-28 02:11:24 +00:00
Jonathan Rosenbaum
ec886a967d When membership expires, date turns red. Noted in #1. 2018-10-27 21:17:46 +00:00
Jonathan Rosenbaum
97f02b6788 This should close #42. 2018-10-26 21:48:43 +00:00
Jonathan Rosenbaum
c050b5c0a4 Corrects the report math for stats_userhours.php as pointed out at #42. 2018-10-26 21:22:20 +00:00
Jonathan Rosenbaum
a06c8e091c Replaces the rest of the subtimes per 10d63ae and #42. 2018-10-26 21:04:36 +00:00
Jonathan Rosenbaum
10d63ae286 Corrects the report math for stats_userhours_season and stats_userhours_year as pointed out at #42. 2018-10-26 20:51:13 +00:00
Jonathan Rosenbaum
46f165d13b Corrects the report math for members.php as pointed out at #42. 2018-10-26 20:38:55 +00:00
Jonathan Rosenbaum
330735ff61 Bug fix for #77 enhancment:
* Only counts transactions that are paid
* Quick hack to show all transactions; defaults to 500 for record_count
2018-09-04 00:56:46 +00:00
Jonathan Rosenbaum
da1a063a0a Closes #77. Currently search capability specific to report(s);
Could be integrated into transaction_log page search.
2018-09-04 00:21:43 +00:00
Jonathan Rosenbaum
01293db335 Closes #76. Shows actual visits by contact_id, rather than visitations for each shop_visit_id. 2018-09-03 23:17:35 +00:00
Jonathan Rosenbaum
b8a42f11a0 Fixes #75
Yes, NaN in new year was the culprit.
2018-07-14 22:09:09 +00:00
Jonathan Rosenbaum
3be493fc62 Fixes a bug with #35.
* nulls work in mysql query which allows for unusual sitations to work
2018-05-18 07:40:44 +00:00
Jonathan Rosenbaum
11480e8fd3 In regards to #35, limits contacts to 200 for performance. 2018-05-18 06:44:59 +00:00
Jonathan Rosenbaum
bc2ea843e4 Closes #35. Will need to experiment with colors. 2018-05-18 06:25:42 +00:00
Jonathan Rosenbaum
4de11ee547 Closes #71, shows if member in individual history. 2018-05-16 21:27:06 +00:00
Jonathan Rosenbaum
b18cf97f7c Cleaning up the regexp for #69. 2018-05-14 23:13:08 +00:00
Jonathan Rosenbaum
d0828bc80b Closes #69 adding word search capability for transaction_log. 2018-05-14 22:28:46 +00:00
Jonathan Rosenbaum
59fdb375c5 Closes #54 - more info for csv
* Adds (O:?; P:?; R:?) .. Original Price, Paid and Redeemed Hours, keeping Paid even no redundant for history.
2018-05-14 04:33:32 +00:00
Jonathan Rosenbaum
f1d85b2060 Another #62 enhancement.
* Show displayed transaction number
2018-05-13 19:48:07 +00:00
Jonathan Rosenbaum
940b6c52b3 More enhancements in regards to #62.
* Now shows name with link to individual history for folk who never had an transactions, as well as who have

* Link from individual history back to transaction_log with max results count.
2018-05-13 18:51:00 +00:00
Jonathan Rosenbaum
78102f3600 Related to #62, better behavior on submit:
* Checks that transaction is not a Deposite, and that transation is paid.
2018-05-13 04:29:28 +00:00
Jonathan Rosenbaum
dbcfbd67e0 Another enhancement related to #62.
* Shows total for amounts
2018-05-13 04:05:15 +00:00
Jonathan Rosenbaum
28f8bf464e Prevents wrapping of the table row. Noticed this after enhancement #enhancement #62. 2018-05-13 03:11:26 +00:00
Jonathan Rosenbaum
305ebee833 Closes #62.
* Provides contact search in transaction_log
* future: may improve calendar search with PickMeUp?
2018-05-13 00:03:01 +00:00
Jonathan Rosenbaum
46be9fa887 Closes #67. 2018-05-12 21:27:33 +00:00
Jonathan Rosenbaum
17684f6e10 Fixes #61. Redundant named constant. 2018-05-11 05:18:22 +00:00
Jonathan Rosenbaum
8810c7f3f1 This fixes #65.
* Hadn't updated populate.sql to take advantage of the new change, and demo it out of the box. Nice default.

* show_soldto_not_signed_in = 1 & show_soldto_signed_in = 0
2018-05-09 07:32:19 +00:00
Jonathan Rosenbaum
b6e416a416 Improves instructions 2018-05-09 07:11:45 +00:00
Jonathan Rosenbaum
e149a86d01
update demo link 2018-05-05 21:45:04 -04:00
26 changed files with 762 additions and 254 deletions

View File

@ -1,6 +1,7 @@
<?php
require_once('YBDB.php');
// DO NOT EDIT - USE Connections/local_configurations.php instead with definitions between
// <?php (no space between ? and >) ? >
@ -17,8 +18,21 @@ require_once('YBDB.php');
Hawaii no DST ..... Pacific/Honolulu
*/
define("TIMEZONE", "America/New_York");
if( !defined( 'TIMEZONE' ) ) define("TIMEZONE", "America/New_York");
/***
DHCP
****/
// The public IP address of the device which has opened a shop determines the ownership of that shop.
// In that way, more than one shop can run without conflicting with each other from different locations.
// However, in some cases the IP changes frequently due to DHCP during a 24hr shop.
// Definitions:
// default (use full IP address assigned)
// or
// Enter the numbers that defines a Class (A|B|C) Network, eg. 73.79;
// 73.79 would match a Class B network with an IP range of 73.79.*.*
// For additional info, read https://www.webopedia.com/DidYouKnow/Internet/IPaddressing.asp
if( !defined( 'IP' ) ) define("IP", "default");
/*********
MEMBERSHIP
@ -34,32 +48,29 @@ Memberships include unlimited access to an available work stand during open shop
// Needs to volunteer at least this amount of defined hours before being considered a member
// Note: used only as a metric for reports
define("MEMBERSHIP_HOURS",8);
if( !defined( 'MEMBERSHIP_HOURS' ) ) define("MEMBERSHIP_HOURS",8);
// Needs to volunteer at least this number of days before being considered a member
// Note: used only as a metric for reports
define("MEMBERSHIP_DAYS",2);
if( !defined( 'MEMBERSHIP_DAYS' ) ) define("MEMBERSHIP_DAYS",2);
// Define how long a patron remains a member if they purchase a membership.
define("PURCHASED_MEMBERSHIP_DAYS",365);
if( !defined( 'PURCHASED_MEMBERSHIP_DAYS' ) ) define("PURCHASED_MEMBERSHIP_DAYS",365);
// Define discount for paid members (applies when volunteer benefits do not)
define("MEMBERSHIP_DISCOUNT",10); // PERCENTAGE
if( !defined( 'MEMBERSHIP_DISCOUNT' ) ) define("MEMBERSHIP_DISCOUNT",10); // PERCENTAGE
/*********
STAND TIME
**********/
// Determines the behaviour of Stand Time (transaction_type_id)
define("STAND_TIME_HOURLY_RATE",10); // IN DOLLARS
// Determines the hourly cost for Stand Time (transaction_type_id)
if( !defined( 'STAND_TIME_HOURLY_RATE' ) ) define("STAND_TIME_HOURLY_RATE",10); // IN DOLLARS
// Define how much time over 1hr is allowed before charging for the next hour.
define("STAND_TIME_GRACE_PERIOD",15); // IN MINUTES 1 - 59
// Define hourly cost for stand time
define("STAND_TIME_VALUE",10); // IN DOLLARS
if( !defined( 'STAND_TIME_GRACE_PERIOD' ) ) define("STAND_TIME_GRACE_PERIOD",15); // IN MINUTES 1 - 59
// Define how many free days of stand time are allotted after purchase of a bike
define("FREE_STAND_TIME_PERIOD",30); // IN DAYS
if( !defined( 'FREE_STAND_TIME_PERIOD' ) ) define("FREE_STAND_TIME_PERIOD",30); // IN DAYS
/********************************
SWEAT EQUITY / VOLUNTEER BENEFITS
@ -80,22 +91,17 @@ donated more than 100 hours of their time in the past 365 days, this match can b
(Sweat Equity / Volunteer Benefits can't be combined with Membership Benefits.)
*/
define("SWEAT_EQUITY_LIMIT",100); // IN DOLLARS
define("MAX_BIKE_EARNED",1); // AMOUNT OF BIKES
define("VOLUNTEER_HOUR_VALUE",8); // IN DOLLARS
define("VOLUNTEER_DISCOUNT",25); // PERCENTAGE
define("SPECIAL_VOLUNTEER_HOURS_QUALIFICATION",100); // IN HOURS
define("SPECIAL_VOLUNTEER_DISCOUNT",50); // PERCENTAGE
if( !defined( 'SWEAT_EQUITY_LIMIT' ) ) define("SWEAT_EQUITY_LIMIT",100); // IN DOLLARS
if( !defined( 'MAX_BIKE_EARNED' ) ) define("MAX_BIKE_EARNED",1); // AMOUNT OF BIKES
if( !defined( 'VOLUNTEER_HOUR_VALUE' ) ) define("VOLUNTEER_HOUR_VALUE",8); // IN DOLLARS
if( !defined( 'VOLUNTEER_DISCOUNT' ) ) define("VOLUNTEER_DISCOUNT",25); // PERCENTAGE
if( !defined( 'SPECIAL_VOLUNTEER_HOURS_QUALIFICATION' ) ) define("SPECIAL_VOLUNTEER_HOURS_QUALIFICATION",100); // IN HOURS
if( !defined( 'SPECIAL_VOLUNTEER_DISCOUNT' ) ) define("SPECIAL_VOLUNTEER_DISCOUNT",50); // PERCENTAGE
// Customized sweat equity limit per contact_id
// e.g. for sweat equity limit of $200 for contact_id 500: array(500 => 200)
$custom_sweat_equity_limit = array();
// Determines the behaviour of Bicycles (transaction_type_id) for volunteer to earn-a-bike purchases.
// Keeping things equitable, if a patron decides to purchase a bike, rather than earning it,
// that counts to the EAB limit for the year.
define("EARN_A_BIKE_LIMIT",1);
// Determine if stand time behaviour will be based on the SWEAT_EQUITY_LIMIT with discounts applied,
// or 1 to 1 (1hr of volunteering === 1hr of free stand time) regardless of the SWEAT_EQUITY_LIMIT
define("REDEEM_ONE_TO_ONE", true);
@ -123,18 +129,28 @@ BANNED IDS
// Ban those pesky individuals who continually refuse to follow policies and safer space agreements by contact_id
$banned_individuals = array();
/************
PROBATION IDS
************/
// Put individuals under probation by contact_id. Probation could be used for a variety of scenarios,
// an individual who may potentially become banned, or who has been deemed as worthy of coming out of a ban,
// or someone who IOU's volunteer time for a bike they earned (generally, people should not be allowed to do
// this in the first place), etc.
$probation_individuals = array();
/*******
CONTACTS
********/
// Allow waiver (recommended) in Add/Edit Contacts; 1 = yes, 0 = no
// Waiver text may be modified in Connections/waiver.txt
define("WAIVER", 1);
if( !defined( 'WAIVER' ) ) define("WAIVER", 1);
define("WAIVER_LABEL","Waiver of Liability and Safer Spaces Agreement:");
if( !defined( 'WAIVER_LABEL' ) ) define("WAIVER_LABEL","Waiver of Liability and Safer Spaces Agreement:");
// Allow email_list option in Add/Edit Contacts; 1 = yes, 0 = no
define("EMAIL_LIST", 1);
if( !defined( 'EMAIL_LIST' ) ) define("EMAIL_LIST", 1);
// Define a url for an email connector that will connect to an email list.
// The url can be a server:port, program, etc.
@ -143,20 +159,20 @@ define("EMAIL_LIST", 1);
// The purpose of email connectors is to provide autonomy in the choice
// of email services and programs. E.g. mailman, googlegroups
// See ./examples for an example mailman connector
define("EMAIL_LIST_CONNECTOR","https://wvcompletestreets.org:9987");
if( !defined( 'EMAIL_LIST_CONNECTOR' ) ) define("EMAIL_LIST_CONNECTOR","https://wvcompletestreets.org:9987");
// Define the password that is unique to the connector.
define("EMAIL_LIST_CONNECTOR_PASSWORD","bikebike");
if( !defined( 'EMAIL_LIST_CONNECTOR_PASSWORD' ) ) define("EMAIL_LIST_CONNECTOR_PASSWORD","bikebike");
// If a self-signed ssl certificate that is associated with the email connector is being provided,
// designate an absolute path, if not, change to false.
define("SSL_CERTIFICATE", "/var/www/html/examples/cert.pem");
if( !defined( 'SSL_CERTIFICATE' ) ) define("SSL_CERTIFICATE", "/var/www/html/examples/cert.pem");
//// "Volunteer Interest" form ////
define("VOLUNTEER_INTEREST_FORM", true);
if( !defined( 'VOLUNTEER_INTEREST_FORM' ) ) define("VOLUNTEER_INTEREST_FORM", true);
// Form name
define("VOLUNTEER_INTEREST_FORM_NAME","Volunteer Interests");
if( !defined( 'VOLUNTEER_INTEREST_FORM_NAME' ) ) define("VOLUNTEER_INTEREST_FORM_NAME","Volunteer Interests");
// NOTE: Introductory text can be modified in Connections/volunteer_interest_form_introduction.txt
@ -178,7 +194,7 @@ $volunteer_interests = array(
);
// Provide a comment box - true of false
define("VOLUNTEER_INTEREST_COMMENTS", true);
if( !defined( 'VOLUNTEER_INTEREST_COMMENTS' ) ) define("VOLUNTEER_INTEREST_COMMENTS", true);
// NOTE: The 2 variables ($volunteer_interest_changename & $volunteer_interests_deletename)
// below allow you to change or delete an interest.
@ -211,40 +227,40 @@ TRANSACTIONS
************/
// User defined constants - read sql/populate.sql for an explanation
define("STORAGE_PERIOD", 14);
define("ACCOUNTING_GROUP", "Sales");
define("DEFAULT_TRANSACTION_TYPE", "Sale - Used Parts");
if( !defined( 'STORAGE_PERIOD' ) ) define("STORAGE_PERIOD", 14);
if( !defined( 'ACCOUNTING_GROUP' ) ) define("ACCOUNTING_GROUP", "Sales");
if( !defined( 'DEFAULT_TRANSACTION_TYPE' ) ) define("DEFAULT_TRANSACTION_TYPE", "Sale - Used Parts");
// shop_user_role
define("DEFAULT_SHOP_USER", "Stand Time");
if( !defined( 'DEFAULT_SHOP_USER' ) ) define("DEFAULT_SHOP_USER", "Stand Time");
/* Change Fund - A specific amount of money for the purpose of making change.
The amount on hand should remain the same at all times;
therefore a change funds does not require replenishment.
*/
define("CHANGE_FUND", 20);
if( !defined( 'CHANGE_FUND' ) ) define("CHANGE_FUND", 20);
// How many hours should the shop be open from the time a person logins? Hours display in pulldown in shop_log.php
// No overtime for volunteers. :)
// shop will be current shop for the 24hr day yyyy-mm-dd (currently no check for hrs, only date)
define("SHOP_HOURS_LENGTH", 10);
if( !defined( 'SHOP_HOURS_LENGTH' ) ) define("SHOP_HOURS_LENGTH", 10);
// What minute interval should be displayed for list_time()? In other words, the time_in and time_out pulldown lists.
// choose an interval that is divisible by 60 minutes, 1, 5, 15, 30 etc.
define("LIST_MINUTE_INTERVAL", 1);
if( !defined( 'LIST_MINUTE_INTERVAL' ) ) define("LIST_MINUTE_INTERVAL", 1);
/* If you elect to keep records for non-shop hours, decide which shop should be used for that purpose.
The first shop created, 1, makes sense. A link will show in start_shop.php.
If you do not want this functionality at all, choose 0.
*/
define("NONSHOP", 0);
if( !defined( 'NONSHOP' ) ) define("NONSHOP", 0);
// How many transactions do you want shown by default
define("NUMBER_OF_TRANSACTIONS", 11);
if( !defined( 'NUMBER_OF_TRANSACTIONS' ) ) define("NUMBER_OF_TRANSACTIONS", 11);
// Define csv directory (see directions below for creating it)
define("CSV_DIRECTORY","csv");
if( !defined( 'CSV_DIRECTORY' ) ) define("CSV_DIRECTORY","csv");
// Make a directory to store csv accounting files. Currently used for GnuCash format.
// Assuming the root of the website, and directory is called csv, and a Debian-based distribution:
@ -278,14 +294,15 @@ $gnucash_accounts = array( "Assets:Current Assets:Checking Account" => "checking
// Note: Remote shops function independently via their IP identification.
//
// Normally, you will want this set at 0.
define('SHOW_SHOP_ID',0);
if( !defined( 'SHOW_SHOP_ID' ) ) define('SHOW_SHOP_ID',0);
/*************
ETHERPAD LITE
**************/
// Allow comments/feedback/notes to be added per individual_history_log in reports,
// and globally in shop_log. An etherpad host has to be defined for this to work.
// See wiki for instructions on how to setup an etherpad docker instance.
// See wiki for instructions on how to setup an etherpad docker instance or just go to
// https://github.com/fspc/etherpad-and-draw-node-alpine
//
// prefix allows you to set a prefix to the name of the autogenerated padId:
// etherpad = prefix + "pad_contact_id_" + contact_id;
@ -315,16 +332,38 @@ if(file_exists( realpath($_SERVER["DOCUMENT_ROOT"]) . "/Connections/local_config
}
// other constants
define("PAGE_START_SHOP", "/start_shop.php");
define("PAGE_SHOP_LOG", "/shop_log.php");
define("PAGE_EDIT_CONTACT", "/contact_add_edit.php");
define("PAGE_SELECT_CONTACT", "/contact_add_edit_select.php");
define("PAGE_SHOP_LOG_DELETE_VISIT", "/shop_log_delete_shopvisitid.php");
define("INDIVIDUAL_HOURS_LOG", "/individual_hours_log.php");
define("INDIVIDUAL_HISTORY_LOG", "/individual_history_log.php");
define("PAGE_SALE_LOG", "/transaction_log.php");
define("PAGE_EDIT_LOCATION", "/location_add_edit.php");
define("PAGE_SELECT_LOCATION", "/location_add_edit_select.php");
if( !defined( 'PAGE_START_SHOP' ) ) define("PAGE_START_SHOP", "/start_shop.php");
if( !defined( 'PAGE_SHOP_LOG' ) ) define("PAGE_SHOP_LOG", "/shop_log.php");
if( !defined( 'PAGE_EDIT_CONTACT' ) ) define("PAGE_EDIT_CONTACT", "/contact_add_edit.php");
if( !defined( 'PAGE_SELECT_CONTACT' ) ) define("PAGE_SELECT_CONTACT", "/contact_add_edit_select.php");
if( !defined( 'PAGE_SHOP_LOG_DELETE_VISIT' ) ) define("PAGE_SHOP_LOG_DELETE_VISIT", "/shop_log_delete_shopvisitid.php");
if( !defined( 'INDIVIDUAL_HOURS_LOG' ) ) define("INDIVIDUAL_HOURS_LOG", "/individual_hours_log.php");
if( !defined( 'INDIVIDUAL_HISTORY_LOG' ) ) define("INDIVIDUAL_HISTORY_LOG", "/individual_history_log.php");
if( !defined( 'PAGE_SALE_LOG' ) ) define("PAGE_SALE_LOG", "/transaction_log.php");
if( !defined( 'PAGE_EDIT_LOCATION' ) ) define("PAGE_EDIT_LOCATION", "/location_add_edit.php");
if( !defined( 'PAGE_SELECT_LOCATION' ) ) define("PAGE_SELECT_LOCATION", "/location_add_edit_select.php");
// Highlight search results in transaction_log
function highlightKeywords($text, $keyword) {
$wordsAry = explode(" ", $keyword);
$wordsCount = count($wordsAry);
// Using REGEXP, this removes regex from search
$find = array('/[\*\.\$\^\?\+\[\]\|\(\)\,\{\}\:\\\]/');
$replace = array('');
for($i=0;$i<$wordsCount;$i++) {
$wordsAry[$i] = preg_replace($find, $replace, $wordsAry[$i]);
$highlighted_text = "<span style='color:black; background:#ffeb3bc7; box-shadow:2px 0 #ffeb3bc7, -2px 0 0 #ffeb3bc7; padding: 0px 0;'>$wordsAry[$i]</span>";
$text = str_ireplace($wordsAry[$i], $highlighted_text, $text);
//$text = str_replace($wordsAry[$i], $highlighted_text, $text);
}
return $text;
}
//This is a general function to generate the contents of a list box based on a MySQL query. All necessary parameters for the query are passed
function generate_list($querySQL,$list_value,$list_text, $form_name, $default_value, $color)
@ -349,7 +388,7 @@ function generate_list($querySQL,$list_value,$list_text, $form_name, $default_va
$default_delimiter = 'selected="selected"';
} else { $default_delimiter = '';}
echo '<option style="color:' . $color . ';" value="' . $row_recordset[$list_value] . '" ' . $default_delimiter . '>' .
$row_recordset[$list_text] . '</option>\n';
$row_recordset[$list_text] . '</option>';
} while ($row_recordset = mysql_fetch_assoc($recordset));
$rows = mysql_num_rows($recordset);
if($rows > 0) {
@ -727,6 +766,13 @@ function dateandtimein($date, $time){
// Drop-Down lists
function list_contacts_select_contact($form_name = "contact_id", $default_value = "")
{
echo "<select name={$form_name} class='yb_standard'>\n";
echo "<option value='everyone'>Everyone</option>\n";
list_contacts("none",$default_value);
echo "</select>\n";
}
function list_contacts_edit_add($form_name = "contact_id", $default_value = "")
{
@ -839,16 +885,26 @@ function max_shop_id(){
}
// Is there currently a shop?
// curl https://ipinfo.io/ip
function current_shop_by_ip(){
global $database_YBDB, $YBDB;
$IP = $_SERVER['REMOTE_ADDR'];
$current_date = current_date();
mysql_select_db($database_YBDB, $YBDB);
if( IP == "default") {
$query_Recordset1 = "SELECT shop_id FROM shops WHERE ip_address = '{$IP}' AND date REGEXP '^{$current_date} ' ORDER BY shop_id DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
} else {
$ip = IP;
$query_Recordset1 = "SELECT shop_id FROM shops WHERE ip_address REGEXP '^{$ip}' AND date REGEXP '^{$current_date} ' ORDER BY shop_id DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
}
return $row_Recordset1['shop_id'];
}

View File

@ -7,7 +7,7 @@ In 2014, Positive Spin of Morgantown, WV in the USA was looking for a way to rep
It was a successful choice, and continues to improve! You can read more about the FLOSS process at [bikecollectives.org in this presentation](https://www.bikecollectives.org/wiki/images/1/1e/2017-SE-BikeBike-Libre-slides.pdf).
There is a demo at [http://ybdb.wvcompletestreets.org](http://ybdb.wvcompletestreets.org). Try it out!
There is a demo at [https://ybdb.bikelover.org](https://ybdb.bikelover.org). Try it out!
Docker Development is at [https://github.com/fspc/ybdb](https://github.com/fspc/ybdb).

View File

@ -17,7 +17,7 @@ include("include_header.html");
?>
<div id="contact_id" style="display:none;"><?php echo $contact_id; ?></div>
<div style="text-align:center;"><div id="name" style="align-content:center; font-size:2em;"></div></div>
<div style="text-align:center;"><div id="name" style="align-content:center; font-size:2em;"></div><div id="membership_status"></div></div>
<div id="individual_history"></div>
<div class="stats-clear nextprev" style="text-align:center; display:block; margin-top:9px;">

View File

@ -36,18 +36,32 @@ $(function(){
$(".stats-left").attr("href","/individual_history_log.php?contact_id=" + prev);
$(".stats-right").attr("href","/individual_history_log.php?contact_id=" + next);
var record_count;
$.post("json/reports.php", { record_count: 1 }, function (data) {
record_count = data;
record_count = $.parseJSON(data);
});
// name
var date;
$.post("json/reports.php", { name: 1, contact_id: contact_id }, function (data) {
if (data) {
var d = new Date();
date = d.toISOString().split('T')[0];
var obj = $.parseJSON(data);
$("#name").text(obj.full_name);
var full_name_with_link = '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;"' +
' href="transaction_log.php?trans_date=' + date +
'&trans_type=all_types&shop_dayname=alldays&record_count=' + record_count.record_count +
'&contact_id_search=' +
contact_id + '">' + obj.full_name + "</a>";
$("#name").html(full_name_with_link);
var pad_name;
if (obj.configurations.prefix) {
pad_name = obj.configurations.prefix + "_pad_contact_id_" + contact_id;
} else {
pad_name = "pad_contact_id_" + contact_id;
}
console.log(pad_name);
//console.log(pad_name);
if ( obj.configurations.host && obj.full_name ) {
$("#individual_history_pad").pad({
"padId": pad_name,
@ -114,6 +128,59 @@ $(function(){
}); // tabulator
// Is contact a member
var contacts = "contact_id=" + contact_id;
$.post("json/transaction.php", { membership_benefits: 1, contact_id: contacts }, function (data) {
var membership, membership_obj, membership_objs = $.parseJSON(data);
/*
Weird hack, before improving performance #46, there was always a property for membership_obj,
membership_discount:10, which just allowed the code to work, now it is empty when a patron
actually is not a paid member, so this creates that obj & property if that is the case.
*/
membership_obj = membership_objs[0] || { membership_discount: 10 };
var title = membership_obj.normal_full_name + "\r\n" +
membership_obj.email + "\r\n" +
membership_obj.phone + "\r\n" +
"expiration: " + membership_obj.expiration_date;
var expiration_date;
var d = new Date();
if (membership_obj.expiration_date) {
var exp = membership_obj.expiration_date;
expiration_date = new Date(exp.split("-").toString());
if (d < expiration_date) {
membership = true;
}
}
if (typeof membership_obj.expiration_date && membership_obj.expiration_date !== undefined) {
if (d >= expiration_date) {
var membership = '<a href="transaction_log.php?trans_date=' + date +
'&trans_type=all_types&shop_dayname=alldays&record_count=' + record_count.record_count +
'&contact_id_search=' +
contact_id + '">' + "Expired Membership</a>";
$("#membership_status").prop("title",title).html(membership).children().
css({color: "rgb(27, 105, 30)", textAlign: "center", cursor: "help", textDecoration: "none"});
} else if (d < expiration_date) {
var membership = '<a href="transaction_log.php?trans_date=' + date +
'&trans_type=all_types&shop_dayname=alldays&record_count=' + record_count.record_count +
'&contact_id_search=' +
contact_id + '">' + "Paid Membership</a>";
$("#membership_status").prop("title",title).html(membership).children().
css({color: "rgb(27, 105, 30)", textAlign: "center", cursor: "help", textDecoration: "none"});
}
}
}); // Is contact a member
} // if contact_id
// stats_userhours

View File

@ -33,6 +33,23 @@ $(function(){
$(banned_list).css({backgroundColor: "red"}).prop("title", "BANNED");
// return probation list
var probation_list, pl;
$.post("json/contact.php", {probation: 1}, function (data) {
if (data) {
pl = $.parseJSON(data);
$(pl).each(function(i,v) {
if (i === 0) {
probation_list = "#" + v;
} else {
probation_list = probation_list + ",#" + v;
}
});
}
});
$(probation_list).css({backgroundColor: "#eed202"}).prop("title", "PROBATION");
// error handler for shops with a popup dialog (TODO)
function error_handler(input,error_span,error,error_text,event) {
var trans_error = 0;
@ -87,7 +104,6 @@ $(function(){
} );
// could have done this in php, but this separates out the view logic
var membership_ids, volunteer_ids;
var last_index = $("#shop_log tr[id]").length;

View File

@ -68,4 +68,120 @@ $(function(){
e.preventDefault();
});
var volunteer_ids;
var last_index = $("tr[id]").length;
if (last_index) {
last_index = last_index - 1;
$.each($("tr[id]"), function(index) {
if (this.id) {
var id = this.id;
if (last_index < 1) {
volunteer_ids = "contacts.contact_id=" + id;
}
else if (!volunteer_ids) {
volunteer_ids = "(contacts.contact_id=" + id + " OR ";
} else if ( index === last_index) {
volunteer_ids += "contacts.contact_id=" + id + ")";
} else {
volunteer_ids += "contacts.contact_id=" + id + " OR ";
}
}
});
}
var d = new Date();
volunteer_status(volunteer_ids);
// volunteer status
// Essentially, the same function (but with modifications) as in shop.js and transaction.js
function volunteer_status(contacts) {
var all_members_obj; //reuse this object
var year = d.getFullYear();
if (contacts) {
$.post("../json/transaction.php", { volunteer_benefits: 1, contact_id: contacts }, function (data) {
all_members_obj = $.parseJSON(data);
$.each(all_members_obj, function() {
var bikes_earned = 0;
var volunteer_hours_redeemed = 0;
var obj = this;
var volunteer = "", remaining = 0, vhr = "", max_bikes_earned = 0;
if (obj.volunteer) {
volunteer = $.parseJSON(obj.volunteer);
if (volunteer.hasOwnProperty(year)) {
remaining = obj.current_year_volunteer_hours - volunteer[year].volunteer_hours_redeemed;
vhr = volunteer[year].volunteer_hours_redeemed;
max_bikes_earned = volunteer[year].max_bike_earned;
}
} else {
vhr = 0;
}
var title = obj.normal_full_name + "\r\n" +
"Volunteer Hours for last 365 days: " + obj.volunteer_hours + "\r\n" +
"Volunteer Hours \(" + year + "\): " + obj.current_year_volunteer_hours + "\r\n" +
"Volunteer Hours Redeemed: " + vhr + "\r\n" +
"Volunteer Hours Remaining: " + remaining + "\r\n" +
"Max Bikes Earned: " + max_bikes_earned;
var volunteer_with_redeemed_hours_at_zero = obj.current_year_volunteer_hours - vhr;
if (obj.contact_id) {
if (obj.volunteer_hours && obj.volunteer_hours !== '0') {
if (volunteer_with_redeemed_hours_at_zero !== 0) {
$("#" + obj.contact_id + " td").first().
css({textAlign: "center", cursor: "cell"}).
prop("title",title).css({textAlign: "center"});
} else {
$("#" + obj.contact_id + " td").first().
css({backgroundColor: "rgb(216, 198, 39)", textAlign: "center", cursor: "cell"}).
prop("title",title).css({textAlign: "center"});
}
} else {
title = obj.normal_full_name + "\r\n" +
"Volunteer Hours for last 365 days: None" + "\r\n";
$("#" + obj.contact_id + " td").first().
css({backgroundColor: "rgb(190, 199, 204)", textAlign: "center", cursor: "cell"}).
prop("title",title).css({textAlign: "center"});
}
} else {
var name = $("#" + id + " td a[href*='individual']").text();
var name_obj = name.trim().split(", ");
name = name_obj[1] + " " + name_obj[0];
title = name + "\r\n" +
"Volunteer Hours for last 365 days: None" + "\r\n";
$("#" + obj.contact_id + " td").first().
css({backgroundColor: "rgb(190, 199, 204)", textAlign: "center", cursor: "cell"}).
prop("title",title).css({textAlign: "center"});
}
}); // each all_members_obj
}); // post volunteer benefits
} // if this is a volunteer
} // function volunteer_status
});

View File

@ -10,9 +10,10 @@ $(function() {
// but all ajax needs to be synchronous in this program because of the use of an "ancient" mysql
$("[name='transaction_type']").attr("tabindex",1);
$("[name='transaction_type']").focus();
$("[name='transaction_type']").focus().scrollTop();
$("input[value='Create Transaction']").attr("tabindex",2);
$("#trans_date").mask("0000-00-00", {placeholder: "yyyy-mm-dd" });
$("[name='contact_id']").attr("tabindex",3);
// Add focus for easier tab browsing
// use .paid parent and hover & classes
@ -88,38 +89,6 @@ $(function() {
}
} );
// Provide membership and volunteer information for patrons
/*
$("[href^='individual_history_log.php']").each( function() { console.log(this.href.split("=")[1]); }); // check for duplicates
var membership_ids, volunteer_ids;
var last_index = $("[href^='individual_history_log.php']").length;
if (last_index) {
last_index = last_index - 1;
$.each($("[href^='individual_history_log.php']"), function(index) {
if (this.id) {
var id = this.id;
if (last_index <= 1) {
membership_ids = "contact_id=" + id;
}
else if (!membership_ids) {
membership_ids = "(contact_id=" + id + " OR ";
} else if ( index === last_index) {
membership_ids += "contact_id=" + id + ")";
} else {
membership_ids += "contact_id=" + id + " OR ";
}
}
});
if (membership_ids) {
volunteer_ids = membership_ids.replace(/contact_id/g,"contacts.contact_id");
}
}
*/
// paid or not?
$(":checked").parent("td").prev().children().not("#payment_type_label").hide(); // need to watch that not introduction bugs
$(".paid").click(function() {
@ -185,6 +154,164 @@ $(function() {
});
// contact search on main page
$("select[name='contact_id_search']").chosen();
// Volunteer Information on mouseover of contact
var volunteer_ids;
var last_index = $("td a[href*='individual_history']").length;
if (last_index) {
last_index = last_index - 1;
$.each($("td a[href*='individual_history']"), function(index) {
if (this.href.match(/\d*$/)) {
var id = this.href.match(/\d+$/);
if (last_index < 1) {
volunteer_ids = "contacts.contact_id=" + id;
}
else if (!volunteer_ids) {
volunteer_ids = "(contacts.contact_id=" + id + " OR ";
} else if ( index === last_index) {
volunteer_ids += "contacts.contact_id=" + id + ")";
} else {
volunteer_ids += "contacts.contact_id=" + id + " OR ";
}
}
});
}
// For performance
if (last_index <= 200) {
volunteer_status(volunteer_ids);
}
// volunteer status
function volunteer_status(contacts) {
var d = new Date();
var all_members_obj; //reuse this object
var year = d.getFullYear();
if (contacts) {
$.post("json/transaction.php", { volunteer_benefits: 1, contact_id: contacts }, function (data) {
all_members_obj = $.parseJSON(data);
$.each(all_members_obj, function() {
var bikes_earned = 0;
var volunteer_hours_redeemed = 0;
var obj = this;
var volunteer = "", remaining = 0, vhr = "", max_bikes_earned = 0;
if (obj.volunteer) {
volunteer = $.parseJSON(obj.volunteer);
if (volunteer.hasOwnProperty(year)) {
remaining = obj.current_year_volunteer_hours - volunteer[year].volunteer_hours_redeemed;
vhr = volunteer[year].volunteer_hours_redeemed;
max_bikes_earned = volunteer[year].max_bike_earned;
}
} else {
vhr = 0;
}
var title = obj.normal_full_name + "\r\n" +
"Volunteer Hours for last 365 days: " + obj.volunteer_hours + "\r\n" +
"Volunteer Hours \(" + year + "\): " + obj.current_year_volunteer_hours + "\r\n" +
"Volunteer Hours Redeemed: " + vhr + "\r\n" +
"Volunteer Hours Remaining: " + remaining + "\r\n" +
"Max Bikes Earned: " + max_bikes_earned;
var volunteer_with_redeemed_hours_at_zero = obj.current_year_volunteer_hours - vhr;
if (obj.contact_id) {
//#d8c62757
if (obj.volunteer_hours && obj.volunteer_hours !== '0') {
if (volunteer_with_redeemed_hours_at_zero !== 0) {
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").
parent().css({backgroundColor: "#19a0cc2b", cursor: "cell"}).
prop("title",title);
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").css({color: "#1b691e", textDecoration: "none", cursor: "crosshair"});
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").hover( function(e){ $(this).css("color",e.type === "mouseenter"?"blue":"#1b691e");});
} else {
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").
parent().css({backgroundColor: "#d8c62757", cursor: "cell"}).
prop("title",title);
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").css({color: "#1b691e", textDecoration: "none", cursor: "crosshair"});
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").hover( function(e){ $(this).css("color",e.type === "mouseenter"?"blue":"#1b691e");});
}
} else {
title = obj.normal_full_name + "\r\n" +
"Volunteer Hours for last 365 days: None" + "\r\n";
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").
parent().css({backgroundColor: "#bec7cc91", textAlign: "center", cursor: "cell"}).
prop("title",title);
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").css({color: "#1b691e", textDecoration: "none", cursor: "crosshair"});
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").hover( function(e){ $(this).css("color",e.type === "mouseenter"?"blue":"#1b691e");});
}
} else {
var name = $("#" + id + " td a[href*='individual']").text();
var name_obj = name.trim().split(", ");
name = name_obj[1] + " " + name_obj[0];
title = name + "\r\n" +
"Volunteer Hours for last 365 days: None" + "\r\n";
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").
parent().css({backgroundColor: "rgb(190, 199, 204)", textAlign: "center", cursor: "cell"}).
prop("title",title);
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").css({color: "#1b691e", textDecoration: "none", cursor: "crosshair"});
$("td a[href='individual_history_log.php?contact_id=" + obj.contact_id + "']").hover( function(e){ $(this).css("color",e.type === "mouseenter"?"blue":"#1b691e");});
}
}); // each all_members_obj
}); // post volunteer benefits
} // if this is a volunteer
// not a current volunteer within the last 365 days, or never has been a volunteer
$("td a[href*='individual_history']").parent(":not([title])").children().each( function() {
var name = $(this).text();
var name_obj = name.trim().split(", ");
name = name_obj[1] + " " + name_obj[0];
var id = this.href.split("=")[1];
var title = name + "\r\n" +
"Volunteer Hours for last 365 days: None" + "\r\n";
if (id) {
$("td a[href='individual_history_log.php?contact_id=" + id + "']").
parent().css({cursor: "cell"}).
prop("title",title);
$("td a[href='individual_history_log.php?contact_id=" + id + "']").css({color: "#1b691e", textDecoration: "none", cursor: "crosshair"});
$("td a[href='individual_history_log.php?contact_id=" + id + "']").hover( function(e){ $(this).css("color",e.type === "mouseenter"?"blue":"#1b691e");});
}
}); // .each not a current volunteer
} // end function volunteer_status
// transaction slider - on reload
transaction_slider();
@ -277,6 +404,12 @@ $(function() {
// watch that percentage doesn't acquire too many decimal points.
//console.dir(range_obj);
// If no min is found this makes it the same as max
// only a problem for non transaction_log pages using transaction.js if there is only one deposit for the last year
// not sure what will happen with 0 deposits for the last year
if ( !range_obj["min"] ) {
range_obj["min"] = range_obj["max"];
}
//initialize slider
if (!slider) {
@ -769,8 +902,6 @@ $(function() {
} // end function redeemable
// editing a transaction
if ( $("input[name='shop_id']").length ) {
@ -910,6 +1041,7 @@ $(function() {
sold_to.change(function() {
//sold_to.hide();
amount.prop("disabled","");
var membership_obj; //reuse this object
@ -1396,11 +1528,22 @@ $(function() {
vhr = parseFloat($("#redeemable_hours").val());
}
// Don't require paid to be selected, only amount >= 0
//
// Here is where equitable behaviour for earned bikes could be turned off/on
// However, it actually was a feature induced bug or undesired depending how you look at it,
// see #78 and #80,
// because vhr always became 0 when amount was added if spinner was not used if the
// patron had become volunteer, which at the time made sense, but there
// are exceptions to the rule, and it actually was not fair, but penalized those
// who chose to volunteer and purchase a bike (usually for someone else) without redeeming hours
// and then later redeemed their hours for a bike for themselves, only to find out they had already hit their
// max eab.
var max_bike_earned = 0, maximum_allowable_earned_bikes;
if ($("#transaction_type").val() === "Bicycles") {
// hours were redeemed and this is a Bicycle transaction
if (vhr !== "0.00") {
if (vhr !== "0.00" && vhr !== 0) {
max_bike_earned = 1;
}
}
@ -1441,8 +1584,15 @@ $(function() {
} else {
if ($("#redeemable_hours").val().length) {
volunteer_benefits_history[year].volunteer_hours_redeemed = parseFloat(volunteer_benefits_history[year].volunteer_hours_redeemed) +
parseFloat($("#redeemable_hours").val());
// NaN bug #75
if (volunteer_benefits_history[year].volunteer_hours_redeemed === "NaN") {
vhr = 0;
} else {
vhr = parseFloat(volunteer_benefits_history[year].volunteer_hours_redeemed);
}
volunteer_benefits_history[year].volunteer_hours_redeemed = vhr + parseFloat($("#redeemable_hours").val());
if (parseFloat(volunteer_benefits_history[year].max_bike_earned) < maximum_allowable_earned_bikes) {
volunteer_benefits_history[year].max_bike_earned = parseFloat(volunteer_benefits_history[year].max_bike_earned) +
@ -1515,11 +1665,14 @@ $(function() {
}
}
// Assuming local time is correct and synchronized with mysql time d.toLocaleDateString().replace(/\//g,'-')
var current_date_time = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate() + " " + d.toLocaleTimeString().split(' ')[0];
var current_transaction =
{
transaction_id: transaction_id,
date_startstorage: $("#date_startstorage").val(),
date: date,
date: current_date_time,
transaction_type: $("#transaction_type").val(),
original_price: original_price,
amount: price,

View File

@ -57,6 +57,15 @@ $ssl_certificate = SSL_CERTIFICATE;
}
// pass probation contact_id values if they exist
if (isset($_POST['probation'])) {
if ($probation_individuals) {
echo json_encode($probation_individuals);
}
}
// update email_list
if( isset($_POST['email_list']) ) {

View File

@ -130,4 +130,14 @@ $handler->start();
} // return everyone
// Latest transaction_id
if (isset($_POST['record_count'])) {
$query = 'SELECT MAX(transaction_id) AS record_count FROM transaction_log;';
$sql = mysql_query($query, $YBDB) or die(mysql_error());
$result = mysql_fetch_assoc($sql);
echo json_encode($result);
}
?>

View File

@ -14,7 +14,6 @@ $change_fund = CHANGE_FUND;
$csv_directory = CSV_DIRECTORY;
$stand_time_hourly_rate = STAND_TIME_HOURLY_RATE;
$stand_time_grace_period = STAND_TIME_GRACE_PERIOD;
$stand_time_value = STAND_TIME_VALUE;
$free_stand_time_period = FREE_STAND_TIME_PERIOD;
$timezone = TIMEZONE;
$sweat_equity_limit = SWEAT_EQUITY_LIMIT;
@ -61,6 +60,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
}
// If payment_type check is selected - return check number if exists
if (isset($_POST['check_number'])) {
@ -160,7 +160,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
$result["volunteer_discount"] = $volunteer_discount;
$result["special_volunteer_hours_qualification"] = $special_volunteer_hours_qualification;
$result["special_volunteer_discount"] = $special_volunteer_discount;
$result["stand_time_value"] = $stand_time_value;
$result["stand_time_value"] = $stand_time_hourly_rate;
$result["redeem_one_to_one"] = $redeem_one_to_one;
$volunteers[] = $result;
}
@ -464,7 +464,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
}
// second statement to find normal transactions
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, check_number, description, amount, " .
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, check_number, description, amount, history, " .
"CONCAT(contacts.first_name, ' ', contacts.last_name) AS 'patron' " .
"FROM transaction_log, contacts WHERE paid=1 AND date!='NULL' " .
"AND (payment_type='cash' OR payment_type='check') " .
@ -473,7 +473,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
$sql2 = mysql_query($query, $YBDB) or die(mysql_error());
// third statement to find anonymous transactions
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, check_number, description, amount " .
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, check_number, description, amount, history " .
"FROM transaction_log WHERE paid=1 AND date!='NULL' " .
"AND (payment_type='cash' OR payment_type='check') " .
"AND anonymous=1 " .
@ -484,6 +484,11 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
// normal transaction
while ( $result = mysql_fetch_assoc($sql2) ) {
$history = json_decode($result['history']);
end($history);
$key = key($history);
$description = preg_replace('/\n/', ' \r ', $result['description']);
$description = preg_replace('/\r/', '\r', $description);
$description = preg_replace('/,/', ';', $description);
@ -493,12 +498,19 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . ' ' . $check_number .
',' . ' [' . $coordinator[$result['transaction_id']] . ' => ' . $result['patron'] . '] ' .
$description . ' (Income:' . $result['transaction_type'] . ') ' .
' [O:' . $history[$key]->original_price . '; P:' . $history[$key]->amount .
'; R:' . $history[$key]->redeemed_hours . ']' .
', ' . $result['amount'] . ', ' .
$accounts_gnucash['checking'] . "\n";
}
// anonymous transaction
while ( $result = mysql_fetch_assoc($sql3) ) {
$history = json_decode($result['history']);
end($history);
$key = key($history);
$description = preg_replace('/\n/', ' \r ', $result['description']);
$description = preg_replace('/\r/', '\r', $description);
$description = preg_replace('/,/', ';', $description);
@ -508,6 +520,8 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . ' ' . $check_number .
',' . ' [' . $coordinator[$result['transaction_id']] . ' => Anonymous] ' .
$description . ' (Income:' . $result['transaction_type'] . ') ' .
' [O:' . $history[$key]->original_price . '; P:' . $history[$key]->amount .
'; R:' . $history[$key]->redeemed_hours . ']' .
', ' . $result['amount'] . ', ' .
$accounts_gnucash['checking'] . "\n";
}
@ -539,7 +553,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
}
// second statement to find normal transactions
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, description, amount, " .
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, description, amount, history, " .
"CONCAT(contacts.first_name, ' ', contacts.last_name) AS 'patron' " .
"FROM transaction_log, contacts WHERE paid=1 AND date!='NULL' " .
"AND payment_type='credit' " .
@ -548,7 +562,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
$sql2 = mysql_query($query, $YBDB) or die(mysql_error());
// third statement to find anonymous transactions
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, description, amount " .
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, description, amount, history " .
"FROM transaction_log WHERE paid=1 AND date!='NULL' " .
"AND payment_type='credit' " .
"AND anonymous=1 " .
@ -559,24 +573,38 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
// normal transaction
while ( $result = mysql_fetch_assoc($sql2) ) {
$history = json_decode($result['history']);
end($history);
$key = key($history);
$description = preg_replace('/\n/', ' \r ', $result['description']);
$description = preg_replace('/\r/', '\r', $description);
$description = preg_replace('/,/', ';', $description);
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] .
',' . ' [' . $coordinator[$result['transaction_id']] . ' => ' . $result['patron'] . '] ' .
$description . ' (Income:' . $result['transaction_type'] . ') ' .
' [O:' . $history[$key]->original_price . '; P:' . $history[$key]->amount .
'; R:' . $history[$key]->redeemed_hours . ']' .
', ' . $result['amount'] . ', ' .
$accounts_gnucash['credit'] . "\n";
}
// anonymous transaction
while ( $result = mysql_fetch_assoc($sql3) ) {
$history = json_decode($result['history']);
end($history);
$key = key($history);
$description = preg_replace('/\n/', ' \r ', $result['description']);
$description = preg_replace('/\r/', '\r', $description);
$description = preg_replace('/,/', ';', $description);
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] .
',' . ' [' . $coordinator[$result['transaction_id']] . ' => Anonymous] ' .
$description . ' (Income:' . $result['transaction_type'] . ') ' .
' [O:' . $history[$key]->original_price . '; P:' . $history[$key]->amount .
'; R:' . $history[$key]->redeemed_hours . ']' .
', ' . $result['amount'] . ', ' .
$accounts_gnucash['credit'] . "\n";
}
@ -680,12 +708,12 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
$query = "SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
CONCAT(first_name, ' ', last_name) AS normal_full_name, contacts.email AS email, contacts.phone AS phone,
transaction_log.date AS membership_start, SUBSTRING_INDEX(DATE_ADD(date, INTERVAL 365 DAY), ' ', 1) AS expiration_date
MAX(transaction_log.date) AS membership_start, MAX(SUBSTRING_INDEX(DATE_ADD(date, INTERVAL 365 DAY), ' ', 1)) AS expiration_date
FROM transaction_log LEFT JOIN contacts ON transaction_log.sold_to = contacts.contact_id
WHERE SUBSTRING_INDEX(date, ' ', 1) <= DATE_ADD(date, INTERVAL 365 DAY)
AND (transaction_type='Memberships' AND paid=1) AND " .
$contact_id .
" ORDER by membership_start DESC;";
" GROUP BY contact_id ORDER by membership_start DESC;";
$sql = mysql_query($query, $YBDB) or die(mysql_error());

View File

@ -198,7 +198,7 @@ INSERT INTO transaction_types
("Used Parts", 3, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0, 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, 0),
("Helmets", 5, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0, 0),
("Donations", 6, 1, 0, 1, 1, 0, 0, 1, 1, 1, "Donation Date", "Received by"," ", "Donated by", 1, "Description", "Donations", 0, 1, 0),
("Donations", 6, 1, 0, 1, 1, 0, 0, 1, 1, 1, "Donation Date", "Received by"," ", "Donated by", 0, "Description", "Donations", 0, 1, 1),
("Monetary Donations", 7, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Donation Date", "Received by"," ", "Donated by", 1, "Description", "Sales", 1, 1, 0),
("Memberships", 8, 1, 0, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0, 0),
("New Parts", 9, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0, 0),

View File

@ -54,7 +54,7 @@ $editFormAction_no_shopid = $_SERVER['PHP_SELF'] . "?shop_date=$shop_date";
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT shops.shop_id, date, DAYNAME(date) as day ,shop_location, shop_type, ip_address,
IF(SUBSTRING(date,1,10) = curdate(),1,0) AS CanEdit,
COUNT(shop_visit_id) AS num_visitors,
COUNT(DISTINCT contact_id) AS num_visitors,
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS total_hours
FROM shops LEFT JOIN shop_hours ON shops.shop_id = shop_hours.shop_id
WHERE date <= '{$shop_date}' {$shop_dayname} GROUP BY shop_id

View File

@ -41,30 +41,16 @@ if (isset($_POST['range1'])) {
$today = $range2;
}
/*
SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
COUNT(shop_hours.contact_id) as cs_volunteer_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS cs_volunteer_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
WHERE (time_in > DATE_SUB(CURDATE(),INTERVAL $days_range1 DAY) AND time_in <= DATE_SUB(CURDATE(), INTERVAL $days_range2 DAY))
AND shop_user_roles.other_volunteer = 1
GROUP BY contact_id
ORDER BY sort_hours DESC;
*/
$query = "SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
COUNT(shop_hours.contact_id) as cs_volunteer_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS cs_volunteer_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS cs_volunteer_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
WHERE (SUBSTRING_INDEX(time_in, ' ', 1) >= DATE_SUB(CURDATE(),INTERVAL $days_range1 DAY) AND SUBSTRING_INDEX(time_in, ' ', 1) <= DATE_SUB(CURDATE(), INTERVAL $days_range2 DAY))
AND shop_user_roles.other_volunteer = 1
AND shop_hours.shop_user_role = 'Student Volunteer/Community Service Hours'
GROUP BY contact_id
ORDER BY cs_volunteer_hours DESC;";
$cs_volunteers_sql = mysql_query($query, $YBDB) or die(mysql_error());

View File

@ -39,43 +39,13 @@ if (isset($_POST['range1'])) {
$today = $range2;
}
/*
SELECT contact_id, full_name, email, phone, sort_visits, sort_hours FROM
(SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
contacts.email AS email, contacts.phone AS phone,
COUNT(shop_hours.contact_id) as sort_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS sort_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
WHERE (time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH))
AND shop_user_roles.volunteer = 1 GROUP BY contact_id) AS members
WHERE sort_hours >= 8 AND sort_visits >= 2
GROUP by contact_id ORDER by sort_hours DESC, sort_visits DESC;
SELECT contacts.contact_id,
CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
CONCAT(first_name, ' ', last_name) AS normal_full_name,
contacts.email AS email, contacts.phone AS phone,
transaction_log.date as sort_hours
FROM transaction_log
LEFT JOIN contacts ON transaction_log.sold_to = contacts.contact_id
WHERE (SUBSTRING_INDEX(date, ' ', 1) >= DATE_SUB(CURDATE(),INTERVAL 365 DAY)
AND SUBSTRING_INDEX(date, ' ', 1) <= DATE_SUB(CURDATE(), INTERVAL 0 DAY))
AND (transaction_type="Memberships" AND paid=1);
*/
// Membership via volunteering
$query = "SELECT contact_id, full_name, normal_full_name, email, phone, sort_visits, sort_hours FROM
(SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
CONCAT(first_name, ' ', last_name) AS normal_full_name,
contacts.email AS email, contacts.phone AS phone,
COUNT(shop_hours.contact_id) as sort_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS sort_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS sort_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -127,11 +97,11 @@ while ($result = mysql_fetch_assoc($purchased_membership)) {
while ($result = mysql_fetch_assoc($members)) {
//do {
?>
<tr>
<tr id="<?php echo $result['contact_id']; ?>">
<?php if( isset($purchased_membership_dictionary[$result['contact_id']]) ) { ?>
<td class="yb_standardRIGHTred"><a href="<?php echo "{$page_individual_history_log}?contact_id=" . $result['contact_id']; ?>"><?php echo $result['full_name']; ?></a><br \>(paid until <?php echo $purchased_membership_dictionary[$result['contact_id']]['expiration_date']; ?>)</td>
<td class="yb_standardRIGHTred"><a style="text-decoration:none" href="<?php echo "{$page_individual_history_log}?contact_id=" . $result['contact_id']; ?>"><?php echo $result['full_name']; ?></a><br \>(paid until <?php echo $purchased_membership_dictionary[$result['contact_id']]['expiration_date']; ?>)</td>
<?php } else { ?>
<td class="yb_standardRIGHTred"><a href="<?php echo "{$page_individual_history_log}?contact_id=" . $result['contact_id']; ?>"><?php echo $result['full_name']; ?></a></td>
<td class="yb_standardRIGHTred"><a style="text-decoration:none" href="<?php echo "{$page_individual_history_log}?contact_id=" . $result['contact_id']; ?>"><?php echo $result['full_name']; ?></a></td>
<?php } ?>
<td class="yb_standardRIGHT"><?php echo number_format($result['sort_visits'],0); ?></td>
<td class="yb_standardRIGHT"><?php echo number_format($result['sort_hours'],0); ?></td>

View File

@ -7,41 +7,13 @@ $page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
mysql_select_db($database_YBDB, $YBDB);
$today = date("Y/m/d");
$year_ago = date("Y/m/d", strtotime("$today -1 year"));
$today_date = new DateTime('now');
$past = new DateTime($year_ago);
$interval = $today_date->diff($past);
$chosen_date = $today;
$days_range1 = $interval->days;
$days_range2 = 0;
// Do some ajax stuff
if (isset($_POST['range1'])) {
$range1 = $_POST['range1'];
$range2 = $_POST['range2'];
$choice1 = new DateTime($range1);
$interval = $today_date->diff($choice1);
$days_range1 = $interval->days;
$choice2 = new DateTime($range2);
$interval = $today_date->diff($choice2);
$days_range2 = $interval->days;
$year_ago = $range1;
$today = $range2;
}
// Membership via volunteering
$query = "SELECT contact_id, full_name, normal_full_name, email, phone, sort_visits, sort_hours FROM
(SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
CONCAT(first_name, ' ', last_name) AS normal_full_name,
contacts.email AS email, contacts.phone AS phone,
COUNT(shop_hours.contact_id) as sort_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS sort_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS sort_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -93,7 +65,14 @@ $num_member_rows = mysql_num_rows($purchased_membership);
?>
<tr>
<td class="yb_standardRIGHTred"><a href="<?php echo "{$page_individual_history_log}?contact_id=" . $result['contact_id']; ?>"><?php echo $result['full_name']; ?></a></td>
<td class="yb_standardRIGHTred"><?php echo $result['expiration_date']; ?></td>
<td class="yb_standardRIGHTred"><?php
if( strtotime($result['expiration_date']) <= time() ) {
echo $result['expiration_date'];
} else {
echo "<span style='color:blue;'>" . $result['expiration_date'] . "</span>";
}
?></td>
<td class="yb_standardRIGHT"><?php echo number_format($purchased_membership_dictionary[$result['contact_id']]['sort_visits'],0); ?></td>
<td class="yb_standardRIGHT"><?php echo number_format($purchased_membership_dictionary[$result['contact_id']]['sort_hours'],0); ?></td>
</tr>

View File

@ -33,7 +33,6 @@ if (isset($_POST['range1'])) {
$today = $range2;
}
$query = "SELECT COUNT(shop_id) as total_shops from shops
WHERE (date >= DATE_SUB(CURDATE(),INTERVAL $days_range1 DAY) AND date <= DATE_SUB(CURDATE(), INTERVAL $days_range2 DAY));";
$shop_totals_sql = mysql_query($query, $YBDB) or die(mysql_error());

View File

@ -20,7 +20,7 @@ mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT year(t.date) as Year,quarter(t.date) as Quarter, month(t.date) as Month, round(sum(amount),2) as TotalSales, tt.accounting_group as AccountingGroup
FROM transaction_log t
LEFT JOIN transaction_types tt ON t.transaction_type = tt.transaction_type_id
WHERE tt.accounting_group = '$accounting_group'
WHERE tt.accounting_group = '$accounting_group' AND t.paid=1
GROUP BY year(t.date), month(t.date)
ORDER BY year(t.date) DESC, month(t.date) DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
@ -37,13 +37,13 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<table id="monthlysalestax" border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="60" height="35">Year</td>
<td width="60">Month</td>
<td width="100">Total Sales</td>
<td width="110">Accounting Group</td>
<th width="120" height="35">Year</th>
<th width="60">Month</th>
<th width="100">Total Sales</th>
<th width="110">Accounting Group</th>
</tr>
<form method="post" name="FormUpdate_<?php echo $row_Recordset1['shop_id']; ?>" action="<?php echo $editFormAction; ?>">
<?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) { //do {
@ -62,9 +62,11 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
<?php } else { // end if EDIT RECORD ?>
<tr>
<td><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Month']; ?></td>
<td>
<?php echo '<a href="/transaction_log.php?month_search=' . $row_Recordset1['Year'] . '-' . $row_Recordset1['Month'] . '-01">' . $row_Recordset1['Month'] . '</a>'; ?>
</td>
<td class="yb_standardRIGHT"><?php currency_format($row_Recordset1['TotalSales'],2);?></td>
<td>&nbsp;<?php echo $row_Recordset1['AccountingGroup']; ?></td>
<td><?php echo $row_Recordset1['AccountingGroup']; ?></td>
</tr>
<?php
} // end if EDIT RECORD

View File

@ -20,7 +20,7 @@ $query_Recordset1 = "SELECT *
FROM (SELECT IF(Week(time_in) DIV 2 <>0,Year(time_in),Year(time_in)-1) as Year,
IF(Week(time_in) DIV 2 <>0,Week(time_in) DIV 2,26 ) as PayPeriod, contacts.contact_id as ContactID, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS Name,
COUNT(shop_hours.contact_id) as Shifts,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60),1) AS Hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS Hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

View File

@ -20,7 +20,7 @@ $query_Recordset1 = "SELECT *
FROM (SELECT IF(Week(time_in) DIV 2 <>0,Year(time_in),Year(time_in)-1) as Year,
IF(Week(time_in) DIV 2 <>0,Week(time_in) DIV 2,26 ) as PayPeriod, contacts.contact_id as ContactID, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS Name,
COUNT(shop_hours.contact_id) as Shifts,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60),1) AS Hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS Hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

View File

@ -21,7 +21,7 @@ shops.shop_type as ShopType, ROUND(sum(t.amount),2) as Total, count(t.transactio
FROM transaction_log t
LEFT JOIN shops ON t.shop_id=shops.shop_id
LEFT JOIN transaction_types AS ttype ON t.transaction_type = ttype.transaction_type_id
WHERE ttype.accounting_group = 'Sales' OR ttype.transaction_type_id = 'Incoming Donation - Cash'
WHERE (ttype.accounting_group = 'Sales' AND t.paid=1) OR ttype.transaction_type_id = 'Incoming Donation - Cash'
GROUP BY t.shop_id, date_format(t.date,'%m/%d/%Y')
ORDER BY t.date DESC, t.shop_id DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
@ -65,7 +65,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
<?php } else { // end if EDIT RECORD ?>
<tr>
<td><?php echo $row_Recordset1['ShopDate']; ?></td>
<td><?php echo $row_Recordset1['ShopID']; ?></td>
<td><?php echo '<a href="/transaction_log.php?shop_id_search=' . $row_Recordset1['ShopID'] . '">' . $row_Recordset1['ShopID'] . '</a>'; ?></td>
<td valign="middle"><?php echo $row_Recordset1['Day']; ?></td>
<td valign="middle"><?php echo $row_Recordset1['ShopType']; ?></td>
<td class="yb_standardRIGHT"><?php currency_format($row_Recordset1['Total'],2);?></td>

View File

@ -18,7 +18,7 @@ default:
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
COUNT(shop_hours.contact_id) as th_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS th_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS th_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -26,7 +26,7 @@ GROUP BY contact_id
ORDER BY last_name, first_name) AS total_hours
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as vh_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS vh_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -35,7 +35,7 @@ GROUP BY contacts.contact_id
ORDER BY last_name, first_name) AS volunteer_hours ON total_hours.contact_id = volunteer_hours.vh_contact_id
LEFT JOIN (SELECT contacts.contact_id AS th3_contact_id,
COUNT(shop_hours.contact_id) as th3_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS th3_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS th3_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -44,7 +44,7 @@ GROUP BY contacts.contact_id
ORDER BY last_name, first_name) AS total_hours3 ON total_hours.contact_id = total_hours3.th3_contact_id
LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id,
COUNT(shop_hours.contact_id) as vh3_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh3_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS vh3_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

View File

@ -18,7 +18,7 @@ default:
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
COUNT(shop_hours.contact_id) as sort_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS sort_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS sort_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -27,7 +27,7 @@ GROUP BY contact_id
ORDER BY sort_hours DESC) AS sort_hours
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as th_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS th_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS th_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -35,7 +35,7 @@ GROUP BY contacts.contact_id
ORDER BY last_name, first_name) AS total_hours ON sort_hours.contact_id = total_hours.vh_contact_id
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as vh_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS vh_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -44,7 +44,7 @@ GROUP BY contacts.contact_id
ORDER BY last_name, first_name) AS volunteer_hours ON sort_hours.contact_id = volunteer_hours.vh_contact_id
LEFT JOIN (SELECT contacts.contact_id AS th3_contact_id,
COUNT(shop_hours.contact_id) as th3_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS th3_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS th3_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -53,7 +53,7 @@ GROUP BY contacts.contact_id
ORDER BY last_name, first_name) AS total_hours3 ON sort_hours.contact_id = total_hours3.th3_contact_id
LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id,
COUNT(shop_hours.contact_id) as vh3_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh3_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS vh3_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

View File

@ -20,7 +20,7 @@ $query_Recordset1 = "SELECT * FROM
(SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
COUNT(shop_hours.contact_id) as sort_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS sort_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS sort_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -30,7 +30,7 @@ ORDER BY sort_hours DESC) AS sort_hours
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as th_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS th_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS th_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -39,7 +39,7 @@ ORDER BY last_name, first_name) AS total_hours ON sort_hours.contact_id = total_
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as vh_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS vh_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -49,7 +49,7 @@ ORDER BY last_name, first_name) AS volunteer_hours ON sort_hours.contact_id = vo
LEFT JOIN (SELECT contacts.contact_id AS th3_contact_id,
COUNT(shop_hours.contact_id) as th3_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS th3_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS th3_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -59,7 +59,7 @@ ORDER BY last_name, first_name) AS total_hours3 ON sort_hours.contact_id = total
LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id,
COUNT(shop_hours.contact_id) as vh3_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh3_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS vh3_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

View File

@ -27,7 +27,7 @@ $total_users = $row_Recordset2['total_users'];
$query_Recordset3 = "SELECT year(date), week(date),
COUNT(shop_visit_id) AS total_visitors,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS total_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS total_hours
FROM shops LEFT JOIN shop_hours ON shops.shop_id = shop_hours.shop_id
GROUP BY year(date), week(date)
ORDER BY year(date) DESC, week(date) DESC";
@ -37,7 +37,7 @@ $totalRows_Recordset3 = mysql_num_rows($Recordset3);
$query_Recordset4 = "SELECT year(date), week(date),
COUNT(shop_visit_id) AS volunteer_visitors,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS volunteer_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS volunteer_hours
FROM shops
LEFT JOIN shop_hours ON shops.shop_id = shop_hours.shop_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

View File

@ -43,7 +43,7 @@ if (isset($_POST['range1'])) {
$query = "SELECT shop_user_role,
COUNT(DISTINCT shop_hours.contact_id) as unique_volunteers,
COUNT(shop_hours.contact_id) as volunteer_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS volunteer_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS volunteer_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -54,7 +54,7 @@ $query = "SELECT shop_user_role,
$query = "SELECT COUNT(DISTINCT shop_hours.contact_id) as unique_volunteers,
COUNT(shop_hours.contact_id) as volunteer_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS volunteer_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS volunteer_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -64,8 +64,7 @@ $total_volunteers_sql = mysql_query($query, $YBDB) or die(mysql_error());
$query = "SELECT shop_user_role, COUNT(DISTINCT shop_hours.contact_id) as unique_visitors,
COUNT(shop_hours.contact_id) as visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out),
TIME(time_in)))/60)) AS hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -77,7 +76,7 @@ $visitors_sql = mysql_query($query, $YBDB) or die(mysql_error());
$query = "SELECT COUNT(DISTINCT shop_hours.contact_id) as unique_visitors,
COUNT(shop_hours.contact_id) as visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -87,7 +86,7 @@ $total_visitors_sql = mysql_query($query, $YBDB) or die(mysql_error());
$query = "SELECT COUNT(DISTINCT shop_hours.contact_id) as unique_vv,
COUNT(shop_hours.contact_id) as visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

View File

@ -7,6 +7,7 @@ require_once('Connections/database_functions.php');
/*
require_once(realpath($_SERVER["DOCUMENT_ROOT"]) . '/php-console/src/PhpConsole/__autoload.php');
$handler = PhpConsole\Handler::getInstance();
$handler->setErrorsHandlerLevel(E_ALL &~ E_DEPRECATED);
$handler->start();
*/
@ -78,7 +79,50 @@ if($_GET['trans_type']=='all_types'){
$trans_type_state = 'all_types';
}
//record_count (SQL or state)
if($_GET['contact_id_search']=='everyone'){
$contact_id = '';
$contact_id_state = 'everyone';
} elseif(isset($_GET['contact_id_search'])) {
$contact_id = "AND contact_id = '" . $_GET['contact_id_search'] . "'";
$contact_id_state = $_GET['contact_id_search'];
} else {
$contact_id = '';
$contact_id_state = 'everyone';
}
if($_GET['search']==''){
$search = '';
$search_state = '';
} elseif(isset($_GET['search'])) {
$search = "AND description REGEXP" . "'" . $_GET['search'] . "'";
//$search = "AND description LIKE" . "'%" . $_GET['search'] . "%'";
$search_state = $_GET['search'];
} else {
$search = '';
$search_state = '';
}
//// currently used for links in reports, and not for transaction_log page search mechanism
// Shop Transaction Totals (stats_shoptransactiontotals.php) - by shop
if($_GET['shop_id_search']==''){
$shop_id_search = '';
} elseif(isset($_GET['shop_id_search'])) {
$shop_id_search = "AND shop_id = '" . $_GET['shop_id_search'] . "'";
} else {
$shop_id_search = '';
}
// Sales Tax Report (stats_monthlysalestax.php)- by month
if($_GET['month_search']==''){
$month_search = '';
} elseif(isset($_GET['month_search'])) {
$month_search = "AND DATE(date) >='" . $_GET['month_search'] . "' AND DATE(date) <= LAST_DAY('" . $_GET['month_search'] . "')";
} else {
$month_search = '';
}
//// record_count (SQL or state)
if($_GET['record_count']>0){
$record_count = $_GET['record_count'];
$number_of_transactions = $record_count;
@ -88,6 +132,8 @@ if($_GET['record_count']>0){
// create a string to remember state
$search_state_array = array(
"search" => $search_state,
"contact_id_search" => $contact_id_state,
"trans_date" => $trans_date_state,
"trans_type" => $trans_type_state,
"shop_dayname" => $shop_dayname_state,
@ -109,6 +155,9 @@ foreach ( $search_state_array as $key => $value ) {
// What is seen on the main page.
mysql_select_db($database_YBDB, $YBDB);
// count for $month_search and $shop_id_search
if($month_search || $shop_id_search) {
$query_Recordset1 = "SELECT *,
DATE_FORMAT(date,'%m/%d/%y (%a)') as date_wday,
CONCAT('$',FORMAT(amount,2)) as format_amount,
@ -120,9 +169,30 @@ LEFT(IF(show_startdate, CONCAT(' [',
FROM transaction_log
LEFT JOIN contacts ON transaction_log.sold_to=contacts.contact_id
LEFT JOIN transaction_types ON transaction_log.transaction_type=transaction_types.transaction_type_id
WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} ORDER BY transaction_id DESC LIMIT 0, $record_count;";
WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} {$contact_id} {$search} {$shop_id_search} {$month_search};";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
//$handler->debug($totalRows_Recordset1);
$record_count = $totalRows_Recordset1;
}
$query_Recordset1 = "SELECT *,
DATE_FORMAT(date,'%m/%d/%y (%a)') as date_wday,
CONCAT('$',FORMAT(amount,2)) as format_amount,
CONCAT(contacts.last_name, ', ', contacts.first_name, ' ',contacts.middle_initial) AS full_name,
LEFT(IF(show_startdate, CONCAT(' [',
DATE_FORMAT(DATE_ADD(date_startstorage,INTERVAL $storage_period DAY),'%W, %M %D'), '] ', transaction_log.description),
IF(community_bike,CONCAT('Quantity(', quantity, ') ', transaction_log.description), description)),2000)
as description_with_locations
FROM transaction_log
LEFT JOIN contacts ON transaction_log.sold_to=contacts.contact_id
LEFT JOIN transaction_types ON transaction_log.transaction_type=transaction_types.transaction_type_id
WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} {$contact_id} {$search} {$shop_id_search} {$month_search} ORDER BY transaction_id DESC LIMIT 0, $record_count;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
//$handler->debug($query_Recordset1);
//Action on form update
$editFormAction = "";
@ -318,9 +388,9 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ConfirmDelete") &&
header(sprintf("Location: %s", PAGE_SALE_LOG . "?trans_id={$delete_trans_id}&" . $search_state )); //$editFormAction
}
//Change Date isset($_POST["MM_update"]) =========================================================
//Change Date & Transaction Search isset($_POST["MM_update"]) =========================================================
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
$editFormAction = "?trans_date={$_POST['trans_date']}&trans_type={$_POST['trans_type']}&shop_dayname={$_POST['dayname']}&record_count={$_POST['record_count']}";
$editFormAction = "?trans_date={$_POST['trans_date']}&trans_type={$_POST['trans_type']}&shop_dayname={$_POST['dayname']}&record_count={$_POST['record_count']}&contact_id_search={$_POST['contact_id_search']}&search={$_POST['search']}";
header(sprintf("Location: %s",$editFormAction )); //$editFormAction
}
@ -641,6 +711,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
<td colspan="9"><p><strong>Start New Transaction:</strong><br />&nbsp;&nbsp;&nbsp;&nbsp;Select Type: <?php list_transaction_types('transaction_type',$default_transaction_type); ?>
<input type="submit" name="Submit43" value="Create Transaction" /><span id="current_shop"></span>
</p>
<div></div>
</td>
</tr>
<input type="hidden" name="MM_insert" value="FormNew" />
@ -680,14 +751,27 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
if($result['anonymous']) {
echo "Anonymous";
$whoami = "Anonymous";
} else {
echo '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;" href="individual_history_log.php?contact_id=' .
$row_Recordset1['contact_id'] . '">' .
$row_Recordset1['full_name'] . "</a>";
$whoami = '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;" href="individual_history_log.php?contact_id=' .
$row_Recordset1['contact_id'] . '">' .
$row_Recordset1['full_name'] . "</a>";
}
?>&nbsp;</td>
<td <?php echo "title='Description: " . htmlspecialchars($row_Recordset1['description_with_locations'], ENT_QUOTES) . "'"; ?> ><?php echo $row_Recordset1['description_with_locations']; ?>&nbsp;</td>
<?php
// Highlight search results in Description
$description = $row_Recordset1['description_with_locations'];
if(!empty($_GET["search"])) {
$description = highlightKeywords($row_Recordset1['description_with_locations'],$_GET["search"]);
}
?>
<td <?php echo "title='Description: " . htmlspecialchars($row_Recordset1['description_with_locations'], ENT_QUOTES) . "'"; ?> ><?php echo $description; ?>&nbsp;</td>
<td><?php echo $row_Recordset1['payment_type']; ?>&nbsp;</td>
<td <?php
$history = json_decode($row_Recordset1['history']);
@ -699,19 +783,25 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
$sql = mysql_query($query, $YBDB) or die(mysql_error());
$result = mysql_fetch_assoc($sql);
if ( $history[$key]->original_price ) {
$title = "Sold By: " . $result['full_name']. "\r\n" .
$title = "Date: " . $history[$key]->date. "\r\n" .
"Sold By: " . $result['full_name']. "\r\n" .
"Original Price: " . $history[$key]->original_price . "\r\n" .
"Paid: " . $history[$key]->amount . "\r\n" .
"Redeemed Hours: " . floatval($history[$key]->redeemed_hours);
echo "title='" . $title . "'";
} else {
$title = "Transaction Performed By: " . $result['full_name'];
$title = "Date: " . $history[$key]->date. "\r\n" .
"Transaction Performed By: " . $result['full_name'];
echo "title='" . $title . "'";
}
}
?>
><?php echo $row_Recordset1['format_amount']; ?>&nbsp;</td>
><?php echo $row_Recordset1['format_amount'];
if($row_Recordset1['transaction_type'] !== "Deposit" && $row_Recordset1['paid'] == 1) {
$total = $total + $row_Recordset1['amount'];
}
?>&nbsp;</td>
<td><?php $record_trans_id = $row_Recordset1['transaction_id'];
foreach ($_GET as $i => $value) {
if ($i != "trans_id") {
@ -772,10 +862,32 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
<input type="hidden" name="shop_visit_id" value="<?php echo $row_Recordset1['transaction_id']; ?>">
</form>
<?php } //while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); // while Recordset1 ?>
<tr>
<td>TOTAL</td><td></td>
<td style="text-align: center;">Transactions: <?php echo $totalRows_Recordset1; ?></td>
<td><?php
if ($contact_id_state !== 'everyone') {
if ($whoami) {
echo $whoami;
} else {
$query = "SELECT CONCAT(last_name, ', ', first_name, ' ', middle_initial) AS full_name
FROM contacts WHERE contact_id=" . $contact_id_state . ";";
$sql = mysql_query($query, $YBDB) or die(mysql_error());
$result = mysql_fetch_assoc($sql);
echo '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;" href="individual_history_log.php?contact_id=' .
$contact_id_state . '">' .
$result['full_name'] . "</a>";
}
}
?></td>
<td></td><td></td>
<td title="Updates on Transaction Search Submit">$<?php echo number_format((float)$total, 2, '.', ''); ?></td>
<td></td><td></td>
</tr>
</table> </tr>
<tr>
<td height="40" valign="bottom"><form id="form1" name="form1" method="post" action="">
<td height="40" valign="bottom" style="white-space: nowrap;"><form id="form1" name="form1" method="post" action="">
<br \>
<label for="transaction_search" style="font-weight:bold;">Transaction Search:</label>
<br \>
@ -816,7 +928,12 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
<option value="Sunday">Sunday</option>
</select>
transaction type <?php list_transaction_types_withheader('trans_type', 'all_types'); ?>
transaction type <?php list_transaction_types_withheader('trans_type', 'all_types'); ?> by
<?php list_contacts_select_contact(contact_id_search, $_GET['contact_id_search']);?> <br \> with these words
<input type="text" name="search" value="<?php echo $_GET[search]; ?>" />
<input type="submit" name="Submit" value="Submit" />
<input type="hidden" name="MM_insert" value="ChangeDate" />
@ -877,8 +994,9 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
</td>
</tr>
</table>
<p>&nbsp;</p>
<?php include("include_footer.html"); ?>
<?php
mysql_free_result($Recordset1);
?>