|
@@ -7,6 +7,7 @@ use think\console\Input;
|
|
|
use think\console\input\Argument;
|
|
|
use think\console\input\Option;
|
|
|
use think\console\Output;
|
|
|
+use think\Exception;
|
|
|
use think\facade\Cache;use think\facade\Db;
|
|
|
|
|
|
class Report extends Command
|
|
@@ -57,7 +58,7 @@ class Report extends Command
|
|
|
break;
|
|
|
case 'B':
|
|
|
$method="B";
|
|
|
- $file ='进项发票等级导出';
|
|
|
+ $file ='进项发票登记导出';
|
|
|
break;
|
|
|
case 'C':
|
|
|
$method="C";
|
|
@@ -101,7 +102,8 @@ class Report extends Command
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- if($method=='') $output->writeln("[$date]【{$param['name']}】[{$param['apply_name']}]预约记录处理失败");
|
|
|
+ if ($method == '') throw new Exception('该报表暂无对应的处理方法');
|
|
|
+
|
|
|
$data =$this->$method($param);
|
|
|
$url = excelSaveFile($data, $file . date('_YmdHis'));//加时间戳,防止同名文件覆盖
|
|
|
Db::name('exec_log')
|
|
@@ -200,7 +202,7 @@ class Report extends Command
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //进项发票等级导出
|
|
|
+ //进项发票登记导出
|
|
|
private function B($param=[])
|
|
|
{
|
|
|
// $param = $this->request->only(['start' => '', 'end' => '', 'invType' => '', 'company' => '', 'relaComNo' => '', 'supplierNo' => '', 'hpNo' => '', 'payNo' => '', 'invoiceType' => '', 'status' => '', 'invoiceNumber' => '', 'checkApi' => '', 'invoiceCode' => '', 'open_start' => '', 'open_end' => '', 'apply_id' => '', 'apply_name' => ''], 'post', 'trim');
|
|
@@ -231,7 +233,7 @@ class Report extends Command
|
|
|
->alias('a')
|
|
|
->leftJoin('pay b', 'a.payNo=b.payNo')
|
|
|
->leftJoin('invoice_info c', 'c.hpNo=a.hpNo AND c.status=1')
|
|
|
- ->field('"" 序号,a.payNo,a.hpNo,a.addtime,a.invoiceNumber,a.open_time,b.supplierName,a.invoiceType,a.status,a.updatetime,a.remark,c.item_list,c.total')
|
|
|
+ ->field('"" 序号,a.payNo,a.hpNo,a.addtime,a.invoiceNumber,a.open_time,b.supplierName,a.invoiceType,a.status,a.updatetime,a.remark,c.item_list,c.total,c.subtotal_amount,c.subtotal_tax')
|
|
|
->where($where)
|
|
|
->order('a.addtime desc')
|
|
|
->cursor();
|
|
@@ -251,8 +253,10 @@ class Report extends Command
|
|
|
'月' => date('m', strtotime($item['addtime'])),
|
|
|
'发票号' => $item['invoiceNumber'],
|
|
|
'开票日期' => $item['open_time'],
|
|
|
+ '金额汇总'=>$item['subtotal_amount'],
|
|
|
'金额' => $val['amount'],
|
|
|
- '税额' => $val['tax'],
|
|
|
+ '税额汇总'=>$item['subtotal_tax'],
|
|
|
+ '税额' => $val['tax'],
|
|
|
'税率' => $val['tax_rate'],
|
|
|
'总额' => $item['total'],
|
|
|
'供应商' => $item['supplierName'],
|
|
@@ -274,10 +278,12 @@ class Report extends Command
|
|
|
'月' => date('m', strtotime($item['addtime'])),
|
|
|
'发票号' => $item['invoiceNumber'],
|
|
|
'开票日期' => $item['open_time'],
|
|
|
- '金额' => '',
|
|
|
- '税额' => '',
|
|
|
+ '金额汇总'=>$item['subtotal_amount'],
|
|
|
+ '金额' => '',
|
|
|
+ '税额汇总'=>$item['subtotal_tax'],
|
|
|
+ '税额' => '',
|
|
|
'税率' => '',
|
|
|
- '总额' => $item['total'],
|
|
|
+ '总额' => $item['total'],
|
|
|
'供应商' => $item['supplierName'],
|
|
|
'业务类型' => '采购回票',
|
|
|
'发票类型' => $invoiceType[$item['invoiceType']] ?? '',
|
|
@@ -686,10 +692,10 @@ class Report extends Command
|
|
|
|
|
|
$value['开票是否超期'] = round(bcdiv(bcsub($time, strtotime($value['最近开票时间']??$value['下单时间']), 1), 86400, 1)) > 15 ? '是' : '否';
|
|
|
|
|
|
- $value['最近一次发货时间'] = Db::table('fh_source')
|
|
|
- ->where(['qrdNo' => $value['业务订单编号']])
|
|
|
- ->order(['id' => 'desc'])
|
|
|
- ->value('send_date', '');
|
|
|
+ $value['最近一次发货时间'] = Db::table('fh_source')
|
|
|
+ ->whereIn('qrdNo', [$value['业务订单编号'], $value['销售订单主编号']])
|
|
|
+ ->order(['id' => 'desc'])
|
|
|
+ ->value('send_date', '');
|
|
|
yield $value;
|
|
|
}
|
|
|
|
|
@@ -739,7 +745,7 @@ class Report extends Command
|
|
|
$item_list = json_decode($value['item_list'], true);
|
|
|
unset($value['item_list']);
|
|
|
foreach ($item_list as $item) {
|
|
|
- $list = array_merge($value, [
|
|
|
+ yield $list[] = array_merge($value, [
|
|
|
'发票货物或应税劳务、服务名称' => $item['name'] ?? '',
|
|
|
'回票数量' => $item['quantity'] ?? '',
|
|
|
'本次回票价款' => $item['amount'] ?? '',
|