예제 #1
0
        case MasterValueUtils::MV_FIN_ENTRY_TYPE_SIMPLE:
            $urlEdit = BaseUrl::toRoute(['payment/update', 'id' => $entryId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
            $urlView = BaseUrl::toRoute(['payment/view', 'id' => $entryId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
            $urlCopy = BaseUrl::toRoute(['payment/copy', 'id' => $entryId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlCopy, $lblCopy]);
            break;
        case MasterValueUtils::MV_FIN_ENTRY_TYPE_DEPOSIT:
        case MasterValueUtils::MV_FIN_ENTRY_TYPE_INTEREST_DEPOSIT:
            $urlEdit = BaseUrl::toRoute(['deposit/update', 'id' => $timeDepositTranId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
            $urlView = BaseUrl::toRoute(['deposit/view', 'id' => $timeDepositTranId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
            $urlCopy = BaseUrl::toRoute(['deposit/copy', 'id' => $timeDepositTranId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlCopy, $lblCopy]);
            break;
        default:
            break;
    }
    $html = '<div class="btn-group">';
    $html .= Html::a($lblEdit, [$urlEdit], ['class' => 'btn btn-' . $btnClass]);
    $html .= '<button type="button" class="btn btn-' . $btnClass . ' dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}]]]);
Pjax::end();
예제 #2
0
echo GridView::widget(['layout' => '{summary}<div class="table-responsive">{items}</div>{pager}', 'options' => ['class' => 'grid-view col-xs-12'], 'tableOptions' => ['class' => 'table table-bordered'], 'pager' => ['options' => ['class' => 'pagination pagination-bottom'], 'maxButtonCount' => 6], 'dataProvider' => new ActiveDataProvider(['query' => $dataQuery, 'pagination' => ['pagesize' => 20]]), 'columns' => [['label' => Yii::t('fin.grid', 'Ref'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    $pagination = $column->grid->dataProvider->pagination;
    $html = $pagination->page * $pagination->pageSize + $index + 1;
    $html .= '<br/>' . str_pad($model->nav_id, 6, '0', STR_PAD_LEFT);
    return $html;
}], ['label' => Yii::t('fin.grid', 'Trade'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model) {
    $html = DateTimeUtils::htmlDateFormatFromDB($model->trade_date, DateTimeUtils::FM_VIEW_DATE, true);
    $lblView = Yii::t('button', 'View');
    $lblEdit = Yii::t('button', 'Edit');
    $urlEdit = null;
    $arrBtns = [];
    $entryId = $model->nav_id;
    $urlEdit = BaseUrl::toRoute(['nav/update', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
    $urlView = BaseUrl::toRoute(['nav/view', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
    $html .= '<br/><div class="btn-group">';
    $html .= Html::a($lblEdit, [$urlEdit], ['class' => 'btn btn-xs btn-info']);
    $html .= '<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}], ['label' => Yii::t('fin.grid', 'Nav / Prev'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: left;'], 'format' => 'raw', 'value' => function ($model) {
    $htmls = [];
    $navPrev = NumberUtils::format($model->nav_value_prev, 2);
    $htmls[] = '<span class="label label-info pull-right">' . $navPrev . '</span>';
    $nav = NumberUtils::format($model->nav_value, 2);
    $htmls[] = '<span class="label label-info pull-right">' . $nav . '</span>';
예제 #3
0
</th>
						<td class="info"><?php 
    echo NumberUtils::format($model->entry_updated);
    ?>
</td>
					</tr>
				<?php 
}
?>
				<tr>
					<th class="warning"><?php 
echo $model->getAttributeLabel('description');
?>
</th>
					<td class="info"><?php 
echo StringUtils::showArrValueAsString($model->arr_entry_log, $arrEntryLog);
?>
</td>
				</tr>
			</table>
			<div style="display: none">
				<?php 
echo $form->field($model, 'entry_date')->hiddenInput();
?>
				<?php 
echo $form->field($model, 'account_source')->hiddenInput();
?>
				<?php 
echo $form->field($model, 'account_target')->hiddenInput();
?>
				<?php 
예제 #4
0
    return $html;
}], ['label' => Yii::t('fin.grid', 'Status'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model) use($arrCustomerStatus) {
    $status = isset($arrCustomerStatus[$model->status]) ? $arrCustomerStatus[$model->status] : '';
    $html = '<span>' . $status . '</span>';
    $lblView = Yii::t('button', 'View');
    $lblEdit = Yii::t('button', 'Edit');
    $arrBtns = [];
    $entryId = $model->id;
    $urlEdit = BaseUrl::toRoute(['customer/update', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
    $urlView = BaseUrl::toRoute(['customer/view', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
    $html .= '<br/><div class="btn-group">';
    $html .= Html::a($lblEdit, [$urlEdit], ['class' => 'btn btn-xs btn-info']);
    $html .= '<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}], ['label' => Yii::t('fin.grid', 'Balance'), 'headerOptions' => ['style' => 'text-align: center'], 'footerOptions' => ['style' => 'vertical-align: middle; text-align: right'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: right'], 'format' => 'raw', 'value' => function ($model) {
    $labelClass = $model->balance < 0 ? 'label-danger' : 'label-info';
    $labelValue = NumberUtils::format(abs($model->balance));
    return StringUtils::format('{2}<br/><span class="label {0} pull-right">{1}</span>', [$labelClass, $labelValue, $model->name]);
}, 'footer' => NumberUtils::getIncDecNumber($sumCustomerValue['balance'], ['template' => '<span class="label pull-right {color}">{number}</span>', 'incColor' => 'label-info', 'decColor' => 'label-danger'])]]]);
Pjax::end();
?>
</div>
    </div>
</div></div></div>
예제 #5
0
 /**
  * @inheritdoc
  */
 public function afterValidate()
 {
     $arrOldErrors = $this->getErrors('saving_account');
     if (count($arrOldErrors) > 0) {
         $this->clearErrors('saving_account');
         foreach ($arrOldErrors as $oldError) {
             $newError = null;
             if (empty($this->saving_account)) {
                 $newError = $oldError;
             } else {
                 $newError = StringUtils::format($oldError, [$this->saving_account => self::$_ARR_SAVING_ACOUNT[$this->saving_account]]);
             }
             $this->addError('saving_account', $newError);
         }
     }
 }
예제 #6
0
 } else {
     $style = '';
     $rowindex++;
 }
 $lblDetele = Yii::t('button', 'Delete');
 $lblEdit = Yii::t('button', 'Edit');
 $dataset = ['item_no' => $item->item_no, 'item_name' => $item->item_name, 'price' => $item->price, 'pay_date' => $item->pay_date, 'description' => $item->description, 'delete_flag' => $item->delete_flag, 'mode' => 'edit'];
 $datasetUpdateStr = json_encode($dataset, JSON_NUMERIC_CHECK);
 $dataset['msgDeleteConfirm'] = Yii::t('message', 'Do you want to delete this item ?');
 $dataset['mode'] = 'delete';
 $datasetDeleteStr = json_encode($dataset, JSON_NUMERIC_CHECK);
 $arrBtns = [];
 $arrBtns[] = StringUtils::format("<li><a href='javascript:void(0)' onclick='editBillItem(this);' data-maps='{0}'>{1}</a></li>", [$datasetUpdateStr, $lblEdit]);
 $arrBtns[] = StringUtils::format("<li><a href='javascript:void(0)' onclick='editBillItem(this);' data-maps='{0}'>{1}</a></li>", [$datasetDeleteStr, $lblDetele]);
 $htmlAction = '<div class="btn-group">';
 $htmlAction .= StringUtils::format("<a href='javascript:void(0)' onclick='editBillItem(this);' data-maps='{0}' class='btn btn-{1}'>{2}</a>", [$datasetUpdateStr, $btnClass, $lblEdit]);
 $htmlAction .= '<button type="button" class="btn btn-' . $btnClass . ' dropdown-toggle" data-toggle="dropdown">';
 $htmlAction .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
 $htmlAction .= '</button>';
 $htmlAction .= '<ul class="dropdown-menu" role="menu">';
 $htmlAction .= implode('', $arrBtns);
 $htmlAction .= '</ul></div>';
 // show error columns
 $colItemNameStyle = '';
 $colPriceStyle = '';
 $colPayDateStyle = '';
 $colDescriptionStyle = '';
 $htmlItemName = $item->item_name;
 $htmlPrice = is_numeric($item->price) ? NumberUtils::format($item->price) : $item->price;
 $htmlPayDate = empty($item->pay_date) ? '' : DateTimeUtils::htmlDateFormat($item->pay_date, DateTimeUtils::FM_VIEW_DATE_WD, $fmShortDatePhp, true);
 $htmlDescription = $item->description;
예제 #7
0
    $html .= '<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}, 'footer' => $htmlFooterDate], ['label' => Yii::t('fin.grid', 'Credit / Debit'), 'headerOptions' => ['style' => 'text-align: center'], 'footerOptions' => ['style' => 'text-align: right'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: left; min-width:162px'], 'format' => 'raw', 'value' => function ($model) use($arrFinAccount) {
    $htmls = [];
    $htmlCredit = isset($arrFinAccount[$model->account_target]) ? $arrFinAccount[$model->account_target] : '';
    if (!empty($htmlCredit)) {
        $amount = $model->account_target == 0 ? '' : NumberUtils::format($model->entry_value);
        $htmlCredit .= '<span class="label label-info pull-right">' . $amount . '</span>';
        $htmls[] = $htmlCredit;
    }
    $htmlDebit = isset($arrFinAccount[$model->account_source]) ? $arrFinAccount[$model->account_source] : '';
    if (!empty($htmlDebit)) {
        $amount = $model->account_source == 0 ? '' : NumberUtils::format($model->entry_value);
        $htmlDebit .= '<span class="label label-danger pull-right">' . $amount . '</span>';
        $htmls[] = $htmlDebit;
    }
    return implode('<br/>', $htmls);
}, 'footer' => $htmlFooterCreditDebit], ['attribute' => 'description', 'label' => Yii::t('fin.grid', 'Description'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: left'], 'enableSorting' => false, 'value' => function ($model) use($arrEntryLog) {
    $arrEntryLogVal = StringUtils::unserializeArr($model->description);
    return StringUtils::showArrValueAsString($arrEntryLogVal, $arrEntryLog);
}]]]);
Pjax::end();
?>
</div>
	</div>
</div></div></div>
예제 #8
0
 /**
  * get Basic of Bill
  * @param $billId
  * @param $postData
  * @param $fmShortDatePhp
  * @return NetBill|false
  */
 private function loadBill($billId, $postData, $fmShortDatePhp)
 {
     $result = null;
     if (is_null($billId)) {
         $result = new NetBill();
         $result->total = 0;
         $result->member_num = 0;
     } else {
         $result = NetBill::findOne(['id' => $billId, 'delete_flag' => MasterValueUtils::MV_FIN_FLG_DELETE_FALSE]);
         if (is_null($result)) {
             return false;
         }
         $result->bill_date = DateTimeUtils::parse($result->bill_date, DateTimeUtils::FM_DB_DATE, $fmShortDatePhp);
         $result->arr_member_list = StringUtils::unserializeArr($result->member_list);
         $result->arr_member_list_old = StringUtils::unserializeArr($result->member_list);
     }
     $result->total_old = $result->total;
     $result->member_num_old = $result->member_num;
     $result->load($postData);
     return $result;
 }
예제 #9
0
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
    $html .= '<br/><div class="btn-group">';
    $html .= Html::a($lblEdit, [$urlEdit], ['class' => 'btn btn-xs btn-info']);
    $html .= '<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}, 'footer' => $htmlFooterCredit], ['label' => Yii::t('fin.grid', 'Credit / Debit'), 'headerOptions' => ['style' => 'text-align: center'], 'footerOptions' => ['style' => 'text-align: right'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: left'], 'format' => 'raw', 'value' => function ($model) {
    $htmls = [];
    if ($model->credit > 0) {
        $htmls[] = '<span class="label label-info pull-right">' . NumberUtils::format($model->credit) . '</span>';
    }
    if ($model->debit > 0) {
        $htmls[] = '<span class="label label-danger pull-right">' . NumberUtils::format($model->debit) . '</span>';
    }
    return implode('<br/>', $htmls);
}, 'footer' => $htmlFooterDebit], ['label' => Yii::t('fin.grid', 'Bill Date'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model) {
    if ($model->order_id > 0 && !is_null($model->bill_date)) {
        $urlEdit = BaseUrl::toRoute(['bill/update', 'id' => $model->order_id]);
        return StringUtils::format('<a href="{0}">{1}</a>', [$urlEdit, DateTimeUtils::htmlDateFormatFromDB($model->bill_date, DateTimeUtils::FM_VIEW_DATE, true)]);
    }
    return '';
}]]]);
Pjax::end();
?>
</div></div>
</div></div></div>
예제 #10
0
 /**
  * format html for date
  * @param string $datetime: value from database (EX: Y-m-d)
  * @param string $format: new format
  * @param mixed $htmlOpts [tag=>'span', class=>'abc']
  * @return string
  */
 public static function htmlDateTimeFormatFromDB($datetime, $format, $htmlOpts = false)
 {
     $date = \DateTime::createFromFormat(self::FM_DB_DATETIME, $datetime);
     $datestr = $date->format($format);
     if ($htmlOpts === false) {
         return $datestr;
     }
     $dt = getdate($date->getTimestamp());
     $daysweek = $dt[self::FN_KEY_GETDATE_DAYSOFWEEK_INT];
     $dateFormatInstall = self::getDateFormatInstall();
     $textcolor = $dateFormatInstall['weekday'][$daysweek]['text-color'];
     $tag = isset($htmlOpts['tag']) ? $htmlOpts['tag'] : 'span';
     $fulltag = '<' . $tag . ' class="{0}">{1}';
     $fulltag .= '</' . $tag . '>';
     $css = (isset($htmlOpts['class']) ? $htmlOpts['class'] : '') . ' ' . $textcolor;
     return StringUtils::format($fulltag, [$css, $datestr]);
 }
예제 #11
0
파일: tool.php 프로젝트: kaihatsusha/kpimon
                <?php 
    $rowindex = 0;
    ?>
                <tbody><?php 
    foreach ($arrFundCertificate4Sell as $fundCertificate4Sell) {
        ?>
                    <?php 
        $class = MasterValueUtils::getColorRow($rowindex);
        $purchaseId = str_pad($fundCertificate4Sell->purchase_id, 6, '0', STR_PAD_LEFT);
        $purchaseDate = $fundCertificate4Sell->purchase_date->format(DateTimeUtils::FM_VIEW_DATE);
        $purchaseType = StringUtils::format('{0}{1}{2}</br>{3}', [$arrPurchaseType[$fundCertificate4Sell->purchase_type], is_null($fundCertificate4Sell->sip_date) ? '' : ' ' . $fundCertificate4Sell->sip_date->format(DateTimeUtils::FM_VIEW_DATE), is_null($fundCertificate4Sell->sip_months) ? '' : ' (' . NumberUtils::format($fundCertificate4Sell->sip_months, 1) . ' Months)', NumberUtils::format($fundCertificate4Sell->investment, 2)]);
        $sellableCertificate = NumberUtils::format($fundCertificate4Sell->sellable_certificate, 2);
        $sellCertificate = NumberUtils::format($fundCertificate4Sell->sell_certificate, 2);
        $revenue = NumberUtils::format($fundCertificate4Sell->revenue, 2);
        $keptMonths = NumberUtils::format($fundCertificate4Sell->kept_months, 1);
        $sellFee = StringUtils::format('{0}%<br/>{1}', [NumberUtils::format($fundCertificate4Sell->sell_fee_rate, 2), NumberUtils::format($fundCertificate4Sell->sell_fee, 2)]);
        $profitBeforeTaxes = NumberUtils::format($fundCertificate4Sell->profit_before_taxes, 2);
        $profitAfterTaxes = NumberUtils::format($fundCertificate4Sell->profit_after_taxes, 2);
        $incomeTax = NumberUtils::format($fundCertificate4Sell->income_tax, 2);
        $investmentResult = NumberUtils::format($fundCertificate4Sell->investment_result, 2);
        $rowindex++;
        ?>
                    <tr class="<?php 
        echo $class;
        ?>
">
                        <td style="vertical-align: middle; text-align: center"><?php 
        echo $rowindex;
        ?>
</td>
                        <td style="vertical-align: middle; text-align: center"><?php 
예제 #12
0
                <th class="warning"><?php 
echo $model->getAttributeLabel('total');
?>
</th>
                <td class="info"><?php 
echo NumberUtils::format($model->total);
?>
</td>
            </tr>
            <tr>
                <th class="warning"><?php 
echo $model->getAttributeLabel('arr_member_list');
?>
</th>
                <td class="info"><?php 
echo StringUtils::showArrValueAsString($model->arr_member_list, $arrNetCustomer);
?>
</td>
            </tr>
            <tr>
                <th class="warning"><?php 
echo Yii::t('common', 'Number Of Member');
?>
</th>
                <td class="info"><?php 
echo $memberCount;
?>
</td>
            </tr>
            <tr>
                <th class="warning"><?php 
예제 #13
0
 public function actionCopy($id)
 {
     $this->objectId = $id;
     $model = FinAccountEntry::findOne(['entry_id' => $id, 'entry_status' => MasterValueUtils::MV_FIN_ENTRY_TYPE_SIMPLE, 'delete_flag' => MasterValueUtils::MV_FIN_FLG_DELETE_FALSE]);
     $renderView = 'copy';
     if (is_null($model)) {
         $model = false;
         $renderData = ['model' => $model];
         Yii::$app->session->setFlash(MasterValueUtils::FLASH_ERROR, Yii::t('common', 'The requested {record} does not exist.', ['record' => Yii::t('fin.models', 'Payment')]));
     } else {
         // master value
         $phpFmShortDate = DateTimeUtils::getPhpDateFormat();
         $arrFinAccount = ModelUtils::getArrData(FinAccount::find()->select(['account_id', 'account_name'])->where(['delete_flag' => 0, 'account_type' => [1, 2, 3, 5, 6, 7]])->orderBy('account_type, order_num'), 'account_id', 'account_name');
         $arrEntryLog = MasterValueUtils::getArrData('fin_entry_log');
         // reset value
         $model->entry_date = DateTimeUtils::formatNow($phpFmShortDate);
         // submit data
         $postData = Yii::$app->request->post();
         $submitMode = isset($postData[MasterValueUtils::SM_MODE_NAME]) ? $postData[MasterValueUtils::SM_MODE_NAME] : false;
         // populate model attributes with user inputs
         $model->load($postData);
         if (is_null($model->arr_entry_log)) {
             $model->arr_entry_log = StringUtils::unserializeArr($model->description);
         }
         // init value
         FinAccountEntry::$_PHP_FM_SHORTDATE = $phpFmShortDate;
         $model->scenario = MasterValueUtils::SCENARIO_COPY;
         $renderData = ['model' => $model, 'phpFmShortDate' => $phpFmShortDate, 'arrFinAccount' => $arrFinAccount, 'arrEntryLog' => $arrEntryLog];
         switch ($submitMode) {
             case MasterValueUtils::SM_MODE_INPUT:
                 $isValid = $model->validate();
                 if ($isValid) {
                     $renderView = 'confirm';
                     $renderData['formMode'] = [MasterValueUtils::PG_MODE_NAME => MasterValueUtils::PG_MODE_COPY];
                 }
                 break;
             case MasterValueUtils::SM_MODE_CONFIRM:
                 $isValid = $model->validate();
                 if ($isValid) {
                     $result = $this->copyPayment($model);
                     if ($result === true) {
                         Yii::$app->session->setFlash(MasterValueUtils::FLASH_SUCCESS, Yii::t('common', '{record} has been saved successfully.', ['record' => Yii::t('fin.models', 'Payment')]));
                         return Yii::$app->getResponse()->redirect(Url::to(['index']));
                     } else {
                         Yii::$app->session->setFlash(MasterValueUtils::FLASH_ERROR, $result);
                         $renderView = 'confirm';
                         $renderData['formMode'] = [MasterValueUtils::PG_MODE_NAME => MasterValueUtils::PG_MODE_COPY];
                     }
                 }
                 break;
             case MasterValueUtils::SM_MODE_BACK:
                 break;
             default:
                 break;
         }
     }
     // render GUI
     return $this->render($renderView, $renderData);
 }