Trying to build a Timesheet

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
jmacdougall
Posts: 29
Joined: 2015-11-02 01:22

Trying to build a Timesheet

Post by jmacdougall » 2020-12-11 02:39

I have a timesheet application I use for my small business and I am attempting to build my own. I would like to have a detail view where you can simply enter the hours plus minutes and have that save to the record. The minutes should automatically round up to the nearest 15 minutes. So if I enter "1" it will auto-add 15 minutes to the record. "16" minutes would add 30 minutes automatically. I would then like to have that show in the table view (See screenshots). I am trying to do this in baby steps. I am actually building a CRM/Helpdesk Ticket System/Vendor DB which is so far coming together but, now I want to add the Timesheet table to make it a total solution for my technicians, bookeeper and sys asmins to use daily.

AppGini is Awesome and I appreciate any help I can get. I am learning slowly but surely. :D
Attachments
timesheet_table.jpg
timesheet_table.jpg (89.1 KiB) Viewed 1650 times
timesheet_detail.jpg
timesheet_detail.jpg (108.03 KiB) Viewed 1650 times
Jeff MacDougall

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1709
Joined: 2018-04-01 10:12

Re: Trying to build a Timesheet

Post by pbottcher » 2020-12-11 07:06

Hi,

that sounds great, but what is your actual question? What did you try and what does not work?

for the minute issue you can the some js code to display it in the page directly like.

Code: Select all

minutes=15 * Math.ceil(minutes / 15) % 60;
hour = hour+Math.ceil((minutes-45) / 60);
hook that code an on change event on you minutes field and that would change your minutes.

if you do not want to have that on your entry (dv) page you can use the before_insert / before_update hook with some php code like:

Code: Select all

$data['YOURMINUTE']=ceil($data['YOURMINUTE'] / 15) * 15 % 60;
$data['YOURHOUR']=$data['YOURHOUR']+ceil($data['YOURHOUR']-45 / 60);
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply