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

How to add a "Boeking | Verkoopboek" #31

Closed
robinvalk opened this issue Dec 24, 2015 · 3 comments
Closed

How to add a "Boeking | Verkoopboek" #31

robinvalk opened this issue Dec 24, 2015 · 3 comments

Comments

@robinvalk
Copy link
Contributor

Hi,

We're trying to add a "Boeking | Verkoopboek".
I tried adding a SalesEntry but I'm stuck with the error: "Ongeldige referentie: Journals"

Is SalesEntry the correct model? And so, how can I fix the error above?
This is our current situation with the given error. Notice that I retrieve the journal id specifically to prevent any mismatch.

$journals = (new Journal($exact->connection()))->get();
$journal = array_filter($journals, function($journal) {
    return $journal->Code == 70;
});
$journal = array_shift($journal);

\Log::info($journal->ID);

$accountingServiceEntry = new SalesEntry($exact->connection(), [
    'Currency' => $invoice->valuta_id,
    'Customer' => $invoice->klant->accounting_service_id,
    'YourRef' => $invoice->nr,
    'Journal' => $journal->ID,
    'Description' => $description,
]);

$items = $invoice->getItems();

foreach($items as $invoiceItem) {
    $accountingServiceEntry->addItem([
        'Description' => $invoiceItem->omschr,
        'Quantity' => (int) $invoiceItem->aantal,
        'AmountFC' => $invoiceItem->bedrag,
        'VATPercentage' => $invoiceItem->btw_perc,
    ]);
}

\Log::info($accountingServiceEntry->save());

Cheers

@stephangroen
Copy link
Member

Hi @robinvalk,

I don't use SalesEntry myself, we only use SalesInvoices for sales. Looking at the Exact API reference, I think you shouldn't supply the $journal->ID but you should use the $journal->Code. Yes, Exact works that way :)

@robinvalk
Copy link
Contributor Author

Thanks, using SalesInvoices would also work for us indeed. We just need to set it to processed directly. That would work using PrintedSalesInvoices, which isn't implemented, right?
Would you accept a PR to add the model?

@stephangroen
Copy link
Member

PrintedSalesInvoices is not implemented yet. A PR is always welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants