|
|
@@ -160,8 +160,8 @@ module.exports = app => {
|
|
|
if (d.tax !== undefined || nd.sf_tp !== undefined || nd.yf_tp !== undefined) {
|
|
|
nd.tax = d.tax !== undefined ? this.ctx.helper.round(d.tax || 0, this.ctx.costStage.decimal.tax) : 0;
|
|
|
const divNum = nd.tax ? this.ctx.helper.add(1, this.ctx.helper.div(nd.tax, 100)) : 1;
|
|
|
- nd.yf_excl_tax_tp = this.ctx.helper.div(nd.yf_tp !== undefined ? nd.yf_tp : 0, divNum, this.ctx.costStage.decimal.tp);
|
|
|
- nd.sf_excl_tax_tp = this.ctx.helper.div(nd.sf_tp !== undefined ? nd.sf_tp : 0, divNum, this.ctx.costStage.decimal.tp);
|
|
|
+ nd.yf_excl_tax_tp = this.ctx.helper.div(nd.yf_tp !== undefined ? nd.yf_tp : 0, divNum, this.ctx.costStage.decimal.excl_tax_tp);
|
|
|
+ nd.sf_excl_tax_tp = this.ctx.helper.div(nd.sf_tp !== undefined ? nd.sf_tp : 0, divNum, this.ctx.costStage.decimal.excl_tax_tp);
|
|
|
}
|
|
|
insertData.push(nd);
|
|
|
}
|
|
|
@@ -250,8 +250,8 @@ module.exports = app => {
|
|
|
if (d.tax !== undefined || nd.sf_tp !== undefined || nd.yf_tp !== undefined) {
|
|
|
nd.tax = d.tax !== undefined ? this.ctx.helper.round(d.tax || 0, this.ctx.costStage.decimal.tax) : od.tax;
|
|
|
const divNum = nd.tax ? this.ctx.helper.add(1, this.ctx.helper.div(nd.tax, 100)) : 1;
|
|
|
- nd.yf_excl_tax_tp = this.ctx.helper.div(nd.yf_tp !== undefined ? nd.yf_tp : od.yf_tp, divNum, this.ctx.costStage.decimal.tp);
|
|
|
- nd.sf_excl_tax_tp = this.ctx.helper.div(nd.sf_tp !== undefined ? nd.sf_tp : od.sf_tp, divNum, this.ctx.costStage.decimal.tp);
|
|
|
+ nd.yf_excl_tax_tp = this.ctx.helper.div(nd.yf_tp !== undefined ? nd.yf_tp : od.yf_tp, divNum, this.ctx.costStage.decimal.excl_tax_tp);
|
|
|
+ nd.sf_excl_tax_tp = this.ctx.helper.div(nd.sf_tp !== undefined ? nd.sf_tp : od.sf_tp, divNum, this.ctx.costStage.decimal.excl_tax_tp);
|
|
|
}
|
|
|
uDatas.push(nd);
|
|
|
}
|
|
|
@@ -327,8 +327,8 @@ module.exports = app => {
|
|
|
idetail.yf_tp = this.ctx.helper.add(idetail.yf_tp, pay.yf_price);
|
|
|
idetail.sf_tp = this.ctx.helper.add(idetail.sf_tp, pay.sf_price);
|
|
|
const divNum = idetail.tax ? this.ctx.helper.add(1, this.ctx.helper.div(idetail.tax, 100)) : 1;
|
|
|
- idetail.yf_excl_tax_tp = this.ctx.helper.add(idetail.yf_excl_tax_tp, this.ctx.helper.div(pay.yf_price, divNum, this.ctx.costStage.decimal.tp));
|
|
|
- idetail.sf_excl_tax_tp = this.ctx.helper.add(idetail.sf_excl_tax_tp, this.ctx.helper.div(pay.sf_price, divNum, this.ctx.costStage.decimal.tp));
|
|
|
+ idetail.yf_excl_tax_tp = this.ctx.helper.add(idetail.yf_excl_tax_tp, this.ctx.helper.div(pay.yf_price, divNum, this.ctx.costStage.decimal.excl_tax_tp));
|
|
|
+ idetail.sf_excl_tax_tp = this.ctx.helper.add(idetail.sf_excl_tax_tp, this.ctx.helper.div(pay.sf_price, divNum, this.ctx.costStage.decimal.excl_tax_tp));
|
|
|
}
|
|
|
const detailDatas = await this.getAllDataByCondition({ columns: ['id'], where: { ledger_id: ledgerId, stage_id: this.ctx.costStage.id } });
|
|
|
const billsUpdate = await this._getLedgerUpdateData(insertDetails, ledgerId, []);
|
|
|
@@ -338,7 +338,7 @@ module.exports = app => {
|
|
|
try {
|
|
|
await conn.delete(this.tableName, { stage_id: this.ctx.costStage.id, ledger_id: ledgerId });
|
|
|
if (detailDatas.length > 0) {
|
|
|
- await this.transaction.update(this.ctx.service.costStageFile.tableName, { is_deleted: 1 }, { where: { rela_sub_id: detailDatas.map(x => { return x.id; }) } });
|
|
|
+ await conn.update(this.ctx.service.costStageFile.tableName, { is_deleted: 1 }, { where: { rela_sub_id: detailDatas.map(x => { return x.id; }) } });
|
|
|
await conn.delete(this.ctx.service.costStageTag.tableName, { rela_sub_id: detailDatas.map(x => { return x.id; }) });
|
|
|
}
|
|
|
if (insertDetails.length > 0) await conn.insert(this.tableName, insertDetails);
|