You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
747 B
24 lines
747 B
<?php
|
|
|
|
namespace App\Domains\Billing\Actions\Invoicing;
|
|
|
|
use App\Domains\Billing\DTOs\Invoicing\InvoiceItemDTO;
|
|
use App\Domains\Billing\Models\InvoiceItem;
|
|
|
|
class AttachItemsToInvoice
|
|
{
|
|
public function execute(int $invoiceId, InvoiceItemDTO $item): void
|
|
{
|
|
InvoiceItem::create([
|
|
'code' => $item->code,
|
|
'name' => $item->name,
|
|
'quantity' => $item->quantity,
|
|
'gross_amount' => $item->pricing->gross_amount,
|
|
'discount_amount' => $item->pricing->discount_amount,
|
|
'net_amount' => $item->pricing->net_amount,
|
|
'invoice_id' => $invoiceId,
|
|
'product_id' => $item->product_id,
|
|
'chart_of_account_id' => $item->coa_id
|
|
]);
|
|
}
|
|
}
|
|
|