mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2026-09-03 02:11:38 -04:00
Adds initial Volunteer Hour logic and displays in transactions with title.
This commit is contained in:
+33
-3
@@ -76,8 +76,8 @@ $csv_directory = CSV_DIRECTORY;
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
// Membership and Volunteer Benefits
|
||||
if (isset($_POST['membership_and_volunteer_benefits'])) {
|
||||
// Membership Benefits
|
||||
if (isset($_POST['membership_benefits'])) {
|
||||
|
||||
$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,
|
||||
@@ -91,7 +91,37 @@ $csv_directory = CSV_DIRECTORY;
|
||||
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
$result = mysql_fetch_assoc($sql);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
// SELECT contact_id, full_name, normal_full_name, email, phone, visits, volunteer_hours FROM (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name, CONCAT(first_name, ' ', last_name) AS normal_full_name, contacts.email AS email, contacts.phone AS phone, COUNT(shop_hours.contact_id) as visits, ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS volunteer_hours FROM shop_hours LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id WHERE (SUBSTRING_INDEX(time_in, ' ', 1) >= DATE_SUB(CURDATE(),INTERVAL 365 DAY) AND SUBSTRING_INDEX(time_in, ' ', 1) <= DATE_SUB(CURDATE(), INTERVAL 0 DAY)) AND shop_user_roles.volunteer = 1 GROUP BY contact_id) AS members;
|
||||
|
||||
|
||||
} // Membership Benefits
|
||||
|
||||
// Volunteer Benefits
|
||||
if (isset($_POST['volunteer_benefits'])) {
|
||||
|
||||
$query = "SELECT contact_id, full_name, normal_full_name, email, phone, visits, volunteer_hours
|
||||
FROM (SELECT contacts.contact_id,
|
||||
CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
|
||||
CONCAT(first_name, ' ', last_name) AS normal_full_name,
|
||||
contacts.email AS email,
|
||||
contacts.phone AS phone,
|
||||
COUNT(shop_hours.contact_id) AS visits,
|
||||
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS volunteer_hours
|
||||
FROM shop_hours
|
||||
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
||||
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
|
||||
WHERE (SUBSTRING_INDEX(time_in, ' ', 1) >= DATE_SUB(CURDATE(),INTERVAL 365 DAY)
|
||||
AND SUBSTRING_INDEX(time_in, ' ', 1) <= DATE_SUB(CURDATE(), INTERVAL 0 DAY))
|
||||
AND shop_user_roles.volunteer = 1 AND contacts.contact_id=" .
|
||||
$_POST['contact_id'] .
|
||||
" GROUP BY contact_id) AS members;";
|
||||
|
||||
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
$result = mysql_fetch_assoc($sql);
|
||||
echo json_encode($result);
|
||||
|
||||
} // Volunteer Benefits
|
||||
|
||||
// Anonymous transaction - save and communicate back settings
|
||||
if(isset($_POST['anonymous'])) {
|
||||
|
||||
Reference in New Issue
Block a user