wugg 5 months ago
parent
commit
9f659c3032
2 changed files with 17 additions and 9 deletions
  1. 16 8
      app/admin/command/CheckInvoice.php
  2. 1 1
      app/admin/controller/Export.php

+ 16 - 8
app/admin/command/CheckInvoice.php

@@ -3,11 +3,19 @@ declare (strict_types = 1);
 
 namespace app\admin\command;
 
-use app\admin\model\CompanyInfo;use app\admin\model\InvoiceInfo;use app\admin\model\Pay;use app\admin\model\PayInvoice;use app\admin\model\SupplierInfo;use think\console\Command;
+use app\admin\model\CompanyInfo;
+use app\admin\model\InvoiceInfo;
+use app\admin\model\Pay;
+use app\admin\model\PayInvoice;
+use app\admin\model\SupplierInfo;
+use think\console\Command;
 use think\console\Input;
 use think\console\input\Argument;
 use think\console\input\Option;
-use think\console\Output;use think\facade\Cache;use think\facade\Config;use think\facade\Db;
+use think\console\Output;
+use think\facade\Cache;
+use think\facade\Config;
+use think\facade\Db;
 
 class CheckInvoice extends Command
 {
@@ -23,7 +31,7 @@ class CheckInvoice extends Command
         $this->setName('checkinvoice')
             ->setDescription('the checkinvoice command');
     }
-
+    // 执行
     protected function execute(Input $input, Output $output)
     {
         $this->datetime = date("Y-m-d");
@@ -40,23 +48,23 @@ class CheckInvoice extends Command
             $list->next();
         }
         Cache::set('checkInvoiceP',0);
-
     }
-
+    // 获取待验票列表
     protected  function getInvoice(){
         $list = PayInvoice::where([["status","in",[1,9]],["open_time","<",$this->datetime],["updatetime","<=",date("Y-m-d H:i:s")],['is_del',"=",0]])->cursor();
         foreach ($list as $item){
             yield $item;
         }
     }
-
+    // 验票
     protected function checkTicket($invoice){
         $pay = Pay::where(["payNo"=>$invoice['payNo'],"is_del"=>0,"status"=>2])->findOrEmpty();
         if(!$pay->isEmpty()){
-           if($pay->winv_fee<=0) return  PayInvoice::where(["id"=>$invoice['id']])->update(["status"=>8,"check_remark"=>"待开票金额不足","updatetime"=>date("Y-m-d H:i:s")]);
+           if($pay->winv_fee <= 0) return  PayInvoice::where(["id"=>$invoice['id']])->update(["status"=>8,"check_remark"=>"待开票金额不足","updatetime"=>date("Y-m-d H:i:s")]);
            $this->taxCheck($invoice);
         }
     }
+    // 验票
     protected function taxCheck($invoice){
         $invoiceConf=Config::get('invoice');
         $iinvoicenfo = $invoiceConf['91110113MA004JNJ28'];
@@ -73,7 +81,7 @@ class CheckInvoice extends Command
         try{
             if(isset($result['code']) && $result['code']=='0000' && isset($result['data']) && count($result['data'])>0){
                 if($result['data']['cyjg']=='0001'){
-                    $data= $result['data'];
+                     $data= $result['data'];
                      $this->changeFiled($data,$invoice);
                 }elseif (in_array($result['data']['cyjg'],['0002','1014'])){
                     $this->lastUpdate($invoice['id']);

+ 1 - 1
app/admin/controller/Export.php

@@ -229,7 +229,7 @@ class Export extends Base
         if (($param['create_start'] != '') && ($param['create_end'] != '')) $where[] = ['b.addtime', 'between', [$param['create_start'] . ' 00:00:00', $param['create_end'] . ' 23:59:59']];
         if ($param['name'] != '') $where[] = ['a.trade_out', 'like', '%' . $param['name'] . '%'];
         if ($param['bank'] != '') $where[] = ['a.trade_bank', 'like', '%' . $param['bank'] . '%'];
-        if ($param['status'] != '') $where[] = ['a.status', '=', $param['status']];
+        if ($param['status'] != '') $where[] = ['b.status', '=', $param['status']];
         if ($param['tradNo'] != '') $where[] = ['a.tradNo', 'like', '%' . $param['tradNo'] . '%'];
         if ($param['company'] != '') $where[] = ['a.companyNo', 'like', '%' . $param['company'] . '%'];
         if ($param['userd_lower'] != '') $where[] = ['a.used_fee', '>=', $param['userd_lower']];