diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 2afba12a..d757c011 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -318,4 +318,5 @@ $route['report_doc_pending'] = 'Report/doc_pending'; $route['report_wav_ref'] = 'Report/wav_ref'; $route['report_examfee'] = 'Report/examfee'; $route['report_balfee'] = 'Report/balfee'; +$route['report_lead'] = 'Report/lead'; diff --git a/Apollo/api/application/controllers/Call_Tracking_Controller.php b/Apollo/api/application/controllers/Call_Tracking_Controller.php index 4ec40ade..72b913bd 100755 --- a/Apollo/api/application/controllers/Call_Tracking_Controller.php +++ b/Apollo/api/application/controllers/Call_Tracking_Controller.php @@ -415,7 +415,7 @@ class Call_Tracking_Controller extends REST_Controller { */ public function autoAddlead_post(){ $student = $this->post('student'); - + //print_r($student);die; if(!empty($student)){ $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); diff --git a/Apollo/api/application/controllers/Report.php b/Apollo/api/application/controllers/Report.php index fd0be293..8a5eb136 100755 --- a/Apollo/api/application/controllers/Report.php +++ b/Apollo/api/application/controllers/Report.php @@ -310,6 +310,31 @@ class Report extends REST_Controller { } + } + public function lead_post() + { + $from = $this->post('from'); + $to = $this->post('to'); + $br = $this->post('branch'); + + $getStatus = $this->report_model->lead($from,$to,$br); + //print_r($getStatus); + if ($getStatus) + { + $getStatus['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + } public function filters_post() { diff --git a/Apollo/api/application/controllers/Reregister_Controller.php b/Apollo/api/application/controllers/Reregister_Controller.php index 2967a0f7..458e9ce1 100644 --- a/Apollo/api/application/controllers/Reregister_Controller.php +++ b/Apollo/api/application/controllers/Reregister_Controller.php @@ -161,12 +161,28 @@ class Reregister_Controller extends REST_Controller { $SemesterID = $this->post('SemNum'); $branchId = $this->post('branchId'); $course = $this->post('Course'); - foreach($SemesterID as $sem){ - if(!empty($sem)){ + $sem = ''; + if(strlen($SemesterID) ==5){ + + if($SemesterID == 'Year1'){ + $sem = '1'; + }else if($SemesterID == 'Year2'){ + $sem = '3'; + }else if($SemesterID == 'Year3'){ + $sem = '5'; + }else{ + $sem = '7'; + } + }else{ + $sem = substr($SemesterID,3); + } + //echo $sem;die; + + $subjectDetails[] = $this->Reregister_model->getsubject($sem,$branchId,$course); - } + // } - } + // } if(sizeof($subjectDetails)>0){ $data['status'] = REST_Controller::HTTP_OK; diff --git a/Apollo/api/application/models/Broadcast_model.php b/Apollo/api/application/models/Broadcast_model.php index ff63ac75..e439c9e3 100755 --- a/Apollo/api/application/models/Broadcast_model.php +++ b/Apollo/api/application/models/Broadcast_model.php @@ -180,7 +180,7 @@ class Broadcast_model extends CI_Model { $this->db->insert_batch('T_BroadcastStatus', $data); if ($this->db->affected_rows() >= 1) { $result['msgStatus'] = true; - $result['message'] = "Successfully Messages Sended!!"; + $result['message'] = "Successfully Messages Sent!!"; } else { $result['msgStatus'] = false; $result['message'] = "error!!"; @@ -270,7 +270,7 @@ class Broadcast_model extends CI_Model { $this->db->insert_batch('T_BroadcastStatus', $data); if ($this->db->affected_rows() >= 1) { $result['msgStatus'] = true; - $result['message'] = "Successfully Messages Sended!!"; + $result['message'] = "Successfully Messages Sent!!"; } else { $result['msgStatus'] = false; $result['message'] = "error!!"; @@ -408,7 +408,7 @@ class Broadcast_model extends CI_Model { $message = urlencode($msg); $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $number . "&SenderID=APOLLO&Message=" . $message . "&ServiceName=PROMOTIONAL_HIGH"); + curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $number . "&SenderID=APODEC&Message=" . $message . "&ServiceName=PROMOTIONAL_HIGH"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $output = curl_exec($ch); curl_close($ch); @@ -483,6 +483,51 @@ class Broadcast_model extends CI_Model { + public function addPhone($details) + { + + + $this->db->select('ID'); + $this->db->from('T_Groups_Numbers'); + $this->db->where('Phone_No', $details['Phone_No']); + $this->db->where('Parent_ID', $details['Parent_ID']); + $query = $this->db->get(); + $resultt['details'] = $query->result(); + if(count($resultt['details'])>0) + { + $res['status']=false; + $res['message'] = 'Phone Number Already Exists'; + } + + else + { + + + + $result= $this->db->insert('T_Groups_Numbers',$details); + + // print_r($result); + + if($result>0) + { + $res['status']=true; + $res['message'] = 'Phone Number Added'; + + } + else + { + $res['status']=false; + $res['message'] = 'Phone Number Adding Failed'; + } + + } + + return $res; + + } + + + public function GetAllGroups($reqBranch) { diff --git a/Apollo/api/application/models/DayBook_model.php b/Apollo/api/application/models/DayBook_model.php index 627c9e52..a3cc182b 100755 --- a/Apollo/api/application/models/DayBook_model.php +++ b/Apollo/api/application/models/DayBook_model.php @@ -673,9 +673,9 @@ class DayBook_model extends CI_Model FROM T_DayBookMaster AS p join T_PickListDetails on T_PickListDetails.ListCode = p.name - where str_to_date(Date,?)>=? and str_to_date(Date,?)<=? and p.IsActive=? and (p.Name=? or p.Name=?) + where str_to_date(Date,?)>=? and str_to_date(Date,?)<=? and p.IsActive=? and (p.Name=? or p.Name=?) and Status !=? GROUP BY p.`Name`'; - $query = $this->db->query($subQuery,array($incomecode,$expensecode,$incomecode,$expensecode,'%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,'1','I001','I002')); + $query = $this->db->query($subQuery,array($incomecode,$expensecode,$incomecode,$expensecode,'%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,'1','I001','I002','Cancel')); $expense = $query->result(); if(count($query)>0) @@ -709,9 +709,9 @@ class DayBook_model extends CI_Model $subQuery='select Name,sum(Amount) as Total,T_DayBookMaster.ID,T_Income_Outcome_Master.ID as SubID,T_Income_Outcome_Master.TypeID as OrgType,T_Income_Outcome_Master.TypeName,T_DayBookMaster.Date,Reason,T_DayBookMaster.Description,ListName from T_DayBookMaster left join T_Income_Outcome_Master on T_Income_Outcome_Master.ID = T_DayBookMaster.Type join T_PickListDetails on T_PickListDetails.ListCode = T_Income_Outcome_Master.TypeID -where str_to_date(date,?)>=? and str_to_date(date,?)<=? group by Type,Name'; +where str_to_date(date,?)>=? and str_to_date(date,?)<=? and Status!=? group by Type,Name'; -$query = $this->db->query($subQuery,array('%d-%m-%Y',$fromd,'%d-%m-%Y',$tod)); +$query = $this->db->query($subQuery,array('%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,'Cancel')); //print_r( $this->db->last_query()); diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index b6da0484..97c5984f 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -16,8 +16,8 @@ class Fees_status_model extends CI_Model * */ public function getStudentList($search=null) { - if($search['MobileNumber']!='' OR $search['Firstname']!='' OR $search['UniversityID']!='' OR $search['CourseID']!=''){ - $this->db->select('ST.StudentID,ST.MobileNumber,ST.Firstname,ST.Lastname,ST.Fathername,ST.EmailID,STC.ID,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName'); + if($search['MobileNumber']!='' OR $search['Firstname']!='' OR $search['UniversityID']!='' OR $search['CourseID']!=''){ + $this->db->select('ST.StudentID,ST.MobileNumber,ST.Firstname,ST.Lastname,ST.Fathername,ST.EmailID,STC.ID,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,ST.PermanentAddress,if(STC.EnrollmentID = "","",STC.EnrollmentID) as EnrollmentID,US.ProfilePicPath,US.MobileNumber as UnivMobileNumber,US.Address,US.EmailID,ST.MotherName,CU.Specilization1 as Specilization'); $this->db->from(STUDENTS.' as ST'); $this->db->join(STUDENTCOURSE.' as STC', 'STC.StudentID = ST.StudentID'); $this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID'); diff --git a/Apollo/api/application/models/Login_model.php b/Apollo/api/application/models/Login_model.php index af78b7af..bfb292bc 100755 --- a/Apollo/api/application/models/Login_model.php +++ b/Apollo/api/application/models/Login_model.php @@ -283,7 +283,8 @@ class Login_model extends CI_Model if($responseDetails->LoginAccess ==1){ $string2 = str_shuffle('1234567890'); $otp = substr($string2,0,6); - //echo $otp;die; + //$otp = '431528'; + // //echo $otp;die; $save['OTP'] = $otp; $save['UpdatedOn'] = date('Y-m-d H:i:s'); // print_r($save);die; @@ -291,7 +292,7 @@ class Login_model extends CI_Model $this->db->where('ListCode',STUDENT); $query = $this->db->update('T_Login',$save); - + // $query =1; if($query == 1){ $sms = $this->smssend($mobile,$otp); diff --git a/Apollo/api/application/models/Reports_model.php b/Apollo/api/application/models/Reports_model.php index afbfb321..79de6b99 100755 --- a/Apollo/api/application/models/Reports_model.php +++ b/Apollo/api/application/models/Reports_model.php @@ -34,7 +34,7 @@ order by CourseID) as cm on cm.cid=cfd.ccid left join (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,AlternateNumber,PresentAddress as address FROM T_StudentDetails where IsActive = 1) as std on std.sid=sms.sid -left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid and scd.branch=sms.branch +left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid where sms.branch = '".$br."' "; @@ -92,7 +92,7 @@ where BranchCode = '".$br."'"; } public function markcard($bat=null,$br=null,$u=null){ - $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(sfs.rollno,'-') as Roll_NO,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sms.cdate,'-') as Date,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.status,'-') as Status,ifnull(sfp.bdate,'-') as Initial_paid_date,ifnull(((sfs.cf + sfs.stf + sfs.others)-sum(sfp.bamount)),0) as Balance_Fee,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber + $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(sfs.rollno,'-') as Roll_NO,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sms.cdate,'-') as Date,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.status,'-') as Status,ifnull(sfp.bdate,'-') as Initial_paid_date,ifnull(((sfs.cf + sfs.stf + sfs.others)-sum(sfp.bamount)),0) as Balance_Fee,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber,appdate,ansdate from (SELECT ID,StudentID as sid,CourseID as cid,BranchCode as branch,ListCode as lcode,CertificationType as ctype,CDate as cdate,Sem as sem FROM T_CertificationStatus WHERE ID IN (SELECT max(ID) FROM T_CertificationStatus group by StudentID,CourseID,BranchCode,Sem) @@ -118,7 +118,21 @@ order by CourseID) as cm on cm.cid=cfd.ccid left join (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid -left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid and scd.branch=sms.branch +left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid +left join (select ID,StudentID as sid,Sem, +if(ListName = 'SENT TO UNIVERSITY', AnsDate,'-') as ansdate +from T_AnswerBookletStatus abs +left join T_PickListDetails list on list.ListCode=abs.ListCode +where AnsDate is not null and ID in (select max(ID) from T_AnswerBookletStatus where AnsDate is not null group by StudentID,Sem) +group by sid,Sem) as andate on andate.sid=sms.sid and andate.Sem=cfd.syear +left join (select abs.ID,StudentID as sid,Sem_Year as sem, +max(if(ListName = 'SENT TO UNIVERSITY', AppDate,'-')) as appdate +from T_ApplicationStatus abs +left join T_PickListDetails list on list.ListCode=abs.ListCode +left join T_Course_Fees_Details cf on cf.CourseID=abs.CourseID +where AppDate is not null + and abs.ID in (select max(ID) from T_ApplicationStatus where AppDate is not null group by StudentID) +group by sid,sem) as apdate on apdate.sid=sms.sid and apdate.sem=cfd.syear where std.active = 1 and sms.branch = '".$br."' "; @@ -132,7 +146,7 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen $sql.=" and cm.uid = '".$u."'"; } - $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem"; + $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem,Sem_year"; $leadDet=$this->db->query($sql); $mstatusDetails = $leadDet->result(); @@ -149,65 +163,7 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen } public function certificate_status($bat=null,$br=null,$u=null){ - $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(sms.certname,'-') as Certificate_name,ifnull(std.father,'-') as Father,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sms.adate,'-') as Date,ifnull(cfd.syear,'-') as Sem_year,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.status,'-') as Status,ifnull(sfp.bdate,'-') as Document_fee_paid_date,ifnull(((sfs.cf + sfs.stf + sfs.others)-sum(sfp.bamount)),0) as Balance_fee,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber - from - (SELECT ID,StudentID as sid,CourseID as cid,app.BranchCode as branch,ListCode as lcode,AppDate as adate,Comments as acmts,CertificationType as ctype,CertificateName as certname FROM T_ApplicationStatus as app -left join T_CertificationMaster cm on cm.CertificationID=app.CertificationType -where CertificationType != 'CERT024' and ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,BranchCode) -group by sid,cid,lcode,branch) as sms - left join - (SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype,sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others FROM T_Students_Fees_Status - group by sid,fid,cid,batch) as sfs on sfs.sid=sms.sid and sms.cid=sfs.cid - left join - (SELECT StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails -where IsActive = 1 -group by sid,fid,billno) as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid - left join - (SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd - on cfd.ccid=sms.cid - left join - (SELECT ListCode as lcode,ListName as status FROM T_PickListDetails) as list - on list.lcode=sms.lcode - left join - (SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm -left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID -group by cid -order by CourseID) as cm - on cm.cid=cfd.ccid - left join - (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid -left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid and scd.branch=sms.branch - where std.active = 1 and sms.branch = '".$br."' - "; - - if ($bat!= ''){ - - $sql.=" and sfs.batch = '".$bat."'"; - - } - if ($u!= ''){ - - $sql.=" and cm.uid = '".$u."'"; - - } - $sql.=" group by Student_id,Course_id,Batch_code,Branch_code"; - - $leadDet=$this->db->query($sql); - $cert_statusDetails = $leadDet->result(); - if (count($cert_statusDetails) > 0) { - $results['certList'] = true; - $results['cert_data'] = $cert_statusDetails; - } else { - $results['certList'] = false; - $results['message'] = 'No record found'; - } - - return $results; - - } - public function mark_cert_status($bat=null,$br=null,$u=null,$from=null,$to=null){ - - $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as course_name,ifnull(cm.uname,'-') as University,ifnull(sfp.bdate,'-') as Document_fee_paid_date,ifnull(((sfs.cf + sfs.stf + sfs.others)-sfp.bamount),0) as Balance_fee,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(list.status,'-') as Markcard_status,ifnull(sms.mdate,'-') as Markcard_date,ifnull(sms.mcmts,'-') as Markcard_comments,ifnull(ams.certname,'-') as Certificate_name,ifnull(alist.astatus,'-') as Certificate_status,ifnull(ams.adate,'-') as Certificate_date,ifnull(ams.acmts,'-') as Certificate_comments,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber + $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(sfp.bdate,'-') as Document_fee_paid_date,ifnull(((sfs.cf + sfs.stf + sfs.others)-sum(sfp.bamount)),0) as Balance_fee,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(list.status,'-') as Markcard_status,ifnull(sms.mdate,'-') as Markcard_date,ifnull(sms.mcmts,'-') as Markcard_comments,ifnull(ams.certname,'-') as Certificate_name,ifnull(alist.astatus,'-') as Certificate_status,ifnull(ams.adate,'-') as Certificate_date,ifnull(ams.acmts,'-') as Certificate_comments,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber from (SELECT ID,StudentID as sid,CourseID as cid,BranchCode as branch,ListCode as lcode, CertificationType as ctype,CDate as mdate,Sem as sem,Comments as mcmts @@ -248,7 +204,79 @@ left join as cm on cm.cid=cfd.ccid left join (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid -left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid and scd.branch=sms.branch +left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid + where std.active = 1 and sms.branch = '".$br."' + "; + + if ($bat!= ''){ + + $sql.=" and sfs.batch = '".$bat."'"; + + } + if ($u!= ''){ + + $sql.=" and cm.uid = '".$u."'"; + + } + $sql.=" group by Student_id,Course_id,Batch_code,Branch_code"; + + $leadDet=$this->db->query($sql); + $cert_statusDetails = $leadDet->result(); + if (count($cert_statusDetails) > 0) { + $results['certList'] = true; + $results['cert_data'] = $cert_statusDetails; + } else { + $results['certList'] = false; + $results['message'] = 'No record found'; + } + + return $results; + + } + public function mark_cert_status($bat=null,$br=null,$u=null,$from=null,$to=null){ + + $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(sfp.bdate,'-') as Document_fee_paid_date,ifnull(((sfs.cf + sfs.stf + sfs.others)-sum(sfp.bamount)),0) as Balance_fee,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(list.status,'-') as Markcard_status,ifnull(sms.mdate,'-') as Markcard_date,ifnull(sms.mcmts,'-') as Markcard_comments,ifnull(ams.certname,'-') as Certificate_name,ifnull(alist.astatus,'-') as Certificate_status,ifnull(ams.adate,'-') as Certificate_date,ifnull(ams.acmts,'-') as Certificate_comments,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber + from + (SELECT ID,StudentID as sid,CourseID as cid,BranchCode as branch,ListCode as lcode, + CertificationType as ctype,CDate as mdate,Sem as sem,Comments as mcmts + FROM T_CertificationStatus + WHERE ID IN (SELECT max(ID) FROM T_CertificationStatus group by StudentID,CourseID,BranchCode,Sem) + group by sid,sem,cid,lcode,branch) as sms +left join + (SELECT ID,StudentID as sid,CourseID as cid,app.BranchCode as branch,ListCode as lcode,AppDate as adate,Comments as acmts,CertificationType as ctype,CertificateName as certname + FROM T_ApplicationStatus as app + left join T_CertificationMaster cm on cm.CertificationID=app.CertificationType + where CertificationType != 'CERT024' and ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,BranchCode) + group by sid,cid,lcode,branch) + as ams on ams.branch=sms.branch and ams.sid=sms.sid +left join + (SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype, sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others + FROM T_Students_Fees_Status + group by sid,fid,cid,batch) + as sfs on sfs.sid=sms.sid and sms.cid=sfs.ftype +left join + (SELECT StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails +where IsActive = 1 + group by sid,fid,billno) + as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid +left join + (SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.cid=sms.cid +left join + (SELECT ListCode as lcode,ListName as status FROM T_PickListDetails) + as list on list.lcode=sms.lcode +left join + (SELECT ListCode as lcode,ListName as astatus FROM T_PickListDetails) + as alist on alist.lcode=ams.lcode +left join + (SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course, + UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm + left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID + group by cid + order by CourseID) + as cm on cm.cid=cfd.ccid +left join + (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid +left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid where std.active = 1 and sms.branch = '".$br."' "; @@ -263,15 +291,15 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen } if ($from != '' and $to != ''){ - $fromd= date("d-m-Y",strtotime($from)); - $tod=date("d-m-Y",strtotime($to)); + $fromd= date("Y-m-d",strtotime($from)); + $tod=date("Y-m-d",strtotime($to)); - $sql.="and sfp.bdate >= '".$fromd."' - and sfp.bdate <= '".$tod."'"; + $sql.="and STR_TO_DATE(sfp.bdate,'%d-%m-%Y') >= '".$fromd."' + and STR_TO_DATE(sfp.bdate,'%d-%m-%Y') <= '".$tod."'"; } - $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem"; + $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem,Sem_year"; $leadDet=$this->db->query($sql); @@ -295,11 +323,11 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen "; if ($from and $to != ''){ - $fromd= date("d-m-Y",strtotime($from)); - $tod=date("d-m-Y",strtotime($to)); - - $sql.="and dbm.Date >= '".$fromd."' - and dbm.Date <= '".$tod."'"; + $fromd= date("Y-m-d",strtotime($from)); + $tod=date("Y-m-d",strtotime($to)); + + $sql.="and STR_TO_DATE(dbm.Date,'%d-%m-%Y') >= '".$fromd."' + and STR_TO_DATE(dbm.Date,'%d-%m-%Y') <= '".$tod."'"; } $sql.=" group by Expense_name"; @@ -320,12 +348,14 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen } public function answer_booklet($bat=null,$br=null,$u=null){ - $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(sms.adate,'-') as Date,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.status,'-') as Status,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber + $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(sms.adate,'-') as Date,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.status,'-') as Status,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber,listdate.issuedate,listdate.rcvedate + from (SELECT ID,StudentID as sid,CourseID as cid,BranchCode as branch,ListCode as lcode,AnsDate as adate,Sem as sem FROM T_AnswerBookletStatus WHERE ID IN (SELECT max(ID) FROM T_AnswerBookletStatus group by StudentID,CourseID,BranchCode,Sem) group by sid,sem,cid,lcode,branch) as sms + left join (SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype, sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others FROM T_Students_Fees_Status @@ -350,7 +380,15 @@ left join as cm on cm.cid=cfd.ccid left join (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid -left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid and scd.branch=sms.branch +left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid +left join + (select ID,StudentID as sid, +max(if(ListName = 'ISSUED TO STUDENT', AnsDate,'-')) as issuedate, +max(if(ListName = 'RECEIVED FROM STUDENT', AnsDate,'-')) as rcvedate +from T_AnswerBookletStatus abs +left join T_PickListDetails list on list.ListCode=abs.ListCode where AnsDate is not null +group by sid +) as listdate on listdate.sid=sms.sid where std.active = 1 and sms.branch = '".$br."' "; @@ -364,7 +402,7 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen $sql.=" and cm.uid = '".$u."'"; } - $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem"; + $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem,Sem_year"; @@ -383,12 +421,13 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen } public function app_pending($bat=null,$br=null,$u=null){ - $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(cfd.syear,'-') as Sem_year,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.status,'-') as Status,ifnull(sfp.bdate,'-') as Admission_date, + $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(cfd.syear,'-') as Sem_year,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(sms.status,'-') as Status,ifnull(sfp.bdate,'-') as Admission_date, ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber from - (SELECT ID,StudentID as sid,CourseID as cid,app.BranchCode as branch,ListCode as lcode,AppDate as adate,Comments as acmts,CertificationType as ctype,CertificateName as certname FROM T_ApplicationStatus as app + (SELECT ID,StudentID as sid,CourseID as cid,app.BranchCode as branch,list.ListName as status,app.ListCode as lcode,AppDate as adate,Comments as acmts,CertificationType as ctype,CertificateName as certname FROM T_ApplicationStatus as app left join T_CertificationMaster cm on cm.CertificationID=app.CertificationType -where CertificateName = 'APPLICATION' and ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,BranchCode) +left join T_PickListDetails list on list.ListCode=app.ListCode +where CertificateName like 'APPLICATION%' and list.ListName != 'SENT TO UNIVERSITY' and ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,BranchCode) group by sid,cid,lcode,branch) as sms left join (SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype, sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others @@ -402,9 +441,6 @@ WHERE IsActive = 1 and ID IN (SELECT min(ID) FROM T_Students_Fees_PaidDetails gr as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid left join (SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.ccid=sfs.cid and cfd.cid=sfs.ftype -left join - (SELECT ListCode as lcode,ListName as status FROM T_PickListDetails) - as list on list.lcode=sms.lcode left join (SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course, UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm @@ -428,7 +464,7 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen $sql.=" and cm.uid = '".$u."'"; } - $sql.=" group by Student_id,Course_id,Batch_code,Branch_code"; + $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem_year"; @@ -447,44 +483,51 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen } public function doc_pending($bat=null,$br=null,$u=null){ - $sql = "SELECT ifnull(sdt.StudentID,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(sfb.bdate,'-') as Admission_date,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(lt.CreatedBranch,'-') as Branch_code,ifnull(sfb.batch,'-') as Batch_code,ifnull(lt.Course,'-') as Course_name,ifnull(lt.University,'-') as University,ifnull(uc.cid,'-') as Course_id,ifnull(cfd.syear,'-') as Sem_year,ifnull(sdt.StatusName,'-') as Status,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber - FROM T_Student_DocumentTrack_Details as sdt - join T_Lead_Tracking as lt on lt.PendingDocStatus=sdt.ID - left join - (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sdt.StudentID - left join + $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(cfd.syear,'-') as Sem_year,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(sms.status,'-') as Status,sms.certname as certname,ifnull(sfp.bdate,'-') as Admission_date,sms.adate, + ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber + from + (SELECT ID,StudentID as sid,CourseID as cid,app.BranchCode as branch,list.ListName as status,app.ListCode as lcode,AppDate as adate,Comments as acmts,CertificationType as ctype,CertificateName as certname FROM T_ApplicationStatus as app +left join T_CertificationMaster cm on cm.CertificationID=app.CertificationType +left join T_PickListDetails list on list.ListCode=app.ListCode +where list.ListName = 'PENDING' and ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,BranchCode) +group by sid,cid,lcode,branch) as sms +left join + (SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype, sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others + FROM T_Students_Fees_Status + group by sid,fid,cid,batch) + as sfs on sfs.sid=sms.sid and sms.cid=sfs.cid +left join + (SELECT ID,StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails +WHERE IsActive = 1 and ID IN (SELECT min(ID) FROM T_Students_Fees_PaidDetails group by StudentID,FeesID) + group by sid,fid,billno) + as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid +left join + (SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.ccid=sfs.cid and cfd.cid=sfs.ftype +left join (SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course, - UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm - left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID - group by cid - order by CourseID) as uc on uc.course=lt.Course - left join - (SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.ccid=uc.cid - left join - (select sfp.sid,sfp.bdate,sfs.batch,sfs.cid from (SELECT ID,StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails - WHERE IsActive = 1 and ID IN (SELECT min(ID) FROM T_Students_Fees_PaidDetails group by StudentID,FeesID) - group by sid,fid,billno) as sfp - join - (SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype,sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others - FROM T_Students_Fees_Status - group by sid,fid,cid,batch) as sfs on sfs.fid=sfp.fid and sfs.sid=sfp.sid - group by sfs.sid,sfs.cid) as sfb on sfb.sid=sdt.StudentID and sfb.cid=uc.cid - left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sdt.StudentID and scd.cid=uc.cid and scd.branch=uc.branch - where std.active = 1 and lt.CreatedBranch = '".$br."' + UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm + left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID + group by cid + order by CourseID) + as cm on cm.cid=cfd.ccid +left join + (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid +left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid and scd.branch=sms.branch + where std.active = 1 and sms.branch = '".$br."' "; if ($bat!= ''){ - $sql.=" and sfb.batch = '".$bat."'"; + $sql.=" and sfs.batch = '".$bat."'"; } if ($u!= ''){ - $sql.=" and uc.cuid = '".$u."'"; + $sql.=" and cm.uid = '".$u."'"; } - $sql.="group by Student_id,Course_id,Batch_code,Branch_code "; + $sql.="group by Student_id,Course_id,Batch_code,Branch_code,Sem_year "; @@ -503,9 +546,9 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen } public function wav_ref($bat=null,$br=null,$u=null){ - $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(cfd.syear,'-') as Sem_year,ifnull(sfs.batch,'-') as Batch_code,ifnull(scd.branch,'-') as Branch_code,ifnull(sfs.cid,'-') as Course_id,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(sms.waiver_bill,'-') as Waiver_bill,ifnull(sms.waiver,0) as Waiver_amount,ifnull(sms.referal_bill,'-') as Referal_bill,ifnull(sms.referal,0) as Referal_amount,ifnull(sms.cmts,'-') as Comments,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber + $sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(cfd.syear,'-') as Sem_year,ifnull(sfs.batch,'-') as Batch_code,ifnull(scd.branch,'-') as Branch_code,ifnull(sfs.cid,'-') as Course_id,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,staff.FirstName as staffname,ifnull(sms.waiver_bill,'-') as Waiver_bill,ifnull(sms.waiver,0) as Waiver_amount,ifnull(sms.referal_bill,'-') as Referal_bill,ifnull(sms.referal,0) as Referal_amount,ifnull(sms.cmts,'-') as Comments,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber from - (SELECT StudentID as sid,CommentsForStudent as cmts,FeesId as fid, + (SELECT StudentID as sid,CreatedBy as lid,CommentsForStudent as cmts,FeesId as fid, IF(ModeOfPayment = 'WAIVER', BillNO,'-') AS waiver_bill, IF(ModeOfPayment = 'WAIVER', sum(BillAmount), 0) AS waiver, IF(ModeOfPayment = 'REFERRAL', BillNO,'-') AS referal_bill, @@ -529,6 +572,10 @@ left join as cm on cm.cid=cfd.ccid left join (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,FirstName as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid +left join + T_Login as login on login.ID=sms.lid +left join + T_StaffDetails as staff on staff.StaffID=login.StaffID where std.active = 1 and scd.branch = '".$br."' "; @@ -543,7 +590,7 @@ left join $sql.=" and cm.uid = '".$u."'"; } - $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Waiver_bill,Referal_bill"; + $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Waiver_bill,Referal_bill,Sem_year"; @@ -598,7 +645,7 @@ left join $sql.=" and cm.uid = '".$u."'"; } - $sql.=" group by Student_id,Course_id,Batch_code,Branch_code"; + $sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem_year"; @@ -617,7 +664,7 @@ left join } public function balfee($bat=null,$br=null,$u=null){ - $sql = "SELECT ifnull(sfp.StudentID,'-') as Student_id,ifnull(scd.eid,'-') as eid,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sfs.batch,'-') as Batch_code,ifnull(sfs.cid,'-') as Course_id,ifnull(cm.course,'-') as Course_name,ifnull(u.uname,'-') as University,ifnull(sfs.branch,'-') as Branch_code,ifnull(cfd.syear,'-') as Sem_year,ifnull((sfs.cf + sfs.stf + sfs.others),0) as Total,ifnull((sfb.bamount),0) as Paid_fee,ifnull(((sfs.cf + sfs.stf + sfs.others) - (sfb.bamount)),0) as balance, + $sql = "SELECT ifnull(sfp.StudentID,'-') as Student_id,ifnull(scd.eid,'-') as eid,ifnull(std.name,'-') as Student_name,date_format(std.regdate,'%d-%m-%Y') as regdate,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sfs.batch,'-') as Batch_code,ifnull(sfs.cid,'-') as Course_id,ifnull(cm.course,'-') as Course_name,ifnull(u.uname,'-') as University,ifnull(sfs.branch,'-') as Branch_code,ifnull(cfd.syear,'-') as Sem_year,ifnull((sfs.cf + sfs.stf + sfs.others),0) as Total,ifnull((sfb.bamount),0) as Paid_fee,ifnull(((sfs.cf + sfs.stf + sfs.others) - (sfb.bamount)),0) as balance, ifnull(MAX(CASE WHEN Installment = 1 THEN sfp.BillNO END),'-') as billno1, ifnull(MAX(CASE WHEN Installment = 1 THEN sfp.BillAmount END),0) as billamt1, ifnull(MAX(CASE WHEN Installment = 2 THEN sfp.BillNO END),'-') as billno2, @@ -652,7 +699,7 @@ left join (SELECT UniversityID as uid,UniversityName as uname FROM T_UniversityMaster) as u on u.uid=cm.uid left join - (SELECT StudentID as sid,MobileNumber as phone,FirstName as name,Fathername as father,IsActive as active,PermanentAddress as address,AlternateNumber FROM T_StudentDetails where IsActive = 1) as std on std.sid=sfp.StudentID + (SELECT StudentID as sid,MobileNumber as phone,FirstName as name,Fathername as father,IsActive as active,PermanentAddress as address,AlternateNumber,CreatedOn as regdate FROM T_StudentDetails where IsActive = 1) as std on std.sid=sfp.StudentID left join (SELECT BatchCode as bcode,BatchName as batchname FROM T_BatchMaster) as b on b.bcode=sfs.batch left join @@ -660,7 +707,7 @@ left join left join (SELECT StudentID as sid,FeesID as fid,BillNo as billno,sum(BillAmount) as bamount FROM T_Students_Fees_PaidDetails where IsActive = 1 group by sid,fid) as sfb on sfb.sid=sfp.StudentID and sfb.fid=sfp.FeesID -left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sfs.sid and scd.cid=sfs.cid and scd.branch=sfs.branch +left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sfs.sid where sfp.IsActive = 1 and br.brcode = '".$br."' "; @@ -694,6 +741,48 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen return $results; + } + public function lead($from=null,$to=null,$br=null){ + + $sql = "select InteractionID,date_format(ltf.CreatedOn,'%d-%m-%Y') as date,ltf.TrackingID as tid,ltf.FollowupOn as fup,ld.LeadName as name,ld.MobileNumber as mobile,lt.University as univ,lt.Course as course,lt.Course as prvStatus,list.ListName as prsStatus,ltf.FollowupComments as cmnts,ifnull(am.ActivityName,'-') as activity,sd.FirstName as AssignTo +from T_Lead_Tracking_Followup as ltf + left join T_Lead_Tracking lt on lt.TrackingID=ltf.TrackingID + join T_Login l on l.ID=lt.AssignedTo + join T_StaffDetails sd on sd.StaffID=l.StaffID + left join T_Lead_Details ld on ld.LeadID=lt.LeadID + left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus + join T_PickListDetails list on list.ListCode=ltf.StatusName + where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) and lt.CreatedBranch = '".$br."' + + "; + + if ($from and $to != ''){ + $fromd= date("Y-m-d",strtotime($from)); + $tod=date("Y-m-d",strtotime($to)); + + $sql.=" and date(ltf.CreatedOn) >= '".$fromd."' + and date(ltf.CreatedOn) <= '".$tod."'"; + + } + + + + + $leadDet=$this->db->query($sql); + $answer = $leadDet->result(); + + //echo $sql; + + if (count($answer) > 0) { + $results['leadList'] = true; + $results['lead_data'] = $answer; + } else { + $results['leadList'] = false; + $results['message'] = 'No record found'; + } + + return $results; + } } \ No newline at end of file diff --git a/Apollo/assets/css/styles.css b/Apollo/assets/css/styles.css index 82be7514..dd86ef6b 100755 --- a/Apollo/assets/css/styles.css +++ b/Apollo/assets/css/styles.css @@ -5821,7 +5821,7 @@ input[type="radio"], input[type="checkbox"] { color: #8e8e93 !important; } .btn-default:active, .btn-default.active, .btn-default.active:focus, .btn-default:active:focus, .btn-default:active:hover { - background-color: #f8f8f8; + background-color: #007AFF; border-color: #d5d4d8; color: #5b5b60 !important; } diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index 2936f67c..6898b6e5 100755 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -90,7 +90,8 @@ "doc_pending": "DOCUMENT PENDING STUDENT LIST REPORT", "wav_ref": "WAIVER AND REFERAL REPORT", "examfee": "EXAM WRITING FEE REPORT", - "balfee": "FEE BALANCE REPORT" + "balfee": "FEE BALANCE REPORT", + "lead": "LEAD TRACKING REPORT" }, "student": { diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index 16a9188a..165e47e5 100755 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -216,6 +216,7 @@ app.constant('JS_REQUIRES', { 'report_waiver_referalCtrl':'assets/js/controllers/report_waiver_referalCtrl.js', 'report_examfeeCtrl':'assets/js/controllers/report_examfeeCtrl.js', 'report_balfeeCtrl':'assets/js/controllers/report_balfeeCtrl.js', + 'report_leadCtrl':'assets/js/controllers/report_leadCtrl.js', }, //*** angularJS Modules modules: [{ diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index e2b93790..053d2cf3 100755 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -651,6 +651,12 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com resolve: loadSequence('ui.select','report_balfeeCtrl','ngTable', 'ladda', 'angular-ladda'), title: 'Balance Fee Report', + }).state('app.reports.lead', { + url: '/report_leadCtrl', + templateUrl: "assets/views/report_lead.html", + resolve: loadSequence('ui.select','report_leadCtrl','ngTable', 'ladda', 'angular-ladda'), + title: 'Lead Details Report', + }).state('app.hallTicket', { url: '/hallticket', template: '
HALLTICKET
', diff --git a/Apollo/assets/js/controllers/BatchmomentCtrl.js b/Apollo/assets/js/controllers/BatchmomentCtrl.js index 394d3892..237159c5 100644 --- a/Apollo/assets/js/controllers/BatchmomentCtrl.js +++ b/Apollo/assets/js/controllers/BatchmomentCtrl.js @@ -28,6 +28,25 @@ $scope.promoteButtonStatus = false; * created by velz * */ $scope.init = function () { + + + // var logcheck = JSON.parse(localStorage.getItem('localObj')); + + // const LOCALTYPE = logcheck.localType; + // if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + // console.log("if"); + // }else { + // if(logcheck != null && LOCALTYPE !='R001') { + // console.log("else if"); + // $state.go('app.dashboard'); + // } else { + + // console.log("else else"); + // //ipCookie.remove('cookiechk'); + // window.localStorage.clear(); + // $state.go('login.signin'); + // } + // } var getUniv = { method: 'POST', diff --git a/Apollo/assets/js/controllers/activityCtrl.js b/Apollo/assets/js/controllers/activityCtrl.js index d69d24a9..fd2d9c0c 100755 --- a/Apollo/assets/js/controllers/activityCtrl.js +++ b/Apollo/assets/js/controllers/activityCtrl.js @@ -10,20 +10,22 @@ app.controller("activityCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$ var localDetail = JSON.parse(localStorage.getItem('localObj')); var localDetails = ipCookie('cookiechk'); - $scope.initHead = function() { - // alert(); - const LOCALTYPE = localDetail.localType; - if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { - }else { - if(localDetail != null) { - $state.go('app.dashboard'); - } else { - ipCookie.remove('cookiechk'); - $window.localStorage.clear(); - $state.go('login.signin'); - } - } - } + // $scope.initHead = function() { + // // alert(); + // const LOCALTYPE = localDetail.localType; + // if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + // }else { + // if((localDetail != null) && (LOCALTYPE !='R001')) { + // $state.go('app.dashboard'); + // } else { + // ipCookie.remove('cookiechk'); + // window.localStorage.clear(); + // $state.go('login.signin'); + // } + // } + // } + + $scope.companies = { "ActivityID": "", "ActivityName": "", @@ -163,6 +165,29 @@ swal("Warning!", "Status are required", "warning"); $scope.loader = ''; $scope.emptyData = ''; $scope.init = function () { + + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + localStorage.setItem('localStatusDetails', ''); var getActivity = { diff --git a/Apollo/assets/js/controllers/announcementCtrl.js b/Apollo/assets/js/controllers/announcementCtrl.js index 7401bcdf..bf3239bd 100755 --- a/Apollo/assets/js/controllers/announcementCtrl.js +++ b/Apollo/assets/js/controllers/announcementCtrl.js @@ -195,6 +195,26 @@ app.controller("CkeditorCtrl", ["$scope", "toaster", "$filter", "ngTableParams", $scope.init = function () { + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + var getAnnouncement = { method: 'POST', url: apiPoint.url + 'getAnnouncementDetails/', diff --git a/Apollo/assets/js/controllers/answerBookletStatusCtrl.js b/Apollo/assets/js/controllers/answerBookletStatusCtrl.js index 84435d42..7f76b306 100755 --- a/Apollo/assets/js/controllers/answerBookletStatusCtrl.js +++ b/Apollo/assets/js/controllers/answerBookletStatusCtrl.js @@ -29,6 +29,30 @@ app.controller('answerBookletStatusCtrl', ["$scope", "toaster", "$filter", "ngTa $scope.localBranchDetails = ''; $scope.init = function () { + + // var logcheck = JSON.parse(localStorage.getItem('localObj')); + + // const LOCALTYPE = logcheck.localType; + // if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + // console.log("if"); + // }else { + // if(logcheck != null && LOCALTYPE !='R001') { + // console.log("else if"); + // $state.go('app.dashboard'); + // } else { + + // console.log("else else"); + // //ipCookie.remove('cookiechk'); + // window.localStorage.clear(); + // $state.go('login.signin'); + // die(); + // } + // } + + + + + if (localDetail != null) { if (localDetails.localType === 'R004') { $scope.localTypeSuperAdmin = true; diff --git a/Apollo/assets/js/controllers/applicationStatusCtrl.js b/Apollo/assets/js/controllers/applicationStatusCtrl.js index e68625ff..9ed53ff7 100755 --- a/Apollo/assets/js/controllers/applicationStatusCtrl.js +++ b/Apollo/assets/js/controllers/applicationStatusCtrl.js @@ -34,6 +34,27 @@ app.controller('applicationStatusCtrl', ["$scope", "toaster", "$filter", "ngTabl $scope.init = function () { + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + if (localDetail != null) { if (localDetails.localType === 'R004') { $scope.localTypeSuperAdmin = true; diff --git a/Apollo/assets/js/controllers/batchCtrl.js b/Apollo/assets/js/controllers/batchCtrl.js index 9ef5ac69..18164da5 100755 --- a/Apollo/assets/js/controllers/batchCtrl.js +++ b/Apollo/assets/js/controllers/batchCtrl.js @@ -240,6 +240,33 @@ app.controller('batchCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTabl $scope.emptyData=''; $rootScope.init = function () { + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + + + + + + localStorage.setItem('localUniversityDetails', ''); var getBranch = { diff --git a/Apollo/assets/js/controllers/branchCtrl.js b/Apollo/assets/js/controllers/branchCtrl.js index 122e5b25..bae7ad09 100755 --- a/Apollo/assets/js/controllers/branchCtrl.js +++ b/Apollo/assets/js/controllers/branchCtrl.js @@ -353,6 +353,29 @@ app.controller('branchCtrl', ["$scope","toaster", "$filter", "ngTableParams", "A $scope.init = function () { + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + + var getBranch = { method: 'POST', url: apiPoint.url + 'getBranchDetails/', diff --git a/Apollo/assets/js/controllers/callTrackingCtrl.js b/Apollo/assets/js/controllers/callTrackingCtrl.js index 81040070..ca3949fb 100755 --- a/Apollo/assets/js/controllers/callTrackingCtrl.js +++ b/Apollo/assets/js/controllers/callTrackingCtrl.js @@ -403,6 +403,32 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter", * created by kms * */ $scope.init = function (myModel) { + + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + + + + $scope.data = []; if(myModel!='' && myModel!=undefined){ $scope.finalSearchArry=myModel; @@ -656,6 +682,26 @@ app.controller('callTrackingLeadCtrl', ["$scope","$rootScope","toaster", "$filte }*/ + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + $scope.loader = true; var getRecentlead = { @@ -838,6 +884,30 @@ app.controller('callTrackingCloseCtrl', ["$scope","$rootScope","toaster", "$filt $scope.loadDate = $filter('date')(new Date($scope.getdate), 'yyyy-MM-dd'); }*/ + + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + + $scope.loader = true; var getRecentclose = { @@ -1021,6 +1091,27 @@ app.controller('callTrackingPendingCtrl', ["$scope","$rootScope","toaster", "$fi $scope.loadDate = $filter('date')(new Date($scope.getdate), 'yyyy-MM-dd'); }*/ + + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + $scope.loader = true; var getRecentclose = { diff --git a/Apollo/assets/js/controllers/centerCtrl.js b/Apollo/assets/js/controllers/centerCtrl.js index 8203f8c7..9bd307b1 100755 --- a/Apollo/assets/js/controllers/centerCtrl.js +++ b/Apollo/assets/js/controllers/centerCtrl.js @@ -191,6 +191,29 @@ app.controller('centerCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab $rootScope.init = function () { + + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + var getCenter = { method: 'POST', url: apiPoint.url + 'getCenterDetails/', diff --git a/Apollo/assets/js/controllers/certificateCtrl.js b/Apollo/assets/js/controllers/certificateCtrl.js index a78c022c..071561ce 100755 --- a/Apollo/assets/js/controllers/certificateCtrl.js +++ b/Apollo/assets/js/controllers/certificateCtrl.js @@ -111,6 +111,31 @@ $scope.certificateForm = { $scope.init = function () { + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + + + + var getCertificate = { method: 'POST', url: apiPoint.url + 'getCertificateDetails/', diff --git a/Apollo/assets/js/controllers/certificationStatusCtrl.js b/Apollo/assets/js/controllers/certificationStatusCtrl.js index 225338d6..e67f0b91 100755 --- a/Apollo/assets/js/controllers/certificationStatusCtrl.js +++ b/Apollo/assets/js/controllers/certificationStatusCtrl.js @@ -31,6 +31,30 @@ app.controller('certificationStatusCtrl', ["$scope", "toaster", "$filter", "ngTa $scope.localBranchDetails = ''; $scope.init = function () { + + + + const LOCALTYPE = localDetail.localType; + if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(localDetail != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + //window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + + + if (localDetail != null) { if (localDetails.localType === 'R004') { $scope.localTypeSuperAdmin = true; diff --git a/Apollo/assets/js/controllers/courseCtrl.js b/Apollo/assets/js/controllers/courseCtrl.js index 5477b170..7a73d074 100755 --- a/Apollo/assets/js/controllers/courseCtrl.js +++ b/Apollo/assets/js/controllers/courseCtrl.js @@ -16,11 +16,11 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab const LOCALTYPE = localDetail.localType; if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { }else { - if(localDetail != null) { + if(localDetail != null && LOCALTYPE != 'R001') { $state.go('app.dashboard'); } else { ipCookie.remove('cookiechk'); - $window.localStorage.clear(); + window.localStorage.clear(); $state.go('login.signin'); } } diff --git a/Apollo/assets/js/controllers/dayBookMasterCtrl.js b/Apollo/assets/js/controllers/dayBookMasterCtrl.js index 0f18e2ca..4544e1fd 100755 --- a/Apollo/assets/js/controllers/dayBookMasterCtrl.js +++ b/Apollo/assets/js/controllers/dayBookMasterCtrl.js @@ -119,6 +119,29 @@ app.controller("dayBookMasterCtrl", ["$scope", "toaster", "$filter", "API_POINTS $scope.init = function () { + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + + + var getdetails = { method: 'POST', url: apiPoint.url + 'getDayBookMasterDetails/', diff --git a/Apollo/assets/js/controllers/daybookCtrl.js b/Apollo/assets/js/controllers/daybookCtrl.js index 96d74667..a109edf7 100755 --- a/Apollo/assets/js/controllers/daybookCtrl.js +++ b/Apollo/assets/js/controllers/daybookCtrl.js @@ -226,9 +226,14 @@ $scope.dayBookApprovalAccess = ''; // alert(JSON.stringify($scope.myModel)); } - + $scope.deleted1 = function (id) { + + var id=id; + var reason=prompt("Enter Reason!",""); + $scope.deleteFeePayableEntry(reason,id); + } //delete the income entry From the fees payable - $scope.deleteFeePayableEntry = function (id) { + $scope.deleteFeePayableEntry = function (reason, id) { // alert(id); SweetAlert.swal({ title: "Warning!", @@ -248,6 +253,7 @@ $scope.dayBookApprovalAccess = ''; 'Content-Type': 'application/json' }, data: { + reason:reason, data: id, requestDetails: localDetails } @@ -264,9 +270,18 @@ $scope.dayBookApprovalAccess = ''; }); } + $scope.deleted = function (id) { + + var id=id; + var a=prompt("Enter Reason!",""); + $scope.deleEditEntry(a,id); + + + + } // delete the income/expense list row - $scope.deleEditEntry = function (id) { + $scope.deleEditEntry = function (a, id) { swal({ title: "Are you sure?", text: "Your will not be able to recover this record!", @@ -277,9 +292,9 @@ $scope.dayBookApprovalAccess = ''; closeOnConfirm: false }, function () { - $scope.indexDelete2(id); + $scope.indexDelete2(a, id); }); - $scope.indexDelete2 = function (id) { + $scope.indexDelete2 = function (a, id) { var deleteDetails = { method: 'POST', url: apiPoint.url + 'deleteDayBookDetails/', @@ -287,6 +302,7 @@ $scope.dayBookApprovalAccess = ''; 'Content-Type': 'application/json' }, data: { + reason: a, data: id, requestDetails: localDetails } diff --git a/Apollo/assets/js/controllers/daybookadminCtrl.js b/Apollo/assets/js/controllers/daybookadminCtrl.js index c4459d42..eae15de8 100755 --- a/Apollo/assets/js/controllers/daybookadminCtrl.js +++ b/Apollo/assets/js/controllers/daybookadminCtrl.js @@ -208,12 +208,16 @@ $scope.dayBookApprovalAccess = ''; } $scope.copyModel = function (p) { - console.log(p); + //console.log(p); + var inc = $scope.incomeExpenseType.filter((inc)=>inc.ID == p.Type); + console.log(inc); + $scope.incexp = inc[0]; + $scope.myModel = { "id": p.ID, "date": p.Date, "incomeExpense": p.Name, - "type": p.Type, + "type":$scope.incexp.ID, "amount": p.Amount, "status": p.Status, "description": p.Description, @@ -225,11 +229,15 @@ $scope.dayBookApprovalAccess = ''; } // alert(JSON.stringify($scope.myModel)); } - + $scope.deleted1 = function (id) { + + var id=id; + var reason=prompt("Enter Reason!",""); + $scope.deleteFeePayableEntry(reason,id); + } //delete the income entry From the fees payable - $scope.deleteFeePayableEntry = function (id) { - // alert(id); + $scope.deleteFeePayableEntry = function (reason,id) { SweetAlert.swal({ title: "Warning!", text: "Do you want to Delete this Entry ?", @@ -248,6 +256,7 @@ $scope.dayBookApprovalAccess = ''; 'Content-Type': 'application/json' }, data: { + reason:reason, data: id, requestDetails: localDetails } @@ -264,9 +273,17 @@ $scope.dayBookApprovalAccess = ''; }); } - + $scope.deleted = function (id) { + + var id=id; + var a=prompt("Enter Reason!",""); + $scope.deleEditEntry(a,id); + + + + } // delete the income/expense list row - $scope.deleEditEntry = function (id) { + $scope.deleEditEntry = function (a, id) { swal({ title: "Are you sure?", text: "Your will not be able to recover this record!", @@ -277,9 +294,9 @@ $scope.dayBookApprovalAccess = ''; closeOnConfirm: false }, function () { - $scope.indexDelete2(id); + $scope.indexDelete2(a, id); }); - $scope.indexDelete2 = function (id) { + $scope.indexDelete2 = function (a, id) { var deleteDetails = { method: 'POST', url: apiPoint.url + 'deleteDayBookDetails/', @@ -287,6 +304,7 @@ $scope.dayBookApprovalAccess = ''; 'Content-Type': 'application/json' }, data: { + reason: a, data: id, requestDetails: localDetails } diff --git a/Apollo/assets/js/controllers/daybooksuperadminCtrl.js b/Apollo/assets/js/controllers/daybooksuperadminCtrl.js index 2724609d..7959cb62 100755 --- a/Apollo/assets/js/controllers/daybooksuperadminCtrl.js +++ b/Apollo/assets/js/controllers/daybooksuperadminCtrl.js @@ -11,6 +11,21 @@ app.controller('daybooksuperadminCtrl', ["$scope", "$rootScope", "toaster", "$fi $scope.disableAddButton = false; $scope.disableEditButton = false; +//In controller +$scope.exportAction = function(){ + alert(); + switch('excel'){ + case 'pdf': $scope.$broadcast('export-pdf', {}); + break; + case 'excel': $scope.$broadcast('export-excel', {}); + break; + case 'doc': $scope.$broadcast('export-doc', {}); + break; + default: console.log('no event caught'); + } +} + + $scope.searchData = { "date": "", "dateTo": "" @@ -217,6 +232,10 @@ $scope.dayBookApprovalAccess = ''; if (response.data.typeNameStatus) { $scope.incomeExpenseName = response.data.typeList; $scope.incomeExpenseType = response.data.typeNameList; + + console.log($scope.incomeExpenseName) + + console.log($scope.incomeExpenseType); } else { } }); @@ -224,19 +243,41 @@ $scope.dayBookApprovalAccess = ''; // parse the income and expense type from the list $scope.getType = function (type) { - $scope.getIncomeTypes = $scope.incomeExpenseType.filter(function (val) { + $scope.getIncomeTypes = $scope.incomeExpenseName.filter(function (val) { return val.TypeID === 'I002' ? 1 : 0; }); - $scope.getExpenseTypes = $scope.incomeExpenseType.filter(function (val) { + $scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) { return val.TypeID === 'I001' ? 1 : 0; }); + + $scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) { + return val.TypeID === 'I003' ? 1 : 0; + }); + + $scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) { + return val.TypeID === 'I004' ? 1 : 0; + }); + + $scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) { + return val.TypeID === 'I005' ? 1 : 0; + }); + + $scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) { + return val.TypeID === 'I006' ? 1 : 0; + }); + + + + $scope.myModelAdd.type = ''; $scope.getTypes = type === 'I002' ? $scope.getIncomeTypes : $scope.getExpenseTypes; + + console.log($scope.getTypes) }; $scope.editId = -1; $scope.setEditId = function (P) { - // alert(id); + //alert(id); $scope.editId = P; } @@ -274,12 +315,14 @@ $scope.dayBookApprovalAccess = ''; } $scope.copyModel = function (p) { - console.log(p); + var inc = $scope.incomeExpenseType.filter((inc)=>inc.ID == p.Type); + console.log(inc); + $scope.incexp = inc[0]; $scope.myModel = { "id": p.ID, "date": p.Date, "incomeExpense": p.Name, - "type": p.Type, + "type" : $scope.incexp.ID, "amount": p.Amount, "status": p.Status, "description": p.Description, @@ -288,6 +331,7 @@ $scope.dayBookApprovalAccess = ''; "voucherNumber": p.VoucherNumber, "branch":p.BranchCode, "name": p.Name + } // alert(JSON.stringify($scope.myModel)); } @@ -295,7 +339,7 @@ $scope.dayBookApprovalAccess = ''; $scope.deleted1 = function (id) { var id=id; - var reason=prompt("Enter for the Delete Reason!",""); + var reason=prompt("Enter Reason!",""); $scope.deleteFeePayableEntry(reason,id); } //delete the income entry From the fees payable @@ -319,7 +363,8 @@ $scope.dayBookApprovalAccess = ''; 'Content-Type': 'application/json' }, data: { - reason:reason,data:id, + reason:reason, + data:id, requestDetails: localDetails } }; @@ -340,7 +385,7 @@ $scope.dayBookApprovalAccess = ''; $scope.deleted = function (id) { var id=id; - var a=prompt("Enter for the Delete Reason!",""); + var a=prompt("Enter Reason!",""); $scope.deleEditEntry(a,id); @@ -491,8 +536,13 @@ $scope.dayBookApprovalAccess = ''; // update a daybook entry details $scope.daybookeditUpdate = { submit: function (form, myModel) { + + console.log(myModel.type); + //return false; var firstError = null; if (form.$invalid) { + + alert(); var field = null, firstError = null; for (field in form) { if (field[0] != '$') { @@ -505,7 +555,7 @@ $scope.dayBookApprovalAccess = ''; } } angular.element('.ng-invalid[name=' + firstError + ']').focus(); - // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); + swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); } else { // alert(JSON.stringify($scope.myModel));exit(); $scope.disableEditButton = true; @@ -536,6 +586,28 @@ $scope.dayBookApprovalAccess = ''; } } + + function styleXl(){ + var mystyle = { + sheetid: 'DAYBOOK DETAILS', + headers: true, + caption: { + title:'DAYBOOK DETAILS'+ '('+ $scope.searchData.date + ' - ' + $scope.searchData.dateTo +')', + width: '300px', + style:'font-size:50px;color:blue;' + }, + // style:'background:#00FF00', + column: { + style:'font-size:11px; color:blue;' + } + }; + return mystyle + } + $scope.exportData = function () { + alasql('SELECT Date as Date, ListName as IncomeExpense, VoucherNumber as VoucherNumberBillNumber, PaidTo as PaidToReceivedFrom,FeePaymentDetails as Sem, CourseName as Course,UniversityName as University,TypeName as Type, ReceiptNo as Receipt_No, ReceiptNoComments as Comments, ModeOfPayment as Mode_of_Payment,Amount as Amount,Balance as Balance, Reason, Activity INTO XLS("daybook_details.xls",?) FROM ?',[styleXl(),$scope.data]); + }; + + }]); diff --git a/Apollo/assets/js/controllers/employeeCtrl.js b/Apollo/assets/js/controllers/employeeCtrl.js index 96825a27..27969230 100755 --- a/Apollo/assets/js/controllers/employeeCtrl.js +++ b/Apollo/assets/js/controllers/employeeCtrl.js @@ -76,7 +76,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ $scope.getRoleList(); $scope.getBranchDetails(); } else { - if(localDetail != null) { + if(localDetail != null && LOCALTYPE !='R001' ) { $state.go('app.dashboard'); } else { ipCookie.remove('cookiechk'); diff --git a/Apollo/assets/js/controllers/examAttendanceCtrl.js b/Apollo/assets/js/controllers/examAttendanceCtrl.js index 3b640ca0..f17df514 100644 --- a/Apollo/assets/js/controllers/examAttendanceCtrl.js +++ b/Apollo/assets/js/controllers/examAttendanceCtrl.js @@ -39,6 +39,30 @@ $scope.isLoaderTxt = "Loading..."; * created by kms * */ $scope.init = function () { + + + // var logcheck = JSON.parse(localStorage.getItem('localObj')); + + // const LOCALTYPE = logcheck.localType; + // if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + // console.log("if"); + // }else { + // if(logcheck != null && LOCALTYPE !='R001') { + // console.log("else if"); + // $state.go('app.dashboard'); + // } else { + + // console.log("else else"); + // //ipCookie.remove('cookiechk'); + // window.localStorage.clear(); + // $state.go('login.signin'); + // } + // } + + + + + var getUniv = { method: 'POST', url: apiPoint.url + 'getUniversityCourseDetails/', diff --git a/Apollo/assets/js/controllers/feesStatusCtrl.js b/Apollo/assets/js/controllers/feesStatusCtrl.js index 7c558dd0..ac5050bf 100755 --- a/Apollo/assets/js/controllers/feesStatusCtrl.js +++ b/Apollo/assets/js/controllers/feesStatusCtrl.js @@ -3,7 +3,7 @@ * controllers for ng-table * Simple table with sorting and filtering on AngularJS */ -app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", "installmentService", "SweetAlert", "dateListDescService", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state,installmentService,SweetAlert,dateListDescService) { +app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", "installmentService", "SweetAlert", "dateListDescService","$modal", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state,installmentService,SweetAlert,dateListDescService,$modal) { $scope.myModel = { "studentName": "", "mobileNumber": "", @@ -92,6 +92,32 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n * created by kms * */ $scope.init = function () { + + + + // var logcheck = JSON.parse(localStorage.getItem('localObj')); + + // const LOCALTYPE = logcheck.localType; + // if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + // console.log("if"); + // }else { + // if(logcheck != null && LOCALTYPE !='R001') { + // console.log("else if"); + // $state.go('app.dashboard'); + // } else { + + // console.log("else else"); + // //ipCookie.remove('cookiechk'); + // // window.localStorage.clear(); + // $state.go('login.signin'); + // } + // } + + + + + + $scope.isTrainee = false; var localUserType = JSON.parse(localStorage.getItem('localObj')).localType; @@ -174,7 +200,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n $http(getStudent).then(function (response) { if (response.data.status==200 && response.data.studentStatus) { $scope.studentInfo=response.data.details; - console.log($scope.studentInfo); } else { $scope.studentInfo=""; @@ -261,11 +286,12 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n * update total fees amount after change value * created by kms * */ - $scope.changeTotalFees = function (model) { + $scope.changeTotalFees = function (model,form) { //User wants to manually enter fees amount //$scope.updateModel.billAmount = model.BalanceAmount; $scope.updateModel.date = $filter('date')(new Date(), 'dd-MM-yyyy'); - + $scope.updateModel.billAmount=""; + form.billAmount.$setPristine(true); } @@ -2177,10 +2203,30 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n }, true);*/ + /* receive fees total bill amount watch function */ + $scope.$watch('updateModel.billAmount', function (newValue,oldValue) { + if(parseInt(newValue) && parseInt(newValue)<=parseInt($scope.updateModel.feesType.BalanceAmount)){ + $scope.payableAmtInfo=parseInt($scope.updateModel.feesType.BalanceAmount)-parseInt(newValue); + } + else if(parseInt(newValue) && parseInt(newValue)>parseInt($scope.updateModel.feesType.BalanceAmount)){ + $scope.payableAmtInfo=0; + } + else{ + $scope.payableAmtInfo=$scope.updateModel.feesType.BalanceAmount; + } + + }); + /* watch function for receive fees semd year options changes */ + $scope.$watch('updateModel.feesType.BalanceAmount', function (newValue,oldValue) { + if(parseInt(newValue)){ + $scope.payableAmtInfo=newValue; + } + else { + $scope.payableAmtInfo = 0; + } - - + }); }]); @@ -2341,7 +2387,7 @@ app.controller('studentModalDemoCtrl', ["$scope", "$rootScope", "$modal", "$log" // $scope.items = ['item1', 'item2', 'item3']; - $scope.open = function (studentDetails) { + $scope.openStudentView = function (studentDetails) { // get student view details @@ -2435,7 +2481,234 @@ app.controller('studentModalDemoCtrl', ["$scope", "$rootScope", "$modal", "$log" }); } +/** + * Created by Viual Studio. + * User: sriram + * Date: 8/9/18 + * + */ +$scope.reregisterPDF = function(student){ + + var coursefiltered = $scope.studentInfo.filter((universitycourse)=>universitycourse.ID == $scope.viewId); + //console.log(coursefiltered); + var getsubject = { + method:'post', + url:apiPoint.url +"getSubject", + headers: { + 'Content-Type': 'application/json' + }, + data:{ + SemNum:student.Sem_Year, + Course:coursefiltered[0].CourseID, + branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, + } + + }; + $http(getsubject).then(function(response){ + // console.log(response); + + if(response.data.status ==200 && response.data.SubjectStatus){ + //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(coursefiltered,response.data.SubjectDetails,student); + //}); + + } + // if(response.data.message == "Something Went Wrong!" ){ + // //alert(); + // swal('No Subject Available','','warning'); + + + },function(error){ + swal('No Subject Available','','warning'); + }); + + +} +$scope.open = function(coursefiltered,Subjects,sem){ + + // console.log(PDFdata); + //$rootScope.Student = PDFdata; + // console.log($rootScope.Student); + // return false; + $rootScope.sem = sem.Sem_Year; + + //console.log($rootScope.sem); + $rootScope.Course = coursefiltered[0]; + + //console.log($rootScope.Course); + + $rootScope.Subject = Subjects; + // console.log($rootScope.Subject); + // return false; + var modalInstance = $modal.open({ + templateUrl: 'assets/views/reregistration/reregistrationformpdf.html', + controller: 'studentModalDemoCtrl', + // size: size, + resolve: { + pdfitems: function () { + //return $scope.FeesName; + return sem; + } + } + }); + + modalInstance.result.then(function (selectedItem) { + $scope.selected = selectedItem; + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); +}; + $scope.generatePDF = function(){ + var sem = "Sem/Year:"+$scope.sem; + + var universityaddress = encodeURIComponent($scope.Course.Address).replace(/[%2C %20]/g,' '); + $scope.universityAddress = universityaddress.replace(" "," ");; + $scope.universitydetails = "Mobile: "+$scope.Course.UnivMobileNumber+",E-mail id:"+$scope.Course.EmailID+ + ",Website:-"; + $scope.Enroll = "Enrolment No: "; + $scope.courseDetails = "Course Name: "+$scope.Course.CourseName+" specialization: "+$scope.Course.Specilization +sem + + $scope.StudentName = "Name of the Candidate: "+$scope.Course.Firstname +' '+ $scope.Course.Lastname; + $scope.StudentFatername = "Father's Name: "+$scope.Course.Fathername; + $scope.StudentMotherName = "Mother's Name: "+$scope.Course.MotherName; + //var str = $scope.Student.PresentAddress; + + var str = encodeURIComponent($scope.Course.PermanentAddress).replace(/[%2C %20 %0A]/g,' '); + + + // str.replace("%0A"," "); + // str.replace("%20"," "); + // str.replace("%2C"," "); + $scope.StudnetAddress = "Address: "+ str.replace(" "," "); + $scope.StudentPin = "Pincode: .................. Mobile No: "+$scope.Course.MobileNumber+" Email ID: "+$scope.Course.EmailID; + + // var sem1 = doc.autoTableHtmlToJson(document.getElementById(subject)); + var universityname = $scope.Course.UniversityName; + var universityCap = universityname.toUpperCase(); + var doc = new jsPDF('A4'); + var img = document.getElementById("logo"); + var canvas = document.createElement("canvas"); + canvas.width = 100; + canvas.height = 100; + var ctx = canvas.getContext("2d"); + ctx.drawImage(img, 0, 0,100,100); + var dataURL = canvas.toDataURL("image/png"); + + doc.rect(10, 10, 190, 280); + + doc.text(70, 20, universityCap); + doc.addImage(dataURL, 'jpeg', 50, 13, 10, 10); + doc.setFontSize(14); + doc.text(70,32,"RE-REGISTRATION FORM"); + doc.setFontSize(12); + doc.text(35,35,$scope.universityAddress); + doc.text(20,42,$scope.universitydetails); + doc.setFontSize(10); + doc.setFontSize(10); + var formdetails = "The from should be complete in all respects and to be filled by student in English CAPITAL letters in blue /black ink."; + var details = doc.splitTextToSize(formdetails,200); + doc.text(15,50,details); + + doc.setFontSize(12); + doc.line(10, 45, 200, 45); + var col = 45; + var EnLen = $scope.Course.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.Course.EnrollmentID[k]); + col = parseInt(col)+4; + k++; + } + }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.setFontSize(10); + doc.text(15,70,$scope.courseDetails); + doc.setFontSize(12); + 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'}); + + doc.line(10, 83, 200, 83); + doc.text(15,88,$scope.StudentName); + doc.text(60,89,"......................................................................................................................"); + doc.text(15,95,$scope.StudentFatername); + doc.text(43,96,"...................................................................................................................................."); + doc.text(15,102,$scope.StudentMotherName); + doc.text(43,103,"...................................................................................................................................."); + + doc.text(15,110,$scope.StudnetAddress); + doc.text(30,111,"................................................................................................................................................"); + doc.text(15,121,$scope.StudentPin); + doc.text + doc.line(10, 125, 200,125); + doc.text(45,130,"SUBJECT / PAPER IN WHICH CANDIDATE APPEARING") + doc.line(10, 131, 200, 131); + doc.text(20,135,"SR.NO"); + + doc.text(60,135,"Subject Code"); + doc.text(110,135,"Subject/Paper Code"); + doc.line(10,137,200,137); + var row = 137; + var no = 1; + //console.log(); + angular.forEach($scope.Subject[0],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(20,row+5,no); + doc.text(65,row+5,subjectData.SubjectCode); + doc.setFontSize(10); + doc.text(100,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[0].length; + //console.log(len); + for(var j=0;j<=len;j++){ + if(no <=9){ + no = no.toString(); + doc.text(20,row+5,no); + }else{ + no = no.toString(); + doc.text(19,row+5,no); + } + // doc.text(75,row+5,"--"); + // doc.text(120,row+5,"--"); + row = row+6; + + 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.Course.Firstname +'_'+ $scope.Course.Lastname+'_'+$scope.sem+'.pdf'); + + } }]); diff --git a/Apollo/assets/js/controllers/generateHallTicketCtrl.js b/Apollo/assets/js/controllers/generateHallTicketCtrl.js index 29d58d5a..705ec048 100755 --- a/Apollo/assets/js/controllers/generateHallTicketCtrl.js +++ b/Apollo/assets/js/controllers/generateHallTicketCtrl.js @@ -41,6 +41,27 @@ $scope.generateButtonStatus = false; * created by kms * */ $scope.init = function () { + + + + // var logcheck = JSON.parse(localStorage.getItem('localObj')); + + // const LOCALTYPE = logcheck.localType; + // if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + // console.log("if"); + // }else { + // if(logcheck != null && LOCALTYPE !='R001') { + // console.log("else if"); + // $state.go('app.dashboard'); + // } else { + + // console.log("else else"); + // //ipCookie.remove('cookiechk'); + // window.localStorage.clear(); + // $state.go('login.signin'); + // } + // } + var getUniv = { method: 'POST', diff --git a/Apollo/assets/js/controllers/incomeCtrl.js b/Apollo/assets/js/controllers/incomeCtrl.js index b6dd89c8..fbfc5941 100644 --- a/Apollo/assets/js/controllers/incomeCtrl.js +++ b/Apollo/assets/js/controllers/incomeCtrl.js @@ -132,6 +132,26 @@ app.controller("incomeCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$lo $scope.emptyData = ''; $scope.init = function () { + + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + var getStatus = { method: 'POST', url: apiPoint.url + 'getAccounttypes/', diff --git a/Apollo/assets/js/controllers/income_reportCtrl.js b/Apollo/assets/js/controllers/income_reportCtrl.js index 9dac148e..8a4ef153 100644 --- a/Apollo/assets/js/controllers/income_reportCtrl.js +++ b/Apollo/assets/js/controllers/income_reportCtrl.js @@ -15,6 +15,41 @@ app.controller('income_reportCtrl', ["$scope","$rootScope","toaster", "$filter", }; + //console.log('out') + + + // $scope.initHead = function() { +//console.log('rfd'); + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + // } + + + $scope.init = function(){ + + console.log('gf'); + } + + + + + // $scope.filters = function () { // var filterlist = { // method: 'POST', diff --git a/Apollo/assets/js/controllers/report_balfeeCtrl.js b/Apollo/assets/js/controllers/report_balfeeCtrl.js index eb86cf8f..cb0d843e 100755 --- a/Apollo/assets/js/controllers/report_balfeeCtrl.js +++ b/Apollo/assets/js/controllers/report_balfeeCtrl.js @@ -111,16 +111,47 @@ app.controller('report_balfeeCtrl', ["$scope", "$filter","$rootScope","$modal", }; $http(response_data).then(function (response) { + var j =0; if (response.data.balfeeList == true) { $scope.balfee_data = response.data.balfee_data; for(var i=0;i<$scope.balfee_data.length;i++) - $scope.balfee_data[i].SL_NO = i+1; + if($scope.balfee_data[i].balance !=0){ + $scope.balfee_data[i].SL_NO = j+1; + j++; + } } else { $scope.message = response.data.message; } }); + + $scope.gettotal = function(){ + var totalfee = 0; + for(var i = 0; i < $scope.balfee_data.length; i++){ + var item = $scope.balfee_data[i]; + totalfee += parseFloat(item.Total); + } + return totalfee; } + $scope.getpaid = function(){ + var totalpaid = 0; + for(var i = 0; i < $scope.balfee_data.length; i++){ + var item = $scope.balfee_data[i]; + totalpaid += parseFloat(item.Paid_fee); + } + return totalpaid; } + + $scope.getbalance = function(){ + var totalbalance=0; + for(var i = 0; i < $scope.balfee_data.length; i++){ + var item = $scope.balfee_data[i]; + totalbalance += parseFloat(item.balance); + + } + return totalbalance; } + + + } @@ -143,7 +174,7 @@ app.controller('report_balfeeCtrl', ["$scope", "$filter","$rootScope","$modal", $scope.exportData = function () { - alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,eid as EnrollmentID,Student_name as StudentName,Father_name as FatherName,Course_name as CourseName,Sem_year as SemYear,CAST(Phone_number AS NUMBER) as PhoneNumber,University as University,CAST(Total AS NUMBER) as TotalFee,CAST(Paid_fee AS NUMBER) as FeesPaid,CAST(balance AS NUMBER) as Balance,billno1 as BillNO1,CAST(billamt1 AS NUMBER) as BillAmount1,billno2 as BillNO2,CAST(billamt2 AS NUMBER) as BillAmount2, billno3 as BillNO3, CAST(billamt3 AS NUMBER) as BillAmount3, billno4 as BillNO4, CAST(billamt4 AS NUMBER) as BillAmount4, billno5 as BillNO5,CAST(billamt5 AS NUMBER) as BillAmount5,billno6 as BillNO6,CAST(billamt6 AS NUMBER) as BillAmount6,billno7 as BillNo7,CAST(billamt7 AS NUMBER)as BillAmount7,billno8 as BillNO8,CAST(billamt8 AS NUMBER) as BillAmount8,billno9 as BillNO9,CAST(billamt9 AS NUMBER) as BillAmount9,billno10 as BillNO10,CAST(billamt10 AS NUMBER) as BillAmount10 INTO XLS("Balancefee_status.xls",?) FROM ?',[mystyle,$scope.balfee_data]); + alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,eid as EnrollmentID,Student_name as StudentName,Father_name as FatherName,Course_name as CourseName,Sem_year as SemYear,CAST(Phone_number AS NUMBER) as PhoneNumber,University as University,regdate as RegistrationDate,CAST(Total AS NUMBER) as TotalFee,CAST(Paid_fee AS NUMBER) as FeesPaid,CAST(balance AS NUMBER) as Balance,billno1 as BillNO1,CAST(billamt1 AS NUMBER) as BillAmount1,billno2 as BillNO2,CAST(billamt2 AS NUMBER) as BillAmount2, billno3 as BillNO3, CAST(billamt3 AS NUMBER) as BillAmount3, billno4 as BillNO4, CAST(billamt4 AS NUMBER) as BillAmount4, billno5 as BillNO5,CAST(billamt5 AS NUMBER) as BillAmount5,billno6 as BillNO6,CAST(billamt6 AS NUMBER) as BillAmount6,billno7 as BillNo7,CAST(billamt7 AS NUMBER)as BillAmount7,billno8 as BillNO8,CAST(billamt8 AS NUMBER) as BillAmount8,billno9 as BillNO9,CAST(billamt9 AS NUMBER) as BillAmount9,billno10 as BillNO10,CAST(billamt10 AS NUMBER) as BillAmount10 INTO XLS("Balancefee_status.xls",?) FROM ?',[mystyle,$scope.balfee_data]); }; diff --git a/Apollo/assets/js/controllers/report_doc_pendingCtrl.js b/Apollo/assets/js/controllers/report_doc_pendingCtrl.js index dc706e08..f032cefd 100755 --- a/Apollo/assets/js/controllers/report_doc_pendingCtrl.js +++ b/Apollo/assets/js/controllers/report_doc_pendingCtrl.js @@ -133,7 +133,7 @@ app.controller('report_doc_pendingCtrl', ["$scope", "$filter","$rootScope","$mod $scope.exportData = function () { - alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,Admission_date as AdmissionDate,Enrollment_id as EnrollmentID,Student_name as StudentName,Father_name as FatherName,Course_name as CourseName,Sem_year as SemYear,CAST(Phone_number AS NUMBER) as PhoneNumber,University as University,Status as DocumentPendingStatus INTO XLS("Document_pending_student_list.xls",?) FROM ?',[mystyle,$scope.doc_pending_data]); + alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,Admission_date as AdmissionDate,Enrollment_id as EnrollmentID,Student_name as StudentName,Father_name as FatherName,Course_name as CourseName,Sem_year as SemYear,CAST(Phone_number AS NUMBER) as PhoneNumber,University as University,adate as DocumentAppliedDate,certname as DocumentName,Status as DocumentPendingStatus INTO XLS("Document_pending_student_list.xls",?) FROM ?',[mystyle,$scope.doc_pending_data]); }; /*modal controller * */ diff --git a/Apollo/assets/js/controllers/report_expenseCtrl.js b/Apollo/assets/js/controllers/report_expenseCtrl.js index 4765e666..a70f785c 100755 --- a/Apollo/assets/js/controllers/report_expenseCtrl.js +++ b/Apollo/assets/js/controllers/report_expenseCtrl.js @@ -13,6 +13,20 @@ app.controller('report_expenseCtrl', ["$scope", "API_POINTS", "$http", "SweetAle }; + var localDetail = JSON.parse(localStorage.getItem('localObj')); + const LOCALTYPE = localDetail.localType; + //console.log(LOCALTYPE) + if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + }else { + if((localDetail != null) && (LOCALTYPE !='R001')) { + $state.go('app.dashboard'); + } else { + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + $scope.filters = function () { var filterlist = { method: 'POST', diff --git a/Apollo/assets/js/controllers/report_leadCtrl.js b/Apollo/assets/js/controllers/report_leadCtrl.js new file mode 100644 index 00000000..ea0c30ca --- /dev/null +++ b/Apollo/assets/js/controllers/report_leadCtrl.js @@ -0,0 +1,533 @@ +'use strict'; +/*** controller***/ +app.controller('report_leadCtrl', ["$scope", "$filter","$rootScope","$modal", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window',"dateListDescService", + function ($scope, $filter,$rootScope,$modal, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window, dateListDescService) { + + /* + * auto call tracking/ + */ + $scope.userType=JSON.parse(localStorage.getItem('localObj')).localType; + $scope.myModel = { + + "date": new Date(), + "activity": "", + "assignedTo": "", + "status": "", + "referedBy": '', + "comments":'', + "enquiryStatus":'', + + "important":false, + "branch":"", + + }; + + + +// $scope.init = function() { + // alert(); + var localDetail = JSON.parse(localStorage.getItem('localObj')); + const LOCALTYPE = localDetail.localType; + //console.log(LOCALTYPE) + if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + }else { + if((localDetail != null) && (LOCALTYPE !='R001')) { + $state.go('app.dashboard'); + } else { + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + // } + + //get current date + $scope.hideDateSearch=true; + $scope.modifyMinDate = moment(); + //$scope.minDate = $filter('date')($scope.modifyMinDate, 'MM-dd-yyyy'); + $scope.currentDate=$filter('date')(new Date(), 'dd-MM-yyyy'); + // get 30 plus date for follwup details + $scope.modifyDate = moment(); + $scope.modifyDate.add(30, 'days'); + $scope.futureDate = $filter('date')($scope.modifyDate, 'dd-MM-yyyy'); + $scope.myModel.date=$scope.currentDate; + // console.log($scope.currentDate); + /** + * End of the call tracking + */ + // DataTables configurable options + + + $scope.filters = { + "branch": "", + "from_date": "", + "to_date": "", + + }; + + $scope.filters = function () { + var filterlist = { + method: 'POST', + url: apiPoint.url + 'report_filters/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + branch : JSON.parse(localStorage.getItem('localObj')).localBranchID + + } + + }; + $http(filterlist).then(function (response) { + if (response.data) { + $scope.batch=[]; + $scope.batchlist = response.data.batch; + $scope.university = response.data.university; + //Desc order Batchlist + angular.forEach($scope.batchlist,function (values,key) { + var parts = values.BatchDate.split("-"); + $scope.batch.push({ + "batchcode":values.batchcode, + "batch":values.batch + '('+ values.batchcode + ')', + "BatchDate":values.BatchDate, + "givenDateObject":new Date(parts[2], parts[1] - 1, parts[0]) + }) + }); + // call service for make a list in desc order based on date + $scope.batch=dateListDescService.getOrderByList($scope.batch); + //console.log($scope.branch); + } else { + } + }); + } + + $scope.onSubmit = function () { + //alert($scope.batch.name); + $scope.lead_data = ''; + $scope.message = ''; + var response_data = { + method: 'POST', + url: apiPoint.url + 'report_lead/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + branch: JSON.parse(localStorage.getItem('localObj')).localBranchID, + from : $scope.filters.from_date, + to : $scope.filters.to_date + } + + }; + + $http(response_data).then(function (response) { + if (response.data.leadList == true) { + $scope.lead_data = response.data.lead_data; + for(var i=0;i<$scope.lead_data.length;i++) + $scope.lead_data[i].SL_NO = i+1; + + } else { + $scope.message = response.data.message; + } + + }); + + } + var mystyle = { + sheetid: 'Lead REPORT', + headers: true, + caption: { + title:'Calls done on a Particular Day/Period - Report', + width: '300px', + style:'font-size:50px;' + }, + // style:'background:#00FF00', + column: { + style:'font-size:10px' + }, + + }; + + + + $scope.exportData = function () { + alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,date as Date,CAST(tid AS NUMBER) as TrackingID,fup as FollowupDate,name as Name,CAST(mobile AS NUMBER) as MobileNo,univ as University,course as Course,prsStatus as PresentStatus,cmnts as Comments,activity as Activity,AssignTo as AssignTo INTO XLS("Lead_Report.xls",?) FROM ?',[mystyle,$scope.lead_data]); + }; + + /*modal controller + * */ + app.controller('studentModalDemoCtrl', ["$scope","$rootScope", "$modal", "$log", "API_POINTS", "$http", function ($scope,$rootScope, $modal, $log, apiPoint, $http) { + //Tooltip for print button + $scope.dynamicTooltip = 'Student View'; + + + + // $scope.items = ['item1', 'item2', 'item3']; + + $scope.open = function (studentDetails) { + + + // get student view details + var getcourse = { + method: 'POST', + url: apiPoint.url + 'getStudentBasicInfo/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: studentDetails.Phone_number, + requestedFrom: 3, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID + } + }; + $http(getcourse).then(function (response) { + + if (response.data.status == 200 && response.data.studentStatus == true) { + $scope.courseEditLoading = false; + // $scope.studentDetails = response.data.studentDetails; + $scope.studentDetails = response.data; + // $scope.courseDetails = response.data.courseDetails; + var modalInstance = $modal.open({ + templateUrl: 'assets/views/student/studentDetailsModal.html', + controller: 'ModalInstanceCtrl', + // size: size, + resolve: { + items: function () { + return $scope.studentDetails; + } + } + }); + + modalInstance.result.then(function (selectedItem) { + $scope.selected = selectedItem; + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + + } else { + swal("Failed!", "This student is not registerd", "warning"); + $scope.courseEditLoading = false; + $scope.studentDetails = ""; + $scope.courseDetails = ""; + + } + }); + + + }; + $scope.open1 = function (values,type) { + + var modalInstance1 = $modal.open({ + templateUrl: 'assets/views/student/studentPaymentModal.html', + controller: 'ModalInstanceCtrl1', + // size: size, + resolve: { + items1: function () { + var myvalues = + { + "values":values, + "type":type + }; + return myvalues; + } + } + }); + + modalInstance1.result.then(function (selectedItem) { + $scope.selected = selectedItem; + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + }; + + $scope.printStudentDetails = function (details) { + $rootScope.pdfItems = details; + + var printInstance = $modal.open({ + templateUrl: 'assets/views/student/studentPdf.html', + controller: 'studentModalDemoCtrl', + }); + }; + + // generate pdf for student view + $scope.export = function(getName) { + kendo.drawing.drawDOM($("#exportthis")).then(function(group) { + kendo.drawing.pdf.saveAs(group, getName+".pdf"); + }); + } + + +}]); + +// Please note that $modalInstance represents a modal window (instance) dependency. +// It is not the same as the $modal service used above. + +app.controller('ModalInstanceCtrl', ["$scope", "$modalInstance", "items", "WordsService", function ($scope, $modalInstance, items, WordsService) { + + $scope.items = items; + $scope.selected = { + item: $scope.items[0] + }; + + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + + +}]); +app.controller('ModalInstanceCtrl1', ["$scope", "$modalInstance", "items1", "WordsService", function ($scope, $modalInstance, items1, WordsService) { + + $scope.items1 = items1.values; + $scope.selectedtype = items1.type; + + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + + +}]); + /** + * Auto Call Tracking Sriram + */ + $scope.selectedStudentsID = []; + $scope.isCheckAll = function(e){ + var val = (e.target.checked ? true : false); + if(val) + { + // $scope.disable = false; + var len = $scope.lead_data.length; + var i = 0; + for(i=0;iExport HTML Table to + + +Installation +============ +jquery Plugin
+<script type="text/javascript" src="tableExport.js">
+<script type="text/javascript" src="jquery.base64.js">
+
+PNG Export +========== +<script type="text/javascript" src="html2canvas.js"> + +PDF Export +========== +<script type="text/javascript" src="jspdf/libs/sprintf.js">
+<script type="text/javascript" src="jspdf/jspdf.js">
+<script type="text/javascript" src="jspdf/libs/base64.js">
+ +Usage +====== +onClick ="$('#tableID').tableExport({type:'pdf',escape:'false'});"
+ +Options +======= +separator: ','
+ignoreColumn: [2,3],
+tableName:'yourTableName'
+type:'csv'
+pdfFontSize:14
+pdfLeftMargin:20
+escape:'true'
+htmlContent:'false'
+consoleLog:'false'
diff --git a/Apollo/assets/js/tableExport/html2canvas.js b/Apollo/assets/js/tableExport/html2canvas.js new file mode 100644 index 00000000..df3ee7ec --- /dev/null +++ b/Apollo/assets/js/tableExport/html2canvas.js @@ -0,0 +1,3010 @@ +/* + html2canvas 0.4.1 + Copyright (c) 2013 Niklas von Hertzen + + Released under MIT License +*/ + +(function(window, document, undefined){ + +//"use strict"; + +var _html2canvas = {}, +previousElement, +computedCSS, +html2canvas; + +_html2canvas.Util = {}; + +_html2canvas.Util.log = function(a) { + if (_html2canvas.logging && window.console && window.console.log) { + window.console.log(a); + } +}; + +_html2canvas.Util.trimText = (function(isNative){ + return function(input) { + return isNative ? isNative.apply(input) : ((input || '') + '').replace( /^\s+|\s+$/g , '' ); + }; +})(String.prototype.trim); + +_html2canvas.Util.asFloat = function(v) { + return parseFloat(v); +}; + +(function() { + // TODO: support all possible length values + var TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g; + var TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g; + _html2canvas.Util.parseTextShadows = function (value) { + if (!value || value === 'none') { + return []; + } + + // find multiple shadow declarations + var shadows = value.match(TEXT_SHADOW_PROPERTY), + results = []; + for (var i = 0; shadows && (i < shadows.length); i++) { + var s = shadows[i].match(TEXT_SHADOW_VALUES); + results.push({ + color: s[0], + offsetX: s[1] ? s[1].replace('px', '') : 0, + offsetY: s[2] ? s[2].replace('px', '') : 0, + blur: s[3] ? s[3].replace('px', '') : 0 + }); + } + return results; + }; +})(); + +_html2canvas.Util.parseBackgroundImage = function (value) { + var whitespace = ' \r\n\t', + method, definition, prefix, prefix_i, block, results = [], + c, mode = 0, numParen = 0, quote, args; + + var appendResult = function(){ + if(method) { + if(definition.substr( 0, 1 ) === '"') { + definition = definition.substr( 1, definition.length - 2 ); + } + if(definition) { + args.push(definition); + } + if(method.substr( 0, 1 ) === '-' && + (prefix_i = method.indexOf( '-', 1 ) + 1) > 0) { + prefix = method.substr( 0, prefix_i); + method = method.substr( prefix_i ); + } + results.push({ + prefix: prefix, + method: method.toLowerCase(), + value: block, + args: args + }); + } + args = []; //for some odd reason, setting .length = 0 didn't work in safari + method = + prefix = + definition = + block = ''; + }; + + appendResult(); + for(var i = 0, ii = value.length; i -1){ + continue; + } + switch(c) { + case '"': + if(!quote) { + quote = c; + } + else if(quote === c) { + quote = null; + } + break; + + case '(': + if(quote) { break; } + else if(mode === 0) { + mode = 1; + block += c; + continue; + } else { + numParen++; + } + break; + + case ')': + if(quote) { break; } + else if(mode === 1) { + if(numParen === 0) { + mode = 0; + block += c; + appendResult(); + continue; + } else { + numParen--; + } + } + break; + + case ',': + if(quote) { break; } + else if(mode === 0) { + appendResult(); + continue; + } + else if (mode === 1) { + if(numParen === 0 && !method.match(/^url$/i)) { + args.push(definition); + definition = ''; + block += c; + continue; + } + } + break; + } + + block += c; + if(mode === 0) { method += c; } + else { definition += c; } + } + appendResult(); + + return results; +}; + +_html2canvas.Util.Bounds = function (element) { + var clientRect, bounds = {}; + + if (element.getBoundingClientRect){ + clientRect = element.getBoundingClientRect(); + + // TODO add scroll position to bounds, so no scrolling of window necessary + bounds.top = clientRect.top; + bounds.bottom = clientRect.bottom || (clientRect.top + clientRect.height); + bounds.left = clientRect.left; + + bounds.width = element.offsetWidth; + bounds.height = element.offsetHeight; + } + + return bounds; +}; + +// TODO ideally, we'd want everything to go through this function instead of Util.Bounds, +// but would require further work to calculate the correct positions for elements with offsetParents +_html2canvas.Util.OffsetBounds = function (element) { + var parent = element.offsetParent ? _html2canvas.Util.OffsetBounds(element.offsetParent) : {top: 0, left: 0}; + + return { + top: element.offsetTop + parent.top, + bottom: element.offsetTop + element.offsetHeight + parent.top, + left: element.offsetLeft + parent.left, + width: element.offsetWidth, + height: element.offsetHeight + }; +}; + +function toPX(element, attribute, value ) { + var rsLeft = element.runtimeStyle && element.runtimeStyle[attribute], + left, + style = element.style; + + // Check if we are not dealing with pixels, (Opera has issues with this) + // Ported from jQuery css.js + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + + if ( !/^-?[0-9]+\.?[0-9]*(?:px)?$/i.test( value ) && /^-?\d/.test(value) ) { + // Remember the original values + left = style.left; + + // Put in the new values to get a computed value out + if (rsLeft) { + element.runtimeStyle.left = element.currentStyle.left; + } + style.left = attribute === "fontSize" ? "1em" : (value || 0); + value = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if (rsLeft) { + element.runtimeStyle.left = rsLeft; + } + } + + if (!/^(thin|medium|thick)$/i.test(value)) { + return Math.round(parseFloat(value)) + "px"; + } + + return value; +} + +function asInt(val) { + return parseInt(val, 10); +} + +function isPercentage(value) { + return value.toString().indexOf("%") !== -1; +} + +function parseBackgroundSizePosition(value, element, attribute, index) { + value = (value || '').split(','); + value = value[index || 0] || value[0] || 'auto'; + value = _html2canvas.Util.trimText(value).split(' '); + if(attribute === 'backgroundSize' && (value[0] && value[0].match(/^(cover|contain|auto)$/))) { + return value; + } else { + value[0] = (value[0].indexOf( "%" ) === -1) ? toPX(element, attribute + "X", value[0]) : value[0]; + if(value[1] === undefined) { + if(attribute === 'backgroundSize') { + value[1] = 'auto'; + return value; + } else { + // IE 9 doesn't return double digit always + value[1] = value[0]; + } + } + value[1] = (value[1].indexOf("%") === -1) ? toPX(element, attribute + "Y", value[1]) : value[1]; + } + return value; +} + +_html2canvas.Util.getCSS = function (element, attribute, index) { + if (previousElement !== element) { + computedCSS = document.defaultView.getComputedStyle(element, null); + } + + var value = computedCSS[attribute]; + + if (/^background(Size|Position)$/.test(attribute)) { + return parseBackgroundSizePosition(value, element, attribute, index); + } else if (/border(Top|Bottom)(Left|Right)Radius/.test(attribute)) { + var arr = value.split(" "); + if (arr.length <= 1) { + arr[1] = arr[0]; + } + return arr.map(asInt); + } + + return value; +}; + +_html2canvas.Util.resizeBounds = function( current_width, current_height, target_width, target_height, stretch_mode ){ + var target_ratio = target_width / target_height, + current_ratio = current_width / current_height, + output_width, output_height; + + if(!stretch_mode || stretch_mode === 'auto') { + output_width = target_width; + output_height = target_height; + } else if(target_ratio < current_ratio ^ stretch_mode === 'contain') { + output_height = target_height; + output_width = target_height * current_ratio; + } else { + output_width = target_width; + output_height = target_width / current_ratio; + } + + return { + width: output_width, + height: output_height + }; +}; + +_html2canvas.Util.BackgroundPosition = function(element, bounds, image, imageIndex, backgroundSize ) { + var backgroundPosition = _html2canvas.Util.getCSS(element, 'backgroundPosition', imageIndex), + leftPosition, + topPosition; + if (backgroundPosition.length === 1){ + backgroundPosition = [backgroundPosition[0], backgroundPosition[0]]; + } + + if (isPercentage(backgroundPosition[0])){ + leftPosition = (bounds.width - (backgroundSize || image).width) * (parseFloat(backgroundPosition[0]) / 100); + } else { + leftPosition = parseInt(backgroundPosition[0], 10); + } + + if (backgroundPosition[1] === 'auto') { + topPosition = leftPosition / image.width * image.height; + } else if (isPercentage(backgroundPosition[1])){ + topPosition = (bounds.height - (backgroundSize || image).height) * parseFloat(backgroundPosition[1]) / 100; + } else { + topPosition = parseInt(backgroundPosition[1], 10); + } + + if (backgroundPosition[0] === 'auto') { + leftPosition = topPosition / image.height * image.width; + } + + return {left: leftPosition, top: topPosition}; +}; + +_html2canvas.Util.BackgroundSize = function(element, bounds, image, imageIndex) { + var backgroundSize = _html2canvas.Util.getCSS(element, 'backgroundSize', imageIndex), width, height; + + if (backgroundSize.length === 1) { + backgroundSize = [backgroundSize[0], backgroundSize[0]]; + } + + if (isPercentage(backgroundSize[0])) { + width = bounds.width * parseFloat(backgroundSize[0]) / 100; + } else if (/contain|cover/.test(backgroundSize[0])) { + return _html2canvas.Util.resizeBounds(image.width, image.height, bounds.width, bounds.height, backgroundSize[0]); + } else { + width = parseInt(backgroundSize[0], 10); + } + + if (backgroundSize[0] === 'auto' && backgroundSize[1] === 'auto') { + height = image.height; + } else if (backgroundSize[1] === 'auto') { + height = width / image.width * image.height; + } else if (isPercentage(backgroundSize[1])) { + height = bounds.height * parseFloat(backgroundSize[1]) / 100; + } else { + height = parseInt(backgroundSize[1], 10); + } + + if (backgroundSize[0] === 'auto') { + width = height / image.height * image.width; + } + + return {width: width, height: height}; +}; + +_html2canvas.Util.BackgroundRepeat = function(element, imageIndex) { + var backgroundRepeat = _html2canvas.Util.getCSS(element, "backgroundRepeat").split(",").map(_html2canvas.Util.trimText); + return backgroundRepeat[imageIndex] || backgroundRepeat[0]; +}; + +_html2canvas.Util.Extend = function (options, defaults) { + for (var key in options) { + if (options.hasOwnProperty(key)) { + defaults[key] = options[key]; + } + } + return defaults; +}; + + +/* + * Derived from jQuery.contents() + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + */ +_html2canvas.Util.Children = function( elem ) { + var children; + try { + children = (elem.nodeName && elem.nodeName.toUpperCase() === "IFRAME") ? elem.contentDocument || elem.contentWindow.document : (function(array) { + var ret = []; + if (array !== null) { + (function(first, second ) { + var i = first.length, + j = 0; + + if (typeof second.length === "number") { + for (var l = second.length; j < l; j++) { + first[i++] = second[j]; + } + } else { + while (second[j] !== undefined) { + first[i++] = second[j++]; + } + } + + first.length = i; + + return first; + })(ret, array); + } + return ret; + })(elem.childNodes); + + } catch (ex) { + _html2canvas.Util.log("html2canvas.Util.Children failed with exception: " + ex.message); + children = []; + } + return children; +}; + +_html2canvas.Util.isTransparent = function(backgroundColor) { + return (!backgroundColor || backgroundColor === "transparent" || backgroundColor === "rgba(0, 0, 0, 0)"); +}; + +_html2canvas.Util.Font = (function () { + + var fontData = {}; + + return function(font, fontSize, doc) { + if (fontData[font + "-" + fontSize] !== undefined) { + return fontData[font + "-" + fontSize]; + } + + var container = doc.createElement('div'), + img = doc.createElement('img'), + span = doc.createElement('span'), + sampleText = 'Hidden Text', + baseline, + middle, + metricsObj; + + container.style.visibility = "hidden"; + container.style.fontFamily = font; + container.style.fontSize = fontSize; + container.style.margin = 0; + container.style.padding = 0; + + doc.body.appendChild(container); + + // http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever (handtinywhite.gif) + img.src = "data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs="; + img.width = 1; + img.height = 1; + + img.style.margin = 0; + img.style.padding = 0; + img.style.verticalAlign = "baseline"; + + span.style.fontFamily = font; + span.style.fontSize = fontSize; + span.style.margin = 0; + span.style.padding = 0; + + span.appendChild(doc.createTextNode(sampleText)); + container.appendChild(span); + container.appendChild(img); + baseline = (img.offsetTop - span.offsetTop) + 1; + + container.removeChild(span); + container.appendChild(doc.createTextNode(sampleText)); + + container.style.lineHeight = "normal"; + img.style.verticalAlign = "super"; + + middle = (img.offsetTop-container.offsetTop) + 1; + metricsObj = { + baseline: baseline, + lineWidth: 1, + middle: middle + }; + + fontData[font + "-" + fontSize] = metricsObj; + + doc.body.removeChild(container); + + return metricsObj; + }; +})(); + +(function(){ + var Util = _html2canvas.Util, + Generate = {}; + + _html2canvas.Generate = Generate; + + var reGradients = [ + /^(-webkit-linear-gradient)\(([a-z\s]+)([\w\d\.\s,%\(\)]+)\)$/, + /^(-o-linear-gradient)\(([a-z\s]+)([\w\d\.\s,%\(\)]+)\)$/, + /^(-webkit-gradient)\((linear|radial),\s((?:\d{1,3}%?)\s(?:\d{1,3}%?),\s(?:\d{1,3}%?)\s(?:\d{1,3}%?))([\w\d\.\s,%\(\)\-]+)\)$/, + /^(-moz-linear-gradient)\(((?:\d{1,3}%?)\s(?:\d{1,3}%?))([\w\d\.\s,%\(\)]+)\)$/, + /^(-webkit-radial-gradient)\(((?:\d{1,3}%?)\s(?:\d{1,3}%?)),\s(\w+)\s([a-z\-]+)([\w\d\.\s,%\(\)]+)\)$/, + /^(-moz-radial-gradient)\(((?:\d{1,3}%?)\s(?:\d{1,3}%?)),\s(\w+)\s?([a-z\-]*)([\w\d\.\s,%\(\)]+)\)$/, + /^(-o-radial-gradient)\(((?:\d{1,3}%?)\s(?:\d{1,3}%?)),\s(\w+)\s([a-z\-]+)([\w\d\.\s,%\(\)]+)\)$/ + ]; + + /* + * TODO: Add IE10 vendor prefix (-ms) support + * TODO: Add W3C gradient (linear-gradient) support + * TODO: Add old Webkit -webkit-gradient(radial, ...) support + * TODO: Maybe some RegExp optimizations are possible ;o) + */ + Generate.parseGradient = function(css, bounds) { + var gradient, i, len = reGradients.length, m1, stop, m2, m2Len, step, m3, tl,tr,br,bl; + + for(i = 0; i < len; i+=1){ + m1 = css.match(reGradients[i]); + if(m1) { + break; + } + } + + if(m1) { + switch(m1[1]) { + case '-webkit-linear-gradient': + case '-o-linear-gradient': + + gradient = { + type: 'linear', + x0: null, + y0: null, + x1: null, + y1: null, + colorStops: [] + }; + + // get coordinates + m2 = m1[2].match(/\w+/g); + if(m2){ + m2Len = m2.length; + for(i = 0; i < m2Len; i+=1){ + switch(m2[i]) { + case 'top': + gradient.y0 = 0; + gradient.y1 = bounds.height; + break; + + case 'right': + gradient.x0 = bounds.width; + gradient.x1 = 0; + break; + + case 'bottom': + gradient.y0 = bounds.height; + gradient.y1 = 0; + break; + + case 'left': + gradient.x0 = 0; + gradient.x1 = bounds.width; + break; + } + } + } + if(gradient.x0 === null && gradient.x1 === null){ // center + gradient.x0 = gradient.x1 = bounds.width / 2; + } + if(gradient.y0 === null && gradient.y1 === null){ // center + gradient.y0 = gradient.y1 = bounds.height / 2; + } + + // get colors and stops + m2 = m1[3].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)(?:\s\d{1,3}(?:%|px))?)+/g); + if(m2){ + m2Len = m2.length; + step = 1 / Math.max(m2Len - 1, 1); + for(i = 0; i < m2Len; i+=1){ + m3 = m2[i].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/); + if(m3[2]){ + stop = parseFloat(m3[2]); + if(m3[3] === '%'){ + stop /= 100; + } else { // px - stupid opera + stop /= bounds.width; + } + } else { + stop = i * step; + } + gradient.colorStops.push({ + color: m3[1], + stop: stop + }); + } + } + break; + + case '-webkit-gradient': + + gradient = { + type: m1[2] === 'radial' ? 'circle' : m1[2], // TODO: Add radial gradient support for older mozilla definitions + x0: 0, + y0: 0, + x1: 0, + y1: 0, + colorStops: [] + }; + + // get coordinates + m2 = m1[3].match(/(\d{1,3})%?\s(\d{1,3})%?,\s(\d{1,3})%?\s(\d{1,3})%?/); + if(m2){ + gradient.x0 = (m2[1] * bounds.width) / 100; + gradient.y0 = (m2[2] * bounds.height) / 100; + gradient.x1 = (m2[3] * bounds.width) / 100; + gradient.y1 = (m2[4] * bounds.height) / 100; + } + + // get colors and stops + m2 = m1[4].match(/((?:from|to|color-stop)\((?:[0-9\.]+,\s)?(?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)\))+/g); + if(m2){ + m2Len = m2.length; + for(i = 0; i < m2Len; i+=1){ + m3 = m2[i].match(/(from|to|color-stop)\(([0-9\.]+)?(?:,\s)?((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\)/); + stop = parseFloat(m3[2]); + if(m3[1] === 'from') { + stop = 0.0; + } + if(m3[1] === 'to') { + stop = 1.0; + } + gradient.colorStops.push({ + color: m3[3], + stop: stop + }); + } + } + break; + + case '-moz-linear-gradient': + + gradient = { + type: 'linear', + x0: 0, + y0: 0, + x1: 0, + y1: 0, + colorStops: [] + }; + + // get coordinates + m2 = m1[2].match(/(\d{1,3})%?\s(\d{1,3})%?/); + + // m2[1] == 0% -> left + // m2[1] == 50% -> center + // m2[1] == 100% -> right + + // m2[2] == 0% -> top + // m2[2] == 50% -> center + // m2[2] == 100% -> bottom + + if(m2){ + gradient.x0 = (m2[1] * bounds.width) / 100; + gradient.y0 = (m2[2] * bounds.height) / 100; + gradient.x1 = bounds.width - gradient.x0; + gradient.y1 = bounds.height - gradient.y0; + } + + // get colors and stops + m2 = m1[3].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)(?:\s\d{1,3}%)?)+/g); + if(m2){ + m2Len = m2.length; + step = 1 / Math.max(m2Len - 1, 1); + for(i = 0; i < m2Len; i+=1){ + m3 = m2[i].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%)?/); + if(m3[2]){ + stop = parseFloat(m3[2]); + if(m3[3]){ // percentage + stop /= 100; + } + } else { + stop = i * step; + } + gradient.colorStops.push({ + color: m3[1], + stop: stop + }); + } + } + break; + + case '-webkit-radial-gradient': + case '-moz-radial-gradient': + case '-o-radial-gradient': + + gradient = { + type: 'circle', + x0: 0, + y0: 0, + x1: bounds.width, + y1: bounds.height, + cx: 0, + cy: 0, + rx: 0, + ry: 0, + colorStops: [] + }; + + // center + m2 = m1[2].match(/(\d{1,3})%?\s(\d{1,3})%?/); + if(m2){ + gradient.cx = (m2[1] * bounds.width) / 100; + gradient.cy = (m2[2] * bounds.height) / 100; + } + + // size + m2 = m1[3].match(/\w+/); + m3 = m1[4].match(/[a-z\-]*/); + if(m2 && m3){ + switch(m3[0]){ + case 'farthest-corner': + case 'cover': // is equivalent to farthest-corner + case '': // mozilla removes "cover" from definition :( + tl = Math.sqrt(Math.pow(gradient.cx, 2) + Math.pow(gradient.cy, 2)); + tr = Math.sqrt(Math.pow(gradient.cx, 2) + Math.pow(gradient.y1 - gradient.cy, 2)); + br = Math.sqrt(Math.pow(gradient.x1 - gradient.cx, 2) + Math.pow(gradient.y1 - gradient.cy, 2)); + bl = Math.sqrt(Math.pow(gradient.x1 - gradient.cx, 2) + Math.pow(gradient.cy, 2)); + gradient.rx = gradient.ry = Math.max(tl, tr, br, bl); + break; + case 'closest-corner': + tl = Math.sqrt(Math.pow(gradient.cx, 2) + Math.pow(gradient.cy, 2)); + tr = Math.sqrt(Math.pow(gradient.cx, 2) + Math.pow(gradient.y1 - gradient.cy, 2)); + br = Math.sqrt(Math.pow(gradient.x1 - gradient.cx, 2) + Math.pow(gradient.y1 - gradient.cy, 2)); + bl = Math.sqrt(Math.pow(gradient.x1 - gradient.cx, 2) + Math.pow(gradient.cy, 2)); + gradient.rx = gradient.ry = Math.min(tl, tr, br, bl); + break; + case 'farthest-side': + if(m2[0] === 'circle'){ + gradient.rx = gradient.ry = Math.max( + gradient.cx, + gradient.cy, + gradient.x1 - gradient.cx, + gradient.y1 - gradient.cy + ); + } else { // ellipse + + gradient.type = m2[0]; + + gradient.rx = Math.max( + gradient.cx, + gradient.x1 - gradient.cx + ); + gradient.ry = Math.max( + gradient.cy, + gradient.y1 - gradient.cy + ); + } + break; + case 'closest-side': + case 'contain': // is equivalent to closest-side + if(m2[0] === 'circle'){ + gradient.rx = gradient.ry = Math.min( + gradient.cx, + gradient.cy, + gradient.x1 - gradient.cx, + gradient.y1 - gradient.cy + ); + } else { // ellipse + + gradient.type = m2[0]; + + gradient.rx = Math.min( + gradient.cx, + gradient.x1 - gradient.cx + ); + gradient.ry = Math.min( + gradient.cy, + gradient.y1 - gradient.cy + ); + } + break; + + // TODO: add support for "30px 40px" sizes (webkit only) + } + } + + // color stops + m2 = m1[5].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)(?:\s\d{1,3}(?:%|px))?)+/g); + if(m2){ + m2Len = m2.length; + step = 1 / Math.max(m2Len - 1, 1); + for(i = 0; i < m2Len; i+=1){ + m3 = m2[i].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/); + if(m3[2]){ + stop = parseFloat(m3[2]); + if(m3[3] === '%'){ + stop /= 100; + } else { // px - stupid opera + stop /= bounds.width; + } + } else { + stop = i * step; + } + gradient.colorStops.push({ + color: m3[1], + stop: stop + }); + } + } + break; + } + } + + return gradient; + }; + + function addScrollStops(grad) { + return function(colorStop) { + try { + grad.addColorStop(colorStop.stop, colorStop.color); + } + catch(e) { + Util.log(['failed to add color stop: ', e, '; tried to add: ', colorStop]); + } + }; + } + + Generate.Gradient = function(src, bounds) { + if(bounds.width === 0 || bounds.height === 0) { + return; + } + + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + gradient, grad; + + canvas.width = bounds.width; + canvas.height = bounds.height; + + // TODO: add support for multi defined background gradients + gradient = _html2canvas.Generate.parseGradient(src, bounds); + + if(gradient) { + switch(gradient.type) { + case 'linear': + grad = ctx.createLinearGradient(gradient.x0, gradient.y0, gradient.x1, gradient.y1); + gradient.colorStops.forEach(addScrollStops(grad)); + ctx.fillStyle = grad; + ctx.fillRect(0, 0, bounds.width, bounds.height); + break; + + case 'circle': + grad = ctx.createRadialGradient(gradient.cx, gradient.cy, 0, gradient.cx, gradient.cy, gradient.rx); + gradient.colorStops.forEach(addScrollStops(grad)); + ctx.fillStyle = grad; + ctx.fillRect(0, 0, bounds.width, bounds.height); + break; + + case 'ellipse': + var canvasRadial = document.createElement('canvas'), + ctxRadial = canvasRadial.getContext('2d'), + ri = Math.max(gradient.rx, gradient.ry), + di = ri * 2; + + canvasRadial.width = canvasRadial.height = di; + + grad = ctxRadial.createRadialGradient(gradient.rx, gradient.ry, 0, gradient.rx, gradient.ry, ri); + gradient.colorStops.forEach(addScrollStops(grad)); + + ctxRadial.fillStyle = grad; + ctxRadial.fillRect(0, 0, di, di); + + ctx.fillStyle = gradient.colorStops[gradient.colorStops.length - 1].color; + ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.drawImage(canvasRadial, gradient.cx - gradient.rx, gradient.cy - gradient.ry, 2 * gradient.rx, 2 * gradient.ry); + break; + } + } + + return canvas; + }; + + Generate.ListAlpha = function(number) { + var tmp = "", + modulus; + + do { + modulus = number % 26; + tmp = String.fromCharCode((modulus) + 64) + tmp; + number = number / 26; + }while((number*26) > 26); + + return tmp; + }; + + Generate.ListRoman = function(number) { + var romanArray = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"], + decimal = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1], + roman = "", + v, + len = romanArray.length; + + if (number <= 0 || number >= 4000) { + return number; + } + + for (v=0; v < len; v+=1) { + while (number >= decimal[v]) { + number -= decimal[v]; + roman += romanArray[v]; + } + } + + return roman; + }; +})(); +function h2cRenderContext(width, height) { + var storage = []; + return { + storage: storage, + width: width, + height: height, + clip: function() { + storage.push({ + type: "function", + name: "clip", + 'arguments': arguments + }); + }, + translate: function() { + storage.push({ + type: "function", + name: "translate", + 'arguments': arguments + }); + }, + fill: function() { + storage.push({ + type: "function", + name: "fill", + 'arguments': arguments + }); + }, + save: function() { + storage.push({ + type: "function", + name: "save", + 'arguments': arguments + }); + }, + restore: function() { + storage.push({ + type: "function", + name: "restore", + 'arguments': arguments + }); + }, + fillRect: function () { + storage.push({ + type: "function", + name: "fillRect", + 'arguments': arguments + }); + }, + createPattern: function() { + storage.push({ + type: "function", + name: "createPattern", + 'arguments': arguments + }); + }, + drawShape: function() { + + var shape = []; + + storage.push({ + type: "function", + name: "drawShape", + 'arguments': shape + }); + + return { + moveTo: function() { + shape.push({ + name: "moveTo", + 'arguments': arguments + }); + }, + lineTo: function() { + shape.push({ + name: "lineTo", + 'arguments': arguments + }); + }, + arcTo: function() { + shape.push({ + name: "arcTo", + 'arguments': arguments + }); + }, + bezierCurveTo: function() { + shape.push({ + name: "bezierCurveTo", + 'arguments': arguments + }); + }, + quadraticCurveTo: function() { + shape.push({ + name: "quadraticCurveTo", + 'arguments': arguments + }); + } + }; + + }, + drawImage: function () { + storage.push({ + type: "function", + name: "drawImage", + 'arguments': arguments + }); + }, + fillText: function () { + storage.push({ + type: "function", + name: "fillText", + 'arguments': arguments + }); + }, + setVariable: function (variable, value) { + storage.push({ + type: "variable", + name: variable, + 'arguments': value + }); + return value; + } + }; +} +_html2canvas.Parse = function (images, options, cb) { + window.scroll(0,0); + + var element = (( options.elements === undefined ) ? document.body : options.elements[0]), // select body by default + numDraws = 0, + doc = element.ownerDocument, + Util = _html2canvas.Util, + support = Util.Support(options, doc), + ignoreElementsRegExp = new RegExp("(" + options.ignoreElements + ")"), + body = doc.body, + getCSS = Util.getCSS, + pseudoHide = "___html2canvas___pseudoelement", + hidePseudoElementsStyles = doc.createElement('style'); + + hidePseudoElementsStyles.innerHTML = '.' + pseudoHide + + '-parent:before { content: "" !important; display: none !important; }' + + '.' + pseudoHide + '-parent:after { content: "" !important; display: none !important; }'; + + body.appendChild(hidePseudoElementsStyles); + + images = images || {}; + + init(); + + function init() { + var background = getCSS(document.documentElement, "backgroundColor"), + transparentBackground = (Util.isTransparent(background) && element === document.body), + stack = renderElement(element, null, false, transparentBackground); + + // create pseudo elements in a single pass to prevent synchronous layouts + addPseudoElements(element); + + parseChildren(element, stack, function() { + if (transparentBackground) { + background = stack.backgroundColor; + } + + removePseudoElements(); + + Util.log('Done parsing, moving to Render.'); + + cb({ + backgroundColor: background, + stack: stack + }); + }); + } + + // Given a root element, find all pseudo elements below, create elements mocking pseudo element styles + // so we can process them as normal elements, and hide the original pseudo elements so they don't interfere + // with layout. + function addPseudoElements(el) { + // These are done in discrete steps to prevent a relayout loop caused by addClass() invalidating + // layouts & getPseudoElement calling getComputedStyle. + var jobs = [], classes = []; + getPseudoElementClasses(); + findPseudoElements(el); + runJobs(); + + function getPseudoElementClasses(){ + var findPsuedoEls = /:before|:after/; + var sheets = document.styleSheets; + for (var i = 0, j = sheets.length; i < j; i++) { + try { + var rules = sheets[i].cssRules; + for (var k = 0, l = rules.length; k < l; k++) { + if(findPsuedoEls.test(rules[k].selectorText)) { + classes.push(rules[k].selectorText); + } + } + } + catch(e) { // will throw security exception for style sheets loaded from external domains + } + } + + // Trim off the :after and :before (or ::after and ::before) + for (i = 0, j = classes.length; i < j; i++) { + classes[i] = classes[i].match(/(^[^:]*)/)[1]; + } + } + + // Using the list of elements we know how pseudo el styles, create fake pseudo elements. + function findPseudoElements(el) { + var els = document.querySelectorAll(classes.join(',')); + for(var i = 0, j = els.length; i < j; i++) { + createPseudoElements(els[i]); + } + } + + // Create pseudo elements & add them to a job queue. + function createPseudoElements(el) { + var before = getPseudoElement(el, ':before'), + after = getPseudoElement(el, ':after'); + + if(before) { + jobs.push({type: 'before', pseudo: before, el: el}); + } + + if (after) { + jobs.push({type: 'after', pseudo: after, el: el}); + } + } + + // Adds a class to the pseudo's parent to prevent the original before/after from messing + // with layouts. + // Execute the inserts & addClass() calls in a batch to prevent relayouts. + function runJobs() { + // Add Class + jobs.forEach(function(job){ + addClass(job.el, pseudoHide + "-parent"); + }); + + // Insert el + jobs.forEach(function(job){ + if(job.type === 'before'){ + job.el.insertBefore(job.pseudo, job.el.firstChild); + } else { + job.el.appendChild(job.pseudo); + } + }); + } + } + + + + // Delete our fake pseudo elements from the DOM. This will remove those actual elements + // and the classes on their parents that hide the actual pseudo elements. + // Note that NodeLists are 'live' collections so you can't use a for loop here. They are + // actually deleted from the NodeList after each iteration. + function removePseudoElements(){ + // delete pseudo elements + body.removeChild(hidePseudoElementsStyles); + var pseudos = document.getElementsByClassName(pseudoHide + "-element"); + while (pseudos.length) { + pseudos[0].parentNode.removeChild(pseudos[0]); + } + + // Remove pseudo hiding classes + var parents = document.getElementsByClassName(pseudoHide + "-parent"); + while(parents.length) { + removeClass(parents[0], pseudoHide + "-parent"); + } + } + + function addClass (el, className) { + if (el.classList) { + el.classList.add(className); + } else { + el.className = el.className + " " + className; + } + } + + function removeClass (el, className) { + if (el.classList) { + el.classList.remove(className); + } else { + el.className = el.className.replace(className, "").trim(); + } + } + + function hasClass (el, className) { + return el.className.indexOf(className) > -1; + } + + // Note that this doesn't work in < IE8, but we don't support that anyhow + function nodeListToArray (nodeList) { + return Array.prototype.slice.call(nodeList); + } + + function documentWidth () { + return Math.max( + Math.max(doc.body.scrollWidth, doc.documentElement.scrollWidth), + Math.max(doc.body.offsetWidth, doc.documentElement.offsetWidth), + Math.max(doc.body.clientWidth, doc.documentElement.clientWidth) + ); + } + + function documentHeight () { + return Math.max( + Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight), + Math.max(doc.body.offsetHeight, doc.documentElement.offsetHeight), + Math.max(doc.body.clientHeight, doc.documentElement.clientHeight) + ); + } + + function getCSSInt(element, attribute) { + var val = parseInt(getCSS(element, attribute), 10); + return (isNaN(val)) ? 0 : val; // borders in old IE are throwing 'medium' for demo.html + } + + function renderRect (ctx, x, y, w, h, bgcolor) { + if (bgcolor !== "transparent"){ + ctx.setVariable("fillStyle", bgcolor); + ctx.fillRect(x, y, w, h); + numDraws+=1; + } + } + + function capitalize(m, p1, p2) { + if (m.length > 0) { + return p1 + p2.toUpperCase(); + } + } + + function textTransform (text, transform) { + switch(transform){ + case "lowercase": + return text.toLowerCase(); + case "capitalize": + return text.replace( /(^|\s|:|-|\(|\))([a-z])/g, capitalize); + case "uppercase": + return text.toUpperCase(); + default: + return text; + } + } + + function noLetterSpacing(letter_spacing) { + return (/^(normal|none|0px)$/.test(letter_spacing)); + } + + function drawText(currentText, x, y, ctx){ + if (currentText !== null && Util.trimText(currentText).length > 0) { + ctx.fillText(currentText, x, y); + numDraws+=1; + } + } + + function setTextVariables(ctx, el, text_decoration, color) { + var align = false, + bold = getCSS(el, "fontWeight"), + family = getCSS(el, "fontFamily"), + size = getCSS(el, "fontSize"), + shadows = Util.parseTextShadows(getCSS(el, "textShadow")); + + switch(parseInt(bold, 10)){ + case 401: + bold = "bold"; + break; + case 400: + bold = "normal"; + break; + } + + ctx.setVariable("fillStyle", color); + ctx.setVariable("font", [getCSS(el, "fontStyle"), getCSS(el, "fontVariant"), bold, size, family].join(" ")); + ctx.setVariable("textAlign", (align) ? "right" : "left"); + + if (shadows.length) { + // TODO: support multiple text shadows + // apply the first text shadow + ctx.setVariable("shadowColor", shadows[0].color); + ctx.setVariable("shadowOffsetX", shadows[0].offsetX); + ctx.setVariable("shadowOffsetY", shadows[0].offsetY); + ctx.setVariable("shadowBlur", shadows[0].blur); + } + + if (text_decoration !== "none"){ + return Util.Font(family, size, doc); + } + } + + function renderTextDecoration(ctx, text_decoration, bounds, metrics, color) { + switch(text_decoration) { + case "underline": + // Draws a line at the baseline of the font + // TODO As some browsers display the line as more than 1px if the font-size is big, need to take that into account both in position and size + renderRect(ctx, bounds.left, Math.round(bounds.top + metrics.baseline + metrics.lineWidth), bounds.width, 1, color); + break; + case "overline": + renderRect(ctx, bounds.left, Math.round(bounds.top), bounds.width, 1, color); + break; + case "line-through": + // TODO try and find exact position for line-through + renderRect(ctx, bounds.left, Math.ceil(bounds.top + metrics.middle + metrics.lineWidth), bounds.width, 1, color); + break; + } + } + + function getTextBounds(state, text, textDecoration, isLast, transform) { + var bounds; + if (support.rangeBounds && !transform) { + if (textDecoration !== "none" || Util.trimText(text).length !== 0) { + bounds = textRangeBounds(text, state.node, state.textOffset); + } + state.textOffset += text.length; + } else if (state.node && typeof state.node.nodeValue === "string" ){ + var newTextNode = (isLast) ? state.node.splitText(text.length) : null; + bounds = textWrapperBounds(state.node, transform); + state.node = newTextNode; + } + return bounds; + } + + function textRangeBounds(text, textNode, textOffset) { + var range = doc.createRange(); + range.setStart(textNode, textOffset); + range.setEnd(textNode, textOffset + text.length); + return range.getBoundingClientRect(); + } + + function textWrapperBounds(oldTextNode, transform) { + var parent = oldTextNode.parentNode, + wrapElement = doc.createElement('wrapper'), + backupText = oldTextNode.cloneNode(true); + + wrapElement.appendChild(oldTextNode.cloneNode(true)); + parent.replaceChild(wrapElement, oldTextNode); + + var bounds = transform ? Util.OffsetBounds(wrapElement) : Util.Bounds(wrapElement); + parent.replaceChild(backupText, wrapElement); + return bounds; + } + + function renderText(el, textNode, stack) { + var ctx = stack.ctx, + color = getCSS(el, "color"), + textDecoration = getCSS(el, "textDecoration"), + textAlign = getCSS(el, "textAlign"), + metrics, + textList, + state = { + node: textNode, + textOffset: 0 + }; + + if (Util.trimText(textNode.nodeValue).length > 0) { + textNode.nodeValue = textTransform(textNode.nodeValue, getCSS(el, "textTransform")); + textAlign = textAlign.replace(["-webkit-auto"],["auto"]); + + textList = (!options.letterRendering && /^(left|right|justify|auto)$/.test(textAlign) && noLetterSpacing(getCSS(el, "letterSpacing"))) ? + textNode.nodeValue.split(/(\b| )/) + : textNode.nodeValue.split(""); + + metrics = setTextVariables(ctx, el, textDecoration, color); + + if (options.chinese) { + textList.forEach(function(word, index) { + if (/.*[\u4E00-\u9FA5].*$/.test(word)) { + word = word.split(""); + word.unshift(index, 1); + textList.splice.apply(textList, word); + } + }); + } + + textList.forEach(function(text, index) { + var bounds = getTextBounds(state, text, textDecoration, (index < textList.length - 1), stack.transform.matrix); + if (bounds) { + drawText(text, bounds.left, bounds.bottom, ctx); + renderTextDecoration(ctx, textDecoration, bounds, metrics, color); + } + }); + } + } + + function listPosition (element, val) { + var boundElement = doc.createElement( "boundelement" ), + originalType, + bounds; + + boundElement.style.display = "inline"; + + originalType = element.style.listStyleType; + element.style.listStyleType = "none"; + + boundElement.appendChild(doc.createTextNode(val)); + + element.insertBefore(boundElement, element.firstChild); + + bounds = Util.Bounds(boundElement); + element.removeChild(boundElement); + element.style.listStyleType = originalType; + return bounds; + } + + function elementIndex(el) { + var i = -1, + count = 1, + childs = el.parentNode.childNodes; + + if (el.parentNode) { + while(childs[++i] !== el) { + if (childs[i].nodeType === 1) { + count++; + } + } + return count; + } else { + return -1; + } + } + + function listItemText(element, type) { + var currentIndex = elementIndex(element), text; + switch(type){ + case "decimal": + text = currentIndex; + break; + case "decimal-leading-zero": + text = (currentIndex.toString().length === 1) ? currentIndex = "0" + currentIndex.toString() : currentIndex.toString(); + break; + case "upper-roman": + text = _html2canvas.Generate.ListRoman( currentIndex ); + break; + case "lower-roman": + text = _html2canvas.Generate.ListRoman( currentIndex ).toLowerCase(); + break; + case "lower-alpha": + text = _html2canvas.Generate.ListAlpha( currentIndex ).toLowerCase(); + break; + case "upper-alpha": + text = _html2canvas.Generate.ListAlpha( currentIndex ); + break; + } + + return text + ". "; + } + + function renderListItem(element, stack, elBounds) { + var x, + text, + ctx = stack.ctx, + type = getCSS(element, "listStyleType"), + listBounds; + + if (/^(decimal|decimal-leading-zero|upper-alpha|upper-latin|upper-roman|lower-alpha|lower-greek|lower-latin|lower-roman)$/i.test(type)) { + text = listItemText(element, type); + listBounds = listPosition(element, text); + setTextVariables(ctx, element, "none", getCSS(element, "color")); + + if (getCSS(element, "listStylePosition") === "inside") { + ctx.setVariable("textAlign", "left"); + x = elBounds.left; + } else { + return; + } + + drawText(text, x, listBounds.bottom, ctx); + } + } + + function loadImage (src){ + var img = images[src]; + return (img && img.succeeded === true) ? img.img : false; + } + + function clipBounds(src, dst){ + var x = Math.max(src.left, dst.left), + y = Math.max(src.top, dst.top), + x2 = Math.min((src.left + src.width), (dst.left + dst.width)), + y2 = Math.min((src.top + src.height), (dst.top + dst.height)); + + return { + left:x, + top:y, + width:x2-x, + height:y2-y + }; + } + + function setZ(element, stack, parentStack){ + var newContext, + isPositioned = stack.cssPosition !== 'static', + zIndex = isPositioned ? getCSS(element, 'zIndex') : 'auto', + opacity = getCSS(element, 'opacity'), + isFloated = getCSS(element, 'cssFloat') !== 'none'; + + // https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context + // When a new stacking context should be created: + // the root element (HTML), + // positioned (absolutely or relatively) with a z-index value other than "auto", + // elements with an opacity value less than 1. (See the specification for opacity), + // on mobile WebKit and Chrome 22+, position: fixed always creates a new stacking context, even when z-index is "auto" (See this post) + + stack.zIndex = newContext = h2czContext(zIndex); + newContext.isPositioned = isPositioned; + newContext.isFloated = isFloated; + newContext.opacity = opacity; + newContext.ownStacking = (zIndex !== 'auto' || opacity < 1); + newContext.depth = parentStack ? (parentStack.zIndex.depth + 1) : 0; + + if (parentStack) { + parentStack.zIndex.children.push(stack); + } + } + + function h2czContext(zindex) { + return { + depth: 0, + zindex: zindex, + children: [] + }; + } + + function renderImage(ctx, element, image, bounds, borders) { + + var paddingLeft = getCSSInt(element, 'paddingLeft'), + paddingTop = getCSSInt(element, 'paddingTop'), + paddingRight = getCSSInt(element, 'paddingRight'), + paddingBottom = getCSSInt(element, 'paddingBottom'); + + drawImage( + ctx, + image, + 0, //sx + 0, //sy + image.width, //sw + image.height, //sh + bounds.left + paddingLeft + borders[3].width, //dx + bounds.top + paddingTop + borders[0].width, // dy + bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight), //dw + bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom) //dh + ); + } + + function getBorderData(element) { + return ["Top", "Right", "Bottom", "Left"].map(function(side) { + return { + width: getCSSInt(element, 'border' + side + 'Width'), + color: getCSS(element, 'border' + side + 'Color') + }; + }); + } + + function getBorderRadiusData(element) { + return ["TopLeft", "TopRight", "BottomRight", "BottomLeft"].map(function(side) { + return getCSS(element, 'border' + side + 'Radius'); + }); + } + + function getCurvePoints(x, y, r1, r2) { + var kappa = 4 * ((Math.sqrt(2) - 1) / 3); + var ox = (r1) * kappa, // control point offset horizontal + oy = (r2) * kappa, // control point offset vertical + xm = x + r1, // x-middle + ym = y + r2; // y-middle + return { + topLeft: bezierCurve({ + x:x, + y:ym + }, { + x:x, + y:ym - oy + }, { + x:xm - ox, + y:y + }, { + x:xm, + y:y + }), + topRight: bezierCurve({ + x:x, + y:y + }, { + x:x + ox, + y:y + }, { + x:xm, + y:ym - oy + }, { + x:xm, + y:ym + }), + bottomRight: bezierCurve({ + x:xm, + y:y + }, { + x:xm, + y:y + oy + }, { + x:x + ox, + y:ym + }, { + x:x, + y:ym + }), + bottomLeft: bezierCurve({ + x:xm, + y:ym + }, { + x:xm - ox, + y:ym + }, { + x:x, + y:y + oy + }, { + x:x, + y:y + }) + }; + } + + function bezierCurve(start, startControl, endControl, end) { + + var lerp = function (a, b, t) { + return { + x:a.x + (b.x - a.x) * t, + y:a.y + (b.y - a.y) * t + }; + }; + + return { + start: start, + startControl: startControl, + endControl: endControl, + end: end, + subdivide: function(t) { + var ab = lerp(start, startControl, t), + bc = lerp(startControl, endControl, t), + cd = lerp(endControl, end, t), + abbc = lerp(ab, bc, t), + bccd = lerp(bc, cd, t), + dest = lerp(abbc, bccd, t); + return [bezierCurve(start, ab, abbc, dest), bezierCurve(dest, bccd, cd, end)]; + }, + curveTo: function(borderArgs) { + borderArgs.push(["bezierCurve", startControl.x, startControl.y, endControl.x, endControl.y, end.x, end.y]); + }, + curveToReversed: function(borderArgs) { + borderArgs.push(["bezierCurve", endControl.x, endControl.y, startControl.x, startControl.y, start.x, start.y]); + } + }; + } + + function parseCorner(borderArgs, radius1, radius2, corner1, corner2, x, y) { + if (radius1[0] > 0 || radius1[1] > 0) { + borderArgs.push(["line", corner1[0].start.x, corner1[0].start.y]); + corner1[0].curveTo(borderArgs); + corner1[1].curveTo(borderArgs); + } else { + borderArgs.push(["line", x, y]); + } + + if (radius2[0] > 0 || radius2[1] > 0) { + borderArgs.push(["line", corner2[0].start.x, corner2[0].start.y]); + } + } + + function drawSide(borderData, radius1, radius2, outer1, inner1, outer2, inner2) { + var borderArgs = []; + + if (radius1[0] > 0 || radius1[1] > 0) { + borderArgs.push(["line", outer1[1].start.x, outer1[1].start.y]); + outer1[1].curveTo(borderArgs); + } else { + borderArgs.push([ "line", borderData.c1[0], borderData.c1[1]]); + } + + if (radius2[0] > 0 || radius2[1] > 0) { + borderArgs.push(["line", outer2[0].start.x, outer2[0].start.y]); + outer2[0].curveTo(borderArgs); + borderArgs.push(["line", inner2[0].end.x, inner2[0].end.y]); + inner2[0].curveToReversed(borderArgs); + } else { + borderArgs.push([ "line", borderData.c2[0], borderData.c2[1]]); + borderArgs.push([ "line", borderData.c3[0], borderData.c3[1]]); + } + + if (radius1[0] > 0 || radius1[1] > 0) { + borderArgs.push(["line", inner1[1].end.x, inner1[1].end.y]); + inner1[1].curveToReversed(borderArgs); + } else { + borderArgs.push([ "line", borderData.c4[0], borderData.c4[1]]); + } + + return borderArgs; + } + + function calculateCurvePoints(bounds, borderRadius, borders) { + + var x = bounds.left, + y = bounds.top, + width = bounds.width, + height = bounds.height, + + tlh = borderRadius[0][0], + tlv = borderRadius[0][1], + trh = borderRadius[1][0], + trv = borderRadius[1][1], + brh = borderRadius[2][0], + brv = borderRadius[2][1], + blh = borderRadius[3][0], + blv = borderRadius[3][1], + + topWidth = width - trh, + rightHeight = height - brv, + bottomWidth = width - brh, + leftHeight = height - blv; + + return { + topLeftOuter: getCurvePoints( + x, + y, + tlh, + tlv + ).topLeft.subdivide(0.5), + + topLeftInner: getCurvePoints( + x + borders[3].width, + y + borders[0].width, + Math.max(0, tlh - borders[3].width), + Math.max(0, tlv - borders[0].width) + ).topLeft.subdivide(0.5), + + topRightOuter: getCurvePoints( + x + topWidth, + y, + trh, + trv + ).topRight.subdivide(0.5), + + topRightInner: getCurvePoints( + x + Math.min(topWidth, width + borders[3].width), + y + borders[0].width, + (topWidth > width + borders[3].width) ? 0 :trh - borders[3].width, + trv - borders[0].width + ).topRight.subdivide(0.5), + + bottomRightOuter: getCurvePoints( + x + bottomWidth, + y + rightHeight, + brh, + brv + ).bottomRight.subdivide(0.5), + + bottomRightInner: getCurvePoints( + x + Math.min(bottomWidth, width + borders[3].width), + y + Math.min(rightHeight, height + borders[0].width), + Math.max(0, brh - borders[1].width), + Math.max(0, brv - borders[2].width) + ).bottomRight.subdivide(0.5), + + bottomLeftOuter: getCurvePoints( + x, + y + leftHeight, + blh, + blv + ).bottomLeft.subdivide(0.5), + + bottomLeftInner: getCurvePoints( + x + borders[3].width, + y + leftHeight, + Math.max(0, blh - borders[3].width), + Math.max(0, blv - borders[2].width) + ).bottomLeft.subdivide(0.5) + }; + } + + function getBorderClip(element, borderPoints, borders, radius, bounds) { + var backgroundClip = getCSS(element, 'backgroundClip'), + borderArgs = []; + + switch(backgroundClip) { + case "content-box": + case "padding-box": + parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftInner, borderPoints.topRightInner, bounds.left + borders[3].width, bounds.top + borders[0].width); + parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightInner, borderPoints.bottomRightInner, bounds.left + bounds.width - borders[1].width, bounds.top + borders[0].width); + parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightInner, borderPoints.bottomLeftInner, bounds.left + bounds.width - borders[1].width, bounds.top + bounds.height - borders[2].width); + parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftInner, borderPoints.topLeftInner, bounds.left + borders[3].width, bounds.top + bounds.height - borders[2].width); + break; + + default: + parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftOuter, borderPoints.topRightOuter, bounds.left, bounds.top); + parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightOuter, borderPoints.bottomRightOuter, bounds.left + bounds.width, bounds.top); + parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightOuter, borderPoints.bottomLeftOuter, bounds.left + bounds.width, bounds.top + bounds.height); + parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftOuter, borderPoints.topLeftOuter, bounds.left, bounds.top + bounds.height); + break; + } + + return borderArgs; + } + + function parseBorders(element, bounds, borders){ + var x = bounds.left, + y = bounds.top, + width = bounds.width, + height = bounds.height, + borderSide, + bx, + by, + bw, + bh, + borderArgs, + // http://www.w3.org/TR/css3-background/#the-border-radius + borderRadius = getBorderRadiusData(element), + borderPoints = calculateCurvePoints(bounds, borderRadius, borders), + borderData = { + clip: getBorderClip(element, borderPoints, borders, borderRadius, bounds), + borders: [] + }; + + for (borderSide = 0; borderSide < 4; borderSide++) { + + if (borders[borderSide].width > 0) { + bx = x; + by = y; + bw = width; + bh = height - (borders[2].width); + + switch(borderSide) { + case 0: + // top border + bh = borders[0].width; + + borderArgs = drawSide({ + c1: [bx, by], + c2: [bx + bw, by], + c3: [bx + bw - borders[1].width, by + bh], + c4: [bx + borders[3].width, by + bh] + }, borderRadius[0], borderRadius[1], + borderPoints.topLeftOuter, borderPoints.topLeftInner, borderPoints.topRightOuter, borderPoints.topRightInner); + break; + case 1: + // right border + bx = x + width - (borders[1].width); + bw = borders[1].width; + + borderArgs = drawSide({ + c1: [bx + bw, by], + c2: [bx + bw, by + bh + borders[2].width], + c3: [bx, by + bh], + c4: [bx, by + borders[0].width] + }, borderRadius[1], borderRadius[2], + borderPoints.topRightOuter, borderPoints.topRightInner, borderPoints.bottomRightOuter, borderPoints.bottomRightInner); + break; + case 2: + // bottom border + by = (by + height) - (borders[2].width); + bh = borders[2].width; + + borderArgs = drawSide({ + c1: [bx + bw, by + bh], + c2: [bx, by + bh], + c3: [bx + borders[3].width, by], + c4: [bx + bw - borders[3].width, by] + }, borderRadius[2], borderRadius[3], + borderPoints.bottomRightOuter, borderPoints.bottomRightInner, borderPoints.bottomLeftOuter, borderPoints.bottomLeftInner); + break; + case 3: + // left border + bw = borders[3].width; + + borderArgs = drawSide({ + c1: [bx, by + bh + borders[2].width], + c2: [bx, by], + c3: [bx + bw, by + borders[0].width], + c4: [bx + bw, by + bh] + }, borderRadius[3], borderRadius[0], + borderPoints.bottomLeftOuter, borderPoints.bottomLeftInner, borderPoints.topLeftOuter, borderPoints.topLeftInner); + break; + } + + borderData.borders.push({ + args: borderArgs, + color: borders[borderSide].color + }); + + } + } + + return borderData; + } + + function createShape(ctx, args) { + var shape = ctx.drawShape(); + args.forEach(function(border, index) { + shape[(index === 0) ? "moveTo" : border[0] + "To" ].apply(null, border.slice(1)); + }); + return shape; + } + + function renderBorders(ctx, borderArgs, color) { + if (color !== "transparent") { + ctx.setVariable( "fillStyle", color); + createShape(ctx, borderArgs); + ctx.fill(); + numDraws+=1; + } + } + + function renderFormValue (el, bounds, stack){ + + var valueWrap = doc.createElement('valuewrap'), + cssPropertyArray = ['lineHeight','textAlign','fontFamily','color','fontSize','paddingLeft','paddingTop','width','height','border','borderLeftWidth','borderTopWidth'], + textValue, + textNode; + + cssPropertyArray.forEach(function(property) { + try { + valueWrap.style[property] = getCSS(el, property); + } catch(e) { + // Older IE has issues with "border" + Util.log("html2canvas: Parse: Exception caught in renderFormValue: " + e.message); + } + }); + + valueWrap.style.borderColor = "black"; + valueWrap.style.borderStyle = "solid"; + valueWrap.style.display = "block"; + valueWrap.style.position = "absolute"; + + if (/^(submit|reset|button|text|password)$/.test(el.type) || el.nodeName === "SELECT"){ + valueWrap.style.lineHeight = getCSS(el, "height"); + } + + valueWrap.style.top = bounds.top + "px"; + valueWrap.style.left = bounds.left + "px"; + + textValue = (el.nodeName === "SELECT") ? (el.options[el.selectedIndex] || 0).text : el.value; + if(!textValue) { + textValue = el.placeholder; + } + + textNode = doc.createTextNode(textValue); + + valueWrap.appendChild(textNode); + body.appendChild(valueWrap); + + renderText(el, textNode, stack); + body.removeChild(valueWrap); + } + + function drawImage (ctx) { + ctx.drawImage.apply(ctx, Array.prototype.slice.call(arguments, 1)); + numDraws+=1; + } + + function getPseudoElement(el, which) { + var elStyle = window.getComputedStyle(el, which); + var parentStyle = window.getComputedStyle(el); + // If no content attribute is present, the pseudo element is hidden, + // or the parent has a content property equal to the content on the pseudo element, + // move along. + if(!elStyle || !elStyle.content || elStyle.content === "none" || elStyle.content === "-moz-alt-content" || + elStyle.display === "none" || parentStyle.content === elStyle.content) { + return; + } + var content = elStyle.content + ''; + + // Strip inner quotes + if(content[0] === "'" || content[0] === "\"") { + content = content.replace(/(^['"])|(['"]$)/g, ''); + } + + var isImage = content.substr( 0, 3 ) === 'url', + elps = document.createElement( isImage ? 'img' : 'span' ); + + elps.className = pseudoHide + "-element "; + + Object.keys(elStyle).filter(indexedProperty).forEach(function(prop) { + // Prevent assigning of read only CSS Rules, ex. length, parentRule + try { + elps.style[prop] = elStyle[prop]; + } catch (e) { + Util.log(['Tried to assign readonly property ', prop, 'Error:', e]); + } + }); + + if(isImage) { + elps.src = Util.parseBackgroundImage(content)[0].args[0]; + } else { + elps.innerHTML = content; + } + return elps; + } + + function indexedProperty(property) { + return (isNaN(window.parseInt(property, 10))); + } + + function renderBackgroundRepeat(ctx, image, backgroundPosition, bounds) { + var offsetX = Math.round(bounds.left + backgroundPosition.left), + offsetY = Math.round(bounds.top + backgroundPosition.top); + + ctx.createPattern(image); + ctx.translate(offsetX, offsetY); + ctx.fill(); + ctx.translate(-offsetX, -offsetY); + } + + function backgroundRepeatShape(ctx, image, backgroundPosition, bounds, left, top, width, height) { + var args = []; + args.push(["line", Math.round(left), Math.round(top)]); + args.push(["line", Math.round(left + width), Math.round(top)]); + args.push(["line", Math.round(left + width), Math.round(height + top)]); + args.push(["line", Math.round(left), Math.round(height + top)]); + createShape(ctx, args); + ctx.save(); + ctx.clip(); + renderBackgroundRepeat(ctx, image, backgroundPosition, bounds); + ctx.restore(); + } + + function renderBackgroundColor(ctx, backgroundBounds, bgcolor) { + renderRect( + ctx, + backgroundBounds.left, + backgroundBounds.top, + backgroundBounds.width, + backgroundBounds.height, + bgcolor + ); + } + + function renderBackgroundRepeating(el, bounds, ctx, image, imageIndex) { + var backgroundSize = Util.BackgroundSize(el, bounds, image, imageIndex), + backgroundPosition = Util.BackgroundPosition(el, bounds, image, imageIndex, backgroundSize), + backgroundRepeat = Util.BackgroundRepeat(el, imageIndex); + + image = resizeImage(image, backgroundSize); + + switch (backgroundRepeat) { + case "repeat-x": + case "repeat no-repeat": + backgroundRepeatShape(ctx, image, backgroundPosition, bounds, + bounds.left, bounds.top + backgroundPosition.top, 99999, image.height); + break; + case "repeat-y": + case "no-repeat repeat": + backgroundRepeatShape(ctx, image, backgroundPosition, bounds, + bounds.left + backgroundPosition.left, bounds.top, image.width, 99999); + break; + case "no-repeat": + backgroundRepeatShape(ctx, image, backgroundPosition, bounds, + bounds.left + backgroundPosition.left, bounds.top + backgroundPosition.top, image.width, image.height); + break; + default: + renderBackgroundRepeat(ctx, image, backgroundPosition, { + top: bounds.top, + left: bounds.left, + width: image.width, + height: image.height + }); + break; + } + } + + function renderBackgroundImage(element, bounds, ctx) { + var backgroundImage = getCSS(element, "backgroundImage"), + backgroundImages = Util.parseBackgroundImage(backgroundImage), + image, + imageIndex = backgroundImages.length; + + while(imageIndex--) { + backgroundImage = backgroundImages[imageIndex]; + + if (!backgroundImage.args || backgroundImage.args.length === 0) { + continue; + } + + var key = backgroundImage.method === 'url' ? + backgroundImage.args[0] : + backgroundImage.value; + + image = loadImage(key); + + // TODO add support for background-origin + if (image) { + renderBackgroundRepeating(element, bounds, ctx, image, imageIndex); + } else { + Util.log("html2canvas: Error loading background:", backgroundImage); + } + } + } + + function resizeImage(image, bounds) { + if(image.width === bounds.width && image.height === bounds.height) { + return image; + } + + var ctx, canvas = doc.createElement('canvas'); + canvas.width = bounds.width; + canvas.height = bounds.height; + ctx = canvas.getContext("2d"); + drawImage(ctx, image, 0, 0, image.width, image.height, 0, 0, bounds.width, bounds.height ); + return canvas; + } + + function setOpacity(ctx, element, parentStack) { + return ctx.setVariable("globalAlpha", getCSS(element, "opacity") * ((parentStack) ? parentStack.opacity : 1)); + } + + function removePx(str) { + return str.replace("px", ""); + } + + function getTransform(element, parentStack) { + var transformRegExp = /(matrix)\((.+)\)/; + var transform = getCSS(element, "transform") || getCSS(element, "-webkit-transform") || getCSS(element, "-moz-transform") || getCSS(element, "-ms-transform") || getCSS(element, "-o-transform"); + var transformOrigin = getCSS(element, "transform-origin") || getCSS(element, "-webkit-transform-origin") || getCSS(element, "-moz-transform-origin") || getCSS(element, "-ms-transform-origin") || getCSS(element, "-o-transform-origin") || "0px 0px"; + + transformOrigin = transformOrigin.split(" ").map(removePx).map(Util.asFloat); + + var matrix; + if (transform && transform !== "none") { + var match = transform.match(transformRegExp); + if (match) { + switch(match[1]) { + case "matrix": + matrix = match[2].split(",").map(Util.trimText).map(Util.asFloat); + break; + } + } + } + + return { + origin: transformOrigin, + matrix: matrix + }; + } + + function createStack(element, parentStack, bounds, transform) { + var ctx = h2cRenderContext((!parentStack) ? documentWidth() : bounds.width , (!parentStack) ? documentHeight() : bounds.height), + stack = { + ctx: ctx, + opacity: setOpacity(ctx, element, parentStack), + cssPosition: getCSS(element, "position"), + borders: getBorderData(element), + transform: transform, + clip: (parentStack && parentStack.clip) ? Util.Extend( {}, parentStack.clip ) : null + }; + + setZ(element, stack, parentStack); + + // TODO correct overflow for absolute content residing under a static position + if (options.useOverflow === true && /(hidden|scroll|auto)/.test(getCSS(element, "overflow")) === true && /(BODY)/i.test(element.nodeName) === false){ + stack.clip = (stack.clip) ? clipBounds(stack.clip, bounds) : bounds; + } + + return stack; + } + + function getBackgroundBounds(borders, bounds, clip) { + var backgroundBounds = { + left: bounds.left + borders[3].width, + top: bounds.top + borders[0].width, + width: bounds.width - (borders[1].width + borders[3].width), + height: bounds.height - (borders[0].width + borders[2].width) + }; + + if (clip) { + backgroundBounds = clipBounds(backgroundBounds, clip); + } + + return backgroundBounds; + } + + function getBounds(element, transform) { + var bounds = (transform.matrix) ? Util.OffsetBounds(element) : Util.Bounds(element); + transform.origin[0] += bounds.left; + transform.origin[1] += bounds.top; + return bounds; + } + + function renderElement(element, parentStack, ignoreBackground) { + var transform = getTransform(element, parentStack), + bounds = getBounds(element, transform), + image, + stack = createStack(element, parentStack, bounds, transform), + borders = stack.borders, + ctx = stack.ctx, + backgroundBounds = getBackgroundBounds(borders, bounds, stack.clip), + borderData = parseBorders(element, bounds, borders), + backgroundColor = (ignoreElementsRegExp.test(element.nodeName)) ? "#efefef" : getCSS(element, "backgroundColor"); + + + createShape(ctx, borderData.clip); + + ctx.save(); + ctx.clip(); + + if (backgroundBounds.height > 0 && backgroundBounds.width > 0 && !ignoreBackground) { + renderBackgroundColor(ctx, bounds, backgroundColor); + renderBackgroundImage(element, backgroundBounds, ctx); + } else if (ignoreBackground) { + stack.backgroundColor = backgroundColor; + } + + ctx.restore(); + + borderData.borders.forEach(function(border) { + renderBorders(ctx, border.args, border.color); + }); + + switch(element.nodeName){ + case "IMG": + if ((image = loadImage(element.getAttribute('src')))) { + renderImage(ctx, element, image, bounds, borders); + } else { + Util.log("html2canvas: Error loading :" + element.getAttribute('src')); + } + break; + case "INPUT": + // TODO add all relevant type's, i.e. HTML5 new stuff + // todo add support for placeholder attribute for browsers which support it + if (/^(text|url|email|submit|button|reset)$/.test(element.type) && (element.value || element.placeholder || "").length > 0){ + renderFormValue(element, bounds, stack); + } + break; + case "TEXTAREA": + if ((element.value || element.placeholder || "").length > 0){ + renderFormValue(element, bounds, stack); + } + break; + case "SELECT": + if ((element.options||element.placeholder || "").length > 0){ + renderFormValue(element, bounds, stack); + } + break; + case "LI": + renderListItem(element, stack, backgroundBounds); + break; + case "CANVAS": + renderImage(ctx, element, element, bounds, borders); + break; + } + + return stack; + } + + function isElementVisible(element) { + return (getCSS(element, 'display') !== "none" && getCSS(element, 'visibility') !== "hidden" && !element.hasAttribute("data-html2canvas-ignore")); + } + + function parseElement (element, stack, cb) { + if (!cb) { + cb = function(){}; + } + if (isElementVisible(element)) { + stack = renderElement(element, stack, false) || stack; + if (!ignoreElementsRegExp.test(element.nodeName)) { + return parseChildren(element, stack, cb); + } + } + cb(); + } + + function parseChildren(element, stack, cb) { + var children = Util.Children(element); + // After all nodes have processed, finished() will call the cb. + // We add one and kick it off so this will still work when children.length === 0. + // Note that unless async is true, this will happen synchronously, just will callbacks. + var jobs = children.length + 1; + finished(); + + if (options.async) { + children.forEach(function(node) { + // Don't block the page from rendering + setTimeout(function(){ parseNode(node); }, 0); + }); + } else { + children.forEach(parseNode); + } + + function parseNode(node) { + if (node.nodeType === node.ELEMENT_NODE) { + parseElement(node, stack, finished); + } else if (node.nodeType === node.TEXT_NODE) { + renderText(element, node, stack); + finished(); + } else { + finished(); + } + } + function finished(el) { + if (--jobs <= 0){ + Util.log("finished rendering " + children.length + " children."); + cb(); + } + } + } +}; +_html2canvas.Preload = function( options ) { + + var images = { + numLoaded: 0, // also failed are counted here + numFailed: 0, + numTotal: 0, + cleanupDone: false + }, + pageOrigin, + Util = _html2canvas.Util, + methods, + i, + count = 0, + element = options.elements[0] || document.body, + doc = element.ownerDocument, + domImages = element.getElementsByTagName('img'), // Fetch images of the present element only + imgLen = domImages.length, + link = doc.createElement("a"), + supportCORS = (function( img ){ + return (img.crossOrigin !== undefined); + })(new Image()), + timeoutTimer; + + link.href = window.location.href; + pageOrigin = link.protocol + link.host; + + function isSameOrigin(url){ + link.href = url; + link.href = link.href; // YES, BELIEVE IT OR NOT, that is required for IE9 - http://jsfiddle.net/niklasvh/2e48b/ + var origin = link.protocol + link.host; + return (origin === pageOrigin); + } + + function start(){ + Util.log("html2canvas: start: images: " + images.numLoaded + " / " + images.numTotal + " (failed: " + images.numFailed + ")"); + if (!images.firstRun && images.numLoaded >= images.numTotal){ + Util.log("Finished loading images: # " + images.numTotal + " (failed: " + images.numFailed + ")"); + + if (typeof options.complete === "function"){ + options.complete(images); + } + + } + } + + // TODO modify proxy to serve images with CORS enabled, where available + function proxyGetImage(url, img, imageObj){ + var callback_name, + scriptUrl = options.proxy, + script; + + link.href = url; + url = link.href; // work around for pages with base href="" set - WARNING: this may change the url + + callback_name = 'html2canvas_' + (count++); + imageObj.callbackname = callback_name; + + if (scriptUrl.indexOf("?") > -1) { + scriptUrl += "&"; + } else { + scriptUrl += "?"; + } + scriptUrl += 'url=' + encodeURIComponent(url) + '&callback=' + callback_name; + script = doc.createElement("script"); + + window[callback_name] = function(a){ + if (a.substring(0,6) === "error:"){ + imageObj.succeeded = false; + images.numLoaded++; + images.numFailed++; + start(); + } else { + setImageLoadHandlers(img, imageObj); + img.src = a; + } + window[callback_name] = undefined; // to work with IE<9 // NOTE: that the undefined callback property-name still exists on the window object (for IE<9) + try { + delete window[callback_name]; // for all browser that support this + } catch(ex) {} + script.parentNode.removeChild(script); + script = null; + delete imageObj.script; + delete imageObj.callbackname; + }; + + script.setAttribute("type", "text/javascript"); + script.setAttribute("src", scriptUrl); + imageObj.script = script; + window.document.body.appendChild(script); + + } + + function loadPseudoElement(element, type) { + var style = window.getComputedStyle(element, type), + content = style.content; + if (content.substr(0, 3) === 'url') { + methods.loadImage(_html2canvas.Util.parseBackgroundImage(content)[0].args[0]); + } + loadBackgroundImages(style.backgroundImage, element); + } + + function loadPseudoElementImages(element) { + loadPseudoElement(element, ":before"); + loadPseudoElement(element, ":after"); + } + + function loadGradientImage(backgroundImage, bounds) { + var img = _html2canvas.Generate.Gradient(backgroundImage, bounds); + + if (img !== undefined){ + images[backgroundImage] = { + img: img, + succeeded: true + }; + images.numTotal++; + images.numLoaded++; + start(); + } + } + + function invalidBackgrounds(background_image) { + return (background_image && background_image.method && background_image.args && background_image.args.length > 0 ); + } + + function loadBackgroundImages(background_image, el) { + var bounds; + + _html2canvas.Util.parseBackgroundImage(background_image).filter(invalidBackgrounds).forEach(function(background_image) { + if (background_image.method === 'url') { + methods.loadImage(background_image.args[0]); + } else if(background_image.method.match(/\-?gradient$/)) { + if(bounds === undefined) { + bounds = _html2canvas.Util.Bounds(el); + } + loadGradientImage(background_image.value, bounds); + } + }); + } + + function getImages (el) { + var elNodeType = false; + + // Firefox fails with permission denied on pages with iframes + try { + Util.Children(el).forEach(getImages); + } + catch( e ) {} + + try { + elNodeType = el.nodeType; + } catch (ex) { + elNodeType = false; + Util.log("html2canvas: failed to access some element's nodeType - Exception: " + ex.message); + } + + if (elNodeType === 1 || elNodeType === undefined) { + loadPseudoElementImages(el); + try { + loadBackgroundImages(Util.getCSS(el, 'backgroundImage'), el); + } catch(e) { + Util.log("html2canvas: failed to get background-image - Exception: " + e.message); + } + loadBackgroundImages(el); + } + } + + function setImageLoadHandlers(img, imageObj) { + img.onload = function() { + if ( imageObj.timer !== undefined ) { + // CORS succeeded + window.clearTimeout( imageObj.timer ); + } + + images.numLoaded++; + imageObj.succeeded = true; + img.onerror = img.onload = null; + start(); + }; + img.onerror = function() { + if (img.crossOrigin === "anonymous") { + // CORS failed + window.clearTimeout( imageObj.timer ); + + // let's try with proxy instead + if ( options.proxy ) { + var src = img.src; + img = new Image(); + imageObj.img = img; + img.src = src; + + proxyGetImage( img.src, img, imageObj ); + return; + } + } + + images.numLoaded++; + images.numFailed++; + imageObj.succeeded = false; + img.onerror = img.onload = null; + start(); + }; + } + + methods = { + loadImage: function( src ) { + var img, imageObj; + if ( src && images[src] === undefined ) { + img = new Image(); + if ( src.match(/data:image\/.*;base64,/i) ) { + img.src = src.replace(/url\(['"]{0,}|['"]{0,}\)$/ig, ''); + imageObj = images[src] = { + img: img + }; + images.numTotal++; + setImageLoadHandlers(img, imageObj); + } else if ( isSameOrigin( src ) || options.allowTaint === true ) { + imageObj = images[src] = { + img: img + }; + images.numTotal++; + setImageLoadHandlers(img, imageObj); + img.src = src; + } else if ( supportCORS && !options.allowTaint && options.useCORS ) { + // attempt to load with CORS + + img.crossOrigin = "anonymous"; + imageObj = images[src] = { + img: img + }; + images.numTotal++; + setImageLoadHandlers(img, imageObj); + img.src = src; + } else if ( options.proxy ) { + imageObj = images[src] = { + img: img + }; + images.numTotal++; + proxyGetImage( src, img, imageObj ); + } + } + + }, + cleanupDOM: function(cause) { + var img, src; + if (!images.cleanupDone) { + if (cause && typeof cause === "string") { + Util.log("html2canvas: Cleanup because: " + cause); + } else { + Util.log("html2canvas: Cleanup after timeout: " + options.timeout + " ms."); + } + + for (src in images) { + if (images.hasOwnProperty(src)) { + img = images[src]; + if (typeof img === "object" && img.callbackname && img.succeeded === undefined) { + // cancel proxy image request + window[img.callbackname] = undefined; // to work with IE<9 // NOTE: that the undefined callback property-name still exists on the window object (for IE<9) + try { + delete window[img.callbackname]; // for all browser that support this + } catch(ex) {} + if (img.script && img.script.parentNode) { + img.script.setAttribute("src", "about:blank"); // try to cancel running request + img.script.parentNode.removeChild(img.script); + } + images.numLoaded++; + images.numFailed++; + Util.log("html2canvas: Cleaned up failed img: '" + src + "' Steps: " + images.numLoaded + " / " + images.numTotal); + } + } + } + + // cancel any pending requests + if(window.stop !== undefined) { + window.stop(); + } else if(document.execCommand !== undefined) { + document.execCommand("Stop", false); + } + if (document.close !== undefined) { + document.close(); + } + images.cleanupDone = true; + if (!(cause && typeof cause === "string")) { + start(); + } + } + }, + + renderingDone: function() { + if (timeoutTimer) { + window.clearTimeout(timeoutTimer); + } + } + }; + + if (options.timeout > 0) { + timeoutTimer = window.setTimeout(methods.cleanupDOM, options.timeout); + } + + Util.log('html2canvas: Preload starts: finding background-images'); + images.firstRun = true; + + getImages(element); + + Util.log('html2canvas: Preload: Finding images'); + // load images + for (i = 0; i < imgLen; i+=1){ + methods.loadImage( domImages[i].getAttribute( "src" ) ); + } + + images.firstRun = false; + Util.log('html2canvas: Preload: Done.'); + if (images.numTotal === images.numLoaded) { + start(); + } + + return methods; +}; + +_html2canvas.Renderer = function(parseQueue, options){ + function sortZindex(a, b) { + if (a === 'children') { + return -1; + } else if (b === 'children') { + return 1; + } else { + return a - b; + } + } + + // http://www.w3.org/TR/CSS21/zindex.html + function createRenderQueue(parseQueue) { + var queue = [], + rootContext; + + rootContext = (function buildStackingContext(rootNode) { + var rootContext = {}; + function insert(context, node, specialParent) { + var zi = (node.zIndex.zindex === 'auto') ? 0 : Number(node.zIndex.zindex), + contextForChildren = context, // the stacking context for children + isPositioned = node.zIndex.isPositioned, + isFloated = node.zIndex.isFloated, + stub = {node: node}, + childrenDest = specialParent; // where children without z-index should be pushed into + + if (node.zIndex.ownStacking) { + contextForChildren = stub.context = { + children: [{node:node, children: []}] + }; + childrenDest = undefined; + } else if (isPositioned || isFloated) { + childrenDest = stub.children = []; + } + + if (zi === 0 && specialParent) { + specialParent.push(stub); + } else { + if (!context[zi]) { context[zi] = []; } + context[zi].push(stub); + } + + node.zIndex.children.forEach(function(childNode) { + insert(contextForChildren, childNode, childrenDest); + }); + } + insert(rootContext, rootNode); + return rootContext; + })(parseQueue); + + function sortZ(context) { + Object.keys(context).sort(sortZindex).forEach(function(zi) { + var nonPositioned = [], + floated = [], + positioned = [], + list = []; + + // positioned after static + context[zi].forEach(function(v) { + if (v.node.zIndex.isPositioned || v.node.zIndex.opacity < 1) { + // http://www.w3.org/TR/css3-color/#transparency + // non-positioned element with opactiy < 1 should be stacked as if it were a positioned element with ‘z-index: 0’ and ‘opacity: 1’. + positioned.push(v); + } else if (v.node.zIndex.isFloated) { + floated.push(v); + } else { + nonPositioned.push(v); + } + }); + + (function walk(arr) { + arr.forEach(function(v) { + list.push(v); + if (v.children) { walk(v.children); } + }); + })(nonPositioned.concat(floated, positioned)); + + list.forEach(function(v) { + if (v.context) { + sortZ(v.context); + } else { + queue.push(v.node); + } + }); + }); + } + + sortZ(rootContext); + + return queue; + } + + function getRenderer(rendererName) { + var renderer; + + if (typeof options.renderer === "string" && _html2canvas.Renderer[rendererName] !== undefined) { + renderer = _html2canvas.Renderer[rendererName](options); + } else if (typeof rendererName === "function") { + renderer = rendererName(options); + } else { + throw new Error("Unknown renderer"); + } + + if ( typeof renderer !== "function" ) { + throw new Error("Invalid renderer defined"); + } + return renderer; + } + + return getRenderer(options.renderer)(parseQueue, options, document, createRenderQueue(parseQueue.stack), _html2canvas); +}; + +_html2canvas.Util.Support = function (options, doc) { + + function supportSVGRendering() { + var img = new Image(), + canvas = doc.createElement("canvas"), + ctx = (canvas.getContext === undefined) ? false : canvas.getContext("2d"); + if (ctx === false) { + return false; + } + canvas.width = canvas.height = 10; + img.src = [ + "data:image/svg+xml,", + "", + "", + "
", + "sup", + "
", + "
", + "
" + ].join(""); + try { + ctx.drawImage(img, 0, 0); + canvas.toDataURL(); + } catch(e) { + return false; + } + _html2canvas.Util.log('html2canvas: Parse: SVG powered rendering available'); + return true; + } + + // Test whether we can use ranges to measure bounding boxes + // Opera doesn't provide valid bounds.height/bottom even though it supports the method. + + function supportRangeBounds() { + var r, testElement, rangeBounds, rangeHeight, support = false; + + if (doc.createRange) { + r = doc.createRange(); + if (r.getBoundingClientRect) { + testElement = doc.createElement('boundtest'); + testElement.style.height = "123px"; + testElement.style.display = "block"; + doc.body.appendChild(testElement); + + r.selectNode(testElement); + rangeBounds = r.getBoundingClientRect(); + rangeHeight = rangeBounds.height; + + if (rangeHeight === 123) { + support = true; + } + doc.body.removeChild(testElement); + } + } + + return support; + } + + return { + rangeBounds: supportRangeBounds(), + svgRendering: options.svgRendering && supportSVGRendering() + }; +}; +window.html2canvas = function(elements, opts) { + elements = (elements.length) ? elements : [elements]; + var queue, + canvas, + options = { + // general + logging: false, + elements: elements, + background: "#fff", + + // preload options + proxy: null, + timeout: 0, // no timeout + useCORS: false, // try to load images as CORS (where available), before falling back to proxy + allowTaint: false, // whether to allow images to taint the canvas, won't need proxy if set to true + + // parse options + svgRendering: false, // use svg powered rendering where available (FF11+) + ignoreElements: "IFRAME|OBJECT|PARAM", + useOverflow: true, + letterRendering: false, + chinese: false, + async: false, // If true, parsing will not block, but if the user scrolls during parse the image can get weird + + // render options + width: null, + height: null, + taintTest: true, // do a taint test with all images before applying to canvas + renderer: "Canvas" + }; + + options = _html2canvas.Util.Extend(opts, options); + + _html2canvas.logging = options.logging; + options.complete = function( images ) { + + if (typeof options.onpreloaded === "function") { + if ( options.onpreloaded( images ) === false ) { + return; + } + } + _html2canvas.Parse( images, options, function(queue) { + if (typeof options.onparsed === "function") { + if ( options.onparsed( queue ) === false ) { + return; + } + } + + canvas = _html2canvas.Renderer( queue, options ); + + if (typeof options.onrendered === "function") { + options.onrendered( canvas ); + } + }); + }; + + // for pages without images, we still want this to be async, i.e. return methods before executing + window.setTimeout( function(){ + _html2canvas.Preload( options ); + }, 0 ); + + return { + render: function( queue, opts ) { + return _html2canvas.Renderer( queue, _html2canvas.Util.Extend(opts, options) ); + }, + parse: function( images, opts ) { + return _html2canvas.Parse( images, _html2canvas.Util.Extend(opts, options) ); + }, + preload: function( opts ) { + return _html2canvas.Preload( _html2canvas.Util.Extend(opts, options) ); + }, + log: _html2canvas.Util.log + }; +}; + +window.html2canvas.log = _html2canvas.Util.log; // for renderers +window.html2canvas.Renderer = { + Canvas: undefined // We are assuming this will be used +}; +_html2canvas.Renderer.Canvas = function(options) { + options = options || {}; + + var doc = document, + safeImages = [], + testCanvas = document.createElement("canvas"), + testctx = testCanvas.getContext("2d"), + Util = _html2canvas.Util, + canvas = options.canvas || doc.createElement('canvas'); + + function createShape(ctx, args) { + ctx.beginPath(); + args.forEach(function(arg) { + ctx[arg.name].apply(ctx, arg['arguments']); + }); + ctx.closePath(); + } + + function safeImage(item) { + if (safeImages.indexOf(item['arguments'][0].src) === -1) { + testctx.drawImage(item['arguments'][0], 0, 0); + try { + testctx.getImageData(0, 0, 1, 1); + } catch(e) { + testCanvas = doc.createElement("canvas"); + testctx = testCanvas.getContext("2d"); + return false; + } + safeImages.push(item['arguments'][0].src); + } + return true; + } + + function renderItem(ctx, item) { + switch(item.type){ + case "variable": + ctx[item.name] = item['arguments']; + break; + case "function": + switch(item.name) { + case "createPattern": + if (item['arguments'][0].width > 0 && item['arguments'][0].height > 0) { + try { + ctx.fillStyle = ctx.createPattern(item['arguments'][0], "repeat"); + } catch(e) { + Util.log("html2canvas: Renderer: Error creating pattern", e.message); + } + } + break; + case "drawShape": + createShape(ctx, item['arguments']); + break; + case "drawImage": + if (item['arguments'][8] > 0 && item['arguments'][7] > 0) { + if (!options.taintTest || (options.taintTest && safeImage(item))) { + ctx.drawImage.apply( ctx, item['arguments'] ); + } + } + break; + default: + ctx[item.name].apply(ctx, item['arguments']); + } + break; + } + } + + return function(parsedData, options, document, queue, _html2canvas) { + var ctx = canvas.getContext("2d"), + newCanvas, + bounds, + fstyle, + zStack = parsedData.stack; + + canvas.width = canvas.style.width = options.width || zStack.ctx.width; + canvas.height = canvas.style.height = options.height || zStack.ctx.height; + + fstyle = ctx.fillStyle; + ctx.fillStyle = (Util.isTransparent(parsedData.backgroundColor) && options.background !== undefined) ? options.background : parsedData.backgroundColor; + ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.fillStyle = fstyle; + queue.forEach(function(storageContext) { + // set common settings for canvas + ctx.textBaseline = "bottom"; + ctx.save(); + + if (storageContext.transform.matrix) { + ctx.translate(storageContext.transform.origin[0], storageContext.transform.origin[1]); + ctx.transform.apply(ctx, storageContext.transform.matrix); + ctx.translate(-storageContext.transform.origin[0], -storageContext.transform.origin[1]); + } + + if (storageContext.clip){ + ctx.beginPath(); + ctx.rect(storageContext.clip.left, storageContext.clip.top, storageContext.clip.width, storageContext.clip.height); + ctx.clip(); + } + + if (storageContext.ctx.storage) { + storageContext.ctx.storage.forEach(function(item) { + renderItem(ctx, item); + }); + } + + ctx.restore(); + }); + + Util.log("html2canvas: Renderer: Canvas renderer done - returning canvas obj"); + + if (options.elements.length === 1) { + if (typeof options.elements[0] === "object" && options.elements[0].nodeName !== "BODY") { + // crop image to the bounds of selected (single) element + bounds = _html2canvas.Util.Bounds(options.elements[0]); + newCanvas = document.createElement('canvas'); + + + newCanvas.width = Math.ceil(bounds.width); + newCanvas.height = Math.ceil(bounds.height); + + ctx = newCanvas.getContext("2d"); + ctx.drawImage(canvas, bounds.left, bounds.top, bounds.width, bounds.height, 0, 0, bounds.width, bounds.height); + + + + canvas = null; + return newCanvas; + } + } + + return canvas; + }; +}; +})(window,document); diff --git a/Apollo/assets/js/tableExport/jquery.base64.js b/Apollo/assets/js/tableExport/jquery.base64.js new file mode 100644 index 00000000..6c98f156 --- /dev/null +++ b/Apollo/assets/js/tableExport/jquery.base64.js @@ -0,0 +1,190 @@ +/*jslint adsafe: false, bitwise: true, browser: true, cap: false, css: false, + debug: false, devel: true, eqeqeq: true, es5: false, evil: false, + forin: false, fragment: false, immed: true, laxbreak: false, newcap: true, + nomen: false, on: false, onevar: true, passfail: false, plusplus: true, + regexp: false, rhino: true, safe: false, strict: false, sub: false, + undef: true, white: false, widget: false, windows: false */ +/*global jQuery: false, window: false */ +//"use strict"; + +/* + * Original code (c) 2010 Nick Galbreath + * http://code.google.com/p/stringencoders/source/browse/#svn/trunk/javascript + * + * jQuery port (c) 2010 Carlo Zottmann + * http://github.com/carlo/jquery-base64 + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* base64 encode/decode compatible with window.btoa/atob + * + * window.atob/btoa is a Firefox extension to convert binary data (the "b") + * to base64 (ascii, the "a"). + * + * It is also found in Safari and Chrome. It is not available in IE. + * + * if (!window.btoa) window.btoa = $.base64.encode + * if (!window.atob) window.atob = $.base64.decode + * + * The original spec's for atob/btoa are a bit lacking + * https://developer.mozilla.org/en/DOM/window.atob + * https://developer.mozilla.org/en/DOM/window.btoa + * + * window.btoa and $.base64.encode takes a string where charCodeAt is [0,255] + * If any character is not [0,255], then an exception is thrown. + * + * window.atob and $.base64.decode take a base64-encoded string + * If the input length is not a multiple of 4, or contains invalid characters + * then an exception is thrown. + */ + +jQuery.base64 = ( function( $ ) { + + var _PADCHAR = "=", + _ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + _VERSION = "1.0"; + + + function _getbyte64( s, i ) { + // This is oddly fast, except on Chrome/V8. + // Minimal or no improvement in performance by using a + // object with properties mapping chars to value (eg. 'A': 0) + + var idx = _ALPHA.indexOf( s.charAt( i ) ); + + if ( idx === -1 ) { + throw "Cannot decode base64"; + } + + return idx; + } + + + function _decode( s ) { + var pads = 0, + i, + b10, + imax = s.length, + x = []; + + s = String( s ); + + if ( imax === 0 ) { + return s; + } + + if ( imax % 4 !== 0 ) { + throw "Cannot decode base64"; + } + + if ( s.charAt( imax - 1 ) === _PADCHAR ) { + pads = 1; + + if ( s.charAt( imax - 2 ) === _PADCHAR ) { + pads = 2; + } + + // either way, we want to ignore this last block + imax -= 4; + } + + for ( i = 0; i < imax; i += 4 ) { + b10 = ( _getbyte64( s, i ) << 18 ) | ( _getbyte64( s, i + 1 ) << 12 ) | ( _getbyte64( s, i + 2 ) << 6 ) | _getbyte64( s, i + 3 ); + x.push( String.fromCharCode( b10 >> 16, ( b10 >> 8 ) & 0xff, b10 & 0xff ) ); + } + + switch ( pads ) { + case 1: + b10 = ( _getbyte64( s, i ) << 18 ) | ( _getbyte64( s, i + 1 ) << 12 ) | ( _getbyte64( s, i + 2 ) << 6 ); + x.push( String.fromCharCode( b10 >> 16, ( b10 >> 8 ) & 0xff ) ); + break; + + case 2: + b10 = ( _getbyte64( s, i ) << 18) | ( _getbyte64( s, i + 1 ) << 12 ); + x.push( String.fromCharCode( b10 >> 16 ) ); + break; + } + + return x.join( "" ); + } + + + function _getbyte( s, i ) { + var x = s.charCodeAt( i ); + + if ( x > 255 ) { + throw "INVALID_CHARACTER_ERR: DOM Exception 5"; + } + + return x; + } + + + function _encode( s ) { + if ( arguments.length !== 1 ) { + throw "SyntaxError: exactly one argument required"; + } + + s = String( s ); + + var i, + b10, + x = [], + imax = s.length - s.length % 3; + + if ( s.length === 0 ) { + return s; + } + + for ( i = 0; i < imax; i += 3 ) { + b10 = ( _getbyte( s, i ) << 16 ) | ( _getbyte( s, i + 1 ) << 8 ) | _getbyte( s, i + 2 ); + x.push( _ALPHA.charAt( b10 >> 18 ) ); + x.push( _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) ); + x.push( _ALPHA.charAt( ( b10 >> 6 ) & 0x3f ) ); + x.push( _ALPHA.charAt( b10 & 0x3f ) ); + } + + switch ( s.length - imax ) { + case 1: + b10 = _getbyte( s, i ) << 16; + x.push( _ALPHA.charAt( b10 >> 18 ) + _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) + _PADCHAR + _PADCHAR ); + break; + + case 2: + b10 = ( _getbyte( s, i ) << 16 ) | ( _getbyte( s, i + 1 ) << 8 ); + x.push( _ALPHA.charAt( b10 >> 18 ) + _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) + _ALPHA.charAt( ( b10 >> 6 ) & 0x3f ) + _PADCHAR ); + break; + } + + return x.join( "" ); + } + + + return { + decode: _decode, + encode: _encode, + VERSION: _VERSION + }; + +}( jQuery ) ); + diff --git a/Apollo/assets/js/tableExport/jspdf/jspdf.js b/Apollo/assets/js/tableExport/jspdf/jspdf.js new file mode 100644 index 00000000..2e703c93 --- /dev/null +++ b/Apollo/assets/js/tableExport/jspdf/jspdf.js @@ -0,0 +1,303 @@ +/** + * jsPDF + * (c) 2009 James Hall + * + * Some parts based on FPDF. + */ + +var jsPDF = function(){ + + // Private properties + var version = '20090504'; + var buffer = ''; + + var pdfVersion = '1.3'; // PDF Version + var defaultPageFormat = 'a4'; + var pageFormats = { // Size in mm of various paper formats + 'a3': [841.89, 1190.55], + 'a4': [595.28, 841.89], + 'a5': [420.94, 595.28], + 'letter': [612, 792], + 'legal': [612, 1008] + }; + var textColor = '0 g'; + var page = 0; + var objectNumber = 2; // 'n' Current object number + var state = 0; // Current document state + var pages = new Array(); + var offsets = new Array(); // List of offsets + var lineWidth = 0.200025; // 2mm + var pageHeight; + var k; // Scale factor + var unit = 'mm'; // Default to mm for units + var fontNumber; // TODO: This is temp, replace with real font handling + var documentProperties = {}; + var fontSize = 16; // Default font size + var pageFontSize = 16; + + // Initilisation + if (unit == 'pt') { + k = 1; + } else if(unit == 'mm') { + k = 72/25.4; + } else if(unit == 'cm') { + k = 72/2.54; + } else if(unit == 'in') { + k = 72; + } + + // Private functions + var newObject = function() { + //Begin a new object + objectNumber ++; + offsets[objectNumber] = buffer.length; + out(objectNumber + ' 0 obj'); + } + + + var putHeader = function() { + out('%PDF-' + pdfVersion); + } + + var putPages = function() { + + // TODO: Fix, hardcoded to a4 portrait + var wPt = pageWidth * k; + var hPt = pageHeight * k; + + for(n=1; n <= page; n++) { + newObject(); + out('<>'); + out('endobj'); + + //Page content + p = pages[n]; + newObject(); + out('<>'); + putStream(p); + out('endobj'); + } + offsets[1] = buffer.length; + out('1 0 obj'); + out('<>'); + out('endobj'); + } + + var putStream = function(str) { + out('stream'); + out(str); + out('endstream'); + } + + var putResources = function() { + putFonts(); + putImages(); + + //Resource dictionary + offsets[2] = buffer.length; + out('2 0 obj'); + out('<<'); + putResourceDictionary(); + out('>>'); + out('endobj'); + } + + var putFonts = function() { + // TODO: Only supports core font hardcoded to Helvetica + newObject(); + fontNumber = objectNumber; + name = 'Helvetica'; + out('<>'); + out('endobj'); + } + + var putImages = function() { + // TODO + } + + var putResourceDictionary = function() { + out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + out('/Font <<'); + // Do this for each font, the '1' bit is the index of the font + // fontNumber is currently the object number related to 'putFonts' + out('/F1 ' + fontNumber + ' 0 R'); + out('>>'); + out('/XObject <<'); + putXobjectDict(); + out('>>'); + } + + var putXobjectDict = function() { + // TODO + // Loop through images + } + + + var putInfo = function() { + out('/Producer (jsPDF ' + version + ')'); + if(documentProperties.title != undefined) { + out('/Title (' + pdfEscape(documentProperties.title) + ')'); + } + if(documentProperties.subject != undefined) { + out('/Subject (' + pdfEscape(documentProperties.subject) + ')'); + } + if(documentProperties.author != undefined) { + out('/Author (' + pdfEscape(documentProperties.author) + ')'); + } + if(documentProperties.keywords != undefined) { + out('/Keywords (' + pdfEscape(documentProperties.keywords) + ')'); + } + if(documentProperties.creator != undefined) { + out('/Creator (' + pdfEscape(documentProperties.creator) + ')'); + } + var created = new Date(); + var year = created.getFullYear(); + var month = (created.getMonth() + 1); + var day = created.getDate(); + var hour = created.getHours(); + var minute = created.getMinutes(); + var second = created.getSeconds(); + out('/CreationDate (D:' + sprintf('%02d%02d%02d%02d%02d%02d', year, month, day, hour, minute, second) + ')'); + } + + var putCatalog = function () { + out('/Type /Catalog'); + out('/Pages 1 0 R'); + // TODO: Add zoom and layout modes + out('/OpenAction [3 0 R /FitH null]'); + out('/PageLayout /OneColumn'); + } + + function putTrailer() { + out('/Size ' + (objectNumber + 1)); + out('/Root ' + objectNumber + ' 0 R'); + out('/Info ' + (objectNumber - 1) + ' 0 R'); + } + + var endDocument = function() { + state = 1; + putHeader(); + putPages(); + + putResources(); + //Info + newObject(); + out('<<'); + putInfo(); + out('>>'); + out('endobj'); + + //Catalog + newObject(); + out('<<'); + putCatalog(); + out('>>'); + out('endobj'); + + //Cross-ref + var o = buffer.length; + out('xref'); + out('0 ' + (objectNumber + 1)); + out('0000000000 65535 f '); + for (var i=1; i <= objectNumber; i++) { + out(sprintf('%010d 00000 n ', offsets[i])); + } + //Trailer + out('trailer'); + out('<<'); + putTrailer(); + out('>>'); + out('startxref'); + out(o); + out('%%EOF'); + state = 3; + } + + var beginPage = function() { + page ++; + // Do dimension stuff + state = 2; + pages[page] = ''; + + // TODO: Hardcoded at A4 and portrait + pageHeight = pageFormats['a4'][1] / k; + pageWidth = pageFormats['a4'][0] / k; + } + + var out = function(string) { + if(state == 2) { + pages[page] += string + '\n'; + } else { + buffer += string + '\n'; + } + } + + var _addPage = function() { + beginPage(); + // Set line width + out(sprintf('%.2f w', (lineWidth * k))); + + // Set font - TODO + // 16 is the font size + pageFontSize = fontSize; + out('BT /F1 ' + parseInt(fontSize) + '.00 Tf ET'); + } + + // Add the first page automatically + _addPage(); + + // Escape text + var pdfEscape = function(text) { + return text.replace(/\\/g, '\\\\').replace(/\(/g, '\\(').replace(/\)/g, '\\)'); + } + + return { + addPage: function() { + _addPage(); + }, + text: function(x, y, text) { + // need page height + if(pageFontSize != fontSize) { + out('BT /F1 ' + parseInt(fontSize) + '.00 Tf ET'); + pageFontSize = fontSize; + } + var str = sprintf('BT %.2f %.2f Td (%s) Tj ET', x * k, (pageHeight - y) * k, pdfEscape(text)); + out(str); + }, + setProperties: function(properties) { + documentProperties = properties; + }, + addImage: function(imageData, format, x, y, w, h) { + + }, + output: function(type, options) { + endDocument(); + if(type == undefined) { + return buffer; + } + if(type == 'datauri') { + document.location.href = 'data:application/pdf;base64,' + Base64.encode(buffer); + } + // @TODO: Add different output options + }, + setFontSize: function(size) { + fontSize = size; + } + } + +}; diff --git a/Apollo/assets/js/tableExport/jspdf/libs/base64.js b/Apollo/assets/js/tableExport/jspdf/libs/base64.js new file mode 100644 index 00000000..7d9536a4 --- /dev/null +++ b/Apollo/assets/js/tableExport/jspdf/libs/base64.js @@ -0,0 +1,143 @@ + +/** +* +* Base64 encode / decode +* http://www.webtoolkit.info/ +* +**/ + +var Base64 = { + + // private property + _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + + // public method for encoding + encode : function (input) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + + input = Base64._utf8_encode(input); + + while (i < input.length) { + + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); + + } + + return output; + }, + + // public method for decoding + decode : function (input) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + while (i < input.length) { + + enc1 = this._keyStr.indexOf(input.charAt(i++)); + enc2 = this._keyStr.indexOf(input.charAt(i++)); + enc3 = this._keyStr.indexOf(input.charAt(i++)); + enc4 = this._keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + + } + + output = Base64._utf8_decode(output); + + return output; + + }, + + // private method for UTF-8 encoding + _utf8_encode : function (string) { + string = string.replace(/\r\n/g,"\n"); + var utftext = ""; + + for (var n = 0; n < string.length; n++) { + + var c = string.charCodeAt(n); + + if (c < 128) { + utftext += String.fromCharCode(c); + } + else if((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } + else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } + + } + + return utftext; + }, + + // private method for UTF-8 decoding + _utf8_decode : function (utftext) { + var string = ""; + var i = 0; + var c = c1 = c2 = 0; + + while ( i < utftext.length ) { + + c = utftext.charCodeAt(i); + + if (c < 128) { + string += String.fromCharCode(c); + i++; + } + else if((c > 191) && (c < 224)) { + c2 = utftext.charCodeAt(i+1); + string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + i += 2; + } + else { + c2 = utftext.charCodeAt(i+1); + c3 = utftext.charCodeAt(i+2); + string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + i += 3; + } + + } + + return string; + } + +} diff --git a/Apollo/assets/js/tableExport/jspdf/libs/sprintf.js b/Apollo/assets/js/tableExport/jspdf/libs/sprintf.js new file mode 100644 index 00000000..1af7bdf6 --- /dev/null +++ b/Apollo/assets/js/tableExport/jspdf/libs/sprintf.js @@ -0,0 +1,152 @@ + + +function sprintf( ) { + // Return a formatted string + // + // version: 903.3016 + // discuss at: http://phpjs.org/functions/sprintf + // + original by: Ash Searle (http://hexmen.com/blog/) + // + namespaced by: Michael White (http://getsprink.com) + // + tweaked by: Jack + // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) + // + input by: Paulo Ricardo F. Santos + // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) + // + input by: Brett Zamir (http://brettz9.blogspot.com) + // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) + // * example 1: sprintf("%01.2f", 123.1); + // * returns 1: 123.10 + // * example 2: sprintf("[%10s]", 'monkey'); + // * returns 2: '[ monkey]' + // * example 3: sprintf("[%'#10s]", 'monkey'); + // * returns 3: '[####monkey]' + var regex = /%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g; + var a = arguments, i = 0, format = a[i++]; + + // pad() + var pad = function(str, len, chr, leftJustify) { + if (!chr) chr = ' '; + var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr); + return leftJustify ? str + padding : padding + str; + }; + + // justify() + var justify = function(value, prefix, leftJustify, minWidth, zeroPad, customPadChar) { + var diff = minWidth - value.length; + if (diff > 0) { + if (leftJustify || !zeroPad) { + value = pad(value, minWidth, customPadChar, leftJustify); + } else { + value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length); + } + } + return value; + }; + + // formatBaseX() + var formatBaseX = function(value, base, prefix, leftJustify, minWidth, precision, zeroPad) { + // Note: casts negative numbers to positive ones + var number = value >>> 0; + prefix = prefix && number && {'2': '0b', '8': '0', '16': '0x'}[base] || ''; + value = prefix + pad(number.toString(base), precision || 0, '0', false); + return justify(value, prefix, leftJustify, minWidth, zeroPad); + }; + + // formatString() + var formatString = function(value, leftJustify, minWidth, precision, zeroPad, customPadChar) { + if (precision != null) { + value = value.slice(0, precision); + } + return justify(value, '', leftJustify, minWidth, zeroPad, customPadChar); + }; + + // doFormat() + var doFormat = function(substring, valueIndex, flags, minWidth, _, precision, type) { + var number; + var prefix; + var method; + var textTransform; + var value; + + if (substring == '%%') return '%'; + + // parse flags + var leftJustify = false, positivePrefix = '', zeroPad = false, prefixBaseX = false, customPadChar = ' '; + var flagsl = flags.length; + for (var j = 0; flags && j < flagsl; j++) switch (flags.charAt(j)) { + case ' ': positivePrefix = ' '; break; + case '+': positivePrefix = '+'; break; + case '-': leftJustify = true; break; + case "'": customPadChar = flags.charAt(j+1); break; + case '0': zeroPad = true; break; + case '#': prefixBaseX = true; break; + } + + // parameters may be null, undefined, empty-string or real valued + // we want to ignore null, undefined and empty-string values + if (!minWidth) { + minWidth = 0; + } else if (minWidth == '*') { + minWidth = +a[i++]; + } else if (minWidth.charAt(0) == '*') { + minWidth = +a[minWidth.slice(1, -1)]; + } else { + minWidth = +minWidth; + } + + // Note: undocumented perl feature: + if (minWidth < 0) { + minWidth = -minWidth; + leftJustify = true; + } + + if (!isFinite(minWidth)) { + throw new Error('sprintf: (minimum-)width must be finite'); + } + + if (!precision) { + precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : void(0); + } else if (precision == '*') { + precision = +a[i++]; + } else if (precision.charAt(0) == '*') { + precision = +a[precision.slice(1, -1)]; + } else { + precision = +precision; + } + + // grab value using valueIndex if required? + value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++]; + + switch (type) { + case 's': return formatString(String(value), leftJustify, minWidth, precision, zeroPad, customPadChar); + case 'c': return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad); + case 'b': return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'o': return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'x': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'X': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad).toUpperCase(); + case 'u': return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'i': + case 'd': { + number = parseInt(+value); + prefix = number < 0 ? '-' : positivePrefix; + value = prefix + pad(String(Math.abs(number)), precision, '0', false); + return justify(value, prefix, leftJustify, minWidth, zeroPad); + } + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': { + number = +value; + prefix = number < 0 ? '-' : positivePrefix; + method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())]; + textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2]; + value = prefix + Math.abs(number)[method](precision); + return justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform](); + } + default: return substring; + } + }; + + return format.replace(regex, doFormat); +} diff --git a/Apollo/assets/js/tableExport/tableExport.jquery.json b/Apollo/assets/js/tableExport/tableExport.jquery.json new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Apollo/assets/js/tableExport/tableExport.jquery.json @@ -0,0 +1 @@ + diff --git a/Apollo/assets/js/tableExport/tableExport.js b/Apollo/assets/js/tableExport/tableExport.js new file mode 100644 index 00000000..1bfaa0fc --- /dev/null +++ b/Apollo/assets/js/tableExport/tableExport.js @@ -0,0 +1,359 @@ +/*The MIT License (MIT) + +Copyright (c) 2014 https://github.com/kayalshri/ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.*/ + +(function($){ + $.fn.extend({ + tableExport: function(options) { + var defaults = { + separator: ',', + ignoreColumn: [], + tableName:'yourTableName', + type:'csv', + pdfFontSize:14, + pdfLeftMargin:20, + escape:'true', + htmlContent:'false', + consoleLog:'false' + }; + + var options = $.extend(defaults, options); + var el = this; + + if(defaults.type == 'csv' || defaults.type == 'txt'){ + + // Header + var tdData =""; + $(el).find('thead').find('tr').each(function() { + tdData += "\n"; + $(this).filter(':visible').find('th').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + tdData += '"' + parseString($(this)) + '"' + defaults.separator; + } + } + + }); + tdData = $.trim(tdData); + tdData = $.trim(tdData).substring(0, tdData.length -1); + }); + + // Row vs Column + $(el).find('tbody').find('tr').each(function() { + tdData += "\n"; + $(this).filter(':visible').find('td').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + tdData += '"'+ parseString($(this)) + '"'+ defaults.separator; + } + } + }); + //tdData = $.trim(tdData); + tdData = $.trim(tdData).substring(0, tdData.length -1); + }); + + //output + if(defaults.consoleLog == 'true'){ + console.log(tdData); + } + var base64data = "base64," + $.base64.encode(tdData); + window.open('data:application/'+defaults.type+';filename=exportData;' + base64data); + }else if(defaults.type == 'sql'){ + + // Header + var tdData ="INSERT INTO `"+defaults.tableName+"` ("; + $(el).find('thead').find('tr').each(function() { + + $(this).filter(':visible').find('th').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + tdData += '`' + parseString($(this)) + '`,' ; + } + } + + }); + tdData = $.trim(tdData); + tdData = $.trim(tdData).substring(0, tdData.length -1); + }); + tdData += ") VALUES "; + // Row vs Column + $(el).find('tbody').find('tr').each(function() { + tdData += "("; + $(this).filter(':visible').find('td').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + tdData += '"'+ parseString($(this)) + '",'; + } + } + }); + + tdData = $.trim(tdData).substring(0, tdData.length -1); + tdData += "),"; + }); + tdData = $.trim(tdData).substring(0, tdData.length -1); + tdData += ";"; + + //output + //console.log(tdData); + + if(defaults.consoleLog == 'true'){ + console.log(tdData); + } + + var base64data = "base64," + $.base64.encode(tdData); + window.open('data:application/sql;filename=exportData;' + base64data); + + + }else if(defaults.type == 'json'){ + + var jsonHeaderArray = []; + $(el).find('thead').find('tr').each(function() { + var tdData =""; + var jsonArrayTd = []; + + $(this).filter(':visible').find('th').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + jsonArrayTd.push(parseString($(this))); + } + } + }); + jsonHeaderArray.push(jsonArrayTd); + + }); + + var jsonArray = []; + $(el).find('tbody').find('tr').each(function() { + var tdData =""; + var jsonArrayTd = []; + + $(this).filter(':visible').find('td').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + jsonArrayTd.push(parseString($(this))); + } + } + }); + jsonArray.push(jsonArrayTd); + + }); + + var jsonExportArray =[]; + jsonExportArray.push({header:jsonHeaderArray,data:jsonArray}); + + //Return as JSON + //console.log(JSON.stringify(jsonExportArray)); + + //Return as Array + //console.log(jsonExportArray); + if(defaults.consoleLog == 'true'){ + console.log(JSON.stringify(jsonExportArray)); + } + var base64data = "base64," + $.base64.encode(JSON.stringify(jsonExportArray)); + window.open('data:application/json;filename=exportData;' + base64data); + }else if(defaults.type == 'xml'){ + + var xml = ''; + xml += ''; + + // Header + $(el).find('thead').find('tr').each(function() { + $(this).filter(':visible').find('th').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + xml += "" + parseString($(this)) + ""; + } + } + }); + }); + xml += ''; + + // Row Vs Column + var rowCount=1; + $(el).find('tbody').find('tr').each(function() { + xml += ''; + var colCount=0; + $(this).filter(':visible').find('td').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + xml += ""+parseString($(this))+""; + } + } + colCount++; + }); + rowCount++; + xml += ''; + }); + xml += '' + + if(defaults.consoleLog == 'true'){ + console.log(xml); + } + + var base64data = "base64," + $.base64.encode(xml); + window.open('data:application/xml;filename=exportData;' + base64data); + + }else if(defaults.type == 'excel' || defaults.type == 'doc'|| defaults.type == 'powerpoint' ){ + //console.log($(this).html()); + var excel=""; + // Header + $(el).find('thead').find('tr').each(function() { + excel += ""; + $(this).filter(':visible').find('th').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + excel += ""; + } + } + }); + excel += ''; + + }); + + + // Row Vs Column + var rowCount=1; + $(el).find('tbody').find('tr').each(function() { + excel += ""; + var colCount=0; + $(this).filter(':visible').find('td').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + excel += ""; + } + } + colCount++; + }); + rowCount++; + excel += ''; + }); + excel += '
" + parseString($(this))+ "
"+parseString($(this))+"
' + + if(defaults.consoleLog == 'true'){ + console.log(excel); + } + + var excelFile = ""; + excelFile += ""; + excelFile += ""; + excelFile += ""; + excelFile += ""; + excelFile += excel; + excelFile += ""; + excelFile += ""; + + var base64data = "base64," + $.base64.encode(excelFile); + window.open('data:application/vnd.ms-'+defaults.type+';filename=exportData.doc;' + base64data); + + }else if(defaults.type == 'png'){ + html2canvas($(el), { + onrendered: function(canvas) { + var img = canvas.toDataURL("image/png"); + window.open(img); + + + } + }); + }else if(defaults.type == 'pdf'){ + + var doc = new jsPDF('p','pt', 'a4', true); + doc.setFontSize(defaults.pdfFontSize); + + // Header + var startColPosition=defaults.pdfLeftMargin; + $(el).find('thead').find('tr').each(function() { + $(this).filter(':visible').find('th').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + var colPosition = startColPosition+ (index * 50); + doc.text(colPosition,20, parseString($(this))); + } + } + }); + }); + + + // Row Vs Column + var startRowPosition = 20; var page =1;var rowPosition=0; + $(el).find('tbody').find('tr').each(function(index,data) { + rowCalc = index+1; + + if (rowCalc % 26 == 0){ + doc.addPage(); + page++; + startRowPosition=startRowPosition+10; + } + rowPosition=(startRowPosition + (rowCalc * 10)) - ((page -1) * 280); + + $(this).filter(':visible').find('td').each(function(index,data) { + if ($(this).css('display') != 'none'){ + if(defaults.ignoreColumn.indexOf(index) == -1){ + var colPosition = startColPosition+ (index * 50); + doc.text(colPosition,rowPosition, parseString($(this))); + } + } + + }); + + }); + + // Output as Data URI + doc.output('datauri'); + + } + + + function parseString(data){ + + if(defaults.htmlContent == 'true'){ + content_data = data.html().trim(); + }else{ + content_data = data.text().trim(); + } + + if(defaults.escape == 'true'){ + content_data = escape(content_data); + } + + + + return content_data; + } + + } + }); + })(jQuery); + diff --git a/Apollo/assets/views/daybook/daybook.html b/Apollo/assets/views/daybook/daybook.html index 61e387f3..4e6e0485 100755 --- a/Apollo/assets/views/daybook/daybook.html +++ b/Apollo/assets/views/daybook/daybook.html @@ -161,7 +161,9 @@ Balance - +Reason + + Status @@ -188,7 +190,7 @@ {{p.ModeOfPayment}} {{p.Amount}} {{p.Balance}} - + {{p.Reason}} {{p.Status}} @@ -205,7 +207,7 @@ - + diff --git a/Apollo/assets/views/daybook/daybookadmin.html b/Apollo/assets/views/daybook/daybookadmin.html index 91dd6175..53f7f83f 100755 --- a/Apollo/assets/views/daybook/daybookadmin.html +++ b/Apollo/assets/views/daybook/daybookadmin.html @@ -161,7 +161,9 @@ Balance - +Reason + + Status @@ -188,7 +190,7 @@ {{p.ModeOfPayment}} {{p.Amount}} {{p.Balance}} - + {{p.Reason}} {{p.Status}} @@ -200,13 +202,13 @@ - + - + @@ -254,12 +256,24 @@ - + + + + + + Type is Required diff --git a/Apollo/assets/views/daybook/daybooksuperadmin.html b/Apollo/assets/views/daybook/daybooksuperadmin.html index dae4cdc2..cc804d72 100755 --- a/Apollo/assets/views/daybook/daybooksuperadmin.html +++ b/Apollo/assets/views/daybook/daybooksuperadmin.html @@ -96,8 +96,8 @@ /*font-size: 16px;*/ } - - + +
+ + @@ -118,6 +125,8 @@ + + diff --git a/Apollo/assets/views/report_studymaterialstatus.html b/Apollo/assets/views/report_studymaterialstatus.html index de1c1984..f8cdc72a 100755 --- a/Apollo/assets/views/report_studymaterialstatus.html +++ b/Apollo/assets/views/report_studymaterialstatus.html @@ -7,14 +7,12 @@
@@ -101,8 +99,9 @@
- + + @@ -119,8 +118,9 @@ + - + diff --git a/Apollo/assets/views/report_waiver_referal.html b/Apollo/assets/views/report_waiver_referal.html index 3f5bff4d..ca6aef60 100755 --- a/Apollo/assets/views/report_waiver_referal.html +++ b/Apollo/assets/views/report_waiver_referal.html @@ -7,6 +7,12 @@
Date @@ -195,7 +195,7 @@
-
+
@@ -242,11 +242,11 @@ - - +
  • BATCHMOVEMENT @@ -466,6 +466,11 @@ Balance Fee Report
  • +
  • + + Lead Tracking Report + +
  • @@ -925,6 +930,11 @@ Balance Fee Report +
  • + + Lead Tracking Report + +
  • diff --git a/Apollo/assets/views/report_answer_booklets.html b/Apollo/assets/views/report_answer_booklets.html index b9455f67..e450ccf7 100755 --- a/Apollo/assets/views/report_answer_booklets.html +++ b/Apollo/assets/views/report_answer_booklets.html @@ -7,6 +7,12 @@
    + +
    +
    +
    +
    +
    +
    + + +
    +
    + +
    + + + +
    +
    +
    + +
    + + + +
    +
    + + +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + +
    + +
    +
    + +
    +
    + +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SL.NoDateTracking IDFollowup DateNameMobile NoUniversityCoursePresent StatusCommentsActivityAssigned To
    {{p.SL_NO}}{{p.date}}{{p.tid}}{{p.fup}}{{p.name}}{{p.mobile}}{{p.univ}}{{p.course}}{{p.prsStatus}}{{p.cmnts}}{{p.activity}}{{p.AssignTo}}
    +

    {{message}}

    + +
    + + + +
    +
    \ No newline at end of file diff --git a/Apollo/assets/views/report_mark_certificate_status.html b/Apollo/assets/views/report_mark_certificate_status.html index a137fb54..90e76c4b 100755 --- a/Apollo/assets/views/report_mark_certificate_status.html +++ b/Apollo/assets/views/report_mark_certificate_status.html @@ -1,12 +1,18 @@
    -

    Markcard/Certificate Issued Status Report

    +

    Marks Card/ Certificates - received/ Issued Status Report

    - +
    @@ -99,6 +104,8 @@
    Phone No University Balance FeeApplication Sent DateAnswer Booklet Sent Date Mark Card Status Date{{p.Phone_number}} {{p.University}} {{p.Balance_Fee}}{{p.appdate}}{{p.ansdate}} {{p.Status}} {{p.Date}}
    Phone No University Study Material StatusBalance Fee DateBalance Fee
    {{p.Phone_number}} {{p.University}} {{p.Status}}{{p.Date}} {{p.Balance_fee}}{{p.Date}}
    @@ -84,7 +93,9 @@ - + - + - + diff --git a/Apollo/assets/views/status-update/setFeesForStudent.html b/Apollo/assets/views/status-update/setFeesForStudent.html index fcec8449..bc77dd75 100755 --- a/Apollo/assets/views/status-update/setFeesForStudent.html +++ b/Apollo/assets/views/status-update/setFeesForStudent.html @@ -388,6 +388,7 @@ + @@ -411,7 +412,9 @@   - + diff --git a/Apollo/assets/views/status-update/updateFeesStatus.html b/Apollo/assets/views/status-update/updateFeesStatus.html index c2293878..00f9933d 100755 --- a/Apollo/assets/views/status-update/updateFeesStatus.html +++ b/Apollo/assets/views/status-update/updateFeesStatus.html @@ -52,7 +52,7 @@ + required ng-change="changeTotalFees(updateModel.feesType,Form);"> - Total Payable:Rs.{{updateModel.feesType.BalanceAmount}} + Total Payable:Rs.{{payableAmtInfo}} Bill amount is required @@ -551,11 +551,9 @@ - + - - diff --git a/Apollo/assets/views/student/student_details.html b/Apollo/assets/views/student/student_details.html index 6264a779..36bf1167 100755 --- a/Apollo/assets/views/student/student_details.html +++ b/Apollo/assets/views/student/student_details.html @@ -256,7 +256,7 @@ - +
    diff --git a/Apollo/assets/views/student/student_details_SuperAdmin.html b/Apollo/assets/views/student/student_details_SuperAdmin.html index 4f0f0dd8..3e263f49 100755 --- a/Apollo/assets/views/student/student_details_SuperAdmin.html +++ b/Apollo/assets/views/student/student_details_SuperAdmin.html @@ -292,7 +292,7 @@ - +
    diff --git a/Apollo/index.html b/Apollo/index.html index 52accbdc..a27a11c7 100755 --- a/Apollo/index.html +++ b/Apollo/index.html @@ -76,6 +76,10 @@ + + + + @@ -96,6 +100,7 @@ + @@ -120,6 +125,7 @@ +
    {{p.MsgBody}}
    {{p.MsgBody}} +
    +
    {{p.MSG_SEND_CNT}} {{p.CreatedOn}} diff --git a/Apollo/assets/views/sendSMS/sendSMSsuperadmin.html b/Apollo/assets/views/sendSMS/sendSMSsuperadmin.html index b88272a8..2048e6de 100755 --- a/Apollo/assets/views/sendSMS/sendSMSsuperadmin.html +++ b/Apollo/assets/views/sendSMS/sendSMSsuperadmin.html @@ -15,10 +15,10 @@
    - - -
    - -
    -
    -
    -
    - - - - -
    - -
    - -
    -

    fetching...

    -
    - -
    - -
    -
    -

    No - records found...

    -
    - -
    -
    -

    No - records found...

    -
    - -
    -
    -
    -
    + + + + +
    + +
    + +
    +

    fetching...

    +
    + +
    + +
    +
    +

    No + records found...

    +
    + +
    +
    +

    No + records found...

    +
    + +
    + +
    +
    +
    + - - -

    + th { + cursor: pointer; + } + +

    +
    +
    -
    -
    - - - - - - - - - - - - - - + + + + + + + +
    - - First Name - - Last Name - - MobileNumber - - Email ID - - Course - -
    - {{p.Firstname}}{{p.Lastname}}{{p.MobileNumber}}{{p.EmailID}}{{p.CourseName}}
    + + +
    +
    -
    - -
    -
    -
    -
    -
    -
    + .target>div:target { + display: block; + } + +
    + +
    +
    +
    +
    -
    -
    - - SMS Details - - -
    -
    -
    -
    diff --git a/Apollo/assets/views/status-update/application_status.html b/Apollo/assets/views/status-update/application_status.html index d8b395dd..6010dc41 100755 --- a/Apollo/assets/views/status-update/application_status.html +++ b/Apollo/assets/views/status-update/application_status.html @@ -3,7 +3,7 @@

    {{ mainTitle }}

    - Update application status. + Update certificate status.
    diff --git a/Apollo/assets/views/status-update/fees_status.html b/Apollo/assets/views/status-update/fees_status.html index 44b53fbd..aed584e9 100755 --- a/Apollo/assets/views/status-update/fees_status.html +++ b/Apollo/assets/views/status-update/fees_status.html @@ -127,9 +127,9 @@
    {{user.Firstname}}{{user.Firstname}} {{user.Lastname}}{{user.MobileNumber}}{{user.MobileNumber}} {{user.UniversityName}} {{user.CourseName}} Payable Fees
    + +