Viewing file:      v_addStudent.php (16.47 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 $row_std = (isset($qu_std) && $qu_std!=NULL) ? $qu_std->row() : NULL;
 $row_parent = (isset($qu_parent) && $qu_parent!=NULL) ? $qu_parent->row() : NULL;
 $row_cur = (isset($qu_cur) && $qu_cur!=NULL) ? $qu_cur->row() : NULL;
 $row_tm = (isset($qu_tm) && $qu_tm!=NULL) ? $qu_tm->row() : NULL;
 $row_sst = (isset($qu_sst) && $qu_sst!=NULL) ? $qu_sst->row() : NULL;
 $row_fs = (isset($qu_fs) && $qu_fs!=NULL) ? $qu_fs->row() : NULL;
 $row_so = (isset($qu_so) && $qu_so!=NULL) ? $qu_so->row() : NULL;
 $admitDate = (is_null($row_std) ? $tmcFrDate : abbreDate2($row_std->stdAdmitDate));
 ?>
 <SCRIPT language=JavaScript type="text/JavaScript">
 function checkId(){
     var data = document.getElementById('sdtCitizenId');
 
     if (data.value.length==13){
         for(i=0,sum=0;i<12;i++)
             sum += parseFloat(data.value.charAt(i))*(13-i);
             if((11-sum%11)%10!=parseFloat(data.value.charAt(12))){
                 alert('เลขบัตรประชาชนไม่ถูกต้อง กรุณาป้อนเลขบัตรประชาชนใหม่');
                 document.getElementById('sdtCitizenId').style.color = "red";
             }else{
                 document.getElementById('sdtCitizenId').style.color = "green";
             }
     }else{
         alert('เลขบัตรประชาชนไม่ครบ 13 หลัก');
     }
 }
 </SCRIPT>
 <table width="100%" align="center">
     <tr>
         <td><div align="center">
             <?php echo form_open($this->config->item("rg_folder")."student/std_insert_update", array("name" => "myform", "id" => "myform"));?>
             <table width="100%" border="0" cellspacing="1" cellpadding="1" align="center">
                 <tr>
                     <td colspan="6" align="center"><font class="h" size="3" color="<?php echo $font_color_err;?>"><b><?php echo (isset($type) && $type=='T') ? 'นำเข้าประวัตินักศึกษาเทียบเท่า/เทียบโอน' : 'เพิ่ม/แก้ไขนักศึกษาใหม่';?></b></font></td>
                 </tr>
                 <tr>
                     <td><br /></td>
                 </tr>
                 <tr>
                     <td><table class="szone">
 <?php
                         if(isset($stdCode) || $row_std!=NULL) {
 ?>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">รหัสประจำตัวนักศึกษา</td>
                             <td colspan="3"><input type="text" name="stdCode" id="stdCode" value="<?php echo ($row_std==NULL) ? set_value('stdCode',$stdCode) : setValue('stdCode',$row_std);?>" <?php echo ($addSpe!='') ? '' : 'class="input2" readonly';?> />
                             <input type="hidden" name="addSpe" id="addSpe" value="<?php echo $addSpe;?>" /></td>
                         </tr>
 <?php
                         } else if(isset($addSpe) && $addSpe) {
 ?>
                         <tr>
                             <td class="coltd_szone2">รหัสประจำตัวนักศึกษา</td>
                             <td colspan="3"></td>
                         </tr>
 <?php
                         }
 ?>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">ชื่อ-สกุล (ไทย)</td>
                             <td colspan="3">
 <?php
                             echo form_dropdown('stdPfId', $rs_pf, set_value('stdPfId',setValue('stdPfId', $row_std)));
 
 ?>
                             <input type="text" name="stdName" id="stdName" value="<?php echo set_value('stdName', setValue('stdName',$row_std));?>" size="20" maxlength="50" />
                             <input type="text" name="stdSurname" id="stdSurname" value="<?php echo set_value('stdSurname', setValue('stdSurname',$row_std));?>" size="20" maxlength="50" />
                             <span class="error">*<?php echo form_error('stdPfId') ? form_error('stdPfId') : (form_error('stdName') ? form_error('stdName') : form_error('stdSurname'));?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">เลขที่บัตรประจำตัวประชาชน</td>
                             <td colspan="3">
                             <input type="text" name="sdtCitizenId" id="sdtCitizenId" value="<?php echo set_value('sdtCitizenId',setValue('sdtCitizenId',$row_std));?>" onchange="checkId()" size="14" maxlength="13" />
 <?php
                             if(isset($stdCode) || $row_std!=NULL) {
 ?>
                             <input type="hidden" name="chkStdCode" id="chkStdCode" value="Y" readonly />
                             <span class="error">*</span>
 <?php
                             }
 ?>
                             <span class="error"><?php echo form_error('sdtCitizenId');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">หลักสูตร</td>
                             <td>
                             <input type="text" name="curName" id="curName" value="<?php echo setValue('curName',$row_cur);?>" size="40" class="input2" readonly />
                             <input type="hidden" name="curId" id="curId" value="<?php echo setValue('curId',$row_cur);?>" readonly /></td>
                             <td class="coltd_szone2">ระดับการศึกษา</td>
                             <td>
                             <input type="text" name="levelName" id="levelName" value="<?php echo setValue('levelName',$row_cur);?>" size="40" class="input2" readonly />
                             <input type="hidden" name="levelId" id="levelId" value="<?php echo setValue('levelId',$row_cur);?>" readonly />
                             <input type="hidden" name="genId" id="genId" value="<?php echo ($row_std==NULL) ? set_value('genId',$genId) : setValue('stdGenId',$row_std);?>" readonly />
                             </td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">ชื่อ-สกุลผู้ปกครอง (ไทย)</td>
                             <td colspan="3">
 <?php
                             echo form_dropdown('sdtPfIdParent', $rs_pf, set_value('sdtPfIdParent', setValue('sdtPfIdParent', $row_std)));
 ?>
                             <input type="text" name="sdtParentName" id="sdtParentName" value="<?php echo set_value('sdtParentName', setValue('sdtParentName',$row_std));?>" size="20" maxlength="50" />
                             <input type="text" name="sdtParentSurname" id="sdtParentSurname" value="<?php echo set_value('sdtParentSurname', setValue('sdtParentSurname',$row_std));?>" size="20" maxlength="50" /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">ความสัมพันธ์กับนักศึกษา</td>
                             <td colspan="3">
                             <input type="text" name="sdtParentRelationship" id="sdtParentRelationship" value="<?php echo set_value('sdtParentRelationship', setValue('sdtParentRelationship',$row_std));?>" size="20" maxlength="30" /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">ที่อยู่ผู้ปกครองที่สามารถติดต่อได้</td>
                             <td colspan="3">
                             <input type="text" name="sdtParentAddr" id="sdtParentAddr" value="<?php echo set_value('sdtParentAddr', setValue('sdtParentAddr',$row_std));?>" size="30" maxlength="70" /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">ตำบล</td>
                             <td>
                             <input type="text" name="dtNameParent" id="dtNameParent" value="<?php echo setValue('dtNameParent',$row_parent);?>" class="input2" readonly />
                             <input type="hidden" name="sdtDtIdParent" id="sdtDtIdParent" value="<?php echo setValue('sdtDtIdParent',$row_parent);?>" readonly /></td>
                             <td class="coltd_szone2">อำเภอ</td>
                             <td>
                             <input type="text" name="apNameParent" id="apNameParent" value="<?php echo setValue('apNameParent',$row_parent);?>" class="input2" readonly />
                             <input type="hidden" name="sdtApIdParent" id="sdtApIdParent" value="<?php echo setValue('sdtApIdParent',$row_parent);?>" readonly /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">จังหวัด</td>
                             <td>
                             <input type="text" name="prvNameParent" id="prvNameParent" value="<?php echo setValue('prvNameParent',$row_parent);?>" class="input2" readonly />
 <?php
                             echo anchor_popup($this->config->item("rg_folder")."popup/dtParent_popup", "<img src=\"".base_url().$this->config->item('rg_search')."\" width=\"15\" height=\"19\" align=\"absmiddle\" border=\"0\" />", array("width" => "550", "height" => "350"));
 ?>
                             <input type="hidden" name="sdtPrvIdParent" id="sdtPrvIdParent" value="<?php echo setValue('sdtPrvIdParent',$row_parent);?>" readonly />
                             </td>
                             <td class="coltd_szone2">รหัสไปรษณีย์</td>
                             <td><input type="text" name="sdtParentPostCode" id="sdtParentPostCode" value="<?php echo set_value('sdtParentPostCode', setValue('sdtParentPostCode',$row_std));?>" size="6" maxlength="5" class="required-int" />
                             <span class="error"><?php echo form_error('sdtParentPostCode');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">เบอร์โทรศัพท์บ้าน</td>
                             <td><input type="text" name="sdtParentPhoneNo" id="sdtParentPhoneNo" value="<?php echo set_value('sdtParentPhoneNo', setValue('sdtParentPhoneNo',$row_std));?>" size="11" maxlength="10" class="required-int"/>
                             <span class="error"><?php echo form_error('sdtParentPhoneNo');?></span></td>
                             <td class="coltd_szone2">เบอร์โทรศัพท์มือถือ</td>
                             <td><input type="text" name="sdtParentMobileNo" id="sdtParentMobileNo" value="<?php echo set_value('sdtParentMobileNo', setValue('sdtParentMobileNo',$row_std));?>" size="11" maxlength="10" class="required-int" />
                             <span class="error"><?php echo form_error('sdtParentMobileNo');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">อีเมล์ผู้ปกครอง</td>
                             <td colspan="3"><input type="text" name="sdtParentEmail" id="sdtParentEmail" value="<?php echo set_value('sdtParentEmail', setValue('sdtParentEmail',$row_std));?>" size="15" maxlength="30" /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">อาชีพผู้ปกครอง</td>
                             <td><input type="text" name="sdtParentOccupation" id="sdtParentOccupation" value="<?php echo set_value('sdtParentOccupation', setValue('sdtParentOccupation',$row_std));?>" size="15" maxlength="30" /></td>
                             <td class="coltd_szone2">รายได้ผู้ปกครอง</td>
                             <td><input type="text" name="sdtParentIncome" id="sdtParentIncome" value="<?php echo set_value('sdtParentIncome', setValue('sdtParentIncome',$row_std));?>" size="7" maxlength="6" class="required-int" /> บาท/เดือน
                             <span class="error"><?php echo form_error('sdtParentIncome');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">ปีการศึกษาที่เข้า</td>
                             <td><input type="text" name="adY" id="adY" value="<?php echo set_value('adY',$adY);?>" class="input2"/></td>
                             <td class="coltd_szone2">ภาคการศึกษาที่เข้า</td>
                             <td><input type="text" name="tmCode" id="tmCode" value="<?php echo setValue('tmCode',$row_tm);?>" class="input2" readonly />
                             <input type="hidden" name="tmId" id="tmId" value="<?php echo setValue('tmId',$row_tm);?>" readonly /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">วันที่รับเข้า</td>
                             <td><input type="text" name="stdAdmitDate" id="stdAdmitDate" value="<?php echo (is_null($row_std)) ? abbreDate2($tmcFrDate) : $admitDate;?>" class="input2" readonly />
                             <input type="hidden" name="admitDate" id="admitDate" value="<?php echo ($row_std==NULL) ? $tmcFrDate : setValue('stdAdmitDate',$row_std);?>" readonly /></td>
                             <td class="coltd_szone2">วันที่สิ้นสุดการเป็นนักศึกษา</td>
                             <td><input type="text" name="stdGraduateDate" id="stdGraduateDate" value="<?php echo ($row_std==NULL) ? abbreDate2($tmcToDate) : (setValue('stdGraduateDate',$row_std)=='0000-00-00' ? '-' : setValue('stdGraduateDate',$row_std));?>" class="input2" /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">ชั้นปีนักศึกษา</td>
                             <td><input type="text" name="syCode" id="syCode" value="<?php echo ($row_std==NULL) ? set_value('syCode',1) : setValue('syCode',$row_std);?>" class="input2" readonly />
                             <input type="hidden" name="syId" id="syId" value="<?php echo ($row_std==NULL) ? set_value('syId',1) : setValue('syId',$row_std);?>" readonly /></td>
                             <td class="coltd_szone2">ประเภททุน</td>
                             <td>
 <?php
                             echo form_dropdown('stdEtId', $rs_et, setValue('stdEtId', $row_std));
 ?>
                             <font size="2" color="<?php echo $font_color_err;?>">*</font></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">เจ้าของทุน</td>
                             <td><input type="text" name="soName" id="soName" value="<?php echo setValue('soName',$row_so);?>" class="input2" size="30" readonly />
                             <input type="hidden" name="stdSoId" id="stdSoId" value="<?php echo setValue('stdSoId',$row_so);?>" readonly /></td>
                             <td class="coltd_szone2">จังหวัดเจ้าของทุน</td>
                             <td>
                             <input type="text" name="prvNameSo" id="prvNameSo" value="<?php echo setValue('prvNameSo',$row_so);?>" class="input2" readonly />
 <?php
                             echo anchor_popup($this->config->item("rg_folder")."popup/so_popup", "<img src=\"".base_url().$this->config->item('rg_search')."\" width=\"15\" height=\"19\" align=\"absmiddle\" border=\"0\" />", array("width" => "500", "height" => "400"));
 ?>
                             <font size="2" color="<?php echo $font_color_err;?>">*</font>
                             <br /><?php echo form_error('stdSoId');?></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">สถานะของนักศึกษา</td>
                             <td><input type="text" name="sstName" id="sstName" value="<?php echo ($row_std==NULL) ? setValue('sstName',$row_sst) : setValue('sstName',$row_std);?>" class="input2" readonly />
                             <input type="hidden" name="sstId" id="sstId" value="<?php echo ($row_std==NULL) ? setValue('sstId',$row_sst) : setValue('sstId',$row_std);?>" readonly /></td>
                             <td class="coltd_szone2">สถานะทางการเงิน</td>
                             <td><input type="text" name="fsName" id="fsName" value="<?php echo ($row_std==NULL) ? setValue('fsName',$row_fs) : setValue('fsName',$row_std);?>"  class="input2" readonly />
                             <input type="hidden" name="fsId" id="fsId" value="<?php echo ($row_std==NULL) ? setValue('fsId',$row_fs) : setValue('fsId',$row_std);?>" readonly /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">สถานะ/ตำแหน่งก่อนเข้าเรียน</td>
                             <td>
 <?php
                             echo form_dropdown('stdPaId', $rs_pa, set_value('stdPaId', setValue('stdPaId', $row_std)));
 ?>
                             </td>
                             <td class="coltd_szone2">สิทธิการเบิกค่าเล่าเรียน</td>
                             <td><input type="radio" id="sdtCanRefund" name="sdtCanRefund" value="Y" <?php echo ((setValue('sdtCanRefund',$row_std)!='N') ? 'checked' : '');?> /> มี
                             <input type="radio" id="sdtCanRefund" name="sdtCanRefund" value="N" <?php echo ((setValue('sdtCanRefund',$row_std)=='N') ? 'checked' : '');?> /> ไม่มี</td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone2">สิทธิการรักษาพยาบาล</td>
                             <td colspan="3">
 <?php
                             echo form_dropdown('sdtHpId', $rs_hp, set_value('sdtHpId', setValue('sdtHpId', $row_std)));
 ?>
                             </td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td colspan="4" align="center">
                             <input type="submit" name="add" id="add" value="บันทึก" />
                             <input type="reset" name="clear" id="clear" value="เคลียร์ข้อมูล" />
                             <input type="button" name="back" id="back" value="ย้อนกลับ" onClick="location.href='<?php echo site_url().$this->config->item("rg_folder")."student/std_show";?>'" />
                             <input type="hidden" name="stdId" id="stdId" value="<?php echo setValue('stdId',$row_std);?>" />
                             <input type="hidden" name="type" id="type" value="<?php echo set_value('type',$type);?>" /></td>
                         </tr>
                     </table></td>
                 </tr>
             </table><?php echo form_close();?></div>
         <br><font size="2" color="<?php echo $font_color_err;?>"><b>หมายเหตุ : </b>* หมายถึง ต้องกรอกข้อมูลให้สมบูรณ์</font></td>
     </tr>
 </table>
  |