- +
@@ -99,6 +99,59 @@ +
+ +
+
+
+
+

Bulan/Tahun : {{bulan_ini}}

+
+ + + + + + + + + + + + {%if data_karyawan %} + + {% for i in range(0, length_karyawan) %} + + + + + + + + + + + {% endfor %} + {% else %} + + + + {% endif %} + +
NamaGaji/HariPendapatan/BulanAksi
{{data_karyawan[i]['name']}}{{data_karyawan[i]['gaji']}}{{data_karyawan[i]['pendapatan']}} + + +
Tidak ada data
+ +
+
+
+
+ + +
@@ -144,6 +197,60 @@ window.location.href = "{{url_for('tambah_karyawan')}}"; } } + + // create a function that addn thousand separator using comma + function addThousandSeparator(number) { + // Convert the number to a string + let numStr = number.toString(); + + // Use a regular expression to add commas as thousand separators + numStr = numStr.replace(/\B(?=(\d{3})+(?!\d))/g, ','); + + return numStr; + } + + // Get all elements with the class "ini dia" + const tdElements = document.querySelectorAll('td.gajinya'); + + // Iterate through each element + tdElements.forEach(td => { + // Get the current value of the + let currentValue = parseFloat(td.textContent); + + // Check if the value is a valid number + if (!isNaN(currentValue)) { + // Update the content of the with the formatted value + td.textContent = 'Rp. ' + addThousandSeparator(currentValue); + } + }); + + + function addThousandSeparators(value) { + return value.replace(/\B(?=(\d{3})+(?!\d))/g, ","); + } + + + function printDiv(name, gaji, pendapatan) { + console.log(name, gaji, pendapatan); + var printWindow = window.open('', '', 'height=400,width=800'); + printWindow.document.write('DIV Contents'); + printWindow.document.write(''); + printWindow.document.write('

Slip Gaji

'); + printWindow.document.write('

Nama : ' + name + '

'); + printWindow.document.write('

Gaji : Rp.' + addThousandSeparator(gaji) + '

'); + printWindow.document.write('

Pendapatan : Rp. ' + addThousandSeparator(pendapatan) + '

'); + printWindow.document.write('

Tanggal : {{today_date}}

'); + printWindow.document.write('

Terima kasih atas kerja keras anda

'); + // ttd + printWindow.document.write('



'); + printWindow.document.write('

TTD

'); + printWindow.document.write('

Naufal

'); + + + printWindow.document.write(''); + printWindow.document.close(); + printWindow.print(); + } diff --git a/templates/tambah_karyawan.html b/templates/tambah_karyawan.html index e6a7263..a8a9bfb 100755 --- a/templates/tambah_karyawan.html +++ b/templates/tambah_karyawan.html @@ -88,6 +88,14 @@
+ +
+ + +
+