Browse Source

Closes #85

Also, counts returned transactions for both stats_monthlysalestax.php and stats_shoptransactiontotals.php .. no more guessing required.
devel
Jonathan Rosenbaum 5 years ago
parent
commit
db93ad1103
  1. 4
      stats/stats_monthlysalestax.php
  2. 2
      stats/stats_shoptransactiontotals.php
  3. 43
      transaction_log.php

4
stats/stats_monthlysalestax.php

@ -62,7 +62,9 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
<?php } else { // end if EDIT RECORD ?>
<tr>
<td><?php echo $row_Recordset1['Year']; ?></td>
<td><?php echo $row_Recordset1['Month']; ?></td>
<td>
<?php echo '<a href="/transaction_log.php?month_search=' . $row_Recordset1['Year'] . '-' . $row_Recordset1['Month'] . '-01">' . $row_Recordset1['Month'] . '</a>'; ?>
</td>
<td class="yb_standardRIGHT"><?php currency_format($row_Recordset1['TotalSales'],2);?></td>
<td><?php echo $row_Recordset1['AccountingGroup']; ?></td>
</tr>

2
stats/stats_shoptransactiontotals.php

@ -65,7 +65,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
<?php } else { // end if EDIT RECORD ?>
<tr>
<td><?php echo $row_Recordset1['ShopDate']; ?></td>
<td><?php echo '<a href="/transaction_log.php?shop_id_search=' . $row_Recordset1['ShopID'] . '&record_count=500">' . $row_Recordset1['ShopID'] . '</a>'; ?></td>
<td><?php echo '<a href="/transaction_log.php?shop_id_search=' . $row_Recordset1['ShopID'] . '">' . $row_Recordset1['ShopID'] . '</a>'; ?></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>

43
transaction_log.php

@ -101,8 +101,9 @@ if($_GET['search']==''){
$search_state = '';
}
// currently used for links in reports, and not for transaction_log page search mechanism
//// currently used for links in reports, and not for transaction_log page search mechanism
// Shop Transaction Totals (stats_shoptransactiontotals.php) - by shop
if($_GET['shop_id_search']==''){
$shop_id_search = '';
} elseif(isset($_GET['shop_id_search'])) {
@ -111,7 +112,16 @@ if($_GET['shop_id_search']==''){
$shop_id_search = '';
}
//record_count (SQL or state)
// Sales Tax Report (stats_monthlysalestax.php)- by month
if($_GET['month_search']==''){
$month_search = '';
} elseif(isset($_GET['month_search'])) {
$month_search = "AND DATE(date) >='" . $_GET['month_search'] . "' AND DATE(date) <= LAST_DAY('" . $_GET['month_search'] . "')";
} else {
$month_search = '';
}
//// record_count (SQL or state)
if($_GET['record_count']>0){
$record_count = $_GET['record_count'];
$number_of_transactions = $record_count;
@ -144,6 +154,27 @@ foreach ( $search_state_array as $key => $value ) {
// What is seen on the main page.
mysql_select_db($database_YBDB, $YBDB);
// count for $month_search and $shop_id_search
if($month_search || $shop_id_search) {
$query_Recordset1 = "SELECT *,
DATE_FORMAT(date,'%m/%d/%y (%a)') as date_wday,
CONCAT('$',FORMAT(amount,2)) as format_amount,
CONCAT(contacts.last_name, ', ', contacts.first_name, ' ',contacts.middle_initial) AS full_name,
LEFT(IF(show_startdate, CONCAT(' [',
DATE_FORMAT(DATE_ADD(date_startstorage,INTERVAL $storage_period DAY),'%W, %M %D'), '] ', transaction_log.description),
IF(community_bike,CONCAT('Quantity(', quantity, ') ', transaction_log.description), description)),2000)
as description_with_locations
FROM transaction_log
LEFT JOIN contacts ON transaction_log.sold_to=contacts.contact_id
LEFT JOIN transaction_types ON transaction_log.transaction_type=transaction_types.transaction_type_id
WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} {$contact_id} {$search} {$shop_id_search} {$month_search};";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
//$handler->debug($totalRows_Recordset1);
$record_count = $totalRows_Recordset1;
}
$query_Recordset1 = "SELECT *,
DATE_FORMAT(date,'%m/%d/%y (%a)') as date_wday,
CONCAT('$',FORMAT(amount,2)) as format_amount,
@ -155,10 +186,13 @@ LEFT(IF(show_startdate, CONCAT(' [',
FROM transaction_log
LEFT JOIN contacts ON transaction_log.sold_to=contacts.contact_id
LEFT JOIN transaction_types ON transaction_log.transaction_type=transaction_types.transaction_type_id
WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} {$contact_id} {$search} {$shop_id_search} ORDER BY transaction_id DESC LIMIT 0, $record_count;";
WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} {$contact_id} {$search} {$shop_id_search} {$month_search} ORDER BY transaction_id DESC LIMIT 0, $record_count;";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
//$handler->debug($query_Recordset1);
//Action on form update
$editFormAction = "";
@ -675,7 +709,8 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
<tr bordercolor="#CCCCCC" bgcolor="#CCCC33">
<td colspan="9"><p><strong>Start New Transaction:</strong><br />&nbsp;&nbsp;&nbsp;&nbsp;Select Type: <?php list_transaction_types('transaction_type',$default_transaction_type); ?>
<input type="submit" name="Submit43" value="Create Transaction" /><span id="current_shop"></span>
</p>
</p>
<div></div>
</td>
</tr>
<input type="hidden" name="MM_insert" value="FormNew" />

Loading…
Cancel
Save