Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on Sample Demo #4

Closed
igun997 opened this issue Dec 31, 2019 · 4 comments
Closed

Error on Sample Demo #4

igun997 opened this issue Dec 31, 2019 · 4 comments

Comments

@igun997
Copy link

igun997 commented Dec 31, 2019

Describe the bug
Like on laraveldaily\laravel-invoices\src\Classes\InvoiceItem.php function 'calculate()' have null value
To Reproduce
Steps to reproduce the behavior:

  1. Install all as docs instruction

  2. Copy Sample demos code
    ` $customer = new Buyer([
    'name' => 'John Doe',
    'custom_fields' => [
    'email' => 'test@example.com',
    ],
    ]);

    $item = (new InvoiceItem())->title('Service 1')->pricePerUnit(2);

    $invoice = Invoice::make()
    ->buyer($customer)
    ->addItem($item);

    return $invoice->stream();`

  3. I Included
    use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\Party; use LaravelDaily\Invoices\Classes\InvoiceItem;

Argument 1 passed to LaravelDaily\Invoices\Classes\InvoiceItem::calculate() must be of the type integer, null given, called in C:\xampp\htdocs\wenow\vendor\laraveldaily\laravel-invoices\src\Traits\InvoiceHelpers.php on line 236

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • PHP 7.1

Additional context

@PovilasKorop
Copy link
Collaborator

@igun997 very weird, it works perfectly for me.

Your error points to this parameter missing:

$this->currency_decimals            = config('invoices.currency.decimals');

Which should be set by default anyway, but maybe something is missing on your end.

Have you done php artisan invoices:install?
If not, please do so.
If you did, please tell me what is the value of your config/invoices.php file's 'currency' => ['decimals' => X]]

@igun997
Copy link
Author

igun997 commented Jan 2, 2020

'currency' => [ 'code' => 'idr', /** * Usually cents * Used when spelling out the amount and if your currency has decimals. * * Example: Amount in words: Eight hundred fifty thousand sixty-eight EUR and fifteen ct. */ 'fraction' => 'ct.', 'symbol' => 'Rp', /** * Example: 19.00 */ 'decimals' => 2, /** * Example: 1.99 */ 'decimal_point' => '.', /** * By default empty. * Example: 1,999.00 */ 'thousands_separator' => '', /** * Supported tags {VALUE}, {SYMBOL}, {CODE} * Example: 1.99 € */ 'format' => '{VALUE} {SYMBOL}', ],

this

@igun997
Copy link
Author

igun997 commented Jan 2, 2020

yes i have done instalation like on insruction

@PovilasKorop
Copy link
Collaborator

@igun997 no idea, to be honest, tried with exact same config - copy-pasted your values, I get this PDF:
Screen Shot 2020-01-02 at 7 38 23 AM

Maybe try to copy-paste the code once again, and make sure you didn't mix any symbol, maybe some bracket or other symbol is incorrect?

Or, you can put your code to github and attach me as collaborator, then I could debug it for you on your project, maybe.

@mc0de mc0de closed this as completed Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants