Compare commits

...

4 Commits

Author SHA1 Message Date
Zelda Ababil ca06f63ca3 sebelum auth 2024-01-22 13:22:02 +07:00
Zelda Ababil 1fb28c33cf total 2024-01-22 13:12:24 +07:00
Zelda Ababil ab1a2c886a total 2024-01-22 13:05:50 +07:00
Zelda Ababil dce70d85dd br print 2024-01-21 16:10:19 +07:00
8 changed files with 234 additions and 85 deletions

View File

@ -24,13 +24,20 @@ class History extends Controller
->addColumn('nomor', function ($data) use (&$nomor) { ->addColumn('nomor', function ($data) use (&$nomor) {
return $nomor++; return $nomor++;
}) })
->addColumn('nama_user', function ($data) { ->addColumn('nama_pemesan', function ($data) {
return $data->user->name; $nomor = $data->nomor_pemesan != null ? '(' . $data->nomor_pemesan . ')' : '';
return $data->nama_pemesan . ' ' . $nomor;
})
->addColumn('nomor_meja', function ($data) {
return $data->nomor_meja != null ? $data->nomor_meja : '-';
}) })
->addColumn('created_at', function ($data) { ->addColumn('created_at', function ($data) {
return \Carbon\Carbon::parse($data->created_at)->format('d F Y H:i:s'); return \Carbon\Carbon::parse($data->created_at)->format('d F Y H:i:s');
}) })
->addColumn('grand_total', function ($data) { ->addColumn('total_bayar_rp', function ($data) {
return 'Rp ' . number_format($data->total_bayar, 0, ',', '.');
})
->addColumn('grand_total_rp', function ($data) {
return 'Rp ' . number_format($data->grand_total, 0, ',', '.'); return 'Rp ' . number_format($data->grand_total, 0, ',', '.');
}) })
->addColumn('ubah', function ($data) { ->addColumn('ubah', function ($data) {

View File

@ -32,14 +32,26 @@
<tr> <tr>
<th class="text-center">No</th> <th class="text-center">No</th>
<th>Kode Pesanan</th> <th>Kode Pesanan</th>
<th>Kasir</th> <th>Pemesan</th>
<th>Nomor Meja</th>
<th>Tanggal & Jam</th> <th>Tanggal & Jam</th>
<th>Total Pesanan</th> <th>Total Pesanan</th>
<th>Sub Total</th>
<th>Diskon(%)</th> <th>Diskon(%)</th>
<th>Total</th> <th>Grand Total</th>
<th class="text-center"><i class="fas fa-cog"></i></th> <th class="text-center"><i class="fas fa-cog"></i></th>
</tr> </tr>
</thead> </thead>
<tfoot>
<tr>
<th class="text-right" colspan="5">Total</th>
<th></th>
<th class="text-right"></th>
<th></th>
<th class="text-right"></th>
<th class="text-center"><i class="fas fa-cog"></i></th>
</tr>
</tfoot>
</table> </table>
</div> </div>
</div> </div>
@ -75,12 +87,42 @@
processing: true, processing: true,
serverSide: true, serverSide: true,
ajax: '{{ route('history.getDataHistory') }}', ajax: '{{ route('history.getDataHistory') }}',
columns: [ columns: [{
{data: 'nomor', name: 'nomor', orderable: false, className: 'text-center'}, data: 'nomor',
{data: 'kode_pesanan', name: 'kode_pesanan'}, name: 'nomor',
{data: 'nama_user', name: 'nama_user'}, orderable: false,
{data: 'created_at', name: 'created_at'}, className: 'text-center'
{data: 'total_pesanan', name: 'total_pesanan', className: 'text-center'}, },
{
data: 'kode_pesanan',
name: 'kode_pesanan'
},
{
data: 'nama_pemesan',
name: 'nama_pemesan'
},
{
data: 'nomor_meja',
name: 'nomor_meja'
},
{
data: 'created_at',
name: 'created_at'
},
{
data: 'total_pesanan',
name: 'total_pesanan',
className: 'text-center'
},
{
data: 'total_bayar',
name: 'total_bayar',
className: 'text-right',
render: function(data) {
// change to IDR
return 'Rp. ' + data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
}
},
{ {
data: 'diskon_persen', data: 'diskon_persen',
name: 'diskon_persen', name: 'diskon_persen',
@ -89,9 +131,66 @@
return data ?? 0; return data ?? 0;
} }
}, },
{data: 'grand_total', name: 'grand_total'}, {
{data: 'ubah', name: 'ubah', className: 'text-center'}, data: 'grand_total',
] name: 'grand_total',
className: 'text-right',
render: function(data) {
// change to IDR
return 'Rp. ' + data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
}
},
{
data: 'ubah',
name: 'ubah',
className: 'text-center'
},
],
footerCallback: function(row, data, start, end, display) {
let api = this.api();
// Remove the formatting to get integer data for summation
let intVal = function(i) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '') * 1 :
typeof i === 'number' ?
i :
0;
};
// GrandTotal over all pages
totalAll = api
.column(8)
.data()
.reduce((a, b) => intVal(a) + intVal(b), 0);
// GrandTotal over all pages
diskonTotal = api
.column(7)
.data()
.reduce((a, b) => intVal(a) + intVal(b), 0);
// Total over this page
pageTotal = api
.column(6, {
page: 'current'
})
.data()
.reduce((a, b) => intVal(a) + intVal(b), 0);
// total pesanan
totalPesanan = api
.column(5)
.data()
.reduce((a, b) => intVal(a) + intVal(b), 0);
// Update footer
api.column(5).footer().innerHTML = totalPesanan + ' Item';
api.column(6).footer().innerHTML =
'Rp. ' + pageTotal.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
api.column(7).footer().innerHTML = diskonTotal + ' %';
api.column(8).footer().innerHTML =
'Rp. ' + totalAll.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
}
}) })
}) })
</script> </script>

View File

@ -77,11 +77,11 @@
<body style="width: 58mm;"> <body style="width: 58mm;">
<!-- Button Print --> <!-- Button Print -->
<div class=""> {{-- <div class="">
<div class="col-6 mb"> <div class="col-6 mb">
<button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button> <button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button>
</div> </div>
</div> </div> --}}
<br> <br>
<h2 style="text-align: center">Sepiring Telur Keriting</h2> <h2 style="text-align: center">Sepiring Telur Keriting</h2>
<p style="text-align: center">Jln. Jawa No. 28A, Jember</p> <p style="text-align: center">Jln. Jawa No. 28A, Jember</p>
@ -211,10 +211,10 @@
{{ $item->nama_produk }} {{ $item->nama_produk }}
</h4> </h4>
@if ($item->keterangan_produk != '') @if ($item->keterangan_produk != '')
<br>
<p> <p>
&nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }} &nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }}
</p> </p>
<br>
@endif @endif
</td> </td>
</tr> </tr>
@ -303,7 +303,12 @@
} }
</style> </style>
<script> <script>
// window.print(); addEventListener("afterprint", (event) => {
window.close();
});
window.print();
const $btnPrint = document.querySelector("#print-dapur"); const $btnPrint = document.querySelector("#print-dapur");
$btnPrint.addEventListener("click", () => { $btnPrint.addEventListener("click", () => {
window.print(); window.print();

View File

@ -75,13 +75,19 @@
} }
</style> </style>
<body style="width: 58mm;"> <body style="width: 56mm;">
<!-- Button Print --> <!-- Button Print -->
<div class=""> {{-- <div class="">
<div class="col-6 mb"> <div class="col-6 mb">
<button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button> <button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button>
</div> </div>
<div class="col-6 mb">
<button class="btn btn-warning btn-block hidden-print" id="refresh">Refresh</button>
</div> </div>
<div class="col-6 mb">
<button class="btn btn-danger btn-block hidden-print" id="close">Tutup</button>
</div>
</div> --}}
<br> <br>
<h2 style="text-align: center">Sepiring Telur Keriting</h2> <h2 style="text-align: center">Sepiring Telur Keriting</h2>
<p style="text-align: center">Jln. Jawa No. 28A, Jember</p> <p style="text-align: center">Jln. Jawa No. 28A, Jember</p>
@ -211,10 +217,10 @@
{{ $item->nama_produk }} {{ $item->nama_produk }}
</h4> </h4>
@if ($item->keterangan_produk != '') @if ($item->keterangan_produk != '')
<br>
<p> <p>
&nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }} &nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }}
</p> </p>
<br>
@endif @endif
</td> </td>
</tr> </tr>
@ -290,6 +296,13 @@
box-shadow: none; box-shadow: none;
} }
.btn-warning {
color: #fff;
background-color: orange;
border-color: orange;
box-shadow: none;
}
.btn-danger { .btn-danger {
color: #fff; color: #fff;
background-color: #dc3545; background-color: #dc3545;
@ -303,7 +316,12 @@
} }
</style> </style>
<script> <script>
// window.print(); addEventListener("afterprint", (event) => {
window.close();
});
window.print();
const $btnPrint = document.querySelector("#print-dapur"); const $btnPrint = document.querySelector("#print-dapur");
$btnPrint.addEventListener("click", () => { $btnPrint.addEventListener("click", () => {
window.print(); window.print();
@ -314,6 +332,11 @@
location.reload() location.reload()
}) })
}) })
$(document).ready(function() {
$('#close').on('click', function() {
window.close()
})
})
</script> </script>
</html> </html>

View File

@ -77,11 +77,11 @@
<body style="width: 58mm;"> <body style="width: 58mm;">
<!-- Button Print --> <!-- Button Print -->
<div class=""> {{-- <div class="">
<div class="col-6 mb"> <div class="col-6 mb">
<button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button> <button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button>
</div> </div>
</div> </div> --}}
<br> <br>
@for ($i = 0; $i < 2; $i++) @for ($i = 0; $i < 2; $i++)
<hr class="dashed-line" style="margin-top: 15px;"> <hr class="dashed-line" style="margin-top: 15px;">
@ -127,10 +127,10 @@
({{ $item->jumlah_produk }} X) ({{ $item->jumlah_produk }} X)
{{ $item->nama_produk }} {{ $item->nama_produk }}
@if ($item->keterangan_produk != '') @if ($item->keterangan_produk != '')
<br> <p>
<small>
&nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }} &nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }}
</small> </p>
<br>
@endif @endif
</td> </td>
</tr> </tr>
@ -220,7 +220,12 @@
} }
</style> </style>
<script> <script>
// window.print(); addEventListener("afterprint", (event) => {
window.close();
});
window.print();
const $btnPrint = document.querySelector("#print-dapur"); const $btnPrint = document.querySelector("#print-dapur");
$btnPrint.addEventListener("click", () => { $btnPrint.addEventListener("click", () => {
window.print(); window.print();

View File

@ -77,11 +77,11 @@
<body style="width: 58mm;"> <body style="width: 58mm;">
<!-- Button Print --> <!-- Button Print -->
<div class=""> {{-- <div class="">
<div class="col-6 mb"> <div class="col-6 mb">
<button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button> <button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button>
</div> </div>
</div> </div> --}}
<br> <br>
@for ($i = 0; $i < 3; $i++) @for ($i = 0; $i < 3; $i++)
<hr class="dashed-line" style="margin-top: 15px;"> <hr class="dashed-line" style="margin-top: 15px;">
@ -129,10 +129,10 @@
{{ $item->nama_produk }} {{ $item->nama_produk }}
</h4> </h4>
@if ($item->keterangan_produk != '') @if ($item->keterangan_produk != '')
<br>
<p> <p>
&nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }} &nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }}
</p> </p>
<br>
@endif @endif
</td> </td>
</tr> </tr>
@ -223,7 +223,12 @@
} }
</style> </style>
<script> <script>
// window.print(); addEventListener("afterprint", (event) => {
window.close();
});
window.print();
const $btnPrint = document.querySelector("#print-dapur"); const $btnPrint = document.querySelector("#print-dapur");
$btnPrint.addEventListener("click", () => { $btnPrint.addEventListener("click", () => {
window.print(); window.print();

View File

@ -1075,21 +1075,26 @@
if (orderMenus.length == 0) { if (orderMenus.length == 0) {
alert('Menu tidak boleh kosong'); alert('Menu tidak boleh kosong');
document.getElementById('pesan-bayar').disabled = false;
return false; return false;
} }
if (totalDiskon != 0) { if (totalDiskon != 0) {
if (nominalBayar == '' || nominalBayar == 0) { if (nominalBayar == '' || nominalBayar == 0) {
alert('Pembayaran tidak boleh kosong'); alert('Pembayaran tidak boleh kosong');
document.getElementById('pesan-bayar').disabled = false;
return false; return false;
} }
} else if (kembaliHidden < 0) { } else if (kembaliHidden < 0) {
alert('Pembayaran kurang'); alert('Pembayaran kurang');
document.getElementById('pesan-bayar').disabled = false;
return false; return false;
} else if (namaPemesan == '') { } else if (namaPemesan == '') {
alert('Nama pemesan tidak boleh kosong'); alert('Nama pemesan tidak boleh kosong');
document.getElementById('pesan-bayar').disabled = false;
return false; return false;
} else if (nomorMeja == '') { } else if (nomorMeja == '') {
alert('Nomor meja tidak boleh kosong'); alert('Nomor meja tidak boleh kosong');
document.getElementById('pesan-bayar').disabled = false;
return false; return false;
} }