<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $model = new LbPvExpenses(); $m = $this->module->id; $canAdd = BasicPermission::model()->checkModules($m, 'add'); $canList = BasicPermission::model()->checkModules($m, 'list'); $id = 0; if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } //echo '<pre>'; //print_r(LbExpenses::model()->getExpensesByPk(4)); $this->widget('bootstrap.widgets.TbGridView', array('id' => 'payment_invoice_grid', 'type' => 'bordered', 'dataProvider' => $model->listPV($id), 'columns' => array(array('class' => 'CButtonColumn', 'template' => '{delete}', 'deleteButtonUrl' => 'CHtml::normalizeUrl(array("/lbExpenses/default/deletePVExpenses", "id"=>$data->lb_record_primary_key))', 'htmlOptions' => array('width' => '30'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Date'), 'name' => 'lb_customer_id', 'type' => 'raw', 'id' => '$data->lb_record_primary_key', 'value' => 'CHtml::textField("date_ex_{LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)[lb_expenses_date]}",LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_expenses_date"] ? date("d M, Y", strtotime(LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_expenses_date"])) : "",array( "style"=>"width: 110px;text-align: left; padding-right: 0px; border: none;box-shadow: none;background:#ffffff;", "disabled"=>"disabled", "id"=>"date_ex_{$data->lb_record_primary_key}", ))', 'htmlOptions' => array('width' => '120'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Expenses No'), 'type' => 'raw', 'value' => 'CHtml::textField("ex_no_{LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)[lb_expenses_no]}",LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_expenses_no"],array( "style"=>"width: 110px;text-align: left; padding-right: 0px; border: none;box-shadow: none;background:#ffffff;", "disabled"=>"disabled", "id"=>"ex_no_{$data->lb_record_primary_key}", ))', 'htmlOptions' => array('width' => '180'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Category'), 'type' => 'raw', 'value' => 'CHtml::textField("ex_category_{LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)[lb_expenses_no]}",(count(UserList::model()->getItem(LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_category_id"])))>0 ?(UserList::model()->getItem(LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_category_id"])->system_list_item_name): "",array( "style"=>"text-align: left; padding-right: 0px; border: none;box-shadow: none;background:#ffffff;", "disabled"=>"disabled",
public function getExByMonth($month = false, $year = false) { $modelEx = LbExpenses::model()->findAll('YEAR(lb_expenses_date) = ' . $year . ' AND MONTH(lb_expenses_date) =' . $month); $total = 0; foreach ($modelEx as $data) { if (LbPvExpenses::model()->getExpensesPVById($data->lb_record_primary_key) == false) { $total += $data->lb_expenses_amount; } } return $total; }
public function getTotalExpensesPrev($financial_year, $financial_prev_year) { $All_PV = LbPaymentVoucher::model()->getTotalPaymentPrev($financial_year, $financial_prev_year); foreach ($All_PV as $row) { $pvexpenses = LbPvExpenses::model()->findAll('lb_payment_voucher_id = ' . $row->lb_record_primary_key); $total = 0; foreach ($pvexpenses as $data) { $modelExpenses = LbExpenses::model()->find('lb_record_primary_key = ' . $data->lb_expenses_id); if ($modelExpenses) { $total += $modelExpenses->lb_expenses_amount; } } return $total; } }
function actiondeletePVExpenses($id) { return LbPvExpenses::model()->deleteByPk($id); }
' . (isset($modelAddress->lb_customer_address_country) ? $modelAddress->lb_customer_address_country . ' ' : '') . ' ' . (isset($modelAddress->lb_customer_address_postal_code) ? $modelAddress->lb_customer_address_postal_code : '') . '<br> ' . (isset($modelAddress->lb_customer_address_phone_1) ? "Phone: " . $modelAddress->lb_customer_address_phone_1 . " " : '') . ' ' . (isset($modelAddress->lb_customer_address_fax) ? "Fax: " . $modelAddress->lb_customer_address_fax : '') . '<br> ' . (isset($modelAddress->lb_customer_address_email) ? "Email: " . $modelAddress->lb_customer_address_email : '') . ' </td> </tr>'; $tblPV .= '</table>'; echo $tblPV . '<br /><br />'; //item expenses $i = 0; $strnum = new LbInvoiceTotal(); $thousand = LbGenera::model()->getGeneraSubscription()->lb_thousand_separator; $decimal = LbGenera::model()->getGeneraSubscription()->lb_decimal_symbol; $item_quotation_arr = LbPvExpenses::model()->findAll('lb_payment_voucher_id = ' . $model->lb_record_primary_key); if (count($item_quotation_arr) > 0) { $tblEx = '<table border="1" style="margin:auto;width:100%;" cellpadding="0" cellspacing="0">'; $tblEx .= '<tr> <td height="35" align="center" width="50">#</td> <td width="100"><b>Expenses Date</b></td> <td width="200"><b>Expenses No</b></td> <td width="100"><b>Expenses category</b></td> <td width="100"><b>Expenses note</b></td> <td width="100"><b>Total</b></td> </tr>'; $subtotalEx = 0; foreach ($item_quotation_arr as $item_quotation_row) { $i++;