<?php
include_once "template.php";
include_once 
"../class/clsTable.php";
include_once 
"../link/function.php";
include_once 
"../link/keyThai.php";
include_once 
"../class/clsbackupDoc.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);

$oBd = new backupDoc($oC);
$oBd->RSbackupDoc();
if(
$oBd->GetRecord()==1){
    
$h=1;
}

$oSys->SearchByKey($free);
$oSys->GetRecord();
$InputThai=$oSys->SearchByInputThai();
?>
<html>
<head>
<script language="javascript" src="../source/calendarDateInput.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<iframe id="addDocNo" name="addDocNo" src="" style="width:$0px;height:0px;border:0"></iframe>
<br>
<table  width=703  align="center">
<tr><td height="150">
<fieldset>
      <legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="?mm=1">จัดเก็บแฟ้มหนังสือ</a></font></legend><br>
       <form name="ff" action="processBackupDoc.php" method="post">
       <table width="90%" height="22" border="0" align="center">
        <tr><td><strong>อายุการเก็บแฟ้มหนังสือ</strong></td><td><input name="yearDoc" type="text" size="5" maxlength="32"> ปี</td></tr>
        <tr><td width="25%"><strong>ว/ด/ป เริ่มต้น</strong></td><td width="75%"><script>DateInput('DocStart', true, 'DD/MM/YYYY','<?php echo getNowDateFw2();?>');</script></td></tr>
        <tr><td>&nbsp;</td></tr>
         <tr><td colspan="2" align="center">
                      <input type="submit" name="setDocNo" value="บันทึก" onClick="return checkFormat();">
                <input type="button" name="cancel" value="ยกเลิก" onClick="location.href = '?mm=1'">
                <input type="hidden" name="method">        
            </td></tr>
            <tr><td>&nbsp;</td></tr>
            <? if($h==1){ ?>
            <tr><td colspan="2"><strong>อายุการเก็บแฟ้มหนังสือ</strong> <? echo $oBd->yearDoc?> ปี</td></tr>
            <tr><td colspan="2"><strong>ว/ด/ป สิ้นสุด</strong> <? echo abbreDate2($oBd->expireDate,'/'); ?></td></tr>
            <? ?>
       </table></form>
</fieldset>
      
    </td>
</tr>
</table>
</body>
</html>

<script language="javascript">
function checkFormat(){
 if (document.ff.formatDoc.value=="") {
      alert('กรุณากรอกที่หนังสือขององค์กร');
      document.ff.formatDoc.focus();
      return false ;
   }
        var agree=confirm("คุณต้องการบันทึกข้อมูลที่หนังสือส่งใช่หรือไม่ ?");
        if (agree){
            return true ;
        }else{
            return false ;
        }    
}
</script>