| |
| $sql_shu1="select SUM(nom_bunga) as nom_bunga, tgl_entry from angsuran group by MONTHNAME(tgl_entry), YEAR(tgl_entry) order by tgl_entry desc"; |
| $query5=mysql_query($sql_shu1); |
| while ($r1=mysql_fetch_array($query5)) { |
| $nom_bunga1=['nom_bunga']; |
| $nom_shu = ($nom_bunga1['nom_bunga']*90/100); |
| } |
| |
| |
| $sql1="select SUM(tabungan) as tabungan, MONTHNAME(tanggal_simpan) as bulan, YEAR(tanggal_simpan) as tahun, (select SUM(tabungan) from simpanan b where jenis = 'SIMPANAN WAJIB' and MONTHNAME(a.tanggal_simpan) = MONTHNAME(b.tanggal_simpan) and YEAR(a.tanggal_simpan) = YEAR(b.tanggal_simpan)) as wajib, (select SUM(tabungan) from simpanan c where jenis = 'SIMPANAN POKOK' and MONTHNAME(a.tanggal_simpan) = MONTHNAME(c.tanggal_simpan) and YEAR(a.tanggal_simpan) = YEAR(c.tanggal_simpan)) as pokok from simpanan a group by MONTHNAME(tanggal_simpan), YEAR(tanggal_simpan) order by tanggal_simpan asc"; |
| $ambil1=mysql_query($sql1); |
| while ($tampil1=mysql_fetch_array($ambil1)) { |
| $wajib = $tampil1['wajib']; |
| } |
| |
| |
| |
| |
| $sql2="select a.tabungan as shu, id_simpan, nopeg, nama, department, unit, jenis, besar, (SELECT b.tabungan FROM simpanan b where a.id_simpan = b.id_simpan and b.status='Aktif' AND b.jenis='Simpanan Wajib' and b.tanggal_simpan in (SELECT MAX(c.tanggal_simpan) FROM simpanan c where c.jenis = 'Simpanan Wajib' and c.id_simpan = b.id_simpan)) as wajib from simpanan a where a.jenis='Simpanan SHU' and a.tanggal_simpan <= '$date1' ORDER BY `a`.`id_simpan` ASC"; |
| $ambil2=mysql_query($sql2); |
| while ($tampil2=mysql_fetch_array($ambil2)) { |
| $id_simpan1=$tampil2['id_simpan']; |
| $nopeg1=$tampil2['nopeg']; |
| $nama1=$tampil2['nama']; |
| $department1=$tampil2['department']; |
| $unit1=$tampil2['unit']; |
| $jenis1=$tampil2['jenis']; |
| $shu=$tampil2['shu']; |
| $wajib1=$tampil2['wajib']; |
| $bagi_shu=$tampil2['wajib']/$tampil1['wajib']*$nom_shu; |
| $tabungan1=$bagi_shu+$shu; |
| mysql_query(" |
| INSERT INTO simpanan |
| (id_simpan, nopeg, nama, department, unit, jenis, besar, tabungan, tanggal_simpan) |
| values |
| ('$id_simpan1', '$nopeg1', '$nama1', '$department1', '$unit1', '$jenis1', '$bagi_shu', '$tabungan1', '$date1')"); |
| } |