Exemple #1
0
 public static function createGL($hdr, $dtls = [])
 {
     $blc = 0.0;
     foreach ($dtls as $row) {
         $blc += $row['ammount'];
     }
     if ($blc != 0) {
         throw new UserException('GL Balance Failed');
     }
     $gl = new GlHeader();
     $gl->gl_date = $hdr['date'];
     $gl->id_reff = $hdr['id_reff'];
     $gl->type_reff = $hdr['type_reff'];
     $gl->description = $hdr['description'];
     $gl->id_branch = $hdr['id_branch'];
     /*
      * Edited By Mujib Masyhudi
      * on 2014-07-07
      */
     $active_periode = self::getCurrentIdAccPeriode();
     $gl->id_periode = $active_periode['id_periode'];
     $gl->status = 0;
     if (!$gl->save()) {
         throw new UserException(implode("\n", $gl->getFirstErrors()));
     }
     foreach ($dtls as $row) {
         $glDtl = new GlDetail();
         $glDtl->id_gl = $gl->id_gl;
         $glDtl->id_coa = $row['id_coa'];
         $glDtl->amount = $row['ammount'];
         if (!$glDtl->save()) {
             throw new UserException(implode("\n", $glDtl->getFirstErrors()));
         }
     }
 }
Exemple #2
0
        </div>
        <table class ="table table-striped" id="tbl-glheader">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Account</th>
                    <th>Debit</th>
                    <th>Credit</th>
                    <th><a class="fa fa-plus-square" href="#" data-action="append">
                            <span class="glyphicon glyphicon-plus"></span>
                        </a>
                    </th>
                </tr>
            </thead>
            <?php 
echo TabularInput::widget(['id' => 'tbl-gldetail', 'allModels' => $model->glDetails, 'itemView' => '_detail', 'modelClass' => GlDetail::className(), 'options' => ['tag' => 'tbody'], 'itemOptions' => ['tag' => 'tr'], 'clientOptions' => ['afterAddRow' => new yii\web\JsExpression('biz.config.glAfterAddRow')]]);
?>
        </table>

        <div class="panel-footer">
            <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
        </div>
    </div>
    <?php 
ActiveForm::end();
?>
</div>
<?php 
yii\jui\AutoCompleteAsset::register($this);
Exemple #3
0
    \$row.find('.nm_account').autocomplete({
        source: biz.master.coas,
        select: function (event, ui) {
            var \$row = \$(event.target).closest('tr');
            \$row.find('.id_account').val(ui.item.id);
            \$row.find('.cd_account').text(ui.item.cd_coa);
            \$row.find('.nm_account').val(ui.item.value);

            return false;
        }
    });
}
JS;
?>
            <?php 
echo TabularInput::widget(['id' => 'tbl-gldetail', 'allModels' => $model->glDetails, 'itemView' => '_detail', 'modelClass' => GlDetail::className(), 'options' => ['tag' => 'tbody'], 'itemOptions' => ['tag' => 'tr'], 'clientOptions' => ['afterAddRow' => new yii\web\JsExpression($jsFunc), 'btnAddSelector' => '#append-row']]);
?>
        </table>

        <div class="panel-footer">
            <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
        </div>
    </div>
    <?php 
ActiveForm::end();
?>
</div>
<?php 
yii\jui\AutoCompleteAsset::register($this);
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGlDetails()
 {
     return $this->hasMany(GlDetail::className(), ['id_gl' => 'id_gl']);
 }
Exemple #5
0
?>

    <?php 
echo $form->field($model, 'description')->textInput();
?>

    <table style="width: 98%">
        <thead>
            <tr>
                <th style="width: 40%">Akun</th>
                <th>Debit</th>
                <th>Kredit</th>
            </tr>
        </thead>
        <?php 
echo TabularInput::widget(['id' => 'gl-detail', 'allModels' => $model->glDetails, 'modelClass' => GlDetail::className(), 'itemView' => '_detail', 'options' => ['tag' => 'tbody'], 'itemOptions' => ['tag' => 'tr'], 'viewParams' => ['form' => $form]]);
?>
    </table>
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
<?php 
$url = \yii\helpers\Url::toRoute(['create']);