<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%INVOICE}}".
 *
 * @property string $ID
 * @property string $USER_ID 会员ID
 * @property string $REAL_NAME 会员姓名
 * @property string $DEC_LV 报单级别
 * @property string $EMP_LV 聘级
 * @property string $MOBILE 手机号
 * @property string $REG_TYPE 注册类型
 * @property string $REG_NAME 注册名称
 * @property string $CREDIT_CODE 统一代码
 * @property string $SALE_NAME 销售方名称
 * @property string $TAXPAYER_NUMBER 纳税人识别代码
 * @property string $INVOICE_NUMBER 发票号
 * @property string $INVOICE_ACCOUNT 交易账户-发票账户
 * @property string $TAX_ACCOUNT 交易账户-税款账户
 * @property string $AMOUNT 交易金额
 * @property int $OUTED_AT 开票日期
 * @property int $DEDUCT_PERIOD_NUM 发票冲减期数
 * @property string $REMARK 备注
 * @property int $IS_DEL 添加时间
 * @property int $CREATED_AT 是否删除
 * @property int $DELETED_AT 删除时间
 */
class Invoice extends \common\components\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%INVOICE}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['USER_ID', 'CREATED_AT'], 'required'],
            [['AMOUNT'], 'number'],
            [['OUTED_AT', 'DEDUCT_PERIOD_NUM', 'IS_DEL', 'CREATED_AT', 'DELETED_AT'], 'integer'],
            [['ID', 'USER_ID', 'DEC_LV', 'EMP_LV', 'MOBILE', 'REG_TYPE'], 'string', 'max' => 32],
            [['REAL_NAME', 'TAXPAYER_NUMBER', 'INVOICE_NUMBER', 'INVOICE_ACCOUNT', 'TAX_ACCOUNT'], 'string', 'max' => 128],
            [['REG_NAME', 'CREDIT_CODE', 'SALE_NAME', 'REMARK'], 'string', 'max' => 4000],
            [['ID'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'USER_ID' => '会员ID',
            'REAL_NAME' => '会员姓名',
            'DEC_LV' => '报单级别',
            'EMP_LV' => '聘级',
            'MOBILE' => '手机号',
            'REG_TYPE' => '注册类型',
            'REG_NAME' => '注册名称',
            'CREDIT_CODE' => '统一代码',
            'SALE_NAME' => '销售方名称',
            'TAXPAYER_NUMBER' => '纳税人识别代码',
            'INVOICE_NUMBER' => '发票号',
            'INVOICE_ACCOUNT' => '交易账户-发票账户',
            'TAX_ACCOUNT' => '交易账户-税款账户',
            'AMOUNT' => '交易金额',
            'OUTED_AT' => '开票日期',
            'DEDUCT_PERIOD_NUM' => '发票冲减期数',
            'REMARK' => '备注',
            'IS_DEL' => '添加时间',
            'CREATED_AT' => '是否删除',
            'DELETED_AT' => '删除时间',
        ];
    }
}
