/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = FeesPaymentTransaction::find(); $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_pay_tran_id' => $this->fees_pay_tran_id, 'fees_pay_tran_collect_id' => $this->fees_pay_tran_collect_id, 'fees_pay_tran_stu_id' => $this->fees_pay_tran_stu_id, 'fees_pay_tran_batch_id' => $this->fees_pay_tran_batch_id, 'fees_pay_tran_course_id' => $this->fees_pay_tran_course_id, 'fees_pay_tran_section_id' => $this->fees_pay_tran_section_id, 'fees_pay_tran_mode' => $this->fees_pay_tran_mode, 'fees_pay_tran_cheque_no' => $this->fees_pay_tran_cheque_no, 'fees_pay_tran_bank_id' => $this->fees_pay_tran_bank_id, 'fees_pay_tran_amount' => $this->fees_pay_tran_amount, 'fees_pay_tran_date' => $this->fees_pay_tran_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]); return $dataProvider; }
public function actionIndex() { $this->layout = 'homePage'; if (\Yii::$app->user->isGuest) { return $this->redirect(['site/login']); } else { $isStudent = Yii::$app->session->get('stu_id'); $isEmployee = Yii::$app->session->get('emp_id'); $holidayData = \app\models\NationalHolidays::find()->andWhere(['is_status' => 0])->asArray()->all(); if (isset($isStudent)) { $payFees = Yii::$app->db->createCommand("SELECT SUM(fees_pay_tran_amount) FROM fees_payment_transaction WHERE fees_pay_tran_stu_id=" . Yii::$app->session->get('stu_id') . " AND is_status=0")->queryScalar(); $currentFeesData = \app\modules\fees\models\FeesPaymentTransaction::getUnpaidTotal($isStudent); return $this->render('stu-dashboard', ['holidayData' => $holidayData, 'currentFeesData' => $currentFeesData, 'payFees' => $payFees]); } else { if (isset($isEmployee)) { return $this->render('emp-dashboard', ['holidayData' => $holidayData]); } else { return $this->render('user-dashboard'); } } } }
use yii\helpers\Html; ?> <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>';
public function checkFeesTotal($attribute) { if (empty($this->fees_pay_tran_amount)) { return $this->addError($attribute, "You can not take zero fees."); } $payFees = $chkFees = 0; $payFees = Yii::$app->db->createCommand("SELECT SUM(fees_pay_tran_amount) FROM fees_payment_transaction WHERE fees_pay_tran_stu_id=" . $this->fees_pay_tran_stu_id . " AND fees_pay_tran_collect_id=" . $this->fees_pay_tran_collect_id . " AND is_status=0")->queryScalar(); $totalPayFees = Yii::$app->db->createCommand("SELECT SUM(fees_details_amount) FROM fees_category_details WHERE fees_details_category_id = " . $this->fees_pay_tran_collect_id . " AND is_status=0")->queryScalar(); if ($this->isNewRecord) { $chkFees = $payFees + $this->fees_pay_tran_amount; } else { $currFees = FeesPaymentTransaction::findOne($this->fees_pay_tran_id)->fees_pay_tran_amount; $chkFees = $payFees + $this->fees_pay_tran_amount - $currFees; } if ($chkFees > $totalPayFees) { return $this->addError($attribute, "You can not take advance fees."); return false; } else { return true; } }
/** * @return \yii\db\ActiveQuery */ public function getFeesPaymentTransactions() { return $this->hasMany(FeesPaymentTransaction::className(), ['fees_pay_tran_bank_id' => 'bank_master_id']); }
/** * Finds the FeesPaymentTransaction model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return FeesPaymentTransaction the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = FeesPaymentTransaction::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }