예제 #1
0
 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);
 }
예제 #2
0
 public function actionPilihItem($id)
 {
     $item = ItemKeuangan::model()->findByPk($id);
     $return = array('id' => $id, 'namaParent' => $item->parent->nama, 'nama' => $item->nama);
     $this->renderJSON($return);
 }
예제 #3
0
 /**
  * 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;
 }
예제 #5
0
파일: _form.php 프로젝트: AbuMuhammad/ap3
        '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>
예제 #6
0
 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;
 }
예제 #7
0
 public function cariPosisi()
 {
     $itemKeu = ItemKeuangan::model()->findByPk($this->item_id);
     return $itemKeu->jenis == ItemKeuangan::ITEM_PENERIMAAN ? self::POSISI_DEBET : self::POSISI_KREDIT;
 }
예제 #8
0
 /**
  * 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;
 }