<?PHP
date_default_timezone_set('ASIA/JAKARTA');
$tablename1 = $_GET["table"];
$tablename2 = $_GET["jenis"];
$tablename3 = $tablename1.''.$tablename2;
$next_increment     = 0;
$qShowStatus        = "SHOW TABLE STATUS LIKE '$tablename3'";
$qShowStatusResult  = mysql_query($qShowStatus) or die ( "Query failed: " . mysql_error() . "<br/>" . $qShowStatus );
$row = mysql_fetch_assoc($qShowStatusResult);
$next_increment = $row['Auto_increment'];
$day = date("d");
$month = date("m");
$year = date("Y");
?><table width="100%"  border="0" cellspacing="4" cellpadding="4">
  <tr>
    <td>&nbsp;
    </td>
  </tr>
  <tr>
    <td><form action="index.postingsuratkeluar.add.php" method="post" enctype="multipart/form-data" name="form1">
      <table width="90%"  border="0" align="center" cellpadding="5" cellspacing="5">
        <tr>
          <td colspan="3"><table width="100%"  border="0" cellspacing="4" cellpadding="4" class="panel">
            <tr>
              <td><table width="100%"  border="0" cellspacing="4" cellpadding="4">
                  <tr>
                    <td>Surat di input pada Jenis Surat : <strong>
                        <?PHP
if ($tablename2 == "b")  {echo "SURAT KELUAR BIASA";} 
elseif ($tablename2 == "r") {echo "SURAT KELUAR RAHASIA";} 
elseif ($tablename2 == "sp") {echo "SURAT PERINTAH";} 
elseif ($tablename2 == "sk") {echo "SURAT KEPUTUSAN";} 
?></strong>
                      <input name="jenis" type="hidden" id="jenis" value="<? echo "$tablename2";?>">
            Dalam Table : <strong><? echo "$tablename3";?></strong>
            <input name="tu_dbtahun" type="hidden" id="tu_dbtahun" value="<? echo "$tablename3";?>">
            <input name="tahun" type="hidden" id="tahun" value="<? echo $tahun1 = $_GET["table"]; ?>"></td>
                  </tr>
              </table></td>
            </tr>
          </table> </td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td width="15%"> No Agenda </td>
          <td width="2%">:</td>
          <td width="83%"><input name="tu_noagenda" type="text" id="tu_noagenda" value="<?PHP echo $next_increment; ?>" size="5"> 
            Nomor urut ini dibuat otomatis dari nomor sebelumnya apabila terloncati ketik manual </td>
        </tr>
        <tr>
          <td>Tanggal Surat</td>
          <td width="2%">:</td>
          <td><select name="day" id="day">
            <option value="01" <? IF($day == "1"){ echo "selected"; } ?>>01</option>
            <option value="02" <? IF($day == "2"){ echo "selected"; } ?>>02</option>
            <option value="03" <? IF($day == "3"){ echo "selected"; } ?>>03</option>
            <option value="04" <? IF($day == "4"){ echo "selected"; } ?>>04</option>
            <option value="05" <? IF($day == "5"){ echo "selected"; } ?>>05</option>
            <option value="06" <? IF($day == "6"){ echo "selected"; } ?>>06</option>
            <option value="07" <? IF($day == "7"){ echo "selected"; } ?>>07</option>
            <option value="08" <? IF($day == "8"){ echo "selected"; } ?>>08</option>
            <option value="09" <? IF($day == "9"){ echo "selected"; } ?>>09</option>
            <option value="10" <? IF($day == "10"){ echo "selected"; } ?>>10</option>
            <option value="11" <? IF($day == "11"){ echo "selected"; } ?>>11</option>
            <option value="12" <? IF($day == "12"){ echo "selected"; } ?>>12</option>
            <option value="13" <? IF($day == "13"){ echo "selected"; } ?>>13</option>
            <option value="14" <? IF($day == "14"){ echo "selected"; } ?>>14</option>
            <option value="15" <? IF($day == "15"){ echo "selected"; } ?>>15</option>
            <option value="16" <? IF($day == "16"){ echo "selected"; } ?>>16</option>
            <option value="17" <? IF($day == "17"){ echo "selected"; } ?>>17</option>
            <option value="18" <? IF($day == "18"){ echo "selected"; } ?>>18</option>
            <option value="19" <? IF($day == "19"){ echo "selected"; } ?>>19</option>
            <option value="20" <? IF($day == "20"){ echo "selected"; } ?>>20</option>
            <option value="21" <? IF($day == "21"){ echo "selected"; } ?>>21</option>
            <option value="22" <? IF($day == "22"){ echo "selected"; } ?>>22</option>
            <option value="23" <? IF($day == "23"){ echo "selected"; } ?>>23</option>
            <option value="24" <? IF($day == "24"){ echo "selected"; } ?>>24</option>
            <option value="25" <? IF($day == "25"){ echo "selected"; } ?>>25</option>
            <option value="26" <? IF($day == "26"){ echo "selected"; } ?>>26</option>
            <option value="27" <? IF($day == "27"){ echo "selected"; } ?>>27</option>
            <option value="28" <? IF($day == "28"){ echo "selected"; } ?>>28</option>
            <option value="29" <? IF($day == "29"){ echo "selected"; } ?>>29</option>
            <option value="30" <? IF($day == "30"){ echo "selected"; } ?>>30</option>
            <option value="31" <? IF($day == "31"){ echo "selected"; } ?>>31</option>
          </select><select name="month" id="month">
            <option value="01" <? IF($month == "1"){ echo "selected"; } ?>>01</option>
            <option value="02" <? IF($month == "2"){ echo "selected"; } ?>>02</option>
            <option value="03" <? IF($month == "3"){ echo "selected"; } ?>>03</option>
            <option value="04" <? IF($month == "4"){ echo "selected"; } ?>>04</option>
            <option value="05" <? IF($month == "5"){ echo "selected"; } ?>>05</option>
            <option value="06" <? IF($month == "6"){ echo "selected"; } ?>>06</option>
            <option value="07" <? IF($month == "7"){ echo "selected"; } ?>>07</option>
            <option value="08" <? IF($month == "8"){ echo "selected"; } ?>>08</option>
            <option value="09" <? IF($month == "9"){ echo "selected"; } ?>>09</option>
            <option value="10" <? IF($month == "10"){ echo "selected"; } ?>>10</option>
            <option value="11" <? IF($month == "11"){ echo "selected"; } ?>>11</option>
            <option value="12" <? IF($month == "12"){ echo "selected"; } ?>>12</option>
          </select>
		   <select name="year" id="year">
            <option value="2016" <? IF($year == "2016"){ echo "selected"; } ?>>2016</option>
            <option value="2017" <? IF($year == "2017"){ echo "selected"; } ?>>2017</option>
            <option value="2018" <? IF($year == "2018"){ echo "selected"; } ?>>2018</option>
            <option value="2019" <? IF($year == "2019"){ echo "selected"; } ?>>2019</option>
            <option value="2020" <? IF($year == "2020"){ echo "selected"; } ?>>2020</option>
        </select>        </td>
        </tr>
        <tr>
          <td>Surat Kepada</td>
          <td width="2%">:</td>
          <td><input name="tu_asalsrt" type="text" id="tu_asalsrt" size="50"> 
		  <?PHP
if ($tablename2 == "b")  {
print ('Jenis Surat 
            <select name="tu_jenissurat">
              <option value="1" selected>SURAT BIASA UMUM</option>
              <option value="2">SURAT BIASA DALAM</option>
            </select>');
} 
elseif ($tablename2 == "r") {
print ('<input name="tu_jenissurat" type="hidden" id="tu_jenissurat" value="0">');

} 

?>
          
</td>
        </tr>
        <tr>
          <td>No Surat</td>
          <td width="2%">:</td>
          <td><input name="tu_nosrt" type="text" id="tu_nosrt2" size="60"></td>
        </tr>
        <tr>
          <td>Jumlah Lampiran </td>
          <td width="2%">:</td>
          <td><input name="tu_lamp" type="text" id="tu_lamp" value="-" size="10">
        (jangan biarkan kosong setidaknya beri tanda - apabila tidak ada lampiran) </td>
        </tr>
        <tr>
          <td>Tanggal Agenda</td>
          <td width="2%">:</td>
          <td><select name="day1" id="day1">
            <option value="01" <? IF($day == "1"){ echo "selected"; } ?>>01</option>
            <option value="02" <? IF($day == "2"){ echo "selected"; } ?>>02</option>
            <option value="03" <? IF($day == "3"){ echo "selected"; } ?>>03</option>
            <option value="04" <? IF($day == "4"){ echo "selected"; } ?>>04</option>
            <option value="05" <? IF($day == "5"){ echo "selected"; } ?>>05</option>
            <option value="06" <? IF($day == "6"){ echo "selected"; } ?>>06</option>
            <option value="07" <? IF($day == "7"){ echo "selected"; } ?>>07</option>
            <option value="08" <? IF($day == "8"){ echo "selected"; } ?>>08</option>
            <option value="09" <? IF($day == "9"){ echo "selected"; } ?>>09</option>
            <option value="10" <? IF($day == "10"){ echo "selected"; } ?>>10</option>
            <option value="11" <? IF($day == "11"){ echo "selected"; } ?>>11</option>
            <option value="12" <? IF($day == "12"){ echo "selected"; } ?>>12</option>
            <option value="13" <? IF($day == "13"){ echo "selected"; } ?>>13</option>
            <option value="14" <? IF($day == "14"){ echo "selected"; } ?>>14</option>
            <option value="15" <? IF($day == "15"){ echo "selected"; } ?>>15</option>
            <option value="16" <? IF($day == "16"){ echo "selected"; } ?>>16</option>
            <option value="17" <? IF($day == "17"){ echo "selected"; } ?>>17</option>
            <option value="18" <? IF($day == "18"){ echo "selected"; } ?>>18</option>
            <option value="19" <? IF($day == "19"){ echo "selected"; } ?>>19</option>
            <option value="20" <? IF($day == "20"){ echo "selected"; } ?>>20</option>
            <option value="21" <? IF($day == "21"){ echo "selected"; } ?>>21</option>
            <option value="22" <? IF($day == "22"){ echo "selected"; } ?>>22</option>
            <option value="23" <? IF($day == "23"){ echo "selected"; } ?>>23</option>
            <option value="24" <? IF($day == "24"){ echo "selected"; } ?>>24</option>
            <option value="25" <? IF($day == "25"){ echo "selected"; } ?>>25</option>
            <option value="26" <? IF($day == "26"){ echo "selected"; } ?>>26</option>
            <option value="27" <? IF($day == "27"){ echo "selected"; } ?>>27</option>
            <option value="28" <? IF($day == "28"){ echo "selected"; } ?>>28</option>
            <option value="29" <? IF($day == "29"){ echo "selected"; } ?>>29</option>
            <option value="30" <? IF($day == "30"){ echo "selected"; } ?>>30</option>
            <option value="31" <? IF($day == "31"){ echo "selected"; } ?>>31</option>
          </select><select name="month1" id="month1">
            <option value="01" <? IF($month == "1"){ echo "selected"; } ?>>01</option>
            <option value="02" <? IF($month == "2"){ echo "selected"; } ?>>02</option>
            <option value="03" <? IF($month == "3"){ echo "selected"; } ?>>03</option>
            <option value="04" <? IF($month == "4"){ echo "selected"; } ?>>04</option>
            <option value="05" <? IF($month == "5"){ echo "selected"; } ?>>05</option>
            <option value="06" <? IF($month == "6"){ echo "selected"; } ?>>06</option>
            <option value="07" <? IF($month == "7"){ echo "selected"; } ?>>07</option>
            <option value="08" <? IF($month == "8"){ echo "selected"; } ?>>08</option>
            <option value="09" <? IF($month == "9"){ echo "selected"; } ?>>09</option>
            <option value="10" <? IF($month == "10"){ echo "selected"; } ?>>10</option>
            <option value="11" <? IF($month == "11"){ echo "selected"; } ?>>11</option>
            <option value="12" <? IF($month == "12"){ echo "selected"; } ?>>12</option>
          </select>
		   <select name="year1" id="year1">
            <option value="2016" <? IF($year == "2016"){ echo "selected"; } ?>>2016</option>
            <option value="2017" <? IF($year == "2017"){ echo "selected"; } ?>>2017</option>
            <option value="2018" <? IF($year == "2018"){ echo "selected"; } ?>>2018</option>
            <option value="2019" <? IF($year == "2019"){ echo "selected"; } ?>>2019</option>
            <option value="2020" <? IF($year == "2020"){ echo "selected"; } ?>>2020</option>
        </select>            </td>
        </tr>
        <tr>
          <td>Perihal / Isi Surat </td>
          <td width="2%">:</td>
          <td><input name="tu_perihal" type="text" id="textarea2" value="" size="100"></td>
        </tr>
        <tr>
          <td colspan="3">&nbsp;</td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td><input type="reset" name="Submit2" value="Reset">            <input type="submit" name="Submit" value="SIMPAN SURAT INI">
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>* Cukup Sekali Tekan tombol simpan dan tunggu proses, Jika terjadi doubleclik tombol simpan akan terkunci </td>
        </tr>
      </table>
    </form></td>
</tr>
</table>