131 lines
6.5 KiB
PHP
131 lines
6.5 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
use yii\behaviors\TimestampBehavior;
|
|
|
|
/**
|
|
* This is the model class for table "handicapped".
|
|
*
|
|
* @property int $id
|
|
* @property string $title คำนำหน้า
|
|
* @property string $name ชื่อ นามสกุล
|
|
* @property string $bdate วัน/เดือน/ปีเกิด
|
|
* @property string $nation สัญชาติ
|
|
* @property string $status_marital สถานภาพ
|
|
* @property string $status_type ประเภทคนพิการ
|
|
* @property string $refer_contract บุคคลอ้างอิงที่สามารถติดต่อได้
|
|
* @property string $gov_welfare สถานภาพการรับสวัสดิการภาครัฐ
|
|
* @property string $jobs อาชีพ
|
|
* @property int $income_m รายได้ต่อเดือน
|
|
* @property string $get_training มีความประสงค์รับการฝึกอาชีพ
|
|
* @property string $get_money มีความประสงค์ขอรับเงินเบี้ยยังชัพความพิการ ประจำปีงบประมาณ พ.ศ. 256๕ โดยวิธีดังต่อไปนี้ (เลือก 1 วิธี)
|
|
* @property string $bank_type ธนาคาร
|
|
* @property string $bank_name ชื่อบัญชี
|
|
* @property int $bank_id เลขที่บัญชี
|
|
* @property string $id_card หมายเลขบัตรประชาชนผู้พิการ
|
|
* @property string|null $address ที่อยู่
|
|
* @property string $tel เบอร์โทรติดต่อ
|
|
* @property string|null $email E-mail
|
|
* @property string|null $topic เรื่องร้องเรียน
|
|
* @property string|null $description รายละเอียด
|
|
* @property string $process ข้าพเจ้าขอรับรองว่าข้อความข้างต้นเป็นความจริงทุกประการ
|
|
* @property string|null $files แนบหลักฐานร้องเรียน
|
|
* @property int|null $created_at เพิ่มเมื่อ
|
|
* @property int|null $updated_at แก้ไขเมื่อ
|
|
* @property int|null $status สถานะ
|
|
* @property string|null $proceed การดำเนินการ
|
|
* @property string|null $remark หมายเหตุ
|
|
*/
|
|
class Handicapped extends \yii\db\ActiveRecord
|
|
{
|
|
|
|
public $verifyCode;
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'handicapped';
|
|
}
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
TimestampBehavior::class,
|
|
];
|
|
}
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['title', 'name', 'bdate', 'nation', 'status_marital', 'status_type', 'refer_contract', 'gov_welfare', 'jobs', 'income_m', 'get_training', 'get_money', 'bank_type', 'bank_name', 'bank_id', 'id_card', 'tel', 'process'], 'required'],
|
|
[['bdate', 'nation', 'status_marital', 'status_type', 'refer_contract', 'gov_welfare', 'jobs', 'get_training', 'get_money', 'bank_type', 'bank_name', 'address', 'description', 'proceed', 'remark'], 'string'],
|
|
[['income_m', 'bank_id', 'created_at', 'updated_at', 'status'], 'integer'],
|
|
[['title', 'id_card'], 'string', 'max' => 45],
|
|
[['id_card'], 'validateIdCard'],
|
|
[['name', 'topic'], 'string', 'max' => 200],
|
|
[['tel', 'email', 'process'], 'string', 'max' => 100],
|
|
[['files'], 'string', 'max' => 500],
|
|
['verifyCode', 'captcha'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'title' => 'คำนำหน้า',
|
|
'name' => 'ชื่อ นามสกุล',
|
|
'bdate' => 'วัน/เดือน/ปีเกิด',
|
|
'nation' => 'สัญชาติ',
|
|
'status_marital' => 'สถานภาพ',
|
|
'status_type' => 'ประเภทคนพิการ',
|
|
'refer_contract' => 'บุคคลอ้างอิงที่สามารถติดต่อได้',
|
|
'gov_welfare' => 'สถานภาพการรับสวัสดิการภาครัฐ',
|
|
'jobs' => 'อาชีพ',
|
|
'income_m' => 'รายได้ต่อเดือน',
|
|
'get_training' => 'มีความประสงค์รับการฝึกอาชีพ',
|
|
'get_money' => 'มีความประสงค์ขอรับเงินเบี้ยยังชัพความพิการ ประจำปีงบประมาณ พ.ศ. 256๕ โดยวิธีดังต่อไปนี้ (เลือก 1 วิธี)',
|
|
'bank_type' => 'ธนาคาร',
|
|
'bank_name' => 'ชื่อบัญชี',
|
|
'bank_id' => 'เลขที่บัญชี',
|
|
'id_card' => 'หมายเลขบัตรประชาชนผู้พิการ',
|
|
'address' => 'ที่อยู่',
|
|
'tel' => 'เบอร์โทรติดต่อ',
|
|
'email' => 'E-mail',
|
|
'topic' => 'เรื่องร้องเรียน',
|
|
'description' => 'รายละเอียด',
|
|
'process' => 'ข้าพเจ้าขอรับรองว่าข้อความข้างต้นเป็นความจริงทุกประการ',
|
|
'files' => 'แนบหลักฐานร้องเรียน',
|
|
'created_at' => 'เพิ่มเมื่อ',
|
|
'updated_at' => 'แก้ไขเมื่อ',
|
|
'status' => 'สถานะ',
|
|
'proceed' => 'การดำเนินการ',
|
|
'remark' => 'หมายเหตุ',
|
|
];
|
|
}
|
|
|
|
public function validateIdCard()
|
|
{
|
|
$id = str_split(str_replace('-', '', $this->id_card));
|
|
$digi = 13;
|
|
|
|
$sum = 0;
|
|
foreach ($id as $key){
|
|
$digi > 1 ? $sum += intval($key) * $digi : null;
|
|
$digi--;
|
|
}
|
|
$n13 = (11 - ($sum % 11)) % 10;
|
|
|
|
if ($n13 != $id[12]) {
|
|
$this->addError('id_card', 'หมายเลขบัตรประชาชนของท่านไม่ถูกต้อง');
|
|
}
|
|
}
|
|
}
|