feat(billing): renewals, coupons, VAT numbering, billing cycles and invoice payment tracking
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
ea9a53f742
commit
25f23d541e
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Repositories\Order;
|
||||
|
||||
use App\Support\Billing\BillingDuplicateDetector;
|
||||
use App\Models\Order;
|
||||
use App\Repositories\BaseRepository;
|
||||
use App\Repositories\Concerns\FiltersBillingRecords;
|
||||
@@ -59,6 +60,7 @@ class OrderRepository extends BaseRepository implements OrderRepositoryInterface
|
||||
}
|
||||
$model = $this->whereStatus($model, $data['status'] ?? null, ['active' => 1, 'pending' => 0, 'processing' => 3, 'cancel' => 2]);
|
||||
$model = $this->whereCreatedBetween($model, $data['date_from'] ?? null, $data['date_to'] ?? null);
|
||||
$model = $this->whereIsDuplicate($model, $data['duplicates'] ?? null, BillingDuplicateDetector::orders(...));
|
||||
if (! empty($data['customer_id'])) {
|
||||
$model = $model->where('customer_id', $data['customer_id']);
|
||||
}
|
||||
@@ -75,9 +77,14 @@ class OrderRepository extends BaseRepository implements OrderRepositoryInterface
|
||||
->orWhere('email', 'like', "%{$search}%");
|
||||
});
|
||||
$this->whereOrderItemNameLike($query, 'orderItems', $search);
|
||||
$this->whereContractFileLike($query, 'invoices.attachments', $search);
|
||||
});
|
||||
}
|
||||
|
||||
$model = $this->applySort($model, $data['sort_by'] ?? null, $data['sort_order'] ?? null, [
|
||||
'order_num', 'sub_total', 'discount_amount', 'total', 'status', 'created_at', 'updated_at', 'customer',
|
||||
]);
|
||||
|
||||
if (count($withCount) > 0) {
|
||||
$model = $model->withCount($withCount);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user