Browse Source

Makes css correct, and allows fine control for stats.

devel
Jonathan Rosenbaum 9 years ago
parent
commit
9ff3b1219f
  1. 39
      include_header_stats.html
  2. 2
      stats/stats_MechanicOperationMetrics_byMonth.php
  3. 2
      stats/stats_MechanicOperationMetrics_byWeek.php
  4. 2
      stats/stats_VolVsMechMetrics_byMonth.php
  5. 2
      stats/stats_VolVsMechMetrics_byWeek.php
  6. 2
      stats/stats_employeemetrics.php
  7. 2
      stats/stats_monthlysalestax.php
  8. 2
      stats/stats_monthlytransactiontotals.php
  9. 2
      stats/stats_monthlytransactiontotals_paid.php
  10. 2
      stats/stats_paidstaffhours.php
  11. 2
      stats/stats_paidstaffhours_byMonth.php
  12. 2
      stats/stats_paidstaffhours_byPayPeriod.php
  13. 2
      stats/stats_paidstaffhours_byWeek.php
  14. 2
      stats/stats_shoptransactiontotals.php
  15. 2
      stats/stats_shoptransactiontotals_byshop.php
  16. 2
      stats/stats_userhours.php
  17. 2
      stats/stats_userhours_season.php
  18. 11
      stats/stats_userhours_year.php
  19. 2
      stats/stats_usersbydayweek.php
  20. 2
      stats/stats_usersbyweek.php
  21. 144
      stats/status_totals.php

39
include_header_stats.html

@ -0,0 +1,39 @@
<script type="text/javascript">
var t;
window.onload=resetTimer;
document.onmousedown=resetTimer;
document.onkeypress=resetTimer;
function logout()
{
location.href='shop_welcome.php'
}
function resetTimer()
{
clearTimeout(t);
//t=setTimeout(logout,1000*240) //Shop welcome after 240 seconds of inactivity
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>YBDB</title>
<link href="../css/transactions.css" rel="stylesheet" type="text/css" />
<link href="../css/contacts.css" rel="stylesheet" type="text/css" />
<link href="../css/css_yb_standard.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-2.1.1.js"></script>
</head>
<body class="yb_standard">
<table align="center" width="1000" border="0" cellpadding="1" cellspacing="0">
<tr valign="top">
<td height="40" align="right"><a href="/shop_log.php">Current Shop</a> | <a href="/start_shop.php"> All Shops</a> | <a href="/contact_add_edit_select.php">Add/Edit Contact</a> | <a href="/stats.php">Statistics</a> | <a href="/transaction_log.php">Transaction Log</a> | <a href="http://www.positivespin.org" target="_blank">PS Home</a></td>
</tr>
<tr>
<td>

2
stats/stats_MechanicOperationMetrics_byMonth.php

@ -23,7 +23,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_MechanicOperationMetrics_byWeek.php

@ -23,7 +23,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_VolVsMechMetrics_byMonth.php

@ -34,7 +34,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_VolVsMechMetrics_byWeek.php

@ -34,7 +34,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_employeemetrics.php

@ -65,7 +65,7 @@ $row_Recordset1 = mysql_fetch_assoc($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr><td><?php echo "Employee Stats: <tr><td><?php echo "Employee Stats:

2
stats/stats_monthlysalestax.php

@ -29,7 +29,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_monthlytransactiontotals.php

@ -29,7 +29,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_monthlytransactiontotals_paid.php

@ -23,7 +23,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_paidstaffhours.php

@ -33,7 +33,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_paidstaffhours_byMonth.php

@ -23,7 +23,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"><td><span class="yb_heading3red">Staff Hours by Month</span></td></tr> <tr valign="top"><td><span class="yb_heading3red">Staff Hours by Month</span></td></tr>

2
stats/stats_paidstaffhours_byPayPeriod.php

@ -40,7 +40,7 @@ $totalRows_Recordset2 = mysql_num_rows($Recordset2);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"><td><span class="yb_heading3red">Staff Hours by Pay Period</span></td></tr> <tr valign="top"><td><span class="yb_heading3red">Staff Hours by Pay Period</span></td></tr>

2
stats/stats_paidstaffhours_byWeek.php

@ -23,7 +23,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"><td><span class="yb_heading3red">Staff Hours by Week</span></td></tr> <tr valign="top"><td><span class="yb_heading3red">Staff Hours by Week</span></td></tr>

2
stats/stats_shoptransactiontotals.php

@ -30,7 +30,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_shoptransactiontotals_byshop.php

@ -26,7 +26,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_userhours.php

@ -57,7 +57,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_userhours_season.php

@ -66,7 +66,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

11
stats/stats_userhours_year.php

@ -16,7 +16,9 @@ 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(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS sort_hours
FROM shop_hours FROM shop_hours
@ -25,6 +27,7 @@ LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_us
WHERE shop_user_roles.volunteer = 1 AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH) WHERE shop_user_roles.volunteer = 1 AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH)
GROUP BY contact_id 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(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS th_hours
@ -33,6 +36,7 @@ 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
GROUP BY contacts.contact_id 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(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh_hours
@ -42,6 +46,7 @@ LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_us
WHERE shop_user_roles.volunteer = 1 WHERE shop_user_roles.volunteer = 1
GROUP BY contacts.contact_id 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(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS th3_hours
@ -51,6 +56,7 @@ LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_us
WHERE time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH) WHERE time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH)
GROUP BY contacts.contact_id 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(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh3_hours
@ -60,13 +66,14 @@ LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_us
WHERE shop_user_roles.volunteer = 1 AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH) WHERE shop_user_roles.volunteer = 1 AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH)
GROUP BY contacts.contact_id GROUP BY contacts.contact_id
ORDER BY first_name) AS volunteer_hours3 ON sort_hours.contact_id = volunteer_hours3.vh3_contact_id"; ORDER BY first_name) AS volunteer_hours3 ON sort_hours.contact_id = volunteer_hours3.vh3_contact_id";
$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); //Wait to fetch until do loop //$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1);
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">

2
stats/stats_usersbydayweek.php

@ -36,7 +36,7 @@ function print_table_daysofweek($year, $week, $total_visits, $new_visits){
?> ?>
<?php include("../include_header.html"); ?> <?php include("../include_header_stats.html"); ?>
<table width="100%"> <table width="100%">
<tr valign="top"> <tr valign="top">
<td><span class="yb_heading3red">New and Total Users by Day/Week</span></td> <td><span class="yb_heading3red">New and Total Users by Day/Week</span></td>

2
stats/stats_usersbyweek.php

@ -52,7 +52,7 @@ $totalRows_Recordset4 = mysql_num_rows($Recordset4);
?> ?>
<?php include("../../include_header.html"); ?> <?php include("../../include_header_stats.html"); ?>
<table> <table>
<tr valign="top"> <tr valign="top">
<td><span class="yb_heading3red">New and Total Users by Week</span></td> <td><span class="yb_heading3red">New and Total Users by Week</span></td>

144
stats/status_totals.php

@ -0,0 +1,144 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
// ** ALTER TABLE shop_user_roles ADD other_volunteer tinyint(1) NOT NULL DEFAULT '0';
// UPDATE shop_user_roles SET other_volunteer=1 WHERE shop_user_role_id="Student Volunteer/Community Service Hours";
// SELECT shop_user_role_id FROM shop_user_roles WHERE volunteer=1 AND other_volunteer!=1;;
/*
+-------------------------------------------+-------------------+------------------+-----------------+
| shop_user_role | unique_volunteers | volunteer_visits | volunteer_hours |
+-------------------------------------------+-------------------+------------------+-----------------+
| Volunteer | 103 | 425 | 1347 |
| Coordinator | 7 | 238 | 1005 |
| Greeter | 7 | 62 | 188 |
| Student Volunteer/Community Service Hours | 13 | 53 | 136 |
+-------------------------------------------+-------------------+------------------+-----------------+
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
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 shop_user_roles.volunteer = 1
OR shop_user_roles.other_volunteer = 1
AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH) GROUP BY shop_user_role
ORDER BY volunteer_hours DESC;
+----------------+-----------------+--------+-------+
| shop_user_role | unique_visitors | visits | hours |
+----------------+-----------------+--------+-------+
| Personal | 141 | 303 | 679 |
| Shopping | 61 | 66 | 48 |
+----------------+-----------------+--------+-------+
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
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 shop_user_roles.volunteer = 0
AND shop_user_roles.other_volunteer = 0
AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH) GROUP BY shop_user_role
ORDER BY hours DESC;
+-------------------+------------------+-----------------+
| unique_volunteers | volunteer_visits | volunteer_hours |
+-------------------+------------------+-----------------+
| 114 | 778 | 2676 |
+-------------------+------------------+-----------------+
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
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 shop_user_roles.volunteer = 1
OR shop_user_roles.other_volunteer = 1
AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH);
+-----------------+--------+-------+
| unique_visitors | visits | hours |
+-----------------+--------+-------+
| 188 | 369 | 727 |
+-----------------+--------+-------+
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
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 shop_user_roles.volunteer = 0
AND shop_user_roles.other_volunteer = 0
AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH);
*/
?>
<?php include("../include_header_stats.html"); ?>
<link rel="stylesheet" type="text/css" href="../css/mystyle.css">
<table id="shop_log">
<tr valign="top">
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#99CC33" class="yb_standardCENTERbold">
<td colspan="4" height="25">Volunteers</td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="relative">Shop Roles<br /></td>
<td width="relative">Unique Volunteers<br /></td>
<td width="relative">Volunteer Visits<br /></td>
<td width="relative">Volunteer Hours</td>
</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 {
if(1 == 2) {?>
<tr valign="bottom" bgcolor="#CCCC33">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<input type="hidden" name="MM_insert" value="FormEdit">
<input type="hidden" name="shop_id" value="<?php echo $row_Recordset1['shop_id']; ?>">
</form>
<?php } else { // end if EDIT RECORD ?>
<tr>
<td><a href="<?php echo "{$page_individual_history_log}?contact_id=" . $row_Recordset1['contact_id']; ?>"><?php echo $row_Recordset1['full_name']; ?></a></td>
<td class="yb_standardRIGHTred">&nbsp;<?php echo number_format($row_Recordset1['vh3_hours'],0); ?></td>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['th3_hours'],0); ?></td>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['th3_visits'],0); ?></td>
<td class="yb_standardRIGHTred">&nbsp;<?php echo number_format($row_Recordset1['vh_hours'],0); ?></td>
</tr>
<?php
} // end if EDIT RECORD
} // end WHILE count of recordset ?>
</table> </td>
</tr>
</table>
<?php include("../include_footer.html"); ?>
<?php
mysql_free_result($Recordset1);
?>
Loading…
Cancel
Save