function get_bulan() { $data = array(); $data = $this->kasir_model->get_tahun(true, 'penjualan'); foreach ($data as $r) { $select = $r->Bulan == date('m') ? 'selected' : ''; echo "<option value='" . $r->Bulan . "' " . $select . ">" . nBulan($r->Bulan) . "</option>"; } }
function LongTgl($tgl = '') { $tgl == '' ? $tanggal = date('d F Y') : ($tanggal = substr($tgl, 0, 2) . " " . nBulan(round(substr($tgl, 3, 2), 0)) . " " . substr($tgl, 6, 4)); return $tanggal; }
function laba_graph($thn, $bln) { $t_days = cal_days_in_month(CAL_GREGORIAN, $bln, $thn); $xml = fopen($this->user . '_graph_labarugi.xml', 'w'); fwrite($xml, "<graph caption='Grafik Aliran Kas' subcaption='Periode :" . nBulan($bln) . " " . $thn . "' xAxisName='Bulan' yAxisName='Value' showValues= '1' showLabels='1' showValues='2'>\r\n"); //create category by jenis penjuallan ( tunai,giro,cheque,Kredit,return fwrite($xml, "<categories>\r\n"); //while($rw=mysql_fetch_object($rcat)){ for ($i = 1; $i <= $t_days; $i++) { fwrite($xml, "<category name='" . $i . "'/>\r\n"); } fwrite($xml, "</categories>\r\n"); $color = array('', '1D8BD1', 'F1683C', '2AD62A', 'DBDC25', 'D2DCDD'); fwrite($xml, "<dataset seriesName='Rugi Laba' color='" . $color[3] . "'>\r\n"); for ($x = 1; $x <= $t_days; $x++) { $ii = strlen($x) == 1 ? '0' . $x : $x; $val = 0; $laba = 0; $cat1 = "select sum(dt.jumlah*dt.harga) as Jual,sum(dt.Jumlah*b.Harga_Beli) as Harga_Beli\r\n\t\t\t\t\t\tfrom inv_penjualan_detail as dt\r\n\t\t\t\t\t\tleft join inv_material_stok as b\r\n\t\t\t\t\t\ton b.id_barang=dt.ID_Barang and b.batch=dt.Batch\r\n\t\t\t\t\t\twhere Tanggal ='" . $thn . '-' . $bln . '-' . $ii . "' and ID_Jenis!='5'\r\n\t\t\t\t\t\tgroup by concat(dt.Tanggal)\r\n\t\t\t\t\t\torder by dt.Tanggal"; $val = rdb('mst_kas_trans', 'jumlah', "sum(jumlah) as jumlah", "where tgl_trans='" . $thn . '-' . $bln . '-' . $ii . "' group by tgl_trans order by tgl_trans"); $rcat1 = mysql_query($cat1) or die(mysql_error()); while ($rw1 = mysql_fetch_object($rcat1)) { $laba = $rw1->Jual - $rw1->Harga_Beli; } $val = $val == '' && $laba == '' ? '' : $laba - $val; fwrite($xml, "<set name='" . $ii . "' value='" . $val . "'/>\r\n"); } fwrite($xml, "</dataset>\r\n"); fwrite($xml, "</graph>\r\n"); }
function nbulan($bulan) { $this->bulan = nBulan(round($bulan)); }
function get_bukubesar_tahunan() { $data = array(); $n = 0; $saldo = 0; $toAkun = ''; $saldo_awal = 0; $t_kredit = 0; $t_debet = 0; $ip_temp = ''; $akun = $_POST['ID_P']; $ID_Simp = $_POST['ID_SubKlas']; $tahun = $_POST['Tahun']; $toAkun = $ID_Simp != '4' && $ID_Simp != '17' && $ID_Simp != '18' && $ID_Simp != '19' && $ID_Simp != '28' ? $akun : $this->akun_model->get_nomor_akun("where ID_Agt='{$akun}' and id_subklas='{$ID_Simp}'"); if (is_array($toAkun)) { foreach ($toAkun as $t) { $ip_temp = $t->ID; $id_Calc = $t->ID_Calc; } } else { $ip_temp = $toAkun; $id_Calc = $this->Admin_model->show_single_field('perkiraan', 'id_calc', "where ID='{$ip_temp}'"); } $datax = $ID_Simp != '4' && $ID_Simp != '18' && $ID_Simp != '19' && $ID_Simp != '28' ? $this->akun_model->get_saldo_awal($ip_temp) : $this->akun_model->get_saldo_simpanan($ip_temp, $tahun); foreach ($datax as $sa) { $saldo_awal = $sa->saldoawal; } echo "<tr class='xx list_genap'>\r\n\t\t\t <td class='kotak' align='center'>•••</td>\r\n\t\t\t <td class='kotak' colspan='3'>Saldo Awal</td>\r\n\t\t\t <td class='kotak' align='right'><b>" . number_format($saldo_awal, 2) . "</b></td>\r\n\t\t\t </tr>"; $saldo = $saldo_awal; $data = $this->akun_model->buku_besar_byTahun($ip_temp, $tahun); foreach ($data as $r) { $n++; $saldo = $id_Calc == 2 ? $saldo + $r->Kredit - $r->Debet : $saldo + $r->Debet - $r->Kredit; echo "<tr class='xx'>\r\n\t\t\t\t\t <td class='kotak' align='center'>{$n}</td>\r\n\t\t\t\t\t <td class='kotak'>" . nBulan($r->ID_Bulan) . "</td>\r\n\t\t\t\t\t <td class='kotak' align='right'>" . number_format($r->Debet, 2) . "</td>\t\r\n\t\t\t\t\t <td class='kotak' align='right'>" . number_format($r->Kredit, 2) . "</td>\t\r\n\t\t\t\t\t <td class='kotak' align='right'>" . number_format($saldo, 2) . "</td>\r\n\t\t\t\t\t </tr>"; $t_kredit = $t_kredit + $r->Kredit; $t_debet = $t_debet + $r->Debet; } $saldo_akhir = $id_Calc == 2 ? $saldo_awal + $t_kredit - $t_debet : $saldo_awal + $t_debet - $t_kredit; if ($n >= 1) { echo "<tr class='list_genap'>\r\n\t\t\t\t\t <td class='kotak'>•••</td>\r\n\t\t\t\t\t <td class='kotak' colspan='3'><b>Saldo Akhir</b>\r\n\t\t\t\t\t <td class='kotak' align='right'><b>" . number_format($saldo_akhir, 2) . "</b></td>\r\n\t\t\t\t\t </tr>"; } }