fix: 修改结算单其他费用的计算逻辑 (#1146)

Reviewed-on: daoyoucloud/tachybase#1146
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-06-11 11:20:09 +08:00 committed by sealday
parent 98e4f7327c
commit 61b685c522

View File

@ -535,21 +535,20 @@ export class SettlementService {
rule.conversion_logic_id !== ConversionLogics.ProductWeight
) {
settlementAbout.records?.forEach((item) => {
if (
dayjs(item.date).isBetween(ruleItem.start_date, ruleItem.end_date, 'day', '[]') &&
dayjs(item.date).isSameOrAfter(settlementAbout.start_date)
) {
if (dayjs(item.date).isBetween(settlementAbout.start_date, settlementAbout.end_date, 'day', '[]')) {
const feeItem = item?.record_items.filter(
(value) => value && value.product_id === rule.fee_product_id,
);
if (feeItem.length) {
feeItem.forEach((value) => {
if (category === '其他') {
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);
const otherData = { ...data };
otherData.movement = item.movement;
otherData.count = value.count * Number(item.movement === '-1' ? '1' : '-1');
otherData.date = dayjs(item.date).endOf('day');
otherData.amount = otherData.count * otherData.unit_price;
otherData.item_count = value.count;
createFeesDatas.push(otherData);
} else {
data.count = data.count + value.count;
conversion = true;