견적서 상세 봄제품

This commit is contained in:
basssy 2024-12-06 10:15:28 +09:00
parent 96290ea060
commit 706af69fef

View File

@ -661,12 +661,14 @@ export default function Estimate({ params }) {
bomItem.salePrice = '0' bomItem.salePrice = '0'
bomItem.saleTotPrice = '0' bomItem.saleTotPrice = '0'
bomItem.unitPrice = '0' bomItem.unitPrice = '0'
bomItem.showSalePrice = '0'
} else { } else {
bomItem.dispOrder = (index + 1 + Number(dispOrder)).toString() bomItem.dispOrder = (index + 1 + Number(dispOrder)).toString()
bomItem.paDispOrder = dispOrder bomItem.paDispOrder = dispOrder
bomItem.salePrice = '0' bomItem.salePrice = '0'
bomItem.saleTotPrice = '0' bomItem.saleTotPrice = '0'
bomItem.unitPrice = '0' bomItem.unitPrice = '0'
bomItem.showSalePrice = '0'
} }
bomItem.delFlg = '0' bomItem.delFlg = '0'
@ -748,12 +750,10 @@ export default function Estimate({ params }) {
makeUniqueSpecialNoteCd(itemList) makeUniqueSpecialNoteCd(itemList)
itemList.forEach((item) => { itemList.forEach((item) => {
// console.log('YJOD::::::', item)
delete item.showSalePrice delete item.showSalePrice
delete item.showSaleTotPrice delete item.showSaleTotPrice
if (item.delFlg === '0') { if (item.delFlg === '0') {
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
// let price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0
let price let price
if (amount === 0) { if (amount === 0) {
price = 0 price = 0
@ -768,6 +768,10 @@ export default function Estimate({ params }) {
totals.supplyPrice += price totals.supplyPrice += price
totals.totAmount += amount totals.totAmount += amount
if (item.paDispOrder) {
item.showSalePrice = '0'
item.showSaleTotPrice = '0'
}
if (item.openFlg === '1') { if (item.openFlg === '1') {
item.showSalePrice = '0' item.showSalePrice = '0'
item.showSaleTotPrice = '0' item.showSaleTotPrice = '0'
@ -777,8 +781,6 @@ export default function Estimate({ params }) {
totals.vatPrice = totals.supplyPrice * 0.1 totals.vatPrice = totals.supplyPrice * 0.1
totals.totPrice = totals.supplyPrice + totals.vatPrice totals.totPrice = totals.supplyPrice + totals.vatPrice
// console.log('YJOD:::totlas:::', totals)
} }
const calculateYJSSTotals = (itemList) => { const calculateYJSSTotals = (itemList) => {
@ -787,7 +789,6 @@ export default function Estimate({ params }) {
itemList.forEach((item) => { itemList.forEach((item) => {
if (item.delFlg === '0') { if (item.delFlg === '0') {
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
// let salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0
let salePrice let salePrice
if (item.moduleFlg === '1') { if (item.moduleFlg === '1') {
const volKw = (item.pnowW * amount) / 1000 const volKw = (item.pnowW * amount) / 1000
@ -810,6 +811,14 @@ export default function Estimate({ params }) {
item.showSalePrice = '0' item.showSalePrice = '0'
item.showSaleTotPrice = '0' item.showSaleTotPrice = '0'
} }
} else {
item.showSalePrice = '0'
item.showSaleTotPrice = '0'
}
if (item.openFlg === '1') {
item.showSalePrice = '0'
item.showSaleTotPrice = '0'
} }
} }
}) })
@ -818,18 +827,15 @@ export default function Estimate({ params }) {
totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice
totals.vatPrice = totals.supplyPrice * 0.1 totals.vatPrice = totals.supplyPrice * 0.1
totals.totPrice = totals.supplyPrice + totals.vatPrice totals.totPrice = totals.supplyPrice + totals.vatPrice
// console.log('YJOD:::totlas:::', totals)
} }
if (estimateContextState.estimateType === 'YJOD') { if (estimateContextState.estimateType === 'YJOD') {
calculateYJODTotals(estimateContextState.itemList) calculateYJODTotals(estimateContextState.itemList)
setEstimateContextState({ setEstimateContextState({
totAmount: totals.totAmount, totAmount: totals.totAmount,
totVolKw: totals.totVolKw.toFixed(2), totVolKw: totals.totVolKw.toFixed(2),
supplyPrice: totals.supplyPrice.toFixed(2), supplyPrice: totals.supplyPrice.toFixed(0), //
vatPrice: totals.vatPrice.toFixed(2), vatPrice: totals.vatPrice.toFixed(0), //
totPrice: totals.totPrice.toFixed(2), totPrice: totals.totPrice.toFixed(0), //
}) })
} else if (estimateContextState.estimateType === 'YJSS') { } else if (estimateContextState.estimateType === 'YJSS') {
calculateYJSSTotals(estimateContextState.itemList) calculateYJSSTotals(estimateContextState.itemList)
@ -837,9 +843,9 @@ export default function Estimate({ params }) {
pkgTotPrice: totals.pkgTotPrice, pkgTotPrice: totals.pkgTotPrice,
totAmount: totals.totAmount, totAmount: totals.totAmount,
totVolKw: totals.totVolKw.toFixed(2), totVolKw: totals.totVolKw.toFixed(2),
supplyPrice: totals.supplyPrice.toFixed(2), supplyPrice: totals.supplyPrice.toFixed(0), //
vatPrice: totals.vatPrice.toFixed(2), vatPrice: totals.vatPrice.toFixed(0), //
totPrice: totals.totPrice.toFixed(2), totPrice: totals.totPrice.toFixed(0), //
}) })
} }
@ -1312,15 +1318,15 @@ export default function Estimate({ params }) {
</div> </div>
<div className="estimate-box"> <div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.supplyPrice')}</div> <div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.supplyPrice')}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimal(estimateContextState?.supplyPrice)}</div> <div className="estimate-name blue">{convertNumberToPriceDecimalToFixed(estimateContextState?.supplyPrice, 0)}</div>
</div> </div>
<div className="estimate-box"> <div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.vatPrice')}</div> <div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.vatPrice')}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimal(estimateContextState?.vatPrice)}</div> <div className="estimate-name blue">{convertNumberToPriceDecimalToFixed(estimateContextState?.vatPrice, 0)}</div>
</div> </div>
<div className="estimate-box"> <div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.totPrice')}</div> <div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.totPrice')}</div>
<div className="estimate-name red">{convertNumberToPriceDecimal(estimateContextState?.totPrice)}</div> <div className="estimate-name red">{convertNumberToPriceDecimalToFixed(estimateContextState?.totPrice, 0)}</div>
</div> </div>
</div> </div>
</div> </div>
@ -1491,7 +1497,6 @@ export default function Estimate({ params }) {
<div className="form-flex-wrap"> <div className="form-flex-wrap">
<div className="select-wrap mr5"> <div className="select-wrap mr5">
<Select <Select
// id="long-value-select1"
name="long-value-select1" name="long-value-select1"
instanceId="long-value-select1" instanceId="long-value-select1"
className="react-select-custom" className="react-select-custom"
@ -1560,15 +1565,17 @@ export default function Estimate({ params }) {
className="input-light al-r" className="input-light al-r"
value={convertNumberToPriceDecimal(item?.showSalePrice === '0' ? null : item?.salePrice?.replaceAll(',', ''))} value={convertNumberToPriceDecimal(item?.showSalePrice === '0' ? null : item?.salePrice?.replaceAll(',', ''))}
disabled={ disabled={
estimateContextState?.estimateType === 'YJSS' item.openFlg === '1'
? item?.paDispOrder ? true
? true : estimateContextState?.estimateType === 'YJSS'
: item.pkgMaterialFlg !== '1' ? item?.paDispOrder
: item.itemId === '' || !!item?.paDispOrder
? true
: item.openFlg === '1'
? true ? true
: false : item.pkgMaterialFlg !== '1'
: item.itemId === '' || !!item?.paDispOrder
? true
: item.openFlg === '1'
? true
: false
} }
onChange={(e) => { onChange={(e) => {
onChangeSalePrice(e.target.value, item.dispOrder, index) onChangeSalePrice(e.target.value, item.dispOrder, index)