Math.round with checkbox for tax

I have a form that needs to calculate sales tax. If it ships to California, then tax is applied.
I have been attempting to cobble together a Boolean JavaScript in Acrobat v8 (on a Mac) using Math.round(). No luck, it always defaults to else. I have searched this forum, planetpdf, bought Padlova's Acrobat Forms book, and just have been stonewalled on this issue.
I have a series of items that SubTotal - ItemTotal.1, ItemTotal.2, ItemTotal.3 using the simplified Value is menu.
California tax is calculated with (Tax * SubTotal) * 0.0725, where Tax is a checkbox with a Mouseup value of 1. When the checkbox is active, the tax is added, otherwise the tax value is zero.
As near as I can tell looking at the State Board of Equalizations tax tables, Acrobats default rounding is displaying the correct amount of tax.
Is there any reason I shouldnt leave this as it stands, as opposed to more research into the correct syntax for Math.round() with a checkbox variable?

Interesting - but exactly the sort of thing a programmer hates. It
gives a huge table, but it doesn't give the exact rules needed to
actually write legal code.
There isn't a generic standard to use. In fact, in some states, the
rule changed. For example, in 2005, Ohio changed to "The computation
shall be carried out to three decimal places. If the result is a
fractional amount of a cent, the calculated tax shall be rounded to a
whole cent using a method that rounds up to the next cent whenever the
third decimal place is greater than four. A vendor may elect to
compute the tax due on a transaction on an item or an invoice basis."
Instead of "always rounding up in any case where the tax calculation
yielded any fractional amount over a whole cent".
But you say "rounds up". Let's test that with the table. $100 is a
good starting point. 7.75% of $100 is exactly $7.75, so no rounding is
needed. This matches the table, which says that amounts over $99.93
pay $7.75 tax. So, what about $99.93? Calculated exactly, 7.75% is
$7.744575. If this were simply rounded up, the tax would be $7.75.
This suggests it is actually rounded to the closest, and might be the
same as the new Ohio rule. Or some variation on it.
Interestingly, there is a California sales tax calculator on
http://www.csgnetwork.com/salestaxcalc.html, and it seems to match the
table. They do offer a JavaScript calculator for license, and given
that it runs to something like 60 lines of code, this may be worth
considering, as reimplementing it (without copying) sounds hard work.
Aandi Inston

Similar Messages

  • Open dialog box window with checkboxes for each child record - Please Help

    Hello Everybody
    I have a 10g form with master record and 20 child records. In the child record form, currently there is a “Notes” Editor, which pops up when user click the “Edit” button. In the “Notes” editor, user enters remarks if anything is missing. For example, typical remarks will be: Statement is missing, LOC paper is missing etc.
    Now, I would like to replace “Notes” editor with a dialog box. In the dialog box , I would like to add checkboxes with values “Statement is missing” and “LOC paper is missing” etc. along with “Notes” field. The user can select checkboxes. The value of the checkboxes should go in the “Notes” field with the ability to edit it. This way, user doesn’t need to type the most common notes every time.
    I have created a “NewNotes” dialog box with checkboxes and multiline text Item. It is pops up when I click on the button. I have also created to WHEN_CHECKBOC_CHANGED trigger for each checkboxes so that the its value will go in a multiline text item.
    But, I am not sure how I can link “NewNotes” dialog box to the each record in child record block. I would really appreciate it if anybody could give me some idea.
    Thanks,

    if i understand correctly you have a note item (based on table) on every child record? when you open the dialog box: how do you put data from notes to dialog box? in the same way as you can write it back ...

  • Tree with checkbox for each level

    1. I have a tree an I want to add a check box to every node. I saw this fonctionality with Java and with a lot of programs (install with choises). I don't know if this is possible with FORMS. If not how knows a solution for this problem ?
    2. My tree is based to a SELECT and I want to add a parent for my tree
    and I don't know how to do it. The problem is this : the value for each node from the first level IS NULL.
    Thanks
    Bye

    I need this functionality because I have to select data's from a tree with 3 or 4 levels (like in the install software when we select to install only what we need).
    There is a lot of information and it's difficult to display all of it in the screen.

  • I cant modify my CheckTree Render to be a TableTree with Checkbox ?!!

    hello everybody .. i am trying for 2 week to modify my code i wrote
    (which allows me to have a tree with a checkbox ) to have a tabletree with checkbox for each node .. plz help .. this is my checkTree renderer
    package com.kelk.cfg_util_gui;
    /* swing1.1 */
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JCheckBox;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTree;
    import javax.swing.UIManager;
    import javax.swing.plaf.ColorUIResource;
    import javax.swing.tree.TreeCellRenderer;
    * @version 1.1 04/24/99
    public class CheckRenderer extends JPanel implements TreeCellRenderer {
         private static final long serialVersionUID = 1L;
         private Icon kelk = new ImageIcon("/com.kelk.cfg_util/Images/KELK32.gif");
    protected JCheckBox check;
    protected TreeLabel label;
    public CheckRenderer() {
    setLayout(null);
    add(check = new JCheckBox());
    add(label = new TreeLabel());
    check.setBackground(UIManager.getColor("Tree.textBackground"));
    label.setForeground(UIManager.getColor("Tree.textForeground"));
    public Component getTreeCellRendererComponent(JTree tree, Object value,
    boolean isSelected, boolean expanded,
    boolean leaf, int row, boolean hasFocus) {
    String stringValue = tree.convertValueToText(value, isSelected,
                   expanded, leaf, row, hasFocus);
    setEnabled(tree.isEnabled());
    check.setSelected(((CheckNode)value).isSelected());
    label.setFont(tree.getFont());
    label.setText(stringValue);
    label.setSelected(isSelected);
    label.setFocus(hasFocus);
    if (leaf) {
    label.setIcon(UIManager.getIcon("Tree.leafIcon"));
    //label.setBackground(Color.RED);
    } else if (expanded) {
    label.setIcon(UIManager.getIcon("Tree.openIcon"));
    } else {
    label.setIcon(UIManager.getIcon("Tree.closedIcon"));
    return this;
    public Dimension getPreferredSize() {
    Dimension d_check = check.getPreferredSize();
    Dimension d_label = label.getPreferredSize();
    return new Dimension(d_check.width + d_label.width,
    (d_check.height < d_label.height ?
    d_label.height : d_check.height));
    public void doLayout() {
    Dimension d_check = check.getPreferredSize();
    Dimension d_label = label.getPreferredSize();
    int y_check = 0;
    int y_label = 0;
    if (d_check.height < d_label.height) {
    y_check = (d_label.height - d_check.height)/2;
    } else {
    y_label = (d_check.height - d_label.height)/2;
    check.setLocation(0,y_check);
    check.setBounds(0,y_check,d_check.width,d_check.height);
    label.setLocation(d_check.width,y_label);
    label.setBounds(d_check.width,y_label,d_label.width,d_label.height);
    public void setBackground(Color color) {
    if (color instanceof ColorUIResource)
    color = null;
    super.setBackground(color);
    public class TreeLabel extends JLabel {
         private static final long serialVersionUID = 1L;
         boolean isSelected;
    boolean hasFocus;
    public TreeLabel() {
    public void setBackground(Color color) {
         if(color instanceof ColorUIResource)
         color = null;
         super.setBackground(color);
    public void paint(Graphics g) {
    String str;
    if ((str = getText()) != null) {
    if (0 < str.length()) {
    if (isSelected) {
    g.setColor(UIManager.getColor("Tree.selectionBackground"));
    } else {
    g.setColor(UIManager.getColor("Tree.textBackground"));
    Dimension d = getPreferredSize();
    int imageOffset = 0;
    Icon currentI = getIcon();
    if (currentI != null) {
    imageOffset = currentI.getIconWidth() + Math.max(0, getIconTextGap() - 1);
    g.fillRect(imageOffset, 0, d.width -1 - imageOffset, d.height);
    if (hasFocus) {
    g.setColor(UIManager.getColor("Tree.selectionBorderColor"));
    g.drawRect(imageOffset, 0, d.width -1 - imageOffset, d.height -1);
    super.paint(g);
    public Dimension getPreferredSize() {
    Dimension retDimension = super.getPreferredSize();
    if (retDimension != null) {
    retDimension = new Dimension(retDimension.width + 3,
                        retDimension.height);
    return retDimension;
    public void setSelected(boolean isSelected) {
    this.isSelected = isSelected;
    public void setFocus(boolean hasFocus) {
    this.hasFocus = hasFocus;
    }

    my code i wrote did you really?
    this fellow here wrote something similar
    http://www.objects.com.au/java/examples/src/tree/CheckRenderer.java
    perhaps you can swap notes.

  • Workflow - User decision step with checkboxes

    Is it possible in standard steps to give the user step of decision, but with options with checkboxes, for example 3, so that he can check or uncheck any of them?

    Thanks, I started making on my own the method of custom business object with screen and so on.
    thanks

  • Reports with checkbox

    Hello Friends,
    I have one interactive report in which it displays 20 records with checkboxes for each.
    From 20 i have randomly selected 6 checkboxes.
    Now i want to display those 6 records in my first seconday screen.
    How to display it? Please give some example.
    Thanks in advance.
    Regards,
    n.i.m.z.

    hi
       the requirement can be done using the READ LINE command...just set the pf-status GUI in the program with a button CLIC
    report zsathish.
    DATA: BEGIN OF ITAB OCCURS 0,
         FLAG(1),
          MATNR LIKE MARA-MATNR,
          END OF ITAB.
    DATA: MLINE TYPE I, MPAGE LIKE SY-PAGNO.
    START-OF-SELECTION.
      SET PF-STATUS 'GUI'.
      SELECT MATNR FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 20 ROWS.
      LOOP AT ITAB.
        WRITE : / ITAB-FLAG AS CHECKBOX, ITAB-MATNR.
       Hide : itab-matnr.
      ENDLOOP.
    MPAGE = SY-PAGNO.
    MLINE = MPAGE * 72.
    AT user-command.
    case sy-ucomm.
      when 'CLIC'.
      DO MLINE TIMES.
        READ LINE SY-INDEX FIELD VALUE ITAB-FLAG.
        IF ITAB-FLAG NE SPACE.
          WRITE : / ITAB-MATNR.
        ENDIF.
      ENDDO.
    if helpful, reward
    Sathish. R

  • Working with checkbox

    Good day everyone, im new to Apex and was doing just fine until i got stuck in this situation:
    - I have tables A, B and C, where B is the relationship between A and C;
    - I've created page 1 with a report of A, where the user selects 1 entry;
    - Page 2 shows a report with checkboxes for each row of C;
    I need to set checked the entries where A is related to C (B)
    Any ideas on how that could be achieved?
    Edson

    Enough with this ..... link
    http://www.oracle.com/technology/products/database/htmldb/howtos/checkbox.html
    How many times do we have to see it in the forum....Enough.....
    Its so frustrating giving the same link time and time again...And the funny
    part is that most people's questions has nothing to do with that. But
    still some geniuses give the same link....I just feel so sorry for people
    who are struggling to get a answer and some idiots give the same link

  • Event.value = Math.round (a.value * 5.00) / 100; Replace this with an input field for user to change

    I have a taxe calcul script in a field with a annulation check box like this:
    if (this.getField("CheckBoxHST").value=="Off") {
    // no tax
    event.value = 0;
    } else {
    // calculate the amount of tax to be paid
    var a = this.getField("pricehorstx");
    event.value = Math.round (a.value * 5.00) / 100;
    I like to able the user to change the percentage —>  (a.value * 5.00) with a simple text field — Say they enter 6% or any other percentage in there and the calcul become (a.value * 6.00) / 100;
    Not to sure how to acheive that....

    Work perfectly thanks...
    I feel so bad, everything work perfect, almost   — 
    — I just want when I check off (checkbox) the tax calculation to put whatever is in the tax percentage input box to zero and I can’t

  • How do I access compacted mail on a Mac version 10.5.8 stuck with Thunderbird version 16.0.2 ? I am unable to access needed documentation for Taxes, etc

    How do I access compacted mail on a Mac version 10.5.8 stuck with Thunderbird version 16.0.2 ? I am unable to access needed documentation for Taxes, etc

    Where in the world did you read Deleting All My Mail? I have reread my answer several times and cannot seem to find that in there.
    When you mark a message for deletion it does just that. It marks it for deletion and hides the message. It is not truly deleted until you compact.
    My point is that unless you deleted your important mail they should still be there somewhere.
    Your question was about compacting and thinking it put your messages in a nice little box for safe keeping and now you want to open it.
    I have to agree that Thunderbird did a horrible job of naming this process because most are like you and do not understand what it actually does. I included the link to the explanation of what compacting means in the Thunderbird world.
    Your messages may still be available to your but finding them has nothing to do with compacting.
    Thunderbird does not archive anything unless you use that process by selecting the message and pressing a. You have the option to setup where you want that archive to go and what folders to make.
    The All Mail folder is a goofy gmail arrangement. If you have problems with that then you need to address that with Google.
    If you go into your gmail account on the gmail site do you see the messages you are hunting in the All Mail folder there?

  • Indicator:Tax Determ.with doc.date (Assign Co.cd to Doc Date for Tax Detrm)

    Hi there,
    Facing a question when configuring Tax on Sales/Purchases. In Calculation node, there is a sub node named "Assign company code to document date for tax determination". Can anyone explain me on this, why there is such a logic to calculate tax based on document date?
    Any responses will be awarded,
    Regards,
    Samson

    Hi,
    Through this activity, you specify per company code the following data necessary for processing taxes with jurisdiction codes: whether the baseline date for determining the tax percentages should be the posting date (default date) or the document date.
    The system usually takes the posting date for this purpose. However, if you want the system to determine tax percentages on the basis of the document date, you must configure the system accordingly at this point.
    The tax percentage rates are dependent on the date in the case of the taxation procedure for jurisdiction codes.
    Regards,
    Jigar

  • Math.round produces inconsistent results

    We've been developing a tax calculator using the Flash 4 SDK in Flash Builder 4, and have experienced difficulties with rounding numbers - for example, the following statement:
         Alert.show(Math.round((8.325 * 100.0)) + ":" + Math.round(832.5));
    Both of the values rounded above should equal 833, however, the first one shows 832, while the second shows 833.  If both of the expressions inside the Math.round() functions equal 832.5, then how are the resulting values different?

    Thanks, Shongrunden - I found that same link literally a minute or two before I saw your response - after some preliminary testing, it looks like the following functions work well as a workaround:
    * Corrects errors caused by floating point math.
    public function correctFloatingPointError(number:Number, precision:int = 5):Number
         //default returns (10000 * number) / 10000
         //should correct very small floating point errors
         var correction:Number = Math.pow(10, precision);
         return Math.round(correction * number) / correction;
    * Tests if two numbers are almost equal.
    public function fuzzyEquals(number1:Number, number2:Number, precision:int = 5):Boolean
         var difference:Number = number1 - number2;
         var range:Number = Math.pow(10, -precision);
         //default check:
         //0.00001 < difference > -0.00001
         return difference < range && difference > -range;

  • Acrobat Pro 6 Average Daily Production and Math.round problem

    Acrobat Pro 6 Average Daily Production and Math.round problem
    (Production.0) (154) (whole units) . (Production.1) (90) (fractional) / (divided by) 31 (days) results in (Average.0) (4)(whole units) . (Average.1) (10) (fractional) using :Math.round.� Noticed that 154 (whole units) . 85 through 99 (fractional) also show 4.10. (without Math.round : 5.00)
    Method:
    �Production.0� (whole units) . �Production .1� (fractional) / Days = (Average Daily Production) (�Average.0� (whole units) . (Average.1) (fractional)
    � Production.0 (value not calculated)�, � Production 1 (calculated) (event.value = util.printx("0099", (event.value)).substr(-2,2); � �Average.0 (value not calculate)�, and �Average.1 has following calculation:
    var punits = this.getField("Production.0");
    var pfrac = this.getField("Production.1");
    var average = 0.0;
    average = (punits.value + pfrac.value / 100) / this.getField("Days").value;
    this.getField("Average.0").value = average - average % 1;
    this.getField("Average.1").value = util.printx("0099", Math.round((average % 1 * 100))).substr(-2,2);
    �Math.round� appears to be a problem. Also, could you explain the purpose of �0099� . Anyway, why would 154.85 through 154.90 divided by 31 give 4,10. Also, their must be a better way, to find the average daily production. All you have to do is divided the production (whole. fractional) by the days, and display the average daily production as (whole. fractional). Any suggestions??

    There are a many loose ends in your question.
    First, I have never seen before a variable type called 'var'. Is it a java primitive or a class?
    Next, I cannot seem to find any class that has the printx method.
    When it comes to substr(-2,2), I get confused. First, I thought that it was a method of the String class, but I only got as far as substring(beginIndex, endIndex).
    If you really must break the production and average into pieces, try this:
    float average = (punits + pfrac/100) / days;
    int avg_units = (int)average;
    int avg_frac = (int)( (average - avg_units) * 100 );My guess is that util.printx("0099", x) formats x having two optional digits and two mandatory digits, showing 0-99 as 00-99, but allows to show numbers with three and four digits.
    154.85/31 = 4,9951612903225806451612903225806
    154.99/31= 4,9996774193548387096774193548387
    If you round the fraction of theese numbers multiplied by 100 ( = 99.51.. and 99.968...) you get 100, and this will be the output of printx. My guess for "4.10" is that substr(-2,2) returns the two first characters of the string, because the start index should not be zero. (According to java docs, substring throws an exception on a negative index, so what kind of class are you really using ??????)

  • Need help with preloader for photo gallery

    Hello!
    I know I might be the 99999999991 to say that but I will say
    it...I'm a begginer with flash and I have a problem...:-)
    I'm building a photo gallery which loads jpg photos inside a
    loader component by using MovieClipLoader.
    Everything works just great but my only problem is that I
    can't scale the content (the jpg's) to the size of the loader
    component.
    I tryed everything but the photos are loading bigger then the
    loader, and I wnat to have the photos bigger then the loader so
    that I could have good quality on any resolution. Here's the
    actionscript I used, if it's necessary:
    //------------------MovieClip Loader---------\\
    var mcLoader:MovieClipLoader = new MovieClipLoader ();
    var myListener:Object = new Object ();
    mcLoader.addListener(myListener)
    myListener.onLoadProgress = function
    (target_mc,bytesLoaded,bytesTotal) {
    extLoader_mc._visible = true;
    var pctLoaded = Math.round(bytesLoaded/bytesTotal*100);
    extLoader_mc.extLoaderBar_mc._xscale = pctLoaded;
    extLoader_mc.extLoadinBarLines_mc._xscale = pctLoaded-1;
    extLoader_mc.pct_txt.text = pctLoaded;
    if (bytesLoaded >= bytesTotal) {
    extLoader_mc._visible = false;
    mcLoader.loadClip("pics/zernike1.jpg",picViewer_mc.picLoader);
    T
    Text
    Text

    first of all, you can't directly resize the bitmaps, you have to resize the movieclip above it. so if needed, create an empty movieclip inside another wrapper movie clip and resize the wrapper.
    then i noticed you don't have onLoadInit in your listener
    this method:
    myLIstener.onLoadInit=function(mc:MovieClip){
    will execute commands after the content is loaded. so you will have to resize your content after it's been loaded. you can't just resize something that you loaded above in your code, you have to wait until it's fully loaded
    anyways since you siad you are beginner i will list some useful tip for this job (i don't know if you already know them):
    this -refers to current movie clip
    this._parent -refers to parent movie cilp
    width and height of movie clips are controlled by _width and _height properties, not width height

  • How to use Round off function in TAX Formula

    Dear All,
             I have to do Round off in the Tax Formula. Hence I was suggested by the SAP Forum Team to use Round off function in the Tax Formulae.
             But sir I don't know how to use Round off function in the Tax Formulae.
            For Eg. BaseAmt = Total
                        TaxAmt = BaseAmt * Rate
               Now within this Eg. How will i use the Round off function and where i will use it.
               Please guide me with example.
      Regards
    Hitesh Parsawala

    Hi Hitesh,
    you can do like this
    Cess_ST_TaxAmt=Round(Cess_ST_BaseAmt*Cess_ST_Rate,0)
    where you can introduce rounding function by choosing from dropdown available in Operation and by click on Insert.
    It will post following in formulla window
    Round (Number, Decimals as Number)
    where in parameter you have to give 1.Number-which is to be round and 2.Decimals as Number-as per your requirement like by 2 decimal or 0 decimal
    If required give me call,
    BR
    Samir Gandhi

  • Rounding up of service tax

    Dear Friends,
    I have a requirement with one of my customers to round up the service tax, ecess & Secess values in a contract and in subsequent billing document. Here, in the pricing procedure beside the service tax condition type as well as the Ecess & Secess condition types, i have assigned requirement13 & calculation type 17. In each of the condition type header also i have entered rounding up(A). In OB90 also i have assigned 100 against the company code and currency. Inspite of doing all these the system is still now not rounding up the values as desired. For example, 203.34 is converted to 203.00 & 203.54 is converted to 204.00. But my requirement is this that in both the cases system should round up only.
    Please suggest if anything else is required to be done to achieve this.
    Regards.

    Hi Rakesh,
    What is happening in your case is the standard thing and if at all you want the system to behave like what u are saying then u need a development for this, take help from your abaper and ask him to modify the requirement 13 accordingly wherein it always takes the upper value instead of the standard rounding rules.
    regards,
    US

Maybe you are looking for

  • Wont burn audio cd with vista

    each time i load a clean disc it starts to initialize and then stops and tells me to load a clean cd!! it then flicks between 'initialising burn' and insert clean cd. i have tried loading earlier itunes but to no effect. i have itunes 8 in at the mom

  • Apple Mobile Service must be started to recognize I-Phone?

    Just downloaded I-Tunes latest version for Windows. I took over my wifes I-Phone 3 and in USB connecting get "This I-phone cannot be used because Apple Mobile Device Service has not been started?" How do I fix this?

  • How to modify -classpath dynamically?

    use classpath to execute an application: java.exe -cp c:\lib; TheApp while TheApp is running, maybe another classpath is required (i.e. user uses FileChooser from TheApp to select a directory: c:\any_dir). my Q is: how to add c:\any_dir as a new clas

  • OWB 10gR2 - Security and Change Control

    I am attempting to setup a customized change control policy in 10gr2. As part of change control, I'll need to setup security to only allow changes to objects that are scoped to the version. In previous versions, I could use WBSecurityServiceImpl. Wit

  • E66- opening link in bar code

    I was able to open the bar code link and instal applications directly into the phone. But after upgrading to the latest software version, I am not able to do do. The message says packet data is not available. Is it because a http url is involved?