|
|
|
@ -188,13 +188,18 @@ class InvoiceIssuanceService |
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
*/ |
|
|
|
public function getTaxNumber($invoice_head_id) |
|
|
|
public function getTaxNumber($invoice_head_id, $CertificateCode = '') |
|
|
|
{ |
|
|
|
$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'] ?? ''; |
|
|
|
if (!empty($CertificateCode) && $bdznsrsbh != $CertificateCode) { |
|
|
|
$bdznsrsbh = $CertificateCode; |
|
|
|
} |
|
|
|
} elseif (!empty($CertificateCode)) { |
|
|
|
$bdznsrsbh = $CertificateCode; |
|
|
|
} |
|
|
|
return $bdznsrsbh; |
|
|
|
} |
|
|
|
@ -219,10 +224,6 @@ class InvoiceIssuanceService |
|
|
|
|
|
|
|
$feeUsers = $this->getFeeUserData($pucode); |
|
|
|
|
|
|
|
$bdznsrsbh = $this->getTaxNumber($invoiceIssuance['invoice_head_id']); // 被代征纳税人识别号 |
|
|
|
|
|
|
|
$feeUsers['bdznsrsbh'] = $bdznsrsbh; |
|
|
|
|
|
|
|
// 获取用户应收费信息 |
|
|
|
$FeeComputeDetail = self::getFeeComputeDetail($pucode, date("Ym", $invoiceIssuance['expire_time'])); |
|
|
|
if ($FeeComputeDetail['MsgID'] != 1) { |
|
|
|
@ -240,6 +241,9 @@ class InvoiceIssuanceService |
|
|
|
$feeUsers['WaterPrice'] = $FeeComputeDetail['WaterPrice']; |
|
|
|
$feeUsers['ThisLastReadingTime'] = $FeeComputeDetail['ThisLastReadingTime']; |
|
|
|
|
|
|
|
$CertificateCode = !empty($feeUsers['CertificateCode']) ? $feeUsers['CertificateCode'] : ''; |
|
|
|
$bdznsrsbh = $this->getTaxNumber($invoiceIssuance['invoice_head_id'],$CertificateCode); // 被代征纳税人识别号 |
|
|
|
$feeUsers['bdznsrsbh'] = $bdznsrsbh; |
|
|
|
|
|
|
|
// 保存 |
|
|
|
$ChinaTaxes = new ChinaTaxes($feeUsers, $invoiceDate); |
|
|
|
@ -314,8 +318,8 @@ class InvoiceIssuanceService |
|
|
|
if (!isset($queryUploadErrorData['mxGrid']['sbMxsjVOList']['ycms'])) { |
|
|
|
throw new FuncException('异常信息返回有误'); |
|
|
|
} |
|
|
|
// 查询待开具电子缴款 |
|
|
|
$queryIssuedPaymentVoucher = $ChinaTaxes->queryIssuedPaymentVoucher($bdznsrsbh); |
|
|
|
// 查询待开具电子缴款(无法调用) |
|
|
|
//$queryIssuedPaymentVoucher = $ChinaTaxes->queryIssuedPaymentVoucher($bdznsrsbh); |
|
|
|
|
|
|
|
// 保存用户异常状态 |
|
|
|
$ycms = $queryUploadErrorData['data']['mxGrid']['sbMxsjVOList']['ycms']; // 数据异常描述 |
|
|
|
|