FinancialManager.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. namespace app\cxinv\controller;
  3. use think\App;
  4. class FinancialManager extends Base{
  5. public function __construct(App $app) {
  6. parent::__construct($app);
  7. $this->model=new \app\cxinv\model\FinancialManager();
  8. }
  9. public function List(){
  10. $param = $this->request->param(["code"=>"","type"=>"","seller_code"=>"","buyer_code"=>"","orderCode"=>"","cxCode"=>"",
  11. "goodNo"=>"","inv_number"=>"","inv_buyer_code"=>"","start"=>"","end"=>"","page"=>1,"size"=>15],"post","trim");
  12. $where=[];
  13. if($param['code']!="") $where[]= ["code","=","%{$param['code']}%"];
  14. if($param['type']!="") $where[]= ["type","=",$param['type']];
  15. if($param['start']!="") $where[]= ["create_time",">=",startTime($param['start'])];
  16. if($param['end']!="") $where[]= ["create_time","<=",endTime($param['end'])];
  17. if($param['seller_code']!="") $where[]= ["seller_code","=",$param['seller_code']];
  18. if($param['buyer_code']!="") $where[]= ["buyer_code","=",$param['buyer_code']];
  19. if($param['orderCode']!="") $where[]= ["orderCode","=",$param['orderCode']];
  20. if($param['cxCode']!="") $where[]= ["cxCode","=",$param['cxCode']];
  21. if($param['goodNo']!="") $where[]= ["goodNo","=",$param['goodNo']];
  22. if($param['inv_number']!="") $where[]= ["inv_number","=",$param['inv_number']];
  23. if($param['inv_buyer_code']!="") $where[]= ["inv_buyer_code","=",$param['inv_buyer_code']];
  24. $list = $this->model
  25. ->where($where)
  26. ->order("id desc")
  27. ->paginate(['page'=>$param['page'],'list_rows'=>$param['size']]);
  28. return success('获取成功',['list'=>$list->items(),'count'=>$list->total()]);
  29. }
  30. //'code'=>'string',//订单或记录的唯一标识符
  31. // 'type'=>'int',//记录类型 1入库2出库
  32. // 'source'=>'int',//数据来源,1结算 2 线下订单
  33. // 'seller_code'=>'string',//卖方代码
  34. // 'seller_name'=>'string',//卖方名称
  35. // 'buyer_code'=>'string',//买方代码
  36. // 'buyer_name'=>'string',//买方名称
  37. // 'orderCode'=>'string',//订单编号
  38. // 'cxCode'=>'string',//客户编号
  39. // 'poCode'=>'string',//采购订单编号
  40. // 'platform_type'=>'int',//平台类型,1ToB 2ToC
  41. // 'goodNo'=>'string',//商品编号
  42. // 'goodName'=>'string',//商品名称
  43. // 'unit'=>'string',//商品单位
  44. // 'num'=>'int',//商品数量
  45. // 'goodPrice'=>'decimal',//商品单价
  46. // 'totalPrice'=>'decimal',//商品总价
  47. // 'cat_code'=>'string',//商品分类代码
  48. // 'cat_name'=>'string',//商品分类名称
  49. // 'tax'=>'decimal',//税率或税费
  50. // 'inv_fee'=>'decimal',//发票费用
  51. // 'inv_seller_code'=>'string',//发票卖方代码
  52. // 'inv_seller_name'=>'string',//发票卖方名称
  53. // 'inv_buyer_code'=>'string',//发票买方代码
  54. // 'inv_buyer_name'=>'string',//发票买方名称
  55. // 'inv_number'=>'string',//发票编号
  56. // 'inv_type'=>'string',//发票类型
  57. // 'inv_item_id'=>'int',//发票项目ID
  58. // 'inv_good_name'=>'string',//发票商品名称
  59. // 'inv_cat_code'=>'string',//发票商品分类代码
  60. // 'inv_spec'=>'string',//发票商品规格
  61. // 'inv_unit'=>'string',//发票商品单位
  62. // 'inv_num'=>'int',//发票商品数量
  63. // 'inv_subprice'=>'decimal',//发票商品子项单价
  64. // 'inv_subtotal'=>'decimal',//发票商品子项总价
  65. // 'inv_tax'=>'decimal',//发票税额
  66. // 'inv_tax_total'=>'decimal',//发票总税额
  67. // 'inv_price'=>'decimal',//发票单价
  68. // 'inv_total'=>'decimal',//发票总价
  69. // 'cat_diff'=>'int',//分类差异
  70. // 'tax_diff'=>'int',//税费差异
  71. // 'remark'=>'string',//备注或说明
  72. public function create(){
  73. $list=$this->request->post("list",[],"trim");
  74. $valid = $this->validate($list,[
  75. 'code|单据编号'=>'require|max:255',
  76. 'type|单据类型'=>'require|in:1,2,3',
  77. "source|单据来源"=>'require|in:1,2',
  78. 'seller_code|卖方公司纳税识别号'=>'require|max:255',
  79. 'seller_name|卖方公司名称'=>'require|max:255',
  80. 'buyer_code|买方公司纳税识别号'=>'require|max:255',
  81. 'buyer_name|买方公司名称'=>'require|max:255',
  82. 'orderCode|订单号'=>'max:255',
  83. 'cxCode|核销单号'=>'max:255',
  84. 'poCode|采购订单号'=>'max:255',
  85. 'platform_type|平台类型'=>'require|in:1,2',
  86. 'goodNo|商品编号'=>'require|max:255',
  87. 'goodName|商品名称'=>'require|max:255',
  88. 'unit|商品单位'=>'require|max:255',
  89. 'num|商品数量'=>'require|integer',
  90. 'goodPrice|商品单价'=>'require|float',
  91. 'totalPrice|商品总价'=>'require|float',
  92. 'cat_code|商品分类代码'=>'require|max:255',
  93. 'cat_name|商品分类名称'=>'require|max:255',
  94. 'tax|税率或税费'=>'require|float',
  95. 'inv_fee|发票费用'=>'float',
  96. 'inv_seller_code|发票卖方代码'=>'max:255',
  97. 'inv_seller_name|发票卖方名称'=>'max:255',
  98. 'inv_buyer_code|发票买方代码'=>'max:255',
  99. 'inv_buyer_name|发票买方名称'=>'max:255',
  100. 'inv_number|发票编号'=>'max:255',
  101. 'inv_type|发票类型'=>'max:255',
  102. 'inv_item_id|发票项目ID'=>'integer',
  103. 'inv_good_name|发票商品名称'=>'max:255',
  104. 'inv_cat_code|发票商品分类代码'=>'max:255',
  105. 'inv_spec|发票商品规格'=>'max:255',
  106. 'inv_unit|发票商品单位'=>'max:255',
  107. 'inv_num|发票商品数量'=>'integer',
  108. 'inv_subprice|发票商品子项单价'=>'float',
  109. 'inv_subtotal|发票商品子项总价'=>'float',
  110. 'inv_tax|发票税额'=>'float',
  111. 'inv_tax_total|发票总税额'=>'float',
  112. 'inv_price|发票单价'=>'float',
  113. 'inv_total|发票总价'=>'float',
  114. 'cat_diff|分类差异'=>'integer',
  115. 'tax_diff|税费差异'=>'integer',
  116. 'remark|备注'=>'max:255',
  117. ]);
  118. }
  119. }