<?php

namespace modules\forms\models;


use Yii;
use modules\activities\models\Activities;
use modules\custom\models\Accounts;
use modules\users\models\User;
use yii\base\Model;
/**
 * This is the model class For table "dt204".
 *
 * @property string $id
 * @property integer $created_at
 * @property integer $updated_at
 * @property string $created_by
 * @property string $updated_by
 * @property string $actid
 * @property string $location
 * @property string $pointno
 * @property integer $dateinspected
 * @property string $nr4swgno
 * @property string $elr
 * @property string $trackid
 * @property string $mileageattoes
 * @property string $switchrailradius
 * @property string $switchsize
 * @property string $tp8no
 * @property string $switchweargaugeno
 * @property string $swtichdesign
 * @property integer $premiumrail
 * @property string $lhgaptoe
 * @property string $lhgap2
 * @property string $lhgap3
 * @property string $lhgap4
 * @property string $lhgap5
 * @property string $lhgap6
 * @property string $lhgap7
 * @property string $lhgap8
 * @property string $lhgap9
 * @property string $lhgap10
 * @property string $rhgaptoe
 * @property string $rhgap2
 * @property string $rhgap3
 * @property string $rhgap4
 * @property string $rhgap5
 * @property string $rhgap6
 * @property string $rhgap7
 * @property string $rhgap8
 * @property string $rhgap9
 * @property string $rhgap10
 * @property integer $vi1lh
 * @property integer $vi1rh
 * @property integer $vi2lh
 * @property integer $vi2rh
 * @property integer $vi3lh
 * @property integer $vi3rh
 * @property integer $vi4lh
 * @property integer $vi4rh
 * @property integer $vi5lh
 * @property integer $vi5rh
 * @property integer $vi6lh
 * @property integer $vi6rh
 * @property integer $vi7lh
 * @property integer $vi7rh
 * @property integer $vi8lh
 * @property integer $vi8rh
 * @property integer $vi9lh
 * @property integer $vi9rh
 * @property integer $i10lh
 * @property integer $vi10rh
 * @property integer $vi11lh
 * @property integer $vi11rh
 * @property integer $vi12lh
 * @property integer $vi12rh
 * @property integer $vi13lh
 * @property integer $vi13rh
 * @property integer $vi14lh
 * @property integer $vi14rh
 * @property integer $vi15lh
 * @property integer $vi15rh
 * @property integer $vi16lh
 * @property integer $vi16rh
 * @property integer $vi17lh
 * @property integer $vi17rh
 * @property integer $vi18lh
 * @property integer $vi18rh
 * @property integer $srwilh1
 * @property string $srwilh1reading
 * @property integer $srwirh1
 * @property string $srwirh1reading
 * @property integer $srwilh2
 * @property string $srwilh2reading
 * @property integer $srwirh2
 * @property string $srwirh2reading
 * @property integer $srwilh3
 * @property string $srwilh3reading
 * @property integer $srwirh3
 * @property string $srwirh3reading
 * @property integer $srwilh4
 * @property string $srwilh4reading
 * @property integer $srwirh4
 * @property string $srwirh4reading
 * @property integer $srwilh5
 * @property string $srwilh5reading
 * @property integer $srwirh5
 * @property string $srwirh5reading
 * @property integer $srwilh6
 * @property string $srwilh6reading
 * @property integer $srwirh6
 * @property string $srwirh6reading
 * @property integer $srrelh1
 * @property integer $srrerh1
 * @property integer $srrelh2
 * @property integer $srrerh3
 * @property integer $fcailh1
 * @property integer $fcairh1
 * @property integer $fcailh2
 * @property integer $fcairh2
 * @property integer $fcailh3
 * @property integer $fcairh3
 * @property integer $fcailh4
 * @property integer $fcairh4
 * @property integer $ssrwdilh1
 * @property integer $ssrwdirh1
 * @property integer $ssrwdilh2
 * @property integer $ssrwdirh3
 * @property integer $allswlh1
 * @property integer $allswrh1
 * @property integer $allswlh2
 * @property integer $allswrh2
 * @property integer $allswlh3
 * @property integer $allswrh3
 * @property integer $allswlh4
 * @property integer $allswrh4
 * @property integer $allswlh5
 * @property integer $allswrh5
 * @property integer $allswlh6
 * @property integer $allswrh6
 * @property integer $allswlh7
 * @property integer $allswrh7
 * @property integer $allswlh8
 * @property integer $allswrh8
 * @property integer $allswlh9
 * @property integer $allswrh9
 * @property string $tconditions
 * @property string $icinspectorname
 * @property string $icinspectorsign
 * @property integer $icinspectordate
 * @property string $icsmtname
 * @property string $icsmtsign
 * @property integer $icsmtdate
 * @property string $rwiactions
 * @property string $defectrdms
 * @property string $rwismtname
 * @property string $rwismtsign
 * @property integer $rwismtdate
 * @property string $rwitmesign
 * @property integer $rwitmedate
 * @property string $rwischname
 * @property string $rwischsign
 * @property integer $rwischdate
 */
class Dt204 extends Model {

    public $dates = ['created_at', 'updated_at', 'deleted_at'];
	public $uniqueidentifiers = ['actid'];
    public $securefields = [];
    public $id;
    public $created_at;
    public $updated_at;
    public $created_by;
    public $updated_by;
    public $actid;
    public $location;
    public $pointno;
    public $dateinspected;
    public $nr4swgno;
    public $elr;
    public $trackid;
    public $mileageattoes;
    public $switchrailradius;
    public $switchsize;
    public $tp8no;
    public $switchweargaugeno;
    public $swtichdesign;
    public $premiumrail;
    public $lhgaptoe;
    public $lhgap2;
    public $lhgap3;
    public $lhgap4;
    public $lhgap5;
    public $lhgap6;
    public $lhgap7;
    public $lhgap8;
    public $lhgap9;
    public $lhgap10;
    public $rhgaptoe;
    public $rhgap2;
    public $rhgap3;
    public $rhgap4;
    public $rhgap5;
    public $rhgap6;
    public $rhgap7;
    public $rhgap8;
    public $rhgap9;
    public $rhgap10;
    public $vi1lh;
    public $vi1rh;
    public $vi2lh;
    public $vi2rh;
    public $vi3lh;
    public $vi3rh;
    public $vi4lh;
    public $vi4rh;
    public $vi5lh;
    public $vi5rh;
    public $vi6lh;
    public $vi6rh;
    public $vi7lh;
    public $vi7rh;
    public $vi8lh;
    public $vi8rh;
    public $vi9lh;
    public $vi9rh;
    public $i10lh;
    public $vi10rh;
    public $vi11lh;
    public $vi11rh;
    public $vi12lh;
    public $vi12rh;
    public $vi13lh;
    public $vi13rh;
    public $vi14lh;
    public $vi14rh;
    public $vi15lh;
    public $vi15rh;
    public $vi16lh;
    public $vi16rh;
    public $vi17lh;
    public $vi17rh;
    public $vi18lh;
    public $vi18rh;
    public $srwilh1;
    public $srwilh1reading;
    public $srwirh1;
    public $srwirh1reading;
    public $srwilh2;
    public $srwilh2reading;
    public $srwirh2;
    public $srwirh2reading;
    public $srwilh3;
    public $srwilh3reading;
    public $srwirh3;
    public $srwirh3reading;
    public $srwilh4;
    public $srwilh4reading;
    public $srwirh4;
    public $srwirh4reading;
    public $srwilh5;
    public $srwilh5reading;
    public $srwirh5;
    public $srwirh5reading;
    public $srwilh6;
    public $srwilh6reading;
    public $srwirh6;
    public $srwirh6reading;
    public $srrelh1;
    public $srrerh1;
    public $srrelh2;
    public $srrerh3;
    public $fcailh1;
    public $fcairh1;
    public $fcailh2;
    public $fcairh2;
    public $fcailh3;
    public $fcairh3;
    public $fcailh4;
    public $fcairh4;
    public $ssrwdilh1;
    public $ssrwdirh1;
    public $ssrwdilh2;
    public $ssrwdirh3;
    public $allswlh1;
    public $allswrh1;
    public $allswlh2;
    public $allswrh2;
    public $allswlh3;
    public $allswrh3;
    public $allswlh4;
    public $allswrh4;
    public $allswlh5;
    public $allswrh5;
    public $allswlh6;
    public $allswrh6;
    public $allswlh7;
    public $allswrh7;
    public $allswlh8;
    public $allswrh8;
    public $allswlh9;
    public $allswrh9;
    public $tconditions;
    public $icinspectorname;
    public $icinspectorsign;
    public $icinspectordate;
    public $icsmtname;
    public $icsmtsign;
    public $icsmtdate;
    public $rwiactions;
    public $defectrdms;
    public $rwismtname;
    public $rwismtsign;
    public $rwismtdate;
    public $rwitmesign;
    public $rwitmedate;
    public $rwischname;
    public $rwischsign;
    public $rwischdate;
    public $risk;
    public $itii;
    public $itpwii;
    public $itfui;
    public $allswlh10;
    public $allswlh11;
    public $allswrh10;
    public $allswrh11;
    public $rwitmename;


        
    public $direction;
    public $deleted_by;
    public $deleted_at;
    public $relatedid;
    public $deleted;
    public $jobno;
    public $padno;
    public $status;
    public $client;


    public $form = 'dt204';
    public $formname = 'Switch Inspection Form (DT204)';
    public $formType = 'Grinding';
    
    public $formLayout = '/dt204/_form.php';
    public $viewLayout = '@modules/forms/views/dt204/_view.php';
    public $createpath = '/forms/dt204/create';
    public $printlayout = 'Portrait';

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'created_by', 'updated_by', 'actid', 'location', 'pointno', 'nr4swgno', 'elr', 'trackid', 'mileageattoes', 'switchrailradius', 'switchsize', 'tp8no', 'switchweargaugeno', 'swtichdesign', 'lhgaptoe', 'lhgap2', 'lhgap3', 'lhgap4', 'lhgap5', 'lhgap6', 'lhgap7', 'lhgap8', 'lhgap9', 'lhgap10', 'rhgaptoe', 'rhgap2', 'rhgap3', 'rhgap4', 'rhgap5', 'rhgap6', 'rhgap7', 'rhgap8', 'rhgap9', 'rhgap10', 'srwilh1reading', 'srwirh1reading', 'srwilh2reading', 'srwirh2reading', 'srwilh3reading', 'srwirh3reading', 'srwilh4reading', 'srwirh4reading', 'srwilh5reading', 'srwirh5reading', 'srwilh6reading', 'srwirh6reading', 'tconditions', 'icinspectorname', 'icinspectorsign', 'icsmtname', 'icsmtsign', 'rwiactions', 'defectrdms', 'rwismtname', 'rwismtsign', 'rwitmesign', 'rwitmename', 'rwischname', 'rwischsign', 'client'], 'string'],
            [[ 'premiumrail', 'vi1lh', 'vi1rh', 'vi2lh', 'vi2rh', 'vi3lh', 'vi3rh', 'vi4lh', 'vi4rh', 'vi5lh', 'vi5rh', 'vi6lh', 'vi6rh', 'vi7lh', 'vi7rh', 'vi8lh', 'vi8rh', 'vi9lh', 'vi9rh', 'i10lh', 'vi10rh', 'vi11lh', 'vi11rh', 'vi12lh', 'vi12rh', 'vi13lh', 'vi13rh', 'vi14lh', 'vi14rh', 'vi15lh', 'vi15rh', 'vi16lh', 'vi16rh', 'vi17lh', 'vi17rh', 'vi18lh', 'vi18rh', 'srwilh1', 'srwirh1', 'srwilh2', 'srwirh2', 'srwilh3', 'srwirh3', 'srwilh4', 'srwirh4', 'srwilh5', 'srwirh5', 'srwilh6', 'srwirh6', 'srrelh1', 'srrerh1', 'srrelh2', 'srrerh3', 'fcailh1', 'fcairh1', 'fcailh2', 'fcairh2', 'fcailh3', 'fcairh3', 'fcailh4', 'fcairh4', 'ssrwdilh1', 'ssrwdirh1', 'ssrwdilh2', 'ssrwdirh3', 'allswlh1', 'allswrh1', 'allswlh2', 'allswrh2', 'allswlh3', 'allswrh3', 'allswlh4', 'allswrh4', 'allswlh5', 'allswrh5', 'allswlh6', 'allswrh6', 'allswlh7', 'allswrh7', 'allswlh8', 'allswrh8', 'allswlh9', 'allswrh9', ], 'integer'],
            [['allswlh10', 'allswrh10','allswlh11','allswrh11','itii','itpwii','itfui'],'boolean'],
        	[['rwitmedate', 'icinspectordate', 'icsmtdate', 'rwismtdate', 'rwischdate', 'dateinspected','created_at', 'updated_at'], 'safe'],
        	[['risk'], 'boolean'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attribute()
    {
        return [
            'id' => 'id',
            'created_at' => 'created_at',
            'updated_at' => 'updated_at',
            'created_by' => 'created_by',
            'updated_by' => 'updated_by',
            'actid' => 'actid',
            'location' => 'location',
            'pointno' => 'pointno',
            'dateinspected' => 'dateinspected',
            'nr4swgno' => 'nr4swgno',
            'elr' => 'elr',
            'trackid' => 'trackid',
            'mileageattoes' => 'mileageattoes',
            'switchrailradius' => 'switchrailradius',
            'switchsize' => 'switchsize',
            'tp8no' => 'tp8no',
            'switchweargaugeno' => 'switchweargaugeno',
            'swtichdesign' => 'swtichdesign',
            'premiumrail' => 'premiumrail',
            'lhgaptoe' => 'lhgaptoe',
            'lhgap2' => 'lhgap2',
            'lhgap3' => 'lhgap3',
            'lhgap4' => 'lhgap4',
            'lhgap5' => 'lhgap5',
            'lhgap6' => 'lhgap6',
            'lhgap7' => 'lhgap7',
            'lhgap8' => 'lhgap8',
            'lhgap9' => 'lhgap9',
            'lhgap10' => 'lhgap10',
            'rhgaptoe' => 'rhgaptoe',
            'rhgap2' => 'rhgap2',
            'rhgap3' => 'rhgap3',
            'rhgap4' => 'rhgap4',
            'rhgap5' => 'rhgap5',
            'rhgap6' => 'rhgap6',
            'rhgap7' => 'rhgap7',
            'rhgap8' => 'rhgap8',
            'rhgap9' => 'rhgap9',
            'rhgap10' => 'rhgap10',
            'vi1lh' => 'vi1lh',
            'vi1rh' => 'vi1rh',
            'vi2lh' => 'vi2lh',
            'vi2rh' => 'vi2rh',
            'vi3lh' => 'vi3lh',
            'vi3rh' => 'vi3rh',
            'vi4lh' => 'vi4lh',
            'vi4rh' => 'vi4rh',
            'vi5lh' => 'vi5lh',
            'vi5rh' => 'vi5rh',
            'vi6lh' => 'vi6lh',
            'vi6rh' => 'vi6rh',
            'vi7lh' => 'vi7lh',
            'vi7rh' => 'vi7rh',
            'vi8lh' => 'vi8lh',
            'vi8rh' => 'vi8rh',
            'vi9lh' => 'vi9lh',
            'vi9rh' => 'vi9rh',
            'i10lh' => 'i10lh',
            'vi10rh' => 'vi10rh',
            'vi11lh' => 'vi11lh',
            'vi11rh' => 'vi11rh',
            'vi12lh' => 'vi12lh',
            'vi12rh' => 'vi12rh',
            'vi13lh' => 'vi13lh',
            'vi13rh' => 'vi13rh',
            'vi14lh' => 'vi14lh',
            'vi14rh' => 'vi14rh',
            'vi15lh' => 'vi15lh',
            'vi15rh' => 'vi15rh',
            'vi16lh' => 'vi16lh',
            'vi16rh' => 'vi16rh',
            'vi17lh' => 'vi17lh',
            'vi17rh' => 'vi17rh',
            'vi18lh' => 'vi18lh',
            'vi18rh' => 'vi18rh',
            'srwilh1' => 'srwilh1',
            'srwilh1reading' => 'srwilh1reading',
            'srwirh1' => 'srwirh1',
            'srwirh1reading' => 'srwirh1reading',
            'srwilh2' => 'srwilh2',
            'srwilh2reading' => 'srwilh2reading',
            'srwirh2' => 'srwirh2',
            'srwirh2reading' => 'srwirh2reading',
            'srwilh3' => 'srwilh3',
            'srwilh3reading' => 'srwilh3reading',
            'srwirh3' => 'srwirh3',
            'srwirh3reading' => 'srwirh3reading',
            'srwilh4' => 'srwilh4',
            'srwilh4reading' => 'srwilh4reading',
            'srwirh4' => 'srwirh4',
            'srwirh4reading' => 'srwirh4reading',
            'srwilh5' => 'srwilh5',
            'srwilh5reading' => 'srwilh5reading',
            'srwirh5' => 'srwirh5',
            'srwirh5reading' => 'srwirh5reading',
            'srwilh6' => 'srwilh6',
            'srwilh6reading' => 'srwilh6reading',
            'srwirh6' => 'srwirh6',
            'srwirh6reading' => 'srwirh6reading',
            'srrelh1' => 'srrelh1',
            'srrerh1' => 'srrerh1',
            'srrelh2' => 'srrelh2',
            'srrerh3' => 'srrerh3',
            'fcailh1' => 'fcailh1',
            'fcairh1' => 'fcairh1',
            'fcailh2' => 'fcailh2',
            'fcairh2' => 'fcairh2',
            'fcailh3' => 'fcailh3',
            'fcairh3' => 'fcairh3',
            'fcailh4' => 'fcailh4',
            'fcairh4' => 'fcairh4',
            'ssrwdilh1' => 'ssrwdilh1',
            'ssrwdirh1' => 'ssrwdirh1',
            'ssrwdilh2' => 'ssrwdilh2',
            'ssrwdirh3' => 'ssrwdirh3',
            'allswlh1' => 'allswlh1',
            'allswrh1' => 'allswrh1',
            'allswlh2' => 'allswlh2',
            'allswrh2' => 'allswrh2',
            'allswlh3' => 'allswlh3',
            'allswrh3' => 'allswrh3',
            'allswlh4' => 'allswlh4',
            'allswrh4' => 'allswrh4',
            'allswlh5' => 'allswlh5',
            'allswrh5' => 'allswrh5',
            'allswlh6' => 'allswlh6',
            'allswrh6' => 'allswrh6',
            'allswlh7' => 'allswlh7',
            'allswrh7' => 'allswrh7',
            'allswlh8' => 'allswlh8',
            'allswrh8' => 'allswrh8',
            'allswlh9' => 'allswlh9',
            'allswrh9' => 'allswrh9',
            'tconditions' => 'tconditions',
            'icinspectorname' => 'icinspectorname',
            'icinspectorsign' => 'icinspectorsign',
            'icinspectordate' => 'icinspectordate',
            'icsmtname' => 'icsmtname',
            'icsmtsign' => 'icsmtsign',
            'icsmtdate' => 'icsmtdate',
            'rwiactions' => 'rwiactions',
            'defectrdms' => 'defectrdms',
            'rwismtname' => 'rwismtname',
            'rwismtsign' => 'rwismtsign',
            'rwismtdate' => 'rwismtdate',
            'rwitmesign' => 'rwitmesign',
            'rwitmedate' => 'rwitmedate',
            'rwischname' => 'rwischname',
            'rwischsign' => 'rwischsign',
            'rwischdate' => 'rwischdate',
            'risk' => 'risk',
            'itii' => 'itii',
            'itpwii' => 'itpwii',
            'itfui' => 'itfui',
            'allswlh10' => 'allswlh10',
            'allswlh11' => 'allswlh11',
            'allswrh10' => 'allswrh10',
            'allswrh11' => 'allswrh11',
            'rwitmename' => 'rwitmename'
        ];
    }
    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'created_by' => 'Created By',
            'updated_by' => 'Updated By',
            'actid' => 'Actid',
            'location' => 'Location',
            'pointno' => 'Pointno',
            'dateinspected' => 'Dateinspected',
            'nr4swgno' => 'Nr4swgno',
            'elr' => 'Elr',
            'trackid' => 'Trackid',
            'mileageattoes' => 'Mileageattoes',
            'switchrailradius' => 'Switchrailradius',
            'switchsize' => 'Switchsize',
            'tp8no' => 'Tp8no',
            'switchweargaugeno' => 'Switchweargaugeno',
            'swtichdesign' => 'Swtichdesign',
            'premiumrail' => 'Premiumrail',
            'lhgaptoe' => 'Lhgaptoe',
            'lhgap2' => 'Lhgap2',
            'lhgap3' => 'Lhgap3',
            'lhgap4' => 'Lhgap4',
            'lhgap5' => 'Lhgap5',
            'lhgap6' => 'Lhgap6',
            'lhgap7' => 'Lhgap7',
            'lhgap8' => 'Lhgap8',
            'lhgap9' => 'Lhgap9',
            'lhgap10' => 'Lhgap10',
            'rhgaptoe' => 'Rhgaptoe',
            'rhgap2' => 'Rhgap2',
            'rhgap3' => 'Rhgap3',
            'rhgap4' => 'Rhgap4',
            'rhgap5' => 'Rhgap5',
            'rhgap6' => 'Rhgap6',
            'rhgap7' => 'Rhgap7',
            'rhgap8' => 'Rhgap8',
            'rhgap9' => 'Rhgap9',
            'rhgap10' => 'Rhgap10',
            'vi1lh' => 'Vi1lh',
            'vi1rh' => 'Vi1rh',
            'vi2lh' => 'Vi2lh',
            'vi2rh' => 'Vi2rh',
            'vi3lh' => 'Vi3lh',
            'vi3rh' => 'Vi3rh',
            'vi4lh' => 'Vi4lh',
            'vi4rh' => 'Vi4rh',
            'vi5lh' => 'Vi5lh',
            'vi5rh' => 'Vi5rh',
            'vi6lh' => 'Vi6lh',
            'vi6rh' => 'Vi6rh',
            'vi7lh' => 'Vi7lh',
            'vi7rh' => 'Vi7rh',
            'vi8lh' => 'Vi8lh',
            'vi8rh' => 'Vi8rh',
            'vi9lh' => 'Vi9lh',
            'vi9rh' => 'Vi9rh',
            'i10lh' => 'I10lh',
            'vi10rh' => 'Vi10rh',
            'vi11lh' => 'Vi11lh',
            'vi11rh' => 'Vi11rh',
            'vi12lh' => 'Vi12lh',
            'vi12rh' => 'Vi12rh',
            'vi13lh' => 'Vi13lh',
            'vi13rh' => 'Vi13rh',
            'vi14lh' => 'Vi14lh',
            'vi14rh' => 'Vi14rh',
            'vi15lh' => 'Vi15lh',
            'vi15rh' => 'Vi15rh',
            'vi16lh' => 'Vi16lh',
            'vi16rh' => 'Vi16rh',
            'vi17lh' => 'Vi17lh',
            'vi17rh' => 'Vi17rh',
            'vi18lh' => 'Vi18lh',
            'vi18rh' => 'Vi18rh',
            'srwilh1' => 'Srwilh1',
            'srwilh1reading' => 'Srwilh1reading',
            'srwirh1' => 'Srwirh1',
            'srwirh1reading' => 'Srwirh1reading',
            'srwilh2' => 'Srwilh2',
            'srwilh2reading' => 'Srwilh2reading',
            'srwirh2' => 'Srwirh2',
            'srwirh2reading' => 'Srwirh2reading',
            'srwilh3' => 'Srwilh3',
            'srwilh3reading' => 'Srwilh3reading',
            'srwirh3' => 'Srwirh3',
            'srwirh3reading' => 'Srwirh3reading',
            'srwilh4' => 'Srwilh4',
            'srwilh4reading' => 'Srwilh4reading',
            'srwirh4' => 'Srwirh4',
            'srwirh4reading' => 'Srwirh4reading',
            'srwilh5' => 'Srwilh5',
            'srwilh5reading' => 'Srwilh5reading',
            'srwirh5' => 'Srwirh5',
            'srwirh5reading' => 'Srwirh5reading',
            'srwilh6' => 'Srwilh6',
            'srwilh6reading' => 'Srwilh6reading',
            'srwirh6' => 'Srwirh6',
            'srwirh6reading' => 'Srwirh6reading',
            'srrelh1' => 'Srrelh1',
            'srrerh1' => 'Srrerh1',
            'srrelh2' => 'Srrelh2',
            'srrerh3' => 'Srrerh3',
            'fcailh1' => 'Fcailh1',
            'fcairh1' => 'Fcairh1',
            'fcailh2' => 'Fcailh2',
            'fcairh2' => 'Fcairh2',
            'fcailh3' => 'Fcailh3',
            'fcairh3' => 'Fcairh3',
            'fcailh4' => 'Fcailh4',
            'fcairh4' => 'Fcairh4',
            'ssrwdilh1' => 'Ssrwdilh1',
            'ssrwdirh1' => 'Ssrwdirh1',
            'ssrwdilh2' => 'Ssrwdilh2',
            'ssrwdirh3' => 'Ssrwdirh3',
            'allswlh1' => 'Allswlh1',
            'allswrh1' => 'Allswrh1',
            'allswlh2' => 'Allswlh2',
            'allswrh2' => 'Allswrh2',
            'allswlh3' => 'Allswlh3',
            'allswrh3' => 'Allswrh3',
            'allswlh4' => 'Allswlh4',
            'allswrh4' => 'Allswrh4',
            'allswlh5' => 'Allswlh5',
            'allswrh5' => 'Allswrh5',
            'allswlh6' => 'Allswlh6',
            'allswrh6' => 'Allswrh6',
            'allswlh7' => 'Allswlh7',
            'allswrh7' => 'Allswrh7',
            'allswlh8' => 'Allswlh8',
            'allswrh8' => 'Allswrh8',
            'allswlh9' => 'Allswlh9',
            'allswrh9' => 'Allswrh9',
            'tconditions' => 'Tconditions',
            'icinspectorname' => 'Icinspectorname',
            'icinspectorsign' => 'Icinspectorsign',
            'icinspectordate' => 'Icinspectordate',
            'icsmtname' => 'Icsmtname',
            'icsmtsign' => 'Icsmtsign',
            'icsmtdate' => 'Icsmtdate',
            'rwiactions' => 'Rwiactions',
            'defectrdms' => 'Defectrdms',
            'rwismtname' => 'Rwismtname',
            'rwismtsign' => 'Rwismtsign',
            'rwismtdate' => 'Rwismtdate',
            'rwitmesign' => 'Rwitmesign',
            'rwitmedate' => 'Rwitmedate',
            'rwischname' => 'Rwischname',
            'rwischsign' => 'Rwischsign',
            'rwischdate' => 'Rwischdate',
        ];
    }

    public function beforeValidate() {
		if (Yii::$app->controller->id != 'sync') {
 			if ($this->rwitmedate) {$this->rwitmedate = strtotime(str_replace('/', '-',$this->rwitmedate));}
 			if ($this->icinspectordate) {$this->icinspectordate = strtotime(str_replace('/', '-',$this->icinspectordate));}
 			if ($this->rwismtdate) {$this->rwismtdate = strtotime(str_replace('/', '-',$this->rwismtdate));}
 			if ($this->rwischdate) {$this->rwischdate = strtotime(str_replace('/', '-',$this->rwischdate));}
 			if ($this->dateinspected) {$this->dateinspected = strtotime(str_replace('/', '-',$this->dateinspected));}
 			if ($this->icsmtdate) {$this->icsmtdate = strtotime(str_replace('/', '-',$this->icsmtdate));}
            $this->padno = $this->padno == null ? User::Padno() : $this->padno;
             
 			return parent::beforeValidate();
		} else {
    		return parent::beforeValidate();
			
		}
	}
	public function getActivity() {
		return Activities::findOne(['id' => $this->actid]);
	}	
	public function getAct() {
		return Activities::findOne(['id' => $this->actid]);
    }

    public function init()
    {
        // Parameters 
        if(Yii::$app->controller->action->id == 'create' && $this->actid !== null ){
           $act = Activities::find()->select(['jobno', 'relatedid', 'location', 'sdate', 'elr'])->where(['id' => $this->actid])->asArray()->one();
           $this->jobno = $act['jobno'];
           $this->client = $act['relatedid'];
           $this->location = $act['location'];
           $this->elr = $act['elr'];
           $this->dateinspected = strtotime($act['sdate']);
        }
        return parent::init();
    }

    public static function adminFormButtons($buttons, $model){
        $_this = new self();
        $buttons[$_this->formType]['items'][] = [
            'label' => $_this->formname,
            'url' => [$_this->createpath, 'actid' => $model->id],
            'linkOptions' =>  ['target'=>'_blank'],
        ];
        return $buttons;
    }
}