Esempio n. 1
0
?>

    <p>
        <?php 
/*= Html::a(Yii::t('app', 'Create {modelClass}', [
    'modelClass' => Yii::t('app','Transaction'),
]), ['//cap/transaction/create'], ['class' => 'btn btn-success'])*/
?>
    </p>
		
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Journal'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['columns' => [['content' => 'Transaction', 'options' => ['colspan' => 6, 'class' => 'text-center', 'style' => 'background-color: #fdfdfd']], ['content' => 'Account', 'options' => ['colspan' => 3, 'class' => 'text-center', 'style' => 'background-color: #fdfdfd']], ['content' => '<div class="row-fluid" style="width:260px"><div class="col-xs-6" style="padding:0 2px 0 2px;">Debet</div><div class="col-xs-6" style="padding:0 2px 0 2px;">Credit</div></div>', 'options' => ['colspan' => 1, 'class' => 'text-centers', 'style' => 'background-color: #fdfdfd;text-align:right;']]], 'options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'mergeColumns' => ['time', 'title', 'subject', 'tags', 'transactionRemarks'], 'type' => 'firstrow', 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'time', 'value' => 'transaction.time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'title', 'value' => 'transaction.title'], ['attribute' => 'subject', 'value' => 'transaction.subject'], ['attribute' => 'tags', 'value' => 'transaction.tags'], ['attribute' => 'transactionRemarks', 'value' => 'transaction.remarks'], ['attribute' => 'accountName', 'value' => function ($data) {
    return ($data->account->code < 0 ? "" : $data->account->code . " - ") . $data->account->name;
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => ArrayHelper::map($tra->accounts(), "name", "name"), 'options' => ['placeholder' => Yii::t('app', 'Select an account...')], 'pluginOptions' => ['allowClear' => true]]], 'remarks:ntext', ['attribute' => 'quantity', 'value' => function ($data) {
    $module = Yii::$app->getModule('cap');
    return number_format($data->qty, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('cap');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}], ['attribute' => 'amount', 'format' => 'html', 'value' => function ($data) use($module) {
    $html = '<div class="col-xs-6" style="padding:0 2px 0 2px;" >' . number_format($data->debet, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]) . '</div>';
    $html .= '<div class="col-xs-6" style="padding:0 2px 0 2px;" >' . number_format($data->credit, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]) . '</div>';
    return '<div class="row-fluid" style="width:260px">' . $html . '</div>';
}, 'headerOptions' => ['class' => 'kv-align-bottom', 'style' => 'text-align:center;'], 'hAlign' => 'right', 'vAlign' => 'top', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('cap');
Esempio n. 2
0
 public function actionDetail_form($increaseon, $usedaccounts = "")
 {
     $usedaccounts = $usedaccounts == "" ? [] : explode(",", $usedaccounts);
     $list = Transaction::accounts($increaseon, $usedaccounts);
     return $this->renderPartial('_form_details', ['increaseon' => $increaseon, 'list' => $list]);
 }