Git Product home page Git Product logo

easyinvoice's People

Contributors

dependabot[bot] avatar dveldhoen avatar employee451 avatar hannesfant avatar kagchi avatar manish3323 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

easyinvoice's Issues

Changing invoice template.

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?

Adding Discount

Thanks for this wonderful package..Is there any way to add discount to total amount.

Way for grouping entries

Is it possible to add a way for grouping entries,
like:

Project 1

  • Usage 1 ---------------------------- Price
  • Usage 2 ---------------------------- Price
  • ...

Multi-Language Support

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 ๐Ÿ‘

API Handling

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.

Not Working

When i create invoice he return this message

{
error: 'Error',
message: 'NoSuchKey: The specified key does not exist.',
sentryId: 'eb96ab2ff2c5429e9b4ae11eb6911843'
}

VAT not being calculated correctly?

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

API rate limits

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

Not compatible with NextJs and React

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'

Cannot read properties of undefined

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');
});

Feature Request - Due Date + calculation results

Hi,
Thanks for the really nice library.

Would be super nice if you can add:

  • Invoice Due Date attribute
  • some possibility to returns all calculation results like total etc.

Thanks in advance.

Run this locally?

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?

VAT Doesn't displayed & questions

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

How to remove tax-rate

Hi, can i know how to remove tax-rate and using only one tax for all products? Thank you

Document Title Line Height

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.

Support for deduction/subtraction for the Subtotal amount

Hi @dveldhoen

Please consider below use case.

A business is running up a X% discount(sale) on total order value. Also it charges Y% as a service charge to a customer. Now, these factor fall under deductions to Subtotal value.

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)

Total: 3675 INR (Subtotal + GST - Discount - 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)

Total: 3430 INR (Subtotal - 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

Total: 3500 INR (Subtotal)

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.

Custom Text for Date and Number

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".

Customization

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!

Japanese language

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

Shipping Fees

what if i wanted to add shipping fees at the end and add it to the total ?

Cannot read property 'toString' of undefined returned by api

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 } ] } }

DeprecationWarning: Invalid 'main' field

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.

'Module not found' errors when running 'ng build'

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.

image

formatting of numbers

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!

Pos Invoice

is it possible to create an invoice for a POS software?

Add column in table

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

authroization header is incorrect

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

Add browser support + example

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.

Change "invoice" to "quotation"

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.

createInvoice method returning error

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!

Translate %document.title% and other translations do not work

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

Support for thermal paper

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.

Outdated typescript declaration

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

Importing issue

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!

Clear the authorization header

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. :)

Module not found: Error: Can't resolve 'http'

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'

Not Working

Hello

I think your service not works,
when i use createInvoice

Translate to Japanese word.

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

Invalid main field in package.json

(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)

Endpoint request timed out

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.

Custom Values Not Working

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.

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.