VT Income Frequency and Poverty Calculator
From PikaDocs
We changed the menu income_freq to this:
W | Weekly B | Every 2 Weeks T | Twice Monthly M | Monthly A | Annual
That is to say, we
- Re-labelled Bi-weekly as Every 2 Weeks to be plainer
- Added a new entry Twice Monthly
- Put the menu in order from shortest frequency to longest
You could do any or none of those if they interest you.
However, if you do add Twice Monthly, you need to modify the code for the Calculate button to handle the new entry.
You need to edit the file /js/case-elig.js.
1) Make a backup copy of the file
2) Open it in a text editor
3) Scroll down or search until you find this section:
if ('M' == document.ws.income_freq0.value)
{
document.ws.annual0.value = round(document.ws.annual0.value * 12);
}
4) Add code like this:
// Andrew 2005/11/17 add twice monthly
if ('T' == document.ws.income_freq0.value)
{
document.ws.annual0.value = round(document.ws.annual0.value * 24);
}
(Note that first line should be your name or initials, and today's date. This is to keep track of a change you made as opposed to something from Pika Software)
This code recognizes T as the value for twice monthly, and multiplies it by 24. You can see the monthly code above it multiplies by 12 and the every two weeks code below it multiplies by 26.
5) There are 3 other places you have to add similar code if you scroll down. What follows are code blocks from our file, you can see in each case the first stanza was pre-existing and I added the 2nd stanza.
What is changing each time is the numeral after income_freq
if ('M' == document.ws.income_freq1.value)
{
document.ws.annual1.value = round(document.ws.annual1.value * 12);
}
// Andrew 2005/11/17 add twice monthly
if ('T' == document.ws.income_freq1.value)
{
document.ws.annual1.value = round(document.ws.annual1.value * 24);
}
if ('M' == document.ws.income_freq2.value)
{
document.ws.annual2.value = round(document.ws.annual2.value * 12);
}
// Andrew 2005/11/17 add twice monthly
if ('T' == document.ws.income_freq2.value)
{
document.ws.annual2.value = round(document.ws.annual2.value * 24);
}
if ('M' == document.ws.income_freq3.value)
{
document.ws.annual3.value = round(document.ws.annual3.value * 12);
}
// Andrew 2005/11/17 add twice monthly
if ('T' == document.ws.income_freq3.value)
{
document.ws.annual3.value = round(document.ws.annual3.value * 24);
}
if ('M' == document.ws.income_freq4.value)
{
document.ws.annual4.value = round(document.ws.annual4.value * 12);
}
// Andrew 2005/11/17 add twice monthly
if ('T' == document.ws.income_freq4.value)
{
document.ws.annual4.value = round(document.ws.annual4.value * 24);
}
initial entry by Andrew Cameron
Legal Services Lawline of Vermont (http://www.lawlinevt.org/) and Vermont Legal Aid (http://www.vtlegalaid.org/)
Update 11/22/2005: Aaron indicates in a future version of Pika he will add the code and menu entry for Twice Monthly. If you want to re-label Bi-Weekly to Every 2 Weeks, or change the order of this menu, that's still going to be up to you.
