From 41a854f5505a8867dee1addd310dfe516c0e2aca Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Thu, 26 Dec 2024 16:59:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=8A=AC=E5=A4=B4=E6=98=AF?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=EF=BC=8C=E5=88=99=E5=8E=BB=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E7=9A=84=E8=A2=AB=E4=BB=A3=E5=BE=81=E7=BA=B3=E7=A8=8E=E4=BA=BA?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../invoice/InvoiceIssuanceService.php | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/service/invoice/InvoiceIssuanceService.php b/app/service/invoice/InvoiceIssuanceService.php index 9337a7f..c74751d 100644 --- a/app/service/invoice/InvoiceIssuanceService.php +++ b/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, []);