如何显示休假余额 [英] How Do I Show Leave Balance

查看:90
本文介绍了如何显示休假余额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天

我正在为休假管理设计数据库

如果假设我正在请假,那么我应该在每次请求和所有请假时保存休假余额详细信息。

在单独的表中或

我应该计算它们动态和其他细节的余额。



哪个我是最好的方法,我应该保存请假详细信息,如平衡剩余的剩余假期,在一个单独的表中剩余的数量





我应该动态计算它们并显示。

Good Day
I am designing data base for leave management
if suppose i am taking a leave then should i save the leave balance on every request and all the leave details.
in separate table or
Should i calculate them leave balance dynamically and other details.

Which is the best approach should i save the leave details like balance how many leave are remaining how many are taken in a separate table

or
should i calculate them dynamically and show .

推荐答案

这两种方法都很好。但是我希望将它存储在数据库中,这样你就可以离线查看余额离开,而不必每次都上线。
Both are good approach. But I would prefer store it in database so that you can view the balance leaves offline also without going online every time.


休假余额是可导出的,取决于休假权利和请假,所以它应该由代码动态计算,它在数据库中没有位置。就像你的年龄一样,你需要存储出生日期而不是年龄随着年龄的变化而变化,并且可以从出生日期开始计算。
Leave balance is derivable and dependent on leave entitlement and leave applied, so it should be calculated dynamically by code, it has no place in the database. Just like your age, you need store date of birth but not age as age is changing and derivable from date of birth.


hi Suraj



离开管理在开始时听起来很复杂,但是如果你仔细观察,你会注意到它不是。现在休假管理应该与会计交易一样对待。在一年中,让我们说雇主给员工30天。现在,这30天没有立即获得,他们每月获得,12个月,它形成30天。所以现在在你的桌子上你应该有这样的字段





创建表Employee_Leave_Balance



Employee_Leave_Balance_id int Identity(1,1)主键,

User_id int, - 这是针对Employee的,因为他是我们系统中的用户,我们使用user_id,

Number_of_days十进制 - 这是因为,可能有半天申请,所以你需要迎合

Leave_Type_ID int,

Add_date datetime,

Leave_Status int





现在上表可以包含这样的数据





Emploee_Leave_Balance_id user_id Number_of_days Add_date

1 44 2.4

2 44 2.4

3 44 2.4

4 34 2.4

5 44 2.4

6 33 2.4

6 44 -4





现在上面的例子告诉你user_id 44累计天数以及之后他现在使用了4天,当您总结剩余天数时,您将得到他的最新余额。在这里,您可以拥有一个视图,该视图将根据user_id检索总余额。



这只是我的想法,你可以从中获取好处,让你自己的假期管理模块更好
hi Suraj

Leave Management sound complex in the beginning, but if you look closer you will notice it is not. Now Leave management should be treated the same as accounting transaction are treated. in a Year let us say the Employer gives an employee 30 days. Now these 30 days are not given instantly they get earned every month and for 12 months it form 30 days. So now in your table you should have fields like this


Create Table Employee_Leave_Balance
(
Employee_Leave_Balance_id int Identity(1,1) primary key,
User_id int ,--This is for the Employee , because he us a user in the system we use user_id,
Number_of_days decimal --This is because , there can be half day application so you need to cater
Leave_Type_ID int ,
Add_date datetime ,
Leave_Status int
)

Now the above table can contain data like this


Emploee_Leave_Balance_id user_id Number_of_days Add_date
1 44 2.4
2 44 2.4
3 44 2.4
4 34 2.4
5 44 2.4
6 33 2.4
6 44 -4


Now the above example tells you that user_id 44 accumulated days and later on he used 4 Days now when you sum the number of days remaining you will get his latest balance. Here you can have a view that will retrieve the total balance based on the user_id.

This is just my idea, you can just take what is good from it and make your own leave management module better


这篇关于如何显示休假余额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆