100 lines
2.7 KiB
PHP
100 lines
2.7 KiB
PHP
<?php if (strtotime($time_now)<strtotime($time_limit) AND $id_karyawan==1) { ?>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var ip = '200.1.1.4';
|
|
var datasync;
|
|
var dataout;
|
|
var datastar;
|
|
|
|
//Kirim Data dari Server Absensi ke Server PCM
|
|
$.ajax({
|
|
url: 'http://' + ip + '/pc-master/index.php/Sinkron',
|
|
type: 'POST',
|
|
async: false,
|
|
data: {
|
|
tgl_absensi: "<?=$tgl?>",
|
|
karyawan_id: "<?=$id_karyawan?>"
|
|
},
|
|
success: function(response) {
|
|
if (response.value == true) {
|
|
var datasync = response.data;
|
|
for (x = 0; x < datasync.length; x++) {
|
|
$.ajax({
|
|
url: '<?= base_url() ?>index.php/Sinkron/sync_absensi_server6',
|
|
type: 'POST',
|
|
async: false,
|
|
data: {
|
|
id_karyawan: datasync[x]['KARYAWAN_ID'],
|
|
tgl_absensi: datasync[x]['TGL_ABSENSI'],
|
|
jam_masuk: datasync[x]['JAM_MASUK'],
|
|
jam_keluar: datasync[x]['JAM_KELUAR'],
|
|
telat: datasync[x]['TELAT'],
|
|
lokasi_absensi: datasync[x]['LOKASI_ABSENSI'],
|
|
pulang_absensi: datasync[x]['PULANG_ABSENSI'],
|
|
id_absensi: datasync[x]['ID_ABSENSI']
|
|
},
|
|
success: function(response) {
|
|
if (response.value == true) {
|
|
$.ajax({
|
|
url: 'http://' + ip + '/pc-master/index.php/Sinkron/sync_done',
|
|
type: 'POST',
|
|
async: false,
|
|
data: {
|
|
id_absensi : response.data,
|
|
},
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
//Kirim Data Update Pulang Server Absensi ke Server PCM
|
|
$.ajax({
|
|
url: 'http://' + ip + '/pc-master/index.php/Sinkron/sync_pulang',
|
|
type: 'POST',
|
|
async: false,
|
|
data: {
|
|
tgl_absensi: "<?=$tgl?>",
|
|
karyawan_id: "<?=$id_karyawan?>"
|
|
},
|
|
success: function(response) {
|
|
if (response.value == true) {
|
|
var dataout = response.data;
|
|
|
|
for (x = 0; x < dataout.length; x++) {
|
|
$.ajax({
|
|
url: '<?= base_url() ?>index.php/Sinkron/sync_pulang_server6',
|
|
type: 'POST',
|
|
async: false,
|
|
data: {
|
|
id_karyawan: dataout[x]['KARYAWAN_ID'],
|
|
tgl_absensi: dataout[x]['TGL_ABSENSI'],
|
|
jam_keluar: dataout[x]['JAM_KELUAR'],
|
|
pulang_absensi: dataout[x]['PULANG_ABSENSI'],
|
|
id_absensi: dataout[x]['ID_ABSENSI']
|
|
},
|
|
success: function(response) {
|
|
if (response.value == true) {
|
|
$.ajax({
|
|
url: 'http://' + ip + '/pc-master/index.php/Sinkron/sync_pulang_done',
|
|
type: 'POST',
|
|
async: false,
|
|
data: {
|
|
id_absensi : response.data,
|
|
},
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
});
|
|
})
|
|
|
|
</script>
|
|
<?php } ?>
|
|
|