peralihan ke queue
parent
965a30ea8c
commit
a8847eb76d
|
@ -9,6 +9,7 @@ use App\Models\RekeningCoa;
|
|||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class PenjualanController extends Controller
|
||||
{
|
||||
|
@ -103,56 +104,62 @@ class PenjualanController extends Controller
|
|||
|
||||
public function laporan(Request $request)
|
||||
{
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4',
|
||||
'orientation' => 'portrait',
|
||||
'margin_left' => 15,
|
||||
'margin_right' => 15,
|
||||
'margin_top' => 10,
|
||||
'margin_bottom' => 10,
|
||||
'default_font_size' => 9,
|
||||
'default_font' => 'arial',
|
||||
]);
|
||||
$mpdf->AddPage();
|
||||
$mpdf->setFooter('{PAGENO}');
|
||||
try {
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4',
|
||||
'orientation' => 'portrait',
|
||||
'margin_left' => 15,
|
||||
'margin_right' => 15,
|
||||
'margin_top' => 10,
|
||||
'margin_bottom' => 10,
|
||||
'default_font_size' => 9,
|
||||
'default_font' => 'arial',
|
||||
]);
|
||||
$mpdf->AddPage();
|
||||
$mpdf->setFooter('{PAGENO}');
|
||||
|
||||
$filter_tanggal_1 = $request->filter_tanggal_1;
|
||||
$filter_tanggal_2 = $request->filter_tanggal_2;
|
||||
if ($request->jenis_coa == null) {
|
||||
$keterangan_coa = 'Semua';
|
||||
$data = Pesanan::with(['user', 'bukuBesar', 'rekening_coa'])->whereDate('tanggal_pesanan', '>=', $request->filter_tanggal_1)
|
||||
->whereDate('tanggal_pesanan', '<=', $request->filter_tanggal_2)
|
||||
->get();
|
||||
} else {
|
||||
$keterangan_coa = RekeningCoa::find($request->jenis_coa)->keterangan_coa;
|
||||
$data = Pesanan::with(['user', 'bukuBesar', 'rekening_coa'])->where('rekening_coa_id', $request->jenis_coa)->whereDate('tanggal_pesanan', '>=', $request->filter_tanggal_1)
|
||||
->whereDate('tanggal_pesanan', '<=', $request->filter_tanggal_2)
|
||||
->get();
|
||||
$filter_tanggal_1 = $request->filter_tanggal_1;
|
||||
$filter_tanggal_2 = $request->filter_tanggal_2;
|
||||
if ($request->jenis_coa == null) {
|
||||
$keterangan_coa = 'Semua';
|
||||
$data = Pesanan::with(['user', 'bukuBesar', 'rekening_coa'])->whereDate('tanggal_pesanan', '>=', $request->filter_tanggal_1)
|
||||
->whereDate('tanggal_pesanan', '<=', $request->filter_tanggal_2)
|
||||
->get();
|
||||
} else {
|
||||
$keterangan_coa = RekeningCoa::find($request->jenis_coa)->keterangan_coa;
|
||||
$data = Pesanan::with(['user', 'bukuBesar', 'rekening_coa'])->where('rekening_coa_id', $request->jenis_coa)->whereDate('tanggal_pesanan', '>=', $request->filter_tanggal_1)
|
||||
->whereDate('tanggal_pesanan', '<=', $request->filter_tanggal_2)
|
||||
->get();
|
||||
}
|
||||
|
||||
$alldata = [
|
||||
'data' => $data,
|
||||
'filter_tanggal_1' => $filter_tanggal_1,
|
||||
'filter_tanggal_2' => $filter_tanggal_2,
|
||||
'keterangan_coa' => $keterangan_coa
|
||||
];
|
||||
|
||||
$html = view('pages.admin.penjualan.laporan', $alldata);
|
||||
// $html->render();
|
||||
// $mpdf->WriteHTML($html);
|
||||
|
||||
// $mpdf->chunkLoadView('<html-separator/>', 'pages.admin.penjualan.laporan', $alldata);
|
||||
// return $mpdf->stream('document.pdf');
|
||||
|
||||
$chunks = explode("chunk", (string)$html);
|
||||
foreach ($chunks as $key => $val) {
|
||||
// $mpdf->WriteHTML($val);
|
||||
}
|
||||
$mpdf->writeHTML($html);
|
||||
|
||||
$mpdf->Output('Laporan_Penjualan.pdf', 'I');
|
||||
return response()->header('Content-Type', 'application/pdf');
|
||||
} catch (\Throwable $th) {
|
||||
Session::flash('errors', 'Gagal membuat laporan, coba lagi dengan rentang tanggal yang lebih pendek');
|
||||
return redirect()->back();
|
||||
//throw $th;
|
||||
}
|
||||
|
||||
$alldata = [
|
||||
'data' => $data,
|
||||
'filter_tanggal_1' => $filter_tanggal_1,
|
||||
'filter_tanggal_2' => $filter_tanggal_2,
|
||||
'keterangan_coa' => $keterangan_coa
|
||||
];
|
||||
|
||||
$html = view('pages.admin.penjualan.laporan', $alldata);
|
||||
// $html->render();
|
||||
// $mpdf->WriteHTML($html);
|
||||
|
||||
// $mpdf->chunkLoadView('<html-separator/>', 'pages.admin.penjualan.laporan', $alldata);
|
||||
// return $mpdf->stream('document.pdf');
|
||||
|
||||
$chunks = explode("chunk", (string)$html);
|
||||
foreach ($chunks as $key => $val) {
|
||||
// $mpdf->WriteHTML($val);
|
||||
}
|
||||
$mpdf->writeHTML($html);
|
||||
|
||||
$mpdf->Output('Laporan_Penjualan.pdf', 'I');
|
||||
return response()->header('Content-Type', 'application/pdf');
|
||||
}
|
||||
|
||||
public function cancel(Request $request)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[ViewState]
|
||||
Mode=
|
||||
Vid=
|
||||
FolderType=Generic
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"name": "zelda/escpos-php",
|
||||
"type": "project",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Zelda\\EscposPhp\\": "src/"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Zelda Ababil",
|
||||
"email": "zeldaababil01@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.3.0",
|
||||
"ext-json": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-zlib": "*",
|
||||
"mike42/gfx-php": "^0.6"
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"name": "zelda/escpos-php",
|
||||
"type": "project",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "zelda",
|
||||
"email": "zelda#gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.3.0",
|
||||
"ext-json": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-zlib": "*",
|
||||
"zelda/gfx-php": "@dev"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Zelda\\": "src/Zelda"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": false
|
||||
}
|
|
@ -29,11 +29,13 @@
|
|||
<label>Filter Pencarian:</label>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<input type="date" class="form-control form-control-sm" id="filter_tanggal_1">
|
||||
<input type="date" class="form-control form-control-sm" id="filter_tanggal_1"
|
||||
value="{{ date('Y-m-d') }}">
|
||||
</div>
|
||||
<p>s/d</p>
|
||||
<div class="col-md-2">
|
||||
<input type="date" class="form-control form-control-sm" id="filter_tanggal_2">
|
||||
<input type="date" class="form-control form-control-sm" id="filter_tanggal_2"
|
||||
value="{{ date('Y-m-d') }}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<a href="javascript:void(0)" class="btn btn-sm btn-primary" id="btn_filter"><i
|
||||
|
|
|
@ -25,6 +25,13 @@
|
|||
<div class="card">
|
||||
<div class="card bg-warning" style="min-height:5px; border-radius:1px;"></div>
|
||||
<div class="card-body">
|
||||
@if (Session::has('errors'))
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h5><i class="icon fas fa-ban"></i> Gagal</h5>
|
||||
{{ Session::get('errors') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<label>Filter Pencarian:</label>
|
||||
|
|
Loading…
Reference in New Issue