Viewing file: v_addPersonDepartment.php (8.62 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<script language="javascript"> function checkFormat(len) { var flag = true; var i = 0; //jQuery(":input[name='pdDptId\[\]']").each(function() { for(var i=0;i<len;i++){ var parent = jQuery(":input[name='pdDptId\["+i+"\]']").parents("td:first"); var obj = jQuery(":input[name='pdDptId\["+i+"\]']"); var pdDptIdOld = parent.find(":input[name='pdDptIdOld\["+i+"\]']").val(); var pdIsBoss = parent.next("td").find(":input[name='pdIsBoss\["+i+"\]']").attr("checked"); if (typeof(pdIsBoss) == 'undefined'|| pdIsBoss == false) pdIsBoss = false; else pdIsBoss = 1; var pdIsBossOld = parent.next("td").find(":input[name='pdIsBossOld\["+i+"\]']").val(); var pdFrDateOld = parent.next("td").next("td").find(":input[name='pdFrDateOld\["+i+"\]']").val(); var dd = parent.next("td").next("td").find(":input[name='dd\["+i+"\]']").val(); var mm = parent.next("td").next("td").find(":input[name='mm\["+i+"\]']").val(); var yy = parseInt(parent.next("td").next("td").find(":input[name='yy\["+i+"\]']").val())-543; var pdFrDate = dd+"/"+mm+"/"+yy; if (obj.val()) { if (!isDate(dd,mm,yy, "วันที่ไม่ถูกต้อง")) { obj.focus(); flag = false; } } if (pdDptIdOld && ((obj.val() != pdDptIdOld) || (obj.val() == pdDptIdOld && pdIsBoss != pdIsBossOld))) { if (!isvaliddate(pdFrDateOld,pdFrDate," วันที่เริ่มสังกัด ต้องมากกว่า "+pdFrDateOld)) { obj.focus(); flag = false; } } i++; }//); return flag; } function isvaliddate(txtStart, txtEnd, msg) { var retval = true; var ArrayStartDay = txtStart.split("/"); var ArrayStopDay = txtEnd.split("/"); var StartDay = ArrayStartDay[2] + ArrayStartDay[1] + ArrayStartDay[0]; var StopDay = ArrayStopDay[2] + ArrayStopDay[1] + ArrayStopDay[0]; if (StartDay >= StopDay) { alert(msg); retval = false; } return retval; }
function doChange() { var character = jQuery("#character").val(); sendPost('hidform', {'character':character}, 'pd_input'); } </script> <table width="100%" align="center"> <tr> <td> <div align="center"><table width="100%"> <tr> <td align="center"><span class="h" style="color:<?php echo $font_color_err;?>">กำหนดบุคลากรในหน่วยงานที่สังกัด</span></td> </tr> <tr> <td><br /></td> </tr> <tr> <td><b>ชื่อบุคลากร</b> <?php $js = "id=\"character\" onChange=\"doChange()\""; echo form_dropdown('character',$rs_character, $character, $js); ?> </td> </tr> <?php echo form_open($this->config->item("rg_folder")."officer/pd_insert_update", array('id' => 'myform', 'name' => 'myform'));?> <tr> <td><table class="headCol"> <tr> <th class="seqCol"><span>ลำดับที่</span></th> <th class="stdCodeCol"><span>รหัสบุคลากร</span></th> <th><span>ชื่อ-นามสกุลบุคลากร</span></th> <th class="domCol"><span>หน่วยงาน</span></th> <th class="seqCol"><span>หัวหน้า</span></th> <th class="domCol"><span>วันที่เริ่มสังกัด</span></th> <th class="deleteCol"><span>ลบ</span></th> </tr> <?php $i=0; $num_rows = count($rs); if ($num_rows) { $i=0; foreach ($rs as $key => $val) { $row_prs = $rs[$key]['qu_prs']->row(); $row_pd = isset($rs[$key]['qu_pd']) ? $rs[$key]['qu_pd']->row() : NULL;
$dd = getNowDay(); $mm = getNowMonth(); $yy = getNowYearTh(); if (getval('pdFrDate', $row_pd)) { list($yy, $mm, $dd) = preg_split('[-]', getval('pdFrDate', $row_pd)); $yy += 543; } echo "<tr onmouseover=\"bgColor='".$tr_color_even."'\" onmouseout=\"bgColor='".$this->config->item("rg_mouseout")."'\">"; ?> <td align="center"><span><?php echo $key + 1;?></span></td> <td align="center"><span><?php echo $row_prs->personCode;?></span> <input type="hidden" id="pdPrsId[<?=$i;?>]" name="pdPrsId[<?=$i;?>]" value="<?php echo $row_prs->prsId;?>" /> <input type="hidden" name="pdSeq[<?=$i;?>]" value="<?php echo getval('pdSeq', $row_pd);?>" /></td> <td class="indent"><span class="hand" onClick="sendPost('hidform1', {'prsId':<?php echo $row_prs->prsId;?>}, 'showDetailPd', {})"><?php echo $row_prs->name;?></span></td> <td align="center"> <?php $js = "id=\"pdDptId[".$i."]\""; echo form_dropdown('pdDptId['.$i.']', $rs_dpt, getval('pdDptId', $row_pd), $js); ?> <input type="hidden" name="pdDptIdOld[<?=$i;?>]" value="<?php echo getval('pdDptId', $row_pd);?>" /></td> <td align="center"><input type="checkbox" name="pdIsBoss[<?=$i;?>]" value="Y" <?php echo (getval('pdIsBoss', $row_pd) == 'Y') ? 'checked' : '';?>> <input type="hidden" name="pdIsBossOld[<?=$i;?>]" value="<?php echo (getval('pdIsBoss', $row_pd) == 'Y') ? true : false;?>"></td> <td align="center"><select name="dd[<?=$i;?>]"> <?php for ($x = 1; $x <= 31; $x++) { ?> <option value="<?php echo substr('0'.$x, -2);?>" <?php echo (substr('0'.$x, -2)==$dd) ? 'selected' : '';?>><?php echo substr('0'.$x, -2);?></option> <?php } ?> </select> <select name="mm[<?=$i;?>]"> <option value="01" <?php echo ($mm=='01') ? 'selected' : '';?>>ม.ค.</option> <option value="02" <?php echo ($mm=='02') ? 'selected' : '';?>>ก.พ.</option> <option value="03" <?php echo ($mm=='03') ? 'selected' : '';?>>มี.ค.</option> <option value="04" <?php echo ($mm=='04') ? 'selected' : '';?>>เม.ย.</option> <option value="05" <?php echo ($mm=='05') ? 'selected' : '';?>>พ.ค.</option> <option value="06" <?php echo ($mm=='06') ? 'selected' : '';?>>มิ.ย.</option> <option value="07" <?php echo ($mm=='07') ? 'selected' : '';?>>ก.ค.</option> <option value="08" <?php echo ($mm=='08') ? 'selected' : '';?>>ส.ค.</option> <option value="09" <?php echo ($mm=='09') ? 'selected' : '';?>>ก.ย.</option> <option value="10" <?php echo ($mm=='10') ? 'selected' : '';?>>ต.ค.</option> <option value="11" <?php echo ($mm=='11') ? 'selected' : '';?>>พ.ย.</option> <option value="12" <?php echo ($mm=='12') ? 'selected' : '';?>>ธ.ค.</option> </select> <input type="text" name="yy[<?=$i;?>]" value="<?php echo $yy;?>" size="4" maxlength="4" class="required-int" /> <input type="hidden" name="pdFrDateOld[<?=$i;?>]" value="<?php echo (getval('pdFrDate', $row_pd)) ? splitDateDb2(getval('pdFrDate', $row_pd), "/") : '';?>" /></td> <td align="center"><span class="hand" onClick="sendPost('hidform', {'pdPrsId':<?php echo $row_prs->prsId;?>,'pdSeq':'<?php echo getval('pdSeq', $row_pd);?>'}, 'pd_delete')" onClick='return confirmSubmit("คุณต้องการลบข้อมูลแน่นอนใช่หรือไม่ ?")'><img src="<?php echo base_url().$this->config->item('rg_delete');?>" width="16" height="19" align="absmiddle" border="0" /></span></td> </tr> <?php $i++; } } else { ?> <tr> <td colspan="7" align="center"><span style="color:<?php echo $font_color_err;?>">** ไม่ปรากฏรายการในฐานข้อมูล **</span></td> </tr> <?php } ?> </table></td> </tr> <tr> <td align="right"><font size="2">รวม <?php echo $num_rows;?> รายการ</font></td> </tr> <tr> <td colspan="2" align="center"><br><input type="submit" name="add" value="บันทึก" onClick="return checkFormat('<?echo $i;?>')"> <input type="reset" name="clear" value="เคลียร์ข้อมูล"> <input type="hidden" id="cnt" name="cnt" value="<?php echo $num_rows;?>"></td> </tr><?php echo form_close();?> </table></div> <br></td> </tr> <tr> <td><table class="mark"> <tr> <td class="coltd_mark"><span style="color:<?php echo $font_color_err;?>"><b>หมายเหตุ : </b></span></td> <td><span style="color:<?php echo $font_color_err;?>">หากมีการเปลี่ยนแปลงข้อมูล กรุณากดปุ่มบันทึกก่อนเปลี่ยนหน้าถัดไป</span></td> </tr> <tr> <td class="coltd_mark"></td> <td><span style="color:<?php echo $font_color_err;?>">ใช้เมาส์คลิกที่ชื่อ-นามสกุลบุคลากร เพื่อดูประวัติการสังกัดหน่วยงาน</span></td> </tr> </table></td> </tr> </table>
|