-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_android.php
64 lines (48 loc) · 1.63 KB
/
process_android.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
require("db.php");
?>
<?php
if(isset($_GET['getData'])){
if($_GET['getData']=='Y'){
$db=connectDb();
$sql="select * from document where synced='false'";
$rs=$db->query($sql);
$nm=$rs->num_rows;
for($i=0;$i<$nm;$i++){
$row=$rs->fetch_assoc();
$data["document_".$i]["ref_id"]=$row['ref_id'];
$data["document_".$i]["title"]=$row['subject'];
$data["document_".$i]["document_date"]=$row['document_date'];
$data["document_".$i]["status"]=$row['status'];
}
$json_object['document']=$data;
// echo json_encode($data);
$sql="select * from document_routing inner join routing_targets where status='PENDING' and destination_office='SUP' and synced='false'";
$rs=$db->query($sql);
$nm=$rs->num_rows;
for($i=0;$i<$nm;$i++){
$row=$rs->fetch_assoc();
$actionSQL="select * from document_actions where action_code='".$row['action_id']."'";
$actionRS=$db->query($actionSQL);
$actionRow=$actionRS->fetch_assoc();
$data["action_".$i]["document_id"]=$row['reference_no'];
$data["action_".$i]["from_office"]=$row['from_office'];
$data["action_".$i]["from_person"]=$row['from_name'];
$data["action_".$i]["send_date"]=$row['request_date'];
$data["action_".$i]["action"]=$actionRow['action_description'];
}
echo json_encode($data);
// $json_object['document_action']=$data;
// echo json_encode($jsonobject);
}
}
if(isset($_POST['dataSynced'])){
if($_POST['dataSynced']=='Y'){
$db=connectDb();
$update="update document set synced='true'";
$updateRS=$db->query($update);
$update="update document_routing set synced='true'";
$updateRS=$db->query($update);
}
}
?>