TaxCategory.php 1016 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\user\model;
  3. class TaxCategory extends Base
  4. {
  5. //设置字段信息
  6. protected $schema = [
  7. 'id' =>'bigint',//
  8. 'cat_name' =>'varchar',//发票类目名称
  9. 'cat_code' =>'varchar',//发票类目编号
  10. 'status' =>'tinyint',//
  11. 'addtime' =>'datetime',//新建时间
  12. 'tax' =>'varchar',//
  13. 'addtax' =>'varchar',//增值税管理
  14. 'sumitem' =>'varchar',//汇总项
  15. 'desc' =>'text',//描述
  16. 'short_name' =>'varchar',//简称
  17. 'merge_code' =>'varchar',//合并编码
  18. 'remark' =>'varchar',//备注
  19. 'cat_desc' =>'varchar',//建议开票税目
  20. ];
  21. public function getTaxAttr($value){
  22. return $value==''?[]:explode('、',$value);
  23. }
  24. public static function checkTax($taxid,$tax){
  25. $info=self::where('id',$taxid)->findorEmpty();
  26. if($info->isEmpty())throw new \Exception('类目不存在');
  27. return empty($info->tax)||in_array($tax,$info->tax);
  28. }
  29. }