mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2026-09-17 00:41:38 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
330735ff61 | ||
|
|
da1a063a0a | ||
|
|
01293db335 | ||
|
|
b8a42f11a0 | ||
|
|
3be493fc62 | ||
|
|
11480e8fd3 | ||
|
|
bc2ea843e4 | ||
|
|
4de11ee547 | ||
|
|
b18cf97f7c | ||
|
|
d0828bc80b | ||
|
|
59fdb375c5 | ||
|
|
f1d85b2060 | ||
|
|
940b6c52b3 | ||
|
|
78102f3600 | ||
|
|
dbcfbd67e0 | ||
|
|
28f8bf464e | ||
|
|
305ebee833 | ||
|
|
46be9fa887 | ||
|
|
17684f6e10 | ||
|
|
8810c7f3f1 | ||
|
|
b6e416a416 | ||
|
|
e149a86d01 |
@@ -49,15 +49,12 @@ define("MEMBERSHIP_DISCOUNT",10); // PERCENTAGE
|
|||||||
/*********
|
/*********
|
||||||
STAND TIME
|
STAND TIME
|
||||||
**********/
|
**********/
|
||||||
// Determines the behaviour of Stand Time (transaction_type_id)
|
// Determines the hourly cost for Stand Time (transaction_type_id)
|
||||||
define("STAND_TIME_HOURLY_RATE",10); // IN DOLLARS
|
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
|
define("STAND_TIME_GRACE_PERIOD",15); // IN MINUTES 1 - 59
|
||||||
|
|
||||||
// Define hourly cost for stand time
|
|
||||||
define("STAND_TIME_VALUE",10); // IN DOLLARS
|
|
||||||
|
|
||||||
// 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
|
define("FREE_STAND_TIME_PERIOD",30); // IN DAYS
|
||||||
|
|
||||||
@@ -285,7 +282,8 @@ define('SHOW_SHOP_ID',0);
|
|||||||
**************/
|
**************/
|
||||||
// Allow comments/feedback/notes to be added per individual_history_log in reports,
|
// 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.
|
// 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:
|
// prefix allows you to set a prefix to the name of the autogenerated padId:
|
||||||
// etherpad = prefix + "pad_contact_id_" + contact_id;
|
// etherpad = prefix + "pad_contact_id_" + contact_id;
|
||||||
@@ -326,6 +324,28 @@ define("PAGE_SALE_LOG", "/transaction_log.php");
|
|||||||
define("PAGE_EDIT_LOCATION", "/location_add_edit.php");
|
define("PAGE_EDIT_LOCATION", "/location_add_edit.php");
|
||||||
define("PAGE_SELECT_LOCATION", "/location_add_edit_select.php");
|
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
|
//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)
|
function generate_list($querySQL,$list_value,$list_text, $form_name, $default_value, $color)
|
||||||
{
|
{
|
||||||
@@ -727,6 +747,13 @@ function dateandtimein($date, $time){
|
|||||||
|
|
||||||
|
|
||||||
// Drop-Down lists
|
// 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 = "")
|
function list_contacts_edit_add($form_name = "contact_id", $default_value = "")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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).
|
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).
|
Docker Development is at [https://github.com/fspc/ybdb](https://github.com/fspc/ybdb).
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ include("include_header.html");
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="contact_id" style="display:none;"><?php echo $contact_id; ?></div>
|
<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 id="individual_history"></div>
|
||||||
|
|
||||||
<div class="stats-clear nextprev" style="text-align:center; display:block; margin-top:9px;">
|
<div class="stats-clear nextprev" style="text-align:center; display:block; margin-top:9px;">
|
||||||
|
|||||||
+69
-2
@@ -36,18 +36,32 @@ $(function(){
|
|||||||
$(".stats-left").attr("href","/individual_history_log.php?contact_id=" + prev);
|
$(".stats-left").attr("href","/individual_history_log.php?contact_id=" + prev);
|
||||||
$(".stats-right").attr("href","/individual_history_log.php?contact_id=" + next);
|
$(".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
|
// name
|
||||||
|
var date;
|
||||||
$.post("json/reports.php", { name: 1, contact_id: contact_id }, function (data) {
|
$.post("json/reports.php", { name: 1, contact_id: contact_id }, function (data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
var d = new Date();
|
||||||
|
date = d.toISOString().split('T')[0];
|
||||||
var obj = $.parseJSON(data);
|
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;
|
var pad_name;
|
||||||
if (obj.configurations.prefix) {
|
if (obj.configurations.prefix) {
|
||||||
pad_name = obj.configurations.prefix + "_pad_contact_id_" + contact_id;
|
pad_name = obj.configurations.prefix + "_pad_contact_id_" + contact_id;
|
||||||
} else {
|
} else {
|
||||||
pad_name = "pad_contact_id_" + contact_id;
|
pad_name = "pad_contact_id_" + contact_id;
|
||||||
}
|
}
|
||||||
console.log(pad_name);
|
//console.log(pad_name);
|
||||||
if ( obj.configurations.host && obj.full_name ) {
|
if ( obj.configurations.host && obj.full_name ) {
|
||||||
$("#individual_history_pad").pad({
|
$("#individual_history_pad").pad({
|
||||||
"padId": pad_name,
|
"padId": pad_name,
|
||||||
@@ -114,6 +128,59 @@ $(function(){
|
|||||||
|
|
||||||
}); // tabulator
|
}); // 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
|
} // if contact_id
|
||||||
|
|
||||||
// stats_userhours
|
// stats_userhours
|
||||||
|
|||||||
+174
-38
@@ -10,9 +10,10 @@ $(function() {
|
|||||||
// but all ajax needs to be synchronous in this program because of the use of an "ancient" mysql
|
// 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']").attr("tabindex",1);
|
||||||
$("[name='transaction_type']").focus();
|
$("[name='transaction_type']").focus().scrollTop();
|
||||||
$("input[value='Create Transaction']").attr("tabindex",2);
|
$("input[value='Create Transaction']").attr("tabindex",2);
|
||||||
$("#trans_date").mask("0000-00-00", {placeholder: "yyyy-mm-dd" });
|
$("#trans_date").mask("0000-00-00", {placeholder: "yyyy-mm-dd" });
|
||||||
|
$("[name='contact_id']").attr("tabindex",3);
|
||||||
|
|
||||||
// Add focus for easier tab browsing
|
// Add focus for easier tab browsing
|
||||||
// use .paid parent and hover & classes
|
// use .paid parent and hover & classes
|
||||||
@@ -88,37 +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?
|
// 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
|
||||||
@@ -185,6 +155,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 - on reload
|
||||||
transaction_slider();
|
transaction_slider();
|
||||||
|
|
||||||
@@ -769,8 +897,6 @@ $(function() {
|
|||||||
|
|
||||||
} // end function redeemable
|
} // end function redeemable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// editing a transaction
|
// editing a transaction
|
||||||
if ( $("input[name='shop_id']").length ) {
|
if ( $("input[name='shop_id']").length ) {
|
||||||
|
|
||||||
@@ -1392,7 +1518,7 @@ $(function() {
|
|||||||
var vhr;
|
var vhr;
|
||||||
if ($("#redeemable_hours").val() === "") {
|
if ($("#redeemable_hours").val() === "") {
|
||||||
vhr = "0.00";
|
vhr = "0.00";
|
||||||
} else {
|
} else {
|
||||||
vhr = parseFloat($("#redeemable_hours").val());
|
vhr = parseFloat($("#redeemable_hours").val());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1441,8 +1567,15 @@ $(function() {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ($("#redeemable_hours").val().length) {
|
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) {
|
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) +
|
volunteer_benefits_history[year].max_bike_earned = parseFloat(volunteer_benefits_history[year].max_bike_earned) +
|
||||||
@@ -1515,11 +1648,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 =
|
var current_transaction =
|
||||||
{
|
{
|
||||||
transaction_id: transaction_id,
|
transaction_id: transaction_id,
|
||||||
date_startstorage: $("#date_startstorage").val(),
|
date_startstorage: $("#date_startstorage").val(),
|
||||||
date: date,
|
date: current_date_time,
|
||||||
transaction_type: $("#transaction_type").val(),
|
transaction_type: $("#transaction_type").val(),
|
||||||
original_price: original_price,
|
original_price: original_price,
|
||||||
amount: price,
|
amount: price,
|
||||||
|
|||||||
@@ -130,4 +130,14 @@ $handler->start();
|
|||||||
|
|
||||||
} // return everyone
|
} // 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
+35
-7
@@ -14,7 +14,6 @@ $change_fund = CHANGE_FUND;
|
|||||||
$csv_directory = CSV_DIRECTORY;
|
$csv_directory = CSV_DIRECTORY;
|
||||||
$stand_time_hourly_rate = STAND_TIME_HOURLY_RATE;
|
$stand_time_hourly_rate = STAND_TIME_HOURLY_RATE;
|
||||||
$stand_time_grace_period = STAND_TIME_GRACE_PERIOD;
|
$stand_time_grace_period = STAND_TIME_GRACE_PERIOD;
|
||||||
$stand_time_value = STAND_TIME_VALUE;
|
|
||||||
$free_stand_time_period = FREE_STAND_TIME_PERIOD;
|
$free_stand_time_period = FREE_STAND_TIME_PERIOD;
|
||||||
$timezone = TIMEZONE;
|
$timezone = TIMEZONE;
|
||||||
$sweat_equity_limit = SWEAT_EQUITY_LIMIT;
|
$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 payment_type check is selected - return check number if exists
|
||||||
if (isset($_POST['check_number'])) {
|
if (isset($_POST['check_number'])) {
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
|
|||||||
$result["volunteer_discount"] = $volunteer_discount;
|
$result["volunteer_discount"] = $volunteer_discount;
|
||||||
$result["special_volunteer_hours_qualification"] = $special_volunteer_hours_qualification;
|
$result["special_volunteer_hours_qualification"] = $special_volunteer_hours_qualification;
|
||||||
$result["special_volunteer_discount"] = $special_volunteer_discount;
|
$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;
|
$result["redeem_one_to_one"] = $redeem_one_to_one;
|
||||||
$volunteers[] = $result;
|
$volunteers[] = $result;
|
||||||
}
|
}
|
||||||
@@ -464,7 +464,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// second statement to find normal transactions
|
// 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' " .
|
"CONCAT(contacts.first_name, ' ', contacts.last_name) AS 'patron' " .
|
||||||
"FROM transaction_log, contacts WHERE paid=1 AND date!='NULL' " .
|
"FROM transaction_log, contacts WHERE paid=1 AND date!='NULL' " .
|
||||||
"AND (payment_type='cash' OR payment_type='check') " .
|
"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());
|
$sql2 = mysql_query($query, $YBDB) or die(mysql_error());
|
||||||
|
|
||||||
// third statement to find anonymous transactions
|
// 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' " .
|
"FROM transaction_log WHERE paid=1 AND date!='NULL' " .
|
||||||
"AND (payment_type='cash' OR payment_type='check') " .
|
"AND (payment_type='cash' OR payment_type='check') " .
|
||||||
"AND anonymous=1 " .
|
"AND anonymous=1 " .
|
||||||
@@ -484,6 +484,11 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
|
|||||||
|
|
||||||
// normal transaction
|
// normal transaction
|
||||||
while ( $result = mysql_fetch_assoc($sql2) ) {
|
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('/\n/', ' \r ', $result['description']);
|
||||||
$description = preg_replace('/\r/', '\r', $description);
|
$description = preg_replace('/\r/', '\r', $description);
|
||||||
$description = preg_replace('/,/', ';', $description);
|
$description = preg_replace('/,/', ';', $description);
|
||||||
@@ -492,13 +497,20 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
|
|||||||
}
|
}
|
||||||
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . ' ' . $check_number .
|
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . ' ' . $check_number .
|
||||||
',' . ' [' . $coordinator[$result['transaction_id']] . ' => ' . $result['patron'] . '] ' .
|
',' . ' [' . $coordinator[$result['transaction_id']] . ' => ' . $result['patron'] . '] ' .
|
||||||
$description . ' (Income:' . $result['transaction_type'] . ') ' .
|
$description . ' (Income:' . $result['transaction_type'] . ') ' .
|
||||||
|
' [O:' . $history[$key]->original_price . '; P:' . $history[$key]->amount .
|
||||||
|
'; R:' . $history[$key]->redeemed_hours . ']' .
|
||||||
', ' . $result['amount'] . ', ' .
|
', ' . $result['amount'] . ', ' .
|
||||||
$accounts_gnucash['checking'] . "\n";
|
$accounts_gnucash['checking'] . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// anonymous transaction
|
// anonymous transaction
|
||||||
while ( $result = mysql_fetch_assoc($sql3) ) {
|
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('/\n/', ' \r ', $result['description']);
|
||||||
$description = preg_replace('/\r/', '\r', $description);
|
$description = preg_replace('/\r/', '\r', $description);
|
||||||
$description = preg_replace('/,/', ';', $description);
|
$description = preg_replace('/,/', ';', $description);
|
||||||
@@ -508,6 +520,8 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
|
|||||||
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . ' ' . $check_number .
|
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . ' ' . $check_number .
|
||||||
',' . ' [' . $coordinator[$result['transaction_id']] . ' => Anonymous] ' .
|
',' . ' [' . $coordinator[$result['transaction_id']] . ' => Anonymous] ' .
|
||||||
$description . ' (Income:' . $result['transaction_type'] . ') ' .
|
$description . ' (Income:' . $result['transaction_type'] . ') ' .
|
||||||
|
' [O:' . $history[$key]->original_price . '; P:' . $history[$key]->amount .
|
||||||
|
'; R:' . $history[$key]->redeemed_hours . ']' .
|
||||||
', ' . $result['amount'] . ', ' .
|
', ' . $result['amount'] . ', ' .
|
||||||
$accounts_gnucash['checking'] . "\n";
|
$accounts_gnucash['checking'] . "\n";
|
||||||
}
|
}
|
||||||
@@ -539,7 +553,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// second statement to find normal transactions
|
// 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' " .
|
"CONCAT(contacts.first_name, ' ', contacts.last_name) AS 'patron' " .
|
||||||
"FROM transaction_log, contacts WHERE paid=1 AND date!='NULL' " .
|
"FROM transaction_log, contacts WHERE paid=1 AND date!='NULL' " .
|
||||||
"AND payment_type='credit' " .
|
"AND payment_type='credit' " .
|
||||||
@@ -548,7 +562,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
|
|||||||
$sql2 = mysql_query($query, $YBDB) or die(mysql_error());
|
$sql2 = mysql_query($query, $YBDB) or die(mysql_error());
|
||||||
|
|
||||||
// third statement to find anonymous transactions
|
// 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' " .
|
"FROM transaction_log WHERE paid=1 AND date!='NULL' " .
|
||||||
"AND payment_type='credit' " .
|
"AND payment_type='credit' " .
|
||||||
"AND anonymous=1 " .
|
"AND anonymous=1 " .
|
||||||
@@ -559,24 +573,38 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
|
|||||||
|
|
||||||
// normal transaction
|
// normal transaction
|
||||||
while ( $result = mysql_fetch_assoc($sql2) ) {
|
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('/\n/', ' \r ', $result['description']);
|
||||||
$description = preg_replace('/\r/', '\r', $description);
|
$description = preg_replace('/\r/', '\r', $description);
|
||||||
$description = preg_replace('/,/', ';', $description);
|
$description = preg_replace('/,/', ';', $description);
|
||||||
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] .
|
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] .
|
||||||
',' . ' [' . $coordinator[$result['transaction_id']] . ' => ' . $result['patron'] . '] ' .
|
',' . ' [' . $coordinator[$result['transaction_id']] . ' => ' . $result['patron'] . '] ' .
|
||||||
$description . ' (Income:' . $result['transaction_type'] . ') ' .
|
$description . ' (Income:' . $result['transaction_type'] . ') ' .
|
||||||
|
' [O:' . $history[$key]->original_price . '; P:' . $history[$key]->amount .
|
||||||
|
'; R:' . $history[$key]->redeemed_hours . ']' .
|
||||||
', ' . $result['amount'] . ', ' .
|
', ' . $result['amount'] . ', ' .
|
||||||
$accounts_gnucash['credit'] . "\n";
|
$accounts_gnucash['credit'] . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// anonymous transaction
|
// anonymous transaction
|
||||||
while ( $result = mysql_fetch_assoc($sql3) ) {
|
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('/\n/', ' \r ', $result['description']);
|
||||||
$description = preg_replace('/\r/', '\r', $description);
|
$description = preg_replace('/\r/', '\r', $description);
|
||||||
$description = preg_replace('/,/', ';', $description);
|
$description = preg_replace('/,/', ';', $description);
|
||||||
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] .
|
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] .
|
||||||
',' . ' [' . $coordinator[$result['transaction_id']] . ' => Anonymous] ' .
|
',' . ' [' . $coordinator[$result['transaction_id']] . ' => Anonymous] ' .
|
||||||
$description . ' (Income:' . $result['transaction_type'] . ') ' .
|
$description . ' (Income:' . $result['transaction_type'] . ') ' .
|
||||||
|
' [O:' . $history[$key]->original_price . '; P:' . $history[$key]->amount .
|
||||||
|
'; R:' . $history[$key]->redeemed_hours . ']' .
|
||||||
', ' . $result['amount'] . ', ' .
|
', ' . $result['amount'] . ', ' .
|
||||||
$accounts_gnucash['credit'] . "\n";
|
$accounts_gnucash['credit'] . "\n";
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -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),
|
("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),
|
("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),
|
("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),
|
("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),
|
("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),
|
("New Parts", 9, 1, 1, 1, 1, 0, 1, 1, 1, 1, "Sale Date", "Sold By"," ", "Sold To", 1, "Description", "Sales", 1, 0, 0),
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ $editFormAction_no_shopid = $_SERVER['PHP_SELF'] . "?shop_date=$shop_date";
|
|||||||
mysql_select_db($database_YBDB, $YBDB);
|
mysql_select_db($database_YBDB, $YBDB);
|
||||||
$query_Recordset1 = "SELECT shops.shop_id, date, DAYNAME(date) as day ,shop_location, shop_type, ip_address,
|
$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,
|
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
|
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
|
||||||
WHERE date <= '{$shop_date}' {$shop_dayname} GROUP BY shop_id
|
WHERE date <= '{$shop_date}' {$shop_dayname} GROUP BY shop_id
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ shops.shop_type as ShopType, ROUND(sum(t.amount),2) as Total, count(t.transactio
|
|||||||
FROM transaction_log t
|
FROM transaction_log t
|
||||||
LEFT JOIN shops ON t.shop_id=shops.shop_id
|
LEFT JOIN shops ON t.shop_id=shops.shop_id
|
||||||
LEFT JOIN transaction_types AS ttype ON t.transaction_type = ttype.transaction_type_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')
|
GROUP BY t.shop_id, date_format(t.date,'%m/%d/%Y')
|
||||||
ORDER BY t.date DESC, t.shop_id DESC;";
|
ORDER BY t.date DESC, t.shop_id DESC;";
|
||||||
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
|
$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 ?>
|
<?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 $row_Recordset1['ShopID']; ?></td>
|
<td><?php echo '<a href="/transaction_log.php?shop_id_search=' . $row_Recordset1['ShopID'] . '&record_count=500">' . $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>
|
||||||
|
|||||||
+93
-11
@@ -78,6 +78,39 @@ if($_GET['trans_type']=='all_types'){
|
|||||||
$trans_type_state = 'all_types';
|
$trans_type_state = 'all_types';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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 = '';
|
||||||
|
}
|
||||||
|
|
||||||
//record_count (SQL or state)
|
//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'];
|
||||||
@@ -88,6 +121,8 @@ if($_GET['record_count']>0){
|
|||||||
|
|
||||||
// create a string to remember state
|
// create a string to remember state
|
||||||
$search_state_array = array(
|
$search_state_array = array(
|
||||||
|
"search" => $search_state,
|
||||||
|
"contact_id_search" => $contact_id_state,
|
||||||
"trans_date" => $trans_date_state,
|
"trans_date" => $trans_date_state,
|
||||||
"trans_type" => $trans_type_state,
|
"trans_type" => $trans_type_state,
|
||||||
"shop_dayname" => $shop_dayname_state,
|
"shop_dayname" => $shop_dayname_state,
|
||||||
@@ -120,7 +155,7 @@ 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} ORDER BY transaction_id DESC LIMIT 0, $record_count;";
|
WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} {$contact_id} {$search} {$shop_id_search} ORDER BY transaction_id DESC LIMIT 0, $record_count;";
|
||||||
$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);
|
||||||
|
|
||||||
@@ -318,9 +353,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
|
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")) {
|
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
|
header(sprintf("Location: %s",$editFormAction )); //$editFormAction
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -680,14 +715,27 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
|
|||||||
|
|
||||||
if($result['anonymous']) {
|
if($result['anonymous']) {
|
||||||
echo "Anonymous";
|
echo "Anonymous";
|
||||||
|
$whoami = "Anonymous";
|
||||||
} else {
|
} else {
|
||||||
echo '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;" href="individual_history_log.php?contact_id=' .
|
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['contact_id'] . '">' .
|
||||||
$row_Recordset1['full_name'] . "</a>";
|
$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>";
|
||||||
}
|
}
|
||||||
?> </td>
|
?> </td>
|
||||||
|
|
||||||
<td <?php echo "title='Description: " . htmlspecialchars($row_Recordset1['description_with_locations'], ENT_QUOTES) . "'"; ?> ><?php echo $row_Recordset1['description_with_locations']; ?> </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; ?> </td>
|
||||||
<td><?php echo $row_Recordset1['payment_type']; ?> </td>
|
<td><?php echo $row_Recordset1['payment_type']; ?> </td>
|
||||||
<td <?php
|
<td <?php
|
||||||
$history = json_decode($row_Recordset1['history']);
|
$history = json_decode($row_Recordset1['history']);
|
||||||
@@ -699,19 +747,25 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
|
|||||||
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||||
$result = mysql_fetch_assoc($sql);
|
$result = mysql_fetch_assoc($sql);
|
||||||
if ( $history[$key]->original_price ) {
|
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" .
|
"Original Price: " . $history[$key]->original_price . "\r\n" .
|
||||||
"Paid: " . $history[$key]->amount . "\r\n" .
|
"Paid: " . $history[$key]->amount . "\r\n" .
|
||||||
"Redeemed Hours: " . floatval($history[$key]->redeemed_hours);
|
"Redeemed Hours: " . floatval($history[$key]->redeemed_hours);
|
||||||
echo "title='" . $title . "'";
|
echo "title='" . $title . "'";
|
||||||
} else {
|
} else {
|
||||||
$title = "Transaction Performed By: " . $result['full_name'];
|
$title = "Date: " . $history[$key]->date. "\r\n" .
|
||||||
|
"Transaction Performed By: " . $result['full_name'];
|
||||||
echo "title='" . $title . "'";
|
echo "title='" . $title . "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
><?php echo $row_Recordset1['format_amount']; ?> </td>
|
><?php echo $row_Recordset1['format_amount'];
|
||||||
|
if($row_Recordset1['transaction_type'] !== "Deposit" && $row_Recordset1['paid'] == 1) {
|
||||||
|
$total = $total + $row_Recordset1['amount'];
|
||||||
|
}
|
||||||
|
?> </td>
|
||||||
<td><?php $record_trans_id = $row_Recordset1['transaction_id'];
|
<td><?php $record_trans_id = $row_Recordset1['transaction_id'];
|
||||||
foreach ($_GET as $i => $value) {
|
foreach ($_GET as $i => $value) {
|
||||||
if ($i != "trans_id") {
|
if ($i != "trans_id") {
|
||||||
@@ -772,10 +826,32 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
|
|||||||
<input type="hidden" name="shop_visit_id" value="<?php echo $row_Recordset1['transaction_id']; ?>">
|
<input type="hidden" name="shop_visit_id" value="<?php echo $row_Recordset1['transaction_id']; ?>">
|
||||||
</form>
|
</form>
|
||||||
<?php } //while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); // while Recordset1 ?>
|
<?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>
|
</table> </tr>
|
||||||
|
|
||||||
<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 \>
|
<br \>
|
||||||
<label for="transaction_search" style="font-weight:bold;">Transaction Search:</label>
|
<label for="transaction_search" style="font-weight:bold;">Transaction Search:</label>
|
||||||
<br \>
|
<br \>
|
||||||
@@ -816,7 +892,12 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
|
|||||||
<option value="Sunday">Sunday</option>
|
<option value="Sunday">Sunday</option>
|
||||||
</select>
|
</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="submit" name="Submit" value="Submit" />
|
||||||
<input type="hidden" name="MM_insert" value="ChangeDate" />
|
<input type="hidden" name="MM_insert" value="ChangeDate" />
|
||||||
@@ -874,11 +955,12 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
|
|||||||
echo "<td td style='vertical-align:inherit;'><input id='gnucash_csv_submit' type='submit' name='Submit' /></td></tr></table></form>";
|
echo "<td td style='vertical-align:inherit;'><input id='gnucash_csv_submit' type='submit' name='Submit' /></td></tr></table></form>";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p> </p>
|
|
||||||
<?php include("include_footer.html"); ?>
|
<?php include("include_footer.html"); ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
mysql_free_result($Recordset1);
|
mysql_free_result($Recordset1);
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user