Commit 6f37be80 by 王昆

ddg]

parent 336af170
...@@ -56,6 +56,11 @@ class InvoiceCtl extends CtlBase { ...@@ -56,6 +56,11 @@ class InvoiceCtl extends CtlBase {
async invoiceApply(pobj, pobj2, req) { async invoiceApply(pobj, pobj2, req) {
try { try {
pobj.invoice_amount = system.y2f(pobj.invoice_amount); pobj.invoice_amount = system.y2f(pobj.invoice_amount);
pobj.additional_tax= system.y2f(pobj.additional_tax);
pobj.value_added_tax= system.y2f(pobj.value_added_tax);
pobj.personal_invoice_tax= system.y2f(pobj.personal_invoice_tax);
pobj.invoice_content= system.y2f(pobj.invoice_content);
return await this.invoiceSve.invoiceApply(pobj); return await this.invoiceSve.invoiceApply(pobj);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
...@@ -170,18 +175,18 @@ class InvoiceCtl extends CtlBase { ...@@ -170,18 +175,18 @@ class InvoiceCtl extends CtlBase {
// } // }
// } // }
// /** /**
// * 发票试算接口 * 发票试算接口
// * @param {*} pobj * @param {*} pobj
// */ */
// async calcInvoice(pobj) { async calcInvoice(pobj) {
// try { try {
// return await this.invoiceSve.apiCalcInvoice(pobj); return await this.invoiceSve.calcInvoice(pobj);
// } catch (error) { } catch (error) {
// console.log(error); console.log(error);
// return system.getResultFail(500, `接口错误 错误信息 ${error}`); return system.getResultFail(500, `接口错误 错误信息 ${error}`);
// } }
// } }
// /** // /**
// * 计算发票增值税 // * 计算发票增值税
......
...@@ -44,6 +44,16 @@ class BusinessmenService extends ServiceBase { ...@@ -44,6 +44,16 @@ class BusinessmenService extends ServiceBase {
} }
} }
async queryObusinessmenByCreditCode(params) {
try {
return await this.callms("order", "queryObusinessmenByCreditCode", params);
} catch (error) {
console.log(error);
return system.getResult(error);
}
}
/** /**
* @params 建仗 * @params 建仗
*/ */
......
...@@ -7,6 +7,7 @@ class InvoiceService extends ServiceBase { ...@@ -7,6 +7,7 @@ class InvoiceService extends ServiceBase {
constructor() { constructor() {
super(); super();
this.userSve = system.getObject("service.uc.userSve"); this.userSve = system.getObject("service.uc.userSve");
this.businessmenSve = system.getObject("service.business.businessmenSve");
} }
async processDics(params) { async processDics(params) {
var rs = await this.callms("invoice", "processDics", params); var rs = await this.callms("invoice", "processDics", params);
...@@ -245,6 +246,44 @@ class InvoiceService extends ServiceBase { ...@@ -245,6 +246,44 @@ class InvoiceService extends ServiceBase {
} }
} }
/**
* 发票试算
* @param {*} params
*
* credit_code :统一社会信用代码
*
*
*/
async calcInvoice(params){
if(!params.credit_code){
return system.getResult(null,`参数错误 统一社会信用代码不能为空`);
}
//取出个体工商户信息
var businessRes = await this.businessmenSve.queryObusinessmenByCreditCode({credit_code:this.trim(params.credit_code)});
if(businessRes.status !=0 && !businessRes.data){
return system.getResult(null,`个体户不存在`);
}
let businessmenBean = businessRes.data;
if(!businessmenBean.sign_time){
return system.getResult(null,`个体户未签约`);
}
//增值税累计类型 1按月 2按季度 add_value_up_type
//个税累计类型 1按月累计 2按季度累计 tax_up_type
let accumulatedAmountParams = {
add_value_up_type:businessmenBean.add_value_up_type,
tax_up_type:businessmenBean.tax_up_type,
credit_code :this.trim(params.credit_code),
invoiced_time:this.trim(params.invoiced_time)
};
//取出累计开票金额
var invoiceRes = await this.callms("invoice", "accumulatedAmount", accumulatedAmountParams);
return system.getResultSuccess();
}
} }
......
...@@ -182,12 +182,12 @@ class System { ...@@ -182,12 +182,12 @@ class System {
// merchant: "http://127.0.0.1:3101" + path, // merchant: "http://127.0.0.1:3101" + path,
// 订单服务 // 订单服务
// order: domain2 + ":3103" + path, order: domain2 + ":3103" + path,
order: domain + ":3103" + path, // order: domain + ":3103" + path,
// 发票服务 // 发票服务
// invoice: domain2 + ":3105" + path, invoice: domain2 + ":3105" + path,
invoice: domain + ":3105" + path, // invoice: domain + ":3105" + path,
// 用户中心 // 用户中心
uc: domain + ":3106" + path , uc: domain + ":3106" + path ,
......
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