maskofa

Tarik attLog Mesin Absensi

Nov 25th, 2021
646
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. procedure THelper.TarikAbsen(ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
  2. var
  3.   fid: WideString;
  4.   vmo: Integer;
  5.   amo: Integer;
  6.   yea: Integer;
  7.   mon: Integer;
  8.   day: Integer;
  9.   hou: Integer;
  10.   men: Integer;
  11.   res: string;
  12.   sec: Integer;
  13.   sss: string;
  14.   wco: Integer;
  15. begin
  16.   res := '{"status":"fail"}';
  17.  
  18.   try
  19.     mesin.Connect_Net(ipMes, Port);
  20.     mesin.ReadGeneralLogData(1);
  21.   except
  22.     on E:Exception do
  23.     begin
  24.       res := '{"status":"fail", "message":"' + E.Message + '"}';
  25.       AResponseInfo.ContentText := res;
  26.       exit;
  27.     end;
  28.   end;
  29.  
  30.   sss := '';
  31.   while Mesin.SSR_GetGeneralLogData(1, fid, vmo, amo, yea, mon, day, hou, men,
  32.         sec, wco) do
  33.   begin
  34.     if inRange(ARequestInfo, yea, mon, day) then
  35.     begin
  36.     if sss <> '' then
  37.       sss := sss + ',';
  38.  
  39.       sss := sss + format('{"faceid":"%s","verifmode":"%d","attmode":"%d",'
  40.              + '"tahun":"%d","bulan":"%d","tanggal":"%d","jam":"%d",'
  41.              + '"menit":"%d","detik":"%d", "workcode":"%d"}',[fid, vmo, amo,
  42.                yea, mon, day, hou, men, sec, wco]);
  43.     end;
  44.   end;
  45.   sss := '[' + sss + ']';
  46.  
  47.   Mesin.RefreshData(1);
  48.  
  49.   res := '{"status":"oke", "data":' + sss + '}';
  50.   AResponseInfo.ContentText := res;
  51. end;
RAW Paste Data