123456789101112131415161718192021222324252627282930 |
- <?php
- namespace app\user\model;
- class TaxCategory extends Base
- {
- //设置字段信息
- protected $schema = [
- 'id' =>'bigint',//
- 'cat_name' =>'varchar',//发票类目名称
- 'cat_code' =>'varchar',//发票类目编号
- 'status' =>'tinyint',//
- 'addtime' =>'datetime',//新建时间
- 'tax' =>'varchar',//
- 'addtax' =>'varchar',//增值税管理
- 'sumitem' =>'varchar',//汇总项
- 'desc' =>'text',//描述
- 'short_name' =>'varchar',//简称
- 'merge_code' =>'varchar',//合并编码
- 'remark' =>'varchar',//备注
- 'cat_desc' =>'varchar',//建议开票税目
- ];
- public function getTaxAttr($value){
- return $value==''?[]:explode('、',$value);
- }
- public static function checkTax($taxid,$tax){
- $info=self::where('id',$taxid)->findorEmpty();
- if($info->isEmpty())throw new \Exception('类目不存在');
- return empty($info->tax)||in_array($tax,$info->tax);
- }
- }
|