Professional Documents
Culture Documents
Computer Science
UBIT
University Of Karachi
BACHELOR OF SCIENCE
In
SOFTWARE ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE
UNIVERSITY OF KARACHI
Project Supervisor: Sir Muhammad Saeed
Preface
1
ACKNOWLEDGMENT
First and foremost, we would like to thank our Almighty ALLAH, for providing us the strength, courage
of conviction and the strong sense of dedication to our project that enabled us to take it to the level that it
has achieved today. Undoubtedly, we wouldnt have been now here, if it weren't for His Mercy and
Blessings.
To our family, thank you for letting us do what we want to do, supporting out decisions as crazy as they
may be. You are always there for us. Our deepest love and gratitude goes to our fathers and mothers who
played such a vital role all through our life by always placing our interests ahead of theirs. This project
work is dedicated to our parents, thank you for seeing us through every step of the way, for praying for us
and with us during times of trouble, and for rejoicing with us over very little triumph. During our studies
our family constantly provided us the hope that we needed to complete my higher education. Also thanks
to all other member of our family and friends whose love and prayers are with us all the time.
This Work would have been impossible without the copious amounts of help, patience, and encouragement from
our kind supervisor Sir Muhammad Saeed. We would like to thank him for teaching us so much and for
inspiring us with the example of hard work, providing great help and key information throughout the time
required for the completion of this project report.
DECLARATION
We hereby declare that this project report is based on our original work except for citations and
quotations which have been duly acknowledged. We also declare that it has not been previously
and concurrently submitted for any other degree or award at University of Karachi.
Signature ________________
Signature ________________
CERTIFICATE
I certify that this project report entitled Blood Finder was prepared by Abdul Bari, Farhan
Riffat and Muhammad Hasan Sarosh has met the required standard for submission in partial
fulfillment of the requirements for the award of BS in Software Engineering at University of
Karachi.
Approved by,
Signature: _________________________
Supervisor: Sir Muhammad Saeed
Date: _________________________
FARHAN RIFFAT
is a Front-End. He is a student of software engineering department of UBIT Karachi University
and working as a trainee UI/UX developer at RIKSOF software house. He plays an important
role in the development of this software. He resolves to find a UX problems and better way of
designing User Interface. He can be the best Front-End, UI/UX developer.
DEDICATION
All thanks and gratitude is due only to ALLAH, the most gracious, the most merciful and the
most beneficial, who bestowed upon me enlightenment, courage and energy to undertake and
complete this project.
Dedicated to our
We thank, pray for and promise them to do whatever is possible in our powers to comfort them and
promote their good mission for the noble cause of spreading education and development of human
beings. They have served us with their best efforts and have brought us up to be the persons we are
today, may Almighty ALLAH bless them.
BLOOD FINDER
ABSTRACT
which helps people to find the blood donors near their location.
In our world where people are suffering from several blood
diseases and having a lot of accidents in which people lost their
blood. This application will help those people to contact blood
donars of their group near them so their precious life can be safe.
Contents
CHAPTER 1
INTRODUCTION
1.1
OVERVIEW
1.2
RATIONALE
1.3
AIMS
AND
12
13
FOR THE
RESEARCH
OBJECTIVES
13
14
1.4
14
1.5
FUTURE ENHANCEMENT
15
1.6
SELECTION
15
1.7
CURRENT SYSTEM
15
1.8
BACKGROUND
16
1.9
METHODOLOGY
OF DEVELOPMENT TOOLS
OF THE PROJECT
19
CHAPTER 2
LITERATURE
REVIEW
20
2.1
INTRODUCTION
21
2.2
METHODOLOGY
21
2.3
CONCEPT
22
2.4
INTERACTIVITY
23
2.5
INTEGRATION
23
2.6
24
2.7
24
AND DEFINITION
AND INTERACTIVITY
CHAPTER 3
RESEARCH METHODOLOGY
26
3.1
INTRODUCTION
27
3.2
THEORETICAL BACKGROUND
27
3.3
BLOCK DIAGRAM
28
3.4
29
3.5
REQUIREMENTS DEFINITION
29
3.6
30
3.7
3.8
31
32
CHAPTER 4
DETAIL DESIGN
37
4.1
38
4.2
41
4.3
FUNCTIONAL DESCRIPTION
43
4.4
44
CHAPTER 5
TESTING
5.1
55
UNIT TESTING
56
CHAPTER 6
PLANNING
58
AND
PURPOSE
59
59
A.
59
REQUIREMENT ANALYSIS
B.
59
PROGRAM DESIGN
C.
59
PROGRAM DESIGN
D.
60
E. PRESENT
FTR
FORMAL MODULE
#1
#1
60
60
A.
60
REQUIREMENT ANALYSIS
B.
60
PROGRAM DESIGN
C.
60
PROGRAM DESIGN
D.
61
E. PRESENT
FTR
FORMAL MODULE
#2
10
DOCUMENTATION
#2
DOCUMENTATION
61
61
A.
61
REQUIREMENT ANALYSIS
B.
61
PROGRAM DESIGN
C.
61
CODING
D.
62
FTR
E. PRESENT
FORMAL MODULE
6.2
#3
AND MAINTENANCE
AND
#3
UNIT TESTING
DOCUMENTATION
62
62
A.
62
ERROR CORRECTION
B.
62
ENHANCEMENTS
C.
62
ADAPTATION
63
CHAPTER 7
CONCLUSION
65
7.1
CONCLUSION
66
7.2
FUTURE SCOPE
67
REFERENCES
68
CHAPTER 8
SOURCE CODE
69
11
12
INTRODUCTION
CHAPTER 1
13
1 Introduction
1.1 Overview
The idea of this project hit us when we saw a lot of terrorism
activities in our country in which a lot of people got injured and lose
their blood and ultimately lose their lifes.
14
The idea of this project hit us when we notice the residents and union presidents
are not synchronized with the budget of society and all are having quarrel among
them and with the presidents.
Beneficial for homeowners as they can keep a track of all the developments in their
society, write complaints, post notices to society management.
The benefits of the project are given as follows:
Establish a connection between the users
Not only can maintenance bills be viewed and paid on the portal but also
provides transparency on how the treasury funds are being utilized in a
society
15
People by nature enjoy feeling wanted and appreciated; by making your property
the very best it can be for your residents, you are showing them that your team
values them and that you appreciate them that you care about their happiness.
Happy residents are much more likely to take care of their homes, are more likely to
remain in their leases longer, and are also much more likely to refer their friends
and acquaintances to your property. This all means a great reputation for your
apartment community and better business, as well.
3.
the application.
Bootstrap
is
the
most
popular
HTML,
CSS,
and
Apnacomplex https://www.apnacomplex.com/
Society123 http://www.society123.com/
1.8.2 Websites
Tutorial downloaded from http://www.lynda.com/
http://www.w3schools.com/ and solution to problems from
http://www.stackoverflow.com/
1.9 Methodology
This segment should elaborate the technical challenges and merits of the project
including the proposed solution that to the said problem. A project can be divided into
four major phases as follow:
17
18
LITERATURE REVIEW
CHAPTER 2
2 LITERATURE REVIEW
2.1 Introduction
19
The purpose of this document is to explain in detail every stage of this project from
the problem statement to the implementation phase. This Document is a final
report for graduation project course for the department of Computer Science
University
of
Karachi
in
Karachi.
Now a days web application is making life easy for people. Like ordering food,
getting location, path finding, booking your movie ticket etc. But there was no
mechanism for society portal in our city Karachi.
2.2 Methodology
In the previous paragraph we established that the intention of this work is to
show the potential benefits and implications to dedicate ourselves to creating this
beautiful Product, that helps Residents of the Neighbourhood Rise High, together.
This will be done by presenting a review of the most relevant information that can
be currently found by searching over the internet. Some limitations are necessary to
be established in order to properly fulfill this task.
First, the attention of this work was given to research that has directly been
done to develop elements of analysis regarding society portal methodologies.
And second, we will use the contents that will be reviewed by the team.
operation on the accounts and other services, i.e. to set notifications for users for
rental expenses and other services for the residents.
There will be different view for almost each operation performed by admin. An
administrator should also be able to log in to the web-portal where he/she can
administer the system by for instance editing apartments or user information.
2.4 Interactivity
Human Computer Interaction (HCI) is the process by which we humans
interact with computers or any other electronic media. Interaction can be done
using a variety of media. The most basic medium to interact with a computer is a
keyboard, or a mouse or both but with the advancement in the field of technology.
21
2.6 Benefits
The software acts as a network of housing society where residents can
communicate with each other on availability of vendors, maids, drivers etc
* Not only can maintenance bills be viewed and paid on the portal but also provides
transparency on how the treasury funds are being utilized in a society
* Beneficial for homeowners as they can keep a track of all the developments in
their society, write complaints, post notices to society management
* Manage property documents, parking lots, clubhouse fees, and CCTV viewing
* Instant online voting for or against any proposal for the society
2.8 Conclusion
The literature review done in this section provides a conclusive result that architecture is
ready for the 21st century. It just needs a proper make-over.
Based on the research we can say our crime reporting application is easy to use
are compare to others in the market.
22
RESEARCH METHODLOGY
23
CHAPTER 3
3 RESEARCH METHODLOGY
3.1 Introduction
The idea of this project hit us when we notice the residents and union presidents
are not synchronized with the budget of society and all are having quarrel among
them and with the presidents.
Beneficial for homeowners as they can keep a track of all the developments in their
society, write complaints, post notices to society management.
model.
Agile
software
development
is
group
of
software
the requirements have been established and prioritized, a more detailed timetable
will be determined.
For requirement elicitation and analysis we use the following technique:
25
risk
management
elements
are
risk
assessment
(identifying,
monitoring)
which
is
discuss
in
risk
mitigation,
monitoring
and
management.
3.5.2 Requirements Management
Initial requirements will be established but these requirements are subject to
change and must be monitored and managed. Managing requirements will
include capturing, tracking, and controlling requirements, as well as any
changes to them. This will establish and maintain a common understanding,
26
27
Probabilit
y
Low
Impac
t
High
RMMM
r1:Work complete out of date assign. Not
flow hand over date, City bad condition.
r2: Weekly check Scheduling if task complete
after due date.
r3: Remote access (internet), give more time.
Personnel (employee
relationship)
High
High
Resources
(Power, experience)
Medium
Mediu
m
Required Problem
(Not understood by
project manager,
employee and client)
Medium
High
Project complexity
and size
Medium
High
Implementation
28
Probabilit
y
High
Medium
Impac RMMM
t
High r1/r2: Mistake in designing phase. Not perfect
analyze of project.
r3: It can be management via third party
(teachers help) and also find liability in
analysis phase.
High r1/r2: Mistake in implementation phase. Not
accurate design of project.
r3: It can be management by using internet
resources and also find problem in design
phase.
Interface
Medium
High
Verification
Medium
High
Maintenance
Medium
High
Technology
Medium
High
29
Probabilit
y
Low
Medium
Impac RMMM
t
High r1:Not clearly define customer and market
needs.
r2: monitor system according to market
needs.
r3: Before starting complete search the scope
of product.
High r1:use for only specific purpose
r2: Do not full fill the needs of customer
r3: Add more feature to enhance product
High
High
Probabili
ty
Impact
High
Low
RMMM
Medium
Mediu
m
Low
High
System failures
High
Mediu
m
30
Medium
High
Medium
Mediu
m
High
High
Unrealistic delivery
date
Low
High
Medium
High
Low
Mediu
m
Medium
High
Medium
Mediu
m
High
High
Lack of documentation
Poor development
environment
31
32
DETAIL DESIGN
CHAPTER 4
33
4 Detail Design
4.1 System Architectural Design
4.1.1SYSTEM ARCHITECTURE
With the web application, the users will be able to find and use their utilities.
The result will be based on the criteria the user inputs. There are several
utilities and it will be possible for the administrator of the system to manage
the options for those criteria that have that.
Firstly the user has to be signup for the account which would be going to
administrator for the verification, next successfully verified now the user is
ready to login and go for the utilities.
The basic utility for the user is the payroll system, in which the user can
store its budget criteria and further depend on user.
4.1.2PORTAL ARCHITECTURE
The Portal Server hosts the User Interface (UI), part of the core
implementation of the portal. The UI handles incoming HTTP requests,
builds HTML responses, and returns the appropriate portal pages to each
client.
34
35
37
i)
User Screen
38
Login Screen
39
40
41
42
Payroll Preview
43
44
45
Notification Preview
46
Messages Preview
47
48
49
TESTING
CHAPTER 5
50
5 Testing
5.1 Unit Testing Snapshots
For testing we take many snapshots to show that we perform testing on it to
check notification, messages, new account approval and residents information is
occurring and is fine in use.
i)
Testing
The screen or preview shown in the previous chapter shows that the work is in
smooth flow.
Messages are occurring successfully.
Notification is based on respective residents by their respective admins.
Signup requirement approval is also shown.
Residents information can also be given when required this is also done in the
previous chapter.
51
52
6.1.1
A. Requirement Analysis
a.
Database modeling
b.
Project cost
c.
Design Admin modules
B. FTR to compile project module # 1 documentation
C. Present formal module # 1 documentation to project advisor
6.1.2
A.
53
B.
Program Design
a. Start date and due date of task
b. Define interface requirements
c. UX
C.
D.
6.1.3
A.
Requirement Analysis
a.Define client requirements
b.
Project status
c.JavaScript Logic scripting
B.
Program Design
a.
JavaScript logic scripting
C.
D.
E.
6.1.4
A.
a.
b.
c.
d.
e.
f.
g.
h.
i.
j.
54
k.
l.
m.
Billing
Project team
Project cost
B.
a.
b.
c.
d.
e.
f.
g.
h.
i.
j.
k.
l.
C.
a.
b.
c.
d.
e.
f.
g.
h.
D.
E.
6.1.5
A.
55
Error correction
a.
Meet with customer/Advisor to review/compile customer/Advisor
driven bug report
b. Compile internally generated bug report
c.
FTR to review complete bug report
d. Implement and test software corrections
e.
Release software corrections to customer
B.
Enhancements
a.
Meet with customer/Advisor to discuss requested feature
enhancements
b. FTR to review requested feature enhancements
c.
Implement and test feature enhancements
d. Release feature enhancements to customer
C.
Adaptation
a.
FTR to analyze market trends to detect possible future
incompatibilities
b. Meet with customer to discuss options regarding software upgrades
that will ensure future compatibility
c.
Implement and test required adaptations
56
Name
Type
Complexity
value
Logic Scripts
Collision detection
EI
EI
High
Average
6
4
Text Document
EI
low
EI
Average
Project Team
EI
Average
EI
Average
Project Cost
EI
Average
EI
High
User profile
EI
Average
Upcoming Event
EU
low
Show Priority
EU
High
History
EU
Average
EU
High
Reporting
EU
Average
Bug Tracking
EU
Average
Project Status
EU
Average
Billing
EU
Average
Time Tracking
EU
low
Something else
EQ
Average
Hullaballoo
EQ
Average
Client Communication
EQ
Average
Chat
EQ
low
ILF
Average
10
Daily Progress
EIF
Average
Searching
EIF
High
10
Task Reminder
EIF
Average
EIF
Average
57
303
Rate
System Complexity
1
2
3
4
3
3
4
5
6
7
8
I/O Complexity
What is the latency of the application?
3
What percentage of the information is entered online?
4
Was the application designed for end-user efficiency?
5
How many internal logical files are updated by the web
application?
5
9
10
11
12
13
14
Application Complexity
Does the application have extensive logical or math processing?
Was the application developed to meet one or many user needs?
How difficult is conversion and installation?
How effective/automated are startup, backup, and recovery?
Was the application designed for multiple sites/organizations?
Was the application designed to facilitate change?
3
5
1
5
5
5
56
58
6.3.1
Team Structure:
so
that
no
one
person
or
Programmers/logic scripting:
Programmers/logic scripting: Abdul Bari
The programming and logic is done for the movement of the camera, the
collision detection of the rooms and GUI programming.
UI/UX:
59
60
61
62
The main idea here regarding an online resident portal is that it makes residents happy.
When residents are happy, it makes managements jobs easier, which makes management
happy. A safe, happy and active neighborhood is something every tenant and manager
wants, and it is at the heart of a successful rental business.
People by nature enjoy feeling wanted and appreciated; by making your property the very
best it can be for your residents, you are showing them that your team values them and that
you appreciate them that you care about their happiness. Happy residents are much more
likely to take care of their homes, are more likely to remain in their leases longer, and are
also much more likely to refer their friends and acquaintances to your property. This all
means a great reputation for your apartment community and better business, as well.
Just as cities are getting smarter, one can't expect housing societies to continue in the old
fashioned way, like official news pasted on the notice board and other interesting trivia
spread through chitchat and gossip.
More and more housing societies in cities and towns are opting for online solutions to
manage their works. We were among the first to see business opportunity in the housing
society sector; now there are many more players offering ERP.
63
References:
[1] http://blogs.cornell.edu/gateshall/3dinteractive/
[2]http://www.ysu.edu/campusmap/
[3] http://campusmap.lsu.edu/map/framesetup.asp
[4] http://www.neduet.edu.pk/aboutus/tour/university_tour.html
[5] http://timesofindia.indiatimes.com/city/mumbai/Mumbai-housing-societies-go-hi-tech-withonline-community-portals/articleshow/42485287.cms
64
SOURCE CODE
CHAPTER 8
65
JS code files
Routes
Routes->collection.js
var express = require('express');
var router = express.Router();
var db=require('../DataBase/db');
router.get('/', function(req, res, next) {
res.render('col');
});
router.post('/',function(req,res,next){
});
module.exports = router;
Routes->dashboards.js
var express = require('express');
var router = express.Router();
var db=require("../DataBase/db");
var adminname;
router.post('/',function(req,res) {
console.log("dashboard");
var Login_detail = {
"U_Name": req.body.U_name,
"Password": req.body.P_word
};
console.log(req.body.U_name);
if(req.body.opt=="User"){
db.LoginUser(Login_detail)
66
.then(function(data){
if(data.length==0){
res.redirect("/");
}
else {
req.session.myUser=Login_detail.U_Name;
adminname=data[0].Admin_Name;
res.render('users');
}},function (errObj) {
console.log("inside request error");
res.send(errObj);
})
}
if(req.body.opt=="Admin") {
db.LoginAdmin(Login_detail)
.then(function (data) {
if (data.length == 0) {
res.redirect("/");
}
else {
req.session.myAdmin = Login_detail.U_Name;
db.Request(req.session.myAdmin).
then(function (data) {
console.log(data);
res.render('adminpp',{account:data});
//res.render('admindashboard',{messages:data,
username:Login_detail.U_Name})
}, function (errObj) {
console.log("inside request error");
res.send(errObj);
})
67
}
}, function (errObj) {
console.log("inside request error");
res.send(errObj);
})
}
});
router.get('/',function(req,res){
if(!req.session.myUser && !req.session.myAdmin){
res.send("Page Not Found");
}
else{
if(req.session.myAdmin){
db.Request(req.session.myAdmin).
then(function (data) {
console.log(req.session.myAdmin);
console.log(data);
res.render('adminpp',{account:data});
//res.render('admindashboard',{messages:data,
username:Login_detail.U_Name})
}, function (errObj) {
console.log("inside request error");
res.send(errObj);
})
}
else{
if(req.session.myUser)
res.render("users")
}
68
}
})
function Adminname(){
var a=adminname
return a;
}
router.admin_name = Adminname;
module.exports = router;
Routes->expense.js
var express=require('express');
var router=express.Router();
router.get('/',function(req,res){
res.render('exp');
});
module.exports=router;
Routes->index.js
var express = require('express');
var router = express.Router();
var db=require('../DataBase/db');
/* GET home page. */
router.get('/', function(req, res, next) {
//res.render('index', { title: 'Express' });
if(!req.session.myUser) {
res.render('index');
}
else{res.send("login already");}
});
69
router.post('/signout',function(req,res){
req.session.destroy();
});
router.get('/payroll',function(req,res){
res.render('payroll');
});
router.post('/expenses',function(req,res){
var expenseData={
Utility_Bill:req.body.utbll,
Other_Bill:req.body.otbll,
Salaries:req.body.salee,
Misc_Services:req.body.mchrgg,
Total:req.body.tulexx
};
db.Expenses(expenseData).
then(function(){
console.log("abcd");
res.send("successfully saved");
},function(errObj){
console.log("abc");
res.send(errObj);
})
});
router.post('/salaries',function(req,res){
var salariesData={
70
Employee_ID:req.body.empid,
Employee_Name:req.body.empn,
Salary_Month:req.body.samo,
Salary_Amount:req.body.samount
};
db.Salary(salariesData).
then(function(){
res.send("successfully saved");
},function(errObj){
res.send(errObj);
})
});
router.post('/funds',function(req,res){
var fundsData={
Apartment_ID:req.body.aptid,
Billing_Month:req.body.mont,
Paid_Cash:req.body.pdcash,
Due_Months:req.body.dum,
Due_Cash:req.body.dcash,
Balance:req.body.bal,
Total:req.body.tul
};
db.Funds(fundsData).
then(function(){
res.send("successfully saved");
},function(errObj){
res.send(errObj);
})
});
71
router.post('/requests',function(req,res){
if(req.session.myAdmin && req.body.approval=="accept"){
db.Approval_Requests(req.session.myAdmin).
then(function(data){
console.log(data);
res.send(data);
},function(errObj){
console.log(errObj)
res.send(errObj);
})
}
});
router.get('/Resident_Info',function(req,res){
if(req.session.myAdmin)
{
db.Resident_Info(req.session.myAdmin).
then(function(data){
console.log(data);
res.render("Resident_info",{info:data});
},function(errObj){
console.log(errObj);
res.send(errObj);
})
}
else{
res.render("error",{message:"404",error:"Page Not Found"});
}
});
72
var note="old";
router.post('/notification',function(req,res){
if(req.session.myAdmin){
var noti={
Subject:req.body.subject,
Text:req.body.text,
Admin_Name:req.session.myAdmin
}
db.Notifications(noti).
then(function(){
note="new";
res.send("success");
},function(errObj){
res.send(errObj);
})
}
})
router.post('/message',function(req,res){
if(req.session.myUser){
var mess={
To:req.body.to,
From:req.session.myUser,
Sub:req.body.sub,
Message:req.body.text
}
73
db.Message(mess).
then(function(){
console.log("successs");
res.send("success");
},function(errObj){
res.send(errObj);
})
}
else{
if(req.session.myAdmin){
var mess={
To:req.body.to,
From:req.session.myAdmin,
Sub:req.body.sub,
Message:req.body.text
}
db.Message(mess).
then(function(){
console.log("successs");
res.send("success");
},function(errObj){
res.send(errObj);
})
}
}
})
router.post('/view_message',function(req,res) {
if (req.session.myUser) {
db.View_Message(req.session.myUser).
74
then(function (data) {
console.log("succes");
res.send(data);
}, function (errObj) {
res.send(errObj);
})
}
else{
if(req.session.myAdmin){
db.View_Message(req.session.myAdmin).
then(function (data) {
console.log("succes");
res.send(data);
}, function (errObj) {
res.send(errObj);
})
}
}
})
router.get('/view_payroll',function(req,res){
if(req.session.myAdmin){
db.View_Expenses(req.session.myAdmin).
then(function (data) {
console.log(data);
res.send(data);
}, function (errObj) {
res.send(errObj);
})
}
})
75
router.post('/view_notification',function(req,res){
if(req.session.myUser){
db.View_Notification().
then(function(data){
data["note"]="old";
console.log("successs");
res.send(data);
},function(errObj){
res.send(errObj);
})
}
})
router.post('/view_message',function(req,res){
if(req.session.myUser){
db.View_Message().
then(function(data){
console.log("successs");
res.send(data);
},function(errObj){
res.send(errObj);
})
}
})
router.get('/apartment_info',function(req,res){
if(req.session.myAdmin){
res.render('apartmentinfo');
}
else{
76
router.post('/apartment_info',function(req,res){
if(req.session.myAdmin){
db.Apartment_Info(req.body.fno,req.session.myAdmin).
then(function(data){
if(data.length!=0)
{res.send(data);}
else{
res.send("no user")
}
},function(errObj){
res.send(errObj);
})
})
router.get('/information',function(req,res){
if(req.session.myUser){
db.Flat(req.session.myUser).
then(function(data){
db.Apartment_Info(data[0].Flat_No).
then(function(data){
res.render('ainfo',{info:data});
},function(errObj){
res.send(errObj);
})
77
},function(errObj){
res.send(errObj);
})
}
})
router.post('/approve',function(req,res){
console.log(req.body.User_Name);
console.log(req.body.response);
if(req.session.myAdmin){
db.Confirm(req.body.User_Name,req.body.response,req.session.myAdmin).
then(function(data){
res.render('ainfo',{info:data});
},function(errObj){
res.send(errObj);
})
}
})
module.exports = router;
Routes->live_streaming.js
var express = require('express');
var router = express.Router();
router.get('/', function(req, res, next) {
if(req.session.myUser){
res.render('live_streaming');
}
else{
res.render('signin');
}
});
78
module.exports = router;
Routes->salary.js
var express = require('express');
var router = express.Router();
var db=require('../DataBase/db');
router.post('/',function(req,res,next){
});
module.exports = router;
Routes->sign_up.js
var express = require('express');
var router = express.Router();
var db=require('../DataBase/db');
router.get('/' , function(req,res,next){
res.render('signup');
});
router.post('/', function(req,res){
if(req.body.opt=="User"){
var UserToSave= {
"Flat_No": req.body.Flno,
"Family_Members": req.body.Nom,
"User_Name": req.body.Uname,
79
"Password": req.body.Pass,
"Admin_Name":req.body.adname,
"status":"Required Approval"
}
db.SaveUser(UserToSave)
.then(function(){
res.send({status:"request send for approval"});
}, function(errObj){
res.send({status:false,err:errObj});
})
}
else{
if(req.body.opt=="Admin"){
var AdminToSave={
"Flat_No": req.body.Flno,
"Family_Members": req.body.Nom,
"User_Name": req.body.Uname,
"Password": req.body.Pass
}
db.SaveAdmin(AdminToSave)
.then(function(){
req.session.myAdmin=req.body.Uname;
res.redirect('/dashboard');
}, function(errObj){
res.send({status:false,err:errObj});
})
}
}
});
module.exports=router;
Routes->users.js
80
module.exports = router;
app.js
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session=require("express-session");
app.use(session({
secret: 'I dont have any secret',
resave: false,
saveUninitialized: true
}))
app.use('/', routes);
app.use('/users', users);
app.use('/dashboard',dash);
app.use('/sign_up',sign_up);
app.use('/salary',salary);
app.use('/expense',expense);
app.use('/collection',collection);
app.use('/live_streaming',live_streaming);
82
next(err);
});
// error handlers
module.exports = app;
db.js
var mongoose=require('mongoose');
var q= require ('q');
83
//var db=mongoose.connect("mongodb://localhost/FYP");
var
db=mongoose.connect("mongodb://sheikhbari:abc123@ds035663.mongolab.com:35663/fyp
");
var admin_check = require("../routes/dashboards.js");
var users=mongoose.model("users",{
Flat_No: String,
Family_Members: Number,
User_Name: String,
Password: String,
Admin_Name: String,
status: String
});
exports.SaveUser=function(user_info){
var deferred= q.defer();
var user=new users(user_info);
user.save(function(err,data){
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("USer Saved Successfully");
deferred.resolve();
}
});
return deferred.promise;
}
var admins=mongoose.model("admins",{
84
Flat_No: String,
Family_Members: Number,
User_Name: String,
Password: String
});
exports.SaveAdmin=function(admin_info){
var deferred= q.defer();
var admin=new admins(admin_info);
admin.save(function(err,data){
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("Admin Saved Successfully");
deferred.resolve();
}
});
return deferred.promise;
}
exports.LoginUser=function(user_info){
85
deferred.reject(err);
}
else{
console.log("successful");
//console.log(data);
deferred.resolve(data);
}
})
return deferred.promise;
}
exports.LoginAdmin=function(admin_info){
var deferred= q.defer();
admins.find({'User_Name': admin_info.U_Name,
'Password':admin_info.Password},function(err,data){
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("successful");
//console.log(data);
deferred.resolve(data);
}
})
return deferred.promise;
}
exports.Flat=function(user_info){
var deferred= q.defer();
users.find({'User_Name': user_info},function(err,data){
86
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("successful");
//console.log(data);
deferred.resolve(data);
}
})
return deferred.promise;
}
exports.Request=function(user){
console.log("inside request db");
var deferred= q.defer();
users.count({'status':"Required Approval",'Admin_Name':user},function(err,data){
if(err){
console.log(err);
deferred.reject(err);
}
else{
console.log(data);
deferred.resolve(data);
}});
return deferred.promise;
87
var expenses=mongoose.model("expenses",{
Utility_Bill: Number,
Other_Bill: Number,
Salaries: Number,
Misc_Services: Number,
Total: Number,
Date: {type:Date,default:Date.now()}
});
exports.Expenses=function(expense_data){
var deferred= q.defer();
var expense= new expenses(expense_data);
expense.save(function(err,data){
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("expense saved successfully");
deferred.resolve();
}
});
return deferred.promise;
}
exports.View_Expenses=function(admin){
var deferred= q.defer();
expenses.find({Admin_Name:admin},function(err,data){
if(err){
console.log(err);
deferred.reject();
88
}
else{
console.log("success");
deferred.resolve();
}
})
return deferred.promise;
}
var salaries=mongoose.model("salary",{
Employee_ID: String,
Employee_Name: String,
Salary_Month: String,
Salary_Amount: Number,
Date:{type:Date,default:Date.now()}
});
exports.Salary=function(salary_data){
var deferred= q.defer();
var salary=new salaries(salary_data);
salary.save(function(err,data){
if(err){
console.log("error");
deferred.reject();
}
else{
console.log("sucess");
deferred.resolve();
}
})
return deferred.promise;
89
var funds=mongoose.model("funds",{
Apartment_ID: String,
Billing_Month: String,
Paid_Cash: Number,
Due_Months: Number,
Due_Cash: Number,
Balance: Number,
Total: Number,
Date: {type:Date,default: Date.now()}
});
exports.Funds=function(funds_data){
var deferred= q.defer();
var fund=new funds(funds_data);
fund.save(function(err,data){
if(err){
console.log(err);
deferred.reject();
}
else{
console.log("success");
deferred.resolve();
}
})
return deferred.promise;
}
exports.Approval_Requests=function(admin_name){
var deferred= q.defer();
90
users.find({'status':"Required Approval",'Admin_Name':admin_name},function(err,data){
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("successful");
//console.log(data);
deferred.resolve(data);
}
})
return deferred.promise;
}
exports.Resident_Info=function(admin){
var deferred= q.defer();
//users.find({"User_Name":{$ne:"sheikhbari"}},function(err,data){
users.find({Admin_Name:admin},
{Flat_No:1,User_Name:1,Family_Members:1,_id:0},function(err,data){
if(err){
console.log(err);
deferred.reject(err);
}
else{
console.log(data);
deferred.resolve(data);
}
})
return deferred.promise;
}
91
var notification=mongoose.model("notification",{
Subject: String,
Text: String,
Admin_Name: String,
Date: {type:Date,default:Date.now()}
});
exports.Notifications=function(noti){
var deferred= q.defer();
var notif=new notification(noti);
notif.save(function(err,data){
if(err){
console.log(err);
deferred.reject();
}
else{
console.log("success");
deferred.resolve();
}
})
return deferred.promise;
}
var message=mongoose.model("messages",{
To: String,
From:String,
Sub: String,
Message: String,
Date: {type:Date,default:Date.now()}
});
exports.Message=function(mess){
92
exports.View_Notification=function(){
var deferred= q.defer();
var a=admin_check.admin_name();
//notification.findOne(function(err,data){
notification.findOne({Admin_Name:a},function(err,data){
if(err){
console.log(err);
deferred.reject(err);
}
else{
//console.log(data);
deferred.resolve(data);
}
}).sort({Date: -1})
var a=admin_check.admin_name();
return deferred.promise;
93
exports.View_Message=function(info){
var deferred= q.defer();
//my query
//db.messages.aggregate([{$group:{ _id: "$To", Message:{$push:"$Message"}}}])
message.find({'To':info},{'_id':0,'To':0,'__v':0},function(err,data){
if(err){
console.log(err);
deferred.reject(err);
}
else{
console.log(data);
deferred.resolve(data);
}
}).sort({Date:-1})
return deferred.promise;
}
exports.Apartment_Info=function(info,admin){
var deferred= q.defer();
funds.find({'Apartment_ID': info,Admin_Name:admin},
{'_id':0,'Apartment_ID':0,'__v':0,'Date':0},function(err,data){
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("successful");
deferred.resolve(data);
}
94
})
return deferred.promise;
}
exports.Confirm=function(username,status,admin){
var deferred= q.defer();
if(status=="accept"){
users.update({User_Name:username,Admin_Name:admin},{$set:
{status:"Approved"}},function(err,data){
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("successful");
deferred.resolve(data);
}
})
}
if(status=="discard"){
users.remove({User_Name:username},function(err,data){
if(err){
console.log("error");
console.log(err);
deferred.reject(err);
}
else{
console.log("successful");
deferred.resolve(data);
}
})
95
}
return deferred.promise;
}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Admin Panel</title>
96
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="/javascripts/myApp.js"></script>
<script>
var Confirm=0;
function values() {
Confirm = document.getElementById("toconfirm").textContent;
if(Confirm!=0){
document.getElementById("confirm_button").style.color="red";
}
}
function signout(){
xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","/signout", true);
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
string=xmlhttp.responseText;
}
}
xmlhttp.send();
97
function Notify(){
$.ajax({
type:"POST",
url:"/notification",
data:{subject:document.getElementById("subj").value,
text:document.getElementById("noti").value
},
success: function(){
document.getElementById("Noti_Close").click();
},
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 500) {
alert('Internal error: ' + jqXHR.responseText);
} else {
alert('Unexpected error.');
}
}
});
}
98
a=data.length;
console.log(a);
mydata=data;
console.log(mydata);
Approve(mydata);
},
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 500) {
alert('Internal error: ' + jqXHR.responseText);
} else {
alert('Unexpected error.');
}
}
})
}
else{
alert("no request to approve");
}
}
var i=0;
function Approve(info){
document.getElementById("nog").innerHTML="User Name:
"+info[i].User_Name+"<br>"+"Flat_No: "+info[i].Flat_No+"<br>"+"Family_Members:
"+info[i].Family_Members;
console.log(info[i].User_Name);
function Confirmation(con){
$.ajax({
type: "Post",
url: '/approve',
data: {response:con,
99
User_Name: mydata[i].User_Name
},
success: function (data) {
i=i+1;
a=a-1;
if(a!=0){
console.log(a);
Approve(mydata);
console.log(mydata);
}
else{
Confirm=0;
document.getElementById("confirm_button").style.color="";
$('#req').modal('hide');
}
},
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 500) {
alert('Internal error: ' + jqXHR.responseText);
} else {
alert('Unexpected error.');
}
}
})
}
</script>
</head>
100
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<!-- Hidden li included to remove active class from about link when scrolled up
past about section -->
<li class="hidden">
<a href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
<li class="dropdown">
<a href="#actions" class="page-scroll dropdown-toggle" datatoggle="dropdown" >Actions</a>
<ul class="dropdown-menu">
<li><a href="#">Apartment Status</a></li>
<li><a href="/payroll">Payroll</a></li>
<li><a href="#">Accounts Approval</a></li>
101
</li>-->
<li>
<a href="/" onclick="signout()">Sign Out</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
102
</a>
</div>
</div>
</div>
</div>
</header>-->
</p>
</div>
</div>
</p>
</div>
</div>
104
<h3>Accounts</h3>
<p>Approve residents accounts</p>
<p>
<a href="#req" class="btn btn-default" id="confirm_button" role="button" datatoggle="modal" onclick="Approval()" >
Approve
</a>
</p>
<div id="req" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ariahidden="true">×</button>
<h4 class="modal-title" id="nog1">Request</h4>
</div>
<div class="modal-body">
<p id="nog">No request To approve</p>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</div>
105
</div>
</p>
</div>
</div>
<br>
<br>
<br>
106
Notify
</a>
</p>
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ariahidden="true">×</button>
<h4 class="modal-title" id="nog">Send Notification</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" id="nog" for="subj">Subject:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="subj" name="subj" placeholder="Enter
subject">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" id="nog" for="noti">Notification:</label>
<div class="col-sm-10">
<textarea class="form-control" rows="5" id="noti" name="noti" placeholder="Write
something"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal"
id="Noti_Close">Close</button>
<button type="button" class="btn btn-default"
onclick="Notify()">Send</button>
107
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</p>
<div id="yModal" class="modal fade">
<div class="modal-dialog">
108
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ariahidden="true">×</button>
<h4 class="modal-title" id="nog">Send Message</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="to" id="nog">To:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="to" name="to" placeholder="Enter Id">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="subjm" id="nog">Subject:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="subjm" name="subjm"
placeholder="Enter subject">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="mess" id="nog">Message:</label>
<div class="col-sm-10">
<textarea class="form-control" rows="5" id="mess" name="mess" placeholder="Write
Message"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal"
id="mess_close">Close</button>
<button type="button" class="btn btn-default"
onclick="Message()">Send</button>
109
</div>
</form>
</div>
</div>
</div>
</div>
<div id="not" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ariahidden="true">×</button>
<h4 class="modal-title" id="nog3">New Message</h4>
</div>
<div class="modal-body" id="list">
<p id="nog2">Check out new messages from here</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" datadismiss="modal">Okay</button>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</section>
<!-- Contact Section -->
<section id="contact" class="container content-section text-center">
<div class="row">
110
111
<script src="/javascripts/js/jquery.js"></script>
<!-- Google Maps API Key - Use your own API key to enable the map feature. More
information on the Google Maps API can be found at https://developers.google.com/maps/
-->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?
key=AIzaSyCRngKslUGJTlibkQ3FkfTxj3Xss1UlZDA&sensor=false"></script>
<script src="/javascripts/myApp.js"></script>
</body>
</html>
apartmentinfo.ejs
<html>
<head>
<link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic"
rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet"
type="text/css">
<link href='/stylesheets/css/style.css' rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
function Apartment_Info() {
var fno = document.getElementById("fno").value;
$.ajax({
type: "post",
url: "/apartment_info",
data: {fno:fno},
success: function (data) {
if(data!="no user")
Table_create(data);
else{alert("no data available");}
},
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 500) {
alert('Internal error: ' + jqXHR.responseText);
} else {
alert('Unexpected error.');
}
}
})
}
function Table_create(infor){
document.getElementById("tablebody").innerHTML="";
var len=infor.length;
var table=document.getElementById("tablebody");
113
for(var i=0;i<len;i++){
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
var cell4 = row.insertCell(3);
var cell5 = row.insertCell(4);
var cell6 = row.insertCell(5);
cell1.innerHTML = infor[i].Billing_Month;
cell2.innerHTML = infor[i].Paid_Cash;
cell3.innerHTML = infor[i].Due_Months;
cell3.innerHTML = infor[i].Due_Cash;
cell3.innerHTML = infor[i].Balance;
cell3.innerHTML = infor[i].Total;
}
document.getElementById("table").removeAttribute("hidden");
</script>
</head>
<body>
<div class="container">
<label> Flat_Number:</label>
<input type="text" id="fno" name="fno">
<input type="button" value="Search" onclick="Apartment_Info()">
</div>
114
<tr>
<th>Billing Month</th>
<th>Paid Cash</th>
<th>Due Months</th>
<th>Due Cash</th>
<th>Balance</th>
<th>Total</th>
</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>
</div>
<script src="/javascripts/js/jquery.js"></script>
<!-- Google Maps API Key - Use your own API key to enable the map feature. More
information on the Google Maps API can be found at https://developers.google.com/maps/
-->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?
key=AIzaSyCRngKslUGJTlibkQ3FkfTxj3Xss1UlZDA&sensor=false"></script>
115
</body>
</html>
index.ejs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Apartment Portal</title>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
116
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<!-- Hidden li included to remove active class from about link when scrolled up
past about section -->
<li class="hidden">
<a href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
117
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
<ul class="dropdown-menu">
<li>payroll</li>
</ul>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
118
</header>
119
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" datadismiss="modal">Close</button>
<button type="submit" class="btn btn-default">Sign in</button>
</div>
</form>
</div>
</div>
</div>
</div>
120
</li>
<li>
<a href="#sumodal" class="btn btn-default btn-lg"role="button" datatoggle="modal"><span>Sign Up</span></a>
<div id="sumodal" class="modal fade">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ariahidden="true">×</button>
<h4 class="modal-title" id="nog">Sign Up</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form" action="/sign_up" method="post">
<div class="form-group">
<label class="control-label col-sm-2" id="nog" for="flno">Flat No:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="Flno" name="Flno" placeholder="Type
Flat number">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" id="nog" for="nod">No of Dependents:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="Nom" name="Nom" placeholder="Total
family members">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" id="nog" for="usnu">Username:</label>
<div class="col-sm-10">
121
</select>
122
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" datadismiss="modal">Close</button>
<button type="submit" class="btn btn-default">Sign up</button>
</div>
</form>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<br>
<div class="gallery-section">
<div class="container">
<div class="col-lg-8 col-lg-offset-2">
<h2>know about us</h2>
<p>View Gallery</p>
<a href="#" class="btn btn-default btn-lg">gallery</a>
</div>
</div>
</div>
</section>
123
</div>
</div>
</div>
<br>
<div class="tv-section">
<div class="container">
<div class="col-lg-8 col-lg-offset-2">
<h2>Watch Online TV!</h2>
<p>Through online Streaming</p>
<a href="live_streaming" class="btn btn-default btn-lg">Television</a>
</div>
</div>
</div>
<br>
<div class="chat-section">
<div class="container">
<div class="col-lg-8 col-lg-offset-2">
124
</div>
</div>
</div>
</section>
</section>
</body>
</html>
live_streaming
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
126
<title>television</title>
</head>
<body>
<body bgcolor="#000000" style="margin: 0px; padding: 0px;" leftmargin="0"
topmargin="0" marginheight="0" marginwidth="0">
<br>
<br>
<!-- Histats.com START (hidden counter)-->
<script type="text/javascript">document.write(unescape("%3Cscript src=
%27http://s10.histats.com/js15.js%27 type=%27text/javascript%27%3E%3C/script
%3E"));</script><script src="http://s10.histats.com/js15.js"
type="text/javascript"></script>
<a href="http://www.histats.com" target="_blank" title="html hit counter"><script
type="text/javascript">
127
try {Histats.start(1,1852587,4,0,0,0,"");
Histats.track_hits();} catch(err){};
</script>
<script type="text/javascript" language="JavaScript"
src="http://s4.histats.com/stats/0.php?
1852587&@f16&@g1&@h1&@i1&@j1436472636288&@k0&a
mp;@l1&@m&@n0&@ohttp%3A%2F%2Ffancystreams.com%2Ftvcat
%2Fnewstv.php&@q0&@r0&@s0&@ten-US&@u1366&@vhttp
%3A%2F%2Fwww.fancystreams.com%2Findexnews.html&@w">
</script>
</a>
<noscript><a href="http://www.histats.com" target="_blank"><img
src="http://sstatic1.histats.com/0.gif?1852587&101" alt="html hit counter"
border="0"></a></noscript>
<!-- Histats.com END -->
</div></body>
</body>
</html>
Payroll.ejs
<!DOCTYPE html>
<html lang="en">
<head>
<link
href='/stylesheets/css/bootstrap.min.css' rel="stylesheet">
128
<link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic"
rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet"
type="text/css">
<link href='/stylesheets/css/style.css' rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
function Expenses(){
var utbl=document.getElementById("utbl").value;
var otbl=document.getElementById("otbl").value;
var sale=document.getElementById("sale").value;
var mchrg=document.getElementById("mchrg").value;
var tulex=document.getElementById("tulex").value;
$.ajax({
type:"POST",
url:"/expenses",
data:{
utbll:utbl,
otbll:otbl,
salee:sale,
mchrgg:mchrg,
tulexx:tulex
},
success: function(abc){
alert(abc);
},
error:function(jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 500) {
alert('Internal error: ' + jqXHR.responseText);
} else {
alert('Unexpected error.');
}
129
}
});
}
function Funds(){
$.ajax({
type:"POST",
url:"/funds",
data:{
aptid:document.getElementById("aptid").value,
mont:document.getElementById("mont").value,
pdcash:document.getElementById("pdcash").value,
dum:document.getElementById("dum").value,
dcash:document.getElementById("dcash").value,
bal:document.getElementById("bal").value,
tul:document.getElementById("tul").value
},
success:function(response){
alert(response);
},
error:function(textstatus, errorThrown) {
alert('text status ' + textstatus + ', err ' + errorThrown);
}
});
}
function Salaries(){
$.ajax({
type:"POST",
url:"/salaries",
data:{
130
empid:document.getElementById("empid").value,
empn:document.getElementById("empn").value,
samo:document.getElementById("samo").value,
samount:document.getElementById("samount").value
},
success:function(){
alert("success");
},
error:function(jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 500) {
alert('Internal error: ' + jqXHR.responseText);
} else {
alert('Unexpected error.');
}
}
});
}
</script>
</head>
<body>
<h1
style="padding:20px;">PAYROLL</h1>
<hr>
<div class="container">
<h2 style="padding-top:20px;">expenses<p class="lead"></p></h2>
<div class="form-group">
<label class="col-sm-1" for="utbls">Utility Bills:</label>
131
<div class="form-group">
<div class="col-sm-6">
<input type="button" class="btn btn-info pull-left" onclick="Expenses()"
value="Submit"/>
</div>
</div>
</form>
<hr>
</div>
<div class="container">
<h2 style="padding-top:20px;">funds<p class="lead"></p></h2>
132
<div class="form-group">
<label class="col-sm-1" for="aptid">Apartment ID:</label>
<div class="col-sm-10"><input type="text" class="form-control" id="aptid"
name="aptid" placeholder="Type Apartment id"></div>
</div>
<div class="form-group">
<label class="col-sm-1" for="bilmo">Billing Month:</label>
<div class="col-sm-10"><select class="form-control" id="mont" name="mont"
placeholder="Select Month">
<option>Jan</option>
<option>Feb</option>
<option>Mar</option>
<option>Apr</option>
<option>May</option>
<option>Jun</option>
<option>Jul</option>
<option>Aug</option>
<option>Sep</option>
<option>Oct</option>
<option>Nov</option>
<option>Dec</option>
</select></div>
</div>
<div class="form-group">
<div class="col-sm-5"><label>Paid Cash:</label><input type="text" class="formcontrol" placeholder="Paid Cash" id="pdcash" name="pdcash">
</div>
<div class="col-sm-6"><label>Due Months:</label><select class="form-control"
id="dum" name="dum" placeholder="Number of Months">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
133
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select></div>
</div>
<div class="form-group">
<div class="col-sm-4"><label>Due Cash:</label><input type="text" class="formcontrol" placeholder="Due Cash" id="dcash" name="dcash"></div>
<div class="col-sm-3"><label>Balance:</label><input type="text" class="form-control"
placeholder="Balance" id="bal" name="bal"></div>
<div class="col-sm-6">
<input type="button" class="btn btn-success pull-left" value="Submit"
onclick="Funds()"/>
</div>
</div>
</form>
<hr>
</div>
<div class="container">
<h2 style="padding-top:20px;">salaries<p class="lead"></p></h2>
<form role="form" class="form-horizontal" id="salaries">
134
<div class="form-group">
<label class="col-sm-1" for="empl">Employee ID:</label>
<div class="col-sm-10"><input type="text" class="form-control" id="empid"
name="empid" placeholder="Type Employee id"></div>
</div>
<div class="form-group">
<label class="col-sm-1" for="emplnm">Employee Name:</label>
<div class="col-sm-10"><input type="text" class="form-control" id="empn"
name="empn" placeholder="Type Employee name"></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="samonth">Salary Month:</label><select
class="form-control" id="samo" name="samo" placeholder="Select Month">
<option>Jan</option>
<option>Feb</option>
<option>Mar</option>
<option>Apr</option>
<option>May</option>
<option>Jun</option>
<option>Jul</option>
<option>Aug</option>
<option>Sep</option>
<option>Oct</option>
<option>Nov</option>
<option>Dec</option>
</select></div>
<div class="col-sm-5"><label>Salary Amount:</label><input type="text" class="formcontrol" placeholder="Amount" id="samount" name="samount">
</div>
</div>
<div class="form-group">
135
<div class="col-sm-6">
<input type="button" class="btn btn-primary pull-left" value="Submit"
onclick="Salaries()"/>
</div>
</div>
</form>
<hr>
<a href="/view_payroll" class="btn btn-default" role="button" >
View
</a>
</div>
<footer>
<div class="container text-center">
<p>Copyright © Apartment Portal 2015</p>
</div>
</footer>
<!-- jQuery -->
<script src="/javascripts/js/jquery.js"></script>
<!-- Google Maps API Key - Use your own API key to enable the map feature. More
information on the Google Maps API can be found at https://developers.google.com/maps/
-->
136
Residents_info.ejs
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script
src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
window.onload=function() {
var data =<%- JSON.stringify(info) %>;
var len=data.length;
var table=document.getElementById("tablebody");
for(var i=0;i<len;i++){
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
cell1.innerHTML = data[i].User_Name;
cell2.innerHTML = data[i].Flat_No;
cell3.innerHTML = data[i].Family_Members;
}
137
</script>
</head>
<body>
<div class="container">
<table class="table table-striped" id="myTable">
<thead>
<tr>
<th>Username</th>
<th>Flat Number</th>
<th>Family Members</th>
</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>
</div>
</body>
</html>
signup.ejs
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sign up!</title>
<meta charset="utf-8">
138
</head>
<style type="text/css">
#bt{
margin-left: 50pt;
}
</style>
<body>
<div class="container">
<h2>Sign Up Here</h2>
<form class="form-horizontal" role="form" action="/sign_up" method="post">
139
140
<div class="form-group">
<label for="email" class="col-md-4 control-label">Email:</label>
<div class="col-md-8">
<input type="email" class="form-control" id="email" name="email"
placeholder="your email id">
</div>
</div>
</div>
<div class="col-sm-6 col-lg-4">
<div class="form-group">
<label for="Uname" class="col-md-4 control-label">User Name:</label>
<div class="col-md-8">
<input type="text" class="form-control" id="Uname" name="Uname"
placeholder="User name">
</div>
</div>
</div>
<div class="col-sm-6 col-lg-4">
<div class="form-group">
<label for="Pass" class="col-md-4 control-label">Password:</label>
<div class="col-md-8">
<input type="password" class="form-control" id="Pass" name="Pass"
placeholder="Password">
</div>
</div>
</div>
<div class="col-sm-6 col-lg-4">
<div class="form-group">
<label for="Cpass" class="col-md-4 control-label">Confirm Password:</label>
<div class="col-md-8">
<input type="password" class="form-control" id="Cpass" name="Cpass"
placeholder="Retype Password">
</div>
141
</div>
</div>
<div class="col-sm-6 col-md-3 col-lg-4">
<div class="form-group">
<div class="col-md-12">
<button type="submit" class="btn btn-primary" id="bt">Sign Up</button>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
users.ejs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>User</title>
142
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="/javascripts/myApp.js"></script>
<script>
function signout(){
xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","/signout", true);
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
string=xmlhttp.responseText;
}
}
xmlhttp.send();
}
143
function View_Notification(){
$.ajax({
type:"POST",
url:"/view_notification",
success:function(data){
console.log(data);
//console.log(document.getElementById("myLI").parentNode.nodeName;)
//alert(document.getElementById("nog").textContent);
document.getElementById("nog").innerHTML=data.Text;
document.getElementById("nog1").innerHTML=data.Subject;
},
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 500) {
alert('Internal error: ' + jqXHR.responseText);
} else {
alert('Unexpected error.');
}
}
})
}
</script>
</head>
144
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" datatarget=".navbar-main-collapse">
<i class="fa fa-bars"></i>
</button>
<a class="navbar-brand page-scroll" href="#page-top">
<i class="fa fa-user"></i> <span class="light">Welcome</span>
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<!-- Hidden li included to remove active class from about link when scrolled up
past about section -->
<li class="hidden">
<a href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact US</a>
</li>
<li class="dropdown">
<a href="#actions" class="page-scroll dropdown-toggle" datatoggle="dropdown" >Actions</a>
<ul class="dropdown-menu">
<li><a href="#">Account</a></li>
<li><a href="#">Notifications</a></li>
<li><a href="#">Messages</a></li>
<li><a href="/live_streaming">Television</a></li>
</ul>
</li>
<!--<li class="dropdown">
145
</li>-->
<li>
<a href="/" onclick="signout()">Sign Out</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
146
</p>
</div>
147
</div>
</p>
<div id="notif" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ariahidden="true">×</button>
<h4 class="modal-title" id="nog1">New Notification</h4>
</div>
<div class="modal-body">
<p id="nog">Check out new notifications from here</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" datadismiss="modal">Okay</button>
148
</div>
</div>
</div>
</div>
</div>
</div>
</p>
<div id="not" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ariahidden="true">×</button>
<h4 class="modal-title" id="nog3">New Message</h4>
</div>
149
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" datadismiss="modal">Okay</button>
</div>
</div>
</div>
</div>
<div id="send" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ariahidden="true">×</button>
<h4 class="modal-title" id="nog">message to admin</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="to" id="nog">To:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="to" name="to"
placeholder="Enter Id">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" id="nog" for="subj">Subject:</label>
<div class="col-sm-10">
150
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal"
id="mess_close">Close</button>
<button type="button" class="btn btn-default"
onclick="Message()">Send</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
151
<h3>Television</h3>
<p>Watch Online TV!</p>
<p>
<a href="/live_streaming" class="btn btn-default" role="button">
Television
</a>
</p>
</div>
</div>
<br>
<br>
<br>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="container content-section text-center">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<h2>Contact</h2>
<p>Feel free to email us to provide some feedback on our web, give us
suggestions for new amendments and updates</p>
152
</li>
<li>
<a href="#" class="btn btn-default btn-lg"><i class="fa fa-google-plus fafw"></i> <span class="network-name">Google+</span></a>
</li>
</ul>
</div>
</div>
</section>
<!-- Google Maps API Key - Use your own API key to enable the map feature. More
information on the Google Maps API can be found at https://developers.google.com/maps/
-->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?
key=AIzaSyCRngKslUGJTlibkQ3FkfTxj3Xss1UlZDA&sensor=false"></script>
153
</body>
</html>
154