|
@@ -452,7 +452,7 @@ func (this *Invoice) ShowinvoiceList() {
|
|
|
}
|
|
|
invoices := ShowList(order_code)
|
|
|
if invoices != nil && len(invoices) > 0 {
|
|
|
- //isIos := util.IsMobileIOS(this.Request.UserAgent())
|
|
|
+ isIos := util.IsMobileIOS(this.Request.UserAgent())
|
|
|
var invoiceData []map[string]interface{}
|
|
|
for _, data := range invoices {
|
|
|
//是否换过票
|
|
@@ -467,13 +467,14 @@ func (this *Invoice) ShowinvoiceList() {
|
|
|
isJyEntity := data["invoicing_entity"] != nil && qutil.InterfaceToStr(data["invoicing_entity"]) != config.InvoiceConfig.SigningSubject
|
|
|
data["changed"] = qutil.If(isJyInvoice || isChanged || isJyEntity || timeLimit, true, false)
|
|
|
//if url := qutil.InterfaceToStr(data["url"]); url != "" {
|
|
|
- // //ios 移动端
|
|
|
- // if isIos {
|
|
|
- // //国家税务局-增值税电子发票公共服务平台
|
|
|
- // if strings.Contains(url, "tysl.beijing.chinatax") {
|
|
|
- // data["url"] = strings.ReplaceAll(url, "/preview.html?code=", "/web-reader/reader?file=")
|
|
|
- // }
|
|
|
- // }
|
|
|
+ //ios 移动端
|
|
|
+ if !isIos {
|
|
|
+ data["url"] = qutil.If(data["source_url"] != nil && qutil.ObjToString(data["source_url"]) != "", data["source_url"], data["url"])
|
|
|
+ //国家税务局-增值税电子发票公共服务平台
|
|
|
+ //if strings.Contains(url, "tysl.beijing.chinatax") {
|
|
|
+ // data["url"] = strings.ReplaceAll(url, "/preview.html?code=", "/web-reader/reader?file=")
|
|
|
+ //}
|
|
|
+ }
|
|
|
//}
|
|
|
isReopen := timeLimit
|
|
|
//var isReopen bool
|
|
@@ -511,7 +512,7 @@ func (this *Invoice) ShowinvoiceList() {
|
|
|
func ShowList(order_code string) []map[string]interface{} {
|
|
|
data := util.Mysql.SelectBySql(fmt.Sprintf(`SELECT *,(
|
|
|
SELECT count(1) as count FROM invoice b WHERE b.order_code = a.order_code and b.only_Identifying is not null and b.only_Identifying = a.only_Identifying
|
|
|
-) as isChanged FROM invoice a WHERE order_code = '%s' and invoice_status != -2 and invoice_variety is not null and invoice_variety not LIKE '%s' ORDER BY create_time DESC`, order_code, "%纸质%"))
|
|
|
+) as isChanged FROM invoice a WHERE order_code = '%s' and invoice_status != -2 and invoice_variety is not null and invoice_variety is not null and invoice_variety not LIKE '%s' ORDER BY create_time DESC`, order_code, "%纸质%"))
|
|
|
if data == nil {
|
|
|
return nil
|
|
|
}
|
|
@@ -526,9 +527,12 @@ func (this *Invoice) NewInvoiceShow() {
|
|
|
case "1": //订单回显金额
|
|
|
data["pay_money"] = ResidueMoney(code)
|
|
|
case "2": //发票信息回显
|
|
|
- invoice := util.Mysql.FindOne("invoice", map[string]interface{}{"id": encrypt.SE.Decode4Hex(code)}, "id,only_Identifying,order_code,invoice_money,remark,invoice_type,invoice_content,invoice_variety,company_name,phone,mail,taxpayer_identnum,invoice_money,invoice_order_money,company_address,bank_name,recipient,delivery_address,bank_account,company_phone", "")
|
|
|
+ invoice := util.Mysql.FindOne("invoice", map[string]interface{}{"id": encrypt.SE.Decode4Hex(code)}, "id,only_Identifying,order_code,invoice_order_code,invoice_money,remark,invoice_type,invoice_content,invoice_variety,company_name,phone,mail,taxpayer_identnum,invoice_money,invoice_order_money,company_address,bank_name,recipient,delivery_address,bank_account,company_phone", "")
|
|
|
if invoice != nil {
|
|
|
(*invoice)["id"] = code
|
|
|
+ if (*invoice)["invoice_order_code"] != nil {
|
|
|
+ (*invoice)["order_code"] = (*invoice)["invoice_order_code"]
|
|
|
+ }
|
|
|
(*invoice)["only_Identifying"] = encrypt.SE.EncodeString(qutil.InterfaceToStr((*invoice)["only_Identifying"]))
|
|
|
}
|
|
|
data["invoice"] = invoice
|
|
@@ -1198,7 +1202,7 @@ func (this *Invoice) NewReplaceinvoice() {
|
|
|
}
|
|
|
if !isMail { //成功发邮件
|
|
|
isMail = true
|
|
|
- sendMail(invoice_type, pCode, company_name, id_num, e_mail, phone, qutil.InterfaceToStr(data["url"]), invoiceContent)
|
|
|
+ sendMail(invoice_type, pCode, company_name, id_num, e_mail, phone, qutil.InterfaceToStr(data["source_url"]), invoiceContent)
|
|
|
//InvoiceSendMail(data["mail"].(string), html, "电子发票")
|
|
|
}
|
|
|
case false:
|
|
@@ -1401,6 +1405,9 @@ func IsAllowInvoice(res map[string]interface{}) bool {
|
|
|
if qutil.IntAll(res["applybill_status"]) > 0 {
|
|
|
return false
|
|
|
}
|
|
|
+ if qutil.Float64All(res["pay_money"]) == 0 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
filter := qutil.ObjToString(res["filter"].(string))
|
|
|
filter_map := map[string]interface{}{}
|
|
|
_ = json.Unmarshal([]byte(filter), &filter_map)
|
|
@@ -1567,6 +1574,7 @@ func OpenInvoiceAgain(oldOnlyIdentifying string, data map[string]interface{}) er
|
|
|
if !ok {
|
|
|
return errors.New("插入失败记录出错")
|
|
|
}
|
|
|
+ delete(data, "invoice_changed")
|
|
|
if !util.Mysql.Update("invoice", map[string]interface{}{"only_Identifying": oldOnlyIdentifying, "invoice_status": -1}, data) {
|
|
|
return errors.New("再次开票更新发票信息出错")
|
|
|
}
|
|
@@ -1744,7 +1752,7 @@ func (this *Invoice) InvoiceQuery() {
|
|
|
}
|
|
|
invoiceOne := util.Mysql.FindOne("invoice", map[string]interface{}{
|
|
|
"only_Identifying": onlyIdentifying,
|
|
|
- }, "id,invoice_changed,order_code, bank_account,invoice_code, create_time,invoice_number,company_phone,company_name, phone, mail,company_phone, invoice_type, invoice_content, url, invoice_status, invoice_serialnum, taxpayer_identnum,operator, operable_time, invoicing_entity, remark, invoice_variety, logistics_code, company_address, bank_name, recipient, delivery_address,only_Identifying", " create_time DESC")
|
|
|
+ }, "id,invoice_changed,order_code, invoice_order_code,bank_account,invoice_code, create_time,invoice_number,company_phone,company_name, phone, mail,company_phone, invoice_type, invoice_content, url, invoice_status, invoice_serialnum, taxpayer_identnum,operator, operable_time, invoicing_entity, remark, invoice_variety, logistics_code, company_address, bank_name, recipient, delivery_address,only_Identifying", " create_time DESC")
|
|
|
companyName := ""
|
|
|
if invoiceOne == nil {
|
|
|
//查询公司名称
|
|
@@ -1754,6 +1762,7 @@ func (this *Invoice) InvoiceQuery() {
|
|
|
companyName = qutil.ObjToString((*orderArr)[0]["company_name"])
|
|
|
}
|
|
|
} else {
|
|
|
+ (*invoiceOne)["order_code"] = qutil.If((*invoiceOne)["invoice_order_code"] != nil, (*invoiceOne)["invoice_order_code"], (*invoiceOne)["order_code"])
|
|
|
(*invoiceOne)["id"] = encrypt.SE.Encode2Hex(qutil.InterfaceToStr((*invoiceOne)["id"]))
|
|
|
timeLimit := qutil.Int64All((*invoiceOne)["create_time"]) <= config.InvoiceConfig.Order_createtime //24年之前的发票不让换票
|
|
|
switch qutil.IntAll((*invoiceOne)["invoice_status"]) {
|