How to Create Payment Method Subtotals in an Acrobat PDF Form
Question details
The user wants to calculate and display separate subtotals for different payment methods (e.g., cash, credit card, check) within a fillable PDF sales form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing a fillable PDF sales or invoice form that processes multiple transactions and categorizes totals based on how the customer paid.
- Observed behavior
- The form needs to automatically evaluate the selected payment method for each row and sum the corresponding transaction amounts into dedicated subtotal fields.
Ensure you have Adobe Acrobat Pro or an advanced PDF editor installed, as basic PDF readers do not support creating or editing JavaScript calculations in form fields.
Use Custom JavaScript to Calculate Subtotals by Payment Type
Create custom JavaScript code within your subtotal fields to evaluate each row's payment method dropdown and add the corresponding amount to the specific total.
Acrobat's built-in sum function cannot filter by categories. To calculate subtotals based on a condition (like payment method), you must use a custom JavaScript calculation script that loops through your form fields.
Launch Adobe Acrobat, go to the Tools menu, and select 'Prepare Form'. This will make all your form fields editable and display the field properties.
Ensure your transaction rows have consistent, numbered field names. For example, name the payment dropdowns 'PayMethod1', 'PayMethod2' and the amounts 'Amount1', 'Amount2'.
Add separate text fields for each payment type at the bottom of your form, naming them appropriately, such as 'Subtotal_Cash' and 'Subtotal_Credit'.
Right-click the 'Subtotal_Cash' field, select Properties, and go to the Calculate tab. Select 'Custom calculation script' and click Edit. Write a JavaScript loop that iterates through your rows, checks if 'PayMethod' equals 'Cash', and if true, adds the 'Amount' to the running total. Repeat this process for the other subtotal fields.

Easily Manage and Fill Advanced PDF Forms with WPS Office
While advanced form creation requires specific design tools, WPS Office provides a comprehensive PDF toolkit that allows you to seamlessly view, fill, edit, and sign interactive PDF forms without expensive software subscriptions.
- 1. Open WPS Office: Launch the WPS Office application on your computer or mobile device and click on the 'PDF' tab.
- 2. Load Your PDF Form: Click 'Open' to browse your files and select the fillable PDF sales or invoice form you want to complete.
- 3. Fill in the Data: Click directly on the interactive fields, dropdowns, and checkboxes to input your transaction amounts and select payment methods.
- 4. Save and Share: Once the form is filled out, click 'Save' to preserve the data or use the share feature to send the completed PDF form via email.

Frequently Asked Questions
Why aren't my PDF form calculation scripts working?
Ensure JavaScript is enabled in your PDF reader's preferences. Additionally, double-check that your field names in the form exactly match the variable names referenced in your JavaScript code, as they are case-sensitive.
Will these JavaScript calculations work on mobile devices?
JavaScript support on mobile PDF readers is often limited. Complex form calculations might not execute properly on basic mobile viewer apps, so it is recommended to fill complex calculated forms on a desktop PDF editor.
Can I export the calculated PDF form data to Excel?
Yes, advanced PDF editors allow you to export form data to CSV or Excel formats, which is highly useful for further financial analysis, accounting, and record-keeping.




