$cash_id = $list['fees_payment_cash_cheque_id']; $amunt = FeesPaymentCash::model()->findByPk($cash_id)->fees_payment_cash_amount; $final_total += $amunt; $type = "Cash"; echo '<td>' . $type . '</td>'; echo '<td>-</td>'; echo '<td>-</td>'; echo '<td>' . $rec_no . '</td>'; echo '<td>' . $amunt . '</td>'; } else { $cheque_id = $list['fees_payment_cash_cheque_id']; $cheque_status = "Return cheque"; $amunt1 = FeesPaymentCheque::model()->findByPk($cheque_id)->fees_payment_cheque_amount; $status = FeesPaymentCheque::model()->findByPk($cheque_id)->fees_payment_cheque_status; $chno = FeesPaymentCheque::model()->findByPk($cheque_id)->fees_payment_cheque_number; $bank = BankMaster::model()->findByPk(FeesPaymentCheque::model()->findByPk($cheque_id)->fees_payment_cheque_bank)->bank_full_name; if ($status == 0) { $final_total += $amunt1; $type = "Cheque"; echo '<td>' . $type . '</td>'; echo '<td>' . $bank . '</td>'; echo '<td>' . $chno . '</td>'; echo '<td>' . $rec_no . '</td>'; echo '<td>' . $amunt1 . '</td>'; } else { echo '<td>' . $cheque_status . '</td>'; echo '<td>' . $bank . '</td>'; echo '<td>' . $chno . '</td>'; echo '<td>' . $rec_no . '</td>'; echo '<td>' . $amunt1 . '</td>'; }
continue; } $stud_model = StudentInfo::model()->findByAttributes(array('student_id' => $stud_trans['student_transaction_student_id'])); $sem_name = AcademicTerm::model()->findByPk($data['fees_academic_term_id']); $branch = Branch::model()->findByPk($stud_trans['student_transaction_branch_id']); $acd_term = AcademicTermPeriod::model()->findByPk($data['fees_academic_period_id']); $field1 = '-'; $field2 = '-'; $field3 = '-'; $field4 = '-'; $field5 = 'CASH'; if ($data['fees_payment_method_id'] == 1) { $cash_amt = FeesPaymentCash::model()->findByPk($data['fees_payment_cash_cheque_id']); $amount = $cash_amt->fees_payment_cash_amount; } else { $cash_amt = FeesPaymentCheque::model()->findByPk($data['fees_payment_cash_cheque_id']); $amount = $cash_amt->fees_payment_cheque_amount; $field1 = $cash_amt->fees_payment_cheque_number; $date = date_create($cash_amt->fees_payment_cheque_date); $field2 = date_format($date, 'd-m-Y'); $bank_name = BankMaster::model()->findByPk($cash_amt->fees_payment_cheque_bank); $field3 = $bank_name->bank_short_name; $field4 = $cash_amt->fees_payment_cheque_branch; $field5 = 'CHEQUE'; } //case receipt ?> <div id="firstlayer"> <div class="part1"> <!------------------------header part--------------------->
} $detail = StudentInfo::model()->findByPk($info['student_transaction_student_id']); echo "<tr class=" . $class . "><td>" . ++$i . "</td>"; echo "<td>" . $detail->student_enroll_no . "</td><td>" . $detail->student_roll_no . "</td>\n\t <td>" . $detail->student_first_name . " " . $detail->student_middle_name . " " . $detail->student_last_name . "</td>"; $amtdata = Yii::app()->db->createCommand()->select('sum(fees_details_amount) as total')->from('student_fees_master')->where('student_fees_master_student_transaction_id=' . $info['student_transaction_id'] . ' and fees_master_table_id=' . $fees_masterid)->queryRow(); $var_amt = $amtdata['total']; echo "<td>" . $var_amt . "</td>"; $grandpayable += $var_amt; $totalpaidamt = 0; $paid_amt = FeesPaymentTransaction::model()->findAll(array('condition' => 'fees_payment_master_id=' . $fees_masterid . ' and fees_student_id=' . $info['student_transaction_id'])); foreach ($paid_amt as $list) { if ($list['fees_payment_method_id'] == 1) { $totalpaidcash = FeesPaymentCash::model()->findByPk($list['fees_payment_cash_cheque_id']); $totalpaidamt += $totalpaidcash->fees_payment_cash_amount; } else { $totalpaidchaque = FeesPaymentCheque::model()->findByPk($list['fees_payment_cash_cheque_id']); if ($totalpaidchaque->fees_payment_cheque_status == 0) { $totalpaidamt += $totalpaidchaque->fees_payment_cheque_amount; } } } echo "<td>" . $totalpaidamt . "</td>"; $grandpaidtotal += $totalpaidamt; $grandoutstandtotal += $amtdata['total'] - $totalpaidamt; echo "<td>" . ($amtdata['total'] - $totalpaidamt) . "</td></tr>"; $m++; } ?> <tr style="font-size:18px;" ><th colspan =4 >Total Amount</th><th><?php echo $grandpayable; ?>
} $payable = $total; //$payable = FeesMaster::model()->findByPk($f->fees_payment_master_id)->fees_master_total; $payable1 = $payable; //$out = $payable - $var; } $out = $payable - $var; $ch_num = FeesPaymentCheque::model()->findByPk($f->fees_payment_cash_cheque_id)->fees_payment_cheque_number; echo "<tr class=" . $class . ">"; echo "<td>" . $i . "</td>"; echo "<td>" . AcademicTermPeriod::model()->findByPk($f->fees_academic_period_id)->academic_term_period . "</td>"; echo "<td>" . AcademicTerm::model()->findByPk($f->fees_academic_term_id)->academic_term_name . "</td>"; echo "<td>" . FeesPaymentMethod::model()->findByPk($f->fees_payment_method_id)->fees_payment_method_name . "</td>"; //echo "<td>".FeesMaster::model()->findByPk($f->fees_payment_master_id)->fees_master_total."</td>"; echo "<td>" . $payable1 . "</td>"; $chqmodel = FeesPaymentCheque::model()->findByPk($f->fees_payment_cash_cheque_id); echo "<td>" . $chqmodel->fees_payment_cheque_amount . "</td>"; //$var += FeesPaymentCheque::model()->findByPk($f->fees_payment_cash_cheque_id)->fees_payment_cheque_amount; $bank_model = BankMaster::model()->findByPk($chqmodel->fees_payment_cheque_bank); $bank_name = $bank_model->bank_short_name; $bank_branch = $bank_model->bank_short_name; $date = $f->fees_received_date; $new_date = date("d-m-Y", strtotime($date)); echo "<td>" . $new_date . "</td>"; echo "<td>" . $bank_name . "</td>"; echo "<td>" . $bank_branch . "</td>"; echo "<td>" . $ch_num . "</td>"; echo "<td>" . FeesReceipt::model()->findByPk($f->fees_receipt_id)->fees_receipt_number . "</td>"; ++$temp; $i += 1; $flag = 1;
public function actionMis_report() { $model = new FeesPaymentTransaction(); $current_aca_term = AcademicTerm::model()->findAll(array('condition' => 'current_sem=1')); if ($current_aca_term) { $aca_data = array(); foreach ($current_aca_term as $aca) { $aca_data[] = $aca['academic_term_id']; $current_aca_term = $aca->academic_term_period_id; } $acam_data = implode(",", $aca_data); //$current_aca_term = $current_aca_term->academic_term_period_id; $fees_data = Yii::app()->db->createCommand()->selectDistinct('fees_master_id, fees_branch_id, fees_academic_term_id,fees_quota_id, fees_academic_term_name_id')->from('fees_master')->where('fees_academic_term_name_id in(' . $acam_data . ') order by fees_branch_id,fees_academic_term_name_id')->queryAll(); //print count($fees_data); exit; if (!empty($fees_data)) { foreach ($fees_data as $list) { $ravi_paid = 0; $ravi_total = 0; $my_total = 0; $receive_amount = 0; if (!empty($list)) { $sql = "SELECT COUNT(*) FROM student_transaction where student_transaction_quota_id=" . $list['fees_quota_id'] . " and student_transaction_branch_id = " . $list['fees_branch_id'] . " AND student_academic_term_period_tran_id = " . $list['fees_academic_term_id'] . " AND student_academic_term_name_id = " . $list['fees_academic_term_name_id']; $numStud[] = Yii::app()->db->createCommand($sql)->queryScalar(); $ravi_total = Yii::app()->db->createCommand($sql)->queryScalar(); $paid_stud = Yii::app()->db->createCommand()->selectDistinct('fees.fees_student_id, stud.student_transaction_id,stud.student_transaction_student_id,stud.student_transaction_quota_id')->from('fees_payment_transaction fees')->join('student_transaction stud', 'fees.fees_student_id = stud.student_transaction_id')->where('stud.student_transaction_branch_id = :branch_id AND stud.student_transaction_quota_id=:quota AND stud.student_academic_term_period_tran_id = :acm_id AND fees.fees_academic_term_id = :acm_name_id', array(':branch_id' => $list['fees_branch_id'], ':acm_id' => $list['fees_academic_term_id'], ':acm_name_id' => $list['fees_academic_term_name_id'], ':quota' => $list['fees_quota_id']))->queryAll(); $paid_stud_count[] = count($paid_stud); $ravi_paid = count($paid_stud); $cash_amount = 0; $cheque_amount = 0; foreach ($paid_stud as $stud_id) { $amount_data = FeesPaymentTransaction::model()->findAll('fees_student_id=' . $stud_id['student_transaction_id'] . ' and fees_academic_term_id=' . $list['fees_academic_term_name_id']); foreach ($amount_data as $cash_cheque_list) { if ($cash_cheque_list['fees_payment_method_id'] == 1) { $cash_amount += FeesPaymentCash::model()->findByPk($cash_cheque_list['fees_payment_cash_cheque_id'])->fees_payment_cash_amount; } else { $amount = FeesPaymentCheque::model()->findByAttributes(array('fees_payment_cheque_status' => 0, 'fees_payment_cheque_id' => $cash_cheque_list->fees_payment_cash_cheque_id)); $cheque_amount = $cheque_amount + $amount['fees_payment_cheque_amount']; } } } $total_receive_amount[] = $cash_amount + $cheque_amount; $unpaid_stud = Yii::app()->db->createCommand()->selectDistinct('stud.student_transaction_id,stud.student_transaction_student_id,stud.student_transaction_quota_id')->from('student_transaction stud')->where('stud.student_transaction_id NOT IN (SELECT fees_student_id FROM fees_payment_transaction) AND stud.student_transaction_branch_id = :branch_id AND stud.student_academic_term_period_tran_id = :acm_id AND stud.student_academic_term_name_id = :acm_name_id', array(':branch_id' => $list['fees_branch_id'], ':acm_id' => $list['fees_academic_term_id'], ':acm_name_id' => $list['fees_academic_term_name_id']))->queryAll(); $unpaid_stud_count[] = $ravi_total - $ravi_paid; //$unpaid_stud_count[] = count($unpaid_stud); $total_amount_data = FeesMaster::model()->findAll('fees_branch_id =' . $list['fees_branch_id'] . ' AND fees_academic_term_id =' . $list['fees_academic_term_id'] . ' AND fees_academic_term_name_id =' . $list['fees_academic_term_name_id']); $fees_stru = Yii::app()->db->createCommand()->select('fees.fees_master_id , stud.student_transaction_student_id, stud.student_academic_term_period_tran_id, stud.student_academic_term_name_id')->from('student_transaction stud')->join('fees_master fees', 'stud.student_transaction_branch_id = fees.fees_branch_id AND stud.student_academic_term_period_tran_id = fees.fees_academic_term_id AND stud.student_academic_term_name_id = fees.fees_academic_term_name_id AND stud.student_transaction_quota_id = fees.fees_quota_id')->where('stud.student_academic_term_period_tran_id = :term_p_id AND stud.student_academic_term_name_id = :term_name_id AND fees.fees_master_id = :fees_id', array(':fees_id' => $list['fees_master_id'], ':term_p_id' => $list['fees_academic_term_id'], ':term_name_id' => $list['fees_academic_term_name_id']))->queryAll(); //print_r($fees_stru); exit; $total = 0; foreach ($fees_stru as $fees_data1) { $student_fees = StudentFeesMaster::model()->findAll('fees_master_table_id = :fees_master_id AND student_fees_master_student_transaction_id = :student_id', array(':fees_master_id' => $fees_data1['fees_master_id'], ':student_id' => $fees_data1['student_transaction_student_id'])); foreach ($student_fees as $fees_data1) { $total += $fees_data1->fees_details_amount; } } //print $total; exit; $total_amount[] = $total; } } if (isset($_REQUEST['MISexport'])) { Yii::import('application.extensions.tcpdf.*'); require_once 'tcpdf/tcpdf.php'; require_once 'tcpdf/config/lang/eng.php'; $html = $this->renderPartial('report_view_pdf', array('numStud' => $numStud, 'fees_data' => $fees_data, 'paid_stud_count' => $paid_stud_count, 'unpaid_stud_count' => $unpaid_stud_count, 'total_amount' => $total_amount, 'total_receive_amount' => $total_receive_amount), true); ob_clean(); $pdf = new TCPDF(); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(Yii::app()->name); $pdf->SetTitle('MIS Report'); $pdf->SetSubject('MIS Report'); $pdf->SetKeywords('example, text, report'); $pdf->SetHeaderData('', 0, "Fees Summary", ''); //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, ""); $pdf->setHeaderFont(array('helvetica', '', 8)); $pdf->setFooterFont(array('helvetica', '', 6)); $pdf->SetMargins(15, 18, 15); $pdf->SetHeaderMargin(5); $pdf->SetFooterMargin(10); $pdf->SetAutoPageBreak(TRUE, 15); $pdf->SetFont('dejavusans', '', 7); $resolution = array(150, 150); $pdf->AddPage('P', $resolution); $pdf->writeHTML($html, true, false, true, false, ''); $pdf->LastPage(); $pdf->Output("MIS.pdf", "I"); } if (isset($_REQUEST['MISexportexcel'])) { Yii::app()->request->sendFile(date('YmdHis') . '.xlsx', $this->renderPartial('report_view_pdf', array('numStud' => $numStud, 'fees_data' => $fees_data, 'paid_stud_count' => $paid_stud_count, 'unpaid_stud_count' => $unpaid_stud_count, 'total_amount' => $total_amount, 'total_receive_amount' => $total_receive_amount), true)); } $this->render('create_report', array('numStud' => $numStud, 'fees_data' => $fees_data, 'paid_stud_count' => $paid_stud_count, 'unpaid_stud_count' => $unpaid_stud_count, 'total_amount' => $total_amount, 'total_receive_amount' => $total_receive_amount)); } else { $this->render('error_msg', array()); } } else { echo "<font color=\"red\"><center>Data Not Available</center></font>"; } }
public function beforesave() { $student_id = $_REQUEST['student_id']; $criteria = new CDbCriteria(); $stud_trans = StudentTransaction::model()->findByPk($student_id); $criteria->condition = 'fees_student_id =' . $student_id . ' AND fees_academic_period_id=' . $stud_trans['student_academic_term_period_tran_id'] . ' AND fees_academic_term_id=' . $stud_trans['student_academic_term_name_id']; $listofid = FeesPaymentTransaction::model()->findAll($criteria); $total_fees_amount = 0; $fees_stru = Yii::app()->db->createCommand()->select('fees.fees_master_id , fees.fees_master_name , fees.fees_branch_id , stud.student_transaction_branch_id , stud.student_transaction_organization_id , fees.fees_organization_id , stud.student_transaction_quota_id , fees.fees_quota_id ,stud.student_academic_term_period_tran_id , fees.fees_academic_term_id, fees.fees_academic_term_name_id, fees.fees_master_total')->from('student_transaction stud')->join('fees_master fees', 'stud.student_transaction_branch_id = fees.fees_branch_id AND stud.student_academic_term_period_tran_id = fees.fees_academic_term_id AND stud.student_academic_term_name_id = fees.fees_academic_term_name_id AND stud.student_transaction_organization_id = fees.fees_organization_id AND stud.student_transaction_quota_id = fees.fees_quota_id')->where('stud.student_transaction_id=:id', array(':id' => $student_id))->queryRow(); $student_fees = StudentFeesMaster::model()->findAll('fees_master_table_id = :fees_master_id AND student_fees_master_student_transaction_id = :student_id', array(':fees_master_id' => $fees_stru['fees_master_id'], ':student_id' => $student_id)); foreach ($student_fees as $fees_data) { $total_fees_amount += $fees_data->fees_details_amount; } $cash_total = 0; $cheque_total = 0; $total = 0; if ($listofid != null) { foreach ($listofid as $list) { if ($list->fees_payment_method_id == 1) { $cash_total = $cash_total + FeesPaymentCash::model()->findByPk($list->fees_payment_cash_cheque_id)->fees_payment_cash_amount; } else { $amount = FeesPaymentCheque::model()->findByAttributes(array('fees_payment_cheque_status' => 0, 'fees_payment_cheque_id' => $list->fees_payment_cash_cheque_id)); $cheque_total = $cheque_total + $amount['fees_payment_cheque_amount']; } } echo "<div class='total-amount'><h4>Total Paid Fees : <b>" . ($total = $cash_total + $cheque_total . '</b></h4></div>'); //$total_fees_amount = FeesMaster::model()->findByPk($list->fees_payment_master_id)->fees_master_total; if ($this->isNewRecord) { $grand_total = $total + $this->fees_payment_cash_amount; } else { $update_total = FeesPaymentCash::model()->findByPk($_REQUEST['id'])->fees_payment_cash_amount; $grand_total = $total - $update_total + $this->fees_payment_cash_amount; } if ($total_fees_amount < $grand_total) { $this->addError('fees_payment_cash_amount', 'You can not take an advance fees for student.'); return false; } else { return true; } } else { if ($this->fees_payment_cash_amount > $total_fees_amount) { $this->addError('fees_payment_cash_amount', 'You can not take an advance fees for student.'); return false; } else { return true; } } }
$term_id = $f->fees_academic_term_id; $var = FeesPaymentCheque::model()->findByPk($f->fees_payment_cash_cheque_id)->fees_payment_cheque_amount; $total = 0; $student_fees = StudentFeesMaster::model()->findAll('fees_master_table_id = :fees_master_id AND student_fees_master_student_transaction_id = :student_id', array(':fees_master_id' => $f->fees_payment_master_id, ':student_id' => $f->fees_student_id)); //print_r($student_fees); exit; foreach ($student_fees as $fees_data) { $total += $fees_data->fees_details_amount; } $payable = $total; //$payable = FeesMaster::model()->findByPk($f->fees_payment_master_id)->fees_master_total; $payable1 = $payable; } $out = $payable - $var; $ch_num = FeesPaymentCheque::model()->findByPk($f->fees_payment_cash_cheque_id)->fees_payment_cheque_number; $columns['payable'] = $payable1; $columns['paid'] = FeesPaymentCheque::model()->findByPk($f->fees_payment_cash_cheque_id)->fees_payment_cheque_amount; $date = $f->fees_received_date; $new_date = date("d-m-Y", strtotime($date)); $columns['date'] = $new_date; $columns['cheque_no'] = $ch_num; $columns['receipt'] = FeesReceipt::model()->findByPk($f->fees_receipt_id)->fees_receipt_number; ++$temp; $flag = 1; } } if ($flag == 1 && $temp != 0) { $columns['out'] = $out; $dataArray[] = $columns; $i += 1; $m++; }
public function actioncheque_return() { $model = new FeesPaymentCheque('cheque_return'); $model->unsetAttributes(); // clear any default values if (isset($_GET['FeesPaymentCheque'])) { $model->attributes = $_GET['FeesPaymentCheque']; } $this->render('return_cheque', array('model' => $model)); }
echo $this->renderPartial('_form', array('model' => $model, 'FeesMasterDetails' => $FeesMasterDetails)); $criteria = new CDbCriteria(); $stud_trans = StudentTransaction::model()->findByPk($_REQUEST['id']); $criteria->condition = 'fees_student_id =' . $_REQUEST['id'] . ' AND fees_academic_period_id=' . $stud_trans['student_academic_term_period_tran_id'] . ' AND fees_academic_term_id=' . $stud_trans['student_academic_term_name_id']; $listofid = FeesPaymentTransaction::model()->findAll($criteria); $cash_total = 0; $cheque_total = 0; $amount; $total = 0; foreach ($listofid as $list) { if ($list->fees_payment_method_id == 1) { $cash_total = $cash_total + FeesPaymentCash::model()->findByPk($list->fees_payment_cash_cheque_id)->fees_payment_cash_amount; } else { //$cheque_total = $cheque_total + FeesPaymentCheque::model()->findByPk($list->fees_payment_cash_cheque_id)->fees_payment_cheque_amount; //$info_model=StudentInfo::model()->findByAttributes(array('student_enroll_no'=>$_POST['en_no'])); $amount = FeesPaymentCheque::model()->findByAttributes(array('fees_payment_cheque_status' => 0, 'fees_payment_cheque_id' => $list->fees_payment_cash_cheque_id)); $cheque_total = $cheque_total + $amount['fees_payment_cheque_amount']; } } echo "<div class='total-amount'><h4>Total Paid Fees : <b>" . ($total = $cash_total + $cheque_total . '</b></h4></div>'); Yii::app()->user->setState('student_paid_fees', $total); ?> <h3 class="past-fees-grid"> Fees Paid by Cash </h3> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'fees-cash-grid', 'dataProvider' => $cash_model->cashsearch(), 'enableSorting' => false, 'ajaxUpdate' => false, 'columns' => array(array('header' => 'SI No', 'class' => 'IndexColumn'), array('name' => 'fees_payment_method_name', 'value' => '$data->Rel_pay_method->fees_payment_method_name'), array('name' => 'Amount', 'value' => 'FeesPaymentCash::model()->findByPk($data->fees_payment_cash_cheque_id)->fees_payment_cash_amount'), array('name' => 'Receipt No', 'value' => 'FeesReceipt::model()->findByPk($data->fees_receipt_id)->fees_receipt_number'), array('class' => 'CButtonColumn', 'template' => '{update}{delete}{print_rec}', 'buttons' => array('delete' => array('label' => 'Delete Fees', 'url' => 'Yii::app()->createUrl("feesPaymentTransaction/delete", array("id"=>$data->fees_payment_transaction_id,"stud_id"=>' . $_REQUEST['id'] . '))'), 'update' => array('label' => 'Edit Fees', 'url' => 'Yii::app()->createUrl("feesPaymentTransaction/update_payfeescash", array("id"=>$data->fees_payment_cash_cheque_id,"student_id"=>' . $_REQUEST['id'] . '))'), 'print_rec' => array('label' => 'Print Receipt', 'url' => 'Yii::app()->createUrl("feesPaymentTransaction/print_cash_receipt", array("id"=>$data->fees_payment_transaction_id))', 'imageUrl' => Yii::app()->baseUrl . '/images/rs.png', 'options' => array('class' => 'fees-receipt', 'target' => '_blank'))))))); ?> <h3 class="past-fees-grid"> Fees Paid by Cheque/Draft </h3>