Closed striderxfossility closed 8 years ago
I have a similar issue, with adding the details (products) to a invoice, tried creating an normal array and sending that and with the same technique as above..
No luck..
I have tried a few times but cant get it to work, otherwise i give you the solution. :(
I hope stephangroen comes online to fix this :+1:
You should create a new SalesInvoiceDetail
for every line on the Sales Invoice and add these to an array. You add that array (array of SalesInvoiceDetail objects) to the Sales Invoice.
$salesInvoiceDetailsArray = [];
foreach ($invoiceLines as $invoiceLine) {
$salesInvoiceDetail = $moneybird->SalesInvoiceDetail();
$salesInvoiceDetail->price = 34.33;
...
$salesInvoiceDetailsArray[] = $salesInvoiceDetail;
}
$salesInvoice = $moneybird->salesInvoice();
$salesInvoice->details = $salesInvoiceDetails;
Hope this solves it for you. I'll adjust the docs and maybe add a special method to add a SalesInvoiceDetail to a SalesInvoice so this is more clear.
Thanks!! That was indeed what I needed to use, it's fixed now! Thanks for the support.
It was fixed for me too! Thanks!
Thanks! I have updated the README with this code.
Can you help me how to add rules ("Description")
Here is my code: $estimate = $moneybird->estimate(); $estimate->contact_id = $contact_id; $estimate->contact = $contact; <- This was by the way the error from previous issiue $estimate->workflow_id = $workflow_id; $estimate->document_style_id = $document_style_id;
And i would like to add another detail.