transaction show page file updated..

This commit is contained in:
Cüneyt Şentürk
2021-06-24 13:52:49 +03:00
parent 0f6ef79384
commit 19a417791e
32 changed files with 2743 additions and 336 deletions

View File

@ -257,4 +257,69 @@ class Payments extends Controller
{
return $this->exportExcel(new Export, trans_choice('general.payments', 2));
}
/**
* Download the PDF file of payment.
*
* @param Transaction $payment
*
* @return Response
*/
public function emailPayment(Transaction $payment)
{
if (empty($payment->contact->email)) {
return redirect()->back();
}
// Notify the customer
$payment->contact->notify(new Notification($payment, 'payment_new_customer', true));
event(new \App\Events\Transaction\TransactionSent($payment));
flash(trans('documents.messages.email_sent', ['type' => trans_choice('general.payments', 1)]))->success();
return redirect()->back();
}
/**
* Print the payment.
*
* @param Transaction $payment
*
* @return Response
*/
public function printPayment(Transaction $payment)
{
event(new \App\Events\Transaction\TransactionPrinting($payment));
$view = view($payment->template_path, compact('payment'));
return mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
}
/**
* Download the PDF file of payment.
*
* @param Transaction $payment
*
* @return Response
*/
public function pdfPayment(Transaction $payment)
{
event(new \App\Events\Transaction\TransactionPrinting($payment));
$currency_style = true;
$view = view($payment->template_path, compact('payment', '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->getDocumentFileName($payment);
return $pdf->download($file_name);
}
}

View File

@ -257,4 +257,69 @@ class Revenues extends Controller
{
return $this->exportExcel(new Export, trans_choice('general.revenues', 2));
}
/**
* Download the PDF file of revenue.
*
* @param Transaction $revenue
*
* @return Response
*/
public function emailRevenue(Transaction $revenue)
{
if (empty($revenue->contact->email)) {
return redirect()->back();
}
// Notify the customer
$revenue->contact->notify(new Notification($revenue, 'revenue_new_customer', true));
event(new \App\Events\Transaction\TransactionSent($revenue));
flash(trans('documents.messages.email_sent', ['type' => trans_choice('general.revenues', 1)]))->success();
return redirect()->back();
}
/**
* Print the revenue.
*
* @param Transaction $revenue
*
* @return Response
*/
public function printRevenue(Transaction $revenue)
{
event(new \App\Events\Transaction\TransactionPrinting($revenue));
$view = view($revenue->template_path, compact('revenue'));
return mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
}
/**
* Download the PDF file of revenue.
*
* @param Transaction $revenue
*
* @return Response
*/
public function pdfRevenue(Transaction $revenue)
{
event(new \App\Events\Transaction\TransactionPrinting($revenue));
$currency_style = true;
$view = view($revenue->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->getDocumentFileName($revenue);
return $pdf->download($file_name);
}
}