Please wait while sync in on progress..

<?php
/**
 * Created by PhpStorm.
 * User: sunusi
 * Date: 2019-02-20
 * Time: 09:42
 */

session_start();

require_once getcwd() . "/../functions/db.class.php";
require_once getcwd() . "/../functions/form.data.php";
require_once getcwd() . "/../functions/robot.php";
//patient details

$patients = $query->getAll("select * from udut_patients where patientSyncStatus = 0");

//unseting patients ID
print("
        <script src=\"https://code.jquery.com/jquery-3.3.1.min.js\"></script>
    ");

$serial = 0;
foreach ($patients as $patient) {
    $serial += 1;


    print("<form name=\"patient_sync\" id=\"patient_sync$serial\" method=\"POST\" target=\"formresponse$serial\" action=\"http://uduthctppp.com/p/sync/sync-code.php\">");
    print("<input type=\"hidden\" name=\"patientUId\" value=\"" . $patient["patientUId"] . "\">");
    print("<input type=\"hidden\" name=\"patientName\" value=\"" . $patient["patientName"] . "\">");
    print("<input type=\"hidden\" name=\"patientDob\" value=\"" . $patient["patientDob"] . "\">");
    print("<input type=\"hidden\" name=\"patientGender\" value=\"" . $patient["patientGender"] . "\">");
    print("<input type=\"hidden\" name=\"patientAddress\" value=\"" . $patient["patientAddress"] . "\">");
    print("<input type=\"hidden\" name=\"patientPhone\" value=\"" . $patient["patientPhone"] . "\">");
    print("<input type=\"hidden\" name=\"patientEmail\" value=\"" . $patient["patientEmail"] . "\">");
    print("<input type=\"hidden\" name=\"patientCompanion\" value=\"" . $patient["patientCompanion"] . "\">");
    print("<input type=\"hidden\" name=\"patientHospitalReferredName\" value=\"" . $patient["patientHospitalReferredName"] . "\">");
    print("<input type=\"hidden\" name=\"patientReferredPaper\" value=\"" . $patient["patientReferredPaper"] . "\">");
    print("<input type=\"hidden\" name=\"patientTypeId\" value=\"" . $patient["patientTypeId"] . "\">");
    print("<input type=\"hidden\" name=\"patientFileNo\" value=\"" . $patient["patientFileNo"] . "\">");
    print("<input type=\"hidden\" name=\"userId\" value=\"" . $patient["userId"] . "\">");
    print("<input type=\"hidden\" name=\"patientDateAdded\" value=\"" . $patient["patientDateAdded"] . "\">");
    print("<input type=\"hidden\" name=\"patientDateModified\" value=\"" . $patient["patientDateModified"] . "\">");
    print("</form>");
    print(" <iframe id=\"formresponse$serial\" name=\"formresponse$serial\" style='display:none;'></iframe> ");
    print("<script>document.getElementById(\"patient_sync$serial\").submit();</script>");



    //update sync status
    //$query->execute("update udut_patients set patientSyncStatus = 1 where patientId = '".$patient['patientId']."' ");

}


$payments = $query->getAll("select * from udut_payments where paymentSyncStatus = 0" );

$serial = 0;
foreach ($patients as $patient) {
    $serial += 1;


    print("<form name=\"patient_sync\" id=\"patient_sync$serial\" method=\"POST\" target=\"formresponse$serial\" action=\"http://uduthctppp.com/p/sync/sync-code.php\">");
    print("<input type=\"hidden\" name=\"patientUId\" value=\"" . $patient["patientUId"] . "\">");
    print("<input type=\"hidden\" name=\"patientName\" value=\"" . $patient["patientName"] . "\">");
    print("<input type=\"hidden\" name=\"patientDob\" value=\"" . $patient["patientDob"] . "\">");
    print("<input type=\"hidden\" name=\"patientGender\" value=\"" . $patient["patientGender"] . "\">");
    print("<input type=\"hidden\" name=\"patientAddress\" value=\"" . $patient["patientAddress"] . "\">");
    print("<input type=\"hidden\" name=\"patientPhone\" value=\"" . $patient["patientPhone"] . "\">");
    print("<input type=\"hidden\" name=\"patientEmail\" value=\"" . $patient["patientEmail"] . "\">");
    print("<input type=\"hidden\" name=\"patientCompanion\" value=\"" . $patient["patientCompanion"] . "\">");
    print("<input type=\"hidden\" name=\"patientHospitalReferredName\" value=\"" . $patient["patientHospitalReferredName"] . "\">");
    print("<input type=\"hidden\" name=\"patientReferredPaper\" value=\"" . $patient["patientReferredPaper"] . "\">");
    print("<input type=\"hidden\" name=\"patientTypeId\" value=\"" . $patient["patientTypeId"] . "\">");
    print("<input type=\"hidden\" name=\"patientFileNo\" value=\"" . $patient["patientFileNo"] . "\">");
    print("<input type=\"hidden\" name=\"userId\" value=\"" . $patient["userId"] . "\">");
    print("<input type=\"hidden\" name=\"patientDateAdded\" value=\"" . $patient["patientDateAdded"] . "\">");
    print("<input type=\"hidden\" name=\"patientDateModified\" value=\"" . $patient["patientDateModified"] . "\">");
    print("</form>");
    print(" <iframe id=\"formresponse$serial\" name=\"formresponse$serial\" style='display:none;'></iframe> ");
    print("<script>document.getElementById(\"patient_sync$serial\").submit();</script>");



    //update sync status
    //$query->execute("update udut_patients set patientSyncStatus = 1 where patientId = '".$patient['patientId']."' ");

}
//
//$obj = json_encode($patients);
//
//echo $obj;


?>


<script language='javascript'>
    alert('Synced successfully.');
    window.close();
</script>
