Calculating taxes

HELP!! The user enters the value of their property and then clicks the button to compute tax.
After I enter the amount and click the button I get the following error.
Exception occurred during event dispatching;
java.lang.NullPointerException
Here is my code.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Debug1Application
public static void main(String args[])
PropTax myCalc = new PropTax();
class PropTax extends JFrame implements ActionListener
// Computes property tax
// as 3.25% of property value
private JTextField propVal;
private JLabel title, countyName, prompt, taxBill;
private JButton calcButton;
public PropTax()
Container c = getContentPane();
c.setLayout(new FlowLayout());
JLabel title = new JLabel("Property Tax Calculator");
JLabel countyName = new JLabel("Opulent County");
JButton calcButton = new JButton("Compute Tax");
JLabel prompt = new JLabel("Enter the value of your property");
JLabel taxBill = new JLabel("Your County Collector");
JTextField propVal = new JTextField(8);
c.add(title);
c.add(countyName);
c.add(prompt);
c.add(taxBill);
c.add(propVal);
c.add(calcButton);
propVal.setText("");
calcButton.addActionListener(this);
setSize(400,300);
setVisible(true);
public void actionPerformed(ActionEvent event)
CalcTax myCalcTax = new CalcTax ();
double value = Double.parseDouble(propVal.getText());
CalcTax.calculate();
taxBill.setText("Property tax is $" + CalcTax.getTax());
class CalcTax
final static double tax = 0.325;
static double pTax;
static double value;
public static void calculate()
pTax = tax * value;
public static double getTax()
return pTax;
}

The NullPointerException occurs because taxBill is null.
Your code defines taxBill as an instance variable of class PropTax in the line:private JLabel title, countyName, prompt, taxBill;Instance variables that are object references are initialized to null.
In the PropTax() constructor, the code defines a local variable also with the name taxBill in the line:JLabel taxBill = new JLabel("Your County Collector");This variable is not the same one as the original definition and its scope is the constructor method. The instance variable taxBill remains null.
In actionPerformed(), the reference to taxBill is to the instance variable and so you get a NullPointerException.
This is easy to fix, just don't declare the second set of variables in the constructor. Change the constructor code to be title = new JLabel("Property Tax Calculator");
countyName = new JLabel("Opulent County");
calcButton = new JButton("Compute Tax");
prompt = new JLabel("Enter the value of your property");
taxBill = new JLabel("Your County Collector");
propVal = new JTextField(8);The changes that slyle pointed out still need to be made to fix the calculation logic.

Similar Messages

  • While invoice verification system calculating tax on delivery costs also

    hi Guru's
       i am facing problem that , wile invoice verification system calculating tax on delivery costs also , and when i am removing tax code in front of dilivery costs , invoice is not posting , i can use zero tax code for delivery costs , but i dont want to use  any tax code for delivery cost , what should i do 
          please help

    HI,
    invoice is not posting , i can use zero tax code for delivery costs , but i don't want to use any tax code for delivery cost , what should i do
    You have to use tax code for that with ZERO tax code,its like import condition where we used zero tax code
    No other option!!!
    Regards
    Kailas Ugale

  • Additional offset tax line after manual change of calculated tax amount

    Dear all,
    I have the following problem:
    if I manually change the calculated tax amount of a domestic AP invoice in r12 the system generates a second tax line as an offset tax so that the total tax is zero. The system does this even so the respective flag is not set for this supplier. I can only stop this by erasing the link between standard tax and offset tax which is not a permanent option.
    Kind regards
    Carsten

    You can uncheck the Auto Tax Calculation check box in E Business tax module which will ensure that automatic tax calculation will not be done.
    Once the above checkbox is unchecked, you keyed an invoice by entering all the required details click on the Calculate tax button which will perform the tax calculation for your invoice.
    Hope this helps.
    Thanks and Regards
    Manish Jain.

  • How to get pre-calculated tax detail before order entry.

    Hello,
    Is there any API to get TAX detail that applied on order before order book.
    We need pre-calculated TAX amount before order entry and that we have to pass to customer when they search for item on website.
    Please advice if have any script available.
    Regards,
    Akil.

    Hi Akil,
    no, we have not found a "standard" solution. We have made some customization that calculates some "estimated Tax" and prints in on the Order Acknowledgment. But nothing within the system itself, unfortunately.
    Do you get an estimated Tax calculated when you book your order? If yes, then perhaps you should think about changing your process and get the orders booked?
    regards,
    David.

  • Override calculated tax distribution account in PO-matched R12 AP invoice

    Hi my friends,
    Can you tell me whether it is possible to override the calculated tax distribution account in PO-matched AP invoice in R12 version? Is there any options to control it?
    We found we can override the calculated tax distribution account in normal AP invoice in R12. But we can't do that for PO-matched AP invoice in R12, while we can do that in 11i.
    Thank you in advantage.
    Best regards,
    Ning

    Hi Ning:
    Please check if 'enforce tax from reference doc' flag at the configuration owner tax options is checked. If this flag is checked, the tax would always be enforced from the PO, and overrides will not be considered.
    Uncheck this flag and try overriding tax lines after matching.
    Hope this helps !!
    Tarun

  • Invoice tax amount is not equal to the calculated tax amount

    Hi All,
    I'm importing AP invoices through Open Interface R12.
    Lines includes Tax lines as well. But Invoices become held when I try to validate.
    I'm getting this hold reason: "Invoice tax amount is not equal to the calculated tax amount"
    Can anybody advise please ?
    Thanks,

    Use T. code SM30 and give table name J_1IT030K_V and click on maintain button give your chart of account, press enter here assign appropriate G/L A/C against Tax code MK.

  • Calculating tax using EB Tax

    Hello Gurus,
    Can you tell me at what level does Oracle calculate tax using EBTax…is it at the invoice line level or can it go down to Invoice distribution level? Since distribution may have a taxable event and one invoice line may have multiple distributions, calculating tax at the invoice distribution level is more accurate. How can this be achieved?
    Thanks!

    Hi,
    Please provide all the details PO qty,Price tax code Tax amounts and freight amount
    GR qty and a/c entries
    MIRO qty what are the tax lines that are appearing for freight when you simulate
    also against which you are doing MIRO i.e Po no Planned delivery cost or any other combination
    Edited by: redriver on Jan 27, 2012 12:03 PM

  • BSI not calculating Tax

    HI,
    When I run payroll, it gives a message
    1201
    THERE IS NO ACTIVE TAX FORMULA ON FILE TO PROCESS THE CENTRAL BUCKS S D 084 TAX
    FOR THIS DATE
    Can someone help me with this issue ?
    Thanks,
    Sesha.
    Edited by: Sesha Venkata on Feb 12, 2008 12:48 AM

    You wrote:
    In T5UTD, I have the following entries for PAAS
    PAAS Central Bucks S D 01 Withholding Tax 10/31/1993 12/31/9999
    PAAS Central Bucks S D 51 Employee Occupatio 01/02/2001 12/31/9999
    PAAS Central Bucks S D 84 Local Services Tax 01/02/2001 12/31/9999
    It doesn't let me delimit the entry for tax type 51. If you see in my other message, I mentioned the tables and entries that I updated. I don't understand why it isn't calculating taxes for 84.
    Quick question, for my own piece of mind, what TUB level are you on?
    I ask because I know through this process of OPT -> LST, that SAP and BSI have released several correction bulletins. To me, the tax type 84 entry with a begin of 01/02/2001 is wrong because the tax is effective 01-Jan-08.
    Anyway, don't delimit the entry in T5UTD, delimit the tax model entry on T5UTE.
    And another thing that I'm not sure I made clear(er) is that the message 1201 is a warning message. Payroll will still run, if anything, this message just indicates that your tax models need updating.
    Regards,
    Kevin

  • Reg. Calculated tax values in Purchase order

    Dear All
    I have to print tax percentage and value applicable in Purchase order. In po, at item level by clicking <i>invoice view</i> tax code appear as 3C besides button named <i>TAXE</i>S. on clicking <i>TAXES</i> different value of tax and excise with percentage appears. all these appears thru komv structure. i want to print these vales.
    by click <i>Where used Structure KOMV</i> there appears many object /classes. but i dont know how to use these. kindly provide me solution to fetch these values.
    thanks/regards
    Manjit

    Create Tax code in FTXP
    Let us SAy A1 --Note : for purchasing it should be input tax only
    Then in FV11 Create condition record with plant material and vendor combination with cond type as JVRD
    Maintain the TAx rate as 4 % or whatever is applicable
    also enter the Tax code as A1 which u have created for ur tax procedure TAXINN
    SAve it
    Create a PO for the same material,vendor and plant combination
    and enter the Tax code as A1
    I think with the above details ur tax should get calculated
    regards
    shailesh

  • BAPI_ACC_DOCUMENT_POST not calculating TAX

    Hi,
    I am using BAPI_ACC_DOCUMENT_POST for posting the FI document for RC type. I tried posting it normally and it posted correctly. But when i give some ACCOUNT TAX information, it is not calculating.
    Here is how I am filling the details.
    Header:
    BUS_ACT = RFBU.
    USERNAME = SY_UNAME.
    HEADER_TEXT = TEXT.
    COMP_CODE = BUKRS.
    DOC_DATE = 12/12/2011
    PSTNG_DATE = 12/05/2011.
    FIS_PERIOD = 00
    REF_DOC_NO = 9700000036.
    AC_DOC_NO = 9700000036.
    Account GL Table:.
    ITEMNO_ACC = 10.
    GL_ACCOUNT = 412010.
    DOC_TYPE = RC.
    COMP_CODE = RECN.
    FIS_PERIOD = 00.
    PSTNG_DATE = 12/05/2011
    TAX_CODE = TN
    TAXJURCODE = TN3707600
    COST CENTER = 107
    Account Receivable:
    ITEMNO_ACC = 20.
    CUSTOMER = 1126045
    COMP_CODE = RECN
    BLINE_DATE = 12/12/2011.
    PYMT_METH = B
    CURRENCY AMOUNT : 2 LINE ITEMS
    1ST LINE ITEM
    ITEMNO_ACC = 10
    CURRENCY = USD
    AMT_DOCCUR = 500.00-
    DISC_BASE = 500.00-.
    2ND LINE ITEM
    ITEMNO_ACC = 20
    CURRENCY = USD
    AMT_DOCCUR = 500.00
    AMT_BASE = 500.00.
    I did not enter the account tax table as I am not sure how to enter the date. But I know that the tax rate is 9.25% and for 500 the tax would be 42.33. I need to make sure that the BAPI posts the document as it posts from FB01 when we check the check box 'calculate tax'. Right now, with these details it is posting the data but not calculating the tax.
    Please help.
    Regards
    Guru
    Edited by: GuruCharan on Dec 15, 2011 6:28 PM

    Raymond,
    Thanks for the reply. I did read the notes you have suggested. They are quite informative but unfortunately -
    Note 367175 is related to the other BAPI`s. My issue is with the BAPI_ACC_DOCUMENT_POST.
    Note 487064 is related to the error when the tax amount is greater than the base amount.
    Since I am using the Acc document post BAPI, please help me understand how to fill in the data for ACCOUNT TAX table or post the document from the BAPI along with the tax as it does in FB01.
    Thanks Again,
    Regards,
    Guru.

  • Not calculating tax in invoice!

    Dear friends,
    I have created invoice, but it is not calculating the tax. What could be the possible reason and what could be the solution? What is the tax procedure used in this case?

    Hi tasleemarif,
                       first of all check whether you have assigned a tax code to your PO in the invoice tab in item details screen,if it is being already done check whether that tax code has been properly maintained in the FTXP tcode,again check while doing the MIRO proper tax code is selected in the TAX tab.Also dont forget to check the calculate tax check.hope,this will help you out.
                                                                                    regards,
                                                                                    ASHISH.

  • Not calculating tax!

    Hi freinds,
    Whenever i am trying to give tax code in invoice, it is not calculating the tax and is giving a message "Customization for SWI1 j_1iindcus missing in the table"  where SWI1 is my company code. Can anybody tell what the problem is and how to rectify it?
    Thanx

    Hi,
    this amy be the case:- Go to IMG -> Logistics - General->Tax on Goods Movements-> India-> Basic Settings-> Determination of Excise Duty-> Condition-Based Excise Determination-> Assign Tax Code to Company Codes
    and check do tax codes been assigned to company codes.
    Rgds
    S

  • Calculating tax condition amount

    Hi all,
    I am  confused on how the system calculates tax conditon amount (let' say MWST) in sales order. In my system the tax condition type mwst has a condition record maintained of 4%  thru VK11 and a tax code V0 assoicated with it.
    The base value for calculating the tax amount for mwst is taken from the SD pricing procedure and so the tax amount is calculated in sales order.... However I need to know that in FTXP for the tax code V0, there is a tax rate of 4% maintained against it and an account key mws and a GL account. Is MWST also maintained in FTXP for the relevant tax procedure for 4% ???. I need to know whether for posting to tax GL account for condition type mwst, does the system calculates the tax amount thru tax procedure  and if yes then how the system takes the value of BASB (base amount )in tax procedure in FTXP  for calculating the tax amount.
    regards
    sachin

    Hi Sachin
    Is MWST also maintained in FTXP for the relevant tax procedure for 4% ???. I need to know whether for posting to tax GL account for condition type mwst, does the system calculates the tax amount thru tax procedure and if yes then how the system takes the value of BASB (base amount )in tax procedure in FTXP for calculating the tax amount.
    The values maintained in FTXP are just for record purpose. For every Tax we should have a particular GL account, so that we can find the total tax in a period of time whenever required.
    But the actual calculation of tax is happening at pricing procedure level only. Tax is calculated based on base price in pricing procedure. Also assigning that amount to GLs assigned against them in VKOA.
    Hope this clarify your doubt.

  • To Read the processed subtotal and use for calculating tax.

    Hi,
    I calculated subtotal in REUSE_ALV_LIST_DISPLAY.
    I got the subtotal.
    After the subtotal i have a line to calculate the tax.
    Now I want to read the subtotal and get the sum(calculated total) and use it to process the tax.
    Thanks.
    Farid.

    TYPE-POOLS: slis.
    DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fieldcat TYPE slis_fieldcat_alv,
    it_events TYPE slis_t_event,
    wa_events TYPE slis_alv_event,
    it_sort TYPE slis_t_sortinfo_alv,
    wa_sort TYPE slis_sortinfo_alv,
    it_list TYPE slis_t_listheader ,
    l_layout TYPE slis_layout_alv,
    wp_type type SLIS_PRINT_ALV,
    tp_type type table of SLIS_PRINT_ALV.
    TYPES: BEGIN OF ty_itab,
    field2(10),
    field1(10),
    qty1(10),
    qty2 type i,
    qty3 TYPE i,
    Total type i,
    END OF ty_itab.
    DATA: itab TYPE STANDARD TABLE OF ty_itab WITH HEADER LINE,
          wa type ty_itab,
    itab1 TYPE slis_t_listheader.
    START-OF-SELECTION.
      CLEAR ITAB.
      itab-field2 = 'FIRST'.
      itab-field1 = 'FIRST'.
      itab-qty1 = '2'.
      itab-qty2 = 1.
      itab-qty3 = 5.
      APPEND itab.
      itab-field2 = ''.
      itab-field1 = 'FIRST'.
      itab-qty1 = '2'.
      itab-qty2 = 1.
      itab-qty3 = 5.
      APPEND itab.
      itab-field2 = 'FIRST'.
      itab-field1 = 'FIRST'.
      itab-qty1 = '2'.
      itab-qty2 = 1.
      itab-qty3 = 5.
      APPEND itab.
      itab-field2 = 'FIRST'.
      itab-field1 = 'FIRST'.
      itab-qty1 = '2'.
      itab-qty2 = 1.
      itab-qty3 = 5.
      APPEND itab.
      itab-field2 = 'SECOND'.
      itab-field1 = 'SECOND'.
      itab-qty1 = '2'.
      itab-qty2 = 1.
      itab-qty3 = 5.
      APPEND itab.
    itab-field2 = 'SECOND'.
      itab-field1 = 'SECOND'.
      itab-qty1 = '2'.
      itab-qty2 = 1.
      itab-qty3 = 5.
      APPEND itab.
    *  wa-field1 = ''.
    *  wa-qty1 = 'TAX'.
    *  wa-qty2 = 5.
    *  wa-qty3 = ''.
    *  insert wa into table itab.
      wa_fieldcat-fieldname = 'FIELD2'.
      wa_fieldcat-seltext_m = 'field2'.
      wa_fieldcat-no_out = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat .
      wa_fieldcat-fieldname = 'FIELD1'.
      wa_fieldcat-seltext_m = 'field'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat .
      wa_fieldcat-fieldname = 'QTY1'.
      wa_fieldcat-seltext_m = 'QUNTITY1'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat .
      wa_fieldcat-fieldname = 'QTY2'.
      wa_fieldcat-seltext_m = 'QUANTITY2'.
      wa_fieldcat-do_sum = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat .
      wa_fieldcat-fieldname = 'QTY3'.
      wa_fieldcat-seltext_m = 'QUANTITY3'.
      wa_fieldcat-do_sum = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat .
      REFRESH it_sort.
      wa_sort-fieldname = 'FIELD1'.
    *  wa_sort-fieldname = 'FIELD2'.
      wa_sort-up = 'X'.
    *  wa_sort-group = '*'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO it_sort.
      wp_type-no_new_page = 'X'.
      append wp_type to tp_type.
      CLEAR wa_sort.
      wa_sort-fieldname = 'QTY1'.
      wa_sort-up = 'X'.
      wa_sort-group = '*'.
    *  wa_sort-subtot = ' '.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
      PERFORM get_events .
    *  l_layout-subtotals_text = 'Subtotal'.
    *  l_layout-totals_text = 'Total text'.
      l_layout-no_totalline = 'X'.
      l_layout-max_linesize = '5'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = sy-repid
          it_fieldcat        = it_fieldcat
           I_SCREEN_END_LINE              = 3
          is_layout          = l_layout
          IS_PRINT = wp_type
          it_sort            = it_sort
          it_events          = it_events
        TABLES
          t_outtab           = itab
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
      IF sy-subrc <> 0.
      ENDIF.
    FORM get_events .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = it_events.
    *  READ TABLE it_events WITH KEY
    *  name = slis_ev_subtotal_text INTO wa_events.
    *  IF sy-subrc = 0.
    *    MOVE 'SUBTOTALS_TEXT' TO wa_events-form.
    *    MODIFY it_events FROM wa_events INDEX sy-tabix.
    *  ENDIF.
    *  CLEAR wa_events.
    *  READ TABLE it_events WITH KEY
    *   name = slis_ev_top_of_page   INTO wa_events.
    *  IF sy-subrc = 0.
    *    MOVE 'TOP_OF_PAGE' TO wa_events-form.
    *    MODIFY it_events FROM wa_events INDEX sy-tabix.
    *  ENDIF.
    READ TABLE it_events into wa_events WITH KEY name = 'BEFORE_LINE_OUTPUT'.
      if sy-subrc = 0.
        wa_events-form = 'BEFORE_LINE_OUTPUT'.
        MODIFY it_events FROM wa_events TRANSPORTING form WHERE name = 'BEFORE_LINE_OUTPUT'.
      ENDIF.
    READ TABLE it_events into wa_events WITH KEY name = 'AFTER_LINE_OUTPUT'.
      if sy-subrc = 0.
        wa_events-form = 'AFTER_LINE_OUTPUT'.
        MODIFY it_events FROM wa_events TRANSPORTING form WHERE name = 'AFTER_LINE_OUTPUT'.
      ENDIF.
    *read table it_events with key name = slis_ev_end_of_page into wa_events.
    *IF sy-subrc eq 0.
    *  wa_events-form = 'END_OF_PAGE'.
    *ENDIF.
    ENDFORM. " GET_EVENTS
    FORM before_line_output using p_c type slis_lineinfo.
      if p_c-subtot = 'X'.
          itab-field1 = ''.
          itab-qty1 = 'TOTAL'.
      endif.
    ENDFORM.
    FORM after_line_output using p_c type slis_lineinfo.
      if p_c-subtot = 'X'.
          ULINE AT (p_c-LINSZ).        "Dynamic Line Size
        FORMAT COLOR COL_TOTAL ON. "Setting the color
        WRITE :/
          sy-vline,
          15 'Tax',
          13 sy-vline,
          24 sy-vline,
          35 sy-vline.
        POSITION P_C-LINSZ.
        WRITE: SY-VLINE.
        FORMAT COLOR OFF.
      endif.
    ENDFORM.

  • Exclude discount while calculating Tax

    Hi, Guru's
    I have create a pricing condition in po and requirement is as under, can you please any guide in the following condition
    Basic Price          = 100
    Discount              =  10
    Less : Rate Diff   =   5
    Currently the tax calculating on 100 - 10 - 5 = 85 but my requirment is the taxes (BASB) should be calcute on 100 - 10 = 90.
    can any body helpe me
    Thanx!
    Rizwan

    Dear sunil
    scenarioa is as under.
    BASIC PRICE(PMT)     69750.00
    ADD : EXCISE DUTY 8%     5580.00
                              75330.00
    ADD : CESS 3% ON ED     167.40
                              75497.40
    ADD: CST  2%      1509.95
                              77007.35
    LESS:RATE DIFF DISC     2675.24
    TOTAL                          74332.11
    Posting in GR account     71259.95
    Less : Rate Diff.     -2675.24
    Shall post the GR as      68584.71

Maybe you are looking for

  • Mountain Lion Finder has no boolean operators?  Where?  When?

    Mountain Lion Finder has no boolean operators?  If so, where?  If not, when?  THANKS

  • Data Migration Infotype load sequence

    Hi All, I am migrating data from our legacy system to SAP HR infotypes and would like to know what the sequence / dependencies are.  There are two of us doing the work and I was hoping we could load some of them simultaneously but I realise there are

  • Validation Failure : Downgrade from Newer Version to the Older Version.

    We have recently upgraded our application from RTR 1.0 version to RTR 2.0 version. Now we are planning on downgrading ( i.e backout ), this new RTR 2.0 version to the RTR 1.0 version of the application. The resource type for this application is : SUN

  • Charging Help! NEED HELP IMMEDIATELY!

    I really need some help. IMMEDIATELY, TOO. I am going on a trip tomorrow and am planning on bringing my new iPod nano with me. Of course, I realised that the nano does NOT come with an AC adapter, like my previous 20GB ipod did. And here the problem

  • Form guide with digital signature inside workspace

    Hi, I want to use form guides for user form filling, but also the resultant PDF form must be digitally signed. I'm presenting the form inside Workspace and as a part of workflow. I've read Form Guides Getting Started document. There, it uses xfaForm