cobisja / tad-php

PHP Library for ZK Time & Attendance Devices
MIT License
213 stars 159 forks source link

Date Range Get Attendance #69

Open zkenstein opened 5 years ago

zkenstein commented 5 years ago

Hi,

How to get attendance log by a date range?

Thanks.

dennist12 commented 5 years ago

use filer_by_date()

zkenstein commented 5 years ago

Hi @dennist12 , where to put this filter function? I tried under $users = $zk->getAttendance(); but not working

Thanks

animfahmy commented 5 years ago

Hi @dennist12 , where to put this filter function? I tried under $users = $zk->getAttendance(); but not working

Thanks

$tad_factory = new TADFactory(['ip' => '192.168.1.201', 'encoding' => 'utf-8']); $tad = $tad_factory->get_instance(); $att_logs = $tad->get_att_log(); $filtered_att_logs = $att_logs->filter_by_date( ['start' => date("Y-m-d"),'end' => date("Y-m-d")] ); $array_filter = $filtered_att_logs->to_array();

zkenstein commented 5 years ago

Hi @animfahmy , got this error:

Fatal error: Uncaught exception 'TADPHP\Exceptions\ConnectionError' with message 'Imposible iniciar conexión con dispositivo

birhannega commented 5 years ago

@zkenstein if you got this error, you didn't establish connection at all