Browse Source

如果抬头是公司,则去公司的被代征纳税人识别号

master
wanghongjun 11 months ago
parent
commit
41a854f550
  1. 23
      app/service/invoice/InvoiceIssuanceService.php

23
app/service/invoice/InvoiceIssuanceService.php

@ -198,6 +198,25 @@ class InvoiceIssuanceService
return $feeUsers;
}
/**
* 获取被代征纳税人识别号
* @param $invoice_head_id // 抬头id
* @return mixed|string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getTaxNumber($invoice_head_id)
{
$bdznsrsbh = '91440300772709730N'; // 被代征纳税人识别号 【默认大工业水务税号】
// 如果是企业 需要取填写抬头的税号
$invoice_head = (new InvoiceHead())->where('id', $invoice_head_id)->where('type', 0)->field('tax_number')->find();
if ($invoice_head) {
$bdznsrsbh = $invoice_head['tax_number'] ?? '';
}
return $bdznsrsbh;
}
/**
* 开具完税证明
* @param $invoiceIssuance // 开票信息
@ -217,7 +236,7 @@ class InvoiceIssuanceService
$feeUsers = $this->getFeeUserData($pucode);
$bdznsrsbh = '91440300772709730N'; // 被代征纳税人识别号
$bdznsrsbh = $this->getTaxNumber($invoiceIssuance['invoice_head_id']); // 被代征纳税人识别号
$feeUsers['bdznsrsbh'] = $bdznsrsbh;
@ -328,7 +347,7 @@ class InvoiceIssuanceService
throw new FuncException('上次发起数据不存在');
}
$bdznsrsbh = '91440300772709730N'; // 被代征纳税人识别号
$bdznsrsbh = $this->getTaxNumber($invoiceIssuance['invoice_head_id']); // 被代征纳税人识别号
$sbpch = $InvoiceIssuanceData['sbpch'];
$ChinaTaxes = new ChinaTaxes($feeUsers, []);

Loading…
Cancel
Save