We want to create a hardware device which allows employees to punch in and out of work using a RFID reader which stores the information in ERPNext.
Problem:
Most of our users are not salaried but get paid by the hour. Currently the information about work times is recorded outside of ERPNext using a RFID tracker that writes to a SQL database and has closed source software for the analytics.
Solution:
We will create a hardware device which will read an RFID tag and allow our employees to punch in an out which will call our ERPNext API. All data will be stored in ERPNext. The project itself will be completely open source so people can DIY or they might eventually be able to buy pre-fabricated devices with RFID chips from us if there is enough interest in this thing.
The prototype hardware will consist of an Arduino Uno, a simple display and 3 buttons (come, go, info), a buzzer and a Mifare RFID reader (RC522).
Basic function description:
User presents RFID-tag to device and presses green “come” button. Device calls ERPNext API passing the RFID tag id. ERPNext logs come and returns employee name, employee number, start date, start time.
User works his shift
When user goes into break or leaves work he presses the red “go” button. Device calls ERPNext API passing the RFID tag ID. ERPNext logs go and returns employee name, employee number, start date, start time, work time.
If user wants to know how many hours he has worked this month he can press the grey “info” button. It will give him his hours today and his ours this month.
Todo:
We will develop the hardware, create BOM and schematics on how to assemble this
The devices’ software will have to be written
Make changes to ERPNext employee DocType to store RFID Tag
Create or modify DocType to store information (see Questions below)
Implement API
Questions:
How will we store the actual time logs start / stop and how will we analyze it? There are timesheets which are more to track specific actions instead of overall work time. Also there is employee attendance but that tracks only the days which employees were present.
we have a similar topic, where we have extended the attendence module to not only cover present on a day or not, but actual working hours; also using a sign in/out. Maybe this would be the way to go in your case as well… (actual time tracking is done on timesheet, but not all time present is actually done in projects)
Hello,
I did same for biomatrix
using attendance doctype add one child table for time logs in attendance doctype and add one custom field for total hours.
make three api’s
1)For In Punch:
when employee come and punch in then one entry add in time logs for IN.
2)For Out Punch:
when employee punch for out then update child table row that have last In punch and calculate OutTime-InTime=Total Hours
(Total Hours is update only when out punched)
3)For Total Hours Today&Month:
pass date today and make api which give today total hours from “total_hours” field and current month “total hours” sum of “total_hours” field from all document of current month.
Working first prototype with Arduino Uno, LCD Display, RFID RC5522 Kit and a few resistors and buttons. It currently waits for the start button (left) or stop button (right), then gives the user 3 seconds to present the RFID tag. If tag presented it reads it.
Next step will be API calls to ERPNext to get the employee info for the tag and to make start and stop calls. I will also add a buzzer to give an audible signal on button press and RFID tag read.
Hi All, here are a few notes from our testing and our design suggestion:
In the current design in ERPNext, here is how we should do it.
We have to setup “Salary Structure” to set per Hour rate of hourly employees.
When employee Punches IN first for the day, it will create “Timesheet” record with first line Item. It will put entry in “From Time”, leaving the “To Time” empty. When it punches “Go” then it will log the “To Time” of the first line. We will create multiple lines in one timesheet basing from how many times the employee time in and out.
For the Info Button, it will just calculate the tentative time for the day and the summation of all submitted timesheet in the current month.
at the end of the month or at the end of a salary cycle, accounting personnel can create Salary Slip basing from all the timesheet it created and calculate total amount from the Salary Structure set rate
As for the current “Attendance” doctype in ERPNext, it will only log if employee is present or not regardless of the time it consumed. So once a timesheet is submitted by end of shift, it will create an entry to Attendance tagging employee as present.
This is okay but there are concerns that we need to raise:
If the attendance time is track in Timesheet and the employee tracks an Activity within his attendance duration, then this is a duplicate.
Timesheet can be manipulated unless restricted through permission.
The hardware is designed, circuit boards and all components have been purchased for 10 prototypes and will arrive here on Thursday.
We are also designing and 3D prining the casing as we speak.
I expect the boards to be finished this Friday.
We are now writing the firmware for the embedded system in C++.
What’s needed now is the ERPNext side of things. I would really appreciate some input and ideas on how to do it right. We need to get this going.
If anyone is interested in a device please write me an email. I would give away 5 of the first boards for manufacturing cost so we can test it and optimize it together.
Attendance: Maybe we can have a new doctype called “Employee Checkin” (Employee, Location, Timestamp) that can log an employee at a location multiple times. At the end of the day we can run a scheduled script to mark in-time and out-time in Attendance (min and max)
Hourly Payroll: I like @creamdory’s idea to a weekly or monthly timesheet from checkins (with each shift in the line item) and link it to payroll. So before going to payroll there, someone can verify the total hours etc. This can automatically be created from the checkins.
I think the timesheets (what billable or non billable thing did they do specifically) and the attendance (when were thy present) are two things. I also think that it should maybe go the other way that we pay per attendance and a time sheet could create attendance.
Instead of employee checkin what about attendance log?
Currently option to link Payroll to timesheets already exists and if option to link Payroll to attendance is required then that can be built. I think that is a feature many need. Payroll can feed off attendance data to get the number of working days and use it as an input to Payroll. There could be complications of half-day etc, in this method that would need to be factored into the payroll design.
I agree on Attendance Log and taking min(in-time) and max(out-time) to create the final attendance record which would serve as an input to payroll. HR settings or setting at company level should dictate what is the input for payroll.
Timesheet creating attendance is not a good idea, because timesheets are sometimes entered just to bill customers & are not related to attendance. So having payroll based on timesheet or payroll based on attendance should be mutually exclusive in my opinion.
@Pawan thanks for your thoughts. So here is my assessment and suggested Design.
Create new child doctype in Attendance called Attendance Log. This is the doctype Rushabh is referring to “Employee Checkin”. Fields will be:
Location
Time In
Time Out
Duration
In HR Setting > Payroll Section, add field “Salary Slip Based On” with select options “Timesheet” and “Attendance Log”. Max working hours against Timesheet will show only for “Timesheet”.
In Salary Structure, add checkbox “Salary Slip Based on Attendance Log”. We can have this auto populated based on the HR setting.
Add new Doctype Attendance Log Validate. It will have the fields below:
Employee Link
Date From
Date To
Table which will be autopopulated with all the attendance logs base on the date duration.
User will be allowed to edit this for Salary Slip purposes. This will be the information pulled in the Salary Slip for payment.
Edit script for these changes.
If this is okay, we can proceed with the development.