GithubHelp home page GithubHelp logo

Comments (5)

rahulS-repo avatar rahulS-repo commented on May 20, 2024 1

Just add these lines in InvoiceForm component and it will fix all issue

 handleCalculateTotal() {
    var itemList = this.state.items;
    var subTotal = 0;
    // items.map(function (items) {
    //   subTotal = parseFloat(
    //     subTotal + parseFloat(items.price).toFixed(2) * parseInt(items.quantity)
    //   ).toFixed(2);
    // });
    itemList.map(
      (itemDetail) =>
        (subTotal +=
          parseFloat(itemDetail.price).toFixed(2) *
          parseInt(itemDetail.quantity))
    );

i am also not an expertπŸ˜…

from invoice-generator.

amarcin3 avatar amarcin3 commented on May 20, 2024

I found a solution to all problems. All bugs here are very easy to fix, but hard to find.
Solution for 1. and 3. In InvoiceForm.js around line 80 (mine says 84 because i have changed the code a little, you can also search for it using ctrl+f). you need to add another phraseFloat() because (i think, i am also not an expert) .toFixed() changes it back to string (and adding strings together is a mess)
git13

Solution for 2. I am no longer sure what fixed it in my code, but I think it could have been one of toFixed(2) around 85 line and below (see image)
git2
You can also add toString like on the image since the taxAmmount and discountAmmount are string values.

from invoice-generator.

kishanmodi avatar kishanmodi commented on May 20, 2024

@amarcin3 Back When I was learning, I created the same project. if you would like to check here's the link Invoice Generator.

from invoice-generator.

amarcin3 avatar amarcin3 commented on May 20, 2024

@kishanmodi Well, you have made some things work, but you also broke it a bit. When you delete the row above it breaks all the rows below. I know it was like a "one day project", and It won't be used as an actual invoice maker for any company, so it's fine.

from invoice-generator.

Vyomrana02 avatar Vyomrana02 commented on May 20, 2024

Still there was error in subtotal calculation, Can @johnuberbacher u assign me this issue?

from invoice-generator.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.