Permalink
Browse files

Implemented Comparison Boxes and, New Tax brackets, Capital Gains Cha…

…nges
  • Loading branch information...
Valadian committed Jan 19, 2016
1 parent c53c58c commit 385b8db09b36005d6732089ebef33b7d0160902c
Showing with 173 additions and 26 deletions.
  1. +30 −2 Content/site.css
  2. +108 −13 Scripts/site.js
  3. +35 −11 index.html
View
@@ -1,3 +1,13 @@
+/*h1, h2, h3, h4, h5, h6 {
+ font-family: jubilat;
+}
+p, div {
+ font-family: freight-sans-pro;
+ font-style: normal;
+ font-weight: 300;
+ color: #364350;
+}*/
+
.navbar-inverse{
background-color: #185378;
}
@@ -135,14 +145,14 @@ div.rounded {
text-align: center;
}
-.savings-top{
+.rounded-top{
border-radius: 20px 20px 0px 0px;
-moz-border-radius: 20px 20px 0px 0px;
-webkit-border-radius: 20px 20px 0px 0px;
border: 1px solid #000000;
border-bottom-style: none;
}
-.savings-bottom{
+.rounded-bottom{
border-radius: 0px 0px 20px 20px;
-moz-border-radius: 0px 0px 20px 20px;
-webkit-border-radius: 0px 0px 20px 20px;
@@ -151,4 +161,22 @@ div.rounded {
}
.shareLinks{
padding-bottom:7px;
+}
+/*.bernieText{
+ color: #185378;
+}*/
+.bernieReplacing{
+ background-color: #555555;
+ color: #fff;
+ padding: 10px 15px 10px 10px;
+ margin: 0px -10px 0px -10px;
+}
+.bernieNew{
+ background-color: #185378;
+ color: #fff;
+ padding: 10px 15px 10px 10px;
+ margin: 0px -10px 0px -10px;
+}
+.bernieNew.rounded-bottom{
+ margin-bottom: 15px;
}
View
@@ -163,19 +163,75 @@ $(function(){
{start: 466950, stop:null, rate:0.396, capGainsRate: 0.20}
]
];
- self.federalWithholding = ko.pureComputed(function(){
- return taxTable2016[self.filingStatus()].reduce(function(curr,next,i,array){
- if(!("sum" in curr)){
- curr = {sum: (clamp(self.taxableIncome(),curr.start,curr.stop) - curr.start) * curr.rate};
- }
- return {sum: curr.sum + (clamp(self.taxableIncome(),next.start,next.stop) - next.start) * next.rate};
- }).sum;
- },self);
- self.longCapGainsTax = ko.pureComputed(function(){
- var sum = 0
- var taxed = 0
- var array = taxTable2016[self.filingStatus()];
+ var taxTableBernie2016 = [
+ [//Single
+ {start: 0, stop:9275, rate:0.10, capGainsRate: 0},
+ {start: 9275, stop:37650, rate:0.15, capGainsRate: 0},
+ {start: 37650, stop:91150, rate:0.25, capGainsRate: 0.15},
+ {start: 91150, stop:190150, rate:0.28, capGainsRate: 0.15},
+ {start: 190150, stop:250000, rate:0.33, capGainsRate: 0.15},
+ {start: 250000, stop:500000, rate:0.37, capGainsRate: 0.37},
+ {start: 500000, stop:2000000, rate:0.43, capGainsRate: 0.43},
+ {start: 2000000, stop:10000000, rate:0.48, capGainsRate: 0.48},
+ {start: 10000000, stop:null, rate:0.52, capGainsRate: 0.52}
+ ],
+ [//Married Filing Jointly
+ {start: 0, stop:18550, rate:0.10, capGainsRate: 0},
+ {start: 18550, stop:75300, rate:0.15, capGainsRate: 0},
+ {start: 75300, stop:151900, rate:0.25, capGainsRate: 0.15},
+ {start: 151900, stop:231450, rate:0.28, capGainsRate: 0.15},
+ {start: 231450, stop:250000, rate:0.33, capGainsRate: 0.15},
+ {start: 250000, stop:500000, rate:0.37, capGainsRate: 0.37},
+ {start: 500000, stop:2000000, rate:0.43, capGainsRate: 0.43},
+ {start: 2000000, stop:10000000, rate:0.48, capGainsRate: 0.48},
+ {start: 10000000, stop:null, rate:0.52, capGainsRate: 0.52}
+ ],
+ [//Married Filing Separately
+ {start: 0, stop:9275, rate:0.10, capGainsRate: 0},
+ {start: 9275, stop:37650, rate:0.15, capGainsRate: 0},
+ {start: 37650, stop:75950, rate:0.25, capGainsRate: 0.15},
+ {start: 75950, stop:115725, rate:0.28, capGainsRate: 0.15},
+ {start: 115725, stop:206675, rate:0.33, capGainsRate: 0.15},
+ {start: 125000, stop:250000, rate:0.37, capGainsRate: 0.37},
+ {start: 250000, stop:500000, rate:0.43, capGainsRate: 0.43},
+ {start: 500000, stop:5000000, rate:0.48, capGainsRate: 0.48},
+ {start: 5000000, stop:null, rate:0.52, capGainsRate: 0.52}
+ ],
+ [//Head of Household
+ {start: 0, stop:13250, rate:0.10, capGainsRate: 0},
+ {start: 13250, stop:50400, rate:0.15, capGainsRate: 0},
+ {start: 50400, stop:130150, rate:0.25, capGainsRate: 0.15},
+ {start: 130150, stop:210800, rate:0.28, capGainsRate: 0.15},
+ {start: 210800, stop:250000, rate:0.33, capGainsRate: 0.15},
+ {start: 250000, stop:500000, rate:0.37, capGainsRate: 0.37},
+ {start: 500000, stop:2000000, rate:0.43, capGainsRate: 0.43},
+ {start: 2000000, stop:10000000, rate:0.48, capGainsRate: 0.48},
+ {start: 10000000, stop:null, rate:0.52, capGainsRate: 0.52}
+ ],
+ [//Qualified Widow(er)
+ {start: 0, stop:18550, rate:0.10, capGainsRate: 0},
+ {start: 18550, stop:75300, rate:0.15, capGainsRate: 0},
+ {start: 75300, stop:151900, rate:0.25, capGainsRate: 0.15},
+ {start: 151900, stop:231450, rate:0.28, capGainsRate: 0.15},
+ {start: 231450, stop:250000, rate:0.33, capGainsRate: 0.15},
+ {start: 250000, stop:500000, rate:0.37, capGainsRate: 0.37},
+ {start: 500000, stop:2000000, rate:0.43, capGainsRate: 0.43},
+ {start: 2000000, stop:10000000, rate:0.48, capGainsRate: 0.48},
+ {start: 10000000, stop:null, rate:0.52, capGainsRate: 0.52}
+ ]
+ ];
+ var calculateFederalWithholding = function(array){
+ var sum = 0;
+ for(var i=0, n=array.length; i< n; i++){
+ curr = array[i];
+ sum = sum + (clamp(self.taxableIncome(),curr.start,curr.stop) - curr.start) * curr.rate;
+ }
+ return sum;
+ }
+ var calculateCapitalGains = function(array){
+ var sum = 0;
+ var taxed = 0;
for(var i=0, n=array.length; i< n; i++){
curr = array[i];
var clampedIncome = clamp(self.taxableIncome(),curr.start,curr.stop);
@@ -185,8 +241,47 @@ $(function(){
taxed = taxed + +taxableLongGains;
}
return sum;
+ }
+ self.federalWithholding = ko.pureComputed(function(){
+ return calculateFederalWithholding(taxTable2016[self.filingStatus()]);
+// var sum = 0;
+// var array = taxTable2016[self.filingStatus()];
+// for(var i=0, n=array.length; i< n; i++){
+// curr = array[i];
+// sum = sum + (clamp(self.taxableIncome(),curr.start,curr.stop) - curr.start) * curr.rate;
+// }
+// return sum;
+ },self);
+
+ self.longCapGainsTax = ko.pureComputed(function(){
+ return calculateCapitalGains(taxTable2016[self.filingStatus()]);
+// var sum = 0
+// var taxed = 0
+// var array = taxTable2016[self.filingStatus()];
+// for(var i=0, n=array.length; i< n; i++){
+// curr = array[i];
+// var clampedIncome = clamp(self.taxableIncome(),curr.start,curr.stop);
+// var clampedLongGains = clamp(self.taxableIncome()+ +self.incomeLongCapGains(),curr.start,curr.stop);
+// var taxableLongGains = Math.min(clampedLongGains - +clampedIncome,self.incomeLongCapGains()-taxed);
+// sum = sum + +taxableLongGains * curr.capGainsRate;
+// taxed = taxed + +taxableLongGains;
+// }
+// return sum;
},self);
+ self.effectiveTaxRate = ko.pureComputed(function(){
+ return (100*(+self.federalWithholding() + +self.longCapGainsTax())/self.income()).toFixed(1) +"%";
+ });
+
+ self.newFederalWithholding = ko.pureComputed(function(){
+ return calculateFederalWithholding(taxTableBernie2016[self.filingStatus()]);
+ });
+ self.newLongCapGainsTax = ko.pureComputed(function(){
+ return calculateCapitalGains(taxTableBernie2016[self.filingStatus()]);
+ });
+ self.newEffectiveTaxRate = ko.pureComputed(function(){
+ return (100*(+self.newFederalWithholding() + +self.newLongCapGainsTax())/self.income()).toFixed(1) +"%";
+ });
self.employeeMediTax = ko.pureComputed(function(){
if(+self.selfEmployed()){
return (0.9235 * self.income() * 0.0145 * 2).toFixed(0);
@@ -271,7 +366,7 @@ $(function(){
},self);
self.employeeSavings = ko.pureComputed(function(){
- return self.employeeHealthCareCost() - + self.employeeBernieCareTax()
+ return self.employeeHealthCareCost() - + self.employeeBernieCareTax() + + self.federalWithholding() - +self.newFederalWithholding() + + self.longCapGainsTax() - +self.newLongCapGainsTax()
},self);
self.employerSavings = ko.pureComputed(function(){
return self.employerHealthCareCost() - + self.employerBernieCareTax()
View
@@ -76,12 +76,12 @@
<div class="row savings-spaceholder">
<div class="row savings-container">
<div class="col-sm-6 savings ">
- <div class="savings-top" data-bind="text: employeeSavingsText(), css: { 'bg-success': employeeSavings()>=0, 'bg-danger': employeeSavings()<0 }"></div>
- <div class="savings-bottom" data-bind="text: employeeSavingsFormatted(), css: { 'bg-success': employeeSavings()>=0, 'bg-danger': employeeSavings()<0 }"></div>
+ <div class="rounded-top" data-bind="text: employeeSavingsText(), css: { 'bg-success': employeeSavings()>=0, 'bg-danger': employeeSavings()<0 }"></div>
+ <div class="rounded-bottom" data-bind="text: employeeSavingsFormatted(), css: { 'bg-success': employeeSavings()>=0, 'bg-danger': employeeSavings()<0 }"></div>
</div>
<div class="col-sm-6 savings">
- <div class="savings-top" data-bind="text: employerSavingsText(), css: { 'bg-success': employerSavings()>=0, 'bg-danger': employerSavings()<0 }"></div>
- <div class="savings-bottom" data-bind="text: employerSavingsFormatted(), css: { 'bg-success': employerSavings()>=0, 'bg-danger': employerSavings()<0 }"></div>
+ <div class="rounded-top" data-bind="text: employerSavingsText(), css: { 'bg-success': employerSavings()>=0, 'bg-danger': employerSavings()<0 }"></div>
+ <div class="rounded-bottom" data-bind="text: employerSavingsFormatted(), css: { 'bg-success': employerSavings()>=0, 'bg-danger': employerSavings()<0 }"></div>
</div>
</div>
</div>
@@ -182,18 +182,42 @@
<input data-bind="value: taxableIncome()" class="form-control currency" name="taxableIncome" readonly />
</div>
</fieldset>
- <fieldset class="form-group advanced">
- <label for="federalWithholding">Federal Withholding:</label>
+ <fieldset class="form-group advanced bernieReplacing rounded-top">
+ <label for="federalWithholding">Old Federal Withholding:</label>
<div class="input-group">
<input data-bind="value: federalWithholding()" class="form-control currency" name="federalWithholding" readonly />
</div>
</fieldset>
- <fieldset class="form-group advanced">
- <label for="longCapGainsTax">Long Term Capital Gains Taxes:</label>
+ <fieldset class="form-group advanced bernieReplacing">
+ <label for="longCapGainsTax">Old Long Term Cap Gains Taxes:</label>
<div class="input-group">
<input data-bind="value: longCapGainsTax()" class="form-control currency" name="longCapGainsTax" readonly />
</div>
</fieldset>
+ <fieldset class="form-group advanced bernieReplacing">
+ <label for="effectiveTaxRate">Old Effective Tax Rate:</label>
+ <div class="input-group">
+ <input data-bind="value: effectiveTaxRate()" class="form-control" name="effectiveTaxRate" readonly />
+ </div>
+ </fieldset>
+ <fieldset class="form-group advanced bernieNew">
+ <label for="newFederalWithholding">New Federal Withholding:</label>
+ <div class="input-group">
+ <input data-bind="value: newFederalWithholding()" class="form-control currency" name="newFederalWithholding" readonly />
+ </div>
+ </fieldset>
+ <fieldset class="form-group advanced bernieNew">
+ <label for="newLongCapGainsTax">New Long Term Cap Gains Taxes:</label>
+ <div class="input-group">
+ <input data-bind="value: newLongCapGainsTax()" class="form-control currency" name="newLongCapGainsTax" readonly />
+ </div>
+ </fieldset>
+ <fieldset class="form-group advanced bernieNew rounded-bottom">
+ <label for="newEffectiveTaxRate">New Effective Tax Rate:</label>
+ <div class="input-group">
+ <input data-bind="value: newEffectiveTaxRate()" class="form-control" name="newEffectiveTaxRate" readonly />
+ </div>
+ </fieldset>
<fieldset class="form-group advanced">
<label for="employeeMediTax">Medicare Taxes:</label>
<div class="input-group">
@@ -324,7 +348,7 @@
</div>
</fieldset>
- <fieldset class="form-group">
+ <fieldset class="form-group bernieReplacing rounded-top">
<label for="employeeHealthCareCost">Estimated ObamaCare Costs:</label>
<div class="input-group">
<div class="input-group-addon info whoLabel">Employee</div>
@@ -336,8 +360,8 @@
</div>
</fieldset>
- <fieldset class="form-group">
- <label for="employeeBernieCareTax">Estimated BernieCare Costs:</label>
+ <fieldset class="form-group bernieNew rounded-bottom">
+ <label for="employeeBernieCareTax" class="bernieText">Estimated BernieCare Costs:</label>
<div class="input-group">
<div class="input-group-addon info whoLabel">Employee</div>
<input data-bind="value: employeeBernieCareTax()" class="form-control currency" name="employeeBernieCareTax" readonly />

0 comments on commit 385b8db

Please sign in to comment.