Giter VIP home page Giter VIP logo

invoices's Introduction

StyleCI Status Build For Laravel Total Downloads Latest Stable Version License

What is Invoices?

Invoices is a Laravel library that generates a PDF invoice for your customers. The PDF can be either downloaded or streamed in the browser. It's highly customizable and you can modify the whole output view as well.

Sample Invoice

This is a sample invoice generated using this library:

Sample Invoice

$invoice = \ConsoleTVs\Invoices\Classes\Invoice::make()
                ->addItem('Test Item', 10.25, 2, 1412)
                ->addItem('Test Item 2', 5, 2, 923)
                ->addItem('Test Item 3', 15.55, 5, 42)
                ->addItem('Test Item 4', 1.25, 1, 923)
                ->addItem('Test Item 5', 3.12, 1, 3142)
                ->addItem('Test Item 6', 6.41, 3, 452)
                ->addItem('Test Item 7', 2.86, 1, 1526)
                ->addItem('Test Item 8', 5, 2, 923, 'https://dummyimage.com/64x64/000/fff')
                ->number(4021)
                ->with_pagination(true)
                ->duplicate_header(true)
                ->due_date(Carbon::now()->addMonths(1))
                ->notes('Lrem ipsum dolor sit amet, consectetur adipiscing elit.')
                ->customer([
                    'name'      => 'Èrik Campobadal Forés',
                    'id'        => '12345678A',
                    'phone'     => '+34 123 456 789',
                    'location'  => 'C / Unknown Street 1st',
                    'zip'       => '08241',
                    'city'      => 'Manresa',
                    'country'   => 'Spain',
                ])
                ->download('demo')
                //or save it somewhere
                ->save('public/myinvoicename.pdf');

Documentation

License

MIT License

Copyright (c) 2017 Erik Campobadal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Special thanks

invoices's People

Contributors

aurawindsurfing avatar bnitobzh avatar codevio avatar consoletvs avatar danielfaulknor avatar fridzema avatar georgetassiano avatar halabe15 avatar jkudish 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

invoices's Issues

How to get two pages in a document

Hi, I was trying to generate pages in the same document, but I don't know how to go about doing this.
I have tried using two make();but it didn't work
is there any fix you can offer

Delivery Fee

Hello guys,

Just wondering if will be some option for add delivery fee?

InvoicesServiceProvider

Hi. InvoicesServiceProvider class doesn't exist at all in the source code. And composer is complaining:

Class 'ConsoleTVs\Invoices\InvoicesServiceProvider' not found

Am I missing something?

Add a packagist requirements to have the bcmath extension installed

Description

I tried to used the package in a minimal PHP environnement, without compiling it with the bcmath extension. An error has been raised telling me that bcmul function does not exists. After downloading the bcmath extension, no error was raised.

Expected behavior

To be warned if the local environment does not have the required bcmath extension.

Actual behavior

No error is raised if the local environment does not have the bcmath extension enabled.

Laravel : impossible to use custom template

Great lib, but I've encountered on a problem that putting custom template is impossible since blade lookup only happens within library scope.
edit: current workaround is to clone PHP class into project and pass to it name of template (since class is in project scope, it works just fine ;)

Possibility to edit invoices

I'm running a custom invoice generator on an app.

Basically, I'm able to generate invoices, edit them, and also convert quotes to invoices. I want to test drive this package but Im not sure how to edit created invoices...

Any help?

Consider using another default font

Maybe consider using another default font. I exported the vendor view and replaced all CSS occurrences of font-family: DejaVu Sans; with font-family: Helvetica;, which saved almost 1MB of filesize (using your default code to generate a PDF).

dompdf is slow as hell

The big issue with dompdf is that it is slow as hell on bigger installations and images. Rendering an invoice takes about 30 seconds per page. (Logo and a bootstrap table)

As you are using a single Class file where you do the actual PDF it shouldn't be a big deal adding another generator in there. I'm currently evaluating a few choices to see which ones actually improve speed.

Typo

Amount - not ammount :)

Support for translating terms

Description

I would like to generate the PDF in French.

Expected behavior

To be able to translate the base terms of the template in French.

Actual behavior

The terms are not using translation helpers.

Notes

I think you could use @lang("the text here") for any texts, so we can use JSON based translation to translate on our own language (if @lang does not find the text, it just prints the text as it, which is handy).

I found a temporary solution, publishing the vendor files, then adding myself the @lang directives around texts.

A facade root has not been set

I'm getting this error:

Type: RuntimeException

Message: A facade root has not been set.

Filename: /homepages/6/d487641550/htdocs/estaxi/vendor/illuminate/support/Facades/Facade.php

Line Number: 258

Backtrace:

File: /homepages/6/d487641550/htdocs/estaxi/vendor/consoletvs/invoices/Classes/PDF.php
Line: 57
Function: __callStatic

File: /homepages/6/d487641550/htdocs/estaxi/vendor/consoletvs/invoices/Classes/Invoice.php
Line: 378
Function: generate

File: /homepages/6/d487641550/htdocs/estaxi/vendor/consoletvs/invoices/Classes/Invoice.php
Line: 425
Function: generate

File: /homepages/6/d487641550/htdocs/estaxi/application/views/wallet/withdrawdata.php
Line: 30
Function: show

I'm using the example code:

 $invoice = \ConsoleTVs\Invoices\Classes\Invoice::make()
                ->addItem('Test Item', 10.25, 2, 1412)
                ->addItem('Test Item 2', 5, 2, 923)
                ->addItem('Test Item 3', 15.55, 5, 42)
                ->addItem('Test Item 4', 1.25, 1, 923)
                ->addItem('Test Item 5', 3.12, 1, 3142)
                ->addItem('Test Item 6', 6.41, 3, 452)
                ->addItem('Test Item 7', 2.86, 1, 1526)
                ->addItem('Test Item 8', 5, 2, 923, 'https://dummyimage.com/64x64/000/fff')
                ->number(4021)
                ->with_pagination(true)
                ->duplicate_header(true)
                ->due_date(Carbon::now()->addMonths(1))
                ->notes('Lrem ipsum dolor sit amet, consectetur adipiscing elit.')
                ->customer([
                    'name'      => 'Èrik Campobadal Forés',
                    'id'        => '12345678A',
                    'phone'     => '+34 123 456 789',
                    'location'  => 'C / Unknown Street 1st',
                    'zip'       => '08241',
                    'city'      => 'Manresa',
                    'country'   => 'Spain',
                ])
                ->show('demo');```

Add instructions to publish the vendor configuration in the documentation

Description

I want to publish the configurations files, but I did not see any command I can copy/paste to do so.

Expected behavior

I can see some instructions to generate and customize the configuration files.

Actual behavior

No instructions in the documentation to customize the configuration files.

invoices due date

Is it possible to add a due date for the invoice? (to be paid until)

Invoice date

Hello guys,

I am facing some bug,

Invoice::make()
            ->with_pagination(true)
            ->date(Carbon::parse($invoice->invocie_date))
            ->due_date(Carbon::parse($invoice->due_date))

When i want to generate invoices which are make in past i should use method ->date however it still take a current date. How i can set up date which i want ?

public function __construct($name = 'Invoice')
    {
        $this->name = $name;
        $this->template = 'default';
        $this->items = Collection::make([]);
        $this->currency = config('invoices.currency');
        $this->decimals = config('invoices.decimals');
        $this->logo = config('invoices.logo');
        $this->logo_height = config('invoices.logo_height');
        $this->date = Carbon::now(); //<<< how to override it ? 
        $this->business_details = Collection::make(config('invoices.business_details'));
        $this->customer_details = Collection::make([]);
        $this->footnote = config('invoices.footnote');
        $this->tax_rates = config('invoices.tax_rates');
        $this->due_date = config('invoices.due_date') != null ? Carbon::parse(config('invoices.due_date')) : null;
        $this->with_pagination = config('invoices.with_pagination');
        $this->duplicate_header = config('invoices.duplicate_header');
    }

How define Tax or no Tax per invoice

I have a requirement to generate invoices with and without VAT, but I can't find the exact way to achieve this as the example does not show this.

Do you define differnet tax rates in the config file ?

'tax_rates' => [
    [ 'name'      => 'VAT', 'tax'       => 20, 'tax_type'  => 'percentage', ],
 [ 'name'      => 'noVAT', 'tax'       => 0, 'tax_type'  => 'percentage', ],
  ],

and then when you make an invoice, how exactly do you define what tax rate to use ?

$invoice = \ConsoleTVs\Invoices\Classes\Invoice::make()
                ->addItem(......)
                ->number(.....)
               ->tax_rates('VAT') ??????????????????? or  ->tax(false) or ?????

Thanks for any help anyone can provide.

php artisan vendor:publish did nothing

Config file and views are not copied over to project directory after vendor:publish.
Could it be InvoicesServiceProvider file not found in vendor directory?

Using consoletvs/invoices ^1.2

Add an option to not display "ID" for the customer, company and items in the PDF

Description

I want to be able to control wether to display the ID of the company, customer and items or not.

Expected behavior

Customer

If the "id" field is not present, do not display it in the invoice

Company

If the configuration has not been publish, or the configuration do not contain the "id" key, do not display it in the invoice

Items

If the "id" field is not present, do not display it in the items table

Actual behavior

The id of the customer is displayed empty.
The id of the company is "1234567890" by default.
The id column on the items table is displayed.

Use the app name by default for the company name

Description

Without publishing configuration files, the company name should be the app name (which might be the most handy for a vast majority of monocompany web apps).

Expected behavior

The business_details.name value should use by default config("app.name").

Actual behavior

The company name is by default "My Company".

Multiple tax rates

Is the library capable of handling different tax rates for each product? In Germany, we have two rates (7% and 19%) for different kinds of products.

Can i show

  • the tax class for each line item on the invoice?
  • total tax amount for each class separately?

Thanks in advance!

Template doesn't take effect any more(wrong)

Hi,
I just did a 'composer update' which updated the package from 1.3.10 to 1.3.11. after the update, I noticed that the template doesn't apply to any newly generated invoices anymore. It worked for sure before the update. any idea how to fix it? thanks.

Image in cell

I am testing this amazing plugin and trying to figure out if I can pass a custom argument in addItem method in order to import images in cells.

Does anyone have implemented that?

Not generating Invoice

I am using this function with the help of your documentation:

public function invoice()
    {
        $invoice = Invoice::make()
                ->addItem('Test Item', 10.25, 2, 1412)
                ->addItem('Test Item 2', 5, 2, 923)
                ->addItem('Test Item 3', 15.55, 5, 42)
                ->addItem('Test Item 4', 1.25, 1, 923)
                ->addItem('Test Item 5', 3.12, 1, 3142)
                ->addItem('Test Item 6', 6.41, 3, 452)
                ->addItem('Test Item 7', 2.86, 1, 1526)
                ->number(4021)
                ->tax(21)
                ->notes('Lrem ipsum dolor sit amet, consectetur adipiscing elit.')
                ->customer([
                    'name'      => 'Èrik Campobadal Forés',
                    'id'        => '12345678A',
                    'phone'     => '+34 123 456 789',
                    'location'  => 'C / Unknown Street 1st',
                    'zip'       => '08241',
                    'city'      => 'Manresa',
                    'country'   => 'Spain',
                ])
                ->download('demo');
              
    }

But it is loading continuously without generating the invoice. anyone out there to help ?

->tax() undefined

Hello!

Since I upgraded to 1.6. 🧨 Call to undefined method ConsoleTVs\Invoices\Classes\Invoice::tax().
How can I set tax? I can't do it via config because it is set at the request. I saw tax_rates but I cant set that either. Laravel 7.*

Add Items

Hi
Can i add items as an object

$items = Items::where('user_id','10')->pluck('name','qty','price'); $invoice = ConsoleTVs\Invoices\Classes\Invoice::make()->addItems($items)

No way to control width of PDF?

This is package very awesome BUT the width of PDF is very big and is NOT suitable print WITH printer. There is a way to control WITH the width?

Question: Subtotals and page numbers on multi-page invoices

Quick question: Are multi-page invoices properly handled? I mean, what happens if there is a large number of line items, that don't fit on a single page?

I would expect the following:

  • Page number (x out of y) on each page
  • Subtotals on top of each page (except on first page, of course)
  • Totals only on last page
  • Optional header/footer on consecutive pages

Thanks a lot!

totalPrice is calculated from string version of subTotalPrice

When using different decimal separators (like , or .) sometimes tax and total sum is calculated to zero.
This issue only occurs when subTotalPrice is over 1000 thus using format_number that adds , after thousands (1,234.00)

This is string is used for calculating total price, which ends up to be 0.

error with example

image
I tried to use your lib who looks easy to use but there is this error

Laravel 7 support

Hi, I tried to upgrade my project to Laravel 7 and wasn't able to do it because ConsoleTVs/Invoices is the only library I'm using that is not compatible with Laravel 7, are you planning on releasing a compatible version any time soon?
Thanks.

laravel 5.3

i have problem when installing this package on laravel 5.3 ..this version is not supported ?

Laravel 5.8 compatibility (carbon 1.x vs 2.x)

Can you please make it compatible with Laravel 5.8.

- Conclusion: don't install nesbot/carbon 2.14.2
- consoletvs/invoices 1.1.0 requires nesbot/carbon ^1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2].

How to install?

After i run on the terminal. i still cant use the package.

Manual total price ( Rewrite)

Hi guys, I want to custom total price rewrite.

Example:
product price: 1 quantity 90 USD = 190 = total price 90 USD
2 quantity 160 USD = 2
160 = 320 USD (problem)

how to custom rewrite total price in my invoices?

Saving the pdf to a different disk

The save() method saves it in the default disk in the Storage facade. It would be nice being able to specify which disk you want to save in a project with multiples (e.g Storage::disk('s3')...).

I can send a PR to add an array of options to the save() method to take that in consideration (or any other better suggestions to handle this case).

large figures upset the total

The total price calculation breaks in here
(it's something to do with bcmul)
If the inputs to the method are:

$name = 'blah';
$price = '8,333.325';
$ammount = 1; 
$id = '';
$this->decimals is the default (2)

The output will return 0.00

public function addItem($name, $price, $ammount = 1, $id = '-')
  {
      $price = number_format($price, $this->decimals);

      $this->items->push(Collection::make([
          'name'       => $name,
          'price'      => $price,
          'ammount'    => $ammount,
          'totalPrice' => number_format(bcmul($price, $ammount, $this->decimals), $this->decimals),
          'id'         => $id,
      ]));

      return $this;
  }

BTW amount is mispelt here 😄

Pdf show in drowser

Please the pdf always download instead of showing in the browser whenever I use the show method

Custom template

Hello,

I'm pretty new with this. Can someone explain how I can use a custom template?
My invoices need to be in dutch.

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.