Exemplo n.º 1
0
 include '../src/header.php';
 foreach ($_POST as $key => $value) {
     ${$key} = $value;
 }
 // Check year in query, match to a dlog table
 $year1 = idate('Y', strtotime($date1));
 $year2 = idate('Y', strtotime($date2));
 echo "<head>\n";
 include '../src/head.php';
 echo "\n</head>\n\n";
 if ($year1 != $year2) {
     echo "<div id='alert'><h4>Reporting Error</h4><p>Fannie cannot run reports across multiple years.<br>Please retry your query.</p></div>\n";
 } else {
     $table = 'dlog_' . $year1;
 }
 $gross = gross($table, $date1, $date2);
 // echo "<div id='progressbar'></div>";
 echo "\n<p>GROSS TOTAL FOR {$date1} thru {$date2}:  <b>" . money_format('%n', $gross) . "</b></p>\n";
 $propR = mysql_query("SELECT * FROM item_properties");
 $itemsQ = "SELECT COUNT(DISTINCT p.upc) as itmct,\n\t\t\ti.name as Item_Property, \n\t\t\tCOUNT(p.props) as Count,\n\t\t\tROUND(SUM(d.total),2) as Sales,\n\t\t\tROUND((SUM(d.total)/{$gross})*100,2) as pct_of_gross\n\t\tFROM " . PRODUCTS_TBL . " p, item_properties i, " . DB_LOGNAME . ".{$table} d\n\t\tWHERE p.props > 1\n\t\tAND p.upc = d.upc\n\t\tAND BINARY(props) & i.bit \n\t\tGROUP BY Item_Property";
 $itemsR = mysql_query($itemsQ);
 if (!$itemsR) {
     die("Query: {$itemsQ}<br />Error:" . mysql_error());
 }
 echo "<table id='output' cellpadding=6 cellspacing=0 border=0 class=\"sortable-onload-3 rowstyle-alt colstyle-alt\">\n\n\t  <thead>\n\n\t    <tr>\n\n\t      <th class=\"sortable-text\">Item Property (ct.)</th>\n\n\t      <th class=\"sortable-numeric favour-reverse\">Count.</th>\n\n\t      <th class=\"sortable-currency favour-reverse\">Sales</th>\n\n\t      <th class=\"sortable-numeric favour-reverse\">% of gross</th>\n\n\t    </tr>\n\n\t  </thead>\n\n\t  <tbody>\n";
 while ($row = mysql_fetch_assoc($itemsR)) {
     echo "<td align=left><b>" . $row['Item_Property'] . "</b> (" . $row['itmct'] . ")</td>\n\n\t\t\t<td align=right>" . $row['Count'] . "</td>\n\n\t\t\t<td align=right>" . money_format('%n', $row['Sales']) . "</td>\n\n\t\t\t<td align=right>" . number_format($row['pct_of_gross'], 2) . "%</td>\n";
     echo "</tr>\n";
 }
 echo "</table>\n";
 // debug_p($_REQUEST, "all the data coming in");
Exemplo n.º 2
0
 	} 
 */
 // Check year in query, match to a dlog table
 $year1 = idate('Y', strtotime($date1));
 $year2 = idate('Y', strtotime($date2));
 if ($year1 != $year2) {
     echo "<div id='alert'><h4>Reporting Error</h4>\n\t\t\t<p>Fannie cannot run reports across multiple years.<br>\n\t\t\tPlease retry your query.</p></div>";
     exit;
 } else {
     $table = 'dlog_' . $year1;
 }
 $date2a = $date2 . " 23:59:59";
 $date1a = $date1 . " 00:00:00";
 include 'reportFunctions.php';
 echo $date1a;
 $gross = gross($table, $date1a, $date2a);
 if (isset($sales)) {
     $hash = hash_total($table, $date1a, $date2a);
     $members_total = members_total($table, $date1a, $date2a);
     $nonmembers_total = nonmembers_total($table, $date1a, $date2a);
     /*		
     		$staff_total = staff_total($table,$date1a,$date2a);
     		$hoo_total = hoo_total($table,$date1a,$date2a);
     		$bene_total = bene_total($table,$date1a,$date2a);
     		$bod_total = bod_total($table,$date1a,$date2a);
     		$MADcoupon = MADcoupon($table,$date1a,$date2a);
     		$foodforall = foodforall($table,$date1a,$date2a);
     
     		$a = array($staff_total,$bene_total,$hoo_total,$bod_total,$MADcoupon,$foodforall);
     */
     // changed the array above to simply add members total and nonmembers total