Browse Source

Puts stat files in their own directory to make things cleaner; deletes *zip

devel
Jonathan Rosenbaum 10 years ago
parent
commit
64b06c541d
  1. BIN
      YBDB-July-24-2014.zip
  2. 27
      stats.php
  3. 110
      stats/stats_MechanicOperationMetrics_byMonth.php
  4. 110
      stats/stats_MechanicOperationMetrics_byWeek.php
  5. 109
      stats/stats_VolVsMechMetrics_byMonth.php
  6. 109
      stats/stats_VolVsMechMetrics_byWeek.php
  7. 125
      stats/stats_employeemetrics.php
  8. 78
      stats/stats_monthlysalestax.php
  9. 83
      stats/stats_monthlytransactiontotals.php
  10. 77
      stats/stats_monthlytransactiontotals_paid.php
  11. 80
      stats/stats_paidstaffhours.php
  12. 71
      stats/stats_paidstaffhours_byMonth.php
  13. 92
      stats/stats_paidstaffhours_byPayPeriod.php
  14. 71
      stats/stats_paidstaffhours_byWeek.php
  15. 84
      stats/stats_shoptransactiontotals.php
  16. 76
      stats/stats_shoptransactiontotals_byshop.php
  17. 122
      stats/stats_userhours.php
  18. 131
      stats/stats_userhours_season.php
  19. 131
      stats/stats_userhours_year.php
  20. 93
      stats/stats_usersbydayweek.php
  21. 121
      stats/stats_usersbyweek.php
  22. 110
      stats_MechanicOperationMetrics_byMonth.php
  23. 110
      stats_MechanicOperationMetrics_byWeek.php
  24. 109
      stats_VolVsMechMetrics_byMonth.php
  25. 109
      stats_VolVsMechMetrics_byWeek.php
  26. 125
      stats_employeemetrics.php
  27. 78
      stats_monthlysalestax.php
  28. 83
      stats_monthlytransactiontotals.php
  29. 77
      stats_monthlytransactiontotals_paid.php
  30. 80
      stats_paidstaffhours.php
  31. 71
      stats_paidstaffhours_byMonth.php
  32. 92
      stats_paidstaffhours_byPayPeriod.php
  33. 71
      stats_paidstaffhours_byWeek.php
  34. 84
      stats_shoptransactiontotals.php
  35. 76
      stats_shoptransactiontotals_byshop.php
  36. 122
      stats_userhours.php
  37. 131
      stats_userhours_season.php
  38. 131
      stats_userhours_year.php
  39. 93
      stats_usersbydayweek.php
  40. 121
      stats_usersbyweek.php

BIN
YBDB-July-24-2014.zip

Binary file not shown.

27
stats.php

File diff suppressed because one or more lines are too long

110
stats/stats_MechanicOperationMetrics_byMonth.php

@ -0,0 +1,110 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM view_MechanicOperationMetrics_byMonth;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Mechanic Operation Metrics by Month</span></td>
</tr>
<tr valign="top">
<td>View Hours by: <a href="stats_MechanicOperationMetrics_byWeek.php">Week</a>, Month
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#E6E6E6" class="yb_standardCENTERbold">
<td height="25" colspan="2">Time Period</td>
<td height="25" colspan="2">Payroll</td>
<td height="25" colspan="6">Operation Net Income Calc</td>
<td height="25" colspan="3">Bike Production</td>
<td height="25" colspan="2">Bike Sales</td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="60" height="35">Year</td>
<td width="60">Month</td>
<td width="60">Hours</td>
<td width="100">Pay</td>
<td width="100">Net Sales New Parts</td>
<td width="100">Sales Used Parts</td>
<td width="100">Value Of Bikes Completed</td>
<td width="100">Value Of Wheels Completed</td>
<td width="100">Value Of New Parts on Bikes</td>
<td width="100" class=yb_standardBold>Est Net Income</td>
<td width="100"># Bikes Fixed</td>
<td width="100">Avg Hours Per Bike Fixed</td>
<td width="100">Avg Bike Price</td>
<td width="100">Value of Bikes Sold</td>
<td width="100"># Bikes Sold</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>
<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 class="yb_standardRIGHT">
<td><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Month']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Hours']; ?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['Pay'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['NetSalesNewParts'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['SalesUsedParts'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['ValueBikesFixed'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['ValueWheelsFixed'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['ValueNewPartsOnBikes'],0);?></td>
<td class=yb_standardBold>&nbsp;<?php currency_format($row_Recordset1['EstimatedNetIncome'],0);?></td>
<td>&nbsp;<?php echo $row_Recordset1['TotalBikesFixed']; ?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['HoursPerBike'],1); ?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['AverageBikeValue'],0); ?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['SalesBikes'],0);?></td>
<td>&nbsp;<?php echo $row_Recordset1['TotalBikesSold']; ?></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);
?>

110
stats/stats_MechanicOperationMetrics_byWeek.php

@ -0,0 +1,110 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM view_MechanicOperationMetrics_byWeek;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Mechanic Operation Metrics by Week</span></td>
</tr>
<tr valign="top">
<td>View Hours by: Week, <a href="stats_MechanicOperationMetrics_byMonth.php">Month</a>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#E6E6E6" class="yb_standardCENTERbold">
<td height="25" colspan="2">Time Period</td>
<td height="25" colspan="2">Payroll</td>
<td height="25" colspan="6">Operation Net Income Calc</td>
<td height="25" colspan="3">Bike Production</td>
<td height="25" colspan="2">Bike Sales</td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="60" height="35">Year</td>
<td width="60">Week</td>
<td width="60">Hours</td>
<td width="100">Pay</td>
<td width="100">Net Sales New Parts</td>
<td width="100">Sales Used Parts</td>
<td width="100">Value Of Bikes Completed</td>
<td width="100">Value Of Wheels Completed</td>
<td width="100">Value Of New Parts on Bikes</td>
<td width="100" class=yb_standardBold>Est Net Income</td>
<td width="100"># Bikes Fixed</td>
<td width="100">Avg Hours Per Bike Fixed</td>
<td width="100">Avg Bike Price</td>
<td width="100">Value of Bikes Sold</td>
<td width="100"># Bikes Sold</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>
<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 class="yb_standardRIGHT">
<td><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Week']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Hours']; ?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['Pay'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['NetSalesNewParts'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['SalesUsedParts'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['ValueBikesFixed'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['ValueWheelsFixed'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['ValueNewPartsOnBikes'],0);?></td>
<td class=yb_standardBold>&nbsp;<?php currency_format($row_Recordset1['EstimatedNetIncome'],0);?></td>
<td>&nbsp;<?php echo $row_Recordset1['TotalBikesFixed']; ?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['HoursPerBike'],1); ?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['AverageBikeValue'],0); ?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['SalesBikes'],0);?></td>
<td>&nbsp;<?php echo $row_Recordset1['TotalBikesSold']; ?></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);
?>

109
stats/stats_VolVsMechMetrics_byMonth.php

@ -0,0 +1,109 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT v.Year, v.Month, (v.NetSalesNewParts + v.SalesUsedParts + v.SalesBikes) as VolSales,
(m.NetSalesNewParts + m.SalesUsedParts + m.SalesBikes) as MechSales,
(v.NetSalesNewParts + v.SalesUsedParts + v.SalesBikes + if( m.SalesUsedParts is null,0,m.NetSalesNewParts + m.SalesUsedParts + m.SalesBikes)) as TotalSales,
v.TotalBikesSold as VolBikesSold,
m.TotalBikesSold as MechBikesSold,
v.TotalBikesSold + if(m.TotalBikesSold is null,0,m.TotalBikesSold) as TotalBikesSold,
if(m.TotalBikesSold is null, 1,0) as test,
m.ValueBikesFixed as MechValueBikesFixed,
m.TotalBikesFixed as MechBikesFixed
FROM view_Transactions_VolRunShop_byMonth_pvTbl v
LEFT JOIN view_Transactions_MechOper_byMonth_pvTbl as m on v.Year = m.Year AND v.Month = m.Month
ORDER BY v.Year DESC, v.Month DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Volunteer vs. Mechanic Operation Metrics by Month</span></td>
</tr>
<tr valign="top">
<td>View Hours by: <a href="stats_VolVsMechMetrics_byWeek.php">Week</a>, Month
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#E6E6E6" class="yb_standardCENTERbold">
<td height="25" colspan="2">Time Period</td>
<td height="25" colspan="3">All Sales</td>
<td height="25" colspan="3">Number of Bikes</td>
<td height="25" colspan="2">Mechanic Bikes Fixed</td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Year</td>
<td width="100">Month</td>
<td width="100">Volunteer</td>
<td width="100">MechOper</td>
<td width="100">Total</td>
<td width="100">Volunteer</td>
<td width="100">MechOper</td>
<td width="100">Total</td>
<td width="100">Value</td>
<td width="100">Number</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>
<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 class="yb_standardRIGHT">
<td><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Month']; ?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['VolSales'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['MechSales'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['TotalSales'],0);?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['VolBikesSold'],0);?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['MechBikesSold'],0);?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['TotalBikesSold'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['MechValueBikesFixed'],0); ?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['MechBikesFixed'],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);
?>

109
stats/stats_VolVsMechMetrics_byWeek.php

@ -0,0 +1,109 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT v.Year, v.Week, (v.NetSalesNewParts + v.SalesUsedParts + v.SalesBikes) as VolSales,
(m.NetSalesNewParts + m.SalesUsedParts + m.SalesBikes) as MechSales,
(v.NetSalesNewParts + v.SalesUsedParts + v.SalesBikes + if( m.SalesUsedParts is null,0,m.NetSalesNewParts + m.SalesUsedParts + m.SalesBikes)) as TotalSales,
v.TotalBikesSold as VolBikesSold,
m.TotalBikesSold as MechBikesSold,
v.TotalBikesSold + if(m.TotalBikesSold is null,0,m.TotalBikesSold) as TotalBikesSold,
if(m.TotalBikesSold is null, 1,0) as test,
m.ValueBikesFixed as MechValueBikesFixed,
m.TotalBikesFixed as MechBikesFixed
FROM view_Transactions_VolRunShop_byWeek_pvTbl v
LEFT JOIN view_Transactions_MechOper_byWeek_pvTbl as m on v.Year = m.Year AND v.Week = m.Week
ORDER BY v.Year DESC, v.Week DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Volunteer vs. Mechanic Operation Metrics by Week</span></td>
</tr>
<tr valign="top">
<td>View Hours by: Week, <a href="stats_VolVsMechMetrics_byMonth.php">Month</a>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#E6E6E6" class="yb_standardCENTERbold">
<td height="25" colspan="2">Time Period</td>
<td height="25" colspan="3">All Sales</td>
<td height="25" colspan="3">Number of Bikes</td>
<td height="25" colspan="2">Mechanic Bikes Fixed</td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Year</td>
<td width="100">Week</td>
<td width="100">Volunteer</td>
<td width="100">MechOper</td>
<td width="100">Total</td>
<td width="100">Volunteer</td>
<td width="100">MechOper</td>
<td width="100">Total</td>
<td width="100">Value</td>
<td width="100">Number</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>
<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 class="yb_standardRIGHT">
<td><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Week']; ?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['VolSales'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['MechSales'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['TotalSales'],0);?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['VolBikesSold'],0);?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['MechBikesSold'],0);?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['TotalBikesSold'],0);?></td>
<td>&nbsp;<?php currency_format($row_Recordset1['MechValueBikesFixed'],0); ?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['MechBikesFixed'],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);
?>

125
stats/stats_employeemetrics.php

@ -0,0 +1,125 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
$page = "stats_employeemetrics.php";
switch ($_GET['metric']) {
case 'OutputValueVsPayRatio':
$metric = $_GET['metric'];
$title = "Value Ratio - (Value of Bikes + Wheels Completed)/Pay";
break;
case 'HoursPerBike': //this is a sample error message. insert error case here
$metric = $_GET['metric'];
$title = "Hours Per Bike";
break;
case 'NumBikes': //this is a sample error message. insert error case here
$metric = $_GET['metric'];
$title = "Total Number of Bikes";
break;
case 'AverageBikePrice': //this is a sample error message. insert error case here
$metric = $_GET['metric'];
$title = "Average Bike Price";
break;
case 'NumWheels': //this is a sample error message. insert error case here
$metric = $_GET['metric'];
$title = "Number of Wheels";
break;
case 'AverageWheelPrice': //this is a sample error message. insert error case here
$metric = $_GET['metric'];
$title = "Average Wheel Price";
break;
default:
$metric = 'OutputValueVsPayRatio';
$title = "Value Ratio - (Value of Bikes + Wheels Completed)/Pay";
break;
}
switch ($_GET['period']) {
case 'Month':
$period = $_GET['period'];
break;
case 'Week': //this is a sample error message. insert error case here
$period = $_GET['period'];
break;
default:
$period = 'Month';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "select v.Year AS Year,v.$period AS $period,
max(if((v2.ContactID = 10019),v2.$metric,0)) AS BW,
max(if((v2.ContactID = 4009),v2.$metric,0)) AS Conti,
max(if((v2.ContactID = 107),v2.$metric,0)) AS Pete,
max(if((v2.ContactID = 554),v2.$metric,0)) AS Savanna,
max(if((v2.ContactID = 1755),v2.$metric,0)) AS John
from (view_EmployeeMetrics_TotalsBy$period v
left join view_EmployeeMetrics_TotalsBy$period v2 on(((v.Year = v2.Year) and (v.$period = v2.$period))))
group by `v`.`Year` DESC,`v`.`$period` DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr><td><?php echo "Employee Stats:
<a href=\"$page?metric=OutputValueVsPayRatio&period=$period\">ValueRatio</a>,
<a href=\"$page?metric=HoursPerBike&period=$period\">Hours Per Bike</a>,
<a href=\"$page?metric=NumBikes&period=$period\">Number of Bikes</a>,
<a href=\"$page?metric=AverageBikePrice&period=$period\">Average Bike Price</a>,
<a href=\"$page?metric=NumWheels&period=$period\">Number of Wheels</a>,
<a href=\"$page?metric=AverageWheelPrice&period=$period\">Avg Wheel Price</a>
<br/>View by: <a href=\"$page?metric=$metric&period=Month\">Month</a>,
<a href=\"$page?metric=$metric&period=Week\">Week</a>"?></td></tr>
<tr valign="top"><td><span class="yb_heading3red"><?php echo $title; ?></span></td></tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Year</td>
<td width="100"><?php echo $period?></td>
<td width="100">BW<br />
<td width="100">Conti<br />
<td width="100">John<br />
<td width="100">Pete<br />
<td width="100">Savanna<br />
</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>
</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 class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Year']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1["$period"]; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['BW']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Conti']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['John']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Pete']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Savanna']; ?></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);
?>

78
stats/stats_monthlysalestax.php

@ -0,0 +1,78 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT year(t.date) as Year,quarter(t.date) as Quarter, month(t.date) as Month, round(sum(amount),2) as TotalSales, tt.accounting_group as AccountingGroup
FROM transaction_log t
LEFT JOIN transaction_types tt ON t.transaction_type = tt.transaction_type_id
WHERE tt.accounting_group = 'Sales'
GROUP BY year(t.date), month(t.date)
ORDER BY year(t.date) DESC, month(t.date) DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Monthly Sales Tax Report</span> - Includes Volunteer and Paid Shop Sales</td>
</tr>
<tr>
<td>
<table 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>
</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>
</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><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?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>
</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);
?>

83
stats/stats_monthlytransactiontotals.php

@ -0,0 +1,83 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT year(t.date) as Year, quarter(t.date) as Quarter, month(t.date) as Month,t.transaction_type as TransactionType, ROUND(sum(t.amount),2) as Total, count(t.transaction_id) as CountOfTrans, transaction_types.accounting_group as AccountingGroup
FROM transaction_log t
LEFT JOIN transaction_types ON t.transaction_type = transaction_types.transaction_type_id
LEFT JOIN shops ON t.shop_id = shops.shop_id
WHERE shop_type is null OR shop_type <> 'Mechanic Operation Shop'
GROUP BY transaction_types.accounting_group, t.transaction_type, year(t.date), quarter(t.date), month(t.date)
ORDER BY year(t.date) DESC, quarter(t.date) DESC, month(t.date) DESC, transaction_types.accounting_group, t.transaction_id;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Monthly Transaction Totals</span></td>
</tr>
<tr>
<td>
<table 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="400">Transaction Type</td>
<td width="100">Total</td>
<td width="50">Count</td>
<td width="200">Accounting Group</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>
</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><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Month']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['TransactionType']; ?></td>
<td class="yb_standardRIGHT"><?php echo currency_format($row_Recordset1['Total'],2);?></td>
<td class="yb_standardRIGHT"><?php echo $row_Recordset1['CountOfTrans']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['AccountingGroup']; ?></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);
?>

77
stats/stats_monthlytransactiontotals_paid.php

@ -0,0 +1,77 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM view_Transactions_MechOper_byMonth;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Monthly Transaction Totals</span></td>
</tr>
<tr>
<td>
<table 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="400">Transaction Type</td>
<td width="100">Total</td>
<td width="100">Count of Transactions</td>
<td width="200">Accounting Group</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>
</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><?php echo $row_Recordset1['Year']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['Month']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['TransactionType']; ?></td>
<td class="yb_standardRIGHT"><?php currency_format($row_Recordset1['Total'],2);?></td>
<td class="yb_standardRIGHT"><?php echo $row_Recordset1['Count']; ?></td>
<td>&nbsp;<?php echo $row_Recordset1['AccountingGroup']; ?></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);
?>

80
stats/stats_paidstaffhours.php

@ -0,0 +1,80 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$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
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_hours.shop_user_role = 'Paid Mechanic'
GROUP BY Year, PayPeriod, ContactID
ORDER BY Year, PayPeriod, last_name, first_name) AS total_hours;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td align="left"><span class="yb_heading3red">Hours by User</span></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Year</td>
<td width="100">PayPeriod</td>
<td width="200">Name<br />
<td width="100">Hours<br />
</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>
</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 class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Year']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['PayPeriod']; ?></td>
<td><a href="<?php echo "{$page_individual_history_log}?contact_id=" . $row_Recordset1['ContactID']; ?>"><?php echo $row_Recordset1['Name']; ?></a></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Hours']; ?></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);
?>

71
stats/stats_paidstaffhours_byMonth.php

@ -0,0 +1,71 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM view_EmployeeHours_byMonth;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top"><td><span class="yb_heading3red">Staff Hours by Month</span></td></tr>
<tr>
<td>View Hours by: <a href="stats_paidstaffhours_byPayPeriod.php">PayPeriod</a>, <a href="stats_paidstaffhours_byWeek.php">Week</a>, <a href="stats_paidstaffhours_byMonth.php">Month</a></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Year</td>
<td width="100">Month</td>
<td width="200">Name<br />
<td width="100">Hours<br />
</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>
</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 class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Year']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Month']; ?></td>
<td><a href="<?php echo "{$page_individual_history_log}?contact_id=" . $row_Recordset1['ContactID']; ?>"><?php echo $row_Recordset1['Name']; ?></a></td>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['Hours'],2); ?></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);
?>

92
stats/stats_paidstaffhours_byPayPeriod.php

@ -0,0 +1,92 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$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
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`.`paid` = 1
GROUP BY Year, PayPeriod, ContactID
ORDER BY Year DESC, PayPeriod DESC, last_name, first_name) AS total_hours;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$query_Recordset2 = "SELECT d.Date, IF(Week(d.date) DIV 2 <>0,Year(d.date),Year(d.date)-1) as Year,
IF(Week(d.date) DIV 2 <>0,Week(d.date) DIV 2,26 ) as PayPeriod
FROM (SELECT curdate() as Date) as d;";
$Recordset2 = mysql_query($query_Recordset2, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top"><td><span class="yb_heading3red">Staff Hours by Pay Period</span></td></tr>
<tr>
<td>View Hours by: <a href="stats_paidstaffhours_byPayPeriod.php">PayPeriod</a>, <a href="stats_paidstaffhours_byWeek.php">Week</a>, <a href="stats_paidstaffhours_byMonth.php">Month</a></td>
</tr>
<tr valign="top">
<?php $row_Recordset2 = mysql_fetch_assoc($Recordset2) ?>
<td align="left">Current Date: <?php echo $row_Recordset2['Date']; ?> | Pay Period Year: <?php echo $row_Recordset2['Year']; ?> | Pay Period: <?php echo $row_Recordset2['PayPeriod']; ?> </td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Year</td>
<td width="100">Pay Period</td>
<td width="200">Name<br />
<td width="100">Hours<br />
</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>
</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 class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Year']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['PayPeriod']; ?></td>
<td><a href="<?php echo "{$page_individual_history_log}?contact_id=" . $row_Recordset1['ContactID']; ?>"><?php echo $row_Recordset1['Name']; ?></a></td>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['Hours'],2); ?></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);
?>

71
stats/stats_paidstaffhours_byWeek.php

@ -0,0 +1,71 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM view_EmployeeHours_byWeek;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top"><td><span class="yb_heading3red">Staff Hours by Week</span></td></tr>
<tr>
<td>View Hours by: <a href="stats_paidstaffhours_byPayPeriod.php">PayPeriod</a>, <a href="stats_paidstaffhours_byWeek.php">Week</a>, <a href="stats_paidstaffhours_byMonth.php">Month</a></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Year</td>
<td width="100">Week</td>
<td width="200">Name<br />
<td width="100">Hours<br />
</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>
</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 class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Year']; ?></td>
<td class="yb_standardCENTER">&nbsp;<?php echo $row_Recordset1['Week']; ?></td>
<td><a href="<?php echo "{$page_individual_history_log}?contact_id=" . $row_Recordset1['ContactID']; ?>"><?php echo $row_Recordset1['Name']; ?></a></td>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['Hours'],2); ?></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);
?>

84
stats/stats_shoptransactiontotals.php

@ -0,0 +1,84 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT t.shop_id as ShopID , date_format(t.date,'%m/%d/%Y') as ShopDate, dayname(t.date) as Day,
shops.shop_type as ShopType, ROUND(sum(t.amount),2) as Total, count(t.transaction_id) as CountOfTrans
FROM transaction_log t
LEFT JOIN shops ON t.shop_id=shops.shop_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'
GROUP BY t.shop_id, date_format(t.date,'%m/%d/%Y')
ORDER BY t.date DESC, t.shop_id DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Shop Transaction Totals</span> - Total includes sales and cash donations</td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Date</td>
<td width="100" height="35">ShopID</td>
<td width="100">Day</td>
<td width="200">Shop Type</td>
<td width="100">Total</td>
<td width="100">Count of Transactions</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>
</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><?php echo $row_Recordset1['ShopDate']; ?></td>
<td><?php echo $row_Recordset1['ShopID']; ?></td>
<td valign="middle"><?php echo $row_Recordset1['Day']; ?></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 echo $row_Recordset1['CountOfTrans']; ?></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);
?>

76
stats/stats_shoptransactiontotals_byshop.php

@ -0,0 +1,76 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT t.shop_id as ShopID, date_format(t.date,'%m/%d/%Y') as ShopDate, dayname(t.date) as Day, ROUND(sum(t.amount),2) as Total, count(t.transaction_id) as CountOfTrans
FROM transaction_log t
GROUP BY t.shop_id, date_format(t.date,'%m/%d/%Y')
ORDER BY t.date DESC, t.shop_id DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td align="left"><span class="yb_heading3red">Shop Transaction Totals</span> | <a href="stats.php">Back to Stats Page </a></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="100" height="35">Date</td>
<td width="100" height="35">ShopID</td>
<td width="100">Day</td>
<td width="100">Total</td>
<td width="100">Count of Transactions</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>
</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><?php echo $row_Recordset1['ShopDate']; ?></td>
<td><?php echo $row_Recordset1['ShopID']; ?></td>
<td valign="middle"><?php echo $row_Recordset1['Day']; ?></td>
<td><?php echo "$"; if(is_null($row_Recordset1['Total'])) echo 0.00; else echo $row_Recordset1['Total'];?></td>
<td><?php echo $row_Recordset1['CountOfTrans']; ?></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);
?>

122
stats/stats_userhours.php

@ -0,0 +1,122 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT * FROM (SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
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
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
GROUP BY contact_id
ORDER BY last_name, first_name) AS total_hours
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
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
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
GROUP BY contacts.contact_id
ORDER BY last_name, first_name) AS volunteer_hours ON total_hours.contact_id = volunteer_hours.vh_contact_id
LEFT JOIN (SELECT contacts.contact_id AS th3_contact_id,
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
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 3 MONTH)
GROUP BY contacts.contact_id
ORDER BY last_name, first_name) AS total_hours3 ON total_hours.contact_id = total_hours3.th3_contact_id
LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id,
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
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 AND time_in > DATE_SUB(CURDATE(),INTERVAL 3 MONTH)
GROUP BY contacts.contact_id
ORDER BY last_name, first_name) AS volunteer_hours3 ON total_hours.contact_id = volunteer_hours3.vh3_contact_id";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Hours by User</span></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#99CC33" class="yb_standardCENTERbold">
<td height="25">Shop User </td>
<td height="25" colspan="3"> Last 3 Months </td>
<td height="25" colspan="3">Lifetime</td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="200" height="35"></td>
<td width="100">Volunteer<br />
Hours</td>
<td width="100">Total<br />
Hours</td>
<td width="100">Visits</td>
<td width="100">Volunteer<br />
Hours</td>
<td width="100">Total<br />
Hours</td>
<td width="100">Visits</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); ?></span></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); ?></span></td>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['th_hours'],0); ?></td>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['th_visits'],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);
?>

131
stats/stats_userhours_season.php

@ -0,0 +1,131 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$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,
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
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 AND time_in > DATE_SUB(CURDATE(),INTERVAL 3 MONTH)
GROUP BY contact_id
ORDER BY sort_hours DESC) AS sort_hours
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
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
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
GROUP BY contacts.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,
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
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
GROUP BY contacts.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,
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
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 3 MONTH)
GROUP BY contacts.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,
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
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 AND time_in > DATE_SUB(CURDATE(),INTERVAL 3 MONTH)
GROUP BY contacts.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());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Hours by User</span></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#99CC33" class="yb_standardCENTERbold">
<td height="25">Shop User </td>
<td height="25" colspan="3"> Last 3 Months </td>
<td height="25" colspan="3">Lifetime</td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="200" height="35"></td>
<td width="100">Volunteer<br />
Hours</td>
<td width="100">Total<br />
Hours</td>
<td width="100">Visits</td>
<td width="100">Volunteer<br />
Hours</td>
<td width="100">Total<br />
Hours</td>
<td width="100">Visits</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>
<td class="yb_standardRight">&nbsp;<?php echo number_format($row_Recordset1['th_hours'],0); ?></td>
<td class="yb_standardRight">&nbsp;<?php echo number_format($row_Recordset1['th_visits'],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);
?>

131
stats/stats_userhours_year.php

@ -0,0 +1,131 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
$page_individual_history_log = INDIVIDUAL_HISTORY_LOG;
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$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,
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
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 AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH)
GROUP BY contact_id
ORDER BY sort_hours DESC) AS sort_hours
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
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
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
GROUP BY contacts.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,
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
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
GROUP BY contacts.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,
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
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 12 MONTH)
GROUP BY contacts.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,
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
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 AND time_in > DATE_SUB(CURDATE(),INTERVAL 12 MONTH)
GROUP BY contacts.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());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">Hours by User</span></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#99CC33" class="yb_standardCENTERbold">
<td height="25">Shop User </td>
<td height="25" colspan="3"> Last 12 Months </td>
<td height="25" colspan="3">Lifetime</td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="200" height="35"></td>
<td width="100">Volunteer<br />
Hours</td>
<td width="100">Total<br />
Hours</td>
<td width="100">Visits</td>
<td width="100">Volunteer<br />
Hours</td>
<td width="100">Total<br />
Hours</td>
<td width="100">Visits</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>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['th_hours'],0); ?></td>
<td class="yb_standardRIGHT">&nbsp;<?php echo number_format($row_Recordset1['th_visits'],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);
?>

93
stats/stats_usersbydayweek.php

@ -0,0 +1,93 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Total Hours';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT total.date, DAYNAME(total.date) AS dayname, YEAR(total.date) AS year, WEEK(total.date) AS week, DAYOFWEEK(total.date) AS dayofweek, total.visits AS total_visits, firstv.first_count AS new_visits
FROM (SELECT date, COUNT(shop_visit_id) AS visits FROM shops s LEFT JOIN shop_hours sh ON s.shop_id = sh.shop_id GROUP BY date) AS total
LEFT JOIN (SELECT first_date, COUNT(contact_id) AS first_count FROM (SELECT sh.contact_id, MIN(s.date) as first_date, DAYNAME(MIN(s.date)) AS day_name FROM shops s LEFT JOIN shop_hours sh ON sh.shop_id=s.shop_id GROUP BY sh.contact_id) AS first_visits GROUP BY first_date) AS firstv
ON total.date = firstv.first_date ORDER BY total.date DESC";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
function print_table_daysofweek($year, $week, $total_visits, $new_visits){
echo "<tr class='yb_standardCENTER'>";
echo "<td class='yb_standardCENTERbold'>$year</td>\n";
echo "<td class='yb_standardCENTERbold'>$week</td>\n";
for ($i = 1; $i <= 7; $i++){
echo "<td> <span class='yb_standardCENTERred'>$new_visits[$i]</span> / $total_visits[$i]</td>\n";
}
echo "</tr>\n";
}
?>
<?php include("include_header.html"); ?>
<table width="100%">
<tr valign="top">
<td><span class="yb_heading3red">New and Total Users by Day/Week</span></td>
</tr>
<tr><td>Legend: <span class="yb_standardred">First Time Users</span> / Total Users</td></tr>
<tr>
<td>
<table width="100%" border="1" cellpadding="1" cellspacing="0">
<tr bgcolor="#99CC33" class="yb_standardCENTERbold">
<td>Year</td>
<td>Week</td>
<td height="35">Sunday</td>
<td>Monday</td>
<td>Tuesday</td>
<td>Wednesday</td>
<td>Thursday</td>
<td>Friday</td>
<td>Saturday</td>
</tr>
<?php
$j=0;
do {
$j++;
if ($row_Recordset1['week']<>$week && j<>1) { // reset if week has changed
print_table_daysofweek($year, $week, $total_visits, $new_visits);
$year = $row_Recordset1['year'];
$week = $row_Recordset1['week'];
$total_visits = array(1 => 0,2 => 0,3 => 0,4 => 0,5 => 0,6 => 0,7 => 0);
$new_visits = array(1 => 0,2 => 0,3 => 0,4 => 0,5 => 0,6 => 0,7 => 0);
} //if
$dayofweek = intval($row_Recordset1['dayofweek']);
$total_visits[$dayofweek] = $row_Recordset1['total_visits'];
$new_visits[$dayofweek] = $row_Recordset1['new_visits'];
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); // while ?>
</table> </td>
</tr>
</table>
<br><table border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="yb_heading3">Legend: </td>
<td>
<table border="1" cellspacing="0" cellpadding="1"><tr><td><span class="yb_standardred">First Time Users</span> Total Users
</td>
</tr></table> </td></tr>
</table>
<?php include("include_footer.html"); ?>
<?php
mysql_free_result($Recordset1);
?>

121
stats/stats_usersbyweek.php

@ -0,0 +1,121 @@
<?php
require_once('../Connections/YBDB.php');
require_once('../Connections/database_functions.php');
switch ($_GET['error']) {
case 'no_shop':
$error_message = 'ERROR: A Shop at this location for today does not exist: Start New Shop';
break;
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'New Users per Week';
break;
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT YEAR(date_created) as year, LEFT(MONTHNAME(date_created),3) as month, WEEK(date_created) as week, COUNT(contact_id) as 'new_users' FROM contacts WHERE first_name <> '' AND last_name <> '' GROUP BY YEAR(date_created), WEEK(date_created) ORDER BY YEAR(date_created) DESC, WEEK(date_created) DESC;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$query_Recordset2 = "SELECT COUNT(contact_id) total_users FROM contacts WHERE first_name <> '' AND last_name <> '' GROUP BY contact_id * 0;";
$Recordset2 = mysql_query($query_Recordset2, $YBDB) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2); //Wait to fetch until do loop
$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
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";
$Recordset3 = mysql_query($query_Recordset3, $YBDB) or die(mysql_error());
//$row_Recordset3 = mysql_fetch_assoc($Recordset3); //Wait to fetch until do loop
$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
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
WHERE volunteer = 1
GROUP BY year(date), week(date)
ORDER BY year(date) DESC, week(date) DESC;";
$Recordset4 = mysql_query($query_Recordset4, $YBDB) or die(mysql_error());
//$row_Recordset4 = mysql_fetch_assoc($Recordset4); //Wait to fetch until do loop
$totalRows_Recordset4 = mysql_num_rows($Recordset4);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td><span class="yb_heading3red">New and Total Users by Week</span></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0">
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTERbold">
<td height="35" colspan="3">Date</td>
<td colspan="2" bgcolor="#99CC33">User Hours for Week</td>
<td colspan="3">Number of Visitors for Week </td>
<td> Users to <br /> Date </td>
</tr>
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
<td width="60" height="25" class="yb_heading3">Year</td>
<td width="60" class="yb_heading3">Month</td>
<td width="60" class="yb_heading3">Week#</td>
<td width="100" bgcolor="#99CC33">Total </td>
<td width="100" bgcolor="#99CC33">Volunteer </td>
<td width="100">Total</td>
<td width="100">Volunteer</td>
<td width="100">First Time </td>
<td>Total</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 {
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
if(1 == 2) {?>
<tr valign="bottom" bgcolor="#CCCC33">
<td bgcolor="#CCCC33">&nbsp;</td>
<td bgcolor="#CCCC33">&nbsp;</td>
<td bgcolor="#CCCC33">&nbsp;</td>
<td width="100">&nbsp;</td>
<td bgcolor="#CCCC33">&nbsp;</td>
<td bgcolor="#CCCC33">&nbsp;</td>
<td bgcolor="#CCCC33">&nbsp;</td>
<td bgcolor="#CCCC33">&nbsp;</td>
<td bgcolor="#CCCC33">&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 class="yb_standardRIGHT">
<td class="yb_standardCENTER"><?php echo $row_Recordset1['year']; ?></td>
<td class="yb_standardCENTER"><?php echo $row_Recordset1['month']; ?></td>
<td class="yb_standardCENTER"><?php echo $row_Recordset1['week']; ?></td>
<td>&nbsp;<?php echo number_format($row_Recordset3['total_hours'],0); ?></td>
<td class="yb_standardRIGHTred">&nbsp;<?php echo number_format($row_Recordset4['volunteer_hours'],0); ?></td>
<td><?php echo number_format($row_Recordset3['total_visitors'],0); ?></td>
<td class="yb_standardRIGHTred">&nbsp;<?php echo number_format($row_Recordset4['volunteer_visitors'],0); ?></td>
<td>&nbsp;<?php echo number_format($row_Recordset1['new_users'],0); ?></td>
<td>&nbsp;<?php echo number_format($total_users,0); $total_users -= $row_Recordset1['new_users']; ?></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);
?>

110
stats_MechanicOperationMetrics_byMonth.php

File diff suppressed because one or more lines are too long

110
stats_MechanicOperationMetrics_byWeek.php

File diff suppressed because one or more lines are too long

109
stats_VolVsMechMetrics_byMonth.php

File diff suppressed because one or more lines are too long

109
stats_VolVsMechMetrics_byWeek.php

File diff suppressed because one or more lines are too long

125
stats_employeemetrics.php

File diff suppressed because one or more lines are too long

78
stats_monthlysalestax.php

File diff suppressed because one or more lines are too long

83
stats_monthlytransactiontotals.php

File diff suppressed because one or more lines are too long

77
stats_monthlytransactiontotals_paid.php

File diff suppressed because one or more lines are too long

80
stats_paidstaffhours.php

File diff suppressed because one or more lines are too long

71
stats_paidstaffhours_byMonth.php

File diff suppressed because one or more lines are too long

92
stats_paidstaffhours_byPayPeriod.php

File diff suppressed because one or more lines are too long

71
stats_paidstaffhours_byWeek.php

File diff suppressed because one or more lines are too long

84
stats_shoptransactiontotals.php

File diff suppressed because one or more lines are too long

76
stats_shoptransactiontotals_byshop.php

File diff suppressed because one or more lines are too long

122
stats_userhours.php

File diff suppressed because one or more lines are too long

131
stats_userhours_season.php

File diff suppressed because one or more lines are too long

131
stats_userhours_year.php

File diff suppressed because one or more lines are too long

93
stats_usersbydayweek.php

File diff suppressed because one or more lines are too long

121
stats_usersbyweek.php

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save