-
Notifications
You must be signed in to change notification settings - Fork 0
/
cl_results.php
1157 lines (1062 loc) · 45.5 KB
/
cl_results.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML>
<html>
<?php
include("config.php");
if ('Production' != constant('DEPLOY_MODE')) {
echo '<h3>Site is running in ' . constant('DEPLOY_MODE') . ': all warnings and errors will be displayed!</h3>';
echo "<pre>";
require 'dump-errors.php';
echo "</pre>";
}
require_once('functions.php');
LogPostValuesToLog($_POST['this_log'], 'cl_income');
// Everything that was collected in the previous forms
$cl_input = array();
foreach($_POST as $key => $value) {
$cl_input[$key] = $value;
}
// Circle leaders who are teenage parents
if(isset($cl_input['cl_adults'])) {
$HowManyAdults = $cl_input['cl_adults'];
} else {
$HowManyAdults = 0;
}
// Calculate how many children the circle leader has, across age groups
if(isset($cl_input['cl_thirteen_to_twenty'])) {
$HowMany13to20s = $cl_input['cl_thirteen_to_twenty'];
} else {
$HowMany13to20s = 0;
}
if(isset($cl_input['cl_less_than_thirteen'])) {
$HowManyLessThan13s = $cl_input['cl_less_than_thirteen'];
} else {
$HowManyLessThan13s = 0;
}
$HowManyChildren = $HowMany13to20s + $HowManyLessThan13s;
$cl_county = $cl_input["cl_county"];
$cl_state = $cl_input["cl_state"];
$cl_city = $cl_input["cl_city"];
$people_count = $HowManyAdults + $HowManyChildren;
$dbconn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if($dbconn->connect_errno > 0) {
die('Unable to connect to database [' . $db->connect_error . ']');
}
$fpig_sql = "SELECT income_guide48 FROM fpig WHERE house_members=\"$people_count\";";
$fpig_result = $dbconn->query($fpig_sql);
$fpig_row = $fpig_result->fetch_assoc();
$fpig100 = $fpig_row["income_guide48"] / 12;
$fpig200 = ($fpig_row["income_guide48"] * 2) / 12;
//$dbconn->close();
$plotpoints = 19;
$TotalEarnedIncome = str_replace(',', '', $cl_input["TotalEarned"]);
$TotalUnEarnedIncome = str_replace(',', '', $cl_input["TotalUnEarned"]);
$TotalIncome = $TotalEarnedIncome + $TotalUnEarnedIncome;
if($people_count > 8) {
$hud_people_count = 8;
} else {
$hud_people_count = $people_count;
}
$hudi = "i50_" . $hud_people_count;
$hud_sql = "SELECT " . $hudi . " FROM nm_hud_income_limits WHERE county_statename=\"" . $cl_county . " County, " . $cl_state . "\";";
$hud_result = $dbconn->query($hud_sql);
$hud_row = $hud_result->fetch_assoc();
$HUD_Income_Limit = $hud_row[$hudi];
if(isset($cl_input['Bedrooms'])) {
$cl_Bedrooms = $cl_input['Bedrooms'];
} else {
$cl_Bedrooms = 0;
}
if($cl_Bedrooms = 0) {
$HUD_Room_Adjusment = 0.5;
}
if($cl_Bedrooms = 1) {
$HUD_Room_Adjusment = 0.7;
}
if($cl_Bedrooms = 2) {
$HUD_Room_Adjusment = 0.9;
}
if($cl_Bedrooms = 3) {
$HUD_Room_Adjusment = 1.1;
}
if($cl_Bedrooms = 4) {
$HUD_Room_Adjusment = 1.5;
}
if($cl_Bedrooms = 5) {
$HUD_Room_Adjusment = 1.6;
}
if(isset($cl_input['AlimonyReceived'])) {
$MAGI_AlimonyReceived = $cl_input['AlimonyReceived'];
} else {
$MAGI_AlimonyReceived = 0;
}
if(isset($cl_input['MonthlyGifts'])) {
$MAGI_MonthlyGifts = $cl_input['MonthlyGifts'];
} else {
$MAGI_MonthlyGifts = 0;
}
if(isset($cl_input['ArmedForcesAmount'])) {
$MAGI_ArmedForcesAmount = $cl_input['ArmedForcesAmount'];
} else {
$MAGI_ArmedForcesAmount = 0;
}
if(isset($cl_input['cl_family_college_students'])) {
$Student_Count = $cl_input['cl_family_college_students'];
} else {
$Student_Count = 0;
}
if(isset($cl_input['GasAmount'])) {
$cl_GasAmount = $cl_input['GasAmount'];
} else {
$cl_GasAmount = 0;
}
if(isset($cl_input['ElectricAmount'])) {
$cl_ElectricAmount = $cl_input['ElectricAmount'];
} else {
$cl_ElectricAmount = 0;
}
require 'col_figurin.php';
require 'tanf_figurin.php';
require 'snap_figurin.php';
require 'ccis_figurin.php';
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
Circles USA CEPT
</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<style type="text/css">
${demo.css}
</style>
<style>
.nextbutton {
background-color: #069B54; /* GREEN */
border: none;
color: white;
padding: 5px 5px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 10px;
margin: 4px 2px;
cursor: pointer;
}
.donebutton {
background-color: #EF5F0A; /* ORANGE */
border: none;
color: white;
padding: 5px 5px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 10px;
margin: 4px 2px;
cursor: pointer;
}
.anotherbutton {
background-color: #008FD9; /* BLUE */
border: none;
color: white;
padding: 5px 5px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 10px;
margin: 4px 2px;
cursor: pointer;
}
.centered {
margin: auto;
width: 80%;
border: 6px ridge rgb(0, 159, 222);
color: rgb(0, 0, 0);
padding: 10px;
box-shadow: 5px 5px 5px #cccccc;
border-radius: 8px;
position: relative;
}
.h2 {
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-weight: bold;
color: rgb(0, 163, 222);
}
.h3 {
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
/ / font-weight: bold;
color: black;
}
.p1 {
display: inline;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-weight: bold;
color: rgb(0, 163, 222);
font-size: 18px;
}
.p2 {
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-weight: bold;
color: rgb(0, 163, 222);
font-size: 16px;
}
.form-els {
/ / display: inline;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
/ / font-weight: bold;
}
.button-text {
/ / display: inline;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
/ / font-weight: bold;
}
.org-hr {
width: 100%;
border-style: outset;
border-width: 3px;
color: rgb(242, 117, 34);
}
</style><!--CUSA STYLE-->
</head>
<body>
<!-- BEGIN CUSA HEAD -->
<div id="MainDIV" class="centered">
<!-- START HEADER -->
<div style="float: left;">
<img alt="Circles USA" id="cusalogo" src="images/circles-usa-new.png" style="display: inline;"/>
</div>
<div style="text-align: center; float: right;">
<h2 class="h2">Cliff Effect Planning Tool</h2>
</div>
<div style="text-align: center; float: left; width: 100%;">
<p class="p1">
<br>Circle Leader <?php echo $HowManyAdults; ?> Adults with <?php echo $HowManyChildren; ?>
Children - <?php echo "$cl_city, $cl_county, $cl_state"; ?>
<?php
?>
</p>
<hr class="org-hr">
</div>
<!-- END CUSA HEAD -->
<script src="hi_c_js/highcharts.js"></script>
<script src="hi_c_js/modules/exporting.js"></script>
<div>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<?php
$fpig2avg = $fpig200 / $plotpoints;
$current_column = ceil($TotalEarnedIncome / $fpig2avg);
$current_hourly = ($TotalIncome) / (40 * 4);
if($current_column > 19) {
echo "<span style=\"color:red;\" class=\"p2\">A total montly income of $" . number_format($TotalIncome, 2) . " falls outside the data available for <br>subsidy calculations and graphing for a " . $people_count . " person home in " . $cl_city . ", " . $cl_county . ", " . $cl_state . "!<br><br></span>";
exit;
}
?>
</div>
<br>
<br><br>
<br><br>
<br><br>
<br>
<div style="float: left; width: 100%;">
<!--Button Here! This would be to set start point to current hourly wage instead of Zero -->
</div>
<br>
<br>
<div style="float: left; width: 100%;">
<table border=1 cellpadding=2 cellspacing=2 width="100%" class="form-els" style="font-size: 14px;">
<tr>
<td style="font-weight:bold;">Hourly Wage</td>
<?php
$x = 1;
while($x <= $plotpoints) {
if($x == 1) {
if($current_hourly == 0) {
$current_line = 0;
}
$this_hourly = 0;
${"this_hourly" . $x} = "0.00";
echo "<td>" . number_format($this_hourly, 2) . "</td>";
$x++;
}
if($current_column == 0) {
$current_column = 1;
}
if($x == $current_column) {
$current_line = $x - 1;
//echo "CURRENT_LINE == ".$current_line."<br><br>";
${"this_hourly" . $x} = $current_hourly;
//echo "CURRENT_HOURLY == ".$current_hourly."<br><br>";
echo "<td style=\"background-color:#33cc33; \"><span style=\"color:white;\">" . number_format($current_hourly, 2) . "</span></td>";
$x++;
}
if($x == $plotpoints) {
${"this_hourly" . $x} = ($fpig200) / (40 * 4);
echo "<td>" . number_format(${"this_hourly" . $x}, 2) . "</td>";
$x++;
} else {
$this_fpig2 = $fpig2avg * ($current_column - $x);
$this_hourly = (($TotalEarnedIncome - $this_fpig2) / (40 * 4));
${"this_hourly" . $x} = $this_hourly;
echo "<td>" . number_format($this_hourly, 2) . "</td>";
$x++;
}
}
?>
</tr>
<tr>
<td style="font-weight:bold;">100% FPIG</td>
<?php
for($x = 1; $x <= $plotpoints; $x++) {
echo "<td>" . number_format($fpig100) . "</td>";
}
?>
</tr>
<tr>
<td style="font-weight:bold;">200% FPIG</td>
<?php
for($x = 1; $x <= $plotpoints; $x++) {
echo "<td>" . number_format($fpig200) . "</td>";
}
?>
</tr>
<tr>
<td style="font-weight:bold;">Monthly Gross Income</td>
<?php
$x = 1;
while($x <= $plotpoints) {
if($x == 1) {
$this_monthly = 0;
${"this_monthly" . $x} = 0;
echo "<td>" . number_format($this_monthly) . "</td>";
$x++;
}
if($x == $current_column) {
${"this_monthly" . $x} = $TotalIncome;
echo "<td style=\"background-color:#33cc33; \"><span style=\"color:white;\">" . number_format($TotalIncome) . "</span></td>";
$x++;
}
if($x == $plotpoints) {
${"this_monthly" . $x} = $fpig200;
echo "<td>" . number_format(${"this_monthly" . $x}) . "</td>";
$x++;
} else {
$this_fpig2 = $fpig2avg * ($current_column - $x);
$this_monthly = $TotalEarnedIncome - $this_fpig2;
${"this_monthly" . $x} = $this_monthly;
echo "<td>" . number_format($this_monthly) . "</td>";
$x++;
}
}
?>
</tr>
<tr>
<td style="font-weight:bold;">Food Stamps</td>
<?php
$x = 1;
while($x <= $plotpoints) {
$This_TotalIncome = ${"this_monthly" . $x};
$ThisGrossIncome = $This_TotalIncome + $TotalUnEarnedIncome;
if($This_TotalIncome < $Gross_Income_Limit_AmountSNAP) {
$This_SNAP_Gross_Income_Test = "True";
} else {
$This_SNAP_Gross_Income_Test = "False";
}
$earned_income_disregardSNAP = ${"this_monthly" . $x} * $SNAP_DisregardPercent;
$SNAPTotal_NonShelterDeductions = $earned_income_disregardSNAP + $SNAP_StandardDeduction + $medical_expense_allowanceSNAP + $SNAP_DependentCareDeduction + $SNAP_ChildSupportPaid;
$SNAPIncome_AfterNonShelterDeductions = max(0, $This_TotalIncome - $SNAPTotal_NonShelterDeductions);
$SNAP_50percent_IANSD = $SNAPIncome_AfterNonShelterDeductions * .5;
//=MAX(0,IF(ElderlyDisableInHouse="y",J154-J155,MIN(J154-J155,VLOOKUP(HouseholdStatusCode,XS_ShelterDedTable,2,TRUE))))
if($elderly_disabled_home == "Yes") {
$SNAP_Compare_Shelter_IANSD = $SNAP_Total_UnadjustedShelterCosts - $SNAP_50percent_IANSD;
} else {
$SNAP_Compare_Shelter_IANSD = min($SNAP_Total_UnadjustedShelterCosts - $SNAP_50percent_IANSD, $household_status_amount);
}
$SNAP_This_ExcessShelter_Deduction = max(0, $SNAP_Compare_Shelter_IANSD);
//=MAX(0,J149-J156)
$SNAP_This_NetFood_Assistance_Income = max(0, $SNAPIncome_AfterNonShelterDeductions - $SNAP_This_ExcessShelter_Deduction);
if($fpig100 > $SNAP_This_NetFood_Assistance_Income) {
$SNAP_This_NetIncomeLimit_Test = "True";
} else {
$SNAP_This_NetIncomeLimit_Test = "False";
}
//$SNAP_Max_Monthly_Benefit
//=MAX(J157*0.3,0)
$SNAP30_This_NetFoodAssistance = max($SNAP_This_NetFood_Assistance_Income * .3, 0);
if($SNAP_This_NetFood_Assistance_Income > -1) {
$SNAP_This_EBT_Lookup_Positive = $SNAP_This_NetFood_Assistance_Income;
} else {
$SNAP_This_EBT_Lookup_Positive = 0;
}
if(($passSNAP_resource_test == "True" && $SNAP_Net_Income_Test == "True") && ($This_SNAP_Gross_Income_Test == "True" || $elderly_disabled_home == "Yes")) {
$whichallotment = "ebt_p" . $people_count;
$ebt_sql = "SELECT $whichallotment FROM ebt_allotment WHERE mni_from>=$SNAP_This_EBT_Lookup_Positive;";
$ebt_result = $dbconn->query($ebt_sql);
$ebt_row = $ebt_result->fetch_assoc();
$This_EBT_Allotment_Amount = $ebt_row[$whichallotment];
${"this_snap" . $x} = $This_EBT_Allotment_Amount;
echo "<td>" . number_format($This_EBT_Allotment_Amount);
//echo "<br>This_TotalIncome == ".$This_TotalIncome."<br><br>";
//echo "<br>TotalUnEarnedIncome == ".$TotalUnEarnedIncome."<br><br>";
//echo "<br>ThisGrossIncome == ".$ThisGrossIncome."<br><br>";
//echo "<br>Gross_Income_Limit_AmountSNAP == ".$Gross_Income_Limit_AmountSNAP."<br><br>";
//echo "<br>This_SNAP_Gross_Income_Tes t== ".$This_SNAP_Gross_Income_Test."<br><br>";
//echo "<br>passSNAP_resource_test == ".$passSNAP_resource_test."<br><br>";
//echo "<br>earned_income_disregardSNAP == ".$earned_income_disregardSNAP."<br><br>";
//echo "<br>SNAP_StandardDeduction == ".$SNAP_StandardDeduction."<br><br>";
//echo "<br>medical_expense_allowanceSNAP == ".$medical_expense_allowanceSNAP."<br><br>";
//echo "<br>SNAP_DependentCareDeduction == ".$SNAP_DependentCareDeduction."<br><br>";
//echo "<br>SNAP_ChildSupportPaid == ".$SNAP_ChildSupportPaid."<br><br>";
//echo "<br>SNAPTotal_NonShelterDeductions == ".$SNAPTotal_NonShelterDeductions."<br><br>";
//echo "<br>SNAPIncome_AfterNonShelterDeductions == ".$SNAPIncome_AfterNonShelterDeductions."<br><br>";
//echo "<br>SNAPstandard_utility_allowance == ".$SNAPstandard_utility_allowance."<br><br>";
//echo "<br>SNAP_MonthlyRentMortgage == ".$SNAP_MonthlyRentMortgage."<br><br>";
//echo "<br>SNAP_InsuranceNotInc == ".$SNAP_InsuranceNotInc."<br><br>";
//echo "<br>SNAP_TaxesNotInc == ".$SNAP_TaxesNotInc."<br><br>";
//echo "<br>SNAP_Total_UnadjustedShelterCosts == ".$SNAP_Total_UnadjustedShelterCosts."<br><br>";
//echo "<br>SNAP_50percent_IANSD == ".$SNAP_50percent_IANSD."<br><br>";
//echo "<br>SNAP_This_ExcessShelter_Deduction == ".$SNAP_This_ExcessShelter_Deduction."<br><br>";
//echo "<br>SNAP_This_NetFood_Assistance_Income == ".$SNAP_This_NetFood_Assistance_Income."<br><br>";
//echo "<br>SNAP_This_NetIncomeLimit_Test == ".$SNAP_This_NetIncomeLimit_Test."<br><br>";
//echo "<br>SNAP_Max_Monthly_Benefit == ".$SNAP_Max_Monthly_Benefit."<br><br>";
//echo "<br>SNAP30_This_NetFoodAssistance == ".$SNAP30_This_NetFoodAssistance."<br><br>";
//echo "<br>SNAP_This_EBT_Lookup_Positive == ".$SNAP_This_EBT_Lookup_Positive."<br><br>";
//echo $x;
echo "</td>";
//echo "<br> == ".."<br><br>";
$x++;
} else {
${"this_snap" . $x} = "0.00";
echo "<td bgcolor=\"lightgray\">" . number_format('0') . "</td>";
$x++;
}
}
?>
</tr>
<tr>
<td style="font-weight:bold;">TANF</td>
<?php
$x = 1;
while($x <= $plotpoints) {
$earned_income_adjustment = ${"this_monthly" . $x} * $income_adjust_eidisregard;
$earned_income_disregard_amount = max(0, $earned_income_adjustment);
$this_countable_income = max(0, ${"this_monthly" . $x} - ($first_adult_deduct + $second_adult_deduct + $deduct_childsupport_amount +
$incomeexpenses_amount + $childcare_max_deduction + $child_support_received1_amount + $child_support_received2_amount +
$medical_elderly_disabled_amount + $earned_income_disregard_amount));
if(${"this_monthly" . $x} <= $gross_income_limit_amount) {
$this_gross_income_test = "TRUE";
} else {
$this_gross_income_test = "FALSE";
}
if($this_countable_income < $standard_of_need_total) {
$this_adjustment_test = "TRUE";
} else {
$this_adjustment_test = "FALSE";
}
if(($this_gross_income_test = "TRUE") && ($child_test == "TRUE") && ($this_adjustment_test = "TRUE") && ($Resource_Test_Passed = "TRUE")) {
$This_Monthly_Assist_Payment = $Total_MaxMonthly_Benefit - $this_countable_income;
if($This_Monthly_Assist_Payment >= $States_Minimum_Payment) {
$This_TANF_Subsidy_Amount = $This_Monthly_Assist_Payment;
} else {
$This_TANF_Subsidy_Amount = 0;
}
${"this_tanf" . $x} = $This_TANF_Subsidy_Amount;
if($This_TANF_Subsidy_Amount > 0) {
echo "<td>" . number_format($This_TANF_Subsidy_Amount) . "</td>";
} else {
echo "<td bgcolor=\"lightgray\">" . number_format($This_TANF_Subsidy_Amount) . "</td>";
}
} else {
${"this_tanf" . $x} = 0;
echo "<td bgcolor=\"lightgray\">0</td>";
}
$x++;
}
?>
</tr>
<tr>
<td style="font-weight:bold;">Child Care</td>
<?php
$x = 1;
while($x <= $plotpoints) {
if($HowManyChildren != 0) {
$CCIS_Income_Counted = ${"this_monthly" . $x};
$CCIS_CountedIncome_Adjusted = $CCIS_Income_Counted - ($CCIS_Medical_Adjustment_Amount + $CCIS_WorkExpense_Amount + $CCIS_ChildSupport_Amount + $CCIS_StepParent_Adjustment + $CCIS_ChildSupportPaid_Amount + $CCIS_AlimonyPaid_Amount);
$CCIS_AdjustedIncome_Amount = max(0, $CCIS_CountedIncome_Adjusted);
$CCIS_AdjustedIncome_Annual = $CCIS_AdjustedIncome_Amount * 12;
if($CCIS_FPIG150Annual_Amount >= $CCIS_AdjustedIncome_Annual) {
$CCIS_AnnualIncomeTest = "True";
} else {
$CCIS_AnnualIncomeTest = "Fals";
}
if(($CCIS_KidsLessThan13_Amount + $CCIS_KiddosUnable_Amount) > .5) {
$CCIS_ChldAge_Test = "True";
} else {
$CCIS_ChldAge_Test = "False";
}
$passSNAP_resource_test = $passSNAP_resource_test;
$whichcopay = "copay_p" . $people_count;
$whichccis = strtolower($cl_stateinits) . "_ccis_copay";
//echo "<br><br>ccp_sql = SELECT ".$whichcopay." FROM ".$whichccis." WHERE mni_from>=".$CCIS_AdjustedIncome_Amount."<br><br>";
$ccp_sql = "SELECT $whichcopay FROM $whichccis WHERE mni_from>=$CCIS_AdjustedIncome_Amount;";
$ccp_result = $dbconn->query($ccp_sql);
$ccp_row = $ccp_result->fetch_assoc();
$CCIS_Child1_ThisCoPay_Amount = $ccp_row[$whichcopay];
if($CCIS_KidsLessThan13_Amount > 1) {
$CCIS_ChildMore_ThisCopay_Amount = ($CCIS_KidsLessThan13_Amount - 1) * ($CCIS_Child1_ThisCoPay_Amount / 2);
} else {
$CCIS_ChildMore_ThisCopay_Amount = 0;
}
$CCIS_TotalMonthlyCopay = $CCIS_Child1_ThisCoPay_Amount + $CCIS_ChildMore_ThisCopay_Amount;
$CCIS_SubsidyLessCopay = max(($CCIS_MaxSubsidy_Amount - $CCIS_Child1_ThisCoPay_Amount), 0);
} else {
$$CCIS_ChldAge_Test = "False";
}
//=IF(AND(Z41=TRUE,Z42=TRUE,Z43=TRUE,Z67>0),Z67,0)
if(($CCIS_AnnualIncomeTest == "True") && ($CCIS_ChldAge_Test == "True") && ($passSNAP_resource_test == "True") && ($CCIS_SubsidyLessCopay > 0))
//CHANGE ME!!
//$This_CCIS_NetSubsidy_Amount=1;
{
${"this_ccis" . $x} = $CCIS_SubsidyLessCopay;
echo "<td>" . number_format($CCIS_SubsidyLessCopay);
//echo "<br>Gross == ".${"this_monthly".$x}."<br>";
//echo "<br>This_TotalIncome == ".$This_TotalIncome."<br><br>";
//echo $x;
echo "</td>";
//echo "<br> == ".."<br><br>"; $x++;
$x++;
} else {
${"this_ccis" . $x} = "0.00";
echo "<td bgcolor=\"lightgray\">" . number_format('0') . "</td>";
$x++;
}
}
?>
</tr>
<tr>
<td style="font-weight:bold;">Medical Assistance</td>
<?php
$MAGI_Income_Exclusions = $child_support_received_amount + $CCIS_AlimonyPaid_Amount + $MAGI_AlimonyReceived + $MAGI_MonthlyGifts + $MAGI_ArmedForcesAmount;
$MAGI_FPIG133 = $fpig100 * 1.33;
$MAGI_FPIG138 = $fpig100 * 1.38;
$MAGI_5Exclusion = $MAGI_FPIG138 - $MAGI_FPIG133;
$x = 1;
while($x <= $plotpoints) {
$MAGI_Adjusted_Gross_Income = ${"this_monthly" . $x} - $MAGI_Income_Exclusions;
if($MAGI_Adjusted_Gross_Income <= $MAGI_FPIG133) {
$MAGI_Adjusted_Monthly_Income = $MAGI_Adjusted_Gross_Income;
} else {
$MAGI_Adjusted_Monthly_Income = $MAGI_Adjusted_Gross_Income - $MAGI_5Exclusion;
}
if($MAGI_Adjusted_Monthly_Income <= $MAGI_FPIG133) {
$MAGI_Eligible = "True";
} else {
$MAGI_Eligible = "False";
}
//=IF(O19=TRUE,MAX(Obamacare_estimate,Monthly_Cost_of_Living_Medical),0)
if($MAGI_Eligible == "True") {
$MAGI_Subsidy_Amount = max($col_Obama, $col_MonthlyMedical);
${"this_magi" . $x} = $MAGI_Subsidy_Amount;
echo "<td>" . number_format($MAGI_Subsidy_Amount);
//echo "<br>THIS_MAGI".$x." == ".${"this_magi".$x};
//echo "<br>THIS_MONTHLY".$x." == ".${"this_monthly".$x};
//echo "<br>MAGI_Income_Exclusions ==".$MAGI_Income_Exclusions;
//echo "<br>MAGI_Adjusted_Gross_Income ==".$MAGI_Adjusted_Gross_Income;
//echo "<br>MAGI_5Exclusion == ".$MAGI_5Exclusion;
//echo "<br>MAGI_Adjusted_Monthly_Income == ".$MAGI_Adjusted_Monthly_Income;
//echo "<br>MAGI_Eligible == ".$MAGI_Eligible;
echo "</td>";
$x++;
} else {
${"this_magi" . $x} = "0.00";
echo "<td bgcolor=\"lightgray\">" . number_format('0') . "</td>";
$x++;
}
}
?>
</tr>
<tr>
<td style="font-weight:bold;">HUD Subsidy Pmt</td>
<?php
$HUD_Dependent_Count = $people_count + $Student_Count;
//THE 480 BELOW IS A STATIC ENTRY . . . NOT A LOOKUP!?
$HUD_Dependent_Allowance = 480 * $HUD_Dependent_Count;
if($elderly_disabled_home == "Yes") {
$HUD_ElderlyDisabled_Allowance = 400;
} else {
$HUD_ElderlyDisabled_Allowance = 0;
}
$EID_Count = 0;
if(isset($cl_input['Butt_Section8'])) {
if($cl_input['Butt_Section8'] == "Yes") {
$EID_Count++;
}
}
if(isset($cl_input['EIupemp'])) {
if($cl_input['EIupemp'] == "Yes") {
$EID_Count++;
}
}
if(isset($cl_input['EIupPart'])) {
if($cl_input['EIupPart'] == "Yes") {
$EID_Count++;
}
}
if(isset($cl_input['IncomeUp'])) {
if($cl_input['IncomeUp'] == "Yes") {
$EID_Count++;
}
}
if($EID_Count >= 2) {
$EID_Qualify = "Qualified";
} else {
$EID_Qualify = "Not Qualified";
}
if($EID_Qualify == "Qualified") {
//We still have to get the Qualified person's name
$EID_Qualified_Name = 1;
//And the qualifying start date
$EID_Qualified_Date = 1;
//echo "<br><br><span style=\"color:red; font-weight:bold;\">NOT ENOUGH INFORMATION TO PROCESS THE EID AMOUNT FOR HUD SUBSIDY . . . PLEASE CONTACT THE DEVELOPER</span><br><br>";
$EID_Amount = 0;
} else {
$EID_Amount = 0;
}
$x = 1;
while($x <= $plotpoints) {
$HUD_Annual_Income = ${"this_monthly" . $x} * 12;
if($HUD_Income_Limit > $HUD_Annual_Income) {
$HUD_Income_Test = "True";
} else {
$HUD_Income_Test = "False";
}
$HUD_NonReimbursed_Medical = $ExpenseDisabledAmount + $medical_elderly_amount;
$HUD_3Annual_Income = $HUD_Annual_Income * .03;
if($HUD_NonReimbursed_Medical - $HUD_3Annual_Income > 0) {
$HUD_Allowable_MedExpense = $HUD_NonReimbursed_Medical - $HUD_3Annual_Income;
} else {
$HUD_Allowable_MedExpense = 0;
}
$HUD_Childcare_Allowance = $ChildcareAmount * 12;
$HUD_EID_Allowances = $HUD_Allowable_MedExpense + $HUD_Dependent_Allowance + $HUD_ElderlyDisabled_Allowance + $HUD_Childcare_Allowance + $EID_Amount;
if($HUD_Annual_Income - $HUD_EID_Allowances < 0) {
$HUD_Monthly_Adjusted_Income = 0;
} else {
$HUD_Monthly_Adjusted_Income = ($HUD_Annual_Income - $HUD_EID_Allowances) / 12;
}
$HUD_30Monthly_Adjusted_Income = $HUD_Monthly_Adjusted_Income * .3;
$HUD_10Monthly_Gross_Income = ${"this_monthly" . $x} * .1;
if($HUD_30Monthly_Adjusted_Income > $HUD_10Monthly_Gross_Income) {
$HUD_TenantRent_Amount = $HUD_30Monthly_Adjusted_Income;
} else {
$HUD_TenantRent_Amount = $HUD_10Monthly_Gross_Income;
}
if($cl_utilities == "sua2") {
$HUD_Utility_Allowance = ($cl_ElectricAmount + $cl_GasAmount) * $HUD_Room_Adjusment;
$HUD_AdjustedRent_Amount = $HUD_TenantRent_Amount - $HUD_Utility_Allowance;
if($HUD_AdjustedRent_Amount < 0) {
$HUD_Rent_Subsidy = $SNAP_MonthlyRentMortgage;
} else {
$HUD_Rent_Subsidy = $SNAP_MonthlyRentMortgage - $HUD_TenantRent_Amount;
}
} else {
$HUD_Rent_Subsidy = $SNAP_MonthlyRentMortgage - $HUD_TenantRent_Amount;
}
if(($HUD_Income_Test == "True") && ($HUD_Rent_Subsidy > 0)) {
${"this_hud" . $x} = $HUD_Rent_Subsidy;
echo "<td>" . number_format($HUD_Rent_Subsidy);
//echo "<br>THIS_HUD".$x." == ".${"this_hud".$x};
echo "</td>";
$x++;
} else {
${"this_hud" . $x} = "0.00";
echo "<td bgcolor=\"lightgray\">" . number_format('0') . "</td>";
$x++;
}
}
?>
</tr>
<tr>
<td style="font-weight:bold;">Spending Power</td>
<?php
$x = 1;
while($x <= $plotpoints) {
$This_SpendingPower = ${"this_monthly" . $x} + ${"this_snap" . $x} + ${"this_tanf" . $x} + ${"this_ccis" . $x} + ${"this_magi" . $x} + ${"this_hud" . $x};
${"this_spendingpower" . $x} = $This_SpendingPower;
echo "<td>" . number_format($This_SpendingPower);
echo "</td>";
$x++;
}
?>
</tr>
</table>
<br>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<!-- ALLWAYS KEEP NEXT DIV AT THE VERY BOTTOM! This makes sure that the blue border stays bigger than the content. -->
<div style="clear: both;"> </div>
</div>
<!-- END MAIN DIV -->
<br>
<div align="center">
<table align="center" border="0" style="font-size: 11px;">
<tr>
<td colspan="3"><p align="center"><img alt="Copyleft Yo!" height="10" width="10"
src="images/Copyleft.png"/> 2017 CirclesUSA.org</p></td>
</tr>
<tr>
<td valign="middle" align="center">Powered with <img src="images/heart.png" height="10" width="10"
alt="Love is all that matters">
by VinceCo<br><br></td>
</tr>
<tr>
<td colspan="3" align="center">
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0"
src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png"/>
</a>
<br/>This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International License
</a>.<br><br>
HighCharts graphing is licensed separately from this work and is solely for use by Circles USA within
the scope of this work.<br>
Please contact HighCharts directly at <a href="http://www.highcharts.com/contact-email">http://www.highcharts.com/contact-email</a>
to obtain your own license.<br><br>
</td>
</tr>
</table>
</div>
<br><br>
</body>
</html>
<script type="text/javascript">
$(function() {
var MonthEXP = <?php Print($cl_input['PostMonthlyExpenses']); ?>;
var fpig1 = Math.round(<?php Print($fpig100); ?>);
var fpig2 = Math.round(<?php Print($fpig200); ?>);
var curr = <?php Print($current_line); ?>;
var cofl1 = <?php Print($costofliving); ?>;
var th1 = (<?php Print($this_hourly1); ?>).toFixed(2);
var th2 = (<?php Print($this_hourly2); ?>).toFixed(2);
var th3 = (<?php Print($this_hourly3); ?>).toFixed(2);
var th4 = (<?php Print($this_hourly4); ?>).toFixed(2);
var th5 = (<?php Print($this_hourly5); ?>).toFixed(2);
var th6 = (<?php Print($this_hourly6); ?>).toFixed(2);
var th7 = (<?php Print($this_hourly7); ?>).toFixed(2);
var th8 = (<?php Print($this_hourly8); ?>).toFixed(2);
var th9 = (<?php Print($this_hourly9); ?>).toFixed(2);
var th10 = (<?php Print($this_hourly10); ?>).toFixed(2);
var th11 = (<?php Print($this_hourly11); ?>).toFixed(2);
var th12 = (<?php Print($this_hourly12); ?>).toFixed(2);
var th13 = (<?php Print($this_hourly13); ?>).toFixed(2);
var th14 = (<?php Print($this_hourly14); ?>).toFixed(2);
var th15 = (<?php Print($this_hourly15); ?>).toFixed(2);
var th16 = (<?php Print($this_hourly16); ?>).toFixed(2);
var th17 = (<?php Print($this_hourly17); ?>).toFixed(2);
var th18 = (<?php Print($this_hourly18); ?>).toFixed(2);
var th19 = (<?php Print($this_hourly19); ?>).toFixed(2);
var tf1 = Math.round(<?php Print($this_tanf1); ?>);
var tf2 = Math.round(<?php Print($this_tanf2); ?>);
var tf3 = Math.round(<?php Print($this_tanf3); ?>);
var tf4 = Math.round(<?php Print($this_tanf4); ?>);
var tf5 = Math.round(<?php Print($this_tanf5); ?>);
var tf6 = Math.round(<?php Print($this_tanf6); ?>);
var tf7 = Math.round(<?php Print($this_tanf7); ?>);
var tf8 = Math.round(<?php Print($this_tanf8); ?>);
var tf9 = Math.round(<?php Print($this_tanf9); ?>);
var tf10 = Math.round(<?php Print($this_tanf10); ?>);
var tf11 = Math.round(<?php Print($this_tanf11); ?>);
var tf12 = Math.round(<?php Print($this_tanf12); ?>);
var tf13 = Math.round(<?php Print($this_tanf13); ?>);
var tf14 = Math.round(<?php Print($this_tanf14); ?>);
var tf15 = Math.round(<?php Print($this_tanf15); ?>);
var tf16 = Math.round(<?php Print($this_tanf16); ?>);
var tf17 = Math.round(<?php Print($this_tanf17); ?>);
var tf18 = Math.round(<?php Print($this_tanf18); ?>);
var tf19 = Math.round(<?php Print($this_tanf19); ?>);
var ts1 = (<?php Print($this_snap1); ?>);
var ts2 = (<?php Print($this_snap2); ?>);
var ts3 = (<?php Print($this_snap3); ?>);
var ts4 = (<?php Print($this_snap4); ?>);
var ts5 = (<?php Print($this_snap5); ?>);
var ts6 = (<?php Print($this_snap6); ?>);
var ts7 = (<?php Print($this_snap7); ?>);
var ts8 = (<?php Print($this_snap8); ?>);
var ts9 = (<?php Print($this_snap9); ?>);
var ts10 = (<?php Print($this_snap10); ?>);
var ts11 = (<?php Print($this_snap11); ?>);
var ts12 = (<?php Print($this_snap12); ?>);
var ts13 = (<?php Print($this_snap13); ?>);
var ts14 = (<?php Print($this_snap14); ?>);
var ts15 = (<?php Print($this_snap15); ?>);
var ts16 = (<?php Print($this_snap16); ?>);
var ts17 = (<?php Print($this_snap17); ?>);
var ts18 = (<?php Print($this_snap18); ?>);
var ts19 = (<?php Print($this_snap19); ?>);
var cc1 = Math.round(<?php Print($this_ccis1); ?>);
var cc2 = Math.round(<?php Print($this_ccis2); ?>);
var cc3 = Math.round(<?php Print($this_ccis3); ?>);
var cc4 = Math.round(<?php Print($this_ccis4); ?>);
var cc5 = Math.round(<?php Print($this_ccis5); ?>);
var cc6 = Math.round(<?php Print($this_ccis6); ?>);
var cc7 = Math.round(<?php Print($this_ccis7); ?>);
var cc8 = Math.round(<?php Print($this_ccis8); ?>);
var cc9 = Math.round(<?php Print($this_ccis9); ?>);
var cc10 = Math.round(<?php Print($this_ccis10); ?>);
var cc11 = Math.round(<?php Print($this_ccis11); ?>);
var cc12 = Math.round(<?php Print($this_ccis12); ?>);
var cc13 = Math.round(<?php Print($this_ccis13); ?>);
var cc14 = Math.round(<?php Print($this_ccis14); ?>);
var cc15 = Math.round(<?php Print($this_ccis15); ?>);
var cc16 = Math.round(<?php Print($this_ccis16); ?>);
var cc17 = Math.round(<?php Print($this_ccis17); ?>);
var cc18 = Math.round(<?php Print($this_ccis18); ?>);
var cc19 = Math.round(<?php Print($this_ccis19); ?>);
var mg1 = Math.round(<?php Print($this_magi1); ?>);
var mg2 = Math.round(<?php Print($this_magi2); ?>);
var mg3 = Math.round(<?php Print($this_magi3); ?>);
var mg4 = Math.round(<?php Print($this_magi4); ?>);
var mg5 = Math.round(<?php Print($this_magi5); ?>);
var mg6 = Math.round(<?php Print($this_magi6); ?>);
var mg7 = Math.round(<?php Print($this_magi7); ?>);
var mg8 = Math.round(<?php Print($this_magi8); ?>);
var mg9 = Math.round(<?php Print($this_magi9); ?>);
var mg10 = Math.round(<?php Print($this_magi10); ?>);
var mg11 = Math.round(<?php Print($this_magi11); ?>);
var mg12 = Math.round(<?php Print($this_magi12); ?>);
var mg13 = Math.round(<?php Print($this_magi13); ?>);
var mg14 = Math.round(<?php Print($this_magi14); ?>);
var mg15 = Math.round(<?php Print($this_magi15); ?>);
var mg16 = Math.round(<?php Print($this_magi16); ?>);
var mg17 = Math.round(<?php Print($this_magi17); ?>);
var mg18 = Math.round(<?php Print($this_magi18); ?>);
var mg19 = Math.round(<?php Print($this_magi19); ?>);
var hud1 = Math.round(<?php Print($this_hud1); ?>);
var hud2 = Math.round(<?php Print($this_hud2); ?>);
var hud3 = Math.round(<?php Print($this_hud3); ?>);
var hud4 = Math.round(<?php Print($this_hud4); ?>);
var hud5 = Math.round(<?php Print($this_hud5); ?>);
var hud6 = Math.round(<?php Print($this_hud6); ?>);
var hud7 = Math.round(<?php Print($this_hud7); ?>);
var hud8 = Math.round(<?php Print($this_hud8); ?>);
var hud9 = Math.round(<?php Print($this_hud9); ?>);
var hud10 = Math.round(<?php Print($this_hud10); ?>);
var hud11 = Math.round(<?php Print($this_hud11); ?>);
var hud12 = Math.round(<?php Print($this_hud12); ?>);
var hud13 = Math.round(<?php Print($this_hud13); ?>);
var hud14 = Math.round(<?php Print($this_hud14); ?>);
var hud15 = Math.round(<?php Print($this_hud15); ?>);
var hud16 = Math.round(<?php Print($this_hud16); ?>);
var hud17 = Math.round(<?php Print($this_hud17); ?>);
var hud18 = Math.round(<?php Print($this_hud18); ?>);
var hud19 = Math.round(<?php Print($this_hud19); ?>);
var sp1 = Math.round(<?php Print($this_spendingpower1); ?>);
var sp2 = Math.round(<?php Print($this_spendingpower2); ?>);
var sp3 = Math.round(<?php Print($this_spendingpower3); ?>);
var sp4 = Math.round(<?php Print($this_spendingpower4); ?>);
var sp5 = Math.round(<?php Print($this_spendingpower5); ?>);
var sp6 = Math.round(<?php Print($this_spendingpower6); ?>);
var sp7 = Math.round(<?php Print($this_spendingpower7); ?>);
var sp8 = Math.round(<?php Print($this_spendingpower8); ?>);
var sp9 = Math.round(<?php Print($this_spendingpower9); ?>);
var sp10 = Math.round(<?php Print($this_spendingpower10); ?>);
var sp11 = Math.round(<?php Print($this_spendingpower11); ?>);
var sp12 = Math.round(<?php Print($this_spendingpower12); ?>);
var sp13 = Math.round(<?php Print($this_spendingpower13); ?>);
var sp14 = Math.round(<?php Print($this_spendingpower14); ?>);
var sp15 = Math.round(<?php Print($this_spendingpower15); ?>);
var sp16 = Math.round(<?php Print($this_spendingpower16); ?>);
var sp17 = Math.round(<?php Print($this_spendingpower17); ?>);
var sp18 = Math.round(<?php Print($this_spendingpower18); ?>);
var sp19 = Math.round(<?php Print($this_spendingpower19); ?>);
$('#container').highcharts({
title: {
text: 'CLIFF EFFECT ANALYSIS',
x: -20 //center
},
subtitle: {
text: '',
x: -20
},
xAxis: {
title: {
text: 'HOURLY WAGE (40 HOURS PER WEEK)'
},
categories: [th1, th2, th3, th4, th5, th6, th7, th8, th9, th10, th11, th12, th13, th14, th15, th16, th17, th18, th19],
plotLines: [{
label: {text: 'Current Hourly'},
color: 'rgb(51,204,51)',
value: curr,
width: 2
}],
},
yAxis: {
title: {
text: 'MONTHLY AMOUNT'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valuePrefix: '$'
},
legend: {
layout: 'vertical',
align: 'right',