Browse Source

Fixes #38 with TIMEDIFF.

devel
Jonathan Rosenbaum 7 years ago
parent
commit
655d009766
  1. 9
      json/transaction.php
  2. 7
      start_shop.php

9
json/transaction.php

@ -114,7 +114,7 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
contacts.phone AS phone,
COUNT(shop_hours.contact_id) AS visits,
contacts.volunteer AS volunteer,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS volunteer_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS volunteer_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
@ -123,16 +123,17 @@ $membership_discount = MEMBERSHIP_DISCOUNT;
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);
// ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60))
// current year volunteer hours and visits
$query = "SELECT current_year_visits, current_year_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 current_year_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS current_year_volunteer_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS current_year_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

7
start_shop.php

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

Loading…
Cancel
Save