If on 1040 I click for Schedule D (green box 13) and then
on Schedule D I click for Capital Loss Carryover Worksheet (green box 6)
then I get a JavaScript error
"which" not defined line 80 of carryOverCG.htm
and hence calculation is not done, results are not passed to Schedule D
and result from Schedule D to 1040 is not correct,
This also seems to be true if I load "testproject".
How can I either fix the source or somehow workaround and force the result
of Carryover worksheet into Schedule D?
Thanks,
Stephen Lewis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Further assessment of the function in question leads to the following changes in the calcTotals() function. Please check this out before accepting this as the de-facto correction.
function calcTotals(which) {
if (!validateNum(which)) {
return;
}
var f = document.forms[0];
var i1 = Number(f.i1.value);
var i2 = 0;
if (opener.use8914) {
i2 = f8914_i2;
}
// Add abs(2005 Loss/Std Cred) to 2005 AGI minus deductions
// This will probably be positive in most cases
var i3 = i1 - i2;
var i4 = Math.abs(f.i4.value);
var i5 = 1*i3+1*i4;
if (i5 < 0) {
i5 = 0;
}
var i6 = min(i4,i5);
var i7 = 1*f.i7.value;
if (i7 < 0) { // Loss
var i7 = 1*f.i7.value;
if (1*f.i8.value < 0) {
var i8 = 0;
} else {
var i8 = 1*f.i8.value;
}
var i9 = 1*i6+1*i8;
var i10 = diffOrZero(i7,i9);
f.i10.value = truncate(i10);
fSchedD.i6.value = f.i10.value;
} else {
var i7 = 0;
var i8 = 0;
var i9 = 0;
var i10 = 0;
f.i10.value = truncate(i10);
fSchedD.i6.value = f.i10.value;
}
var i11 = Math.abs(f.i8.value);
var i12 = f.i7.value;
if (i12 < 0) {
i12 = 0;
}
var i13 = diffOrZero(i6,i7);
var i14 = 1*i12+1*i13;
var i15 = diffOrZero(i11,i14);
f.i15.value = truncate(i15);
fSchedD.i14.value = f.i15.value;
///
saveForm();
opener.calcTotals();
}
If accepted, I will post in update5 later today.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using update4
If on 1040 I click for Schedule D (green box 13) and then
on Schedule D I click for Capital Loss Carryover Worksheet (green box 6)
then I get a JavaScript error
"which" not defined line 80 of carryOverCG.htm
and hence calculation is not done, results are not passed to Schedule D
and result from Schedule D to 1040 is not correct,
This also seems to be true if I load "testproject".
How can I either fix the source or somehow workaround and force the result
of Carryover worksheet into Schedule D?
Thanks,
Stephen Lewis
Stephen,
Good catch! These are regression errors from improvements in validation and in standardization.
On line 79, replace:
function calcTotals() {
with
function calcTotals(which) {
Also, to save you some grief, on line 129, change it from
opener.SchedD_calcTotal();
to
opener.calcTotals();
I'll post the alert now and get the fix out tomorrow morning.
Thanks!
Further assessment of the function in question leads to the following changes in the calcTotals() function. Please check this out before accepting this as the de-facto correction.
function calcTotals(which) {
if (!validateNum(which)) {
return;
}
var f = document.forms[0];
var i1 = Number(f.i1.value);
var i2 = 0;
if (opener.use8914) {
i2 = f8914_i2;
}
// Add abs(2005 Loss/Std Cred) to 2005 AGI minus deductions
// This will probably be positive in most cases
var i3 = i1 - i2;
var i4 = Math.abs(f.i4.value);
var i5 = 1*i3+1*i4;
if (i5 < 0) {
i5 = 0;
}
var i6 = min(i4,i5);
var i7 = 1*f.i7.value;
if (i7 < 0) { // Loss
var i7 = 1*f.i7.value;
if (1*f.i8.value < 0) {
var i8 = 0;
} else {
var i8 = 1*f.i8.value;
}
var i9 = 1*i6+1*i8;
var i10 = diffOrZero(i7,i9);
f.i10.value = truncate(i10);
fSchedD.i6.value = f.i10.value;
} else {
var i7 = 0;
var i8 = 0;
var i9 = 0;
var i10 = 0;
f.i10.value = truncate(i10);
fSchedD.i6.value = f.i10.value;
}
var i11 = Math.abs(f.i8.value);
var i12 = f.i7.value;
if (i12 < 0) {
i12 = 0;
}
var i13 = diffOrZero(i6,i7);
var i14 = 1*i12+1*i13;
var i15 = diffOrZero(i11,i14);
f.i15.value = truncate(i15);
fSchedD.i14.value = f.i15.value;
///
saveForm();
opener.calcTotals();
}
If accepted, I will post in update5 later today.
Thanks Tim,
My bug and a couple of cascade bugs fixed and posted to the download page
in under 19hrs (mostly nighttime) - much appreciated,
Stephen Lewis