Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated /index.html, /js/cash_out.js, and /css/styles.css to split th…

…e 'Deposit' field into two new fields: 'Cash Deposit' & 'Total Deposit'. The latter is hidden unless checks have been entered. (#184)
  • Loading branch information...
commit f88a038c05c30c940a8d1c3e3c06583cd725491d 1 parent 7db78e0
@morgant authored
Showing with 35 additions and 15 deletions.
  1. +1 −1  css/styles.css
  2. +8 −4 index.html
  3. +26 −10 js/cash_out.js
View
2  css/styles.css
@@ -114,7 +114,7 @@ input[type=button]:active, input[type=button]:hover {
margin: 10px 0;
}
#addCheck { margin-bottom: 0; }
-#checksBalance, label[for=checksBalance] { display: none; }
+#checksBalance, label[for=checksBalance], #totalDeposit, label[for=totalDeposit] { display: none; }
#print {
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
View
12 index.html
@@ -8,7 +8,7 @@
<meta name="author" content="" />
<meta name="copyright" content="" />
<meta name="company" content="" />
- <link rel="stylesheet" href="/css/styles.css" type="text/css" media="screen" />
+ <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" />
<link rel="stylesheet" href="" type="text/css" media="print" />
<link rel="alternate" type="application/rss+xml" title="" href="" />
<link rel="icon" href="favico.ico" type="image/x-icon" />
@@ -27,7 +27,7 @@
h1, p, #print, #email, #addCheck { display: none; }
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
- <script type="text/javascript" src="/js/cash_out.js"></script>
+ <script type="text/javascript" src="js/cash_out.js"></script>
<title>Cash Out</title>
</head>
<body>
@@ -117,8 +117,12 @@ <h2 id="date"></h2>
<input id="checksBalance" readonly="readonly" />
</li>
<li>
- <label for="balanceDelta">Deposit</label>
- <input id="balanceDelta" readonly="readonly" />
+ <label for="cashDeposit">Cash Deposit</label>
+ <input id="cashDeposit" readonly="readonly" />
+ </li>
+ <li>
+ <label for="totalDeposit">Total Deposit</label>
+ <input id="totalDeposit" readonly="readonly" />
<span id="balanceDeltaDesc"></span>
</li>
</ol>
View
36 js/cash_out.js
@@ -31,21 +31,37 @@ function CalculateBalances() {
$("li.check > input").each(function () { checksTotal += Number($(this).val()); });
$("#checksBalance").val(checksTotal.toFixed(2));
- // update the delta
- var delta = 0;
- delta = Number($('#cashBalance').val()) - Number($('#openingBalance').val()) + Number($("#checksBalance").val());
- $('#balanceDelta').val(delta.toFixed(2)).removeClass("over under even");
- if ( (delta - Number($("#checksBalance").val())) < 0 )
+ // update the cash deposit
+ var deposit = 0;
+ deposit = Number($('#cashBalance').val()) - Number($('#openingBalance').val());
+ $('#cashDeposit').val(deposit.toFixed(2)).removeClass("over under even");
+ if ( deposit < 0 )
{
- $("#balanceDelta").addClass("under");
+ $("#cashDeposit").addClass("under");
}
- else if ( (delta - Number($("#checksBalance").val())) == 0 )
+ else if ( deposit == 0 )
{
- $("#balanceDelta").addClass("even");
+ $("#cashDeposit").addClass("even");
}
else
{
- $("#balanceDelta").addClass("over");
+ $("#cashDeposit").addClass("over");
+ }
+
+ // update the total deposit
+ deposit += Number($("#checksBalance").val());
+ $("#totalDeposit").val(deposit.toFixed(2)).removeClass("over under even");
+ if ( deposit < 0 )
+ {
+ $("#totalDeposit").addClass("under");
+ }
+ else if ( deposit == 0 )
+ {
+ $("#totalDeposit").addClass("even");
+ }
+ else
+ {
+ $("#totalDeposit").addClass("over");
}
}
@@ -74,7 +90,7 @@ $(document).ready(function() {
// update calculations upon leaving the new check field
$("#check" + checkNumber).blur(CalculateBalances);
- $("#checksBalance, label[for=checksBalance]").show();
+ $("#checksBalance, label[for=checksBalance], #totalDeposit, label[for=totalDeposit]").show();
});
// print button action
Please sign in to comment.
Something went wrong with that request. Please try again.