fix: 结算表无关联费用支持其他类型 (#799)
Co-authored-by: sealday <zhanglin@daoyoucloud.com> Reviewed-on: daoyoucloud/tachybase#799 Co-authored-by: wjh <wwwjh0710@163.com> Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
parent
75b4dae712
commit
eeed385ea1
5
.changeset/three-pumpkins-grow.md
Normal file
5
.changeset/three-pumpkins-grow.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@hera/plugin-rental": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
结算表无关联费用支持其他类型
|
@ -116,6 +116,10 @@ export const excelDataHandle = (excelData) => {
|
|||||||
name: '装卸运费',
|
name: '装卸运费',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '其他',
|
||||||
|
key: 'name',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: '税率',
|
name: '税率',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
@ -144,6 +148,7 @@ export const excelDataHandle = (excelData) => {
|
|||||||
parseFloat(calc.n_compensate.toFixed(2)),
|
parseFloat(calc.n_compensate.toFixed(2)),
|
||||||
parseFloat(calc.h_compensate.toFixed(2)),
|
parseFloat(calc.h_compensate.toFixed(2)),
|
||||||
parseFloat(calc.loadfreight.toFixed(2)),
|
parseFloat(calc.loadfreight.toFixed(2)),
|
||||||
|
parseFloat(calc.other.toFixed(2)),
|
||||||
formatPercent(calc.tax, 2),
|
formatPercent(calc.tax, 2),
|
||||||
parseFloat(calc.current_expenses.toFixed(2)),
|
parseFloat(calc.current_expenses.toFixed(2)),
|
||||||
parseFloat(calc.accumulate.toFixed(2)),
|
parseFloat(calc.accumulate.toFixed(2)),
|
||||||
|
@ -13,6 +13,7 @@ export interface Settlement {
|
|||||||
loadfreight: number;
|
loadfreight: number;
|
||||||
h_compensate: number;
|
h_compensate: number;
|
||||||
n_compensate: number;
|
n_compensate: number;
|
||||||
|
other: number;
|
||||||
maintenance: number;
|
maintenance: number;
|
||||||
rent: number;
|
rent: number;
|
||||||
current_expenses: number;
|
current_expenses: number;
|
||||||
|
@ -179,6 +179,7 @@ const PreviewDocument = ({
|
|||||||
无物赔偿: calc.n_compensate ?? 0.0,
|
无物赔偿: calc.n_compensate ?? 0.0,
|
||||||
有物赔偿: calc.h_compensate ?? 0.0,
|
有物赔偿: calc.h_compensate ?? 0.0,
|
||||||
装卸运费: calc.loadfreight ?? 0.0,
|
装卸运费: calc.loadfreight ?? 0.0,
|
||||||
|
其他: calc.other ?? 0.0,
|
||||||
税率: calc.tax ?? 0.0,
|
税率: calc.tax ?? 0.0,
|
||||||
本期费用: calc.current_expenses ?? 0.0,
|
本期费用: calc.current_expenses ?? 0.0,
|
||||||
累计费用: calc.accumulate ?? 0.0,
|
累计费用: calc.accumulate ?? 0.0,
|
||||||
@ -270,6 +271,7 @@ const PreviewDocument = ({
|
|||||||
<Text style={styles.tableCellTitle}>无物赔偿</Text>
|
<Text style={styles.tableCellTitle}>无物赔偿</Text>
|
||||||
<Text style={styles.tableCellTitle}>有物赔偿</Text>
|
<Text style={styles.tableCellTitle}>有物赔偿</Text>
|
||||||
<Text style={styles.tableCellTitle}>装卸运费</Text>
|
<Text style={styles.tableCellTitle}>装卸运费</Text>
|
||||||
|
<Text style={styles.tableCellTitle}>其他</Text>
|
||||||
<Text style={styles.tableCellTitle}>税率</Text>
|
<Text style={styles.tableCellTitle}>税率</Text>
|
||||||
<Text style={styles.tableCellTitle}>本期费用</Text>
|
<Text style={styles.tableCellTitle}>本期费用</Text>
|
||||||
<Text style={styles.tableCellTitle}>累计费用</Text>
|
<Text style={styles.tableCellTitle}>累计费用</Text>
|
||||||
@ -282,6 +284,7 @@ const PreviewDocument = ({
|
|||||||
<Text style={styles.tableCell}>{formatCurrency(group['无物赔偿'], 2)}</Text>
|
<Text style={styles.tableCell}>{formatCurrency(group['无物赔偿'], 2)}</Text>
|
||||||
<Text style={styles.tableCell}>{formatCurrency(group['有物赔偿'], 2)}</Text>
|
<Text style={styles.tableCell}>{formatCurrency(group['有物赔偿'], 2)}</Text>
|
||||||
<Text style={styles.tableCell}>{formatCurrency(group['装卸运费'], 2)}</Text>
|
<Text style={styles.tableCell}>{formatCurrency(group['装卸运费'], 2)}</Text>
|
||||||
|
<Text style={styles.tableCell}>{formatCurrency(group['其他'], 2)}</Text>
|
||||||
<Text style={styles.tableCell}>{formatPercent(group['税率'], 2)}</Text>
|
<Text style={styles.tableCell}>{formatPercent(group['税率'], 2)}</Text>
|
||||||
<Text style={styles.tableCell}>{formatCurrency(group['本期费用'], 2)}</Text>
|
<Text style={styles.tableCell}>{formatCurrency(group['本期费用'], 2)}</Text>
|
||||||
<Text style={styles.tableCell}>{formatCurrency(group['累计费用'], 2)} </Text>
|
<Text style={styles.tableCell}>{formatCurrency(group['累计费用'], 2)} </Text>
|
||||||
|
@ -439,12 +439,15 @@ export class SettlementService {
|
|||||||
let conversion = false;
|
let conversion = false;
|
||||||
const spec = rule.product.spec;
|
const spec = rule.product.spec;
|
||||||
const name = rule.product.name;
|
const name = rule.product.name;
|
||||||
|
const category = ['装卸运费', '维修人工', '无物赔偿', '有物赔偿'].includes(rule.product.name)
|
||||||
|
? rule.product.name
|
||||||
|
: '其他';
|
||||||
const data = {
|
const data = {
|
||||||
settlement_id: settlementsId,
|
settlement_id: settlementsId,
|
||||||
date: dayjs(settlementAbout.end_date).add(1, 'day').add(-1, 'minute'),
|
date: dayjs(settlementAbout.end_date).add(1, 'day').add(-1, 'minute'),
|
||||||
name: spec,
|
name: `${name}[${spec}]`,
|
||||||
label: spec,
|
label: `${name}[${spec}]`,
|
||||||
category: name,
|
category: category,
|
||||||
movement: '0',
|
movement: '0',
|
||||||
count: 0,
|
count: 0,
|
||||||
item_count: 0,
|
item_count: 0,
|
||||||
@ -536,8 +539,16 @@ export class SettlementService {
|
|||||||
const feeItem = item?.record_items.filter((value) => value.product_id === rule.fee_product_id);
|
const feeItem = item?.record_items.filter((value) => value.product_id === rule.fee_product_id);
|
||||||
if (feeItem.length) {
|
if (feeItem.length) {
|
||||||
feeItem.forEach((value) => {
|
feeItem.forEach((value) => {
|
||||||
data.count = data.count + value.count;
|
if (category === '其他') {
|
||||||
conversion = true;
|
data.movement = item.movement;
|
||||||
|
data.count = value.count * Number(item.movement === '-1' ? '1' : '-1');
|
||||||
|
data.date = item.date;
|
||||||
|
data.amount = data.count * data.unit_price;
|
||||||
|
createFeesDatas.push(data);
|
||||||
|
} else {
|
||||||
|
data.count = data.count + value.count;
|
||||||
|
conversion = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (item.fee_item.length) {
|
if (item.fee_item.length) {
|
||||||
@ -736,6 +747,7 @@ export class SettlementService {
|
|||||||
n_compensate: 0.0, //无物赔偿
|
n_compensate: 0.0, //无物赔偿
|
||||||
h_compensate: 0.0, //有物赔偿
|
h_compensate: 0.0, //有物赔偿
|
||||||
loadfreight: 0.0, //装卸运费
|
loadfreight: 0.0, //装卸运费
|
||||||
|
other: 0.0,
|
||||||
current_expenses: 0.0, //本期费用
|
current_expenses: 0.0, //本期费用
|
||||||
tax: 0.0, //税率
|
tax: 0.0, //税率
|
||||||
accumulate: 0.0, //累计费用
|
accumulate: 0.0, //累计费用
|
||||||
@ -758,6 +770,9 @@ export class SettlementService {
|
|||||||
case Itemcategory.loadFreight:
|
case Itemcategory.loadFreight:
|
||||||
summaryPeriod.loadfreight += value.amount;
|
summaryPeriod.loadfreight += value.amount;
|
||||||
break;
|
break;
|
||||||
|
case Itemcategory.other:
|
||||||
|
summaryPeriod.other += value.amount;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
settlementAbout.settlement_add_items.forEach((value) => {
|
settlementAbout.settlement_add_items.forEach((value) => {
|
||||||
@ -787,6 +802,7 @@ export class SettlementService {
|
|||||||
summaryPeriod.maintenance +
|
summaryPeriod.maintenance +
|
||||||
summaryPeriod.n_compensate +
|
summaryPeriod.n_compensate +
|
||||||
summaryPeriod.h_compensate +
|
summaryPeriod.h_compensate +
|
||||||
|
summaryPeriod.other +
|
||||||
summaryPeriod.loadfreight) *
|
summaryPeriod.loadfreight) *
|
||||||
(summaryPeriod.tax + 1);
|
(summaryPeriod.tax + 1);
|
||||||
const settlement = settlementAbout.settlements?.filter((value) =>
|
const settlement = settlementAbout.settlements?.filter((value) =>
|
||||||
@ -821,6 +837,7 @@ export class SettlementService {
|
|||||||
n_compensate: settlementAbout.n_compensate, //无物赔偿
|
n_compensate: settlementAbout.n_compensate, //无物赔偿
|
||||||
h_compensate: settlementAbout.h_compensate, //有物赔偿
|
h_compensate: settlementAbout.h_compensate, //有物赔偿
|
||||||
loadfreight: settlementAbout.loadfreight, //装卸运费
|
loadfreight: settlementAbout.loadfreight, //装卸运费
|
||||||
|
other: settlementAbout.other, //其他
|
||||||
current_expenses: settlementAbout.current_expenses, //本期费用
|
current_expenses: settlementAbout.current_expenses, //本期费用
|
||||||
tax: settlementAbout.tax, //税率
|
tax: settlementAbout.tax, //税率
|
||||||
accumulate: settlementAbout.accumulate, //累计费用
|
accumulate: settlementAbout.accumulate, //累计费用
|
||||||
|
@ -123,6 +123,10 @@ export enum Itemcategory {
|
|||||||
* 租金
|
* 租金
|
||||||
*/
|
*/
|
||||||
rent = '租金',
|
rent = '租金',
|
||||||
|
/**
|
||||||
|
* 其他
|
||||||
|
*/
|
||||||
|
other = '其他',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum countCource {
|
export enum countCource {
|
||||||
|
Loading…
Reference in New Issue
Block a user