Programmatically controlling the "balance" of time (sick / vacation)

I use Python / Django, but it's more about the “data model” and how I interact with the information - I really just want to know if I'm crazy here.

I am working on a small application in my company (~ 55 employees) that will track the available vacation time / time. Part of the goal is to integrate self-service into our intranet so that employees can send Time Requests electronically instead of filling out and submitting the document to HR.

Obviously, this application should maintain the current balance for one employee and will verify that the employee has enough leave remaining for everything that they request.

As with financial / accounting software, I know that I don't have to store floating point values ​​or just keep one working balance.

My idea is to use the database table structure, for example, to store "credits" and "debits":

Employee | Year | Credit/Debit | Amount | Timestamp

“Year” is the year to which the credit / debit relates, since holidays and sick time are processed on an annual basis, and not on the current balance per employee.

To determine which employees are available for vacation / time, I get "transactions" for the employee for the given year and find the balance.

, , : ,, , ?

+3
4

, , . / , , .

"" " ", ( ) , .

ID | | |

ID | | | |

, . , ( ), , , ).

" ", Transactions.ID, , , , , ..

+2

. :

  • , . , , / ?

  • , ? , , - . , (, ), , , ... , . , , . . ? , , , ?

0

.

/. HR, .

If HR is removed from the image (which I doubt, but perhaps), then there is no need to do this; The application can track requests and leave a balance and immediately say whether the request is valid or not. But I suspect it can't be that simple. :)

0
source
How have getting balance Debit-Credit for  running balamace ACCESS DATABASE
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*"%>
<%@ page import="java.util.Calendar" %>
<%
//java Code
String date = (new java.util.Date()).toString();
String UserName = request.getParameter("UserName");
String CusId= request.getParameter("CusId");
String AccountNo = request.getParameter("AccountNo");
String Debit = request.getParameter("Debit");
String Credit=request.getParameter("Credit");
String Balance=request.getParameter("Balance");
String sDate=request.getParameter("sDate");
try
{
String s="jdbc:odbc:Database1";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(s);
Statement smt=conn.createStatement();
Calendar calendar = Calendar.getInstance();
java.sql.Date startDate = new java.sql.Date(calendar.getTime().getTime());
String sql= "SELECT  sDate, (SUM(Debit)*-1) + SUM(Credit)Balance FROM abcbank GROUP BY  sDate";
ResultSet result = smt.executeQuery(sql);
int count = 0;
while (result.next())
{
result.getString(1,"Debit");
result.getString(2,"Credit");
result.getString(3,"Balance");
result.getDate(4,startDate);

}

String update= "UPDATE abcbank SET Balance =Debit + Balance   WHERE AccountNo="+AccountNo+" ";
PreparedStatement statement = conn.prepareStatement(update);
//statement.setString(1,"AccountNo");
int rowsUpdated = statement.executeUpdate();
if (rowsUpdated ==0)
{
out.println("This Emp does not Exists!");
}
else if(rowsUpdated ==1)
{
out.println("An existing user was updated successfully!");
}
conn.close();
}
catch(Exception ex)
{
System.err.println(ex.getMessage());
  }

%>
</body>
</html>
0
source

Source: https://habr.com/ru/post/1761939/


All Articles