batchshedule file upload

This commit is contained in:
gayathri1990 2018-09-05 13:13:41 +05:30
parent 87304b2030
commit a19d1b10e6
8 changed files with 274 additions and 36 deletions

View File

@ -137,7 +137,7 @@ defined('STUDENTS') OR define('STUDENTS','T_StudentDetails');
defined('ANNOUNCEMENT') OR define('ANNOUNCEMENT','T_AnnouncementDetails');
defined('ACTIVITY') OR define('ACTIVITY','T_ActivityMaster');
defined('ACTIVITY_STATUS') OR define('ACTIVITY_STATUS','T_Activity_Status');
defined('ANSWER_BOOKLET') OR define('ANSWER_BOOKLET','T_AnswerBookletStatus');
defined('ANSWER_BOOKLET') OR define('ANSWER_BOOKLET','T_AnswerBookletStatus');
defined('APPLICATION_STATUS') OR define('APPLICATION_STATUS','T_ApplicationStatus');
defined('CERTIFICATION_STATUS') OR define('CERTIFICATION_STATUS','T_CertificationStatus');
defined('STUDENTS_FEES_STATUS') OR define('STUDENTS_FEES_STATUS','T_Students_Fees_Status');

View File

@ -142,7 +142,7 @@ $route['deleteDocPendingDetails'] = 'Student_Controller/deleteDocPendingDetails'
$route['getEmployeeDetailsBranch'] = 'Student_Controller/getEmployeeDetailsBranch';
//batch
$route['addBatchDetails'] = 'Batch_Controller/addBatchDetails';
$route['addBatchDetails'] = 'Batch_Controller/addBatchDetails';
$route['updateBatchDetails'] = 'Batch_Controller/updateBatchDetails';
$route['getBatchDetails'] = 'Batch_Controller/getBatchDetails';
$route['updateBatchDefault'] = 'Batch_Controller/updateBatchDefault';
@ -200,6 +200,7 @@ $route['feepaidDetails'] = 'Report/feepaidDetails';
$route['getSubjectDetaillist'] = 'HallTickets_Controller/getSubjectDetaillist';
/* Add New Contact Group */
$route['addNewGroup'] = 'Broadcast_Controller/addNewGroup';
$route['getGroups'] = 'Broadcast_Controller/getGroups';
@ -311,6 +312,7 @@ $route['updateSheduleDetails'] = 'HallTickets_Controller/updateSheduleDetails';
$route['getSheduleDetails'] = 'HallTickets_Controller/getSheduleDetails';
$route['getUniversityCourseId'] = 'HallTickets_Controller/getUniversityCourseId';
$route['saveBatchSchedule'] = 'HallTickets_Controller/SaveAllBatchSchedule';
$route['batchUploadDataDetails'] = 'HallTickets_Controller/BatchUploadDataDetails';
// Re Registration Form
$route['getStudentListForRegistrer'] = 'Reregister_Controller/getStudentListForReregister';
$route['getSubject'] = 'Reregister_Controller/getSubject';

View File

@ -36,13 +36,15 @@ class Batch_Controller extends REST_Controller {
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
$details['BatchCode'] = $this->post('batchcode');
$details['BatchName'] = $this->post('batcheName');
$details['BatchDate'] = $this->post('batcheDate');
$details['UniversityID'] = $this->post('universityName');
$details['CreatedBy'] = $this->post('createdBy');
$details['CreatedBy'] = $this->post('createdBy');
$details['IsActive'] = $this->post('status');
$details['BranchCode'] = $this->post('branchCode');
$details['CreatedOn'] = $now->format('Y-m-d H:i:s');
print_r( $details +'samplearray');
$batchDetails = $this->batch_model->addBatch($details);// Check if the users data store contains users (in case the database result returns NULL)
if ($batchDetails)

View File

@ -24,7 +24,7 @@ class HallTickets_Controller extends REST_Controller {
$this->methods['getCourseSubjectDetails_post']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['getUniversityCourseDetails_post']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['updateSheduleDetails_post']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['BatchUploadDataDetails_post']['limit'] = 500;
// load the model
$this->load->model('Hallticket_model', 'Hallticket_model');
@ -305,22 +305,58 @@ class HallTickets_Controller extends REST_Controller {
}
}
public function BatchUploadDataDetails_post()
{
// echo 'hai';
$university= $this->post('universityDetails');
$courseArray = $this->post('courseDetails');
$filedetails = $this->post('details');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata'));
$CreatedOn = $Cdate->format('Y-m-d H:i:s');
foreach($courseArray as $CourseDatialArray)
{
$course=$CourseDatialArray;
$schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn);
$schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMasterFile($schedulemaster,$filedetails);
}
$SchId = '';
if(count($schedulemasteradd)>0)
{
$SchId = $schedulemasteradd[0]['SchId'];
}
if((count($schedulemasteradd)>0))
{
$data['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($data, REST_Controller::HTTP_OK);
}
else
{
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND);
}
}
public function SaveAllBatchSchedule_post()
{
$detailArray = $this->post('scheduleDetails');
$university =$this->post('getuniversityid');
$courseid= $this->post('getcourseid');
$detailArray = $this->post('scheduleDetails');
$university =$this->post('getuniversityid');
//$courseid= $this->post('getcourseid');
$requestedBy = $this->post('requestedBy');
$branchId = $this->post('branchId');
$Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata'));
$CreatedOn = $Cdate->format('Y-m-d H:i:s');
//echo $courseid;
$CourseDatialArray = $this->post('courseDetails');
foreach($CourseDatialArray as $coursedetails)
{

View File

@ -108,18 +108,21 @@ class Hallticket_model extends CI_Model
$this->db->select('SM.SubjectName,SM.SubjectID');
$this->db->from('T_SubjectMaster SM');
$this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SubjectID=SM.SubjectID');
$this->db->where('SM.BranchCode',$branchcode);
$this->db->where('T_Batch_Schedule_Child.SchId',$mapid);
$result = $this->db->get();
if($result->result()){
$resultShedule['status']=true;
$mastScheduleID="";
foreach($result->result() as $row)
{
$this->db->select('T_Batch_Schedule_Child.SchId,T_Batch_Schedule_Child.SubjectID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_Batch_Schedule_Child.SchChildId,T_Batch_Schedule_Child.SchId');
$this->db->from('T_Batch_Schedule_Master SCM');
$this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SchId = SCM.SchId');
$this->db->where('T_Batch_Schedule_Child.SchId',$mapid);
//$this->db->where('SCM.BranchCode',$branchcode);
// $this->db->where('T_Batch_Schedule_Child.SchId',$mapid);
$this->db->where('T_Batch_Schedule_Child.SubjectID',$row->SubjectID);
$existsheduledetails = $this->db->get();
@ -1245,11 +1248,75 @@ class Hallticket_model extends CI_Model
//echo "MODEL";print_r($result);die();
return $result;
}
}
public function AddBatchScheduleMasterFile($schedulemaster,$filedetails)
{
$this->db->trans_start();
$this->db->insert('T_Batch_Schedule_Master', $schedulemaster);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
// print_r($this->db->last_query());
if($insert_id>0)
{
$subQuery = 'select max(SchId) as SchId from T_Batch_Schedule_Master';
$query = $this->db->query($subQuery);
$result = $query->result_array();
$schid= $result[0]['SchId'];
// if(($schid != '')||($schid !=0))
if(count($result)>0)
{
foreach($filedetails as $det)
{
$sudate = $det['schduleDate'];
$SubDate = date("Y-m-d", strtotime($sudate));
// $SubDate=$sudate->format('Y-m-d H:i:s');
$stime = $det['FromTime'];
$etime = $det['ToTime'];
$isactive=1;
$subcode = $det['SubjectID'];
$Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata'));
$CreatedOn = $Cdate->format('Y-m-d H:i:s');
$this->db->select('SubjectCode,SubjectID,SubjectName');
$this->db->from('T_SubjectMaster');
$this->db->where('T_SubjectMaster.BranchCode', $schedulemaster['BranchCode']);
$this->db->where('T_SubjectMaster.SubjectCode', $det['SubjectID']);
$subDetails = $this->db->get()->result();
$SubjectID=$subDetails[0]->SubjectID;
$schedulchild = array('SchId'=>$schid,'SubjectID'=>$SubjectID,'SchChildId'=>'','ScheduleDate'=>$SubDate,'FromTime'=>$stime,'ToTime'=>$etime,'IsActive'=>$isactive);
$this->db->trans_start();
$this->db->insert('T_Batch_Schedule_Child',$schedulchild);
$this->db->trans_complete();
}
}
//echo $schid;
// $schid=$query[0]['SchId'];
// echo $schid;
}
return true;
// return $query->result_array();
}
public function AddBatchScheduleMaster($schedulemaster,$detailArray)
{
$this->db->trans_start();
$this->db->insert('T_Batch_Schedule_Master', $schedulemaster);
$insert_id = $this->db->affected_rows();

View File

@ -24,7 +24,7 @@ app.controller('batchCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTabl
};
$scope.setEditId = function (pid,p) {
$scope.editModel.editBatchName = p.BatchName;
$scope.editModel.editBatchName = p.BatchName;
$scope.editModel.editDate = p.BatchDate;
$scope.localUniversityDetails="";
$scope.localUniversityDetails = JSON.parse(localStorage.getItem('localUniversityDetails'));
@ -61,11 +61,63 @@ app.controller('batchCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTabl
$scope.sortKey = keyname; //set the sortKey to the param passed
$scope.reverse = !$scope.reverse; //if true make it false and vice versa
}
/*
* Submit,upload file and extract details
* @params myModel
* created by Bala
* */
$scope.extractFileDetails="";
$scope.readUploadXlsxDetails = function (workbook) {
/* DO SOMETHING WITH workbook HERE */
for (var sheetName in workbook.Sheets) {
var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]);
if(jsonData.length!=0){
$scope.extractFileDetails=jsonData;
}
}
$scope.error = function (e) {
/* DO SOMETHING WHEN ERROR IS THROWN */
//console.log(e);
}
}
$scope.UploadFileData = function (details,uploadForDetails) {
var updateUniversityEnrolment = {
method: 'POST',
url: apiPoint.url + 'fileUploadDataDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
localDetails: localDetail,
details: details,
batchcode: myModel.batchCode,
batcheName: myModel.batchName,
universityName: myModel.universityName,
universityID: angular.fromJson(uploadForDetails.university).UniversityID,
// universityName: angular.fromJson(uploadForDetails.university).UniversityName,
}
};
$http(updateUniversityEnrolment).then(function (response) {
if (response.data.status == true) {
swal("", "Updated Successfully", "success");
$state.go($state.current, {}, {reload: true});
} else {
swal("", "Failed", "error");
}
});
}
// end
/*
* Submit,update and reset batch details
* @params myModel
* created by subaram
* created by Bala
* */
$scope.batchForm = {

View File

@ -86,7 +86,6 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP
};
// $scope.details = [];
$scope.cancel = function () {
$scope.init();
$scope.editId = -1;
@ -136,7 +135,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP
* get course semester,subjects details
* created by TamilBala
* */
var course='';
$scope.getSemSubDetails = function(UID,COURSES){
course=COURSES;
@ -172,7 +171,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP
swal("Select Course");
return false;
}
$scope.editId=1;
$scope.semDropDownShowLoading = false;
$scope.semDropDownShow = false;
$scope.semDropDownShowLoading = true;
@ -226,11 +225,16 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP
} );
}
}
$scope.remove = function () {
$scope.init();
$scope.semDropDownShow = false;
};
/*
* Remove Subjects from Master Subjects Arry
* after selecting subjects for each semester
@ -326,7 +330,63 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP
}
/* upload file for batch schedule
* created by bala
* */
$scope.extractFileDetails="";
$scope.readUploadBatchDetails = function (workbook) {
/* DO SOMETHING WITH workbook HERE */
for (var sheetName in workbook.Sheets) {
var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]);
if(jsonData.length!=0){
$scope.extractFileDetails=jsonData;
}
}
$scope.error = function (e) {
/* DO SOMETHING WHEN ERROR IS THROWN */
//console.log(e);
}
}
/*upload file and extract data Created By bala */
$scope.UploadFileData = function (FileDetails,myModel,courseDetails) {
$scope.courseDetailsArray=courseDetails.list;
$scope.universityDetails=myModel.universityName.universityID;
// //console.log($scope.universityDetails);
// $scope.scheduledDetails=[];
// $scope.scheduledDetails.push({
// "universityID":myModel.universityName.universityID,
// });
var updateUniversityEnrolment = {
method: 'POST',
url: apiPoint.url + 'batchUploadDataDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
details: FileDetails,
universityDetails : $scope.universityDetails,
courseDetails : $scope.courseDetailsArray,
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(updateUniversityEnrolment).then(function (response) {
console.log(response);
if (response.data.status == 200) {
swal("", "Saved Successfully", "success");
$state.go($state.current, {}, {reload: true});
} else {
swal("", "Failed", "error");
}
});
}
// end
$scope.saveAll= function(myModel,courseDetails,subjectsDetails)
{
@ -369,7 +429,11 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP
// var finalEndTime = new Date(newEndTime).toLocaleString('en-GB').slice(12 ,20);
// finalEndTime = tempDate+'T'+finalEndTime+':000Z';
// console.log(finalEndTime);
$scope.scheduledDetails.push({
$scope.scheduledDetails.push({
"universityID":myModel.universityName.universityID,
//"courseID":courseDetails.list[0],
"subjectID":value.Subject.SubjectID,
@ -382,7 +446,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP
}
});
//return false;
var saveAllInfo = {
method: 'POST',
url: apiPoint.url + 'saveBatchSchedule/',
@ -418,7 +482,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP
});
}
$scope.updateShedule = function (unsheduledetails) {
$scope.UpdatescheduledDetails=[];

View File

@ -24,7 +24,7 @@
<section id="page-title">
<div class="row">
<div class="col-sm-8">
<h1 class="mainTitle" translate="Batch Schedule">{{ mainTitle }}</h1>
<span class="mainDescription">Allocate Batch schedule </span>
@ -129,7 +129,7 @@
<!-- <pre>{{myModel.universityName | json}}</pre> -->
</div>
<div class="col-md-5 form-group">
<div class="col-md-3 form-group">
<label>
Course
</label>
@ -148,16 +148,29 @@
repeat="x.CourseID as x in selectedUniversityCourseName | filter:$select.search">
{{x.CourseName}}
</ui-select-choices>
</ui-select>
</ui-select>
<!-- <pre>{{selectedCourseNameC.list | json}}</pre> -->
</div>
<div class="col-md-3 form-group">
<div class="col-md-2 form-group">
<br>
<button type="button" ladda="ldloading1.zoom_in" tabindex="3" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="getSemSubDetails(myModel.universityName.universityID,selectedCourseNameC);">GET SUBJECTS</button>
<button type="button" ladda="ldloading1.zoom_in" tabindex="3" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="getSemSubDetails(myModel.universityName.universityID,selectedCourseNameC);">MANUAL SCHDULE</button>
</div>
</div>
<div class="col-md-1 form group">
<br>
<br>
<lable style="color:green ;font-size:14px"> (OR) </lable>
</div>
<div class="col-md-3 form-group">
<fieldset>
<js-xls onread="readUploadBatchDetails" onerror="error"></js-xls>
<br>
<button type="button" class="btn btn-success btn-o" style="float: right" ng-click="UploadFileData(extractFileDetails,myModel,selectedCourseNameC)"> Submit</button>
</fieldset>
</div>
</div>
<div class="row" ng-if="semDropDownShowLoading">
@ -260,9 +273,11 @@
</div>
<div class="col-md-12 form-group" ng-if="semDropDownShow">
<div class="pull-right">
<br>
<button type="button" ladda="ldloading1.zoom_in" tabindex="" class="btn btn-wide btn-primary" data-style="zoom-in" ng-disabled="saveButtonDisabled" ng-click="saveAll(myModel,selectedCourseNameC,subjects);">{{saveButtonTxt}}</button>
<br>
<button type="button" ladda="ldloading1.zoom_in" tabindex="" class="btn btn-wide btn-success" data-style="zoom-in" ng-disabled="saveButtonDisabled" ng-click="saveAll(myModel,selectedCourseNameC,subjects);">{{saveButtonTxt}}</button>
<input type="button" class="btn btn-warning btn-wide" tabindex="3" value="Cancel"
ng-click="remove();">
</div>
</div>