/** * Report Harian Rekap * @return array Nilai-nilai yang diperlukan untuk report harian */ public function reportHarianRekap() { $date = isset($this->tanggal) ? date_format(date_create_from_format('d-m-Y', $this->tanggal), 'Y-m-d') : NULL; $laporanHarian = LaporanHarian::model()->find('tanggal=:tanggal', array(':tanggal' => $date)); if (is_null($laporanHarian)) { /* Object, tidak untuk disimpan, hanya untuk mencari nilai per tanggal */ $laporanHarian = new LaporanHarian(); $laporanHarian->tanggal = date_format(date_create_from_format('d-m-Y', $this->tanggal), 'Y-m-d'); } else { /* fixme: ganti afterFind() */ $laporanHarian->tanggal = date_format(date_create_from_format('d-m-Y', $laporanHarian->tanggal), 'Y-m-d'); } return array('saldoAwal' => $laporanHarian->saldoAwal(), 'saldoAkhir' => $laporanHarian->saldoAkhir(), 'saldoAkhirAsli' => $laporanHarian->saldo_akhir, 'keterangan' => $laporanHarian->keterangan, 'totalPenjualanTunai' => $laporanHarian->totalPenjualanTunai(), 'totalPenjualanPiutang' => $laporanHarian->totalPenjualanPiutang(), 'totalPenjualanBayar' => $laporanHarian->totalPenjualanBayar(), 'totalMargin' => $laporanHarian->totalMarginPenjualanTunai(), 'totalPembelianTunai' => $laporanHarian->totalPembelianTunai(), 'totalPembelianHutang' => $laporanHarian->totalPembelianHutang(), 'totalPembelianBayar' => $laporanHarian->totalPembelianBayar(), 'itemPengeluaran' => $laporanHarian->itemPengeluaran(), 'itemPenerimaan' => $laporanHarian->itemPenerimaan(), 'totalReturBeliTunai' => $laporanHarian->totalReturBeliTunai(), 'totalReturBeliPiutang' => $laporanHarian->totalReturBeliPiutang(), 'totalReturBeliBayar' => $laporanHarian->totalReturBeliBayar(), 'totalReturJualTunai' => $laporanHarian->totalReturJualTunai(), 'totalReturJualHutang' => $laporanHarian->totalReturJualHutang(), 'totalReturJualBayar' => $laporanHarian->totalReturJualBayar()); }