견적서 저장후 아이템 체크
This commit is contained in:
parent
d73daf1024
commit
7db2553074
@ -950,6 +950,19 @@ export default function Estimate({}) {
|
|||||||
|
|
||||||
setItemChangeYn(false)
|
setItemChangeYn(false)
|
||||||
} else {
|
} else {
|
||||||
|
let totals = {
|
||||||
|
totAmount: 0,
|
||||||
|
totVolKw: 0,
|
||||||
|
supplyPrice: 0,
|
||||||
|
vatPrice: 0,
|
||||||
|
totPrice: 0,
|
||||||
|
addSupplyPrice: 0,
|
||||||
|
pkgTotPrice: 0,
|
||||||
|
}
|
||||||
|
estimateContextState.itemList.sort((a, b) => a.dispOrder - b.dispOrder)
|
||||||
|
makeUniqueSpecialNoteCd(estimateContextState.itemList)
|
||||||
|
|
||||||
|
if (estimateContextState.estimateType === 'YJSS') {
|
||||||
estimateContextState.itemList.forEach((item) => {
|
estimateContextState.itemList.forEach((item) => {
|
||||||
if (estimateContextState.estimateType === 'YJSS' && !item.paDispOrder && item.pkgMaterialFlg === '0') {
|
if (estimateContextState.estimateType === 'YJSS' && !item.paDispOrder && item.pkgMaterialFlg === '0') {
|
||||||
item.showSalePrice = '0'
|
item.showSalePrice = '0'
|
||||||
@ -964,6 +977,59 @@ export default function Estimate({}) {
|
|||||||
item.showSaleTotPrice = '0'
|
item.showSaleTotPrice = '0'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
estimateContextState.itemList.forEach((item) => {
|
||||||
|
if (item.delFlg === '0') {
|
||||||
|
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
|
||||||
|
let salePrice
|
||||||
|
if (item.moduleFlg === '1') {
|
||||||
|
const volKw = (item.pnowW * amount) / 1000
|
||||||
|
totals.totVolKw += volKw
|
||||||
|
}
|
||||||
|
if (amount === 0) {
|
||||||
|
salePrice = 0
|
||||||
|
} else {
|
||||||
|
salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0
|
||||||
|
}
|
||||||
|
|
||||||
|
totals.totAmount += amount
|
||||||
|
if (item.pkgMaterialFlg === '1') {
|
||||||
|
const saleTotPrice = amount * salePrice
|
||||||
|
totals.addSupplyPrice += saleTotPrice
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!item.paDispOrder) {
|
||||||
|
if (item.pkgMaterialFlg === '0') {
|
||||||
|
item.showSalePrice = '0'
|
||||||
|
item.showSaleTotPrice = '0'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
item.showSalePrice = '0'
|
||||||
|
item.showSaleTotPrice = '0'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.openFlg === '1') {
|
||||||
|
item.showSalePrice = '0'
|
||||||
|
item.showSaleTotPrice = '0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let pkgAsp = estimateContextState.pkgAsp ? Number(estimateContextState.pkgAsp.replaceAll(',', '')) : 0
|
||||||
|
|
||||||
|
totals.pkgTotPrice = pkgAsp * totals.totVolKw * 1000
|
||||||
|
totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice
|
||||||
|
totals.vatPrice = totals.supplyPrice * 0.1
|
||||||
|
totals.totPrice = totals.supplyPrice + totals.vatPrice
|
||||||
|
|
||||||
|
setEstimateContextState({
|
||||||
|
pkgTotPrice: totals.pkgTotPrice,
|
||||||
|
totAmount: totals.totAmount,
|
||||||
|
totVolKw: totals.totVolKw.toFixed(2),
|
||||||
|
supplyPrice: totals.supplyPrice.toFixed(0), //소수첫자리에서 반올림
|
||||||
|
vatPrice: totals.vatPrice.toFixed(0), //소수첫자리에서 반올림
|
||||||
|
totPrice: totals.totPrice.toFixed(0), //소수첫자리에서 반올림
|
||||||
|
})
|
||||||
|
} else {
|
||||||
estimateContextState.itemList.forEach((item) => {
|
estimateContextState.itemList.forEach((item) => {
|
||||||
if (estimateContextState.estimateType === 'YJOD' && item.openFlg === '1') {
|
if (estimateContextState.estimateType === 'YJOD' && item.openFlg === '1') {
|
||||||
item.showSalePrice = '0'
|
item.showSalePrice = '0'
|
||||||
@ -974,6 +1040,48 @@ export default function Estimate({}) {
|
|||||||
item.showSaleTotPrice = '0'
|
item.showSaleTotPrice = '0'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
estimateContextState.itemList.forEach((item) => {
|
||||||
|
delete item.showSalePrice
|
||||||
|
delete item.showSaleTotPrice
|
||||||
|
if (item.delFlg === '0') {
|
||||||
|
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
|
||||||
|
let price
|
||||||
|
if (amount === 0) {
|
||||||
|
price = 0
|
||||||
|
} else {
|
||||||
|
price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.moduleFlg === '1') {
|
||||||
|
const volKw = (item.pnowW * amount) / 1000
|
||||||
|
totals.totVolKw += volKw
|
||||||
|
}
|
||||||
|
totals.supplyPrice += price
|
||||||
|
totals.totAmount += amount
|
||||||
|
|
||||||
|
if (item.paDispOrder) {
|
||||||
|
item.showSalePrice = '0'
|
||||||
|
item.showSaleTotPrice = '0'
|
||||||
|
}
|
||||||
|
if (item.openFlg === '1') {
|
||||||
|
item.showSalePrice = '0'
|
||||||
|
item.showSaleTotPrice = '0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
totals.vatPrice = totals.supplyPrice * 0.1
|
||||||
|
totals.totPrice = totals.supplyPrice + totals.vatPrice
|
||||||
|
|
||||||
|
setEstimateContextState({
|
||||||
|
totAmount: totals.totAmount,
|
||||||
|
totVolKw: totals.totVolKw.toFixed(2),
|
||||||
|
supplyPrice: totals.supplyPrice.toFixed(0), //소수첫자리에서 반올림
|
||||||
|
vatPrice: totals.vatPrice.toFixed(0), //소수첫자리에서 반올림
|
||||||
|
totPrice: totals.totPrice.toFixed(0), //소수첫자리에서 반올림
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [itemChangeYn, estimateContextState.itemList])
|
}, [itemChangeYn, estimateContextState.itemList])
|
||||||
|
|
||||||
|
|||||||
@ -385,7 +385,7 @@ export const useEstimateController = (planNo) => {
|
|||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
estimateData.newFileList = []
|
estimateData.newFileList = []
|
||||||
swalFire({ text: getMessage('estimate.detail.save.alertMsg'), type: 'alert' })
|
swalFire({ text: getMessage('estimate.detail.save.alertMsg'), type: 'alert' })
|
||||||
fetchSetting(objectRecoil.floorPlanObjectNo, estimateData.planNo)
|
fetchSetting(estimateData.objectNo, estimateData.planNo)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -410,7 +410,7 @@ export const useEstimateController = (planNo) => {
|
|||||||
const params = {
|
const params = {
|
||||||
saleStoreId: session.storeId,
|
saleStoreId: session.storeId,
|
||||||
sapSalesStoreCd: session.custCd,
|
sapSalesStoreCd: session.custCd,
|
||||||
objectNo: objectRecoil.floorPlanObjectNo,
|
objectNo: estimateData.objectNo,
|
||||||
planNo: sendPlanNo,
|
planNo: sendPlanNo,
|
||||||
copySaleStoreId: otherSaleStoreId ? otherSaleStoreId : saleStoreId,
|
copySaleStoreId: otherSaleStoreId ? otherSaleStoreId : saleStoreId,
|
||||||
copyReceiveUser: copyReceiveUser,
|
copyReceiveUser: copyReceiveUser,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user