Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function env(string $key, $default = null)
]));

// Developer mode
define('DEV_MODE', env('DEVMODE') ?: 'true');
define('DEV_MODE', true);

define('JWT_SECRET', 'mlite_secret_key_change_me');

Expand Down
8 changes: 4 additions & 4 deletions mlite_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1651,8 +1651,8 @@ CREATE TABLE `mlite_bpjs_emr_device` (
`kode_produk` VARCHAR(100) DEFAULT NULL,
`keterangan` TEXT DEFAULT NULL,
`manufacturer` VARCHAR(255) DEFAULT NULL,
'manufacture_date' DATE NOT NULL,
'expiration_date' DATE NOT NULL,
'manufacture_date' DATE DEFAULT NULL,
'expiration_date' DATE DEFAULT NULL,
`model` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_device_id` (`device_id`),
Expand Down Expand Up @@ -2060,7 +2060,7 @@ CREATE TABLE `mlite_esignatures` (
PRIMARY KEY (`id`),
KEY `ref_idx` (`ref_type`,`ref_id`),
KEY `hash_idx` (`signature_hash`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;


CREATE TABLE `mlite_geolocation_presensi` (
Expand Down Expand Up @@ -2798,7 +2798,7 @@ CREATE TABLE `mlite_sertisign_webhook` (
PRIMARY KEY (`id`),
KEY `transaction_idx` (`transaction_id`),
KEY `status_idx` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;


CREATE TABLE `mlite_mapping_snomed_icd` (
Expand Down
2 changes: 1 addition & 1 deletion plugins/kasir_rawat_inap/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ public function anyRincian()

// Prepare ingredient row (hide prices)
$row['nomor'] = '';
$row['nama_brng'] = "     - " . $row['nama_brng'];
$row['nama_brng'] = str_repeat("\u{00A0}", 4) . ' - ' . $row['nama_brng'];
$row['total'] = 0;
$row['embalase'] = 0;
$row['tuslah'] = 0;
Expand Down
35 changes: 32 additions & 3 deletions plugins/kasir_rawat_jalan/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function navigation()
'Kelola' => 'manage',
'Kasir' => 'shift',
'Laporan' => 'report',
'Rekap Shift' => 'shiftreport',
];
}

Expand Down Expand Up @@ -822,7 +823,7 @@ public function anyRincian()

// Prepare ingredient row (hide prices)
$row['nomor'] = '';
$row['nama_brng'] = "     - " . $row['nama_brng'];
$row['nama_brng'] = str_repeat("\u{00A0}", 4) . ' - ' . $row['nama_brng'];
$row['total'] = 0;
$row['embalase'] = 0;
$row['tuslah'] = 0;
Expand Down Expand Up @@ -2006,7 +2007,7 @@ public function anyFaktur()
if ($row) {
$total_racikan += $row['total'];

$row['nama_brng'] = "     - " . $row['nama_brng'];
$row['nama_brng'] = str_repeat("\u{00A0}", 4) . ' - ' . $row['nama_brng'];
$row['total'] = 0;
$row['jml'] = 0;
$row['biaya_obat'] = 0;
Expand Down Expand Up @@ -2298,7 +2299,7 @@ public function anyReport()
$detailStmt->execute([$awal, $akhir]);
$details = $detailStmt->fetchAll();

return $this->draw('report.html', ['awal' => $awal, 'akhir' => $akhir, 'rows' => $rows, 'details' => $details]);
return $this->draw('report.html', ['awal' => $awal, 'akhir' => $akhir, 'rows' => $rows, 'details' => $details, 'settings' => $this->settings('settings')]);
}

public function anyReportExport()
Expand All @@ -2317,4 +2318,32 @@ public function anyReportExport()
exit();
}

public function anyShiftReport()
{
$this->_addHeaderFiles();
$awal = isset($_GET['awal']) ? $_GET['awal'] : date('Y-m-d').' 00:00:00';
$akhir = isset($_GET['akhir']) ? $_GET['akhir'] : date('Y-m-d').' 23:59:59';
$pdo = $this->db()->pdo();
$stmt = $pdo->prepare("SELECT s.id_shift, s.user_id, COALESCE(p.nama, u.fullname) AS nama_kasir, s.waktu_buka, s.waktu_tutup, IFNULL(s.kas_awal,0) kas_awal, IFNULL(s.total_transaksi,0) total_transaksi, IFNULL(s.kas_akhir,0) kas_akhir, IFNULL(s.selisih,0) selisih, s.keterangan FROM mlite_kasir_shift s LEFT JOIN mlite_users u ON u.id=s.user_id LEFT JOIN pegawai p ON p.nik=u.username WHERE (s.waktu_buka BETWEEN ? AND ?) OR (s.waktu_tutup BETWEEN ? AND ?) OR (s.waktu_buka <= ? AND (s.waktu_tutup IS NULL OR s.waktu_tutup >= ?)) ORDER BY s.waktu_buka ASC, s.id_shift ASC");
$stmt->execute([$awal, $akhir, $awal, $akhir, $awal, $akhir]);
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
return $this->draw('shift.report.html', ['awal' => $awal, 'akhir' => $akhir, 'rows' => $rows, 'settings' => $this->settings('settings')]);
}

public function anyShiftReportExport()
{
$awal = isset($_GET['awal']) ? $_GET['awal'] : date('Y-m-d').' 00:00:00';
$akhir = isset($_GET['akhir']) ? $_GET['akhir'] : date('Y-m-d').' 23:59:59';
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="rekap_shift_kasir.csv"');
$pdo = $this->db()->pdo();
$stmt = $pdo->prepare("SELECT s.id_shift, s.user_id, COALESCE(p.nama, u.fullname) AS nama_kasir, s.waktu_buka, s.waktu_tutup, IFNULL(s.kas_awal,0) kas_awal, IFNULL(s.total_transaksi,0) total_transaksi, IFNULL(s.kas_akhir,0) kas_akhir, IFNULL(s.selisih,0) selisih, s.keterangan FROM mlite_kasir_shift s LEFT JOIN mlite_users u ON u.id=s.user_id LEFT JOIN pegawai p ON p.nik=u.username WHERE (s.waktu_buka BETWEEN ? AND ?) OR (s.waktu_tutup BETWEEN ? AND ?) OR (s.waktu_buka <= ? AND (s.waktu_tutup IS NULL OR s.waktu_tutup >= ?)) ORDER BY s.waktu_buka ASC, s.id_shift ASC");
$stmt->execute([$awal, $akhir, $awal, $akhir, $awal, $akhir]);
echo "id_shift,user_id,nama_kasir,waktu_buka,waktu_tutup,kas_awal,total_transaksi,kas_akhir,selisih,keterangan\n";
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
echo ($row['id_shift'] ?? '').",".($row['user_id'] ?? '').",\"".str_replace('\"', '\"\"', (string)($row['nama_kasir'] ?? ''))."\",".($row['waktu_buka'] ?? '').",".($row['waktu_tutup'] ?? '').",".($row['kas_awal'] ?? 0).",".($row['total_transaksi'] ?? 0).",".($row['kas_akhir'] ?? 0).",".($row['selisih'] ?? 0).",\"".str_replace('\"', '\"\"', (string)($row['keterangan'] ?? ''))."\"\n";
}
exit();
}

}
34 changes: 33 additions & 1 deletion plugins/kasir_rawat_jalan/view/admin/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,37 @@ <h3 class="panel-title">Laporan Kasir</h3>
</form>

<hr>
<div id="kop_print" style="display:none;">
<div style="width:960px;">
<table style="width:100%;">
<thead>
<tr>
<th style="text-align:left;">
<img src="{?=url()?}/{?=isset_or($settings.logo)?}" height="80px" style="margin-right: 20px;" alt="">
</th>
<th style="text-align:left;" width="100%">
<p style="margin:0;">
<span style="font-size: 22px;">{?=isset_or($settings.nama_instansi)?}</span><br>
<span style="font-size: 14px;">Alamat: {?=isset_or($settings.alamat)?} - {?=isset_or($settings.kota)?} - {?=isset_or($settings.propinsi)?}</span><br>
<span style="font-size: 14px;">Telepon: {?=isset_or($settings.nomor_telepon)?} - Email: {?=isset_or($settings.email)?}</span>
</p>
</th>
</tr>
<tr>
<th colspan="2">
<hr style="border-bottom: 2px solid #000;padding-top:3px;">
</th>
</tr>
<tr>
<th colspan="2">
<div style="text-align:center;font-size:16px;margin:10px 0 0 0;"><b>LAPORAN KASIR RAWAT JALAN</b></div>
<div style="text-align:center;font-size:13px;margin:4px 0 10px 0;">Periode {?=isset_or($awal)?} s/d {?=isset_or($akhir)?}</div>
</th>
</tr>
</thead>
</table>
</div>
</div>
<div id="laporan">
<table class="table table-striped">
<thead>
Expand Down Expand Up @@ -91,8 +122,9 @@ <h3 class="panel-title">Laporan Kasir</h3>

function printContent(el){
var restore = document.body.innerHTML;
var kop = document.getElementById('kop_print') ? document.getElementById('kop_print').innerHTML : '';
var content = document.getElementById(el).innerHTML;
document.body.innerHTML = content;
document.body.innerHTML = kop + content;
window.print();
document.body.innerHTML = restore;
}
Expand Down
157 changes: 157 additions & 0 deletions plugins/kasir_rawat_jalan/view/admin/shift.report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Rekap Shift Kasir</h3>
</div>
<div class="panel-body">
<form method="get" action="{?= url([ADMIN,'kasir_rawat_jalan','shiftreport']) ?}">
<input type="hidden" name="t" value="{?=$_SESSION['token']?}">
<div class="row">
<div class="col-md-4">
<label>Mulai</label>
<input type="text" class="form-control tanggal_jam" name="awal" value="{?=isset_or($awal)?}">
</div>
<div class="col-md-4">
<label>Selesai</label>
<input type="text" class="form-control tanggal_jam" name="akhir" value="{?=isset_or($akhir)?}">
</div>
<div class="col-md-4">
<label>&nbsp;</label>
<div>
<button type="submit" class="btn btn-primary">Terapkan</button>
<a class="btn btn-default" href="{?= url([ADMIN,'kasir_rawat_jalan','shiftreportexport']) ?}&awal={?=isset_or($awal)?}&akhir={?=isset_or($akhir)?}">Export CSV</a>
<button type="button" class="btn btn-warning" onclick="printContent('laporan_shift')">Cetak</button>
</div>
</div>
</div>
</form>
<hr>
<div id="kop_print" style="display:none;">
<div style="width:960px;">
<table style="width:100%;">
<thead>
<tr>
<th style="text-align:left;">
<img src="{?=url()?}/{?=isset_or($settings.logo)?}" height="80px" style="margin-right: 20px;" alt="">
</th>
<th style="text-align:left;" width="100%">
<p style="margin:0;">
<span style="font-size: 22px;">{?=isset_or($settings.nama_instansi)?}</span><br>
<span style="font-size: 14px;">Alamat: {?=isset_or($settings.alamat)?} - {?=isset_or($settings.kota)?} - {?=isset_or($settings.propinsi)?}</span><br>
<span style="font-size: 14px;">Telepon: {?=isset_or($settings.nomor_telepon)?} - Email: {?=isset_or($settings.email)?}</span>
</p>
</th>
</tr>
<tr>
<th colspan="2">
<hr style="border-bottom: 2px solid #000;padding-top:3px;">
</th>
</tr>
<tr>
<th colspan="2">
<div style="text-align:center;font-size:16px;margin:10px 0 0 0;"><b>REKAP SHIFT KASIR RAWAT JALAN</b></div>
<div style="text-align:center;font-size:13px;margin:4px 0 10px 0;">Periode {?=isset_or($awal)?} s/d {?=isset_or($akhir)?}</div>
</th>
</tr>
</thead>
</table>
</div>
</div>
<div id="laporan_shift">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>ID Shift</th>
<th>ID Kasir</th>
<th>Nama Kasir</th>
<th>Waktu Buka</th>
<th>Waktu Tutup</th>
<th>Status</th>
<th>Kas Awal</th>
<th>Total Transaksi</th>
<th>Kas Akhir</th>
<th>Selisih</th>
<th>Keterangan</th>
</tr>
</thead>
<tbody id="rows"></tbody>
<tfoot>
<tr>
<th colspan="6" class="text-right">Total</th>
<th id="t_kas_awal"></th>
<th id="t_total"></th>
<th id="t_kas_akhir"></th>
<th id="t_selisih"></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
<script>
(function(){
var rows = {?= json_encode($rows ?? []) ?};
var tbody = document.getElementById('rows');
var tKasAwal = 0;
var tTotal = 0;
var tKasAkhir = 0;
var tSelisih = 0;

function fmt(n){
return Number(n || 0).toLocaleString('id-ID',{minimumFractionDigits:2, maximumFractionDigits:2});
}

if (Array.isArray(rows)) {
rows.forEach(function(r){
var kasAwal = Number(r.kas_awal || 0);
var total = Number(r.total_transaksi || 0);
var kasAkhir = Number(r.kas_akhir || 0);
var selisih = Number(r.selisih || 0);
var status = r.waktu_tutup ? 'Tertutup' : 'Terbuka';

tKasAwal += kasAwal;
tTotal += total;
tKasAkhir += kasAkhir;
tSelisih += selisih;

var tr = document.createElement('tr');
tr.innerHTML =
'<td>'+ (r.id_shift || '') +'</td>'+
'<td>'+ (r.user_id || '') +'</td>'+
'<td>'+ (r.nama_kasir || '') +'</td>'+
'<td>'+ (r.waktu_buka || '') +'</td>'+
'<td>'+ (r.waktu_tutup || '') +'</td>'+
'<td>'+ status +'</td>'+
'<td class="text-right">'+ fmt(kasAwal) +'</td>'+
'<td class="text-right">'+ fmt(total) +'</td>'+
'<td class="text-right">'+ fmt(kasAkhir) +'</td>'+
'<td class="text-right">'+ fmt(selisih) +'</td>'+
'<td>'+ (r.keterangan || '') +'</td>';
tbody.appendChild(tr);
});
}

document.getElementById('t_kas_awal').innerText = fmt(tKasAwal);
document.getElementById('t_total').innerText = fmt(tTotal);
document.getElementById('t_kas_akhir').innerText = fmt(tKasAkhir);
document.getElementById('t_selisih').innerText = fmt(tSelisih);
})();

function printContent(el){
var restore = document.body.innerHTML;
var kop = document.getElementById('kop_print') ? document.getElementById('kop_print').innerHTML : '';
var content = document.getElementById(el).innerHTML;
document.body.innerHTML = kop + content;
window.print();
document.body.innerHTML = restore;
}
</script>
<script type="text/javascript">
$(function () {
$('.tanggal_jam').datetimepicker({
defaultDate: '{?=date('Y-m-d H:i:s')?}',
format: 'YYYY-MM-DD HH:mm:ss',
locale: 'id'
});
});
</script>
</div>
</div>
Loading