|
@@ -151,7 +151,7 @@ func (im *InvoiceManager) simpleMakeInvoice(ctx context.Context) (total, okNum i
|
|
)
|
|
)
|
|
//查询需要开票的数据
|
|
//查询需要开票的数据
|
|
//res, err = g.DB().Query(ctx, "SELECT a.*,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_status=0 AND a.invoice_changed=0 AND a.invoice_variety='普通发票(电子发票)' AND a.invoice_order_code is NULL AND a.create_time > ? ", consts.InvoiceStartTime.Unix())
|
|
//res, err = g.DB().Query(ctx, "SELECT a.*,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_status=0 AND a.invoice_changed=0 AND a.invoice_variety='普通发票(电子发票)' AND a.invoice_order_code is NULL AND a.create_time > ? ", consts.InvoiceStartTime.Unix())
|
|
- res, err = g.DB().Query(ctx, "SELECT a.*,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_status=0 AND a.invoice_changed=0 AND a.invoice_variety like '%普通发票%' 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.*,b.pay_money FROM invoice a INNER JOIN dataexport_order b ON a.order_code=b.order_code WHERE a.invoice_status=0 AND a.invoice_changed=0 AND a.invoice_variety like '%普通发票%' AND (a.invoice_order_code is NULL OR a.invoice_order_code not like '%,%') AND a.create_time > ? ", consts.InvoiceStartTime.Unix())
|
|
if err != nil {
|
|
if err != nil {
|
|
return -1, -1, gerror.Wrap(err, "simpleMakeInvoice-查询待开票异常")
|
|
return -1, -1, gerror.Wrap(err, "simpleMakeInvoice-查询待开票异常")
|
|
}
|
|
}
|
|
@@ -168,15 +168,11 @@ func (im *InvoiceManager) simpleMakeInvoice(ctx context.Context) (total, okNum i
|
|
orderCode = gconv.String(m["order_code"])
|
|
orderCode = gconv.String(m["order_code"])
|
|
iType = gconv.String(m["invoice_type"])
|
|
iType = gconv.String(m["invoice_type"])
|
|
remark = gconv.String(m["remark"])
|
|
remark = gconv.String(m["remark"])
|
|
- 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 { //若开票金额为0 则取支付金额
|
|
prices = gconv.Float64(m["pay_money"]) / float64(100)
|
|
prices = gconv.Float64(m["pay_money"]) / float64(100)
|
|
- } else {
|
|
|
|
- prices = gconv.Float64(m["order_money"]) / float64(100)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
c := MakeInvoiceData{
|
|
c := MakeInvoiceData{
|