 <?php
include 'verifikasi.php';?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO verivikasi_tb (kode_unit, bulan, tahun, key_register, verifikator, konsolidasi) VALUES (%s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['kode_unit'], "text"),
                       GetSQLValueString($_POST['bulan'], "text"),
                       GetSQLValueString($_POST['tahun'], "text"),
                       GetSQLValueString($_POST['key_register'], "text"),
                       GetSQLValueString($_POST['verifikator'], "text"),
                       GetSQLValueString($_POST['konsol'], "text"));

  mysql_select_db($database_sistem, $sistem);
  $Result1 = mysql_query($insertSQL, $sistem) or die(mysql_error());
}
?>

<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
  <p>&nbsp;</p>
  <table width="50%" align="center" class="isi_tabel">
    <tr valign="baseline">
      <td colspan="2" align="left" nowrap><h2 style="color:#069">Form Tutup Buku</h2></td>
    </tr>
    <tr valign="baseline">
      <td colspan="2" align="left" nowrap><hr></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="left">Kode Unit</td>
      <td><input name="kode_unit" type="text" value="<?php echo $_SESSION['kode'];?>" size="32" readonly></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="left">Bulan</td>
      <td><input name="bulan" type="text" value="<?php echo $_SESSION['bulan'];?>" size="32" readonly></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="left">Tahun</td>
      <td><input name="tahun" type="text" value="<?php echo $_SESSION['tahun'];?>" size="32" readonly></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="left">Verifikator</td>
      <td><input type="text" name="verifikator" value="" size="32">
      <input type="hidden" name="konsol" value="Active" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="left">&nbsp;</td>
      <td><input class="button" type="submit" value="Tutup Buku Bulan Berjalan">
      <input type="hidden" name="key_register" value="<?php echo $_SESSION['kode'].'/'.$bulan.'/'.$tahun;?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td colspan="2" align="left" nowrap><hr></td>
    </tr>
    <tr valign="baseline">
      <td colspan="2" align="left" nowrap>Catatan :</td>
    </tr>
    <tr valign="baseline">
      <td colspan="2" align="left" nowrap>1. Pastikan semua data telah terinput dengan benar</td>
    </tr>
    <tr valign="baseline">
      <td colspan="2" align="left" nowrap>2. Pastikan telah melakukan rekap saldo untuk tiap Buku Besar Perkiraan</td>
    </tr>
    <tr valign="baseline">
         <td colspan="2" align="left" nowrap>3. Pastikan saldo kas dan bank di pembukuan sudah sesuai dg riilnya</td>
    </tr>
    <tr valign="baseline">
      <td colspan="2" align="left" nowrap>&nbsp;</td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
