Build overview and handling for unpaid incoming.
This commit is contained in:
@@ -24,6 +24,25 @@ class IncomingController extends Controller
|
||||
return response()->json(Incoming::whereBetween('issue_date', [$from, $end])->with(['supplier'])->orderBy('issue_date', 'desc')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function payment($from = null, $end = null): JsonResponse
|
||||
{
|
||||
Option::updateOrCreate(['name' => 'incoming_payments_from'], ['value' => $from]);
|
||||
Option::updateOrCreate(['name' => 'incoming_payments_end'], ['value' => $end]);
|
||||
|
||||
return response()->json(Incoming::whereBetween('pay_date', [$from, $end])->with(['supplier'])->orderBy('pay_date', 'desc')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource that are not paid.
|
||||
*/
|
||||
public function open(): JsonResponse
|
||||
{
|
||||
return response()->json(Incoming::where('pay_date', '=', null)->orderBy('issue_date', 'desc')->with(['supplier'])->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an upload file for the resource.
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,26 @@ class IncomingController extends Controller
|
||||
return view('incoming.index', ['first' => $first, 'last' => $last]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function payment(): View
|
||||
{
|
||||
if (Option::where('name', '=', 'incoming_payments_from')->count() > 0) {
|
||||
$first = Option::where('name', '=', 'incoming_payments_from')->first()->value;
|
||||
} else {
|
||||
$first = Date::now()->firstOfMonth()->format('Y-m-d');
|
||||
}
|
||||
|
||||
if (Option::where('name', '=', 'incoming_payments_end')->count() > 0) {
|
||||
$last = Option::where('name', '=', 'incoming_payments_end')->first()->value;
|
||||
} else {
|
||||
$last = Date::now()->format('Y-m-d');
|
||||
}
|
||||
|
||||
return view('incoming.payment', ['first' => $first, 'last' => $last]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
@@ -37,6 +57,15 @@ class IncomingController extends Controller
|
||||
return view('incoming.create');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function createPayment(): View
|
||||
{
|
||||
return view('incoming.create-payment');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for uploading a new resource.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user