<LINK href="images/index.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
    function refreshAndClose() {
        window.opener.location.reload(true);
        window.close();
    }
</script>
<body onbeforeunload="refreshAndClose();">
<?php
include("../index.cma.db.php");
$mytable = $_POST['table'];
$do1 = $_POST['do'];
$id1 = $_POST['id'];
$day1 = $_POST['day'];
$month1 = $_POST['month'];
$year1 = $_POST['year'];
$tanggalexec = "$day1/$month1/$year1";
//----------STEP
if ($do1 == "p17"){
$query = "UPDATE $mytable Set berkas_tahap1p17tgl  = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_spdp = '1' WHERE uid = '$id1'";
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_riwayat  = 'TAHAP P17' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING P17 TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
//----------STEP
if ($do1 == "berkastahap1"){
$namatdw1 = $_POST['namatdw'];
$jaksaid1 = $_POST['jaksaid'];
$query = "UPDATE $mytable Set berkas_tahap1tgl = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_spdpkembali = '1' WHERE uid = '$id1'";
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_spdp = '1' WHERE uid = '$id1'";
$result = mysql_query($query);
$query = "UPDATE $mytable Set berkas_riwayat  = 'PENERIMAAN TAHAP I' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING BERKAS TAHAP 1 DATANG. TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
//SMS NOTIFIKASI BERKAS DATANG
$SQL     = "SELECT * FROM tab_personil where daftar_pegid = '$jaksaid1'";
$results = mysql_query($SQL);
while ($row = mysql_fetch_array($results)){
$notujuan = $row['daftar_nohp'];
print ('<table width="100%"  border="0" cellspacing="2" cellpadding="2"><tr><td><strong>Pesan terkirim ke Jaksa P16 </strong></td>
</tr><tr><td>&nbsp;</td></tr><tr><td bgcolor="#FF6600"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td><strong>Sms Pesan </strong></td></tr><tr><td bgcolor="#FFDFB0"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td width="15%">Kepada</td><td width="2%">:</td><td width="83%">');
print('<b>'.$row['daftar_nama'].'</b>');
$jaksanya = $row['daftar_nama'];}
print ('</td></tr>');
$maxlen=60;
if (strlen($namatdw1)>$maxlen)
$namatdw2 = substr($namatdw1,0,$maxlen-3)."*";
else 
$namatdw2 = $namatdw1;
$isipesan = "Berkas An.Tsk $namatdw2 Sudah datang segera tentukan sikap dlm 7 hari";
$DestinationNumber=addslashes(strip_tags($notujuan));	
$TextDecoded=addslashes(strip_tags($isipesan)); 
$sql="INSERT INTO outbox (`UpdatedInDB` ,`InsertIntoDB` ,`SendingDateTime` ,`Text` ,`DestinationNumber` ,`Coding` ,`UDH` ,`Class` ,`TextDecoded` ,`ID` ,`MultiPart` ,`RelativeValidity` ,`SenderID` ,`SendingTimeOut` ,`DeliveryReport` ,`CreatorID`)
VALUES (NOW() , NOW(), '0000-00-00 00:00:00', NULL , '$DestinationNumber', 'Default_No_Compression', NULL , '-1', '$TextDecoded', NULL , 'false', '-1', NULL , '0000-00-00 00:00:00', 'default', '')";

mysql_query($sql); 
print ('<tr><td>Isi Pesan </td> <td>:</td> <td>');
echo "$isipesan Telah terkirim ke Nomor : $notujuan";
print ('</td></tr></table></td></tr></table></td></tr></table>');
//SMS PENYIDIK
$SQL     = "SELECT * FROM $mytable where uid = '$id1'"; 
$results = mysql_query($SQL);
while ($row2 = mysql_fetch_array($results)){
$namapenyidik2 = $row2['spdp_namapenyidik'];
$notujuan2 = $row2['spdp_telppenyidik'];
print ('<table width="100%"  border="0" cellspacing="2" cellpadding="2"><tr><td><strong>Pesan terkirim ke Penyidik '.$namapenyidik2.'</strong></td>
</tr><tr><td>&nbsp;</td></tr><tr><td bgcolor="#FF6600"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td><strong>Sms Pesan </strong></td></tr><tr><td bgcolor="#FFDFB0"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td width="15%">Kepada</td><td width="2%">:</td><td width="83%">');
print('<b>'.$namapenyidik2.'</b>');
print ('</td></tr>');

if ($notujuan2 == "0")  {
echo "No Penyidik Kosong";
} 
elseif ($notujuan2 !== "0") {
$namatdw2 = $namatdw1;
$isipesan2 = "Berkas An.Tsk $namatdw2 sudah Diterima Oleh Jaksa $jaksanya Silahkan Koordinasi";
$DestinationNumber=addslashes(strip_tags($notujuan2));	
$TextDecoded=addslashes(strip_tags($isipesan2)); 
$sql="INSERT INTO outbox (`UpdatedInDB` ,`InsertIntoDB` ,`SendingDateTime` ,`Text` ,`DestinationNumber` ,`Coding` ,`UDH` ,`Class` ,`TextDecoded` ,`ID` ,`MultiPart` ,`RelativeValidity` ,`SenderID` ,`SendingTimeOut` ,`DeliveryReport` ,`CreatorID`)
VALUES (NOW() , NOW(), '0000-00-00 00:00:00', NULL , '$DestinationNumber', 'Default_No_Compression', NULL , '-1', '$TextDecoded', NULL , 'false', '-1', NULL , '0000-00-00 00:00:00', 'default', '')";
mysql_query($sql); 
print ('<tr><td>Isi Pesan </td> <td>:</td> <td>');
echo "$isipesan2 Telah terkirim ke Nomor : $notujuan2";
print ('</td></tr></table></td></tr></table></td></tr></table>');
}
}} 
//----------ENDSTEP
//----------STEP
if ($do1 == "p21"){

$namatdw1 = $_POST['namatdw'];
$jaksaid1 = $_POST['jaksaid'];
$query = "UPDATE $mytable Set berkas_tahap1p21tgl = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_berkas = '1' WHERE uid = '$id1'";
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_riwayat  = 'BERKAS LENGKAP/P21' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING BERKAS TELAH LENGKAP atau P21. TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";

//SMS PENYIDIK--------------------------------------------------------------------
$SQL     = "SELECT * FROM $mytable where uid = '$id1'"; 
$results = mysql_query($SQL);
while ($row2 = mysql_fetch_array($results)){
$namapenyidik2 = $row2['spdp_namapenyidik'];
$notujuan2 = $row2['spdp_telppenyidik'];
if ($notujuan2 == "0")  {
echo "No Penyidik Kosong";
} 
elseif ($notujuan2 !== "0") {
print ('<table width="100%"  border="0" cellspacing="2" cellpadding="2"><tr><td><strong>Pesan terkirim ke Penyidik '.$namapenyidik2.'</strong></td>
</tr><tr><td>&nbsp;</td></tr><tr><td bgcolor="#FF6600"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td><strong>Sms Pesan </strong></td></tr><tr><td bgcolor="#FFDFB0"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td width="15%">Kepada</td><td width="2%">:</td><td width="83%">');
print('<b>'.$namapenyidik2.'</b>');
print ('</td></tr>');
$namatdw2 = $namatdw1;
$isipesan2 = "Berkas An.Tsk $namatdw2 telah dinyatakan lengkap.";
$DestinationNumber=addslashes(strip_tags($notujuan2));	
$TextDecoded=addslashes(strip_tags($isipesan2)); 
$sql="INSERT INTO outbox (`UpdatedInDB` ,`InsertIntoDB` ,`SendingDateTime` ,`Text` ,`DestinationNumber` ,`Coding` ,`UDH` ,`Class` ,`TextDecoded` ,`ID` ,`MultiPart` ,`RelativeValidity` ,`SenderID` ,`SendingTimeOut` ,`DeliveryReport` ,`CreatorID`)
VALUES (NOW() , NOW(), '0000-00-00 00:00:00', NULL , '$DestinationNumber', 'Default_No_Compression', NULL , '-1', '$TextDecoded', NULL , 'false', '-1', NULL , '0000-00-00 00:00:00', 'default', '')";
mysql_query($sql); 
print ('<tr><td>Isi Pesan </td> <td>:</td> <td>');
echo "$isipesan2 Telah terkirim ke Nomor : $notujuan2";
print ('</td></tr></table></td></tr></table></td></tr></table>');
}

}
}
//----------ENDSTEP
//----------STEP
if ($do1 == "p18"){

$namatdw1 = $_POST['namatdw'];
$jaksaid1 = $_POST['jaksaid'];
$query = "UPDATE $mytable Set berkas_tahap1p18tgl = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_berkas = '1' WHERE uid = '$id1'";
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_riwayat  = 'BERKAS P18/P19' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING BERKAS BELUM LENGKAP atau P18. TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
//SMS PENYIDIK--------------------------------------------------------------------
$SQL     = "SELECT * FROM $mytable where uid = '$id1'"; 
$results = mysql_query($SQL);
while ($row2 = mysql_fetch_array($results)){
$namapenyidik2 = $row2['spdp_namapenyidik'];
$notujuan2 = $row2['spdp_telppenyidik'];
if ($notujuan2 == "0")  {
echo "No Penyidik Kosong";
} 
elseif ($notujuan2 !== "0") {
print ('<table width="100%"  border="0" cellspacing="2" cellpadding="2"><tr><td><strong>Pesan terkirim ke Penyidik '.$namapenyidik2.'</strong></td>
</tr><tr><td>&nbsp;</td></tr><tr><td bgcolor="#FF6600"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td><strong>Sms Pesan </strong></td></tr><tr><td bgcolor="#FFDFB0"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td width="15%">Kepada</td><td width="2%">:</td><td width="83%">');
print('<b>'.$namapenyidik2.'</b>');
print ('</td></tr>');
$namatdw2 = $namatdw1;
$isipesan2 = "Berkas An.Tsk $namatdw2 Belum lengkap, agar penyidik dapat segera berkordinasi.";
$DestinationNumber=addslashes(strip_tags($notujuan2));	
$TextDecoded=addslashes(strip_tags($isipesan2)); 
$sql="INSERT INTO outbox (`UpdatedInDB` ,`InsertIntoDB` ,`SendingDateTime` ,`Text` ,`DestinationNumber` ,`Coding` ,`UDH` ,`Class` ,`TextDecoded` ,`ID` ,`MultiPart` ,`RelativeValidity` ,`SenderID` ,`SendingTimeOut` ,`DeliveryReport` ,`CreatorID`)
VALUES (NOW() , NOW(), '0000-00-00 00:00:00', NULL , '$DestinationNumber', 'Default_No_Compression', NULL , '-1', '$TextDecoded', NULL , 'false', '-1', NULL , '0000-00-00 00:00:00', 'default', '')";
mysql_query($sql); 
print ('<tr><td>Isi Pesan </td> <td>:</td> <td>');
echo "$isipesan2 Telah terkirim ke Nomor : $notujuan2";
print ('</td></tr></table></td></tr></table></td></tr></table>');
}}
}
//----------ENDSTEP
//----------STEP
if ($do1 == "p19"){

$namatdw1 = $_POST['namatdw'];
$jaksaid1 = $_POST['jaksaid'];
$query = "UPDATE $mytable Set berkas_tahap1p19tgl = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_berkas = '1' WHERE uid = '$id1'";
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_riwayat  = 'BERKAS P18/P19' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING BERKAS BELUM LENGKAP atau P19. TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
//SMS PENYIDIK--------------------------------------------------------------------
$SQL     = "SELECT * FROM $mytable where uid = '$id1'"; 
$results = mysql_query($SQL);
while ($row2 = mysql_fetch_array($results)){
$namapenyidik2 = $row2['spdp_namapenyidik'];
$notujuan2 = $row2['spdp_telppenyidik'];
if ($notujuan2 == "0")  {
echo "No Penyidik Kosong";
} 
elseif ($notujuan2 !== "0") {
print ('<table width="100%"  border="0" cellspacing="2" cellpadding="2"><tr><td><strong>Pesan terkirim ke Penyidik '.$namapenyidik2.'</strong></td>
</tr><tr><td>&nbsp;</td></tr><tr><td bgcolor="#FF6600"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td><strong>Sms Pesan </strong></td></tr><tr><td bgcolor="#FFDFB0"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
<tr><td width="15%">Kepada</td><td width="2%">:</td><td width="83%">');
print('<b>'.$namapenyidik2.'</b>');
print ('</td></tr>');
$namatdw2 = $namatdw1;
$isipesan2 = "Petunjuk (P19) BP An.Tsk $namatdw2 telah siap untuk diambil.";
$DestinationNumber=addslashes(strip_tags($notujuan2));	
$TextDecoded=addslashes(strip_tags($isipesan2)); 
$sql="INSERT INTO outbox (`UpdatedInDB` ,`InsertIntoDB` ,`SendingDateTime` ,`Text` ,`DestinationNumber` ,`Coding` ,`UDH` ,`Class` ,`TextDecoded` ,`ID` ,`MultiPart` ,`RelativeValidity` ,`SenderID` ,`SendingTimeOut` ,`DeliveryReport` ,`CreatorID`)
VALUES (NOW() , NOW(), '0000-00-00 00:00:00', NULL , '$DestinationNumber', 'Default_No_Compression', NULL , '-1', '$TextDecoded', NULL , 'false', '-1', NULL , '0000-00-00 00:00:00', 'default', '')";
mysql_query($sql); 
print ('<tr><td>Isi Pesan </td> <td>:</td> <td>');
echo "$isipesan2 Telah terkirim ke Nomor : $notujuan2";
print ('</td></tr></table></td></tr></table></td></tr></table>');
}
}}
if ($do1 == "p20"){

$query = "UPDATE $mytable Set berkas_p20 = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_spdp = '1', late_p21 = '1', late_berkas = '1', late_spdpkembali = '1' WHERE uid = '$id1'"; //UNTUK PENYETINGAN SEMENTARA JIKA SUDAH BERI TANDA //
$result = mysql_query($query);
$query = "UPDATE $mytable Set berkas_riwayat  = 'BERKAS P20/SP3' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING BERKAS BELUM LENGKAP atau P20 / SP3. TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
if ($do1 == "diversi"){

$query = "UPDATE $mytable Set berkas_diversi = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_p20 = 'Diversi Dik' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_spdp = '1', late_p21 = '1', late_berkas = '1', late_spdpkembali = '1' WHERE uid = '$id1'"; //UNTUK PENYETINGAN SEMENTARA JIKA SUDAH BERI TANDA //
$result = mysql_query($query);
$query = "UPDATE $mytable Set berkas_riwayat  = 'BERKAS DIVERSI' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING BERKAS BELUM LENGKAP atau P20 / SP3. TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
//----------ENDSTEP
if ($do1 == "spdpkembali"){

$query = "UPDATE $mytable Set spdp_kembali = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable SET late_spdp = '1', late_p21 = '1', late_berkas = '1', late_spdpkembali = '1' WHERE uid = '$id1'"; //UNTUK PENYETINGAN SEMENTARA JIKA SUDAH BERI TANDA //
$result = mysql_query($query);
$query = "UPDATE $mytable Set berkas_riwayat  = 'SPDP TELAH DIKEMBALIKAN KE PENYIDIK' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING BERKAS SPDP KEMBALI TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP

?>
