Browse Source

This should close #42.

devel
Jonathan Rosenbaum 6 years ago
parent
commit
97f02b6788
  1. 18
      stats/community_service_hours.php
  2. 2
      stats/paid_members.php
  3. 1
      stats/shops.php
  4. 14
      stats/stats_monthlysalestax.php
  5. 2
      stats/stats_paidstaffhours.php
  6. 2
      stats/stats_paidstaffhours_byPayPeriod.php
  7. 4
      stats/stats_usersbyweek.php
  8. 11
      stats/status_totals.php

18
stats/community_service_hours.php

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

2
stats/paid_members.php

@ -41,7 +41,7 @@ $query = "SELECT contact_id, full_name, normal_full_name, email, phone, sort_vis
CONCAT(first_name, ' ', last_name) AS normal_full_name,
contacts.email AS email, contacts.phone AS phone,
COUNT(shop_hours.contact_id) as sort_visits,
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS sort_hours
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS sort_hours
FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id

1
stats/shops.php

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

14
stats/stats_monthlysalestax.php

@ -37,13 +37,13 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<table id="monthlysalestax" border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="60" height="35">Year</td>
<td width="60">Month</td>
<td width="100">Total Sales</td>
<td width="110">Accounting Group</td>
<th width="120" height="35">Year</th>
<th width="60">Month</th>
<th width="100">Total Sales</th>
<th width="110">Accounting Group</th>
</tr>
<form method="post" name="FormUpdate_<?php echo $row_Recordset1['shop_id']; ?>" action="<?php echo $editFormAction; ?>">
<?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) { //do {
@ -62,9 +62,9 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
<?php } else { // end if EDIT RECORD ?>
<tr>
<td><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Month']; ?></td>
<td><?php echo $row_Recordset1['Month']; ?></td>
<td class="yb_standardRIGHT"><?php currency_format($row_Recordset1['TotalSales'],2);?></td>
<td>&nbsp;<?php echo $row_Recordset1['AccountingGroup']; ?></td>
<td><?php echo $row_Recordset1['AccountingGroup']; ?></td>
</tr>
<?php
} // end if EDIT RECORD

2
stats/stats_paidstaffhours.php

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

2
stats/stats_paidstaffhours_byPayPeriod.php

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

4
stats/stats_usersbyweek.php

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

11
stats/status_totals.php

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

Loading…
Cancel
Save