0

Timecard employees

Hi, I have two employees, the first works 8 hour per day monday to friday (simple), the second works 4 hour per day except Wednesday that works 8 hours. So I need a function that will create the correct record for every employees with the right working time. Thanks in advance.

Alberto

4 replies

null
    • Mconneen
    • 4 yrs ago
    • Reported - view

    @Alberto,

    Here is one approach ... Create an Employee table... with composite table of Timecard.   On the Employee.. also create their “default work schedule”.

     

    And the code behind the button...

    • Mconneen
    • 4 yrs ago
    • Reported - view

    hmm.. Images not posting like they used to.. :(

    • Mconneen
    • 4 yrs ago
    • Reported - view

    double hmmmm..   Well.. here is the code behind the button ..

    let t := this;
    let msg := “Week Starting Date must be a Sunday”;
    if weekday(t.“Week Starting Date”) = 6 then
    let tc := first(t.Timecard[“Week Starting Date” = t.“Week Starting Date”]);
    if tc then
    msg := “Timecard already exists”
    else
    let tc := (create Timecard);
    tc.(Employee := t);
    tc.(“Week Starting Date” := t.“Week Starting Date”);
    tc.(Sun := t.Sun);
    tc.(Mon := t.Mon);
    tc.(Tue := t.Tue);
    tc.(Wed := t.Wed);
    tc.(Thu := t.Thu);
    tc.(Fri := t.Fri);
    tc.(Sat := t.Sat);
    msg := “Timecard created”
    end
    end;
    alert(msg)

    • MENOZZI_srl
    • 4 yrs ago
    • Reported - view

    Thanks Mconneen! I will try

Content aside

  • 4 yrs agoLast active
  • 4Replies
  • 544Views