Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 48

Thread: Time Clock

  1. #11
    Hello
    I have reviewed the Additems link and still have no idea how to update the treegrid with the cursor data i get from the sql statement i run after the badge information is entered.
    Is it possible to get an example of the code required to do this. I want to list the LP.Tiem and LP.Type information in the grid.

    proc page1_section1_field5_lostfocus()
    // insert your code here
    m_fsf="LostFocus"
    close databases all
    open database butchery shared
    use vt_employee
    select fname,lname from VT_Employee where VT_Employee.badge=m_badge into cursor emp
    m_empname=alltrim(Emp.Fname)+ " "+Alltrim(EMP.Lname)
    Lianja.get("Page1.section1.field7").Refresh() // EMployee Name field
    TimeClockPunchUpdate()
    // use vt_localpunch
    // select * from VT_LocalPunch where vt_LocalPunch.Badge=m_badge and ttod(VT_LocalPunch.Datetime)=Date() into cursor LP
    // select lp
    // go bottom in lp
    //// scatter name m_cett
    // m_cett=lp.type
    close database butchery
    endproc


    // Opon the Employee Time Clock Puch File(s) to view and update
    proc TimeClockPunchUpdate()
    //close databases all
    //open database butchery shared
    use vt_localpunch in 0
    select substr(ttoc(vt_LocalPunch.datetime),12,11) as time,Type from VT_LocalPunch where vt_LocalPunch.Badge=m_badge and ttod(VT_LocalPunch.Datetime)=Date() order by datetime desc into cursor LP
    m_cett=lp.type
    close database butchery
    ////////////////////////////////////////////////////////////////
    // Event delegate for 'interactivechange' event

  2. #12
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,088
    Blog Entries
    22
    Iím afraid to say that code is so incorrect in many ways that it cannot just be edited to achieve what you want to achieve. Itís wildly over complicated and requires a complete rethink.

    1. using the lostfocus event is incorrect. You should be using the change event which was mentioned earlier.

    2. you cannot use memory variables in a sql statement that will be executed in the VFP oledb driver as those variables do not exist in VFP

    3. the additems() method of a treegrid can be used to execute a sql select statement that populates the grid.

    I will put a small app together for you that does what you want and you can study it.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #13
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,088
    Blog Entries
    22
    Install and run the attached package.

    It shows you how to do it.

    Click image for larger version. 

Name:	Screen Shot 2023-09-28 at 1.20.23 PM.jpg 
Views:	59 
Size:	102.2 KB 
ID:	3069
    Attached Files Attached Files
    Last edited by barrymavin; 2023-09-28 at 12:27.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #14
    Hello

    Thank you for the help. i have the grid and employee name fields updating properly now. can i extend the Fieldx.Additems Select statement to change the order in the grid ? I would also like to use the select with an additional table. When i try to sdd Order by 1 Desc i get an error.
    field6.addItems("select substr(ttoc(vt_LocalPunch.datetime),12,11),;
    Type from Butchery!VT_LocalPunch;
    where ttod(Datetime)=Date() and Badge='"+field5.text+"'" order by 1 descending)

  5. #15
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,088
    Blog Entries
    22
    You can try and test all your sql select statements in the console.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #16
    Hello
    I am testing the select code in the console and the order does not to change.

    select datetime as Time,Type from Butchery!VT_LocalPunch where ttod(Datetime)=Date() and Badge=m_badge order by time desc
    Result:
    TIME TYPE

    09/29/2023 09:48:15 AM 1
    09/29/2023 10:50:39 AM 3
    09/29/2023 10:51:44 AM 1

    3 records selected in <1ms

    select datetime as Time,Type from Butchery!VT_LocalPunch where ttod(Datetime)=Date() and Badge=m_badge order by time asc

    Result:
    TIME TYPE

    09/29/2023 09:48:15 AM 1
    09/29/2023 10:50:39 AM 3
    09/29/2023 10:51:44 AM 1

    3 records selected in 31ms

    The order function works on the "TYPE" field

  7. #17
    I found my mistake. All set on the Ordering of the items.

  8. #18
    Hello

    Is there any way to access the data in a tree grid that i fill with the following:

    fields(6).addItems("select substr(ttoc(vt_LocalPunch.datetime),12,11) as Time,VT_TimeType.Label,Type from Butchery!VT_LocalPunch Inner Join Butchery!VT_TimeType on VT_LocalPunch.Type = VT_TimeType.Type where vt_LocalPunch.Badge='"+fields(5).text+"' and ttod(Datetime)=Date() order by datetime desc")

    I would like to get the Type value for the top record in the grid ?

  9. #19
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,088
    Blog Entries
    22
    Use the item() method

    item(nRow, nCol)
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  10. #20
    Hello

    Is there a way to check for Lastkey() ?

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us