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

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EPERSON'], $GLOBALS['DBUSER_EPERSON'], $GLOBALS['DBPASS_EPERSON']);

$oDp = new Department($oC);
$oDP3 = new Department($oC);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<br>
<table  width=703  align="center">
<tr><td height="150">
<fieldset>
      <legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>">ตั้งค่าโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ</font></legend><br>
      <form name=ps method=post>
      <table width="73%" border="1" cellpadding="0" cellspacing="0" align="center" style="border-collapse:collapse" bordercolor="#DADADA">
      <tr height=22 bgcolor="<?php echo $GLOBALS['COLOR_BG_TD_15'];?>" >
      <td width="57%" align="center"><font  size="2"><strong>วันที่ยืนยันการใช้โครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ</strong></font></td>
      <td width="5%" align="center"><font  size="2"><strong>&nbsp;</strong></font></td>
      <td width="8%" align="center"><font  size="2"><strong>แก้ไข</strong></font></td>
      <td width="8%" align="center"><font  size="2"><strong>ลบ</strong></font></td>
          </tr>
          <?  $i=0;
                  
$maxdate $oDP3->MaxDate();
                  
$oDp->RSdeptGroupBydeptDate($free); 
                  while(
$oDp->GetRecord()){
          
?>
        <tr>
        <td align="center" height="22"><?  if($oDp->deptDate==$maxdate && $maxdate !='0000-00-00'){   echo abbreDate(splitDateDb2($oDp->deptDate ,'/'))." (โครงสร้างปัจจุบัน)"; }else if($oDp->deptDate=='0000-00-00'){   echo "ยังไม่ยืนยันการใช้งานโครงสร้างนี้"; }else{ echo abbreDate(splitDateDb2($oDp->deptDate ,'/'));   } ?></td>
        <td align="center"><img src="../picture/search.gif" alt="ดูโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ"  border="0" style="cursor:pointer;" onclick="popup('<? echo $oDp->deptDate?>');"></td>
        <td align="center"><? if($oDp->deptDate=='0000-00-00'){ ?><a href="deptstructure.php"><img src="../picture/textedit.gif" alt="แก้ไขโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ"  border="0" style="cursor:pointer;" ></a><? }else if($oDp->deptDate==$maxdate){ ?><a href="deptstructureedit.php?deptDate=<? echo $oDp->deptDate?>"><img src="../picture/textedit3.gif" alt="แก้ไขข้อมูลโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณที่ใช้ปัจุบัน"  border="0" style="cursor:pointer;" ></a> <? }else{  ?><img src="../picture/textedit2.gif"  border="0" style="cursor:pointer;" > <? ?></td>
        <td align="center" valign="middle"><? if($oDp->deptDate=='0000-00-00'){ ?><a href="javascript:doDelete(document.ps, '<? echo $oDp->deptDate?>')"><img src="../picture/delete.gif" alt="ลบโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ"  border="0" style="cursor:pointer;" ></a><? }else{ ?><img src="../picture/delete3.gif"   border="0" > <? ?></td>
        </tr>
        <?   $i++; }
                if(
$i==0){
        
?>
        <tr><td colspan="4" align="center" height="22"><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2">** ไม่มีข้อมูลโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ กรุณาเพิ่มโครงสร้างใหม่ **</font></td></tr>
        <? ?>
      </table>
      <table width="73%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse:collapse" >
      <tr><td align="right" height="25"><a href="deptstructure.php"><img src="../picture/new.gif"  border="0" align="absmiddle">&nbsp;เพิ่มโครงสร้างใหม่ (ปรับโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ)&nbsp;</a></td></tr>
      </table>
      </form>
      <br>
</fieldset>
         <table width="704" border="0" align="center">
        <tr> 
          <td width="76" align="left"><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2">&nbsp;<strong>หมายเหตุ 
            : </strong>&nbsp;</font></td>
          <td width="618" align="left"><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2"><img src="../picture/textedit3.gif" alt="แก้ไขข้อมูลโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณที่ยืนยันการใช้งานแล้ว"  border="0" >
           คลิกเพื่อแก้ไขข้อมูลโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณที่ใช้ปัจจุบัน</font></td>
        </tr>
        <tr> 
          <td width="76" align="left">&nbsp;</td>
          <td width="618" align="left"><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2"><img src="../picture/search.gif" alt="ดูโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ"  border="0"> 
           คลิกเพื่อดูโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ</font></td>
        </tr>
        <tr> 
          <td width="76" align="left">&nbsp;</td>
          <td width="618" align="left"><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2"><img src="../picture/textedit.gif" alt="แก้ไขโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ"  border="0" > 
            คลิกเพื่อแก้ไขโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ </font></td>
        </tr>
                <tr> 
          <td width="76" align="left">&nbsp;</td>
          <td width="618" align="left"><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2"><img src="../picture/delete.gif" alt="ลบโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ"  border="0" > 
            คลิกเพื่อลบโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณ</font></td>
        </tr>
        <tr> 
          <td width="76" align="left">&nbsp;</td>
          <td width="618" align="left"><font color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>" size="2"><img src="../picture/new.gif"  border="0" align="absmiddle"> 
            คลิกเพื่อเพิ่มโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณใหม่</font></td>
        </tr>
      </table> <br><br>

</td>
</tr>
</table>
</body>
</html>
<script language="javascript">
function doDelete(f,p){
    if (confirm('ต้องการลบโครงสร้างเพื่อการส่งหนังสือในระบบสารบรรณนี้ใช่หรือไม่') ) {
        window.location="processdept.php?method=deletedept&deptDate=" + p;
    }
}
 function popup(p){     
window.open("showdepttable.php?deptDate="+p,'loaddorder','toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=600, height=700, left = 650, top = 150');
 }
</script>