• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Question: How to calculate percentage discounts in Acrobat form?

New Here ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

I'm trying to create a form in Acrobat Pro DC on a PC running Windows 10 Pro.

 

I have a form that has drop-down lists of procedures which will auto-populate a "Cost" field. The sum of the cost fields is calculated in a "Total" field. I've been able to make that work, even including fixed-price discounts (e.g., -$1000, -$50).

 

Now, the client wants to calculate multi-procedure discounts. For 2+ procedures, the form needs to calculate 10% discount on each of the multiple prices, but not the first procedure price.

 

For example:

  • Abdominoplasty and Lipo = $9,825
  • Buccal Fat Pad Removal = $4,075 +10% discount = $3,668
  • Liposuction of Arms = $1,500 + 10% discount = $1,350
  • Total (including discounts) = $14,843

Is it possible to create a PDF form that will automatically perform those calculations—and show that those deductions were added?

 

Here is the code I use to populate the "Cost" field:

 

/* SetFieldValues */
// Place all pre-population data into a single data structure
var
ProcedureData =
{"Upper Blepharoplasty":{Cost: "4148"}, "Lower Blepharoplasty":{Cost: "4463"},
"Upper and Lower Blepharoplasty": {Cost: "6825"}, "Brow Lift Full": {Cost: "7980"},
"Brow Lift Lateral": {Cost: "4305"}, "Brow Lift and Upper Blepharoplasty": {Cost: "10395"},
"Lateral Brow and Upper Blepharoplasty": {Cost: "7245"}, "Genioplasty": {Cost: "4305"},
"Otoplasty": {Cost: "4410"}, "Earlobe Repair-Simple": {Cost: "1181"},
"Earlobe Repair Pair-Simple": {Cost: "1995"}, "Earlobe Repair-Complex": {Cost: "2573"},
"Earlobe Repair Pair-Complex": {Cost: "3780"}, "Facelift with Fat Grafting": {Cost: "13125"},
"Facelift Revision": {Cost: "15225"}, "Facelift and Upper Blepharoplasty": {Cost: "15698"},
"Facelift and Lower Blepharoplasty": {Cost: "15960"}, "Facelift and Upper and Lower Bleph": {Cost: "16958"},
"Facelift and C02 Laser Resurfacing": {Cost: "15750"}, "Facial Fat Grafting": {Cost: "4410"},
"Buccal Fat Pad Removal": {Cost: "4279"}, "Cheek Implants": {Cost: "6825"},
"Angle Implants on Lower Jaw": {Cost: "6825"}, "Lip Lift": {Cost: "3885"},
"Forehead Reduction-Skin": {Cost: "7285"}, "Forehead Reduction-Bone": {Cost: "10098"},
"Necklift": {Cost: "6825"}, "Rhinoplasty": {Cost: "7928"}, "Rhinoplasty Revision": {Cost: "10028"},
"Rhinoplasty and Rib Graft": {Cost: "10028"}, "PRP scalp injections": {Cost: "1226"},
"Abdominoplasty Mini": {Cost: "6825"}, "Reverse Abdominoplasty": {Cost: "6825"},
"Abdominoplasty and Lipo": {Cost: "10316"}, "Abdominoplasty Fleur De Lis": {Cost: "12390"},
"Brachioplasty and Lipo": {Cost: "6825"}, "Brazilian Butt Lift-Fat Graft to Butt": {Cost: "8741"},
"Liposuction-First Area": {Cost: "3728"}, "Liposuciton-Add Area": {Cost: "1575"},
"Fat Grafting Hands": {Cost: "4410"}, "Thigh Lift": {Cost: "7613"}, "Augmentation": {Cost: "6510"},
"Re-Augmentation-Size Only": {Cost: "6195"}, "Revision Augmentation": {Cost: "9030"},
"Augmentation and Lift": {Cost: "9975"}, "Fat Grafting to Breasts-1 Donor Area": {Cost: "8741"},
"Mesh": {Cost: "1680"}, "Mastopexy": {Cost: "6720"}, "Small Lift-Cresent or Periareolar": {Cost: "3045"},
"Reduction": {Cost: "8400"}, "Gynecomastia with skin removal-Bilateral": {Cost: "7455"},
"Gynecomastia-Bilateral": {Cost: "4200"}, "Explantation-Implants Only": {Cost: "4725"},
"Explanatation-Implants and Capsule": {Cost: "5775"}, "Explanation-En-Bloc": {Cost: "7455"},
"Explantation and Lift": {Cost: "9555"}, "C02 Face Laser-WIthout Surgical Procedure": {Cost: "4200"},
"CO2 Face Laser-With Surgical Procedure": {Cost: "2625"}, "Add on Area-Neck or Chest": {Cost: "525"},
"Breast Augmentation and Abdominoplasty-With Lipo": {Cost: "16275"},
"Breast Augmentation with Lift and Abdominoplasty-With Lipo": {Cost: "17325"},
"Labiaplasty": {Cost: "3854"}, "Scar Revision-10cm or less": {Cost: "1050"},
"Scar Revision-10cm or more": {Cost: "2100"}, "Rib Removal": {Cost: "7875"},
"Full Body Lift": {Cost: "18500"},
" (discount) Friends-n-Family": {Cost: "-1000"}, " (discount) Professional": {Cost: "-500"}};
function
SetFieldValues(cProcedure)
{
// Populate fields with values from the Procedure Data Object
this.getField("Cost").value=ProcedureData[cProcedure].Cost;
}

 

Any help would be appreciated. Thanks in advance.

 

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

413

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 08, 2022 Jun 08, 2022

Votes

Translate

Translate
Community Expert ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

Yes, it's possible. You will need to first count how many products were selected. If more then one, apply the discount(s) when calculating the total sum.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

You will find the answer in the attachment I posted in this topic:

https://community.adobe.com/t5/acrobat-discussions/discount-calculation-base-on-radio-button-choice/...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 10, 2022 Jun 10, 2022

Copy link to clipboard

Copied

LATEST

Thanks @JR Boulay ! It looks like I'll be able to make it work from what you had in that attached PDF. It was a huge help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines