public function get_fcd($params) { $query = FeesCategoryDetails::find()->where(['fees_details_category_id' => $_REQUEST['id'], 'is_status' => 0]); $dataProvider = new ActiveDataProvider(['query' => $query]); $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_category_details_id' => $this->fees_category_details_id, 'fees_details_category_id' => $this->fees_details_category_id, 'fees_details_amount' => $this->fees_details_amount, '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_details_name', $this->fees_details_name])->andFilterWhere(['like', 'fees_details_description', $this->fees_details_description]); 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]); }
echo $model->isNewRecord ? 'box-success' : 'box-info'; ?> box col-xs-12 col-lg-12 no-padding"> <div class="box-header with-border"> <h3 class="box-title"><i class="fa fa-inr"></i><sub><i class="fa fa-info-circle"></i></sub> <?php echo Yii::t('fees', 'Fees Collection Category'); ?> : <?php echo $FccModel->fees_collect_name; ?> </h3> </div> <div class="box-body table-responsive"> <?php $totalAmount = $totalPay = 0; $feesDetails = \app\modules\fees\models\FeesCategoryDetails::find()->where(['fees_details_category_id' => $FccModel->fees_collect_category_id, 'is_status' => 0])->asArray()->all(); echo '<table class="table table-bordered tbl-pay-fees">'; echo '<col class="col-xs-1">'; echo '<col class="col-xs-9">'; echo '<col class="col-xs-2">'; echo '<tr>'; echo '<th class="">' . Yii::t('fees', 'SI No.') . '</th>'; echo '<th>' . Yii::t('fees', 'Fees Details') . '</th>'; echo '<th>' . Yii::t('fees', 'Amount') . '</th>'; echo '</tr>'; foreach ($feesDetails as $key => $value) { echo '<tr>'; echo '<td>' . ($key + 1) . '</td>'; echo '<td>' . $value['fees_details_name'] . '</td>'; echo '<td>' . $value['fees_details_amount'] . '</td>'; echo '</tr>';
?> <html> <head> <title><?php echo Yii::t('fees', 'Fees Collection Category Wise PDF Report'); ?> </title> </head> <body> <?php $totalAmount = $gTotalAmount = $gpayFees = $gActualCollect = $payFees = $actualCollect = 0; $stuDataTmp = Yii::$app->db->createCommand("SELECT stu_master_id FROM stu_master WHERE stu_master_batch_id=" . $FccModel->fees_collect_batch_id . " AND is_status=0")->queryColumn(); $payFeesTmp = Yii::$app->db->createCommand("SELECT fees_pay_tran_stu_id FROM fees_payment_transaction WHERE fees_pay_tran_batch_id=" . $FccModel->fees_collect_batch_id . " AND is_status=0 AND fees_pay_tran_collect_id=" . $FccModel->fees_collect_category_id)->queryColumn(); $stuData = array_unique(array_merge($stuDataTmp, $payFeesTmp)); $feesData = \app\modules\fees\models\FeesPaymentTransaction::find()->where(['fees_pay_tran_batch_id' => $FccModel->fees_collect_batch_id, 'is_status' => 0])->asArray()->all(); $totalAmountTmp = \app\modules\fees\models\FeesCategoryDetails::getFeeCategoryTotal($FccModel->fees_collect_category_id); $totalAmount = !$totalAmountTmp ? 0 : $totalAmountTmp; ?> <div class="grid-view"> <?php if (!empty($stuData)) { echo '<table class="table table-striped">'; echo '<tr>'; echo '<th class="text-center">' . Yii::t('fees', 'SI No.') . '</th>'; echo '<th>' . Yii::t('fees', 'Student No') . '</th>'; echo '<th>' . Yii::t('fees', 'Student Name') . '</th>'; echo '<th>' . Yii::t('fees', 'Total Collection') . '</th>'; echo '<th>' . Yii::t('fees', 'Paid Amount') . '</th>'; echo '<th>' . Yii::t('fees', 'Unpaid Amount') . '</th>'; echo '</tr>'; $sr = 1;
public function getFeesCategoryDetails() { return $this->hasMany(FeesCategoryDetails::className(), ['fees_details_category_id' => 'fees_collect_category_id']); }
echo GridView::widget(['dataProvider' => $currFeesData, 'layout' => "{items}\n{pager}", 'showOnEmpty' => true, 'emptyText' => Yii::t('fees', 'No current fees data available.'), 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'fees_collect_name', 'fees_collect_details', ['attribute' => 'fees_collect_start_date', 'value' => function ($data) { return Yii::$app->formatter->asDate($data['fees_collect_start_date']); }], ['attribute' => 'fees_collect_end_date', 'value' => function ($data) { return Yii::$app->formatter->asDate($data['fees_collect_end_date']); }], ['attribute' => 'fees_collect_due_date', 'value' => function ($data) { return Yii::$app->formatter->asDate($data['fees_collect_due_date']); }], ['header' => 'Fees Details', 'format' => 'raw', 'value' => function ($data) { $fcdModel = \app\modules\fees\models\FeesCategoryDetails::find()->where(['is_status' => 0, 'fees_details_category_id' => $data->fees_collect_category_id])->asArray()->all(); $tmp = '<ol>'; foreach ($fcdModel as $value) { $tmp .= '<li>' . $value['fees_details_name'] . ' (' . $value['fees_details_amount'] . ') </li>'; } $tmp .= '</ol>'; return $tmp; }], ['header' => Yii::t('fees', 'Total Amount'), 'value' => function ($data) { return \app\modules\fees\models\FeesCategoryDetails::getFeeCategoryTotal($data->fees_collect_category_id); }], ['header' => Yii::t('fees', 'Total Paid Fees'), 'value' => function ($data) use($model, $stuData) { return $model->getStuTotalPayFees($stuData->stu_master_id, $data->fees_collect_category_id); }]]]); ?> </div> </div> </div> <!-----End current batch fees details-----> <!-----Start student payment history block-----> <div class="col-xs-12" style="padding-top: 10px;"> <div class="box box-info col-xs-12 col-lg-12 no-padding"> <div class="box-header with-border"> <h3 class="box-title"><i class="fa fa-inr"></i><sup><i class="fa fa-clock-o"></i></sup> <?php echo Yii::t('fees', 'Student Payment History');
/** * Finds the FeesCategoryDetails model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return FeesCategoryDetails the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = FeesCategoryDetails::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }