<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 == "tapsidang"){
$km1 = $_POST['km'];
$notap1 = $_POST['notap'];
$query = "UPDATE $mytable Set berkas_taptglsidang  = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_tapnomor  = '$notap1' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_taphakim  = '$km1' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING TANGGAL PENETAPAN SIDANG DAN KETUA MAJELIS HAKIM TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
//SMS
$query = "Select * from $mytable where uid = '$id1'"; 
$result = mysql_query($query); 
if($row2 = mysql_fetch_array($result)){ 
$p16 = $row2['p16_jaksa1'];
$spdp_nama1 = $row2['spdp_namatsk'];
$SQL     = "SELECT * FROM tab_personil where daftar_pegid = '$p16'";
$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 penetapan hari sidang 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>');}
print ('</td></tr>');

$isipesan = "TAP SIDANG AN. $spdp_nama1, $tanggalexec KM: $km1";
$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>');
}}
//----------ENDSTEP
//----------STEP
if ($do1 == "tuntutan"){
$isitut1 = $_POST['isitut'];
$pslterbukti1 = $_POST['pslterbukti'];
$query = "UPDATE $mytable Set berkas_tuttgl  = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_tutpidana  = '$isitut1' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_tutpasal  = '$pslterbukti' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING TANGGAL TUNTUTAN, ISI AMAR TUNTUTAN, PASAL TERBUKTI TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
//----------STEP
if ($do1 == "putusan"){
$isiput1 = $_POST['isiput'];
$pslterbuktiput1 = $_POST['pslterbuktiput'];
$query = "UPDATE $mytable Set berkas_ptstgl  = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_amarput  = '$isiput1 ' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_putpasal  = '$pslterbuktiput1' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING TANGGAL PUTUSAN, ISI AMAR PUTUSAN, PASAL TERBUKTI OLEH HAKIM TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
//----------STEP
$jenis1 = $_POST['jenis'];
if ($do1 == "upayahukum" && $jenis1 == "1"){ //Banding
$query = "UPDATE $mytable Set berkas_tglbanding  = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_tahapan  = '2' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING TANGGAL UPAYA HUKUM BANDING TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
//----------STEP
if ($do1 == "upayahukum" && $jenis1 == "2"){ //Banding
$query = "UPDATE $mytable Set berkas_tglkasasi  = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_tahapan  = '3' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING TANGGAL UPAYA HUKUM KASASI TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
//----------STEP
if ($do1 == "upayahukum" && $jenis1 == "0"){ //Banding
echo "<b>ERROR ANDA BELUM MEMILIH JENIS UPAYA HUKUM</b>";
}
//----------ENDSTEP
if ($do1 == "eksekusi"){
$day2 = $_POST['day1'];
$month2 = $_POST['month1'];
$year2 = $_POST['year1'];
$tanggalexec2 = "$day1/$month1/$year1";
$query = "UPDATE $mytable Set berkas_p48tgl  = '$tanggalexec' where uid = '$id1'";  
$result = mysql_query($query); 
$query = "UPDATE $mytable Set berkas_tahapan  = '1a' where uid = '$id1'";  
$result = mysql_query($query); 
echo "<b>POSTING EKSEKUSI BADAN TERPIDANA TELAH DISIMPAN SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
?>
