6 Replies Latest reply on May 7, 2016 11:07 AM by gkaiseril

    Spawn Page Calculation Carry to next spawn page

    Tom.Lam90

      Hi all!

       

      I am trying to create a simply invoicing PDF that will spawn different the same invoice pages with a button and a summary page:

       

      • first page is a summary page that will sum up all the different expenses from the following invoice page
      • I create a template with that invoice page (it is only 1 page), and it is hidden.
      • there is a add page button that will spawn the invoice template page
      • there is a remove page button that will remove the last page (which stop at summary page).
      • Each field from spawn page will be name P#.Invoice.[FieldName]
      • When adding or removing a page, I added this.calculateNow(); to recalculate the numbers that might be change.

       

      My problem is, for some reason, after creating the first invoice page, the different expense total for that previous page is carry over.

      e.g. the 1st invoice page has service expense total $100. When I spawn the 2nd invoice page, that $100 will appear in that page's field.

       

      this is what the script I wrote for that field, and other calculating fields, with small adjustment in which field to capture.

      this.calculateNow();

      var f_prefix = "";

      f_prefix = "P" + (this.pageNum) + ".Invoice.";

      event.value = this.getField(f_prefix+"HoursWorked01").value*100;

       

      I guess my question is whether I am missing something from my script or I wrote something wrong.

       

      Thanks in advance.

       

      Message was edited by: Tom Lam