LaravelDaily / laravel-invoices

Laravel package to generate PDF invoices from various customizable parameters
GNU General Public License v3.0
1.4k stars 304 forks source link

Include PayDueDate() function in invoice #122

Closed patricktan98 closed 3 years ago

patricktan98 commented 3 years ago

This PR is to introduce a new function called "payDueDate" which provides the community to have the opportunity to include the due date of the invoice.

To use the function, the community can only directly call payDueDate() in their invoice object. As below example shown:

        $invoice = Invoice::make("QUOTATION")
            ->series('BIG')
            // ability to include translated invoice status
            // in case it was paid
            ->sequence(667)
            ->serialNumberFormat('{SEQUENCE}/{SERIES}')
            ->seller($client)
            ->buyer($customer)
            ->date(now()->subWeeks(3))
            ->payDueDate(now()->addDay()) //this is the payDueDate function

As below image shown, this is how the due date look like image

mc0de commented 3 years ago

@patricktan98 thanks for the effort, but I think it would still be better to extend existing function to also accept Carbon instance.

For example now it is ->payUntilDays(1), it would just add one day in same way as now()->addDay(), it would be more useful to add parameter check if it is integer or Carbon instance.

Tho we wouldn't accept this PR because function seems redundant, but we are looking forward, and consider extending that anyway later.

This is a great idea since that would be useful to many people, in addition there would be no need to introduce new function or update template and adds less confusion.