public function actionPilihItemKeu($id) { $itemKeuangan = ItemKeuangan::model()->findByPk($id); $return = array('id' => $id, 'parent' => isset($itemKeuangan->parent) ? $itemKeuangan->parent->nama : '-', 'nama' => $itemKeuangan->nama); $this->renderJSON($return); }
public function actionPilihItem($id) { $item = ItemKeuangan::model()->findByPk($id); $return = array('id' => $id, 'namaParent' => $item->parent->nama, 'nama' => $item->nama); $this->renderJSON($return); }
/** * Mendapatkan item keuangan (kode akun) dari dokumen hutang piutang * @return array id, nama, & nama parent dari Item Keuangan (kode akun) */ public function getItemBayarHutang() { $itemId = $this->itemKeuanganId($this->asal); $item = ItemKeuangan::model()->findByPk($itemId); return array('itemId' => $itemId, 'itemNama' => $item->nama, 'itemParent' => $item->parent->nama); }
public function getNamaItemKeu() { $itemKeu = ItemKeuangan::model()->findByPk($this->itemKeuId); $namaParent = isset($itemKeu->parent) ? '(' . $itemKeu->parent->nama . ')' : '(-)'; return $namaParent . ' ' . $itemKeu->nama; }
'id' => 'item-keuangan-form', // Please note: When you enable ajax validation, make sure the corresponding // controller action is handling ajax validation correctly. // There is a call to performAjaxValidation() commented in generated controller code. // See class documentation of CActiveForm for details on this. 'enableAjaxValidation' => false, )); ?> <?php echo $form->errorSummary($model, 'Error: Perbaiki input', null, array('class' => 'panel callout')); ?> <div class="row"> <div class="small-12 columns"> <?php echo $form->labelEx($model, 'parent_id'); ?> <?php echo $form->dropDownList($model, 'parent_id', CHtml::listData(ItemKeuangan::model()->findAll('jenis=' . ItemKeuangan::ITEM_PENGELUARAN . ' and parent_id is null'), 'id', 'nama'), array( 'empty' => 'Pilih satu..' )); ?> <?php echo $form->error($model, 'parent_id', array('class' => 'error')); ?> </div> </div> <div class="row"> <div class="small-12 columns"> <?php echo $form->labelEx($model, 'nama'); ?> <?php echo $form->textField($model, 'nama', array('size' => 45, 'maxlength' => 45)); ?> <?php echo $form->error($model, 'nama', array('class' => 'error')); ?> </div> </div>
public function itemPenerimaan() { $parents = ItemKeuangan::model()->findAll('parent_id is null'); $itemArr = array(); $command = Yii::app()->db->createCommand("\n select profil.nama, item.nama akun, pd.keterangan, pd.jumlah\n from penerimaan_detail pd\n join penerimaan p on pd.penerimaan_id=p.id and p.status=:statusPenerimaan and date_format(p.tanggal,'%Y-%m-%d')=:tanggal\n join item_keuangan item on pd.item_id=item.id and item.id > :itemTrx and parent_id = :parentId\n join profil on p.profil_id=profil.id\n where pd.posisi=:posisiPenerimaan\n union\n select profil.nama, item.nama, pd.keterangan, pd.jumlah\n from pengeluaran_detail pd\n join pengeluaran p on pd.pengeluaran_id=p.id and p.status=:statusPengeluaran and date_format(p.tanggal,'%Y-%m-%d')=:tanggal\n join item_keuangan item on pd.item_id=item.id and item.id > :itemTrx and parent_id = :parentId\n join profil on p.profil_id=profil.id\n where pd.posisi=:posisiPengeluaran"); $commandTotal = Yii::app()->db->createCommand("\n select sum(jumlah) total\n from\n (\n select sum(pd.jumlah) jumlah\n from penerimaan_detail pd\n join penerimaan p on pd.penerimaan_id=p.id and p.status=:statusPenerimaan and date_format(p.tanggal,'%Y-%m-%d')=:tanggal\n join item_keuangan item on pd.item_id=item.id and item.id > :itemTrx and parent_id = :parentId\n join profil on p.profil_id=profil.id\n where pd.posisi=:posisiPenerimaan\n union\n select sum(pd.jumlah) jumlah\n from pengeluaran_detail pd\n join pengeluaran p on pd.pengeluaran_id=p.id and p.status=:statusPengeluaran and date_format(p.tanggal,'%Y-%m-%d')=:tanggal\n join item_keuangan item on pd.item_id=item.id and item.id > :itemTrx and parent_id = :parentId\n join profil on p.profil_id=profil.id\n where pd.posisi=:posisiPengeluaran\n ) t"); foreach ($parents as $parent) { $command->bindValues(array(':tanggal' => $this->tanggal, ':itemTrx' => ItemKeuangan::ITEM_TRX_SAJA, ':parentId' => $parent->id, ':statusPengeluaran' => Pengeluaran::STATUS_BAYAR, ':statusPenerimaan' => Penerimaan::STATUS_BAYAR, ':posisiPengeluaran' => PengeluaranDetail::POSISI_KREDIT, ':posisiPenerimaan' => PenerimaanDetail::POSISI_DEBET)); $commandTotal->bindValues(array(':tanggal' => $this->tanggal, ':itemTrx' => ItemKeuangan::ITEM_TRX_SAJA, ':parentId' => $parent->id, ':statusPengeluaran' => Pengeluaran::STATUS_BAYAR, ':statusPenerimaan' => Penerimaan::STATUS_BAYAR, ':posisiPengeluaran' => PengeluaranDetail::POSISI_KREDIT, ':posisiPenerimaan' => PenerimaanDetail::POSISI_DEBET)); $jumlah = $commandTotal->queryRow(); $itemArr[] = array('id' => $parent->id, 'nama' => $parent->nama, 'total' => $jumlah['total'], 'items' => $command->queryAll()); } return $itemArr; }
public function cariPosisi() { $itemKeu = ItemKeuangan::model()->findByPk($this->item_id); return $itemKeu->jenis == ItemKeuangan::ITEM_PENERIMAAN ? self::POSISI_DEBET : self::POSISI_KREDIT; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return ItemKeuangan the loaded model * @throws CHttpException */ public function loadModel($id) { $model = ItemKeuangan::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }