Loading ...
Sorry, an error occurred while loading the content.
 

Calculations not working correctly

Expand Messages
  • swisscatdk
    Hi all One of you already helped me with this a while ago. In short: I need to calculate the Paypal fees for concert tickets. The main if is, that if the
    Message 1 of 1 , Nov 3, 2008
      Hi all
      One of you already helped me with this a while ago. In short: I need
      to calculate the Paypal fees for concert tickets. The main "if" is,
      that if the Paypal fee (5%) works out to less than 4 SFr, then the
      Paypal fee should be set to 4 SFr. Postage is only ever the three
      options, 8.40 or 6.00 or 1.00. The 1.00 is again linked to
      another "if" ("Late" lines). The fans can select if they want to pick
      up the tickets themselves (1 Fr instead of 8.40 or 6.00) but
      sometimes it's too late to send the tickets, so we charge 1 Fr for
      printing the tickets & the envelope so they can pick them up).

      The input and calculation lines of my clip is below.

      It works sometimes, but not always. It just calculated over 400 SFr
      instead of 42 SFr, and - even worse - as soon as the price of the
      tickets + postage is over about 200 SFr then it goes completely
      haywire and calculates only 4 SFr.

      I use exactly the same **script and calculation lines** for the
      resulting emails in English, French, German and Italian, and
      sometimes they work fine, sometimes they calculate wrongly.

      Could someone test it and tell me what is going wrong ?
      Many thanks for any suggestions. For testing purposes: the minimum
      price of a ticket is, say 33 SFr and there is no maximum, but it's
      the "200 SFr" limit which seems to wreck it.

      Here are the lines of my clip:

      ^!Set %Tix%=^?[Tickets value only=1]
      ^!Set %Postage%=^?[&Postage=8.40|6.00|1.00]
      ^!Set %Late%=^?[&Too late to send=1.00|0.00]
      ^!Set %Paypal%=^$Calc((^%Tix%+^%Postage%)*0.05;2)$
      ^!If "^%Paypal%" < "4.00" Next ELSE Skip_1
      ^!Set %Paypal%=^$Calc(4*1)$
      ;following calculates Paypal fee
      Paypal fee corrected: CHF ^%Paypal%

      ---------------------------

      ^!Continue [Question]
      Tickets* CHF ^%Tix%
      Postage* CHF ^%Postage%
      Paypal Fee* CHF ^%Paypal%
      ;following calculates final sum in SFr
      Total* CHF ^$Calc(^%Tix%+^%Postage%+^%Paypal%)$
      ;following calculates final sum in Euro
      ^!Set %Total_SFr%=^$Calc(^%Tix%+^%Postage%+^%Paypal%)$

      Euro* ^$Calc((^%Total_SFr%)/1.41;2)$ EUR
      ---------------------------

      ^!If "^%Paypal%" > "4.00" Next ELSE Skip_2
      ^!InsertText ^P Unfortunately, our ticket program is unable to
      calculate the Paypal fee correctly.
      ^!InsertText ^P The corrected Paypal fee is ^%Paypal% SFr.^P^P

      ^!If "^%Postage%" = "1.00" Next ELSE Skip_8
      ^!If "^%Late%" = "1.00" Next ELSE Skip_2
      ^!InsertText ^PIt is too late to send the tickets, so we have only
      calculated 1 SFr for the printing of the tickets and no postage.
      ^!InsertText ^pIf payment has been received, your tickets will be
      deposited at the ticket office where you can collect them there from
      doors-open time.^P^P

      ^!If "^%Postage%" = "1.00" Next ELSE Skip_3
      ^!If "^%Late%" <> "1.00" Next ELSE Skip_2
      ^!InsertText ^PYou have selected to pick up your tickets in person (1
      SFr for printing the tickets).
      ^!InsertText ^pIf payment has been received, your tickets will be
      deposited at the ticket office where you can collect them there from
      doors-open time.^P^P

      Please pay the sum in Euros to the correct Paypal address as given
      below.

      Paypal account: xxxxx
      Total sum: Euro* ^$Calc((^%Total_SFr%)/1.41;2)$ EUR

      ^!If "^%Postage%" <> "1.00" Next ELSE Skip_2

      ^!InsertText ^P^P As soon as your payment is received, your tickets
      will be sent with the next post.

      best wishes
      xxx
    Your message has been successfully submitted and would be delivered to recipients shortly.