Home » Developer & Programmer » Forms » Insert Tags (Windows XP)
Insert Tags [message #502083] |
Mon, 04 April 2011 03:22 |
|
adeelali
Messages: 10 Registered: April 2011 Location: Pakistan
|
Junior Member |
|
|
I have created on procedure about Inserting Tags
This tags work as Attednance of employees
For example tag 1 show present tag 2 show week off and others..
So, I have probelm in to insert tags
---------------------------------------------------
insert_tags(p_emp_id, p_dt_attn, 4);
---------------------------------------------------
Where I am using 4 there i want to use variable because tags will increase due to
some holidays or other type
For Example Not Aplicable or Others.
So, tell me please how to insert tags into table
with using variable where i use no 4 numeric word...
My Procedure Is ...
---------------------------------------------------------------------------------------
PROCEDURE set_tags(
p_emp_id in number,
p_dt_attn date
) IS
mwof boolean;
mleave boolean;
msuspend boolean;
V_Time_In boolean;
V_Time_Out boolean;
mact_shift number;
msch_shift number;
V_LEAVE_ID NUMBER;
begin
delete from emp_tags where dt_attend = p_dt_attn and emp_id = p_emp_id;
-- get defined Scheduled shift
begin
--get_ghd(emp_cd, p_dt_attn);
mwof := get_week(p_emp_id, p_dt_attn);
mleave := get_leave(p_emp_id, p_dt_attn);
msuspend := get_suspend(p_emp_id, p_dt_attn);
V_Time_In := Get_Time_In(p_emp_id, p_dt_attn);
V_Time_Out := Get_Time_Out(p_emp_id, p_dt_attn);
If -- FOR TIME IN CHECK ..
V_Time_In = True then
insert_tags(p_emp_id, p_dt_attn, 1);
If
mwof = true then
insert_tags(p_emp_id, p_dt_attn, 2);
end if;
If
mleave = true then
IF
V_LEAVE_ID = 1 THEN
insert_tags(p_emp_id, p_dt_attn, 4);
ELSIF
V_LEAVE_ID = 2 THEN
insert_tags(p_emp_id, p_dt_attn, 5);
END IF;
End if;
Elsif -- FOR CHECK TIME OUT If TIME In NULL
V_TIME_IN = false then
If
V_TIME_OUT = FALSE then
If
mwof = true then
insert_tags(p_emp_id, p_dt_attn, 2);
Elsif
mleave = true then
select leave_id into V_LEAVE_ID FROM SET_LEAVE_DETAIL
WHERE P_DT_ATTN BETWEEN DT_FROM AND DT_TO AND EMP_ID = P_EMP_ID;
IF
V_LEAVE_ID = 1 THEN
insert_tags(p_emp_id, p_dt_attn, 4);
ELSIF
V_LEAVE_ID = 2 THEN
insert_tags(p_emp_id, p_dt_attn, 5);
END IF;
ELSIF
msuspend = true then
insert_tags(p_emp_id, p_dt_attn, 8);
Else
insert_tags(p_emp_id, p_dt_attn, 6);
End if;
ELSIF
V_TIME_OUT = true then
insert_tags(p_emp_id, p_dt_attn, 3);
End If;
End if;
-- prs
begin
select act_shift, sch_shift into mact_shift, msch_shift from time_attm where emp_id = p_emp_id and dt_attend = p_dt_attn;
If mact_shift != msch_shift then
insert_tags(p_emp_id, p_dt_attn, 7);
end if;
exception
when no_data_found then
null;
end;
end;
exception
when no_data_found then null;
when others then message(' Error Set_Tags :' || sqlerrm);
end;
---------------------------------------------------------------------------------------
There iS V_TIME_IN & V_TIME_OUT Is Function which get boolean
if Time In or Out exists then return true
if Time In or Out not exists time then return false
and Insert_tags is procedure ...
where i insert data into detail table
procedure is
---------------------------------------------------------------------------------------
PROCEDURE insert_tags (p_emp_id in number, p_dt_attn in date, p_ord in number) IS
BEGIN
insert into emp_tags
(emp_id, dt_attend, tag_id)
values
(p_emp_id, p_dt_attn, p_ord);
END;
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
I hope u can solve my problem..
I have attached this file..
kindly enclosed the attach..
Thanks & Regards
Syed Adeel Ali
CM: changed colour tags to code tags. Please use [code] tags in future - see the orafaq forum guide if you're not sure how.
-
Attachment: sma1.fmb
(Size: 152.00KB, Downloaded 961 times)
[Updated on: Mon, 04 April 2011 03:32] by Moderator Report message to a moderator
|
|
|
|
|
Re: Insert Tags [message #502092 is a reply to message #502083] |
Mon, 04 April 2011 04:44 |
|
adeelali
Messages: 10 Registered: April 2011 Location: Pakistan
|
Junior Member |
|
|
Dear I am using oracle form 6i and I have developed one program of time office means daily attendance of employee. I have created many tables.
These names are
Set_Wof (This is for employee week off. This table has 2 columns 1st Employee ID and 2nd Date). If employee has week off on any date then we insert data into this table for week off's of employees.
For Example Employee has week off on 04-APR-2011 and his/her Employee Id = 1
Set_Leave (This table works as a master table of leave or leave type)
Set_Leave_Deatail (This table works as a detail table of leave in this table we insert employee those are on leave (paid leave or unpaid leave)
For Example (Employee has leave on '24-APR-2011' and his/her Employee ID = 3)
Then we insert data into Set_Leave_detail table for leave of employees.
Set_Suspend (if any employees suspend from company for few days then those employees
Data Insert into this table with date (Start Date and End Date of Suspend).
Set_Tags (This is a master table of Tags in this table we insert types of tags)
(Tag ID, Description, Abbreviation, order by, check type).
Values
(Auto, PRESENT, PRS, 1, 1)
(There is check type use for paid or unpaid days if 1 then paid or if 0 then unpaid)
Emp_Tags (This is a detail table of tags because in this table we insert employees for attendance
Emp_Tags has 3 columns (1 Employee ID, 2 Date, 3 Tag ID)
This is detail of my tables ...
Now my problem is that when I increase tags or increase data into master table of tag
(Set_Tags) then I change my program
insert_tags(p_emp_id, p_dt_attn, 1);
I want to insert tags into detail table from this query
But I don't want to change my program due to increasing of tags into master table ..
This is happen when I wrote
If
mwof = true then
insert_tags(p_emp_id, p_dt_attn, 2);
end if;
this is my Constraint just because of my programming style .
I have issue in
If
mleave = true then
IF
V_LEAVE_ID = 1 THEN
insert_tags(p_emp_id, p_dt_attn, 4);
ELSIF
V_LEAVE_ID = 2 THEN
insert_tags(p_emp_id, p_dt_attn, 5);
END IF;
And
IF V_TIME_OUT = true then
insert_tags(p_emp_id, p_dt_attn, 3);
end if;
[Updated on: Mon, 04 April 2011 04:46] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Thu Sep 19 22:56:36 CDT 2024
|