|
@@ -21,7 +21,7 @@ func (im *InvoiceManager) simpleMakeInvoice(ctx context.Context) (total, okNum i
|
|
|
//查询需要开票的数据
|
|
|
//(新开发票【a.invoice_status=0 AND a.invoice_changed=0】,红冲后新开【a.invoice_status=2 AND a.invoice_changed=1】)
|
|
|
//线上申请发票【invoice_order_code is null 】, 管理后台一个订单拆分多个发票【invoice_order_code not like '%,%'】
|
|
|
- res, err = g.DB().Query(ctx, "SELECT a.id,a.invoice_type,a.remark,a.invoice_variety,a.taxpayer_identnum,a.company_name,a.invoice_content,b.pay_way,b.order_money,b.pay_money FROM invoice a INNER JOIN dataexport_order b ON a.order_code=b.order_code WHERE a.invoice_variety like '%电子%' AND ((a.invoice_status=0 AND a.invoice_changed=0) or (a.invoice_status=2 AND a.invoice_changed=1 )) AND (a.invoice_order_code is NULL OR a.invoice_order_code not like '%,%') AND a.create_time > ? ", consts.InvoiceStartTime.Unix())
|
|
|
+ res, err = g.DB().Query(ctx, "SELECT a.id,a.invoice_type,a.remark,a.invoice_variety,a.taxpayer_identnum,a.company_name,a.invoice_content,a.invoice_money,b.pay_money FROM invoice a INNER JOIN dataexport_order b ON a.order_code=b.order_code WHERE a.invoice_variety like '%电子%' AND ((a.invoice_status=0 AND a.invoice_changed=0) or (a.invoice_status=2 AND a.invoice_changed=1 )) AND (a.invoice_order_code is NULL OR a.invoice_order_code not like '%,%') AND a.create_time > ? ", consts.InvoiceStartTime.Unix())
|
|
|
if err != nil {
|
|
|
err = gerror.Wrap(err, "simpleMakeInvoice-查询待开票异常")
|
|
|
return
|
|
@@ -39,15 +39,11 @@ func (im *InvoiceManager) simpleMakeInvoice(ctx context.Context) (total, okNum i
|
|
|
remark = gconv.String(m["remark"])
|
|
|
invoiceVariety = gconv.String(m["invoice_variety"])
|
|
|
invoiceContent = gconv.String(m["invoice_content"])
|
|
|
- prices float64
|
|
|
+ prices = gconv.Float64(m["invoice_money"]) / float64(100)
|
|
|
)
|
|
|
|
|
|
- //公对公转账 账单金额可以修改 开发票应取实付金额 pay_money
|
|
|
- //微信支付宝支付 pay_money为订单金额减去微信or支付包红包
|
|
|
- if gconv.String(m["pay_way"]) == "transferAccounts" {
|
|
|
+ if prices == 0 { //开票金额为空,取支付金额
|
|
|
prices = gconv.Float64(m["pay_money"]) / float64(100)
|
|
|
- } else {
|
|
|
- prices = gconv.Float64(m["order_money"]) / float64(100)
|
|
|
}
|
|
|
|
|
|
c := MakeInvoiceData{
|