|
|
|
@ -190,12 +190,15 @@ class InvoiceIssuanceService |
|
|
|
*/ |
|
|
|
public function getTaxNumber($invoice_head_id, $CertificateCode = '') |
|
|
|
{ |
|
|
|
$bdznsrsbh = '91440300772709730N'; // 被代征纳税人识别号 【默认大工业水务税号】 |
|
|
|
$bdznsrsbh = '';//'91440300772709730N'; // 被代征纳税人识别号 【默认大工业水务税号】 |
|
|
|
// 如果是企业 需要取填写抬头的税号 |
|
|
|
$invoice_head = (new InvoiceHead())->where('id', $invoice_head_id)->where('type', 0)->field('tax_number')->find(); |
|
|
|
$invoice_head = (new InvoiceHead())->where('id', $invoice_head_id)->field('tax_number')->find(); |
|
|
|
if ($invoice_head) { |
|
|
|
if ($invoice_head['type'] == 1) { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
$bdznsrsbh = $invoice_head['tax_number'] ?? ''; |
|
|
|
if (!empty($CertificateCode) && $bdznsrsbh != $CertificateCode) { |
|
|
|
if (!empty($CertificateCode) && empty($bdznsrsbh) && $bdznsrsbh != $CertificateCode) { |
|
|
|
$bdznsrsbh = $CertificateCode; |
|
|
|
} |
|
|
|
} elseif (!empty($CertificateCode)) { |
|
|
|
@ -244,6 +247,7 @@ class InvoiceIssuanceService |
|
|
|
$CertificateCode = !empty($feeUsers['CertificateCode']) ? $feeUsers['CertificateCode'] : ''; |
|
|
|
$bdznsrsbh = $this->getTaxNumber($invoiceIssuance['invoice_head_id'],$CertificateCode); // 被代征纳税人识别号 |
|
|
|
$feeUsers['bdznsrsbh'] = $bdznsrsbh; |
|
|
|
$bdznsrsbh = $bdznsrsbh ?: $CertificateCode; |
|
|
|
|
|
|
|
// 保存 |
|
|
|
$ChinaTaxes = new ChinaTaxes($feeUsers, $invoiceDate); |
|
|
|
|