This commit is contained in:
resicovenba 2018-02-22 19:22:33 +05:30
commit bfc518856c
4 changed files with 1002 additions and 206 deletions

View File

@ -240,6 +240,7 @@ class Fees_Status_Controller extends REST_Controller {
$details['Others'] = $this->post('other'); $details['Others'] = $this->post('other');
$details['CreatedBy'] = $this->post('createdBy'); $details['CreatedBy'] = $this->post('createdBy');
$details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s');
$details['BatchCode'] = $this->post('batchCode');
$jsonInstallmenData = $this->post('installmentItems'); $jsonInstallmenData = $this->post('installmentItems');

View File

@ -17,7 +17,7 @@ class Fees_status_model extends CI_Model
public function getStudentList($search=null) public function getStudentList($search=null)
{ {
if($search['MobileNumber']!='' OR $search['Firstname']!='' OR $search['UniversityID']!='' OR $search['CourseID']!=''){ if($search['MobileNumber']!='' OR $search['Firstname']!='' OR $search['UniversityID']!='' OR $search['CourseID']!=''){
$this->db->select('ST.StudentID,ST.MobileNumber,ST.Firstname,ST.Fathername,ST.EmailID,STC.ID,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,BA.BatchCode,BA.BatchName'); $this->db->select('ST.StudentID,ST.MobileNumber,ST.Firstname,ST.Fathername,ST.EmailID,STC.ID,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,BA.BatchCode,BA.BatchName,BA.BatchDate');
$this->db->from(STUDENTS.' as ST'); $this->db->from(STUDENTS.' as ST');
$this->db->join(STUDENTCOURSE.' as STC', 'STC.StudentID = ST.StudentID'); $this->db->join(STUDENTCOURSE.' as STC', 'STC.StudentID = ST.StudentID');
$this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID'); $this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID');
@ -408,12 +408,14 @@ class Fees_status_model extends CI_Model
} else { } else {
$this->db->insert(STUDENTS_FEES_PAID, $feesPaidDetails); $this->db->insert(STUDENTS_FEES_PAID, $feesPaidDetails);
if ($this->db->affected_rows() == '1') { if ($this->db->affected_rows() == '1') {
$result['paidStatus'] = true; $result['paidStatus'] = true;
$result['message'] = "Successfully fees details added"; $result['message'] = "Successfully fees details added";
$feesPayedID = $this->db->insert_id();
// $entryOfCallTrack = $this->updateInCallTrack($trackDetails); // $entryOfCallTrack = $this->updateInCallTrack($trackDetails);
// day book entry // day book entry
if($feesPaidDetails['ModeOfPayment']=='CASH' AND $feesPaidDetails['BillAmount']!='0'){ if($feesPaidDetails['BillAmount']!='0'){
$dayBookEntry = $this->insertDayBookMaster($feesPaidDetails); $dayBookEntry = $this->insertDayBookMaster($feesPaidDetails,$feesPayedID);
} }
@ -632,6 +634,7 @@ class Fees_status_model extends CI_Model
* created by kms * created by kms
* */ * */
public function getFeesStructureAssign($student=null){ public function getFeesStructureAssign($student=null){
$this->db->select('ID,CourseID,ProgramType,FeesAmount,Sem_Year'); $this->db->select('ID,CourseID,ProgramType,FeesAmount,Sem_Year');
$this->db->where('CourseID',$student['CourseID']); $this->db->where('CourseID',$student['CourseID']);
$this->db->order_by('ProgramType'); $this->db->order_by('ProgramType');
@ -640,7 +643,8 @@ class Fees_status_model extends CI_Model
$result_array['feesStatus']=true; $result_array['feesStatus']=true;
foreach ($feesDetails->result() as $row){ foreach ($feesDetails->result() as $row){
$this->db->select('FeesID,CourseFees, STFOrWR,Waiver,Others,SessionName,RollNo'); $this->db->select('FeesID,CourseFees, STFOrWR,Waiver,Others,SessionName,RollNo,BatchCode');
$this->db->where('StudentID',$student['StudentID']); $this->db->where('StudentID',$student['StudentID']);
$this->db->where('CourseID',$student['CourseID']); $this->db->where('CourseID',$student['CourseID']);
$this->db->where('FeesType',$row->ID); $this->db->where('FeesType',$row->ID);
@ -651,6 +655,7 @@ class Fees_status_model extends CI_Model
$fetchData['CourseID']=$row->CourseID; $fetchData['CourseID']=$row->CourseID;
$fetchData['Sem_Year']=$row->Sem_Year; $fetchData['Sem_Year']=$row->Sem_Year;
$fetchData['ActualFees']=$existData[0]->CourseFees; $fetchData['ActualFees']=$existData[0]->CourseFees;
$fetchData['BatchCode']=$existData[0]->BatchCode;
$fetchData['STFOrWR']=$existData[0]->STFOrWR; $fetchData['STFOrWR']=$existData[0]->STFOrWR;
$fetchData['Waiver']=$existData[0]->Waiver; $fetchData['Waiver']=$existData[0]->Waiver;
$fetchData['Others']=$existData[0]->Others; $fetchData['Others']=$existData[0]->Others;
@ -659,6 +664,7 @@ class Fees_status_model extends CI_Model
$fetchData['PayableFees']=$existData[0]->CourseFees+$existData[0]->STFOrWR+$existData[0]->Others-$existData[0]->Waiver; $fetchData['PayableFees']=$existData[0]->CourseFees+$existData[0]->STFOrWR+$existData[0]->Others-$existData[0]->Waiver;
// for installment details // for installment details
$InstallemtResult = $this->getInstallmentDetails($existData[0]->FeesID); $InstallemtResult = $this->getInstallmentDetails($existData[0]->FeesID);
if($InstallemtResult != false){ if($InstallemtResult != false){
$fetchData['InstallmentDetails']=$InstallemtResult; $fetchData['InstallmentDetails']=$InstallemtResult;
} }
@ -668,6 +674,13 @@ class Fees_status_model extends CI_Model
} }
$batchDetails = $this->getBatchDetails($existData[0]->BatchCode,$student['CourseID'],$student['StudentID'],$row->ID);
if($batchDetails!=false){
$fetchData['batchDetails']=$batchDetails;
}
else{
$fetchData['batchDetails']="";
}
$CourseFeesArray[]=$fetchData; $CourseFeesArray[]=$fetchData;
@ -676,8 +689,10 @@ class Fees_status_model extends CI_Model
$fetchData['ExistValue']=0; $fetchData['ExistValue']=0;
$fetchData['ID']=$row->ID; $fetchData['ID']=$row->ID;
$fetchData['CourseID']=$row->CourseID; $fetchData['CourseID']=$row->CourseID;
$fetchData['Sem_Year']=$row->Sem_Year; $fetchData['Sem_Year']=$row->Sem_Year;
$fetchData['ActualFees']=$row->FeesAmount; $fetchData['ActualFees']=$row->FeesAmount;
$fetchData['BatchCode']="";
$fetchData['STFOrWR']=""; $fetchData['STFOrWR']="";
$fetchData['Waiver']=""; $fetchData['Waiver']="";
$fetchData['Others']=""; $fetchData['Others']="";
@ -686,6 +701,13 @@ class Fees_status_model extends CI_Model
$fetchData['PayableFees']=$row->FeesAmount; $fetchData['PayableFees']=$row->FeesAmount;
// for installment details // for installment details
$fetchData['InstallmentDetails']=""; $fetchData['InstallmentDetails']="";
$batchDetails = $this->getBatchDetails('',$student['CourseID'],$student['StudentID'],'');
if($batchDetails!=false){
$fetchData['batchDetails']=$batchDetails;
}
else{
$fetchData['batchDetails']="";
}
$CourseFeesArray[]=$fetchData; $CourseFeesArray[]=$fetchData;
@ -708,6 +730,7 @@ class Fees_status_model extends CI_Model
else{ else{
$result_array['feesStatus']=false; $result_array['feesStatus']=false;
} }
return $result_array; return $result_array;
} }
@ -729,6 +752,68 @@ class Fees_status_model extends CI_Model
} }
/*
* get batch details
* created by kms
* */
public function getBatchDetails($batchCode=null,$courseID=null,$studentID=null,$feesType=null){
if($batchCode=='' OR $batchCode==null){
$this->db->select('BA.BatchCode,BA.BatchName,BA.BatchDate,US.UniversityID,US.UniversityName,BA.IsActive');
$this->db->from(COURSE.' as CU');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID');
$this->db->join(BATCH.' as BA', 'BA.UniversityID = US.UniversityID');
$this->db->order_by('BA.CreatedOn','DESC');
$this->db->where('CU.CourseID',$courseID);
$this->db->where('BA.IsActive','1');
$batchDetails = $this->db->get();
if($batchDetails->result()){
return $batchDetails->result();
}
else {
return false;
}
}
else{
$this->db->distinct();
$this->db->select('BA.BatchCode,BA.BatchName,BA.BatchDate,US.UniversityID,US.UniversityName,BA.IsActive');
$this->db->from(COURSE.' as CU');
$this->db->join(STUDENTS_FEES_STATUS.' as STF', 'STF.CourseID = CU.CourseID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID');
$this->db->join(BATCH.' as BA', 'BA.UniversityID = US.UniversityID');
$this->db->order_by('BA.CreatedOn','DESC');
$this->db->where('CU.CourseID',$courseID);
$this->db->where('STF.StudentID',$studentID);
$this->db->where('STF.FeesType',$feesType);
$batchDetails = array();
/* $this->db->or_where('BA.IsActive','1');
$this->db->or_where('STF.BatchCode =',$batchCode);*/
$existDetails = $this->db->get();
if($existDetails->result()){
foreach ($existDetails->result() as $row){
if($row->IsActive=='1' || $row->BatchCode==$batchCode){
array_push($batchDetails,$row);
}
}
}
if($batchDetails){
return $batchDetails;
}
else {
return false;
}
}
}
/* /*
* get default pc,tc,dc,mc,other fees * get default pc,tc,dc,mc,other fees
* created by kms * created by kms
@ -803,6 +888,7 @@ class Fees_status_model extends CI_Model
} }
$CourseFeesArray1[]=$fetchData; $CourseFeesArray1[]=$fetchData;
} }
@ -948,31 +1034,92 @@ class Fees_status_model extends CI_Model
* insert day book master while fees update * insert day book master while fees update
* created by kms * created by kms
* */ * */
public function insertDayBookMaster($data=null){ public function insertDayBookMaster($data=null,$paymentID){
$insertArray['Date'] = $data['BillDate']; if($data['ModeOfPayment']=='CASH'){
$insertArray['CreatedBy'] = $data['CreatedBy']; $insertArray['Date'] = $data['BillDate'];
$insertArray['CreatedOn'] = $data['CreatedOn']; $insertArray['CreatedBy'] = $data['CreatedBy'];
$insertArray['Description'] = $data['InternalComments']; $insertArray['CreatedOn'] = $data['CreatedOn'];
$insertArray['Amount'] = $data['BillAmount']; $insertArray['Description'] = $data['InternalComments'];
$insertArray['Status'] = 'Approved'; $insertArray['Amount'] = $data['BillAmount'];
$insertArray['Status'] = 'Approved';
$insertArray['PaymentStatus'] = false;
$insertArray['FeesPaymentID'] = $paymentID;
$insertArray['BranchCode'] = $data['UpdatedBy']; $insertArray['BranchCode'] = $data['UpdatedBy'];
$this->db->select('ID,TypeID'); $this->db->select('ID,TypeID');
$this->db->where('TypeID', 'I002'); $this->db->where('TypeID', 'I002');
$this->db->where('TypeName', 'FEES'); $this->db->where('TypeName', 'FEES');
$getIncome=$this->db->get(INCOMEOUTCOMEMASTER)->last_row(); $getIncome=$this->db->get(INCOMEOUTCOMEMASTER)->last_row();
if($getIncome){
$insertArray['Name'] = $getIncome->TypeID;
$insertArray['Type'] = $getIncome->ID;
$this->db->insert(DAYBOOKMASTER, $insertArray);
return true;
}
else{
return true;
}
if($getIncome){
$insertArray['Name'] = $getIncome->TypeID;
$insertArray['Type'] = $getIncome->ID;
$this->db->insert(DAYBOOKMASTER, $insertArray);
return true;
} }
else{ else{
// this is for income entry
$insertArray['Date'] = $data['BillDate'];
$insertArray['CreatedBy'] = $data['CreatedBy'];
$insertArray['CreatedOn'] = $data['CreatedOn'];
$insertArray['Description'] = $data['InternalComments'];
$insertArray['Amount'] = $data['BillAmount'];
$insertArray['Status'] = 'Approved';
$insertArray['PaymentStatus'] = false;
$insertArray['FeesPaymentID'] = $paymentID;
$insertArray['BranchCode'] = $data['UpdatedBy'];
$this->db->select('ID,TypeID');
$this->db->where('TypeID', 'I002');
$this->db->where('TypeName', 'FEES');
$getIncome=$this->db->get(INCOMEOUTCOMEMASTER)->last_row();
if($getIncome){
$insertArray['Name'] = $getIncome->TypeID;
$insertArray['Type'] = $getIncome->ID;
$this->db->insert(DAYBOOKMASTER, $insertArray);
}
// this is for expense come entry
$expenseArray['Date'] = $data['BillDate'];
$expenseArray['CreatedBy'] = $data['CreatedBy'];
$expenseArray['CreatedOn'] = $data['CreatedOn'];
$expenseArray['Description'] = $data['InternalComments'];
$expenseArray['Amount'] = $data['BillAmount'];
$expenseArray['Status'] = 'Approved';
$expenseArray['PaymentStatus'] = false;
$expenseArray['FeesPaymentID'] = $paymentID;
$expenseArray['BranchCode'] = $data['UpdatedBy'];
$this->db->select('ID,TypeID');
$this->db->where('TypeID', 'I001');
$this->db->where('TypeName', 'FEES');
$getOutcome=$this->db->get(INCOMEOUTCOMEMASTER)->last_row();
if($getOutcome){
$expenseArray['Name'] = $getOutcome->TypeID;
$expenseArray['Type'] = $getOutcome->ID;
$this->db->insert(DAYBOOKMASTER, $expenseArray);
}
return true; return true;
} }
} }
/* /*
* send notification for student * send notification for student

View File

@ -3,7 +3,7 @@
* controllers for ng-table * controllers for ng-table
* Simple table with sorting and filtering on AngularJS * Simple table with sorting and filtering on AngularJS
*/ */
app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", "installmentService", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state,installmentService) {
$scope.myModel = { $scope.myModel = {
"studentName": "", "studentName": "",
"mobileNumber": "", "mobileNumber": "",
@ -11,6 +11,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
"courseName":"" "courseName":""
}; };
$rootScope.userType = JSON.parse(localStorage.getItem('localObj')).localType; $rootScope.userType = JSON.parse(localStorage.getItem('localObj')).localType;
/* /*
* updateModel default value * updateModel default value
@ -28,32 +29,49 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}; };
/* /*
* set model * set model
* */ * */
$scope.setModel = { $scope.setModel = {
"feesType": "", "feesType": "",
}; };
/* /*
* get payment options * get payment options
* */ * */
$scope.paymentOptions = [
{
"paymentOn":"CASH"
},
{
"paymentOn":"CHEQUE"
},
{
"paymentOn":"NEFT"
},
{
"paymentOn":"CASH DEPOSIT"
}
]; if(JSON.parse(localStorage.getItem('localObj')).localType=='R002' && JSON.parse(localStorage.getItem('localObj')).is_DayBookApproval_Access==0){
$scope.paymentOptions = [
{
"paymentOn":"CASH"
},
];
}
else{
$scope.paymentOptions = [
{
"paymentOn":"CASH"
},
{
"paymentOn":"CHEQUE"
},
{
"paymentOn":"REFERRAL"
},
{
"paymentOn":"ONLINE TRANSACTION"
},
{
"paymentOn":"WAIVER"
},
];
}
// sorting function for table params // sorting function for table params
$scope.sort = function(keyname){ $scope.sort = function(keyname){
$scope.sortKey = keyname; //set the sortKey to the param passed $scope.sortKey = keyname; //set the sortKey to the param passed
@ -163,6 +181,8 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
* */ * */
$scope.viewId=-1; $scope.viewId=-1;
$scope.setFees = function (p) { $scope.setFees = function (p) {
$scope.BatchDate ='';
$scope.editId=-1; $scope.editId=-1;
$scope.getStudentSetFees(p.ID,p.CourseID,p.StudentID); $scope.getStudentSetFees(p.ID,p.CourseID,p.StudentID);
$scope.viewId=p.ID; $scope.viewId=p.ID;
@ -277,9 +297,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
/* /*
* set fees for student * set fees for student
* */ * */
$scope.submitFeesForStudent = function (myModel, form,updateModel, loading,installment) { $scope.submitFeesForStudent = function (myModel, form,updateModel, loading) {
var firstError = null; var firstError = null;
if (form.$invalid) { if (form.$invalid) {
var field = null, firstError = null; var field = null, firstError = null;
@ -296,15 +314,15 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
} }
angular.element('.ng-invalid[name=' + firstError + ']').focus(); angular.element('.ng-invalid[name=' + firstError + ']').focus();
} else { } else {
if(isNaN(installment.date)){ /* if(isNaN(installment.date)){
$scope.pushDueDate1= $rootScope.lastInstallemtDate; $scope.pushDueDate1= $rootScope.lastInstallemtDate;
} }
else{ else{
$scope.convertGetDate1=new Date(installment.date).toDateString(); $scope.convertGetDate1=new Date(installment.date).toDateString();
$scope.pushDueDate1 = $filter('date')(new Date($scope.convertGetDate1), 'dd-MM-yyyy'); $scope.pushDueDate1 = $filter('date')(new Date($scope.convertGetDate1), 'dd-MM-yyyy');
} }*/
if(installment.ID !='' && installment.ID !==null && installment.ID !=undefined){ /* if(installment.ID !='' && installment.ID !==null && installment.ID !=undefined){
$rootScope.updateMoreItems.push({ $rootScope.updateMoreItems.push({
ID: installment.ID, ID: installment.ID,
Name: installment.name, Name: installment.name,
@ -319,7 +337,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
Amount: installment.amount, Amount: installment.amount,
DueDate: $scope.pushDueDate1 DueDate: $scope.pushDueDate1
}); });
} }*/
angular.forEach($rootScope.updateMoreItems, function (value, key) { angular.forEach($rootScope.updateMoreItems, function (value, key) {
if(isNaN(value.DueDate)){ if(isNaN(value.DueDate)){
@ -332,7 +350,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$rootScope.updateMoreItems[key].DueDate=$scope.pushDueDate2; $rootScope.updateMoreItems[key].DueDate=$scope.pushDueDate2;
} }
}); });
$scope.ldloading5 = {}; $scope.ldloading5 = {};
$scope.ldloading5[loading.replace('-', '_')] = true; $scope.ldloading5[loading.replace('-', '_')] = true;
@ -355,7 +372,8 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
session: updateModel.SessionName, session: updateModel.SessionName,
rollNo: updateModel.RollNo, rollNo: updateModel.RollNo,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
installmentItems:$rootScope.updateMoreItems installmentItems:$rootScope.updateMoreItems,
batchCode:updateModel.BatchCode,
} }
}; };
@ -441,7 +459,10 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
* get student set fees details * get student set fees details
* */ * */
$scope.feesStructureInfo=""; $scope.feesStructureInfo="";
$scope.BatchDetails=[];
$scope.getStudentSetFees = function (ID,courseID,studeID) { $scope.getStudentSetFees = function (ID,courseID,studeID) {
$scope.BatchDetails=[];
$scope.feesStructureInfo=""; $scope.feesStructureInfo="";
$scope.myModelInstallemt.ID=""; $scope.myModelInstallemt.ID="";
$scope.myModelInstallemt.name=""; $scope.myModelInstallemt.name="";
@ -464,30 +485,56 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}; };
$http(setFees).then(function (response) { $http(setFees).then(function (response) {
if (response.data.status==200 && response.data.feesStatus) { if (response.data.status==200 && response.data.feesStatus) {
$scope.feesStructureInfo=response.data.feesDetails; $scope.feesStructureInfo=response.data.feesDetails;
$scope.setModel = { $scope.setModel = {
"feesType": $scope.feesStructureInfo[0], "feesType": $scope.feesStructureInfo[0],
}; };
$scope.setTotalAmount=$scope.feesStructureInfo[0].PayableFees; angular.forEach($scope.feesStructureInfo[0].batchDetails,function (values,key) {
$scope.BatchDetails.push({
"BatchCode":values.BatchCode,
"BatchName":values.BatchName + '-'+ values.BatchCode,
"BatchDate":values.BatchDate
})
});
$scope.setTotalAmount=$scope.feesStructureInfo[0].PayableFees;
$rootScope.updateMoreItems=[]; $rootScope.updateMoreItems=[];
if($scope.feesStructureInfo[0].InstallmentDetails != ''){ if($scope.feesStructureInfo[0].InstallmentDetails == '') {
$scope.myModelInstallemt.ID=$scope.feesStructureInfo[0].InstallmentDetails[$scope.feesStructureInfo[0].InstallmentDetails.length-1].ID; $scope.setModel.feesType.BatchCode = $scope.feesStructureInfo[0].batchDetails[0].BatchCode;
$scope.BatchDate = new Date($scope.feesStructureInfo[0].batchDetails[0].BatchDate.substring(6,10)+'-'+$scope.feesStructureInfo[0].batchDetails[0].BatchDate.substring(3,5)+'-'+$scope.feesStructureInfo[0].batchDetails[0].BatchDate.substring(0,2));
$scope.calculateInstallemnts($scope.feesStructureInfo[0],$scope.setTotalAmount,0,'1');
}
else {
/* $scope.myModelInstallemt.ID=$scope.feesStructureInfo[0].InstallmentDetails[$scope.feesStructureInfo[0].InstallmentDetails.length-1].ID;
$scope.myModelInstallemt.name=$scope.feesStructureInfo[0].InstallmentDetails[$scope.feesStructureInfo[0].InstallmentDetails.length-1].Name; $scope.myModelInstallemt.name=$scope.feesStructureInfo[0].InstallmentDetails[$scope.feesStructureInfo[0].InstallmentDetails.length-1].Name;
$scope.myModelInstallemt.amount=$scope.feesStructureInfo[0].InstallmentDetails[$scope.feesStructureInfo[0].InstallmentDetails.length-1].Amount; $scope.myModelInstallemt.amount=$scope.feesStructureInfo[0].InstallmentDetails[$scope.feesStructureInfo[0].InstallmentDetails.length-1].Amount;
$scope.myModelInstallemt.date=$scope.feesStructureInfo[0].InstallmentDetails[$scope.feesStructureInfo[0].InstallmentDetails.length-1].DueDate; $scope.myModelInstallemt.date=$scope.feesStructureInfo[0].InstallmentDetails[$scope.feesStructureInfo[0].InstallmentDetails.length-1].DueDate;
$rootScope.lastInstallemtDate = $scope.myModelInstallemt.date; $rootScope.lastInstallemtDate = $scope.myModelInstallemt.date;*/
for(var i=0; i < $scope.feesStructureInfo[0].InstallmentDetails.length-1; i++){ for(var i=0; i < $scope.feesStructureInfo[0].InstallmentDetails.length; i++){
$rootScope.updateMoreItems.push($scope.feesStructureInfo[0].InstallmentDetails[i]); $rootScope.updateMoreItems.push($scope.feesStructureInfo[0].InstallmentDetails[i]);
$scope.getDateArray.push({
"Date":new Date($scope.feesStructureInfo[0].InstallmentDetails[i].DueDate.substring(6,10)+'-'+$scope.feesStructureInfo[0].InstallmentDetails[i].DueDate.substring(3,5)+'-'+$scope.feesStructureInfo[0].InstallmentDetails[i].DueDate.substring(0,2))
});
} }
$scope.setModel.feesType.BatchCode = $scope.feesStructureInfo[0].BatchCode;
} }
$scope.dateValidations();
} else { } else {
$scope.feesStructureInfo=""; $scope.feesStructureInfo="";
$scope.setModel = { $scope.setModel = {
@ -500,6 +547,15 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
} }
/*
* change batch details
* createdcby kms
* */
$scope.changeBatch = function (Details) {
$scope.setFeesTotalAmount(Details,'2','2');
}
$scope.cancel = function () { $scope.cancel = function () {
$scope.editId=-1; $scope.editId=-1;
@ -523,7 +579,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}; };
$rootScope.updateMoreItems=[]; $rootScope.updateMoreItems=[];
$rootScope.clickMoreItems = function (model,form,setModel) { $rootScope.clickMoreItems = function (form,setModel) {
$scope.convertGetDate=''; $scope.convertGetDate='';
var firstError = null; var firstError = null;
if (form.$invalid) { if (form.$invalid) {
@ -544,19 +600,29 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
} }
else { else {
if(isNaN(model.date)){ if(isNaN($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate)){
$scope.pushDueDate= $rootScope.lastInstallemtDate; $scope.pushDueDate= $rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate;
} }
else{ else{
$scope.convertGetDate=new Date(model.date).toDateString(); $scope.convertGetDate=new Date($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate).toDateString();
$scope.pushDueDate = $filter('date')(new Date($scope.convertGetDate), 'dd-MM-yyyy'); $scope.pushDueDate = $filter('date')(new Date($scope.convertGetDate), 'dd-MM-yyyy');
} }
if(model.ID !='' && model.ID !==null && model.ID !=undefined){ var MoreInsAmt= Math.round($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount * 50 / 100);
var afterMoreInsAmt = parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount)-parseInt(MoreInsAmt);
$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount = MoreInsAmt;
$rootScope.updateMoreItems.push({
ID:"",
Name: installmentService.installmentWords($rootScope.updateMoreItems.length+1),
Amount: MoreInsAmt,
DueDate: $scope.pushDueDate
});
/*if(model.ID !='' && model.ID !==null && model.ID !=undefined){
$rootScope.updateMoreItems.push({ $rootScope.updateMoreItems.push({
ID:model.ID, ID:model.ID,
Name: model.name, Name: model.name,
Amount: model.amount, Amount: MoreInsAmt,
DueDate: $scope.pushDueDate DueDate: $scope.pushDueDate
}); });
} }
@ -564,80 +630,619 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$rootScope.updateMoreItems.push({ $rootScope.updateMoreItems.push({
ID:"", ID:"",
Name: model.name, Name: model.name,
Amount: model.amount, Amount: MoreInsAmt,
DueDate: $scope.pushDueDate DueDate: $scope.pushDueDate
}); });
} }*/
$scope.myModelInstallemt.ID=""; /* $scope.myModelInstallemt.ID="";
$scope.myModelInstallemt.name=""; $scope.myModelInstallemt.name=installmentService.installmentWords($rootScope.updateMoreItems.length+1);
$scope.myModelInstallemt.amount=""; $scope.myModelInstallemt.amount=parseInt(afterMoreInsAmt);
$scope.myModelInstallemt.date=""; $scope.myModelInstallemt.date=$scope.pushDueDate;*/
$scope.dateValidations();
} }
} }
/* /*
* change installment values * change installment values
* */ * */
$scope.changeInstallemt = function (model,form) { $scope.changeInstallemt = function (model,form) {
if(model.Sem_Year!='TC' && model.Sem_Year!='PC' && model.Sem_Year!='DC' && model.Sem_Year!='MC' && model.Sem_Year!='OTHER'){
$scope.BatchDetails=[];
$rootScope.updateMoreItems=[]; $rootScope.updateMoreItems=[];
angular.forEach(model.batchDetails,function (values,key) {
$scope.BatchDetails.push({
"BatchCode":values.BatchCode,
"BatchName":values.BatchName + '-'+ values.BatchCode,
"BatchDate":values.BatchDate
})
});
if(model.InstallmentDetails != ''){ if(model.InstallmentDetails != ''){
$scope.myModelInstallemt.ID=model.InstallmentDetails[model.InstallmentDetails.length-1].ID; /*$scope.myModelInstallemt.ID=model.InstallmentDetails[model.InstallmentDetails.length-1].ID;
$scope.myModelInstallemt.name=model.InstallmentDetails[model.InstallmentDetails.length-1].Name; $scope.myModelInstallemt.name=model.InstallmentDetails[model.InstallmentDetails.length-1].Name;
$scope.myModelInstallemt.amount=model.InstallmentDetails[model.InstallmentDetails.length-1].Amount; $scope.myModelInstallemt.amount=model.InstallmentDetails[model.InstallmentDetails.length-1].Amount;
$scope.myModelInstallemt.date=model.InstallmentDetails[model.InstallmentDetails.length-1].DueDate; $scope.myModelInstallemt.date=model.InstallmentDetails[model.InstallmentDetails.length-1].DueDate;
$rootScope.lastInstallemtDate = $scope.myModelInstallemt.date; $rootScope.lastInstallemtDate = $scope.myModelInstallemt.date;*/
for(var i=0; i < model.InstallmentDetails.length-1; i++){ for(var i=0; i < model.InstallmentDetails.length; i++){
$rootScope.updateMoreItems.push(model.InstallmentDetails[i]); $rootScope.updateMoreItems.push(model.InstallmentDetails[i]);
}
$scope.setModel.feesType.BatchCode = model.BatchCode;
angular.forEach($rootScope.updateMoreItems,function (values,key) {
if(values.DueDate.length>10 || values.DueDate.length==undefined){
$rootScope.updateMoreItems[key].DueDate = $filter('date')(values.DueDate,'dd-MM-yyyy');
}
});
} }
} else{
else{ $scope.setModel.feesType.BatchCode = $scope.BatchDetails[0].BatchCode;
$scope.myModelInstallemt.ID=""; $scope.BatchDate = new Date($scope.BatchDetails[0].BatchDate.substring(6,10)+'-'+$scope.BatchDetails[0].BatchDate.substring(3,5)+'-'+$scope.BatchDetails[0].BatchDate.substring(0,2));
$scope.myModelInstallemt.name="";
$scope.myModelInstallemt.amount=""; /* $scope.myModelInstallemt.ID="";
$scope.myModelInstallemt.date=""; $scope.myModelInstallemt.name="";
$rootScope.lastInstallemtDate=""; $scope.myModelInstallemt.amount="";
} $scope.myModelInstallemt.date="";
$scope.setFeesTotalAmount(model); $rootScope.lastInstallemtDate="";*/
$rootScope.updateMoreItems=[];
}
$scope.setFeesTotalAmount(model,'1','2');
}
else{
$scope.setFeesTotalAmount(model,'3','1');
}
form.$setPristine(true); form.$setPristine(true);
} }
$scope.setTotalAmount=''; $scope.setTotalAmount='';
/* /*
* get set fees total amount * get set fees total amount
* */ * */
$scope.setFeesTotalAmount = function (values) { $scope.setFeesTotalAmount = function (values,type,type1) {
if(values.ActualFees=='' || values.ActualFees==null || values.ActualFees==undefined){
$scope.actFees=0; if(type==3 || values.Sem_Year=='TC' || values.Sem_Year=='PC' || values.Sem_Year=='DC' || values.Sem_Year=='MC' || values.Sem_Year=='OTHER'){
} if(values.ActualFees=='' || values.ActualFees==null || values.ActualFees==undefined){
else{ $scope.actFees=0;
$scope.actFees=values.ActualFees; }
} else{
if(values.Others=='' || values.Others==null || values.Others==undefined){ $scope.actFees=values.ActualFees;
$scope.othersFees=0; }
} if(values.Others=='' || values.Others==null || values.Others==undefined){
else{ $scope.othersFees=0;
$scope.othersFees=values.Others; }
} else{
if(values.STFOrWR=='' || values.STFOrWR==null || values.STFOrWR==undefined){ $scope.othersFees=values.Others;
$scope.stfFees=0; }
} if(values.STFOrWR=='' || values.STFOrWR==null || values.STFOrWR==undefined){
else{ $scope.stfFees=0;
$scope.stfFees=values.STFOrWR; }
} else{
if(values.Waiver=='' || values.Waiver==null || values.Waiver==undefined){ $scope.stfFees=values.STFOrWR;
$scope.wiverFees=0; }
} if(values.Waiver=='' || values.Waiver==null || values.Waiver==undefined){
else{ $scope.wiverFees=0;
$scope.wiverFees=values.Waiver; }
else{
$scope.wiverFees=values.Waiver;
}
$scope.setTotalAmount= parseInt($scope.actFees) + parseInt($scope.stfFees) + parseInt($scope.othersFees) - parseInt($scope.wiverFees);
$scope.setModel.feesType.BatchCode = "Nill";
$rootScope.updateMoreItems=[];
} }
$scope.setTotalAmount= parseInt($scope.actFees) + parseInt($scope.stfFees) + parseInt($scope.othersFees) - parseInt($scope.wiverFees); else{
angular.forEach(values.batchDetails,function (values1,key) {
if(values1.BatchCode==values.BatchCode){
$scope.BatchDate = new Date(values1.BatchDate.substring(6,10)+'-'+values1.BatchDate.substring(3,5)+'-'+values1.BatchDate.substring(0,2));
}
});
if(type=='1'){
if(values.ActualFees=='' || values.ActualFees==null || values.ActualFees==undefined){
$scope.actFees=0;
}
else{
$scope.actFees=values.ActualFees;
}
if(values.Others=='' || values.Others==null || values.Others==undefined){
$scope.othersFees=0;
}
else{
$scope.othersFees=values.Others;
}
if(values.STFOrWR=='' || values.STFOrWR==null || values.STFOrWR==undefined){
$scope.stfFees=0;
}
else{
$scope.stfFees=values.STFOrWR;
}
if(values.Waiver=='' || values.Waiver==null || values.Waiver==undefined){
$scope.wiverFees=0;
}
else{
$scope.wiverFees=values.Waiver;
}
$scope.setTotalAmount= parseInt($scope.actFees) + parseInt($scope.stfFees) + parseInt($scope.othersFees) - parseInt($scope.wiverFees);
if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length==0){
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
}
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1);
}
else{
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1);
}
}
else{
if(values.ActualFees=='' || values.ActualFees==null || values.ActualFees==undefined){
$scope.actFees=0;
}
else{
$scope.actFees=values.ActualFees;
}
if(values.Others=='' || values.Others==null || values.Others==undefined){
$scope.othersFees=0;
}
else{
$scope.othersFees=values.Others;
}
if(values.STFOrWR=='' || values.STFOrWR==null || values.STFOrWR==undefined){
$scope.stfFees=0;
}
else{
$scope.stfFees=values.STFOrWR;
}
if(values.Waiver=='' || values.Waiver==null || values.Waiver==undefined){
$scope.wiverFees=0;
}
else{
$scope.wiverFees=values.Waiver;
}
$scope.setTotalAmount= parseInt($scope.actFees) + parseInt($scope.stfFees) + parseInt($scope.othersFees) - parseInt($scope.wiverFees);
if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length==0){
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
}
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1);
}
else{
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1);
}
}
}
}
/*
* calculate installments
* created by kms
* */
$scope.calculateInstallemnts =function (model,totAmt,other,type) {
// $scope.setTotalAmount=totAmt;
$rootScope.updateMoreItems=[];
var cDate = moment();
var bDate = moment($scope.BatchDate);
var startPayableAmt = parseInt(totAmt);
for (var i = 1; i <= 2; i++) {
if (i == 1) {
if (cDate <= bDate) {
var percentage = Math.round(startPayableAmt * 70 / 100);
percentage = Math.round(percentage / 10) * 10;
startPayableAmt = startPayableAmt - percentage;
$scope.insFirstDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
var dayDiff2 = moment(bDate).diff(cDate, 'days');
if (dayDiff2 > 30) {
$scope.insSecondDate = moment($scope.BatchDate).subtract(30, 'days');
$scope.insSecondDate = $filter('date')(new Date($scope.insSecondDate), 'dd-MM-yyyy');
}
else if (dayDiff2 > 15 && dayDiff2 <= 30) {
$scope.insSecondDate = moment($scope.BatchDate).subtract(15, 'days');
$scope.insSecondDate = $filter('date')(new Date($scope.insSecondDate), 'dd-MM-yyyy');
}
else {
$scope.insSecondDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
}
}
else {
var dayDiff = moment().diff(bDate, 'days');
var todatlFineAmt = 0;
var fineAmt1 = 0;
var fineAmt2 = 0;
var fineAmt3 = 0;
var fineAmt4 = 0;
var fineAmt5 = 0;
var fineAmt6 = 0;
var fineAmt7 = 0;
var fineAmt8 = 0;
var fineAmt9 = 0;
var fineAmt10 = 0;
var fineAmt11 = 0;
for (var k = 1; k <= dayDiff; k++) {
if (k <= 90) {
if (startPayableAmt <= 10000) {
fineAmt1 = 300;
}
else if ((startPayableAmt > 10000) && (startPayableAmt <= 20000)) {
fineAmt1 = 600;
}
else if (startPayableAmt > 30000) {
fineAmt1 = 900;
}
}
else if (k > 90) {
if (k > 90 && k <= 120) {
fineAmt2 = 300;
}
else if (k > 120 && k <= 150) {
fineAmt3 = 300;
}
else if (k > 150 && k <= 180) {
fineAmt4 = 300;
}
else if (k > 180 && k <= 210) {
fineAmt5 = 300;
}
else if (k > 210 && k <= 240) {
fineAmt6 = 300;
}
else if (k > 240 && k <= 270) {
fineAmt7 = 300;
}
else if (k > 270 && k <= 300) {
fineAmt8 = 300;
}
else if (k > 300 && k <= 330) {
fineAmt9 = 300;
}
else if (k > 330 && k <= 360) {
fineAmt10 = 300;
}
else {
fineAmt11 = 300;
}
}
}
todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt2) + parseInt(fineAmt3) + parseInt(fineAmt4) + parseInt(fineAmt5) + parseInt(fineAmt6) + parseInt(fineAmt7) + parseInt(fineAmt8) + parseInt(fineAmt9) + parseInt(fineAmt10) + parseInt(fineAmt11);
if(type=='1'){
$scope.setTotalAmount = Math.round(parseInt(totAmt) + parseInt(todatlFineAmt)-parseInt(other));
$scope.setModel.feesType.Others = Math.round(parseInt(todatlFineAmt));
}
else{
$scope.setTotalAmount = Math.round(parseInt(totAmt));
if(other==0){
$scope.setModel.feesType.Others = '';
}
else{
$scope.setModel.feesType.Others = Math.round(parseInt(other));
}
}
startPayableAmt = parseInt($scope.setTotalAmount);
var percentage = Math.round(startPayableAmt * 70 / 100);
percentage = Math.round(percentage / 10) * 10;
startPayableAmt = startPayableAmt - percentage;
$scope.insFirstDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
$scope.insSecondDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
}
$scope.updateMoreItems.push({
ID: "",
Name: installmentService.installmentWords(i),
Amount: percentage,
DueDate: $scope.insFirstDate
});
}
else {
startPayableAmt = Math.round(startPayableAmt / 10) * 10;
$scope.updateMoreItems.push({
ID: "",
Name: installmentService.installmentWords(i),
Amount: startPayableAmt,
DueDate: $scope.insSecondDate
});
/* $scope.myModelInstallemt.ID = "";
$scope.myModelInstallemt.name = installmentService.installmentWords(i);
$scope.myModelInstallemt.amount = startPayableAmt;
$scope.myModelInstallemt.date = $scope.insSecondDate;
$rootScope.lastInstallemtDate = $scope.myModelInstallemt.date;*/
}
}
$scope.dateValidations();
}
/*
* calculate exist installment
* created by kms
* */
$scope.calculateInstallemntsExist = function (model,totAmt,other,type,type1) {
var exBatchDate = moment($scope.BatchDate);
if(type==2 || type==1){
if($rootScope.updateMoreItems.length>0){
var exDatenew1;
var exDatenew2;
var exitPayAmt=parseInt(totAmt-other);
if(isNaN(moment($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate))){
exDatenew1 = new Date($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate.substring(6,10)+'-'+$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate.substring(3,5)+'-'+$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate.substring(0,2));
exDatenew1 = moment(exDatenew1);
}
else{
exDatenew1 = moment($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate);
}
if (exDatenew1 <= exBatchDate) {
if(type=='1'){
$scope.setTotalAmount = Math.round(parseInt(totAmt)-parseInt(other));
// $scope.setModel.feesType.Others = Math.round(parseInt(other));
$scope.setModel.feesType.Others = '';
}
else{
if(other==0){
$scope.setModel.feesType.Others = '';
$scope.setTotalAmount = Math.round(parseInt(totAmt)-parseInt(other));
}
else{
$scope.setTotalAmount = Math.round(parseInt(totAmt)-parseInt(other));
$scope.setModel.feesType.Others = '';
}
}
var existPercentage = Math.round($scope.setTotalAmount * 70 / 100);
existPercentage = Math.round(existPercentage / 10) * 10;
exitPayAmt = parseInt($scope.setTotalAmount)-parseInt(existPercentage);
$rootScope.updateMoreItems[0].Amount = existPercentage;
$rootScope.updateMoreItems[1].Amount = exitPayAmt;
if($rootScope.updateMoreItems.length>2){
angular.forEach($rootScope.updateMoreItems,function (values,key) {
if(key>=1 && $rootScope.updateMoreItems.length-1!=key){
var currentElementAmt = $rootScope.updateMoreItems[key].Amount;
var dividePrevElementAmt = Math.round(currentElementAmt * 50 / 100);
var divideNextElementAmt = parseInt(currentElementAmt)-parseInt(dividePrevElementAmt);
$rootScope.updateMoreItems[key].Amount = dividePrevElementAmt;
$rootScope.updateMoreItems[key+1].Amount = dividePrevElementAmt;
}
});
}
}
else if(exDatenew1 > exBatchDate){
var dayDiff = exDatenew1.diff(exBatchDate, 'days');
dayDiff = dayDiff+1;
var todatlFineAmt = 0;
var fineAmt1 = 0;
var fineAmt2 = 0;
var fineAmt3 = 0;
var fineAmt4 = 0;
var fineAmt5 = 0;
var fineAmt6 = 0;
var fineAmt7 = 0;
var fineAmt8 = 0;
var fineAmt9 = 0;
var fineAmt10 = 0;
var fineAmt11 = 0;
for (var k = 1; k <= dayDiff; k++) {
if (k <= 90) {
if (exitPayAmt <= 10000) {
fineAmt1 = 300;
}
else if ((exitPayAmt > 10000) && (exitPayAmt <= 20000)) {
fineAmt1 = 600;
}
else if (exitPayAmt > 30000) {
fineAmt1 = 900;
}
}
else if (k > 90) {
if (k > 90 && k <= 120) {
fineAmt2 = 300;
}
else if (k > 120 && k <= 150) {
fineAmt3 = 300;
}
else if (k > 150 && k <= 180) {
fineAmt4 = 300;
}
else if (k > 180 && k <= 210) {
fineAmt5 = 300;
}
else if (k > 210 && k <= 240) {
fineAmt6 = 300;
}
else if (k > 240 && k <= 270) {
fineAmt7 = 300;
}
else if (k > 270 && k <= 300) {
fineAmt8 = 300;
}
else if (k > 300 && k <= 330) {
fineAmt9 = 300;
}
else if (k > 330 && k <= 360) {
fineAmt10 = 300;
}
else {
fineAmt11 = 300;
}
}
}
todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt2) + parseInt(fineAmt3) + parseInt(fineAmt4) + parseInt(fineAmt5) + parseInt(fineAmt6) + parseInt(fineAmt7) + parseInt(fineAmt8) + parseInt(fineAmt9) + parseInt(fineAmt10) + parseInt(fineAmt11);
if(type1=='2'){
$scope.setTotalAmount = Math.round(parseInt(totAmt) -parseInt(other) + parseInt(todatlFineAmt));
$scope.setModel.feesType.Others = Math.round(parseInt(todatlFineAmt));
}
else{
$scope.setTotalAmount = Math.round(parseInt(totAmt));
if(other==0){
$scope.setModel.feesType.Others = '';
}
else{
$scope.setModel.feesType.Others = Math.round(parseInt(other));
}
}
exitPayAmt = parseInt($scope.setTotalAmount);
var existPercentage = Math.round(exitPayAmt * 70 / 100);
existPercentage = Math.round(existPercentage / 10) * 10;
exitPayAmt = parseInt(exitPayAmt)-parseInt(existPercentage);
$rootScope.updateMoreItems[0].Amount = existPercentage;
$rootScope.updateMoreItems[1].Amount = exitPayAmt;
if($rootScope.updateMoreItems.length>2){
angular.forEach($rootScope.updateMoreItems,function (values,key) {
if(key>=1 && $rootScope.updateMoreItems.length-1!=key){
var currentElementAmt = $rootScope.updateMoreItems[key].Amount;
var dividePrevElementAmt = Math.round(currentElementAmt * 50 / 100);
var divideNextElementAmt = parseInt(currentElementAmt)-parseInt(dividePrevElementAmt);
$rootScope.updateMoreItems[key].Amount = dividePrevElementAmt;
$rootScope.updateMoreItems[key+1].Amount = dividePrevElementAmt;
}
});
}
}
}
}
$scope.dateValidations();
}
$scope.getDateArray = [];
/*
* validate installment date
* */
$scope.dateValidations = function () {
$scope.getDateArray = [];
$scope.getDateArray=[
{
"Date":''
}
];
angular.forEach($rootScope.updateMoreItems,function (values,key) {
if(values.DueDate.length==10){
$scope.getDateArray.push({
"Date":new Date(values.DueDate.substring(6,10)+'-'+values.DueDate.substring(3,5)+'-'+values.DueDate.substring(0,2))
})
}
else{
$scope.getDateArray.push({
"Date":values.DueDate
})
}
});
$scope.getDateArray.push({
"Date":''
})
} }

View File

@ -30,6 +30,36 @@
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.setfeesType.$dirty && Form.setfeesType.$invalid">Fees type is required</span> ng-if="Form.setfeesType.$dirty && Form.setfeesType.$invalid">Fees type is required</span>
</div> </div>
<div class="col-md-3 form-group"
ng-class="{'has-error':Form.batchCode.$dirty && Form.batchCode.$invalid, 'has-success':Form.batchCode.$valid}" ng-if="setModel.feesType.Sem_Year!='TC' && setModel.feesType.Sem_Year!='PC' && setModel.feesType.Sem_Year!='DC' && setModel.feesType.Sem_Year!='MC' && setModel.feesType.Sem_Year!='OTHER'">
<label>
Batch <span class="symbol required"></span>
</label>
<select class="form-control" name="batchCode" tabindex="8" id="batchCode"
ng-model="setModel.feesType.BatchCode"
ng-options="batch.BatchCode as batch.BatchName for batch in BatchDetails" ng-click="changeBatch(setModel.feesType);" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"
required>
<option value=""> Select Batch</option>
</select>
<span class="error text-small block"
ng-if="Form.batchCode.$dirty && Form.batchCode.$invalid">Batch is required</span>
</div>
<div class="col-md-3 form-group" ng-if="setModel.feesType.Sem_Year=='TC' || setModel.feesType.Sem_Year=='PC' || setModel.feesType.Sem_Year=='DC' || setModel.feesType.Sem_Year=='MC' || setModel.feesType.Sem_Year=='OTHER'">
<label>
Batch
</label>
<!--<select class="form-control" name="batchCode" tabindex="8" id="batchCode"
ng-model="setModel.feesType.BatchCode"
ng-options="batch.BatchCode as batch.BatchName for batch in BatchDetails" ng-click="changeBatch(setModel.feesType);" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"
required>
<option value=""> Select Batch</option>
</select>-->
<input type="text" placeholder="Enter Batch Name"
tabindex="8" class="form-control" name="batchCode"
ng-model="setModel.feesType.BatchCode" ng-readonly="true" />
<!--<span class="error text-small block"
ng-if="Form.batchCode.$dirty && Form.batchCode.$invalid">Batch is required</span>-->
</div>
<div class="col-md-3 form-group" <div class="col-md-3 form-group"
ng-class="{'has-error':Form.setsessionname.$dirty && Form.setsessionname.$invalid, 'has-success':Form.setsessionname.$valid}"> ng-class="{'has-error':Form.setsessionname.$dirty && Form.setsessionname.$invalid, 'has-success':Form.setsessionname.$valid}">
<label> <label>
@ -37,7 +67,7 @@
</label> </label>
<input type="text" placeholder="Enter Session Name" <input type="text" placeholder="Enter Session Name"
tabindex="8" class="form-control" name="setsessionname" tabindex="9" class="form-control" name="setsessionname"
ng-model="setModel.feesType.SessionName" ng-pattern="/^[a-zA-Z0-9-./\s]*$/" required ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/> ng-model="setModel.feesType.SessionName" ng-pattern="/^[a-zA-Z0-9-./\s]*$/" required ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.setsessionname.$dirty && Form.setsessionname.$error.required">Session name is required</span> ng-if="Form.setsessionname.$dirty && Form.setsessionname.$error.required">Session name is required</span>
@ -53,13 +83,17 @@
</label> </label>
<input type="text" placeholder="Enter Roll No" <input type="text" placeholder="Enter Roll No"
tabindex="9" class="form-control" name="setrollNo" tabindex="10" class="form-control" name="setrollNo"
ng-model="setModel.feesType.RollNo" ng-pattern="/^[a-zA-Z0-9-./\s]*$/" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/> ng-model="setModel.feesType.RollNo" ng-pattern="/^[a-zA-Z0-9-./\s]*$/" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.setrollNo.$dirty && Form.setrollNo.$error.required">Roll no is required</span> ng-if="Form.setrollNo.$dirty && Form.setrollNo.$error.required">Roll no is required</span>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.setrollNo.$dirty && Form.setrollNo.$error.pattern">Invalid roll no </span> ng-if="Form.setrollNo.$dirty && Form.setrollNo.$error.pattern">Invalid roll no </span>
</div> </div>
</div>
<div class="row">
<div class="col-md-3 form-group" <div class="col-md-3 form-group"
ng-class="{'has-error':Form.feesAmount.$dirty && Form.feesAmount.$invalid,'has-success':Form.feesAmount.$valid}"> ng-class="{'has-error':Form.feesAmount.$dirty && Form.feesAmount.$invalid,'has-success':Form.feesAmount.$valid}">
<label> <label>
@ -67,7 +101,7 @@
</label> </label>
<input type="text" placeholder="Enter Fees Amount" <input type="text" placeholder="Enter Fees Amount"
autofocus tabindex="10" class="form-control" name="feesAmount" id="feesAmount" ng-maxlength="9" autofocus tabindex="11" class="form-control" name="feesAmount" id="feesAmount" ng-maxlength="9"
ng-model="setModel.feesType.ActualFees" ng-pattern="/^[0-9]*$/" readonly required/> ng-model="setModel.feesType.ActualFees" ng-pattern="/^[0-9]*$/" readonly required/>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.feesAmount.$dirty && Form.feesAmount.$invalid" ng-if="Form.feesAmount.$dirty && Form.feesAmount.$invalid"
@ -77,10 +111,6 @@
</div> </div>
</div>
<div class="row">
<div class="col-md-3 form-group" <div class="col-md-3 form-group"
ng-class="{'has-error':Form.STF.$dirty && Form.STF.$invalid}"> ng-class="{'has-error':Form.STF.$dirty && Form.STF.$invalid}">
<label> <label>
@ -88,8 +118,8 @@
</label> </label>
<input type="text" placeholder="Enter STF/WR Amount" <input type="text" placeholder="Enter STF/WR Amount"
autofocus tabindex="11" class="form-control" name="STF" id="STF" ng-maxlength="9" autofocus tabindex="12" class="form-control" name="STF" id="STF" ng-maxlength="9"
ng-model="setModel.feesType.STFOrWR" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType);" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/> ng-model="setModel.feesType.STFOrWR" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType,'2','2');" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.STF.$dirty && Form.STF.$invalid" ng-if="Form.STF.$dirty && Form.STF.$invalid"
ng-hide="Form.STF.$error.maxlength || Form.STF.$error.pattern">STF/WR amount is required</span> ng-hide="Form.STF.$error.maxlength || Form.STF.$error.pattern">STF/WR amount is required</span>
@ -104,8 +134,8 @@
</label> </label>
<input type="text" placeholder="Enter Other Amount" <input type="text" placeholder="Enter Other Amount"
autofocus tabindex="12" class="form-control" name="others" id="others" ng-maxlength="9" autofocus tabindex="13" class="form-control" name="others" id="others" ng-maxlength="9"
ng-model="setModel.feesType.Others" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType);" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/> ng-model="setModel.feesType.Others" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType,'2','1');" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" readonly/>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.others.$dirty && Form.others.$invalid" ng-if="Form.others.$dirty && Form.others.$invalid"
ng-hide="Form.others.$error.maxlength || Form.others.$error.pattern">Others amount is required</span> ng-hide="Form.others.$error.maxlength || Form.others.$error.pattern">Others amount is required</span>
@ -136,8 +166,8 @@
</label> </label>
<input type="text" placeholder="Enter Waiver Amount" <input type="text" placeholder="Enter Waiver Amount"
autofocus tabindex="13" class="form-control" name="waiver" id="waiver" ng-maxlength="9" autofocus tabindex="14" class="form-control" name="waiver" id="waiver" ng-maxlength="9"
ng-model="setModel.feesType.Waiver" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType);" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/> ng-model="setModel.feesType.Waiver" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType,'2','2');" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.waiver.$dirty && Form.waiver.$invalid" ng-if="Form.waiver.$dirty && Form.waiver.$invalid"
ng-hide="Form.waiver.$error.maxlength || Form.waiver.$error.pattern">Waiver amount is required</span> ng-hide="Form.waiver.$error.maxlength || Form.waiver.$error.pattern">Waiver amount is required</span>
@ -145,6 +175,9 @@
ng-if="Form.waiver.$error.maxlength || Form.waiver.$error.pattern">Enter a valid amount</span> ng-if="Form.waiver.$error.maxlength || Form.waiver.$error.pattern">Enter a valid amount</span>
</div> </div>
</div>
<div class="row">
<div class="col-md-3 form-group" <div class="col-md-3 form-group"
ng-class="{'has-error':Form.total.$dirty && Form.total.$invalid}"> ng-class="{'has-error':Form.total.$dirty && Form.total.$invalid}">
<label> <label>
@ -152,7 +185,7 @@
</label> </label>
<input type="text" placeholder="Enter Total Amount" <input type="text" placeholder="Enter Total Amount"
autofocus tabindex="14" class="form-control" name="total" id="total" ng-maxlength="9" autofocus tabindex="15" class="form-control" name="total" id="total" ng-maxlength="9"
ng-model="setTotalAmount" ng-pattern="/^[0-9]*$/" readonly/> ng-model="setTotalAmount" ng-pattern="/^[0-9]*$/" readonly/>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.total.$dirty && Form.total.$invalid" ng-if="Form.total.$dirty && Form.total.$invalid"
@ -163,7 +196,7 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row" ng-if="updateMoreItems.length>=1">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-white" id="panel2"> <div class="panel panel-white" id="panel2">
<div class="panel-heading bg-light-blue"> <div class="panel-heading bg-light-blue">
@ -176,9 +209,87 @@
<div collapse="panel2" ng-init="panel2=false" class="panel-wrapper"> <div collapse="panel2" ng-init="panel2=false" class="panel-wrapper">
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-md-3 form-group" <div class="col-md-3">
<input type="button" class="btn btn-sm btn-info" title="Click to add one more items" value="Add More" ng-click="clickMoreItems(Form,setModel.feesType);" style="margin-top:0%;" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/>
</div>
</div>
</br>
<div class="row" ng-repeat="n in updateMoreItems">
<div class="col-md-3 form-group" ng-class="{'has-error':n.Name==undefined, 'has-success':n.Name!=undefined}">
<label> Installment
<span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Installment"
class="form-control" name="instllment{{$index}}"
ng-model="n.Name" ng-pattern="/^[a-zA-Z0-9-./\s]*$/" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" required/>
<span class="error text-small block" ng-if="n.Name==undefined">Enter a valid installment</span>
</div>
<div class="col-md-3 form-group" ng-class="{'has-error':n.Amount==undefined, 'has-success':n.Amount!=undefined}">
<label>
Amount
<span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Fees Amount"
autofocus class="form-control" name="amount{{$index}}" id="amount{{$index}}" ng-maxlength="8"
ng-model="n.Amount" ng-pattern="/^[0-9]*$/" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" required/>
<span class="error text-small block" ng-if="n.Amount==undefined">Enter a valid amount</span>
</div>
<!-- <div class="col-md-3 form-group" ng-class="{'has-error':n.DueDate==undefined, 'has-success':n.DueDate!=undefined}">
<label>
</label>
<input type="text" placeholder="Enter Date"
autofocus class="form-control" name="date{{$index}}" id="date{{$index}}"
ng-model="n.DueDate" required/>
<span class="error text-small block" ng-if="n.DueDate==undefined">Enter a valid date</span>
</div>-->
<div data-ng-controller="DatepickerDemoCtrl">
<div class="col-md-3 form-group"
ng-class="{'has-error':n.DueDate==undefined, 'has-success':n.DueDate!=undefined}">
<label> Due Date
<span class="symbol required"></span>
</label>
<input type="text"
class="form-control " tabindex="16"
ng-click="startOpen = !startOpen"
datepicker-popup="dd-MM-yyyy"
ng-model="n.DueDate"
is-open="startOpen"
ng-init="startOpen = false"
name="date{{$index}}"
datepicker-options="dateOptions"
placeholder="Select Date"
min-date="getDateArray[$index].Date"
max-date="getDateArray[$index+2].Date"
close-text="Close" ng-change="setFeesTotalAmount(setModel.feesType,'2','2');" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" required="required"/>
<span class="error text-small block"
ng-if="n.DueDate==undefined">Date is required.</span>
<!--<span class="success text-small block"-->
<!--ng-if="Form.date.$valid ">Thank You</span>-->
</div>
</div>
</div>
<!--<div class="row">
&lt;!&ndash;<div class="col-md-3 form-group"
ng-class="{'has-error':Form.insName.$dirty && Form.insName.$invalid,'has-success':Form.insName.$valid}"> ng-class="{'has-error':Form.insName.$dirty && Form.insName.$invalid,'has-success':Form.insName.$valid}">
<label> <label>
Installment <span Installment <span
@ -232,83 +343,15 @@
close-text="Close" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" required="required"/> close-text="Close" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" required="required"/>
<span class="error text-small block" <span class="error text-small block"
ng-if="Form.date.$dirty && Form.date.$error.required">Date is required.</span> ng-if="Form.date.$dirty && Form.date.$error.required">Date is required.</span>
<!--<span class="success text-small block"--> &lt;!&ndash;<span class="success text-small block"&ndash;&gt;
<!--ng-if="Form.date.$valid ">Thank You</span>--> &lt;!&ndash;ng-if="Form.date.$valid ">Thank You</span>&ndash;&gt;
</div> </div>
</div> </div>&ndash;&gt;
<div class="col-md-3"> <div class="col-md-3">
<input type="button" class="btn btn-sm btn-info" title="Click to add one more items" value="Add More" ng-click="clickMoreItems(myModelInstallemt,Form,setModel.feesType);" style="margin-top:16%;" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/> <input type="button" class="btn btn-sm btn-info" title="Click to add one more items" value="Add More" ng-click="clickMoreItems(Form,setModel.feesType);" style="margin-top:16%;" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/>
</div> </div>
</div> </div>-->
<div class="row" ng-repeat="n in updateMoreItems">
<div class="col-md-3 form-group" ng-class="{'has-error':n.Name==undefined, 'has-success':n.Name!=undefined}">
<label>
</label>
<input type="text" placeholder="Enter Installment"
class="form-control" name="instllment{{$index}}"
ng-model="n.Name" ng-pattern="/^[a-zA-Z0-9-./\s]*$/" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" required/>
<span class="error text-small block" ng-if="n.Name==undefined">Enter a valid installment</span>
</div>
<div class="col-md-3 form-group" ng-class="{'has-error':n.Amount==undefined, 'has-success':n.Amount!=undefined}">
<label>
</label>
<input type="text" placeholder="Enter Fees Amount"
autofocus class="form-control" name="amount{{$index}}" id="amount{{$index}}" ng-maxlength="8"
ng-model="n.Amount" ng-pattern="/^[0-9]*$/" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" required/>
<span class="error text-small block" ng-if="n.Amount==undefined">Enter a valid amount</span>
</div>
<!-- <div class="col-md-3 form-group" ng-class="{'has-error':n.DueDate==undefined, 'has-success':n.DueDate!=undefined}">
<label>
</label>
<input type="text" placeholder="Enter Date"
autofocus class="form-control" name="date{{$index}}" id="date{{$index}}"
ng-model="n.DueDate" required/>
<span class="error text-small block" ng-if="n.DueDate==undefined">Enter a valid date</span>
</div>-->
<div data-ng-controller="DatepickerDemoCtrl">
<div class="col-md-3 form-group"
ng-class="{'has-error':n.DueDate==undefined, 'has-success':n.DueDate!=undefined}">
<label>
</label>
<input type="text"
class="form-control " tabindex="16"
ng-click="startOpen = !startOpen"
datepicker-popup="dd-MM-yyyy"
ng-model="n.DueDate"
is-open="startOpen"
ng-init="startOpen = false"
name="date{{$index}}"
datepicker-options="dateOptions"
placeholder="Select Date"
max-date="futureDate"
close-text="Close" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" required="required"/>
<span class="error text-small block"
ng-if="n.DueDate==undefined">Date is required.</span>
<!--<span class="success text-small block"-->
<!--ng-if="Form.date.$valid ">Thank You</span>-->
</div>
</div>
</div>
</div> </div>
@ -321,11 +364,11 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="pull-right"> <div class="pull-right">
<button type="submit" ladda="ldloading5.zoom_in" tabindex="17" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="submitFeesForStudent(user,Form,setModel.feesType,'zoom-in',myModelInstallemt)" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"> <!--ng-disabled="setModel.feesType.ExistValue=='1'"--> <button type="submit" ladda="ldloading5.zoom_in" tabindex="16" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="submitFeesForStudent(user,Form,setModel.feesType,'zoom-in')" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"> <!--ng-disabled="setModel.feesType.ExistValue=='1'"-->
Save Save
</button> </button>
<input type="button" class="btn btn-warning btn-wide" tabindex="18" value="Cancel" <input type="button" class="btn btn-warning btn-wide" tabindex="17" value="Cancel"
ng-click="cancel();"> ng-click="cancel();">
</input> </input>
@ -357,7 +400,7 @@
</tr> </tr>
</thead> </thead>
<tbody dir-paginate="p in feesStructureInfo|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:10"> <tbody ng-repeat="p in feesStructureInfo|orderBy:sortKey:reverse|filter:search:strict">
<tr ng-if="p.ExistValue=='1'"> <tr ng-if="p.ExistValue=='1'">
<td>{{p.Sem_Year}}</td> <td>{{p.Sem_Year}}</td>
<td>{{p.SessionName}}</td> <td>{{p.SessionName}}</td>
@ -374,8 +417,8 @@
</tbody> </tbody>
</table> </table>
<dir-pagination-controls max-size="10" direction-links="true" boundary-links="true"> <!--<dir-pagination-controls max-size="10" direction-links="true" boundary-links="true">
</dir-pagination-controls> </dir-pagination-controls>-->
</div> </div>