Viewing file: deptpop2.php (6.6 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include_once("../../class/clsConnection.php"); include_once("../../class/clsDB.php"); include_once "../global.php"; include_once "../link/function.php"; include_once "../class/clsDepartment.php"; include_once "../class/clsdepttype.php"; include_once "../class/clsdeptref.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EPERSON'], $GLOBALS['DBUSER_EPERSON'], $GLOBALS['DBPASS_EPERSON']);
$oDp = new Department($oC); $oDp1 = new Department($oC); $oDpT = new Department($oC); $oDp2 = new Department($oC); $oDp3 = new Department($oC); $oDp4 = new Department($oC); $oDp5 = new Department($oC); $oDp6 = new Department($oC); $oDp7 = new Department($oC); $oDp8 = new Department($oC); $oDpt= new Departmenttype($oC); $maxdate = $oDp5->MaxDate(); $oDr= new deptref($oC); $oDr2= new deptref($oC); ?> <script language="JavaScript1.2"> function checkFormat(){ document.ps.xv.value = 0; if(document.ps.deptName.value==""){ alert("กรุณากรอกชื่อส่วนราชการภายใน!"); document.ps.xv.value = 1; return false; } if(document.ps.depttypeId.value==""){ alert("กรุณากรอกประเภทส่วนราชการภายใน!"); document.ps.xv.value = 1; return false; } } </script> <? if($method=="edit" && $xv != 1){ //$oC->BeginTrans(); $oDp->SearchByKey($deptId); $oDp->GetRecord(); $oDp->Edit(); $oDp->deptId=$deptId; $oDp->deptName=$deptName; $oDp->deptDesc=$deptDesc; $oDp->deptCode=$oDp->deptCode; if($deptlink!=""){ $deptParent=$deptlink; } $oDp->deptParent=$deptParent; $oDp->deptYear=$oDp->deptYear; $oDp->deptDate=$oDp->deptDate; $oDp->deptRef=$oDp->deptRef; $oDp->pbriId=$oDp->pbriId; $oDp->depttypeId=$depttypeId; $oDp->deptParentId=$oDp->deptParentId; $oDp->deptLevel=$oDp->deptLevel; $oDp->deptgroup=$oDp->deptgroup; $oDp->Save(); $oDr2->deleteDept($deptId); $oDp4->searchdeptDate($maxdate); while($oDp4->GetRecord()){ if($deptmaxdate[$oDp4->deptId]==1){ $oDr->AddNew(); $oDr->drId=$oDr->GetNextCode(); $oDr->deptId=$oDp->deptId; $oDr->deptrefId=$oDp4->deptId; $oDr->Save(); } } ?> <script language="javascript1.2"> window.opener.location.href="deptstructure.php?startyear=<?php echo $oDp->deptstartyear;?>&endyear=<?php echo $oDp->deptendyear;?>"; window.close(); </script> <?php } ?> <html> <head> <title>แก้ไขส่วนราชการภายใน</title> <meta http-equiv="Content-Type" content="text/html; charset=tis-620"> <link href="../source/style.css" rel="stylesheet" type="text/css"> <style> <!-- A:link {text-decoration: none } A:visited {text-decoration: none} A:hover {text-decoration: none; font-weight: underline} --> </style> </head> <body bgcolor="#FFFFFF"> <form name="ps" action="<?php echo $PHP_SELF;?>" method="post" > <table width="550" border="0" cellspacing="1" cellpadding="1" align="center"><?php echo $startyear;?> <tr > <td align="center" colspan="4" height="22"><font size="3" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>"><b>แก้ไขส่วนราชการภายใน</b></font></td> </tr> <tr> <td colspan="4" height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>"> </font></td> </tr> <? $oDp->SearchByKey($deptId); $oDp->GetRecord(); ?> <tr height="22" > <td align="left" width="221" ><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ชื่อส่วนราชการภายใน</b></font></td> <td align="left" width="4"> </td> <td align="left" width="315"><input type="text" name="deptName" size="40" value="<? echo $oDp->deptName; ?>" onKeyPress="if(event.keyCode==39){ alert('ระบบไม่สามารถบันทึกตัวอักษรนี้ได้!!'); return false;}"> <font size="2" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td> </tr> <? if($maxdate!='0000-00-00' && $maxdate!=""){ ?> <tr height="22" bgcolor="<?php echo $GLOBALS['COLOR_BG_TD_4'];?>"> <td align="left"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ส่วนราชการภายใน<br>(โครงสร้างหน่วยงานสารบรรณเก่า)</b></font></td> <td align="left" > </td> <td align="left"> <? $oDp4->searchdeptDate($maxdate); while($oDp4->GetRecord()){ $checkeddept=0; $oDr->SearchBydeptIddeptrefId($deptId,$oDp4->deptId); if($oDr->GetRecord()==1){ $checkeddept=1; } ?> <input name="deptmaxdate[<? echo $oDp4->deptId; ?>]" type="checkbox" value="1" <? if($checkeddept==1){ echo "checked"; }?>> <? echo $oDp4->deptName; ?><br> <? } ?> </td> </tr> <? } ?> <tr height="22" bgcolor="<?php echo $GLOBALS['COLOR_BG_TD_4'];?>"> <td align="left"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ประเภทของส่วนราชการภายใน</b></font></td> <td align="left" > </td> <td align="left"> <select name="depttypeId" > <? $oDpt->RSDepartmenttype(); while($oDpt->GetRecord()){ ?> <option value="<? echo $oDpt->depttypeId; ?>" <? if($oDpt->depttypeId == $oDp->depttypeId){ echo "selected"; }?>><? echo $oDpt->depttypeName; ?> <? }?> </select>
<font size="2" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td> </tr> <tr height="22" > <td align="left" width="221" ><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>รายละเอียด</b></font></td> <td align="left" width="4"> </td> <td align="left" width="315"><input type="text" name="deptDesc" size="40" value="<? if($oDp->deptDesc!=""){ echo $oDp->deptDesc; } ?>" onKeyPress="if(event.keyCode==39){ alert('ระบบไม่สามารถบันทึกตัวอักษรนี้ได้!!'); return false;}"> </td> </tr> <tr height="22"> <td align="left" width="221" colspan="4" height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b> </b></font></td> </tr> <tr height="40"> <td colspan="4" align="center" bgcolor="#FFFFFF"><input type="submit" name="edit" value="แก้ไข" onClick="return checkFormat()"> <input type="reset" name="clear" value="เคลียร์ข้อมูล"> <input type="hidden" name="method" id="method" value="edit"> </td> </tr> <input type="hidden" name="deptId" id="deptId" value="<?php echo $deptId;?>"> <br> </table> <table width="550" border="0" cellspacing="0" cellpadding="1" align="center" > <tr> <td align="center" colspan="4" bgcolor="#FFFFFF" height="22"><a href="#" onClick="window.close()"><font size="1" face="Microsoft Sans Serif">[ปิดหน้าต่าง]</font></a></td> </tr> </table> </form> </body> </html> <?php $oC->Disconnect(); ?>
|