mark bill as paid
This commit is contained in:
parent
5625e837dd
commit
8427f0bd3e
@ -8,6 +8,7 @@ use App\Http\Requests\Common\Import as ImportRequest;
|
||||
use App\Http\Requests\Purchase\Bill as Request;
|
||||
use App\Http\Requests\Purchase\BillAddItem as ItemRequest;
|
||||
use App\Imports\Purchases\Bills as Import;
|
||||
use App\Jobs\Banking\CreateDocumentTransaction;
|
||||
use App\Jobs\Purchase\CreateBill;
|
||||
use App\Jobs\Purchase\DeleteBill;
|
||||
use App\Jobs\Purchase\DuplicateBill;
|
||||
@ -330,6 +331,30 @@ class Bills extends Controller
|
||||
return $pdf->download($file_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the bill as paid.
|
||||
*
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function markPaid(Bill $bill)
|
||||
{
|
||||
try {
|
||||
$this->dispatch(new CreateDocumentTransaction($bill, []));
|
||||
|
||||
$message = trans('bills.messages.marked_paid');
|
||||
|
||||
flash($message)->success();
|
||||
} catch(\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
|
||||
flash($message)->error();
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function addItem(ItemRequest $request)
|
||||
{
|
||||
$item_row = $request['item_row'];
|
||||
|
@ -28,6 +28,7 @@ return [
|
||||
'histories' => 'Histories',
|
||||
'payments' => 'Payments',
|
||||
'add_payment' => 'Add Payment',
|
||||
'mark_paid' => 'Mark Paid',
|
||||
'mark_received' => 'Mark Received',
|
||||
'download_pdf' => 'Download PDF',
|
||||
'send_mail' => 'Send Email',
|
||||
@ -46,6 +47,7 @@ return [
|
||||
|
||||
'messages' => [
|
||||
'received' => 'Bill marked as received successfully!',
|
||||
'marked_paid' => 'Bill marked as paid!',
|
||||
'draft' => 'This is a <b>DRAFT</b> bill and will be reflected to charts after it gets received.',
|
||||
|
||||
'status' => [
|
||||
|
@ -139,6 +139,12 @@
|
||||
@stack('timeline_body_make_payment_body_message_end')
|
||||
|
||||
<div class="mt-3">
|
||||
@stack('timeline_body_get_paid_body_button_pay_start')
|
||||
@permission('update-purchases-bills')
|
||||
<a href="{{ route('bills.paid', $bill->id) }}" class="btn btn-white btn-sm header-button-top">{{ trans('bills.mark_paid') }}</a>
|
||||
@endpermission
|
||||
@stack('timeline_body_get_paid_body_button_pay_end')
|
||||
|
||||
@stack('timeline_body_make_payment_body_button_payment_start')
|
||||
@if(empty($bill->transactions->count()) || (!empty($bill->transactions->count()) && $bill->paid != $bill->amount))
|
||||
<button @click="onPayment" id="button-payment" class="btn btn-success btn-sm header-button-bottom">{{ trans('bills.add_payment') }}</button>
|
||||
@ -456,9 +462,18 @@
|
||||
<div class="dropdown-menu" role="menu">
|
||||
@stack('button_pay_start')
|
||||
@if($bill->status != 'paid')
|
||||
@permission('update-purchases-bills')
|
||||
<a class="dropdown-item" href="{{ route('bills.paid', $bill->id) }}">{{ trans('bills.mark_paid') }}</a>
|
||||
@endpermission
|
||||
|
||||
@if(empty($bill->paid) || ($bill->paid != $bill->amount))
|
||||
<button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('bills.add_payment') }}</button>
|
||||
@endif
|
||||
<div class="dropdown-divider"></div>
|
||||
@endif
|
||||
@stack('button_pay_end')
|
||||
|
||||
@stack('button_received_start')
|
||||
@permission('update-purchases-bills')
|
||||
@if($bill->status == 'draft')
|
||||
<a class="dropdown-item" href="{{ route('bills.received', $bill->id) }}">{{ trans('bills.mark_received') }}</a></a>
|
||||
@ -466,9 +481,7 @@
|
||||
<button type="button" class="dropdown-item" disabled="disabled">{{ trans('bills.mark_received') }}</button>
|
||||
@endif
|
||||
@endpermission
|
||||
<div class="dropdown-divider"></div>
|
||||
@endif
|
||||
@stack('button_pay_end')
|
||||
@stack('button_received_end')
|
||||
|
||||
@stack('button_pdf_start')
|
||||
<a class="dropdown-item" href="{{ route('bills.pdf', $bill->id) }}">{{ trans('bills.download_pdf') }}</a>
|
||||
|
@ -70,7 +70,7 @@ Route::group(['prefix' => 'auth'], function () {
|
||||
Route::group(['prefix' => 'sales'], function () {
|
||||
Route::get('invoices/{invoice}/sent', 'Sales\Invoices@markSent')->name('invoices.sent');
|
||||
Route::get('invoices/{invoice}/email', 'Sales\Invoices@emailInvoice')->name('invoices.email');
|
||||
Route::get('invoices/{invoice}/pay', 'Sales\Invoices@markPaid')->name('invoices.paid');
|
||||
Route::get('invoices/{invoice}/paid', 'Sales\Invoices@markPaid')->name('invoices.paid');
|
||||
Route::get('invoices/{invoice}/print', 'Sales\Invoices@printInvoice')->name('invoices.print');
|
||||
Route::get('invoices/{invoice}/pdf', 'Sales\Invoices@pdfInvoice')->name('invoices.pdf');
|
||||
Route::get('invoices/{invoice}/duplicate', 'Sales\Invoices@duplicate')->name('invoices.duplicate');
|
||||
@ -97,6 +97,7 @@ Route::group(['prefix' => 'sales'], function () {
|
||||
|
||||
Route::group(['prefix' => 'purchases'], function () {
|
||||
Route::get('bills/{bill}/received', 'Purchases\Bills@markReceived')->name('bills.received');
|
||||
Route::get('bills/{bill}/paid', 'Purchases\Bills@markPaid')->name('bills.paid');
|
||||
Route::get('bills/{bill}/print', 'Purchases\Bills@printBill')->name('bills.print');
|
||||
Route::get('bills/{bill}/pdf', 'Purchases\Bills@pdfBill')->name('bills.pdf');
|
||||
Route::get('bills/{bill}/duplicate', 'Purchases\Bills@duplicate')->name('bills.duplicate');
|
||||
|
Loading…
x
Reference in New Issue
Block a user