feat: add account linking and improve sales table
- Add many-to-many relationships between Sale/Expense and Account models - Create pivot tables for account_sale and account_expense with migrations - Implement account syncing during sale/expense creation and editing - Add accounts_list attribute to display comma-separated account names - Introduce SaleService with DTO for sale creation logic - Simplify sales table columns to show branch, reference, date, and creator - Calculate and store aggregated financial fields from transactions - Make series field read-only instead of disabled in sale form
This commit is contained in:
29
app/DataObjects/CreateSaleDTO.php
Normal file
29
app/DataObjects/CreateSaleDTO.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataObjects;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
readonly class CreateSaleDTO
|
||||
{
|
||||
/**
|
||||
* Create a new class instance.
|
||||
*/
|
||||
public function __construct(
|
||||
protected string $reference_number,
|
||||
protected Carbon $happened_on,
|
||||
protected int $branch_id,
|
||||
protected int $user_id,
|
||||
)
|
||||
{}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'reference_number' => $this->reference_number,
|
||||
'happened_on' => $this->happened_on,
|
||||
'branch_id' => $this->branch_id,
|
||||
'user_id' => $this->user_id,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user