Viewing file: clsEnrollFee.php (16.76 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) | SetQuery("select studentId from EnrollFee where acadYear='$wKey' and studentYear='$xKey' and semester='$yKey' and programId='$zKey' group by studentId");
}*/
function RSEnrollFeeByAcYAndStYAndSeAndPgIdAndNoPay($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select studentId from EnrollFee where acadYear='$wKey' and studentYear='$xKey' and semester='$yKey' and programId='$zKey' and balance=totalAmount group by studentId");
}
function GetSumTtAmtByStIdAndAcYAndStYAndSe($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(totalAmount) as num from EnrollFee where studentId='$wKey' and acadYear='$xKey' and studentYear='$yKey' and semester='$zKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumBlByStIdAndAcYAndStYAndSe($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(balance) as num from EnrollFee where studentId='$wKey' and acadYear='$xKey' and studentYear='$yKey' and semester='$zKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumBlByStIdAndAcYAndStYAndSeAndNoPay($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(balance) as num from EnrollFee where studentId='$wKey' and acadYear='$xKey' and studentYear='$yKey' and semester='$zKey' and balance=totalAmount");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumBlByStIdAndAcYAndStYAndSeAndTimePay($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(balance) as num from EnrollFee where studentId='$wKey' and acadYear='$xKey' and studentYear='$yKey' and semester='$zKey' and balance>0 and balanceGetResult()) {
return $result['num'];
}
}
function GetSumTtAmtByAcYAndStYAndSeAndPgId($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(totalAmount) as num from EnrollFee where acadYear='$wKey' and studentYear='$xKey' and semester='$yKey' and programId='$zKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumTtAmtByAcYAndSeAndPgIdAndAdYAndPay($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(totalAmount) as num from EnrollFee e, StudentMaster s where acadYear='$wKey' and semester='$xKey' and e.programId='$yKey' and balance=0 and e.studentId=s.studentId and admitAcadYear='$zKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumTtAmtByAcYAndSeAndPay($xKey, $yKey){
$this->SetQuery("select sum(totalAmount) as num from EnrollFee where acadYear='$xKey' and semester='$yKey' and balance=0");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumBlByAcYAndStYAndSeAndPgId($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(balance) as num from EnrollFee where acadYear='$wKey' and studentYear='$xKey' and semester='$yKey' and programId='$zKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumBlByAcYAndStYAndSeAndPgIdAndNoPay($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(balance) as num from EnrollFee where acadYear='$wKey' and studentYear='$xKey' and semester='$yKey' and programId='$zKey' and balance=totalAmount");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumBlByAcYAndStYAndSeAndPgIdAndTimePay($wKey, $xKey, $yKey, $zKey){
$this->SetQuery("select sum(balance) as num from EnrollFee where acadYear='$wKey' and studentYear='$xKey' and semester='$yKey' and programId='$zKey' and balance>0 and balanceGetResult()) {
return $result['num'];
}
}
function RSEnrollFeeByStIdAndAcYAndSe($xKey, $yKey, $zKey){
$this->SetQuery("select * from EnrollFee where studentId='$xKey' and acadYear='$yKey' and semester='$zKey'");
}
function CalFee($stId, $acY, $stY, $se, $pgId, $etId){
include_once "clsCommonFeeTP.php";
include_once "clsCommonFee.php";
include_once "clsFee.php";
include_once "clsProgramFeeTP.php";
include_once "clsProgramFee.php";
include_once "clsStudentDom.php";
include_once "clsDomFeeTP.php";
include_once "clsCourseFeeTP.php";
include_once "clsCourseFee.php";
include_once "clsEnrollItem.php";
$oCft = new CommonFeeTP();
$oCf = new CommonFee();
$oCf2 = new CommonFee();
$oFe = new Fee();
$oPft = new ProgramFeeTP();
$oPf = new ProgramFee();
$oPf2 = new ProgramFee();
$oSd = new StudentDom();
$oDft = new DomFeeTP();
$oCoft = new CourseFeeTP();
$oCof = new CourseFee();
$oEi = new EnrollItem();
/*$this->RSEnrollFeeByStIdAndAcYAndSe($stId, $acY, $se);
// Not found
if($this->GetRecord() == 0) {
// Insert EnrollFee
$this->AddNew();
$this->enrollFeeId=$this->GetNextCode();
$this->studentId=$stId;
$this->acadYear=$acY;
$this->studentYear=$stY;
$this->semester=$se;
$this->programId=$pgId;
$this->totalAmount=$totalAmount;
$this->balance=$balance;
$this->refNo=$acY.$se.$stCode;
$this->createDateTime=date('Y-m-d H:i:s');
$this->createUserId=$createUserId;
$this->updateDateTime=date('Y-m-d H:i:s');
$this->updateUserId=$updateUserId;
$this->Save();
}*/
// ---------- CommonFee ----------
$oCf->RSCommonFeeByStIdAndAcYAndSe($stId, $acY, $se);
while($oCf->GetRecord()) {
$oCf2->SearchByKey($stId, $acY, $se, $oCf->feeId);
$oCf2->GetRecord();
$oCf2->Delete();
}
$sumCommonFee = 0;
$oCft->RSCommonFeeTPByAcYAndSeAndIsNotDom($acY, $se);
while($oCft->GetRecord()) {
$oFe->SearchByKey($oCft->feeId);
$oFe->GetRecord();
if(($oFe->feePayType==1 && $stY==1) || $oFe->feePayType!=1) {
$oCf->SearchByKey($stId, $acY, $se, $oCft->feeId);
// Not found
if($oCf->GetRecord() == 0) {
// Insert CommonFee
$oCf->AddNew();
$oCf->studentId=$stId;
$oCf->acadYear=$acY;
$oCf->semester=$se;
$oCf->feeId=$oCft->feeId;
$oCf->amount=$oCft->amount;
$oCf->Save();
}
}
}
$sumCommonFee = $oCf->GetSumAmountByStIdAndAcYAndSe($stId, $acY, $se);
// ---------- ProgramFee ----------
$oPf->RSProgramFeeByStIdAndAcYAndSe($stId, $acY, $se);
while($oPf->GetRecord()) {
$oPf2->SearchByKey($stId, $acY, $se, $oPf->feeId);
$oPf2->GetRecord();
$oPf2->Delete();
}
$sumProgramFee = 0;
$oPft->RSProgramFeeTPByPgIdAndAcYAndSe($pgId, $acY, $se);
while($oPft->GetRecord()) {
$oFe->SearchByKey($oPft->feeId);
$oFe->GetRecord();
if(($oFe->feePayType==1 && $stY==1) || $oFe->feePayType!=1) {
if(($oFe->onTop=='Y' && $etId==2) || $oFe->onTop=='N') {
$oPf->SearchByKey($stId, $acY, $se, $oPft->feeId);
// Not found
if($oPf->GetRecord() == 0) {
// Insert ProgramFee
$oPf->AddNew();
$oPf->studentId=$stId;
$oPf->acadYear=$acY;
$oPf->semester=$se;
$oPf->feeId=$oPft->feeId;
$oPf->amount=$oPft->amount;
$oPf->Save();
}
}
}
}
$sumProgramFee = $oPf->GetSumAmountByStIdAndAcYAndSe($stId, $acY, $se);
// ---------- DomFee ----------
$domFee = 0;
$oCft->RSCommonFeeTPByAcYAndSeAndIsDom($acY, $se);
if($oCft->GetRecord()) {
$oSd->SearchByKey($stId, $acY, $se);
// Student stay dom
if($oSd->GetRecord()) {
$oDft->SearchByKey($acY, $se, $oSd->domId);
// Found dom fee
if($oDft->GetRecord()) {
$oCf->SearchByKey($stId, $acY, $se, $oCft->feeId);
// Not found
if($oCf->GetRecord() == 0) {
// Insert CommonFee
$oCf->AddNew();
$oCf->studentId=$stId;
$oCf->acadYear=$acY;
$oCf->semester=$se;
$oCf->feeId=$oCft->feeId;
$oCf->amount=$oSd->monthAmount * $oDft->domFee;
$oCf->Save();
$domFee = $oCf->amount;
}
}
}
}
// ---------- CourseFee ----------
$sumCourseFee = 0;
$oCoft->SearchByKey($pgId, $acY, $se);
if($oCoft->GetRecord()) {
$oCof->SearchByKey($stId, $acY, $se, $this->enrollFeeId);
// Found
if($oCof->GetRecord()) {
// Update CourseFee
$oCof->Edit();
$oCof->lcFee=$oEi->GetSumCr1ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lcCreditFee;
$oCof->lbFee=$oEi->GetSumCr2ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lbCreditFee;
$oCof->Save();
}
// Not Found
else {
// Insert CourseFee
$oCof->AddNew();
$oCof->studentId=$stId;
$oCof->acadYear=$acY;
$oCof->semester=$se;
$oCof->enrollFeeId=$this->enrollFeeId;
$oCof->lcFee=$oEi->GetSumCr1ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lcCreditFee;
$oCof->lbFee=$oEi->GetSumCr2ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lbCreditFee;
$oCof->lateFine=$lateFine;
$oCof->kssFee=$kssFee;
$oCof->Save();
}
$sumCourseFee = $oCof->lcFee + $oCof->lbFee;
}
/*$this->SearchByKey($this->enrollFeeId);
$this->GetRecord();
$this->Edit();
$this->totalAmount=$sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee;
$this->balance=$sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee;
$this->updateDateTime=date('Y-m-d H:i:s');
$this->updateUserId=$updateUserId;
$this->Save();*/
return $sumCommonFee+$sumProgramFee+$domFee+$sumCourseFee;
}
function CalFeeAndKSSFee($stId, $acY, $stY, $se, $pgId, $etId){
include_once "clsCommonFeeTP.php";
include_once "clsCommonFee.php";
include_once "clsFee.php";
include_once "clsProgramFeeTP.php";
include_once "clsProgramFee.php";
include_once "clsStudentDom.php";
include_once "clsDomFeeTP.php";
include_once "clsCourseFeeTP.php";
include_once "clsCourseFee.php";
include_once "clsEnrollItem.php";
$oCft = new CommonFeeTP();
$oCf = new CommonFee();
$oCf2 = new CommonFee();
$oFe = new Fee();
$oPft = new ProgramFeeTP();
$oPf = new ProgramFee();
$oPf2 = new ProgramFee();
$oSd = new StudentDom();
$oDft = new DomFeeTP();
$oCoft = new CourseFeeTP();
$oCof = new CourseFee();
$oEi = new EnrollItem();
/*$this->RSEnrollFeeByStIdAndAcYAndSe($stId, $acY, $se);
// Not found
if($this->GetRecord() == 0) {
// Insert EnrollFee
$this->AddNew();
$this->enrollFeeId=$this->GetNextCode();
$this->studentId=$stId;
$this->acadYear=$acY;
$this->studentYear=$stY;
$this->semester=$se;
$this->programId=$pgId;
$this->totalAmount=$totalAmount;
$this->balance=$balance;
$this->refNo=$acY.$se.$stCode;
$this->createDateTime=date('Y-m-d H:i:s');
$this->createUserId=$createUserId;
$this->updateDateTime=date('Y-m-d H:i:s');
$this->updateUserId=$updateUserId;
$this->Save();
}*/
// ---------- CommonFee ----------
$oCf->RSCommonFeeByStIdAndAcYAndSe($stId, $acY, $se);
while($oCf->GetRecord()) {
$oCf2->SearchByKey($stId, $acY, $se, $oCf->feeId);
$oCf2->GetRecord();
$oCf2->Delete();
}
$sumCommonFee = 0;
$oCft->RSCommonFeeTPByAcYAndSeAndIsNotDom($acY, $se);
while($oCft->GetRecord()) {
$oFe->SearchByKey($oCft->feeId);
$oFe->GetRecord();
if(($oFe->feePayType==1 && $stY==1) || $oFe->feePayType!=1) {
$oCf->SearchByKey($stId, $acY, $se, $oCft->feeId);
// Not found
if($oCf->GetRecord() == 0) {
// Insert CommonFee
$oCf->AddNew();
$oCf->studentId=$stId;
$oCf->acadYear=$acY;
$oCf->semester=$se;
$oCf->feeId=$oCft->feeId;
$oCf->amount=$oCft->amount;
$oCf->Save();
}
}
}
$sumCommonFee = $oCf->GetSumAmountByStIdAndAcYAndSe($stId, $acY, $se);
// ---------- ProgramFee ----------
$oPf->RSProgramFeeByStIdAndAcYAndSe($stId, $acY, $se);
while($oPf->GetRecord()) {
$oPf2->SearchByKey($stId, $acY, $se, $oPf->feeId);
$oPf2->GetRecord();
$oPf2->Delete();
}
$sumProgramFee = 0;
$oPft->RSProgramFeeTPByPgIdAndAcYAndSe($pgId, $acY, $se);
while($oPft->GetRecord()) {
$oFe->SearchByKey($oPft->feeId);
$oFe->GetRecord();
if(($oFe->feePayType==1 && $stY==1) || $oFe->feePayType!=1) {
if(($oFe->onTop=='Y' && $etId==2) || $oFe->onTop=='N') {
$oPf->SearchByKey($stId, $acY, $se, $oPft->feeId);
// Not found
if($oPf->GetRecord() == 0) {
// Insert ProgramFee
$oPf->AddNew();
$oPf->studentId=$stId;
$oPf->acadYear=$acY;
$oPf->semester=$se;
$oPf->feeId=$oPft->feeId;
$oPf->amount=$oPft->amount;
$oPf->Save();
}
}
}
}
$sumProgramFee = $oPf->GetSumAmountByStIdAndAcYAndSe($stId, $acY, $se);
// ---------- DomFee ----------
$domFee = 0;
$oCft->RSCommonFeeTPByAcYAndSeAndIsDom($acY, $se);
if($oCft->GetRecord()) {
$oSd->SearchByKey($stId, $acY, $se);
// Student stay dom
if($oSd->GetRecord()) {
$oDft->SearchByKey($acY, $se, $oSd->domId);
// Found dom fee
if($oDft->GetRecord()) {
$oCf->SearchByKey($stId, $acY, $se, $oCft->feeId);
// Not found
if($oCf->GetRecord() == 0) {
// Insert CommonFee
$oCf->AddNew();
$oCf->studentId=$stId;
$oCf->acadYear=$acY;
$oCf->semester=$se;
$oCf->feeId=$oCft->feeId;
$oCf->amount=$oSd->monthAmount * $oDft->domFee;
$oCf->Save();
$domFee = $oCf->amount;
}
}
}
}
// ---------- CourseFee ----------
$sumCourseFee = 0;
$oCoft->SearchByKey($pgId, $acY, $se);
if($oCoft->GetRecord()) {
$oCof->SearchByKey($stId, $acY, $se, $this->enrollFeeId);
// Found
if($oCof->GetRecord()) {
// Update CourseFee
$oCof->Edit();
$oCof->lcFee=$oEi->GetSumCr1ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lcCreditFee;
$oCof->lbFee=$oEi->GetSumCr2ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lbCreditFee;
$oCof->kssFee=$oCoft->kssFee;
$oCof->Save();
}
// Not Found
else {
// Insert CourseFee
$oCof->AddNew();
$oCof->studentId=$stId;
$oCof->acadYear=$acY;
$oCof->semester=$se;
$oCof->enrollFeeId=$this->enrollFeeId;
$oCof->lcFee=$oEi->GetSumCr1ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lcCreditFee;
$oCof->lbFee=$oEi->GetSumCr2ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lbCreditFee;
$oCof->lateFine=$lateFine;
$oCof->kssFee=$oCoft->kssFee;
$oCof->Save();
}
$sumCourseFee = $oCof->lcFee + $oCof->lbFee + $oCof->kssFee;
}
/*$this->SearchByKey($this->enrollFeeId);
$this->GetRecord();
$this->Edit();
$this->totalAmount=$sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee;
$this->balance=$sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee;
$this->updateDateTime=date('Y-m-d H:i:s');
$this->updateUserId=$updateUserId;
$this->Save();*/
return $sumCommonFee+$sumProgramFee+$domFee+$sumCourseFee;
}
function CalKSSFee($stId, $acY, $se, $pgId){
include_once "clsCourseFeeTP.php";
include_once "clsCourseFee.php";
include_once "clsEnrollItem.php";
$oCoft = new CourseFeeTP();
$oCof = new CourseFee();
$oEi = new EnrollItem();
/*$this->RSEnrollFeeByStIdAndAcYAndSe($stId, $acY, $se);
// Not found
if($this->GetRecord() == 0) {
// Insert EnrollFee
$this->AddNew();
$this->enrollFeeId=$this->GetNextCode();
$this->studentId=$stId;
$this->acadYear=$acY;
$this->studentYear=$stY;
$this->semester=$se;
$this->programId=$pgId;
$this->totalAmount=$totalAmount;
$this->balance=$balance;
$this->refNo=$acY.$se.$stCode;
$this->createDateTime=date('Y-m-d H:i:s');
$this->createUserId=$createUserId;
$this->updateDateTime=date('Y-m-d H:i:s');
$this->updateUserId=$updateUserId;
$this->Save();
}*/
// ---------- CourseFee ----------
$sumCourseFee = 0;
$oCoft->SearchByKey($pgId, $acY, $se);
$oCoft->GetRecord();
// Insert CourseFee
$oCof->AddNew();
$oCof->studentId=$stId;
$oCof->acadYear=$acY;
$oCof->semester=$se;
$oCof->enrollFeeId=$this->enrollFeeId;
$oCof->lcFee=$oEi->GetSumCr1ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lcCreditFee;
$oCof->lbFee=$oEi->GetSumCr2ByStIdAndAcYAndSe($stId, $acY, $se) * $oCoft->lbCreditFee;
$oCof->lateFine=$lateFine;
$oCof->kssFee=$oCoft->kssFee;
$oCof->Save();
$sumCourseFee = $oCof->kssFee;
/*$this->SearchByKey($this->enrollFeeId);
$this->GetRecord();
$this->Edit();
$this->totalAmount=$sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee;
$this->balance=$sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee;
$this->updateDateTime=date('Y-m-d H:i:s');
$this->updateUserId=$updateUserId;
$this->Save();*/
return $sumCourseFee;
}
function RSEnrollFeeByPayDateAndBlIs0GroupEfId($xKey, $yKey){
$this->SetQuery("select EnrollFee.enrollFeeId from EnrollFee, Payment where payDate between '$xKey' and '$yKey' and balance=0 and EnrollFee.enrollFeeId=Payment.enrollFeeId group by Payment.enrollFeeId");
}
//--Use on page paymentEnroll.php--
function GetSumBlByStId($xKey){
$this->SetQuery("select sum(balance) as num from EnrollFee where studentId='$xKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RSEnrollFeeByStIdAndBl($xKey){
$this->SetQuery("select * from EnrollFee where studentId='$xKey' and balance!=0");
}
function RSEnrollFeeByStId($xKey){
$this->SetQuery("select * from EnrollFee where studentId='$xKey'");
}
function RSEnrollFeeByReNo($ReNo){
if($this->SetQuery("select * from EnrollFee where refNo='$ReNo' and balance!=0")){
return 1;
}else {
return 0;
}
}
function RSEnrollFeeByReNo2($ReNo){
if($this->SetQuery("select * from EnrollFee where refNo='$ReNo'")){
return 1;
}else {
return 0;
}
}
function RSEnrollFeeByPM($PM){
if($this->SetQuery("select * from EnrollFee where balance>='$PM' and balance!=0")){
return 1;
}else {
return 0;
}
}
//--The end--
} //--End class EnrollFee--
?>
|