Browse Source

More enhancements in regards to #62.

* Now shows name with link to individual history for folk who never had an transactions, as well as who have

* Link from individual history back to transaction_log with max results count.
devel
Jonathan Rosenbaum 6 years ago
parent
commit
940b6c52b3
  1. 17
      js/reports.js
  2. 10
      json/reports.php
  3. 24
      transaction_log.php

17
js/reports.js

@ -36,18 +36,31 @@ $(function(){
$(".stats-left").attr("href","/individual_history_log.php?contact_id=" + prev);
$(".stats-right").attr("href","/individual_history_log.php?contact_id=" + next);
var record_count;
$.post("json/reports.php", { record_count: 1 }, function (data) {
record_count = data;
record_count = $.parseJSON(data);
});
// name
$.post("json/reports.php", { name: 1, contact_id: contact_id }, function (data) {
if (data) {
var d = new Date();
var date = d.toISOString().split('T')[0];
var obj = $.parseJSON(data);
$("#name").text(obj.full_name);
var full_name_with_link = '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;"' +
' href="transaction_log.php?trans_date=' + date +
'&trans_type=all_types&shop_dayname=alldays&record_count=' + record_count.record_count +
'&contact_id_search=' +
contact_id + '">' + obj.full_name + "</a>";
$("#name").html(full_name_with_link);
var pad_name;
if (obj.configurations.prefix) {
pad_name = obj.configurations.prefix + "_pad_contact_id_" + contact_id;
} else {
pad_name = "pad_contact_id_" + contact_id;
}
console.log(pad_name);
//console.log(pad_name);
if ( obj.configurations.host && obj.full_name ) {
$("#individual_history_pad").pad({
"padId": pad_name,

10
json/reports.php

@ -129,5 +129,15 @@ $handler->start();
echo json_encode($result);
} // return everyone
// Latest transaction_id
if (isset($_POST['record_count'])) {
$query = 'SELECT MAX(transaction_id) AS record_count FROM transaction_log;';
$sql = mysql_query($query, $YBDB) or die(mysql_error());
$result = mysql_fetch_assoc($sql);
echo json_encode($result);
}
?>

24
transaction_log.php

@ -691,11 +691,15 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
$result = mysql_fetch_assoc($sql);
if($result['anonymous']) {
echo "Anonymous";
echo "Anonymous";
$whoami = "Anonymous";
} else {
echo '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;" href="individual_history_log.php?contact_id=' .
$row_Recordset1['contact_id'] . '">' .
$row_Recordset1['full_name'] . "</a>";
$whoami = '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;" href="individual_history_log.php?contact_id=' .
$row_Recordset1['contact_id'] . '">' .
$row_Recordset1['full_name'] . "</a>";
}
?>&nbsp;</td>
@ -791,7 +795,23 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
</form>
<?php } //while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); // while Recordset1 ?>
<tr>
<td>TOTAL</td><td></td><td></td><td></td><td></td><td></td>
<td>TOTAL</td><td></td><td></td>
<td><?php
if ($contact_id_state !== 'everyone') {
if ($whoami) {
echo $whoami;
} else {
$query = "SELECT CONCAT(last_name, ', ', first_name, ' ', middle_initial) AS full_name
FROM contacts WHERE contact_id=" . $contact_id_state . ";";
$sql = mysql_query($query, $YBDB) or die(mysql_error());
$result = mysql_fetch_assoc($sql);
echo '<a style="color: rgb(27, 105, 30); text-decoration: none; cursor: crosshair;" href="individual_history_log.php?contact_id=' .
$contact_id_state . '">' .
$result['full_name'] . "</a>";
}
}
?></td>
<td></td><td></td>
<td title="Updates on Transaction Search Submit">$<?php echo number_format((float)$total, 2, '.', ''); ?></td>
<td></td><td></td>
</tr>

Loading…
Cancel
Save