mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-22 00:53:22 -05:00
Stat totals for shop types. In the future a graph would be nice.
This commit is contained in:
parent
4a77289b2f
commit
8eac9b6dd5
@ -3,7 +3,7 @@
|
||||
}
|
||||
|
||||
|
||||
#status_totals, #community_service_hours {
|
||||
#status_totals, #community_service_hours, #shops{
|
||||
height: 36px;
|
||||
width: 98px;
|
||||
font-size: x-large;
|
||||
|
@ -41,4 +41,13 @@ $(function(){
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#shops").on("click keypress", function(e){
|
||||
var range_display = range.pickmeup('get_date', true);
|
||||
$.post("shops.php", {range1: range_display[0], range2: range_display[1]}, function (data) {
|
||||
$("body").html(data);
|
||||
//range.pickmeup.date($range_display[0]);
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
});
|
12
stats.php
12
stats.php
@ -5,17 +5,27 @@
|
||||
<li><a href="stats/stats_monthlysalestax.php">Sales Tax Report</a><br /></li>
|
||||
<li><a href="stats/stats_shoptransactiontotals.php">Shop Transaction Totals</a><br /></li>
|
||||
<li>Monthly Transaction Totals: <a href="stats/stats_monthlytransactiontotals.php">Volunteer Shops</a>, <a href="stats/stats_monthlytransactiontotals_paid.php">Mechanic Operation</a><br />
|
||||
</ul>
|
||||
|
||||
<p class="yb_heading3red">Membership</p>
|
||||
<ul>
|
||||
<li><a href="stats/members.php" >Members (Running 12 Month Period)</a></li>
|
||||
</ul>
|
||||
|
||||
<p class="yb_heading3red">Volunteer Shops</p>
|
||||
<ul>
|
||||
<li><a href="stats/status_totals.php" >Status Totals by Date Range</a></li>
|
||||
<li><a href="stats/status_totals.php" >Status Totals by Status and Date Range</a></li>
|
||||
<li><a href="stats/stats_userhours.php">Hours by User</a></li>
|
||||
<li><a href="stats/community_service_hours.php">Community Service Hours by Date Range</a></li>
|
||||
<li>Volunteer Hours - <a href="stats/stats_userhours_year.php">Year Summary</a> | <a href="stats/stats_userhours_season.php">3 Month Summary</a> </li>
|
||||
<li><a href="stats/stats_usersbyweek.php">New and Total Users by Week</a> </li>
|
||||
<li><a href="stats/stats_usersbydayweek.php">New and Total Users by Day/Week</a></li>
|
||||
</ul>
|
||||
|
||||
<p class="yb_heading3red">All Shops</p>
|
||||
<ul>
|
||||
<li><a href="stats/shops.php" >Totals by Types and Range</a></li>
|
||||
</ul>
|
||||
|
||||
<p class="yb_heading3red">Mechanic Operation Statistics</p>
|
||||
<ul>
|
||||
|
99
stats/shops.php
Normal file
99
stats/shops.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
require_once('../Connections/YBDB.php');
|
||||
require_once('../Connections/database_functions.php');
|
||||
mysql_select_db($database_YBDB, $YBDB);
|
||||
|
||||
|
||||
$today = date("Y/m/d");
|
||||
$year_ago = date("Y/m/d", strtotime("$today -1 year"));
|
||||
|
||||
$today_date = new DateTime('now');
|
||||
$past = new DateTime($year_ago);
|
||||
$interval = $today_date->diff($past);
|
||||
|
||||
$chosen_date = $today;
|
||||
$days_range1 = $interval->days;
|
||||
$days_range2 = 0;
|
||||
|
||||
// Do some ajax stuff
|
||||
if (isset($_POST['range1'])) {
|
||||
$range1 = $_POST['range1'];
|
||||
$range2 = $_POST['range2'];
|
||||
|
||||
$choice1 = new DateTime($range1);
|
||||
$interval = $today_date->diff($choice1);
|
||||
$days_range1 = $interval->days;
|
||||
|
||||
$choice2 = new DateTime($range2);
|
||||
$interval = $today_date->diff($choice2);
|
||||
$days_range2 = $interval->days;
|
||||
|
||||
$year_ago = $range1;
|
||||
$today = $range2;
|
||||
}
|
||||
|
||||
|
||||
$query = "SELECT COUNT(shop_id) as total_shops from shops
|
||||
WHERE (date >= DATE_SUB(CURDATE(),INTERVAL $days_range1 DAY) AND date <= DATE_SUB(CURDATE(), INTERVAL $days_range2 DAY));";
|
||||
$shop_totals_sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
|
||||
$query = "SELECT shop_type, COUNT(shop_id) AS shop_totals from shops
|
||||
LEFT JOIN shop_types ON shops.shop_type = shop_types.shop_type_id
|
||||
WHERE (date >= DATE_SUB(CURDATE(),INTERVAL $days_range1 DAY) AND date <= DATE_SUB(CURDATE(), INTERVAL $days_range2 DAY))
|
||||
GROUP BY shop_type ORDER BY shop_totals DESC;";
|
||||
$shop_totals_by_types_sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
|
||||
?>
|
||||
|
||||
<?php include("../include_header_stats.html"); ?>
|
||||
|
||||
<table class="stats">
|
||||
<tr valign="top">
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table border="1" cellpadding="1" cellspacing="0">
|
||||
<tr bgcolor="#99CC33" class="yb_standardCENTERbold">
|
||||
<td colspan="4" height="25">Totals for Shop Openings</td>
|
||||
</tr>
|
||||
<tr valign="top" bgcolor="#99CC33" class="yb_standardCENTER">
|
||||
<td width="relative">Type<br /></td>
|
||||
<td width="relative">Totals<br /></td>
|
||||
</tr>
|
||||
<?php while ($result = mysql_fetch_assoc($shop_totals_by_types_sql)) { //do {
|
||||
?>
|
||||
<tr>
|
||||
<td class="yb_standardRIGHTred"><?php echo $result['shop_type'] ?></td>
|
||||
<td class="yb_standardRIGHT"><?php echo number_format($result['shop_totals'],0); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end WHILE count of recordset ?>
|
||||
<?php while ($result = mysql_fetch_assoc($shop_totals_sql)) { //do {
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="yb_standardRIGHT"><?php echo number_format($result['total_shops'],0); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end WHILE count of recordset ?>
|
||||
</table> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<br \><br \>
|
||||
|
||||
<div id="range_input">Date Range: <?php echo "$year_ago - $today"; ?></div>
|
||||
<div id="range"></div>
|
||||
|
||||
<br \>
|
||||
<form method="post" name="range_query">
|
||||
<input id="shops" type="submit" value="Submit" tabindex="14">
|
||||
</form>
|
||||
|
||||
<?php include("../include_footer.html"); ?>
|
||||
<?php
|
||||
mysql_free_result($shop_totals_sql);
|
||||
mysql_free_result($shop_totals_by_types_sql);
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user