public function actionGetFeesCategory($id)
 {
     $rows = \app\modules\fees\models\FeesCollectCategory::find()->where(['is_status' => 0, 'fees_collect_batch_id' => $id])->all();
     echo Html::tag('option', Html::encode(Yii::t('fees', 'Select Fees Collect Category')), ['value' => '']);
     foreach ($rows as $row) {
         echo Html::tag('option', Html::encode($row->fees_collect_name), ['value' => $row->fees_collect_category_id]);
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     //$query = FeesCollectCategory::find()->where(['fees_collect_category.is_status' => 0 ]);
     $query = FeesCollectCategory::find();
     //$query->joinWith(['feesCollectBatch']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['fees_collect_category_id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['fees_collect_category_id' => $this->fees_collect_category_id, 'fees_collect_start_date' => $this->dbDateSearch($this->fees_collect_start_date), 'fees_collect_end_date' => $this->dbDateSearch($this->fees_collect_end_date), 'fees_collect_due_date' => $this->dbDateSearch($this->fees_collect_due_date), 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'fees_collect_name', $this->fees_collect_name])->andFilterWhere(['like', 'fees_collect_details', $this->fees_collect_details])->andFilterWhere(['like', 'fees_collect_batch_id', $this->fees_collect_batch_id]);
     unset($_SESSION['exportData']);
     $_SESSION['exportData'] = $dataProvider;
     return $dataProvider;
 }
 public function actionIndex()
 {
     $paidData = $unPaidData = $fcCategory = [];
     if (Yii::$app->session->get('stu_id')) {
         return $this->redirect(['/fees/fees-payment-transaction/stu-fees-data']);
     }
     //Course Wise Collection Count
     $cateWisePaid = 0;
     $courseWiseCollect = (new \yii\db\Query())->select(["(cs.course_name) AS '0'", 'SUM(fpt.fees_pay_tran_amount) AS "1"'])->from('fees_payment_transaction fpt')->join('JOIN', 'courses cs', 'cs.course_id = fpt.fees_pay_tran_course_id')->where(['cs.is_status' => 0, 'fpt.is_status' => 0])->groupBy('fpt.fees_pay_tran_course_id')->all();
     $actFcc = \app\modules\fees\models\FeesCollectCategory::find()->where(['is_status' => 0])->asArray()->all();
     foreach ($actFcc as $v) {
         $stuCount = \app\modules\student\models\StuMaster::find()->where(['is_status' => 0, 'stu_master_batch_id' => $v['fees_collect_batch_id']])->count();
         $fccTotal = \app\modules\fees\models\FeesCategoryDetails::getFeeCategoryTotal($v['fees_collect_category_id']);
         $cateWisePaid += $stuCount * $fccTotal;
     }
     $paidTotal = (new \yii\db\Query())->from('fees_payment_transaction fpt')->join('JOIN', 'fees_collect_category fcc', 'fpt.fees_pay_tran_collect_id = fees_collect_category_id')->where(['fcc.is_status' => 0, 'fpt.is_status' => 0])->sum('fpt.fees_pay_tran_amount');
     $paidPer = ' (' . ($cateWisePaid != 0 ? round($paidTotal * 100 / $cateWisePaid, 2) : 0) . '%)';
     $unPaidPer = ' (' . ($cateWisePaid != 0 ? round(($cateWisePaid - $paidTotal) * 100 / $cateWisePaid, 2) : 0) . '%)';
     $paidUnpaidData = [['name' => 'Paid' . $paidPer, 'y' => $paidTotal, 'color' => '#77C730'], ['name' => 'Unpaid' . $unPaidPer, 'y' => $cateWisePaid - $paidTotal, 'color' => '#F45B5B']];
     //Individual Fees Collection Category Wise
     $fcWiseDetails = (new \yii\db\Query())->select(['fees_collect_category_id', 'fees_collect_batch_id', "CONCAT(fcc.fees_collect_name,'(',bt.batch_name,')') AS fc_name"])->from('fees_collect_category fcc')->join('JOIN', 'batches bt', 'bt.batch_id = fcc.fees_collect_batch_id')->where(['fcc.is_status' => '0'])->orderBy('fcc.fees_collect_category_id DESC')->limit('10')->all();
     $fccTotal = $fccPaid = 0;
     foreach ($fcWiseDetails as $k => $v) {
         $stuCount = \app\modules\student\models\StuMaster::find()->where(['is_status' => 0, 'stu_master_batch_id' => $v['fees_collect_batch_id']])->count();
         $fccTotalTmp = \app\modules\fees\models\FeesCategoryDetails::getFeeCategoryTotal($v['fees_collect_category_id']);
         $fccPaidTmp = (new \yii\db\Query())->from('fees_payment_transaction fpt')->where(['fpt.is_status' => 0, 'fpt.fees_pay_tran_collect_id' => $v['fees_collect_category_id']])->sum('fpt.fees_pay_tran_amount');
         $fccTotal = $stuCount * $fccTotalTmp;
         $fccPaid = $fccPaidTmp === NULL ? 0 : $fccPaidTmp;
         $fccUnPaid = $fccTotal - $fccPaid;
         $fcCategory[] = $v['fc_name'];
         $paidData[] = $fccPaid;
         $unPaidData[] = $fccUnPaid;
     }
     $fccWisePaidUnPaid = [['name' => 'Paid Amount', 'data' => $paidData, 'color' => '#77C730'], ['name' => 'Unpaid Amount', 'data' => $unPaidData, 'color' => '#F45B5B']];
     //Recently fees transaction
     $feeRecent = (new \yii\db\Query())->select(['fpt.fees_pay_tran_id', 'fpt.fees_pay_tran_amount', 'stu_unique_id', "CONCAT(si.stu_first_name, ' ', si.stu_last_name) AS 'stu_name'", 'fcc.fees_collect_name', 'DATE_FORMAT(fpt.fees_pay_tran_date, "%d-%m-%Y") AS tranDate'])->from('fees_payment_transaction fpt')->join('JOIN', 'fees_collect_category fcc', 'fcc.fees_collect_category_id = fpt.fees_pay_tran_collect_id')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = fpt.fees_pay_tran_stu_id')->where(['fpt.is_status' => '0'])->orderBy('fees_pay_tran_id DESC')->limit(10)->all();
     return $this->render('index', ['feeRecent' => $feeRecent, 'courseWiseCollect' => $courseWiseCollect, 'paidUnpaidData' => $paidUnpaidData, 'fccWisePaidUnPaid' => $fccWisePaidUnPaid, 'fcCategory' => $fcCategory]);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFeesDetailsCategory()
 {
     return $this->hasOne(FeesCollectCategory::className(), ['fees_collect_category_id' => 'fees_details_category_id']);
 }
Exemple #5
0
<?php

use yii\helpers\Html;
use app\modules\fees\models\FeesCollectCategory;
/* @var $this yii\web\View */
/* @var $model app\modules\fees\models\FeesCategoryDetails */
$this->title = 'Add Fees Category Detail';
$this->params['breadcrumbs'][] = ['label' => 'Fees', 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => 'Manage Fees Categories', 'url' => ['fees-collect-category/index']];
$this->params['breadcrumbs'][] = ['label' => FeesCollectCategory::findOne($_REQUEST['fcc_id'])->fees_collect_name, 'url' => ['fees-collect-category/view', 'id' => $_REQUEST['fcc_id']]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="col-xs-12">
  <div class="col-lg-4 col-sm-8 col-xs-12 no-padding"><h3 class="box-title"><i class="fa fa-plus"></i> Add Fees Category Detail</h3></div>
</div>

<div class="fees-category-details-create">
    <?php 
echo $this->render('_form', ['model' => $model]);
?>
</div>
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFeesPayTranCollect()
 {
     return $this->hasOne(FeesCollectCategory::className(), ['fees_collect_category_id' => 'fees_pay_tran_collect_id']);
 }
 /**
  * Display Fees category wise & student wise fees receipt.
  * @param integer $sid, $fcid
  * @return mixed
  */
 public function actionPrintCommonReceipt($sid, $fcid)
 {
     $model = new FeesPaymentTransaction();
     $stuData = \app\modules\student\models\StuMaster::findOne($sid);
     $FccModel = \app\modules\fees\models\FeesCollectCategory::findOne($fcid);
     $title = "Receipt of " . $stuData->stuMasterStuInfo->name . ' : ' . Yii::$app->dateformatter->getDateDisplay(date('Y-m-d'));
     $html = $this->renderPartial('print-common-receipt', ['model' => $model, 'stuData' => $stuData, 'FccModel' => $FccModel, 'title' => $title]);
     $imgSrc = Yii::$app->urlManager->createAbsoluteUrl('site/loadimage');
     $mpdf = new mPDF('utf-8', 'A4', 0, '', 15, 15, 25, 16, 4, 9, 'P');
     $mpdf->WriteHTML('<watermarkimage src=' . $imgSrc . ' alpha="0.33" size="50,30"/>');
     $mpdf->showWatermarkImage = true;
     $mpdf->WriteHTML($html);
     $mpdf->Output($title . '.pdf', "I");
 }