<?php

namespace common\models;

use Yii;

/**
 * This is the model class for view "lis_api_send".
 *
 * @property int $RiaHDocID
 * @property string $RiaHDocDate
 * @property string $LabID
 * @property string $LabName
 * @property string $CustID
 * @property int|null $status
 * @property string $PatHN
 * @property string $PatName
 * @property string|null $CustTitle
 *
 * // additional fields from your SELECT
 * @property string|null $RiaLDRsltAnal
 * @property string|null $LabNormal1
 * @property string|null $LabUnit
 * @property string|null $RiaLDUserNameReEntry
 * @property string|null $RiaLDUserDateReEntry
 * @property string|null $RiaLDUserNameAppr
 * @property string|null $RiaLDUserDateAppr
 * @property int|null $RiaLDApprvFlag
 */
class LisApiSend extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'lis_api_send'; // ชื่อ view
    }

    public static function getDb()
    {
        return Yii::$app->get('prolab');
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['RiaHDocID', 'LabID', 'LabName', 'CustID', 'PatHN', 'PatName'], 'required'],
            [['RiaHDocID', 'status', 'RiaLDApprvFlag'], 'integer'],
            [['RiaHDocDate', 'RiaLDUserDateEntry', 'RiaLDUserDateAppr'], 'safe'],
            [['LabID'], 'string', 'max' => 50],
            [['LabName', 'PatName', 'PatHN', 'CustID', 'CustTitle'], 'string', 'max' => 255],
            [['RiaLDRsltAnal', 'LabNormal1', 'LabUnit', 'RiaLDUserNameEntry', 'RiaLDUserNameAppr'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'RiaHDocID' => 'Doc ID',
            'RiaHDocDate' => 'Doc Date',
            'LabID' => 'Lab ID',
            'LabName' => 'Lab Name',
            'CustID' => 'Customer ID',
            'status' => 'Status',
            'PatHN' => 'HN',
            'PatName' => 'Patient Name',
            'CustTitle' => 'Customer Title',

            // additional labels
            'RiaLDRsltAnal' => 'Result Anal (RiaLDRsltAnal)',
            'LabNormal1' => 'Lab Normal 1',
            'LabUnit' => 'Lab Unit',
            'RiaLDUserNameEntry' => 'User Entry',
            'RiaLDUserDateEntry' => 'User Entry Date',
            'RiaLDUserNameAppr' => 'User Approver',
            'RiaLDUserDateAppr' => 'Approve Date',
            'RiaLDApprvFlag' => 'Approved Flag',
        ];
    }
}
