Multiple ReregisterForm PDF :sriram

This commit is contained in:
sriramv 2018-06-22 16:08:20 +05:30
parent 74d5f467ab
commit 914c15b71c
5 changed files with 203 additions and 61 deletions

View File

@ -160,7 +160,14 @@ class Reregister_Controller extends REST_Controller {
$SemesterID = $this->post('SemNum');
$branchId = $this->post('branchId');
$subjectDetails = $this->Reregister_model->getsubject($SemesterID,$branchId);
$course = $this->post('Course');
foreach($SemesterID as $sem){
if(!empty($sem)){
$subjectDetails[] = $this->Reregister_model->getsubject($sem,$branchId,$course);
}
}
if(sizeof($subjectDetails)>0){
$data['status'] = REST_Controller::HTTP_OK;
$data['SubjectStatus'] = true;

View File

@ -293,7 +293,7 @@ class Reregister_model extends CI_Model
$result_array[]=$university_array;
}
$result_university['univerSityDetails']= $result_array;
$result_university['centerDetails'] = $this->getCenterDetails($branchId);
//$result_university['centerDetails'] = $this->getCenterDetails($branchId);
}
else {
$result_university['universityStatus'] = false;
@ -333,15 +333,7 @@ class Reregister_model extends CI_Model
}
public function getCenterDetails($branchId)
{
$this->db->select('CenterID,CenterCode,CenterName,CenterAddress');
$this->db->from('T_CenterMaster');
$this->db->where('IsActive',1);
$this->db->where('BranchCode',$branchId);
$res = $this->db->get();
return $res->result();
}
public function getStudentListForReregistermodel($UID,$courseID,$batch,$requestedBy,$branchId)
{
@ -375,7 +367,8 @@ class Reregister_model extends CI_Model
$studentdetails['EmailID'] = $r->EmailID;
$studentdetails['Fathername'] = $r->Fathername;
$studentdetails['MotherName'] = $r->MotherName;
$studentdetails['PermanentAddress'] = $r->PermanentAddress;
$PermanentAddress = ($r->PermanentAddress);
$studentdetails['PermanentAddress'] = $PermanentAddress;
$studentdetails['EnrollmentID'] = $r->EnrollmentID;
$studentdetails['FeeDetails'] = $this->getFeeSemesterDetails($r->StudentID,$batch,$branchId,$courseID);
// if(!empty($studetdetails['FeeDetails'])){
@ -387,7 +380,7 @@ class Reregister_model extends CI_Model
}
}
//print_r($studentdetails);die;
//echo json_encode(urldecode($result));die;
//print_r($studentdetails);die;
return $result;
@ -410,14 +403,16 @@ class Reregister_model extends CI_Model
$res = $this->db->get();
return $res->result();
}
function getSubject($sem,$branch){
function getSubject($sem,$branch,$course){
$this->db->select('sub.*');
$this->db->join('T_SemSubMap_Child SC','SC.MapID = SM.MapID','left');
$this->db->join('T_SubjectMaster sub','sub.SubjectID = SC.SubjectID');
$this->db->where('SM.SemesterID',$sem);
$this->db->where('SM.BranchCode',$branch);
$this->db->where('SM.CourseID',$course);
$this->db->where('SC.isActive',1);
$query = $this->db->get('T_SemSubMap_Master SM');
//print_r($query->result());die;
//print_r($query->result());die;
return $query->result();
}

View File

@ -9,11 +9,12 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
"courseName":"",
"batchName":"",
"selectSem":""
};
};
$scope.sort = function(keyname){
$scope.sortKey = keyname; //set the sortKey to the param passed
$scope.reverse = !$scope.reverse; //if true make it false and vice versa
}
$scope.disable = true;
$scope.init = function () {
$scope.Sem = [
{Sem:"SEM1",SemNum:1},
@ -26,6 +27,15 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
{Sem:"SEM8",SemNum:8},
];
$scope.Year = [
{Year:"Year1",SemNum:1},
{Year:"Year2",SemNum:3},
{Year:"Year3",SemNum:5},
{Year:"Year4",SemNum:7},
];
// console.log($scope.Sem);
var getUniv = {
method: 'POST',
@ -134,14 +144,99 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
}
}
$scope.isCheckAll = function(e){
var val = (e.target.checked ? true : false);
if(val)
{
// $scope.disable = false;
var len = $scope.studentInfo.length;
var i = 0;
for(i=0;i<len;i++)
{
if($scope.selectedStudentsID.indexOf($scope.studentInfo[i]) === -1)
{
$scope.selectedStudentsID.push($scope.studentInfo[i]);
}
}
}
else
{
// $scope.disable = true;
$scope.selectedStudentsID = [];
}
if($scope.selectedStudentsID !=''){
$scope.disable = false;
}else{
$scope.disable = true;
}
}
$scope.isClick = function(e){
var ide = e.target;
var val = (ide.checked ? true : false);
var sid = e.target.id;
angular.forEach($scope.studentInfo,function(value,key){
if(sid == value.StudentID)
{
sid = value;
}
});
//console.log(sid);
var pos = $scope.selectedStudentsID.indexOf(sid);
//alert(val);
if(val)
{
if( pos == -1)
{
//console.log("PUSH");
$scope.selectedStudentsID.push(sid);
}
}
else
{
//console.log("POP");
$scope.selectedStudentsID.splice(pos,1);
}
//
if(val){
$scope.disable = false;
}else{
$scope.disable = true;
}
}
$scope.selectedSem = new Array();
$scope.semArray = function(sem,index){
//console.log(sem +''+index);
// alert();
if(sem != ''){
$scope.selectedSem[index] = sem;
console.log($scope.selectedSem);
}
}
//console.log($scope.Sem);
$scope.changeSem = function(sem,stuDetails,universityId,course){
$scope.changeSem = function(universityId,course){
// console.log($scope.selectedStudentsID);
var coursefiltered = universityId.courseDetails.filter((universitycourse)=>universitycourse.CourseID == course);
if(sem !=''){
if($scope.selectedSem ==''){
swal('Select University Sem Year','','warning');
return false;
}else if($scope.selectedStudentsID ==''){
swal('Select Checkbox','','warning');
return false;
}else{
//console.log(stuDetails);
console.log("else");
var getsubject = {
method:'post',
url:apiPoint.url +"getSubject",
@ -149,15 +244,25 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
'Content-Type': 'application/json'
},
data:{
SemNum:sem,
SemNum:$scope.selectedSem,
Course:course,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
}
};
$http(getsubject).then(function(response){
//console.log(response);
// console.log(response);
if(response.data.status ==200 && response.data.SubjectStatus){
$scope.open(stuDetails,sem,universityId,response.data.SubjectDetails,coursefiltered);
//angular.forEach($scope.selectedStudentsID,function(studentdata,key){
// angular.forEach(response.data.SubjectDetails[key],function(subjectdata,subkey){
// console.log(subkey);
// $scope.subjectDetails.push(subjectdata);
// });
$scope.open($scope.selectedStudentsID,$scope.selectedSem,universityId,coursefiltered,response.data.SubjectDetails);
//});
}
// if(response.data.message == "Something Went Wrong!" ){
// //alert();
@ -170,17 +275,20 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
}
}
$scope.open = function(PDFdata,sem,universityId,Subjects,coursefiltered){
$scope.open = function(PDFdata,sem,universityId,coursefiltered,Subjects){
// console.log(PDFdata);
$rootScope.Student = PDFdata;
// console.log(PDFdata);
// console.log($rootScope.Student);
// return false;
$rootScope.sem = sem;
//console.log($rootScope.sem);
$rootScope.Course = coursefiltered[0];
console.log($rootScope.Course);
//console.log($rootScope.Course);
$rootScope.university = universityId;
$rootScope.Subject = Subjects;
// console.log($rootScope.Subject);
// return false;
var modalInstance = $modal.open({
templateUrl: 'assets/views/reregistration/reregistrationformpdf.html',
controller: 'reregistrationformCtrl',
@ -200,20 +308,27 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
});
};
$scope.generatePDF = function(){
// alert();
angular.forEach($scope.Student,function(Student,key){
$scope.universityAddress = $scope.university.Address;
$scope.universitydetails = "Mobile: "+$scope.university.MobileNumber+",E-mail id:"+$scope.university.EmailID+
",Website:-";
$scope.Enroll = "Enrolment No: ";
$scope.corseDetails = "Course Name: "+$scope.Course.CourseName+" specialization: "+$scope.Course.Specilization +"Sem/Year: SEM"+$scope.sem;
$scope.StudentName = "Name of the Candidate: "+$scope.Student.Firstname +' '+ $scope.Student.Lastname;
$scope.StudentFatername = "Father's Name: "+$scope.Student.Fathername;
$scope.StudentMotherName = "Mother's Name: "+$scope.Student.MotherName;
$scope.corseDetails = "Course Name: "+$scope.Course.CourseName+" specialization: "+$scope.Course.Specilization +"Sem/Year: SEM"+$scope.sem[key];
$scope.StudentName = "Name of the Candidate: "+Student.Firstname +' '+ Student.Lastname;
$scope.StudentFatername = "Father's Name: "+Student.Fathername;
$scope.StudentMotherName = "Mother's Name: "+Student.MotherName;
//var str = $scope.Student.PresentAddress;
var str = escape($scope.Student.PermanentAddress);
var str = encodeURIComponent(Student.PermanentAddress).replace(/[%2C %20 %0A]/g,' ');
$scope.StudnetAddress = "Address: "+ str.replace("%0A"," ");
$scope.StudentPin = "Pincode: .................. Mobile No: "+$scope.Student.MobileNumber+"Email ID: "+$scope.Student.EmailID;
// str.replace("%0A"," ");
// str.replace("%20"," ");
// str.replace("%2C"," ");
$scope.StudnetAddress = "Address: "+ str.replace(" "," ");
$scope.StudentPin = "Pincode: .................. Mobile No: "+Student.MobileNumber+"Email ID: "+Student.EmailID;
// var sem1 = doc.autoTableHtmlToJson(document.getElementById(subject));
var universityname = $scope.university.universityName;
@ -246,23 +361,26 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
doc.setFontSize(12);
doc.line(10, 45, 200, 45);
var col = 45;
var EnLen = $scope.Student.EnrollmentID.length;
console.log(EnLen);
var EnLen = Student.EnrollmentID.length;
//console.log(EnLen);
var k = 0;
if(EnLen !=0){
while( k<= EnLen-1){
//console.log(k);
doc.text(15,60,$scope.Enroll);doc.rect(col,57,5,5);
col = col+1;
doc.text(col,61,$scope.Student.EnrollmentID[k]);
doc.text(col,61,Student.EnrollmentID[k]);
col = parseInt(col)+4;
k++;
}
//doc.rect(45,55,5,5);doc.rect(50,55,5,5);doc.rect(55,55,5,5);doc.rect(60,55,5,5);doc.rect(65,55,5,5);doc.rect(70,55,5,5);doc.rect(75,55,5,5);doc.rect(80,55,5,5);doc.rect(85,55,5,5);doc.rect(90,55,5,5);doc.rect(95,55,5,5);doc.rect(100,55,5,5);doc.rect(105,55,5,5);doc.rect(110,55,5,5);doc.rect(115,55,5,5);doc.rect(120,55,5,5);doc.rect(125,55,5,5);
}else{
doc.text(15,60,$scope.Enroll); doc.rect(45,55,5,5);doc.rect(50,55,5,5);doc.rect(55,55,5,5);doc.rect(60,55,5,5);doc.rect(65,55,5,5);doc.rect(70,55,5,5);doc.rect(75,55,5,5);doc.rect(80,55,5,5);doc.rect(85,55,5,5);doc.rect(90,55,5,5);doc.rect(95,55,5,5);doc.rect(100,55,5,5);doc.rect(105,55,5,5);doc.rect(110,55,5,5);doc.rect(115,55,5,5);doc.rect(120,55,5,5);doc.rect(125,55,5,5);
// doc.text(46,59,$scope.Student.EnrollmentID[0]);doc.text(51,59,$scope.Student.EnrollmentID[1]);doc.text(56,59,$scope.Student.EnrollmentID[2]);doc.text(61,59,$scope.Student.EnrollmentID[3]);doc.text(66,59,$scope.Student.EnrollmentID[4]);
// doc.text(71,59,$scope.Student.EnrollmentID[5]);doc.text(76,59,$scope.Student.EnrollmentID[6]);doc.text(81,59,$scope.Student.EnrollmentID[7]);doc.text(86,59,$scope.Student.EnrollmentID[8]);doc.text(91,59,$scope.Student.EnrollmentID[9]);
// doc.text(96,59,$scope.Student.EnrollmentID[10]);doc.text(101,59,$scope.Student.EnrollmentID[11]);doc.text(106,59,$scope.Student.EnrollmentID[12]);
// //doc.text(111,59,$scope.Student.EnrollmentID[13]);doc.text(116,59,$scope.Student.EnrollmentID[14]);doc.text(121,59,$scope.Student.EnrollmentID[15]);
}
doc.text(15,70,$scope.corseDetails);
doc.text(15,80,"Examination Session: January ");doc.rect(73,77,5,5);doc.text(80,80,"June");doc.rect(90,77,5,5);doc.text(100,80,"Semester Mode");doc.rect(131,77,5,5);doc.text(140,80,"Yearly Mode");doc.rect(165,77,5,5);
// doc.autoTable(sem1.columns, sem1.data, {margin: {top: 100},theme:'grid'});
@ -289,20 +407,25 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
doc.line(10,137,200,137);
var row = 137;
var no = 1;
for(var i=0;i<=$scope.Subject.length-1;i++){
// doc.line(10,row,200,row);
//console.log();
angular.forEach($scope.Subject[key],function(subjectData,key){
//for(var i=0;i<=$scope.Subject[key].length-1;i++){
// console.log(subjectData);
doc.line(10,row,200,row);
no = no.toString();
doc.text(25,row+5,no);
doc.text(75,row+5,$scope.Subject[i].SubjectCode);
doc.text(126,row+5,$scope.Subject[i].SubjectName);
doc.text(75,row+5,subjectData.SubjectCode);
doc.text(126,row+5,subjectData.SubjectName);
row = row+6;
no = parseInt(no)+1;
doc.line(10,row,200,row);
}
var index = 14;
var len = index-$scope.Subject.length;
for(var j=0;j<=len;j++){
});
var index = 14;
var len = index-$scope.Subject[key].length;
//console.log(len);
for(var j=0;j<=len;j++){
no = no.toString();
doc.text(25,row+5,no);
// doc.text(75,row+5,"--");
@ -311,13 +434,14 @@ app.controller('reregistrationformCtrl', ["$scope","$rootScope","toaster", "$fil
no = parseInt(no)+1;
doc.line(10,row,200,row);
}
}
doc.line(10,240,200,240);
doc.text(15,250,"Fees Details: Cash / Cheque / DD");
doc.text(15,260,"DD No / Cheque No ....................... Dated ............... Bank ....................");
doc.text(15,270,"Amount ...................");
doc.text(150,280,"Signature of Candidate");
doc.save($scope.Student.Firstname +'_'+ $scope.Student.Lastname+'_sem'+$scope.sem+'.pdf');
doc.save(Student.Firstname +'_'+ Student.Lastname+'_sem'+$scope.sem[key]+'.pdf');
});
}
}]);

View File

@ -13,7 +13,7 @@
box-shadow: 0px 0px 2px green;
padding: 0.5em 0.6em;
}
a {
color: #007AFF;
@ -87,7 +87,11 @@
<br>
<button type="button" ladda="ldloading1.zoom_in" tabindex="5" class="btn btn-wide btn-info" data-style="zoom-in" ng-click="getStudentDetails(Form,myModel);">GET STUDENTS</button>
</div>
<div class="col-md-2 form-group">
<br>
<button type="button" ladda="ldloading1.zoom_in" tabindex="5" class="btn btn-wide btn-info" data-style="zoom-in" ng-click="changeSem(myModel.universityName,myModel.courseName);">Generate PDF</button>
</div>
</div>
</fieldset>
@ -105,7 +109,8 @@
<table class="table table-hover">
<thead>
<tr>
<th>Student Name
<th><input type="checkbox" ng-model="myModel.all" id="all" name="all" ng-click="isCheckAll($event);" class="form-control"></th>
<th ng-click="sort('Firstname')">Student Name
<span class="glyphicon sort-icon" ng-show="sortKey=='Firstname'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
<!-- <th ng-click="sort('UniversityShortName')">University Short Name -->
@ -117,7 +122,7 @@
<th ng-click="sort('EmailID')">EmailID
<span class="glyphicon sort-icon" ng-show="sortKey=='EmailID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
<th ng-click="sort('SemYear ')">Sem Year
<th ng-click="sort('SemYear')">Sem Year
<span class="glyphicon sort-icon" ng-show="sortKey=='SemYear'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
<th>Select Sem</th>
@ -128,24 +133,31 @@
</thead>
<tbody dir-paginate="p in studentInfo|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:10">
<tr>
<td><input type="checkbox" ng-checked="myModel.all" id="{{p.StudentID}}" name="{{p.StudentID}}" class="form-control" ng-click="isClick($event);" ></td>
<td>{{p.Firstname}}{{p.Lastname}}</td>
<!-- <td>{{p.UniversityShortName}}</td> -->
<td>{{p.MobileNumber}}</td>
<td>{{p.EmailID}}</td>
<td>{{p.FeeDetails[0].Sem_Year}}</td>
<td><select class="form-control" name="sem" tabindex="4" id="sem"
ng-model="myModel.selectSum" ng-change="changeSem(myModel.selectSum,p,myModel.universityName,myModel.courseName);">
<td ng-show="p.FeeDetails[0].SubType =='SEM'"><select class="form-control" name="sem" tabindex="4" id="{{p.StudentID}}"
ng-model="myModel.selectSem[$index]" ng-change="semArray(myModel.selectSem[$index],$index)" ng-disabled="{{diabele}}">
<option value=""> Select Sem</option>
<option ng-repeat="s in Sem" ng-selected="p.FeeDetails[0].Sem_Year == s.Sem"value="{{s.SemNum}}"><span ng-show="courseDetails.CourseCode != ''"><strong>{{s.Sem}}</strong></span></option>
</select></td>
<td ng-show="p.FeeDetails[0].SubType =='YEAR'"><select class="form-control" name="sem" tabindex="4" id="{{p.StudentID}}"
ng-model="myModel.selectSem[$index]" ng-change="semArray(myModel.selectSem[$index],$index)" ng-disabled="{{diabele}}">
<option value=""> Select Sem</option>
<option ng-repeat="s in Year" ng-selected="p.FeeDetails[0].Sem_Year == s.Year"value="{{s.SemNum}}"><span ng-show="courseDetails.CourseCode != ''"><strong>{{s.Year}}</strong></span></option>
</select></td>
</tr>
</tbody>
</table>
<dir-pagination-controls max-size="10" direction-links="true" boundary-links="true">
</dir-pagination-controls>
</div>
</div>
</div>

View File

@ -2,7 +2,7 @@
<div class="col-md-offset-10 col-md-1">
<button class="btn btn-success" id="print"ng-click="generatePDF();">Print</button></div>
<div id="reregisterform">
<table style="height: 341px;background-color: white;" width="578" border=1 >
<table style="height: 341px;background-color: white;" width="578" border=1 ng-repeat="Student in Student">
<tbody>
<tr>
<td style="width: 185px; text-align: right;border-right-style: hidden;border-bottom-style: hidden;"><img src="images/{{university.ProfilePicPath}}" id="logo" style="width: 30%;"></td>
@ -47,7 +47,7 @@
</tbody>
</table>
&nbsp;
<p>Course Name: {{Course.CourseName}} specialization {{Course.Specilization}} Sem/Year <span style="text-decoration:underline;">SEM{{sem}}</span></p>
<p>Course Name: {{Course.CourseName}} specialization {{Course.Specilization}} Sem/Year <span style="text-decoration:underline;">SEM{{sem[$index]}}</span></p>
&nbsp;
<p>Examination Session:&nbsp;&nbsp;&nbsp; January&nbsp;&nbsp;&nbsp;<span style="border:1px solid black;padding: 0px 0px 0px 18px;"></span>&nbsp;&nbsp;&nbsp; June &nbsp;&nbsp;&nbsp;<span style="border:1px solid black;padding: 0px 0px 0px 18px;"></span>&nbsp;&nbsp;&nbsp; Semester Mode &nbsp;&nbsp;&nbsp;<span style="border:1px solid black;padding: 0px 0px 0px 18px;"></span>&nbsp;&nbsp;&nbsp; Yearly Mode &nbsp;&nbsp;&nbsp;<span style="border:1px solid black;padding: 0px 0px 0px 18px;"></span></p>
</td>
@ -89,7 +89,7 @@
<th style="width: 186px; text-align: center;"><strong>&nbsp;Subject / Paper Code</strong></th>
</tr>
<tr ng-repeat="sub in Subject">
<tr ng-repeat="sub in Subject[$index]">
<td style="width: 185px;">{{$index+1}}</td>
<td style="width: 185px;">{{sub.SubjectCode}}</td>
<td style="width: 186px;">{{sub.SubjectName}}</td>
@ -108,5 +108,9 @@
</tr>
</tfoot>
</table>
<br/>
<br/>
<br/>
<br/>
</div>
</div>