Browse Source

More preps for Deposit Calculator.

devel
Jonathan Rosenbaum 10 years ago
parent
commit
d8b74b7a79
  1. 14
      js/transaction.js
  2. 5
      json/transaction.php
  3. 20
      transaction_log.php

14
js/transaction.js

@ -28,15 +28,13 @@ $(function() {
// Deposit Calculator
if ( $(".paid").length ) { // any transactions?
var deposit = {};
$(".deposit input").each(function(count){
deposit[count] = this.name;
});
$(".deposit input").each(function(){ console.log(this.name);});
var deposit_length = $(".deposit").length;
if ( deposit_length == 1 ) { // one visible deposit could be 1 or more invisible
var deposit_number = $(".deposit input").attr("name");
//console.log(deposit_number);
}
$.post("json/transaction.php",{"deposit": deposit});
}

5
json/transaction.php

@ -29,6 +29,11 @@ mysql_select_db($database_YBDB, $YBDB);
}
// Deposit Calculator
if (isset($_POST['deposit'])) {
print_r($_POST);
}
/*
transaction_id, date_startstorage, date,transaction_type, amount, description, sold_to, sold_by, quantity, shop_id, paid

20
transaction_log.php

@ -134,6 +134,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormNew")) {
header(sprintf("Location: %s", $LoadPage));
} // end Form Submit New Transaction
//Form Edit Record ===============================================================================
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_POST["EditSubmit"] == "Save")) {
@ -160,7 +161,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_PO
mysql_select_db($database_YBDB, $YBDB);
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
$trans_id = $_POST['transaction_id'];
header(sprintf("Location: %s",$editFormAction . "?trans_id={$trans_id}" )); //$editFormAction
@ -168,7 +169,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_PO
//Form Edit Record Delete ===============================================================================
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit") && ($_POST["EditSubmit"] == "Delete")) {
$trans_id = $_POST['transaction_id'];
header(sprintf("Location: %s",$editFormAction . "?delete_trans_id={$trans_id}" )); //$editFormAction
}
@ -431,7 +432,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
<?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) { //do { ?>
<form method="post" name="FormView_<?php echo $row_Recordset1['transaction_id']; ?>" action="<?php echo $editFormAction; ?>">
<tr bordercolor='#CCCCCC' <?php
<tr bordercolor='#CCCCCC' <?php echo "title='Transaction ID: " . $row_Recordset1['transaction_id'] . "'";
echo ((intval($row_Recordset1['transaction_id']) == intval($trans_id)) ? "bgcolor='#CCCC33'" : "");
if ($row_Recordset1['paid'] == 1) { echo "bgcolor='#E6E7E6'"; }
if ($row_Recordset1['transaction_type'] == "Deposit") { echo "class='deposit'"; }
@ -444,7 +445,18 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
<td><?php echo $row_Recordset1['payment_type']; ?>&nbsp;</td>
<td><?php echo $row_Recordset1['format_amount']; ?>&nbsp;</td>
<td><?php $record_trans_id = $row_Recordset1['transaction_id'];
echo "<a href=\"{$_SERVER['PHP_SELF']}?trans_id={$record_trans_id}\">edit</a>"; ?></td>
foreach ($_GET as $i => $value) {
if ($i != "trans_id") {
$trans_url .= "&$i" . "=" . $value;
}
}
if (isset($trans_url)) {
echo "<a href=\"{$_SERVER['PHP_SELF']}?trans_id={$record_trans_id}$trans_url\">edit</a></td>";
} else {
echo "<a href=\"{$_SERVER['PHP_SELF']}?trans_id={$record_trans_id}\">edit</a></td>";
}
?>
<td><input class="paid" type="checkbox" name="<?php $ti = $row_Recordset1['transaction_id']; echo $ti; ?>"
value="<?php echo $row_Recordset1['paid'];?>"
<?php if ($row_Recordset1['paid'] == 1) { echo " checked"; } ?>

Loading…
Cancel
Save