Comments (5)
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.
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)
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)
You can also add toString like on the image since the taxAmmount
and discountAmmount
are string values.
from invoice-generator.
@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.
@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.
Still there was error in subtotal calculation, Can @johnuberbacher u assign me this issue?
from invoice-generator.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from invoice-generator.