Closed martuico closed 2 years ago
Hi @martuico,
I've since made some changes to that part of the so I can't really tell what is happening. Could you please post the contents of EntityScope.php
?
Cheers.
I force entity_id in Vat to create the error comes from entity id. Also Vat class has error when doing eloquent function like Vat::whereCode()->first() it shoes same error
Also when saving transaction
I tried doing this code
$newLineRow = LineItem::with('vat')->whereId($accLineitem->id)->first(); $transaction->addLineItem($newLineRow);
this is whole function code ` $transaction = ($request->get('transaction_type') === 'ES' || $request->get('transaction_type') === 'PO') ? null : Transaction::getType($request->get('transaction_type'));
$headerClass = ($transaction) ? "IFRS\Transactions\\" . \str_replace(' ', '', $transaction) : '';
// return response()->json($headerClass);
//Create Trasasction
if (class_exists($headerClass)) {
$transaction = new $headerClass([
"account_id" => $request->get('account_id'),
"transaction_date" => Carbon::now(),
"narration" => $request->get('narration'),
]);
}
$lineItems = [];
foreach ($request->get('line_items') as $item) {
$lineItem = [
"amount" => $item['amount'],
"vat_id" => $item['vat_id'],
"account_id" => $item['account_id'],
"narration" => $item['description'],
"quantity" => $item['quantity']
];
if (class_exists($headerClass) && $transaction) {
$accLineitem = new LineItem($lineItem);
$accLineitem->save();
$accLineitem->attributes();
}
// $lineItem = LineItem::create();
$newLineRow = LineItem::with('vat')->whereId($accLineitem->id)->first();
$transaction->addLineItem($newLineRow);
$lineItems[] = $accLineitem;
}
Log::info($transaction);
if (class_exists($headerClass) && $transaction) {
$transaction->post();
}
`
Found the issue its on my end there's missing data
Hi, I keep having this issue.