| Current Path : /var/www/html/dyna-hr/models/ |
| Current File : /var/www/html/dyna-hr/models/Claim.php |
<?php
namespace app\models;
use Yii;
use app\models\ClaimPayment;
use app\models\ClaimPaymentItem;
use app\models\ParamList;
/**
* This is the model class for table "claim".
*
* @property int $id
* @property string $uuid
* @property int $user_id
* @property string $cat
* @property string $total
* @property string $receipt_dt
* @property string $receipt_no
* @property string $remarks
* @property string $attachment
* @property string $approval_status
* @property int $created_by
* @property string $created_dt
* @property int $updated_by
* @property string $updated_dt
*/
class Claim extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'claim';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['cat', 'receipt_no', 'total', 'receipt_dt'], 'required'],
[['user_id', 'created_by', 'updated_by'], 'integer'],
[['receipt_dt', 'created_dt', 'updated_dt', 'uuid', 'approved_dt', 'approved_by'], 'safe'],
[['remarks'], 'string'],
[['cat', 'total', 'receipt_no', 'attachment', 'approval_status'], 'string', 'max' => 255],
[['attachment'], 'file'],
[['attachment'], 'required', 'on' => 'create'],
[['total'], 'number'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'id' => 'ID',
'uuid' => 'Uuid',
'user_id' => 'Staff Name',
'cat' => 'Category',
'total' => 'Total',
'receipt_dt' => 'Receipt Date',
'receipt_no' => 'Reference Number',
'remarks' => 'Remarks',
'attachment' => 'Attachment',
'approval_status' => 'Approval Status',
'created_by' => 'Created By',
'created_dt' => 'Apply Date',
'updated_by' => 'Updated By',
'updated_dt' => 'Updated Dt',
];
}
public function checkpayment($claim_id) {
$output = '';
if (($model = ClaimPaymentItem::findOne(['claim_id' => $claim_id])) !== null) {
if (($model2 = ClaimPayment::findOne($model->parent_id)) !== null) {
$ParamList = new ParamList();
$output = $ParamList->getlabel(63, $model2->status);
}
}
return $output;
}
}