Portal payment added print and pdf action..

This commit is contained in:
Cüneyt Şentürk
2021-06-27 12:59:56 +03:00
parent 116562ea03
commit 339e7b320a
10 changed files with 92 additions and 152 deletions

View File

@ -349,7 +349,7 @@ abstract class TransactionShow extends Base
$this->transaction = $transaction;
$this->transactionTemplate = $this->getTransactionTemplate($type, $transactionTemplate);
$this->logo = $this->getLogo($logo);
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods();
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
$this->date_format = $this->getCompanyDateFormat();
// Navbar Hide
@ -909,7 +909,7 @@ abstract class TransactionShow extends Base
$default_key = 'payment_made';
break;
default:
$default_key = 'revenue_made';
$default_key = 'revenue_received';
break;
}
@ -919,7 +919,7 @@ abstract class TransactionShow extends Base
return $translation;
}
return 'revenues.revenue_made';
return 'revenues.revenue_received';
}
protected function getTextPaidAt($type, $textPaidAt)

View File

@ -187,7 +187,7 @@ abstract class TransactionTemplate extends Base
$this->transaction = $transaction;
$this->logo = $this->getLogo($logo);
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods();
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
// Company Information Hide checker
$this->hideCompany = $hideCompany;
@ -313,7 +313,7 @@ abstract class TransactionTemplate extends Base
$default_key = 'payment_made';
break;
default:
$default_key = 'revenue_made';
$default_key = 'revenue_received';
break;
}
@ -323,7 +323,7 @@ abstract class TransactionTemplate extends Base
return $translation;
}
return 'revenues.revenue_made';
return 'revenues.revenue_received';
}
protected function getTextPaidAt($type, $textPaidAt)

View File

@ -7,10 +7,13 @@ use App\Models\Banking\Transaction;
use App\Models\Setting\Currency;
use App\Http\Requests\Portal\PaymentShow as Request;
use App\Utilities\Modules;
use App\Traits\Transactions;
use Illuminate\Support\Facades\URL;
class Payments extends Controller
{
use Transactions;
/**
* Display a listing of the resource.
*
@ -53,6 +56,50 @@ class Payments extends Controller
return $this->response('portal.currencies.index', compact('currencies'));
}
/**
* Show the form for viewing the specified resource.
*
* @param Transaction $payment
*
* @return Response
*/
public function printPayment(Transaction $payment, Request $request)
{
event(new \App\Events\Transaction\TransactionPrinting($payment));
$revenue = $payment;
$view = view($payment->template_path, compact('revenue'));
return mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
}
/**
* Show the form for viewing the specified resource.
*
* @param Transaction $payment
*
* @return Response
*/
public function pdfPayment(Transaction $payment, Request $request)
{
event(new \App\Events\Transaction\TransactionPrinting($payment));
$currency_style = true;
$revenue = $payment;
$view = view($payment->template_path, compact('revenue', 'currency_style'))->render();
$html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
$pdf = app('dompdf.wrapper');
$pdf->loadHTML($html);
//$pdf->setPaper('A4', 'portrait');
$file_name = $this->getTransactionFileName($payment);
return $pdf->download($file_name);
}
public function signed(Transaction $payment)
{
if (empty($payment)) {