dveldhoen / easyinvoice Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
How can I change the invoice template? For example how can I change the "Products" into "Services" on the pdf, or get rid of the "Quanity" column?
Thanks for this wonderful package..Is there any way to add discount to total amount.
Is it possible to add a way for grouping entries,
like:
Project 1
There could be a way to edit all parameters, maybe, while initializing.
To use this libary for example in german projects
If needed/possible i would like to contribute ๐
Due to the new update, all of our invoices which got sent was broken due to the new API
was updated, and since we had the "old" config everything was broken.
We had to fix the code and resend all of our invoices twice which is a bummer...
Thus I recommend version handling, to not get these mistakes. So when a new version of the NPM
comes out, it changes version to the correct one, and not the whole API
.
When i create invoice he return this message
{
error: 'Error',
message: 'NoSuchKey: The specified key does not exist.',
sentryId: 'eb96ab2ff2c5429e9b4ae11eb6911843'
}
Alright, so when I make a test order with 2 items and include some kind of discount code, VAT seems to not be calculated correctly.
Item A costs 120 EUR and item B costs 180 EUR. This makes 300. Now if you exclude the discount of 60, you'll be back at 240 EUR.
Now if you have 21% Tax running on both item A and B, you'll be charged with an additional 63 EUR for the taxes. I am not sure about this but I believe that is wrong. You are calculating taxes over an amount that is not being payed. 240 * 1,21 = 290,4. Not 303
Hello!
We would like to try your library, but from what we see it's calling an API endpoint to generate the PDFs. Could you please let us know about the rate limits?
Thanks,
Jeremy
When I try add the package to my project with nextjs and react I recieved the following error after start:
Location: "/mnt/c/Users/Angel Igareta/Desktop/AteCloud/ecommerce/packages/shop/babel.config.js"
error - /mnt/c/Users/Angel Igareta/Desktop/AteCloud/ecommerce/node_modules/easyinvoice/dist/easyinvoice.js
Module not found: Can't resolve 'fs' in '/mnt/c/Users/Angel Igareta/Desktop/AteCloud/ecommerce/node_modules/easyinvoice/dist'
Hi
I'm having an issue using the package, I get the error
TypeError: Cannot read properties of undefined (reading 'data')
at /home/gwendal/Documents/SvelteKit/easyinvoice/node_modules/easyinvoice/dist/easyinvoice.min.js:1:17753
at processTicksAndRejections (node:internal/process/task_queues:96:5)
My code is this :
var easyinvoice = require('easyinvoice');
var fs = require('fs');
var data = {};
easyinvoice.createInvoice(data, function (result) {
fs.writeFileSync("invoice.pdf", pdf, 'base64');
});
Hi,
Thanks for the really nice library.
Would be super nice if you can add:
Thanks in advance.
Hi,
First of all, nice library. Just a few concerns.
I noticed that your createInvoice function is making a call to 'https://api.factuursimpel.nl/v1/invoices';
I'm worried about data harvesting as well as a dependency to some external api which I have no control over. Is there a way to create invoice locally?
It would be nice to be able to use customer column names when specifying invoice entries.
const data = {
"currency": "EUR",
"taxNotation": "vat", //or gst
"marginTop": 25,
"marginRight": 25,
"marginLeft": 25,
"marginBottom": 25,
"logo": fs.readFileSync("resources/img/geode_logo.png", { encoding: 'base64' }), //or base64
"logoExtension": "png", //only when logo is base64
"companyFrom": "Geode",
"addressFrom": "Boulevard de la marquette",
"zipFrom": "31200",
"cityFrom": "Toulouse",
"countryFrom": "France",
"companyTo": invoice.order.company.name,
"addressTo": invoice.order.company.address,
"zipTo": invoice.order.company.zipCode,
"cityTo": invoice.order.company.address,
"countryTo": "France",
"invoiceNumber": invoice.invoiceId,
"invoiceDate": dateInvoice,
"products": [],
"bottomNotice": "Kindly pay your invoice within 15 days."
};
for (const orderItem of invoice.order.orderItems) {
data.products.push({
"quantity": orderItem.quantity,
"description": orderItem.product.name,
"tax": 20,
"price": orderItem.product.price
});
}
return await easyinvoice.createInvoice(data, function (result) {
return (result.pdf);
});
I got this config but the VAT isn't displayed at all.
In France, we have other mandatory fields for companies, named siret and siren is it possible to add them easily?
Thanks
Hi, can i know how to remove tax-rate and using only one tax for all products? Thank you
Hi! When providing a long document title (like "EARNINGS STATEMENT"), the text has to wrap.
However, it looks like there is an issue with the line height of the document title, since it wraps on top of the first line.
Hi @dveldhoen
Please consider below use case.
Example 1: Let X=5 & Y=2
Product P1 -> Price 2500INR, Quantity: 1, GST(Tax) 12%
Product P2 -> Price 1000INR, Quantity: 1, GST(Tax) 0%
Price P1 * Quantity P1 = S1: 2500 INR
Price P2 * Quantity P2 = S2: 1000 INR
S1 + S2 = Subtotal: 3500 INR
GST 12% of S1: 420 INR <------- optional field (product may/may not undergo tax depending upon type)
Discount 5% of Subtotal: 175 INR <------- optional field (business may/may not provide discount/sale)
Service Charge 2% of Subtotal: 70 INR <------ optional field (business may/may not charge service charge)
Example 2: Let X=0 & Y=2
Product P1 -> Price 2500INR, Quantity: 1, GST(Tax) 0%
Product P2 -> Price 1000INR, Quantity: 1, GST(Tax) 0%
Price P1 * Quantity P1 = S1: 2500 INR
Price P2 * Quantity P2 = S2: 1000 INR
S1 + S2 = Subtotal: 3500 INR
Service Charge 2% of Subtotal: 70 INR <------ optional field (business may/may not charge service charge)
Example 3: Let X=0 & Y=0
Product P1 -> Price 2500INR, Quantity: 1, GST(Tax) 0%
Product P2 -> Price 1000INR, Quantity: 1, GST(Tax) 0%
Price P1 * Quantity P1 = S1: 2500 INR
Price P2 * Quantity P2 = S2: 1000 INR
S1 + S2 = Subtotal: 3500 INR
Hence, deductions (Discounts & Service Charges) play an important role in invoicing/billing.
Please consider adding these optional fields. I am looking forward for positive response from your end. Also excited to discuss more business use cases in details.
Please how can I contribute to this project, what are the guidelines I must follow.
It would be great if there was an option for customizing the "Invoice Number" and "Invoice Date" text.
It could simply be optional dateText
and numberText
parameters on the data
object, which default to "Invoice Number" and "Invoice Date".
Hello,
Is there any way i can customize the layout of the generated invoice?
I mean something like adding extra text before the client data, changing font size or weight, etc.
Thx!
translate: { invoice: 'Invoice',
number: 'No.',
date: '่ซๆฑๆฅ',
subtotal: 'ๅฐ่จ',
products: 'ๅๅๅ/ๅๅ',
quantity: 'ๆฐ้',
price: '้้ก',
total: 'ๅ่จ' }
Hi, I already change word to Japanese in translate part but its not reflected in pdf file. I hope you can help me. Thank you sir
what if i wanted to add shipping fees at the end and add it to the total ?
Hello,
When trying to generate an invoice lately, I have been having this response:
{"success":false,"error":"TypeError","message":"Cannot read property 'toString' of undefined"}
The json file I send to the api:
{ "data":{ "documentTitle":"FACTURA", "currency":"EUR", "taxNotation":"vat", "marginTop":25, "marginRight":25, "marginLeft":25, "marginBottom":25, "logo":"X.webp", "sender":{ "company":"Restaurante X", "address":"Av. X \ns/n, Santa Cruz de Tenerife", "zip":"38400", "city":"Puerto de la Cruz", "country":"ES" }, "client":{ "company":"XX", "address":"-", "zip":"00000", "city":"S/C de Tenerife", "country":"ES" }, "invoiceNumber":41, "invoiceDate":"5/8/2020", "products":[ { "description":"BOCADILLO DE JAMON Y QUESO", "qt":1, "tax":7, "price":3.69 }, { "description":"BOCADILLO JAMON SERRANO", "qt":4, "tax":7, "price":3.9725 } ] } }
Hi,
I'm trying to run your library and when I launch your script then I've got:
(node:58474) [DEP0128] DeprecationWarning: Invalid 'main' field in '/app/node_modules/easyinvoice/package.json' of '/dist/easyinvoice.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
Everything works fine but would be nice to fix it anyway.
NPM version - 6.14.11
"webpack": "^4.0.0",
"@angular/core": "^11.1.1",
I have tried to install the npm packages "tty", "zlib" and even the browserify versions of those packages but they did not make a difference.
I also originally had the same errors for 'http', 'https' (solved by adding the following to my package.json:
"browser": { "http": false, "https": false },
The error for 'stream' was fixed by adding the npm package.
The error for 'os' was fixed with a workaround.
The errors for these packages all showed the same as attached. I just cannot fix these last two. It builds fine without using easyinvoice.download('myInvoice.pdf', result.pdf);
. It will build if I use easyinvoice.createInvoice
with nothing inside the function.
I did see a similar error reported but it was for react native.
Hi there,
First of all thank you for contributing to the github library. Can we perhaps add formatting to number values? 10000.00 is not formatted as 10,000.00.
Thanks a lot!
is it possible to create an invoice for a POS software?
Hi, is there the possibility to insert another column in the product table?
I need to insert the VAT for each of product.
Thank you
Just started getting this today:
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "No authorization header provided".] {
code: 'ERR_UNHANDLED_REJECTION'
}
Node.js v17.5.0
Since the package is based on a REST endpoint it is compatible with browsers. Though the package is not yet configured to work out-of-the-box in a browser.
Also an example should be added to display how to use in a browser environment.
Hi there,
Is there a possibility to change the title from "invoice" to "quotation". I can't seem to find a more detail document regarding this issue.
Great work btw.
Hi there, thanks for the great work on this package. It's super easy to use! However, I've just started to receive an error when trying to create an invoice:
{ error: 'SequelizeHostNotFoundError', message: 'getaddrinfo ENOTFOUND database-private-write.easyinvoice.cloud', errorId: '9671c6057739414db25022a250c82c3a' }
I haven't made any code changes recently and I haven't found any other issues with anything similar, do you have any idea what may be causing this?
Cheers!
Hi there, thanks for the great work you have put into the creation of the Invoicing API! I just have a bug that I recently found out and would like to highlight it :)
Bug: When using the translate.invoice for %document-title%, translation does not work
Replication: Send Post Data with the following parameters
{
"customize": {
},
"images": {
"logo": "https://public.easyinvoice.cloud/img/logo_en_original.png",
"background": "https://public.easyinvoice.cloud/img/watermark-draft.jpg"
},
"sender": {
"company": "Sample Corp",
"address": "Sample Street 123",
"zip": "1234 AB",
"city": "Sampletown",
"country": "Samplecountry"
},
"client": {
"company": "Client Corp",
"address": "Clientstreet 456",
"zip": "4567 CD",
"city": "Clientcity",
"country": "Clientcountry"
},
"information": {
"number": "2021.0001",
"date": "12-12-2021",
"due-date": "31-12-2021"
},
"products": [
{
"quantity": 2,
"description": "Product 1",
"tax-rate": 6,
"price": 33.87
},
{
"quantity": 4.1,
"description": "Product 2",
"tax-rate": 6,
"price": 12.34
},
{
"quantity": 4.5678,
"description": "Product 3",
"tax-rate": 21,
"price": 6324.453456
}
],
"bottom-notice": "Kindly pay your invoice within 15 days.",
"settings": {
"currency": "USD",
},
"translate": {
"invoice": "FACTUUR", // Default to 'INVOICE' <- This line has an issue
},
}
Additional Details: NIL
Hi @dveldhoen
Thank you for this awesome repo. I have been using easyinvoice since a year now and only complaint I have is providing an option for the page size to 80mm X 60mm (thermal paper) used for credit card printing or in the retail shops.
Could you please add thermal paper size to the page format options list.
Eg.:
export type InvoiceData = {
information?: InvoiceInformation,
translate?: InvoiceTranslations,
settings?: InvoiceSettings,
images?: InvoiceImages,
sender?: InvoiceSenderOrClient
client?: InvoiceSenderOrClient
products?: InvoiceProduct[]
bottomNotice?: string
}
there is missing field: customize
How can i add more columns to the main table ? and hide some props like client city ?
Hi, thanks for a great package!
I'm having issues importing it in nestjs (typescript):
node_modules/.pnpm/[email protected][email protected]/node_modules/easyinvoice/index.d.ts:90:5 - error TS2666: Exports and export assignments are not permitted in module augmentations.
export = easyinvoice
Neither of these imports worked:
import { createInvoice, InvoiceData } from 'easyinvoice';
import easyinvoice from 'easyinvoice';
Could it be because I'm using newer version of pdfjs? The old one had conflicts with my other dependencies.
Any suggestions?
Thanks!
Was trying to use this library and since it's using axios it's interfering with another library. The other lib is setting the global axios auth header, which results in easyinvoice also using the same API key. An easy fix for this would be to specify the Authorization header in each axios request to overwrite any other potential ones for that specific request.
I would do it myself, but I was not quite sure how changes are handled here with your dist.
The API is also denying all requests with an invalid API key, instead of letting through the free requests, like it does when no key is supplied. :)
Build in feature to use your local path e.g.:
const data {
logo: './img/logo.png'
}
I am getting the following error after installing and can't fix this can anybody help me with this.
./node_modules/easyinvoice/dist/easyinvoice.js
Module not found: Error: Can't resolve 'http'
is it closed source?
Hello
I think your service not works,
when i use createInvoice
translate: { invoice: 'Invoice',
number: 'No.',
date: '่ซๆฑๆฅ',
subtotal: 'ๅฐ่จ',
products: 'ๅๅๅ/ๅๅ',
quantity: 'ๆฐ้',
price: '้้ก',
total: 'ๅ่จ' }
Hi, I already change word to Japanese in translate part but its not reflected in pdf file. Can you help me? Thank you
(node:90936) [DEP0128] DeprecationWarning: Invalid 'main' field in 'node_modules/easyinvoice/package.json' of '/dist/easyinvoice.js'. Please either fix that or report it to the module author
(Use node --trace-deprecation ...
to show where the warning was created)
When I set my own logo or use my own background, this is the error message I get: {message: 'Endpoint request timed out'}
I cannot see what is causing this.
Hi there. When trying to add custom values on either the Sender or Client objects, they aren't shown in the invoice.
In my case, I am trying to add the value taxId
to both the Sender and Sender, but this property is not showing up on the generated PDF.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.