Integrated Information System FOR Heavy Water Board: Dissertation Submitted To
Integrated Information System FOR Heavy Water Board: Dissertation Submitted To
Integrated Information System FOR Heavy Water Board: Dissertation Submitted To
FOR
HEAVY WATER BOARD
Dissertation submitted to
COMPUTER ENGINEERING
By
B. KAVYA (15054-CP-011)
MAY-NOVEMBER 2018
1
ELECTRONICS CORPORATION OF INDIA LIMITED
(A Government of India Enterprise)
E-mail : [email protected]
CERTIFICATE
This is to certify that the project report on “INTEGRATED INFORMATION
SYSTEM FOR HEAVY WATER BOARD” is being done by B. KAVYA
(15054-CP-011) in partial fulfillment for the award of SPECIAL DIPLOMA IN
ELECLTRONICS WITH SPECIALIZATION IN COMPUTER
PROGRAMMING from GOVERNMENT INSTITUTE OF ELECTRONICS.
This work is carried out under my guidance and supervision.
She is sincere and hardworking and has shown great zeal of enthusiasm in group
participation and practical aspects. Her conduct has been good during the course of
project in “ELECTRONICS CORPORATION OF INDIA LIMITED”,
HYDERABAD.
2
GOVERNMENT INSTITUTE OF ELECTRONICS
EASTMARREDPALLY,
Secunderabad-500 026,
TELANGANA, INDIA.
__________________________________________________________
CERTIFICATE
Certified further that to the best of our knowledge the work presented in this thesis
has not been submitted to any other College / Institute for the award of any Degree
or Diploma.
3
ACKNOWLEDGEMENT
It is our privilege to express our gratitude and respect to all those who guided,
inspired and helped us in the completion of this project.
We express our Sincere Gratitude to Shri CH. VENU MADHAV, S.M, CR&D,
ECIL and Smt. Sabahat Fatima, S.T.O, CR&D, ECIL who guided and
encouraged us in every step till the successful completion of our project.
B. KAVYA
15054-CP-011
4
ORGANIZATION PROFILE
ECIL was setup under the Department of Atomic Energy on 11th April, 1967 with
a view to generate a strong indigenous capability in the field of professional grade
electronics. The initial accent was on total self-reliance and ECIL was engaged in
the Design, Development, Manufacture and Marketing of several products with
emphasis on three technology lines viz. Computers, Control Systems and
Communications.
Over the years, ECIL pioneered the development of various complex electronic
products without any external technological help and scored several 'firsts' in
these fields prominent among them being country's
First Digital Computer
First Solid State TV
First Control & Instrumentation for Nuclear Power Plants
First Earth Station Antenna
First Computerized Operator Information System
First Radiation Monitoring & Detection Systems
First Automatic Message Switching Systems
First Operation & Maintenance Center For E-108 Exchange
First Programmable Logic Controller
First Solid State Cockpit Voice Recorder
First Electronic Voting Machines
The company played a very significant role in the training and growth of high
caliber technical and managerial manpower especially in the fields of Computers
5
and Information Technology. Though the initial thrust was on meeting
the Control & Instrumentation requirements of the Nuclear Power Program, the
expanded scope of self-reliance pursued by ECIL enabled the company to develop
various products to cater to the needs of Defence, Civil Aviation, Information &
Broadcasting, Telecommunications, Insurance, Banking, Police, and Para-Military
Forces, Oil & Gas, Power, Space Education, Health, Agriculture, Steel and Coal
sectors and various user departments in the Government domain. ECIL thus
evolved as a multi-product company serving multiple sectors of Indian economy
with emphasis on import of country substitution and development of products &
services that are of economic and strategic significance to the country.
Vision
Mission
ECIL's mission is to consolidate its status as a valued national asset in the area of
strategic electronics with specific focus on Atomic Energy, Defence, Security and
such critical sectors of strategic national importance.
Objectives
To continue services to the country's needs for the peaceful uses Atomic
Energy. Special and Strategic requirements of Defence and Space,
Electronics Security Systems and Support for Civil Aviation sector.
6
and Explosive Detectors.
To explore new avenues of business and work for growth in strategic sectors
in addition to working for realizing technological solutions for the benefit of
society in areas like Agriculture, Education, Health, Power, Transportation,
Food, Disaster Management etc.
To strengthen the technology base, enhance skill base and ensure succession
planning in the company.
To consciously work for finding export markets for the company's products.
7
ABSTRACT
by the HWB and financial accounting functions in Heavy Water Plants and
Maintenance Management
Stores Inventory
8
Table of Contents
CHAPTER 1 ............................................................................................................12
INTRODUCTION .............................................................................. 12
Objective of Integrated Information System: ..................................................................................... 12
Scope: .................................................................................................................................................. 12
CHAPTER 2 ............................................................................................................15
CHAPTER 3 ............................................................................................................18
CHAPTER 4 ............................................................................................................22
9
PHP – Variable Types .......................................................................................................................... 24
CHAPTER 5 ............................................................................................................26
CHAPTER 6 ............................................................................................................32
Input .................................................................................................................................................... 32
Processing ........................................................................................................................................... 32
Output ................................................................................................................................................. 32
Test Cases............................................................................................................................................ 39
REFERENCES ................................................................................... 75
10
List of Figures
CHAPTER 1 ...........................................................................................................12
CHAPTER 2 ...........................................................................................................15
Fig 2.1 Process Flow Diagram – Leave and Attendance Processing ......................16
CHAPTER 3 ...........................................................................................................18
CHAPTER 4 ...........................................................................................................22
CHAPTER 5 ...........................................................................................................26
CHAPTER 6 ...........................................................................................................32
11
CHAPTER 1
INTRODUCTION
(Central Office) at Mumbai and Heavy Water Plants at Baroda, Kota, Manuguru,
Scope:
Integrated Information System for HWB (IIS-HWB) is being established in HWB
by the HWB and financial accounting functions in Heavy Water Plants and
Corporate Office of HWB with Open source platform (PHP, RHEL, PostgreSQL
12
Block diagram of IIS-HWB
HWB Main Server and Backup Server is LAPP (Linux Apache PostgreSQL PHP)
Platform. There are 7 Plants of HWB which are connected to HWB Main Server
13
IIS-HWB Project Software Architecture
IIS-HWB has 3-tier architecture. Database Server, Web Server and Client Tier.
A Client typically a web browser sends a request for a resource to the web server
and the web server collects the information from the database server and sends
back a response corresponding to the resource.
14
CHAPTER 2
APPLICATION SOFTWARE
DB Programming : Pl/PgSQL
15
IIS-HWB Software Block Diagram
16
Hardware and Software Resources
Main Servers : 02
Rack : 02
UPS : 02
KVM Switch : 02
RHEL : 02
Hardware Specifications
Main Server Specs:
Rack Model
2 * Intel Xeon Gold 6148 Processor 64 bit 20 core @ 2.40 GHz or
better 27 MB cache
Intel Mother Board with built in RAID 0/1 support for SAS drives
256 GB RAM (32 GB * 8) DDR4 2666 MHz. Registered ECC
expandable to 512 GB
2*1 TB SAS hot-plug drives, scope for adding 2 more drives.
6 * 1.8 TB SAS hot-plug drives, scope for adding 2 more drives.
A separate RAID controller for SAS supporting RAID 1+0, 5 and 6.
2* Dual port gigabit ethernet card, at least two ports supporting
SAS/iSCSI connectivity
Certified for Latest Redhat Server Edition
Hot Plug and Redundant Power Supply
DVD r/w drive
17
CHAPTER 3
DATABASE DESCRIPTION
Introduction to PostgreSQL
PostgreSQL supports a large part of the SQL standard and offers many modern
features including the following:
18
Views
Transactions
Multiversion concurrency control (MVCC)
Streaming Replication (as of 9.0)
Hot Standby (as of 9.0)
PostgreSQL can be extended by the user in many ways. For example by adding
new:
Data types
Functions
Operators
Aggregate functions
Index methods
PostgreSQL Functions
19
can interact directly with stored procedures instead of a middle-tier or duplicating
code. Functions can be created in a language of choice like SQL, PL/pgSQL, C,
Python, etc.
Syntax
The basic syntax to create a function is as follows-
Where,
function-name specifies the name of the function.
[OR REPLACE] option allows modifying an existing function.
The function must contain a return statement.
20
RETURN clause specifies that data type to return from the function.
The return_datatype can be a base, composite, or domain type, or
can reference
the type of a table column.
function-body contains the executable part.
The AS keyword is used for creating a standalone function.
Plpgsql is the name of the language that the function is implemented
in. Here, we Use this option for PostgreSQL, it can be SQL, C,
internal, or the name of a user defined Procedural language. For
backward compatibility, the name can be enclosed by single quotes.
21
CHAPTER 4
PHP DESCRIPTION
PHP started out as a small open source project that evolved as more and more
people found out how useful it was. Rasmus Lerdorf unleashed the first
version of PHP way back in 1994.
Introduction to PHP
22
PHP is forgiving: PHP language tries to be as forgiving as possible.
PHP Syntax is C-Like.
23
PHP – Variable Types
Here are the most important things to know about variables in PHP.
All variables in PHP are denoted with a leading dollar sign ($).
The value of a variable is the value of its most recent assignment.
Variables are assigned with the = operator, with the variable on the
left-hand side and the expression to be evaluated on the right.
Variables can, but do not need, to be declared before assignment.
Variables in PHP do not have intrinsic types - a variable does not
know in advance whether it will be used to store a number or a string
of characters.
Variables used before they are assigned have default values.
PHP does a good job of automatically converting types from one to
another when necessary.
PHP variables are Perl-like.
PHP – Datatypes
PHP has a total of eight data types which we use to construct our variables:
Integers: are whole numbers, without a decimal point, like 4195.
Doubles: are floating-point numbers, like 3.14159 or 49.1.
Booleans: have only two possible values either true or false.
NULL: is a special type that only has one value: NULL.
24
Strings: are sequences of characters, like 'PHP supports string operations.
Arrays: are named and indexed collections of other values.
Objects: are instances of programmer-defined classes, which can package
up both other kinds of values and functions that are specific to the class.
The first five are simple types, and the next two (arrays and objects) are
compound – the compound types can package up other arbitrary values of
arbitrary type, whereas the simple types cannot.
25
CHAPTER 5
MODULE DESCRIPTION
26
Project Monitoring is used to check the status of all projects which are
undertaken by HWB and Heavy Water Plants
28
Ascertainment of result of above recorded transactions: accountant
prepares profit and loss account to know the result of business operations for
a particular period of time. If expenses exceed revenue then it is said that the
business is running under loss. The profit and loss account helps the
management and different stakeholders in taking rational decisions. For
example, if business is not proved to be remunerative or profitable, the cause
of such a state of affairs can be investigated by the management for taking
remedial steps.
29
provides information and ensures the use of such information by
management to assess project effects – both intentional and unintentional –
and their impact. It aims at determining whether or not the intended project
goals and objectives are being on the track.
30
Data flow Diagram
31
CHAPTER 6
Pre-Conditions to Calculate OT
Employee Master Data should be available.
Shift Master Data should be available.
Overtime and Undertime is calculated for current attendance month.
Overtime hours worked will be considered if >= 1 hour prior to shift or
after the shift.
Input
Enter required attendance date
Enter Overtime or Undertime Reasons.
Click on Apply
Processing
Get Employee Details by Employee No..
Get Swipe Details of entered attendance date.
Calculate Work Hours of each day of current attendance month
Add Overtime hours, if Overtime is >=1 and < 4 hours.
Add Half day C-Off, if Overtime >= 4 hours and <= 8 hours.
Add Full day C-Off, If Overtime >= 8 hours.
Undertime is calculated when Work hours is less than Shift hours
If Overtime or Undertime exists, then Approving authority is assigned
Output
After clicking on apply button the Overtime and Undertime is forwarded to
his approving authority for approval.
32
Design of Over Time and Undertime Calculation Program
33
Fig 6.2 Employee Overtime/Undertime with Swipe Data
34
Fig 6.3 Attendance OT/UT Approval
35
Fig 6.4 Attendance OT/UT Approval with Employee Data
36
Functionality Description
Input
Click on Approve
Processing
Output
37
Flowchart of Over Time and Undertime Calculation Program
The processing of inputs and generation of the output is as per the following
flowchart.
38
Test Cases
Test Case Test Case Prerequisites Test Exec Expected Actual Reference
No Description Procedure uted results Results to Defect
By Report Id
( for
failed
cases
alone)
1. Browser must be
HWB_STC Start the Available. 1. Enter * Heavy Water
_M10_01 "Login Page 2. HWB Server should be "http://local Board Login
of HWB" connected host" in Screen must be
Application. 3. Web server must be in Browser. opened.
running mode. 4. 2. Enter Couldn't
Database Server should be User connect to
in running mode. Credentials HWB with
5. Employee/ and "HWB
Recommending Database
Officer/Approving 3. Click on Server IP
Officer/Sanctioning Officer “Login address" error
must be available with Button”. message will
validity be displayed if
39
HWB Server
was not
connected.
HWB_STC Open This web page should be Click * Attendance
_M10_02 Attendance accessed by HWB Sites “Attendance Module must
Module only for the authorized user Module” be opened
1. Login user should be 1. Enter
HWB_STC Open IIS- from establishment section. Login * If the
_M10_03_ HWB Login 2. Employee Master data details validation is
1 Screen should be available 2. Click on successful
“Login Employee is
Button”. logged in
successfully.
HWB_STC Open Time Time Office Data Upload Click “Time * Time Office
_M10_03_ Office Data Screen must be accessed by Office Data Data Upload
2 Upload HWPs and HWB for Upload” Screen must be
Screen authorized users menu. opened.
HWB_STC Data Upload Time Office Data Upload Select * The
_M10_03_ Screen must be accessed by Swipe Data Attendance
3 HWPs and HWB file to Data file will
upload to be uploaded.
HWB
Server Message “File
Uploaded
Successfully!”i
s displayed
40
HWB_STC Validate Data Time Office Data Upload Don’t select * An error
_M10_03_ Upload file Screen must be accessed by any file to message "No
4 HWPs and HWB upload. file selected.
Click Please select
"Upload" file!!” must be
Button. displayed.
Employee Master and 1. Enter
HWB_STC Open IIS- Reporting Officer data Login * If the
_M10_04_ HWB Login should be available. details validation is
1 Screen 2. Click on successful
“Login Employee is
Button”. logged in
successfully.
HWB_STC Open Employee master and Click on Based on the
_M10_04_ Employee Employee OT/UT data “Apply logged in
2 Overtime/Un must be available OT/UT” Employee,
dertime Employee
screen name and
Employee No.
will be
displayed
HWB_STC Get Employee OT and UT data Enter * Swipe in time,
_M10_04_ Overtime/Un must be available required Swipe out time
3 dertime attendance and OT/UT
details date to view must be
OT/UT displayed.
41
HWB_STC Apply Employee OT and UT data 1. Enter * Employee
_M10_04_ Overtime/Un must be available Reason for Overtime or
4 dertime OT/UT Undertime is
screen applied.
2. Click
“Apply”
button
1. Employees, having the 1. Enter
HWB_STC Open IIS- role of leave Login * If the
_M10_05_ HWB Login recommendation. details validation is
1 Screen 2. Click on successful
“Login” Employee is
Button. logged in
successfully.
HWB_STC Open OT/UT Employee master and Click on OT/UT
_M10_05_ Approval Employee OT/UT data “Approve Approval
2 Menu must be available OT/UT” screen must be
menu displayed
1. Reporting Employees
HWB_STC Employee data should be available. Select * Employee No.,
_M10_05_ OT/ UT 2. Reporting Employees Reporting Employee
3 Approval should apply for OT/UT. Employee swipe details
Screen No. and OT/UT
with reasons
must be
displayed.
42
1. Reporting Employees
HWB_STC Select data should be available. 1. Select * Employee
_M10_05_ Employee for desired Overtime or
4 approval 2. Reporting Employees OT/UT for Undertime is
should apply for OT/UT. approval approved and
regularized.
2. Click
“Approve”
button
HWB_STC Close OT/UT OT/UT approval Screen Click * HWB Login
_M10_05_ approval must be active "Logout" web page will
5 Screen Button be displayed.
43
Integration Test Cases
Test Case Test Case Prerequisites Test Procedure Execu Expected Actua Reference to
No Descripti ted By results l Defect Report
on Result Id ( for failed
s cases alone)
1. Browser must be
HWB_ITC Start the Available. 1. Enter * Heavy Water
_M10_01 "Login 2. HWB Server should be "http://localhost Board Login
Page of connected " in Browser. Screen must
HWB" 3. Web server must be in be opened.
Applicatio 2. Enter User
running mode. Credentials and Couldn't
n. 4. Database Server should connect to
be in running mode. 3. Click on HWB with
5. Employee/ “Login Button”. "HWB
Recommending Database
Officer/Approving Server IP
Officer/Sanctioning address" error
Officer must be available message will
with validity be displayed
if HWB
Server was
not
connected.
HWB_ITC Open This web page should be Click * Attendance
_M10_02 Attendanc accessed by HWB Sites “Attendance Module must
e Module only for the authorized Module” be opened
44
user
1. Login user should be 1. Enter Login
HWB_ITC Open IIS- from establishment details * If the
_M10_03_ HWB section. 2. Click on validation is
1 Login 2. Employee Master data “Login Button”. successful
Screen should be available Employee is
logged in
successfully.
HWB_ITC Open Time Office Data Upload Click “Time * Time Office
_M10_03_ Time Screen must be accessed Office Data Data Upload
2 Office by HWPs and HWB for Upload” menu. Screen must
Data authorized users be opened.
Upload
Screen
HWB_ITC Data Time Office Data Upload Select Swipe * The
_M10_03_ Upload Screen must be accessed Data file to Attendance
3 by HWPs and HWB upload to HWB Data file will
Server be uploaded.
Message
“File
Uploaded
Successfully!
”is displayed
45
HWB_ITC Validate Time Office Data Upload Don’t select any * An error
_M10_03_ Data Screen must be accessed file to upload. message "No
4 Upload by HWPs and HWB Click "Upload" file selected.
file Button. Please select
file!!” must
be displayed.
Employee Master and 1. Enter Login
HWB_ITC Open IIS- Reporting Officer data details * If the
_M10_04_ HWB should be available. 2. Click on validation is
1 Login “Login Button”. successful
Screen Employee is
logged in
successfully.
HWB_ITC Open Employee master and Click on “Apply Based on the
_M10_04_ Employee Employee OT/UT data OT/UT” logged in
2 Overtime/ must be available Employee,
Undertime Employee
screen name and
Employee
No. will be
displayed
HWB_ITC Get Employee OT and UT Enter required * Swipe in
_M10_04_ Overtime/ data must be available attendance date time, Swipe
3 Undertime to view OT/UT out time and
details OT/UT must
be displayed.
46
HWB_ITC Apply Employee OT and UT 1. Enter Reason * Employee
_M10_04_ Overtime/ data must be available for OT/UT Overtime or
4 Undertime Undertime is
screen 2. Click applied.
“Apply” button
1. Employees, having the 1. Enter Login
HWB_ITC Open IIS- role of leave details * If the
_M10_05_ HWB recommendation. 2. Click on validation is
1 Login 2. Employee Master & “Login Button”. successful
Screen Reporting officer data Employee is
should be available logged in
successfully.
HWB_ITC OT/UT Employee master and Click on OT/UT
_M10_05_ Approval Employee OT/UT data “Approve Approval
2 Menu must be available OT/UT” menu screen must
be displayed
1. Reporting Employees
HWB_ITC Employee data should be available. Select * Employee
_M10_05_ OT/ UT 2. Reporting Employees Reporting No.,
3 Approval should apply for OT/UT. Employee No. Employee
Screen swipe details
and OT/UT
must be
displayed.
HWB_ITC Select Applied OT and UT data 1. Select desired * Employee
_M10_05_ Employee of an Employee must be OT/UT for Overtime is
4 for available approval approved.
47
approval
2. Click
“Approve”
button
HWB_ITC Close OT/UT approval Screen Click "Logout" * HWB Login
_M10_05_ OT/UT must be active Button web page will
5 approval be displayed.
Screen
48
Unit Test Cases
Test Test Case Prerequisites Test Procedure Ex Expected Actual Results Referen
Case Description ecu results ce to
No ted Defect
By Report
Id ( for
failed
cases
alone)
1. Browser must be
HWB_ Start the "Login Available. 1. Enter * Heavy Water
UTC_M Page of HWB" 2. HWB Server "http://localhost Board Login
10_01 Application. should be connected " in Browser. Screen must
3. Web server must be opened.
2. Enter User
be in running mode. Credentials and Couldn't
4. Database Server connect to
should be in 3. Click on HWB with
running mode. “Login Button”. "HWB
5. Employee/ Database
Recommending Server IP
Officer/Approving address" error
Officer/Sanctioning message will
Officer must be be displayed
available with if HWB
validity Server was
49
not
connected.
HWB_ Open Time Office Time Office Data Click “Time * Time Office
UTC_M Data Upload Upload Screen must Office Data Data Upload
10_03_ Screen be accessed by Upload” menu. Screen must
2 HWPs and HWB be opened.
for authorized users
50
HWB_ Data Upload Time Office Data Select Swipe * The
UTC_M Upload Screen must Data file to Attendance
10_03_ be accessed by upload to HWB Data file will
3 HWPs and HWB Server be uploaded.
Message
“File
Uploaded
Successfully!
”is displayed
Employee Master 1. Enter Login
HWB_ Open IIS-HWB and Reporting details * If the
UTC_M Login Screen Officer data should 2. Click on validation is
10_04_ be available. “Login Button”. successful
1 Employee is
logged in
successfully.
HWB_ Open Employee Employee master Click on “Apply Based on the
UTC_M Overtime/Undertim and Employee OT/UT” logged in
10_04_ e screen OT/UT data must Employee,
2 be available Employee
name and
Employee
No. will be
displayed
51
HWB_ Get Employee OT and Enter required * Swipe in
UTC_M Overtime/Undertim UT data must be attendance date time, Swipe
10_04_ e details available to view OT/UT out time and
3 OT/UT must
be displayed.
HWB_ Validate Swipe date must be Enter required * Attendance
UTC_M Attendance Date available in data attendance date date must be
10_04_ base YYYY-MM-
4 DD format. It
should not
accept
characters.
Based on the
HWB_ Employee Employee master logged in Employee
UTC_M Overtime/Undertim and Employee Employee, Name and
10_04_ e screen OT/UT data must his/her name Employee
5 be available and Employee Number must
No. will be be displayed
displayed
HWB_ Apply Employee OT and 1. Enter Reason * Employee
UTC_M Overtime/Undertim UT data must be for OT/UT Overtime or
10_04_ e screen available Undertime is
4 2. Click applied.
“Apply” button
HWB_ Validate Reason Reason Description Enter Reason * Reason can
UTC_M must be available in for OT/UT be of 50
52
10_04_ database characters.
5
1. Employees, 1. Enter Login
HWB_ Open IIS-HWB having the role of details * If the
UTC_M Login Screen leave 2. Click on validation is
10_05_ recommendation. “Login Button”. successful
1 2. Employee Master Employee is
& Reporting officer logged in
data should be successfully.
available
HWB_ OT/UT Approval Employee master Click on OT/UT
UTC_M Menu and Employee “Approve Approval
10_05_ OT/UT data must OT/UT” menu screen must
2 be available be displayed
1. Reporting
HWB_ Employee OT/ UT Employees data Select * Employee
UTC_M Approval Screen should be available. Reporting No.,
10_05_ 2. Reporting Employee No. Employee
3 Employees should swipe details
apply for OT/UT. and OT/UT
must be
displayed.
HWB_ Select Employee Applied OT and UT 1. Select desired * Employee
UTC_M for approval data of an OT/UT for Overtime is
10_05_ Employee must be approval approved.
4 available
2. Click
53
“Approve”
button
54
PostgreSQL Functions for Overtime and Undertime
RETURNS boolean AS $$
DECLARE
max_overtime numeric(4,2) := 6.00;
min_overtime numeric(4,2) := 1.00;
max_balance numeric(3,0) := 120;
min_adjusted_ot_ut numeric := 0 ;
no_ot_ut numeric(1,0) := 0;
ot_ut_not_applied numeric(1,0) := 1;
ot_approved numeric(1,0) := 3;
ut_coff_approved numeric(1,0) := 3;
gap_reason_undertime numeric(2,0) := 1;
gap_reason_overtime numeric(2,0) := 2;
no_coff numeric(1,0) := 0;
min_ot_hrs numeric(4,2) := 1.0;
min_coff_hrs numeric(4,2) := 4.00;
coff_halfday numeric(2,1) := 0.5;
max_coff_hrs numeric(4,2) := 8.00;
coff_fullday numeric(2,1) := 1.0;
coff_approved numeric(1,0) := 6;
BEGIN
-- Roll back
55
UPDATE iismasterdb.att_ot_ut_dtl SET work_hours= 0.0, overtime
= 0.0, undertime = 0.0, balance_120min = 120, approving_auth = 0,
ot_status = no_ot_ut, ut_status = no_ot_ut ,coff_status = 0.0,
modified_userid = param_modified_userid, modified_timestamp =
current_timestamp ,reason_code = null WHERE (ot_status <=
ot_ut_not_applied or ut_status <= ot_ut_not_applied) and (ot_status <
ot_approved or ut_status < ut_coff_approved ) and
site_code=param_site_code and (in_time between
param_shift_start_time and param_shift_end_time) and (out_time
between param_shift_start_time and param_shift_end_time);
56
param_shift_end_time) and (out_time between param_shift_start_time
and param_shift_end_time) and site_code = param_site_code;
-- CALCULATION OF OVERTIME
57
-- CALCULATION OF UNDERTIME
58
UPDATE iismasterdb.att_ot_ut_dtl set undertime = shift_hours -
(to_number(extract(hours from ( shift_end_time))|| '.' || extract(minute
from (shift_end_time )),'09d99') - (to_number(extract(hours from (
in_time))|| '.' || extract(minute from (in_time
)),'09d99')),modified_userid = param_modified_userid,
modified_timestamp = current_timestamp WHERE (work_hours <
shift_hours or work_hours > shift_hours) and (in_time between
param_shift_start_time and param_shift_end_time) and (out_time
between param_shift_start_time and param_shift_end_time) and
in_time > shift_start_time and (out_time > shift_end_time or
out_time < shift_end_time ) and site_code = param_site_code;
--CALCULATION OF WORK_HRS_MINUS_LUNCH
--UPDATION OF OT STATUS
59
gap_reason_overtime WHERE overtime > 0 and (in_time between
param_shift_start_time and param_shift_end_time) and (out_time
between param_shift_start_time and param_shift_end_time) and
site_code = param_site_code;
--UPDATION OF UT STATUS
60
between param_shift_start_time and param_shift_end_time) and
site_code = param_site_code;
RETURN true;
END;
62
PostgreSQL Functions for Overtime and Undertime Accumulation
RETURNS BOOLEAN AS $$
DECLARE
min_ot_hrs numeric(4,2) := 1.0;
max_ot_hrs numeric(4,2) := 3.59;
min_coff_hrs numeric(4,2) := 4.00;
coff_halfday numeric(2,1) := 0.5;
max_coff_hrs numeric(4,2) := 8.00;
coff_fullday numeric(2,1) := 1.0;
no_ot_ut numeric(1,0) := 0;
ot_ut_not_applied numeric(1,0) := 1;
ot_approved numeric(1,0) := 3;
ut_coff_approved numeric(1,0) := 3;
coff_approved numeric(1,0) := 6;
BEGIN
--ROLLBACK
63
=param_modified_userid,modified_timestamp=current_timestamprea
son_code = null WHERE (ot_status <= ot_ut_not_applied or
ut_status <= ot_ut_not_applied) and(ot_status < ot_approved or
ut_status < ut_coff_approved ) and (in_time between
param_shift_start_time and param_shift_end_time) and (out_time
between param_shift_start_time and param_shift_end_time) and
site_code = param_site_code ;
64
(month from param_shift_start_time) and pert_year = extract (year
from param_shift_start_time);
RETURN true;
END;
66
PostgreSQL Functions for Applying Overtime and Undertime
RETURNS BOOLEAN AS $$
DECLARE
ot_ut_applied numeric(1,0) := 2;
gap_reason_ot numeric(2,0) := 2;
BEGIN
else
67
UPDATE iismasterdb.att_ot_ut_dtl SET ut_status = ot_ut_applied ,
end if;
RETURN TRUE;
END;
68
PostgreSQL Functions for Approval of Overtime and Undertime
RETURNS BOOLEAN AS $$
DECLARE
gap_reason_ot numeric(2,0) := 2;
BEGIN
--param_ot_ut_status should 3 or 4
69
param_shift_end_time) and (out_time between param_shift_start_time
and param_shift_end_time) and site_code = param_site_code;
else
end if;
RETURN TRUE;
END;
70
PostgreSQL Functions for Applying C-Off
DECLARE
coff_applied numeric(1,0) := 5;
min_coff_hrs NUMERIC(4,2) := 4.00;
coff_halfday numeric(2,1) := 0.5;
max_coff_hrs NUMERIC(4,2) := 8.00;
coff_fullday numeric(2,1) := 1.0;
BEGIN
71
PostgreSQL Functions for Approval of C-Off
RETURNS BOOLEAN AS $$
DECLARE
coff_approved numeric(1,0) := 6;
BEGIN
RETURN TRUE;
END;
72
PostgreSQL Functions for C-Off Accumulation
RETURNS BOOLEAN AS $$
BEGIN
RETURN TRUE;
END;
73
CONCLUSION
74
REFERENCES
http://www.w3schools.org
http://www.php.net
http://www.tutorialspoint.com - POSTGRESQL
Mehdi Achour
Friedhelm Betz
Antony Dovgal
75