Add number to even number pages and increment that number on those pages
Below is the JS that I am using but for some reason it is not incrementing on the fields. All the fields VOUCHERCOUNT values are the same. Attached is a screen shot. I have tired adding the increment both before and after the field being generated. I am trying to add the text fields on the even pages which I was able to do but I need the last part of this text to increment upwards. Any help is much appreciated as this is driving me crazy!! I am not sure if it is just something simple that I am missing.

SCHEDULE_NUMBER = this.getField("SCHEDULE_NUMBER").valueAsString;
VOUCHERCOUNT = this.getField("VOUCHERCOUNT").value;
for (var page = 0; page < this.numPages; page++) {
var numb = page+1;
if (numb%2 == 0) {
var firstpagecords = this.getPageBox("Crop",page);
Top = firstpagecords[1];
Midhoriz = firstpagecords[2]/2;
var ScheduleBox = this.addField("Textbox1", "text", page, [Midhoriz-200,Top-2,Midhoriz,Top-24]);
ScheduleBox.value = "L-" + SCHEDULE_NUMBER+ " / " + VOUCHERCOUNT;
ScheduleBox.textSize = 20;
ScheduleBox.textColor = color.red;
ScheduleBox.readonly = true;
VOUCHERCOUNT = VOUCHERCOUNT+1;
}
}
