Commit fcf64b99 by 王昆

gsb

parent b7716528
...@@ -142,8 +142,10 @@ class InvoiceCtl extends CtlBase { ...@@ -142,8 +142,10 @@ class InvoiceCtl extends CtlBase {
let businessmen = businessmenMap[creditCode]; let businessmen = businessmenMap[creditCode];
let itemList = bmMap[creditCode]; let itemList = bmMap[creditCode];
let amount = 0; let amount = 0;
let data_ids = [];
for (let item of itemList) { for (let item of itemList) {
amount = amount + Number(item.amt || 0); amount = amount + Number(item.amt || 0);
data_ids.push(item.id);
} }
let service_tax = parseFloat((Number(amount) * Number(invoice_service_rate) / 100).toFixed(2)); let service_tax = parseFloat((Number(amount) * Number(invoice_service_rate) / 100).toFixed(2));
if (!businessmen.is_bank) { if (!businessmen.is_bank) {
...@@ -169,7 +171,8 @@ class InvoiceCtl extends CtlBase { ...@@ -169,7 +171,8 @@ class InvoiceCtl extends CtlBase {
"unit": "", "unit": "",
"quantity": "", "quantity": "",
"price": "", "price": "",
"remark": "" "remark": "",
"data_ids": data_ids.join(",")
}); });
} }
...@@ -303,6 +306,7 @@ class InvoiceCtl extends CtlBase { ...@@ -303,6 +306,7 @@ class InvoiceCtl extends CtlBase {
mail_addr: this.trim(params.mail_addr), mail_addr: this.trim(params.mail_addr),
mail_mobile: this.trim(params.mail_mobile), mail_mobile: this.trim(params.mail_mobile),
mail_to: this.trim(params.mail_to), mail_to: this.trim(params.mail_to),
data_ids: this.trim(params.data_ids),
personal_invoice_tax: system.y2f(invoice.personal_invoice_tax), personal_invoice_tax: system.y2f(invoice.personal_invoice_tax),
additional_tax: system.y2f(invoice.additional_tax), additional_tax: system.y2f(invoice.additional_tax),
...@@ -325,6 +329,16 @@ class InvoiceCtl extends CtlBase { ...@@ -325,6 +329,16 @@ class InvoiceCtl extends CtlBase {
status: "1060", status: "1060",
} }
}); });
if (rs && rs.data && rs.data.length > 0) {
for (let d of rs.data) {
console.log(d.id, d.data_ids);
if (!d.data_ids) {
continue;
}
let tradeIds = d.data_ids.split(",");
await this.tradeSve.updateInvoice({ids: tradeIds, saas_invoice_id: d.id});
}
}
return system.getResultSuccess(rs); return system.getResultSuccess(rs);
} catch (error) { } catch (error) {
let msg = error.message; let msg = error.message;
......
...@@ -36,6 +36,11 @@ class TradeService extends ServiceBase { ...@@ -36,6 +36,11 @@ class TradeService extends ServiceBase {
return rs; return rs;
} }
async updateInvoice(params) {
let rs = await this.callms("trade", "updateItemInvoice", params);
return rs;
}
async setMerchantIdsByName(params) { async setMerchantIdsByName(params) {
let merchantName = this.trim(params.merchant_name); let merchantName = this.trim(params.merchant_name);
if (merchantName) { if (merchantName) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment