37 lines
1.8 KiB
PHP
37 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Purchasing;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Tempo\Finance\Payables\SettlementHttp;
|
|
|
|
final class SupplierPaymentsController extends SettlementHttp
|
|
{
|
|
protected const MODE = 'sgf';
|
|
|
|
protected const SERVICE = SupplierPayables::class;
|
|
|
|
private const PAYMENT_FILTERS = ['payments_page', 'allocation_proposals_page', 'allocations_page', 'payment_events_page', 'payment_per_page', 'payment_q', 'payment_state', 'payment'];
|
|
protected function ledgerSettings(Request $request):array
|
|
{
|
|
if(config('general_ledger.cycle_enabled')!==true)return [];
|
|
$scope=app(SupplierPayables::class)->scope($request->user());
|
|
if(!app(\App\Modules\Identity\Services\Permissions::class)->has($request->user()->id,$scope['tenant_id'],$scope['company_id'],'general_ledger.view',$scope['unit_id']))return [];
|
|
return ['ledger_cycle_url'=>'/general-ledger/cycle','ledger_scope'=>$scope];
|
|
}
|
|
|
|
protected function obligationOptions(Request $request): array
|
|
{
|
|
return app(SupplierPayablesController::class)->listingOptions($request->duplicate(array_diff_key($request->query(), array_flip(self::PAYMENT_FILTERS))));
|
|
}
|
|
|
|
protected function settlementOptions(Request $request): ?array
|
|
{
|
|
return $request->validate(['payments_page' => 'sometimes|integer|min:1|max:100000',
|
|
'allocation_proposals_page' => 'sometimes|integer|min:1|max:100000', 'allocations_page' => 'sometimes|integer|min:1|max:100000',
|
|
'payment_events_page' => 'sometimes|integer|min:1|max:100000', 'payment_per_page' => 'sometimes|integer|in:25,100',
|
|
'payment_q' => 'sometimes|nullable|string|max:100', 'payment_state' => 'sometimes|in:all,proposed,confirmed,rejected',
|
|
'payment' => 'sometimes|required|integer|min:1']);
|
|
}
|
|
}
|