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

Compare commits

..

18 Commits
2.1 ... 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
20 changed files with 342 additions and 184 deletions

View File

@ -1,6 +1,7 @@
<?php <?php
require_once('YBDB.php'); require_once('YBDB.php');
// DO NOT EDIT - USE Connections/local_configurations.php instead with definitions between // DO NOT EDIT - USE Connections/local_configurations.php instead with definitions between
// <?php (no space between ? and >) ? > // <?php (no space between ? and >) ? >
@ -17,8 +18,21 @@ require_once('YBDB.php');
Hawaii no DST ..... Pacific/Honolulu 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 MEMBERSHIP
@ -34,29 +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 // Needs to volunteer at least this amount of defined hours before being considered a member
// Note: used only as a metric for reports // 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 // Needs to volunteer at least this number of days before being considered a member
// Note: used only as a metric for reports // 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 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 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 STAND TIME
**********/ **********/
// Determines the hourly cost for Stand Time (transaction_type_id) // Determines the hourly cost for Stand Time (transaction_type_id)
define("STAND_TIME_HOURLY_RATE",10); // IN DOLLARS 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 how much time over 1hr is allowed before charging for the next hour.
define("STAND_TIME_GRACE_PERIOD",15); // IN MINUTES 1 - 59 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 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 SWEAT EQUITY / VOLUNTEER BENEFITS
@ -77,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.) (Sweat Equity / Volunteer Benefits can't be combined with Membership Benefits.)
*/ */
define("SWEAT_EQUITY_LIMIT",100); // IN DOLLARS if( !defined( 'SWEAT_EQUITY_LIMIT' ) ) define("SWEAT_EQUITY_LIMIT",100); // IN DOLLARS
define("MAX_BIKE_EARNED",1); // AMOUNT OF BIKES if( !defined( 'MAX_BIKE_EARNED' ) ) define("MAX_BIKE_EARNED",1); // AMOUNT OF BIKES
define("VOLUNTEER_HOUR_VALUE",8); // IN DOLLARS if( !defined( 'VOLUNTEER_HOUR_VALUE' ) ) define("VOLUNTEER_HOUR_VALUE",8); // IN DOLLARS
define("VOLUNTEER_DISCOUNT",25); // PERCENTAGE if( !defined( 'VOLUNTEER_DISCOUNT' ) ) define("VOLUNTEER_DISCOUNT",25); // PERCENTAGE
define("SPECIAL_VOLUNTEER_HOURS_QUALIFICATION",100); // IN HOURS if( !defined( 'SPECIAL_VOLUNTEER_HOURS_QUALIFICATION' ) ) define("SPECIAL_VOLUNTEER_HOURS_QUALIFICATION",100); // IN HOURS
define("SPECIAL_VOLUNTEER_DISCOUNT",50); // PERCENTAGE if( !defined( 'SPECIAL_VOLUNTEER_DISCOUNT' ) ) define("SPECIAL_VOLUNTEER_DISCOUNT",50); // PERCENTAGE
// Customized sweat equity limit per contact_id // Customized sweat equity limit per contact_id
// e.g. for sweat equity limit of $200 for contact_id 500: array(500 => 200) // e.g. for sweat equity limit of $200 for contact_id 500: array(500 => 200)
$custom_sweat_equity_limit = array(); $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, // 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 // or 1 to 1 (1hr of volunteering === 1hr of free stand time) regardless of the SWEAT_EQUITY_LIMIT
define("REDEEM_ONE_TO_ONE", true); define("REDEEM_ONE_TO_ONE", true);
@ -120,18 +129,28 @@ BANNED IDS
// Ban those pesky individuals who continually refuse to follow policies and safer space agreements by contact_id // Ban those pesky individuals who continually refuse to follow policies and safer space agreements by contact_id
$banned_individuals = array(); $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 CONTACTS
********/ ********/
// Allow waiver (recommended) in Add/Edit Contacts; 1 = yes, 0 = no // Allow waiver (recommended) in Add/Edit Contacts; 1 = yes, 0 = no
// Waiver text may be modified in Connections/waiver.txt // 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 // 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. // Define a url for an email connector that will connect to an email list.
// The url can be a server:port, program, etc. // The url can be a server:port, program, etc.
@ -140,20 +159,20 @@ define("EMAIL_LIST", 1);
// The purpose of email connectors is to provide autonomy in the choice // The purpose of email connectors is to provide autonomy in the choice
// of email services and programs. E.g. mailman, googlegroups // of email services and programs. E.g. mailman, googlegroups
// See ./examples for an example mailman connector // 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 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, // 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. // 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 //// //// "Volunteer Interest" form ////
define("VOLUNTEER_INTEREST_FORM", true); if( !defined( 'VOLUNTEER_INTEREST_FORM' ) ) define("VOLUNTEER_INTEREST_FORM", true);
// Form name // 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 // NOTE: Introductory text can be modified in Connections/volunteer_interest_form_introduction.txt
@ -175,7 +194,7 @@ $volunteer_interests = array(
); );
// Provide a comment box - true of false // 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) // NOTE: The 2 variables ($volunteer_interest_changename & $volunteer_interests_deletename)
// below allow you to change or delete an interest. // below allow you to change or delete an interest.
@ -208,40 +227,40 @@ TRANSACTIONS
************/ ************/
// User defined constants - read sql/populate.sql for an explanation // User defined constants - read sql/populate.sql for an explanation
define("STORAGE_PERIOD", 14); if( !defined( 'STORAGE_PERIOD' ) ) define("STORAGE_PERIOD", 14);
define("ACCOUNTING_GROUP", "Sales"); if( !defined( 'ACCOUNTING_GROUP' ) ) define("ACCOUNTING_GROUP", "Sales");
define("DEFAULT_TRANSACTION_TYPE", "Sale - Used Parts"); if( !defined( 'DEFAULT_TRANSACTION_TYPE' ) ) define("DEFAULT_TRANSACTION_TYPE", "Sale - Used Parts");
// shop_user_role // 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. /* Change Fund - A specific amount of money for the purpose of making change.
The amount on hand should remain the same at all times; The amount on hand should remain the same at all times;
therefore a change funds does not require replenishment. 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 // 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. :) // No overtime for volunteers. :)
// shop will be current shop for the 24hr day yyyy-mm-dd (currently no check for hrs, only date) // 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. // 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. // 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. /* 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. 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. 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 // 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 (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. // 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: // Assuming the root of the website, and directory is called csv, and a Debian-based distribution:
@ -275,7 +294,7 @@ $gnucash_accounts = array( "Assets:Current Assets:Checking Account" => "checking
// Note: Remote shops function independently via their IP identification. // Note: Remote shops function independently via their IP identification.
// //
// Normally, you will want this set at 0. // 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 ETHERPAD LITE
@ -313,16 +332,16 @@ if(file_exists( realpath($_SERVER["DOCUMENT_ROOT"]) . "/Connections/local_config
} }
// other constants // other constants
define("PAGE_START_SHOP", "/start_shop.php"); if( !defined( 'PAGE_START_SHOP' ) ) define("PAGE_START_SHOP", "/start_shop.php");
define("PAGE_SHOP_LOG", "/shop_log.php"); if( !defined( 'PAGE_SHOP_LOG' ) ) define("PAGE_SHOP_LOG", "/shop_log.php");
define("PAGE_EDIT_CONTACT", "/contact_add_edit.php"); if( !defined( 'PAGE_EDIT_CONTACT' ) ) define("PAGE_EDIT_CONTACT", "/contact_add_edit.php");
define("PAGE_SELECT_CONTACT", "/contact_add_edit_select.php"); if( !defined( 'PAGE_SELECT_CONTACT' ) ) define("PAGE_SELECT_CONTACT", "/contact_add_edit_select.php");
define("PAGE_SHOP_LOG_DELETE_VISIT", "/shop_log_delete_shopvisitid.php"); if( !defined( 'PAGE_SHOP_LOG_DELETE_VISIT' ) ) define("PAGE_SHOP_LOG_DELETE_VISIT", "/shop_log_delete_shopvisitid.php");
define("INDIVIDUAL_HOURS_LOG", "/individual_hours_log.php"); if( !defined( 'INDIVIDUAL_HOURS_LOG' ) ) define("INDIVIDUAL_HOURS_LOG", "/individual_hours_log.php");
define("INDIVIDUAL_HISTORY_LOG", "/individual_history_log.php"); if( !defined( 'INDIVIDUAL_HISTORY_LOG' ) ) define("INDIVIDUAL_HISTORY_LOG", "/individual_history_log.php");
define("PAGE_SALE_LOG", "/transaction_log.php"); if( !defined( 'PAGE_SALE_LOG' ) ) define("PAGE_SALE_LOG", "/transaction_log.php");
define("PAGE_EDIT_LOCATION", "/location_add_edit.php"); if( !defined( 'PAGE_EDIT_LOCATION' ) ) define("PAGE_EDIT_LOCATION", "/location_add_edit.php");
define("PAGE_SELECT_LOCATION", "/location_add_edit_select.php"); if( !defined( 'PAGE_SELECT_LOCATION' ) ) define("PAGE_SELECT_LOCATION", "/location_add_edit_select.php");
// Highlight search results in transaction_log // Highlight search results in transaction_log
function highlightKeywords($text, $keyword) { function highlightKeywords($text, $keyword) {
@ -369,7 +388,7 @@ function generate_list($querySQL,$list_value,$list_text, $form_name, $default_va
$default_delimiter = 'selected="selected"'; $default_delimiter = 'selected="selected"';
} else { $default_delimiter = '';} } else { $default_delimiter = '';}
echo '<option style="color:' . $color . ';" value="' . $row_recordset[$list_value] . '" ' . $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)); } while ($row_recordset = mysql_fetch_assoc($recordset));
$rows = mysql_num_rows($recordset); $rows = mysql_num_rows($recordset);
if($rows > 0) { if($rows > 0) {
@ -866,16 +885,26 @@ function max_shop_id(){
} }
// Is there currently a shop? // Is there currently a shop?
// curl https://ipinfo.io/ip
function current_shop_by_ip(){ function current_shop_by_ip(){
global $database_YBDB, $YBDB; global $database_YBDB, $YBDB;
$IP = $_SERVER['REMOTE_ADDR']; $IP = $_SERVER['REMOTE_ADDR'];
$current_date = current_date(); $current_date = current_date();
mysql_select_db($database_YBDB, $YBDB); 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;"; $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()); $Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1); $row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($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']; return $row_Recordset1['shop_id'];
} }

View File

@ -33,6 +33,23 @@ $(function(){
$(banned_list).css({backgroundColor: "red"}).prop("title", "BANNED"); $(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) // error handler for shops with a popup dialog (TODO)
function error_handler(input,error_span,error,error_text,event) { function error_handler(input,error_span,error,error_text,event) {
var trans_error = 0; var trans_error = 0;
@ -87,7 +104,6 @@ $(function(){
} ); } );
// could have done this in php, but this separates out the view logic // could have done this in php, but this separates out the view logic
var membership_ids, volunteer_ids; var membership_ids, volunteer_ids;
var last_index = $("#shop_log tr[id]").length; var last_index = $("#shop_log tr[id]").length;

View File

@ -68,4 +68,120 @@ $(function(){
e.preventDefault(); 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

@ -89,7 +89,6 @@ $(function() {
} }
} ); } );
// paid or not? // paid or not?
$(":checked").parent("td").prev().children().not("#payment_type_label").hide(); // need to watch that not introduction bugs $(":checked").parent("td").prev().children().not("#payment_type_label").hide(); // need to watch that not introduction bugs
$(".paid").click(function() { $(".paid").click(function() {
@ -405,6 +404,12 @@ $(function() {
// watch that percentage doesn't acquire too many decimal points. // watch that percentage doesn't acquire too many decimal points.
//console.dir(range_obj); //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 //initialize slider
if (!slider) { if (!slider) {
@ -1036,6 +1041,7 @@ $(function() {
sold_to.change(function() { sold_to.change(function() {
//sold_to.hide();
amount.prop("disabled",""); amount.prop("disabled","");
var membership_obj; //reuse this object var membership_obj; //reuse this object
@ -1522,11 +1528,22 @@ $(function() {
vhr = parseFloat($("#redeemable_hours").val()); vhr = parseFloat($("#redeemable_hours").val());
} }
// Don't require paid to be selected, only amount >= 0 // 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; var max_bike_earned = 0, maximum_allowable_earned_bikes;
if ($("#transaction_type").val() === "Bicycles") { if ($("#transaction_type").val() === "Bicycles") {
// hours were redeemed and this is a Bicycle transaction // hours were redeemed and this is a Bicycle transaction
if (vhr !== "0.00") { if (vhr !== "0.00" && vhr !== 0) {
max_bike_earned = 1; max_bike_earned = 1;
} }
} }

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 // update email_list
if( isset($_POST['email_list']) ) { if( isset($_POST['email_list']) ) {

View File

@ -708,12 +708,12 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
$query = "SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name, $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, 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 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) WHERE SUBSTRING_INDEX(date, ' ', 1) <= DATE_ADD(date, INTERVAL 365 DAY)
AND (transaction_type='Memberships' AND paid=1) AND " . AND (transaction_type='Memberships' AND paid=1) AND " .
$contact_id . $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()); $sql = mysql_query($query, $YBDB) or die(mysql_error());

View File

@ -41,30 +41,16 @@ if (isset($_POST['range1'])) {
$today = $range2; $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, $query = "SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
COUNT(shop_hours.contact_id) as cs_volunteer_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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)) 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_user_roles.other_volunteer = 1
AND shop_hours.shop_user_role = 'Student Volunteer/Community Service Hours'
GROUP BY contact_id GROUP BY contact_id
ORDER BY cs_volunteer_hours DESC;"; ORDER BY cs_volunteer_hours DESC;";
$cs_volunteers_sql = mysql_query($query, $YBDB) or die(mysql_error()); $cs_volunteers_sql = mysql_query($query, $YBDB) or die(mysql_error());

View File

@ -39,43 +39,13 @@ if (isset($_POST['range1'])) {
$today = $range2; $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 // Membership via volunteering
$query = "SELECT contact_id, full_name, normal_full_name, email, phone, sort_visits, sort_hours FROM $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, (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
CONCAT(first_name, ' ', last_name) AS normal_full_name, CONCAT(first_name, ' ', last_name) AS normal_full_name,
contacts.email AS email, contacts.phone AS phone, contacts.email AS email, contacts.phone AS phone,
COUNT(shop_hours.contact_id) as sort_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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)) { while ($result = mysql_fetch_assoc($members)) {
//do { //do {
?> ?>
<tr> <tr id="<?php echo $result['contact_id']; ?>">
<?php if( isset($purchased_membership_dictionary[$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 { ?> <?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 } ?> <?php } ?>
<td class="yb_standardRIGHT"><?php echo number_format($result['sort_visits'],0); ?></td> <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> <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); 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 // Membership via volunteering
$query = "SELECT contact_id, full_name, normal_full_name, email, phone, sort_visits, sort_hours FROM $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, (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
CONCAT(first_name, ' ', last_name) AS normal_full_name, CONCAT(first_name, ' ', last_name) AS normal_full_name,
contacts.email AS email, contacts.phone AS phone, contacts.email AS email, contacts.phone AS phone,
COUNT(shop_hours.contact_id) as sort_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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> <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"><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_visits'],0); ?></td>
<td class="yb_standardRIGHT"><?php echo number_format($purchased_membership_dictionary[$result['contact_id']]['sort_hours'],0); ?></td> <td class="yb_standardRIGHT"><?php echo number_format($purchased_membership_dictionary[$result['contact_id']]['sort_hours'],0); ?></td>
</tr> </tr>

View File

@ -33,7 +33,6 @@ if (isset($_POST['range1'])) {
$today = $range2; $today = $range2;
} }
$query = "SELECT COUNT(shop_id) as total_shops from shops $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));"; 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()); $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 $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 FROM transaction_log t
LEFT JOIN transaction_types tt ON t.transaction_type = tt.transaction_type_id 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) GROUP BY year(t.date), month(t.date)
ORDER BY year(t.date) DESC, month(t.date) DESC;"; ORDER BY year(t.date) DESC, month(t.date) DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error()); $Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
@ -37,13 +37,13 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
</tr> </tr>
<tr> <tr>
<td> <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"> <tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="60" height="35">Year</td> <th width="120" height="35">Year</th>
<td width="60">Month</td> <th width="60">Month</th>
<td width="100">Total Sales</td> <th width="100">Total Sales</th>
<td width="110">Accounting Group</td> <th width="110">Accounting Group</th>
</tr> </tr>
<form method="post" name="FormUpdate_<?php echo $row_Recordset1['shop_id']; ?>" action="<?php echo $editFormAction; ?>"> <form method="post" name="FormUpdate_<?php echo $row_Recordset1['shop_id']; ?>" action="<?php echo $editFormAction; ?>">
<?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) { //do { <?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 ?> <?php } else { // end if EDIT RECORD ?>
<tr> <tr>
<td><?php echo $row_Recordset1['Year']; ?></td> <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 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> </tr>
<?php <?php
} // end if EDIT RECORD } // 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, 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, 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, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, 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, 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, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

View File

@ -65,7 +65,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
<?php } else { // end if EDIT RECORD ?> <?php } else { // end if EDIT RECORD ?>
<tr> <tr>
<td><?php echo $row_Recordset1['ShopDate']; ?></td> <td><?php echo $row_Recordset1['ShopDate']; ?></td>
<td><?php echo '<a href="/transaction_log.php?shop_id_search=' . $row_Recordset1['ShopID'] . '&record_count=500">' . $row_Recordset1['ShopID'] . '</a>'; ?></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['Day']; ?></td>
<td valign="middle"><?php echo $row_Recordset1['ShopType']; ?></td> <td valign="middle"><?php echo $row_Recordset1['ShopType']; ?></td>
<td class="yb_standardRIGHT"><?php currency_format($row_Recordset1['Total'],2);?></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); mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name, $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, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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 ORDER BY last_name, first_name) AS total_hours
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id, LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as vh_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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 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, LEFT JOIN (SELECT contacts.contact_id AS th3_contact_id,
COUNT(shop_hours.contact_id) as th3_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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 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, LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id,
COUNT(shop_hours.contact_id) as vh3_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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); mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name, $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, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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 ORDER BY sort_hours DESC) AS sort_hours
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id, LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as th_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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 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, LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as vh_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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 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, LEFT JOIN (SELECT contacts.contact_id AS th3_contact_id,
COUNT(shop_hours.contact_id) as th3_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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 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, LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id,
COUNT(shop_hours.contact_id) as vh3_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
COUNT(shop_hours.contact_id) as sort_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as th_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
COUNT(shop_hours.contact_id) as vh_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, LEFT JOIN (SELECT contacts.contact_id AS th3_contact_id,
COUNT(shop_hours.contact_id) as th3_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id,
COUNT(shop_hours.contact_id) as vh3_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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), $query_Recordset3 = "SELECT year(date), week(date),
COUNT(shop_visit_id) AS total_visitors, 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 FROM shops LEFT JOIN shop_hours ON shops.shop_id = shop_hours.shop_id
GROUP BY year(date), week(date) GROUP BY year(date), week(date)
ORDER BY year(date) DESC, week(date) DESC"; 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), $query_Recordset4 = "SELECT year(date), week(date),
COUNT(shop_visit_id) AS volunteer_visitors, 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 FROM shops
LEFT JOIN shop_hours ON shops.shop_id = shop_hours.shop_id 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 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, $query = "SELECT shop_user_role,
COUNT(DISTINCT shop_hours.contact_id) as unique_volunteers, COUNT(DISTINCT shop_hours.contact_id) as unique_volunteers,
COUNT(shop_hours.contact_id) as volunteer_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, $query = "SELECT COUNT(DISTINCT shop_hours.contact_id) as unique_volunteers,
COUNT(shop_hours.contact_id) as volunteer_visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, $query = "SELECT shop_user_role, COUNT(DISTINCT shop_hours.contact_id) as unique_visitors,
COUNT(shop_hours.contact_id) as visits, COUNT(shop_hours.contact_id) as visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS hours
TIME(time_in)))/60)) AS hours
FROM shop_hours FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, $query = "SELECT COUNT(DISTINCT shop_hours.contact_id) as unique_visitors,
COUNT(shop_hours.contact_id) as visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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, $query = "SELECT COUNT(DISTINCT shop_hours.contact_id) as unique_vv,
COUNT(shop_hours.contact_id) as visits, 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 FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id 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 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'); require_once(realpath($_SERVER["DOCUMENT_ROOT"]) . '/php-console/src/PhpConsole/__autoload.php');
$handler = PhpConsole\Handler::getInstance(); $handler = PhpConsole\Handler::getInstance();
$handler->setErrorsHandlerLevel(E_ALL &~ E_DEPRECATED);
$handler->start(); $handler->start();
*/ */
@ -101,8 +102,9 @@ if($_GET['search']==''){
$search_state = ''; $search_state = '';
} }
// currently used for links in reports, and not for transaction_log page search mechanism //// 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']==''){ if($_GET['shop_id_search']==''){
$shop_id_search = ''; $shop_id_search = '';
} elseif(isset($_GET['shop_id_search'])) { } elseif(isset($_GET['shop_id_search'])) {
@ -111,7 +113,16 @@ if($_GET['shop_id_search']==''){
$shop_id_search = ''; $shop_id_search = '';
} }
//record_count (SQL or state) // 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){ if($_GET['record_count']>0){
$record_count = $_GET['record_count']; $record_count = $_GET['record_count'];
$number_of_transactions = $record_count; $number_of_transactions = $record_count;
@ -144,6 +155,9 @@ foreach ( $search_state_array as $key => $value ) {
// What is seen on the main page. // What is seen on the main page.
mysql_select_db($database_YBDB, $YBDB); mysql_select_db($database_YBDB, $YBDB);
// count for $month_search and $shop_id_search
if($month_search || $shop_id_search) {
$query_Recordset1 = "SELECT *, $query_Recordset1 = "SELECT *,
DATE_FORMAT(date,'%m/%d/%y (%a)') as date_wday, DATE_FORMAT(date,'%m/%d/%y (%a)') as date_wday,
CONCAT('$',FORMAT(amount,2)) as format_amount, CONCAT('$',FORMAT(amount,2)) as format_amount,
@ -155,9 +169,30 @@ LEFT(IF(show_startdate, CONCAT(' [',
FROM transaction_log FROM transaction_log
LEFT JOIN contacts ON transaction_log.sold_to=contacts.contact_id 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 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} 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()); $Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($Recordset1); $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 //Action on form update
$editFormAction = ""; $editFormAction = "";
@ -676,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); ?> <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> <input type="submit" name="Submit43" value="Create Transaction" /><span id="current_shop"></span>
</p> </p>
<div></div>
</td> </td>
</tr> </tr>
<input type="hidden" name="MM_insert" value="FormNew" /> <input type="hidden" name="MM_insert" value="FormNew" />