견적서

This commit is contained in:
basssy 2024-11-26 15:05:50 +09:00
parent d5d6cda1f0
commit 8e47b69266
2 changed files with 25 additions and 17 deletions

View File

@ -447,7 +447,6 @@ export default function Estimate({ params }) {
})
//
setItemChangeYn(true)
} else {
}
}
@ -471,10 +470,15 @@ export default function Estimate({ params }) {
updateList = estimateContextState.itemList.map((item) => {
if (item.dispOrder === dispOrder) {
return { ...item, ...updates }
} else if (item.paDispOrder === dispOrder) {
return { ...item, ...updates, amount: (item.bomAmount * amount?.replaceAll(',', '')).toLocaleString(), saleTotPrice: '0' }
} else {
return item
}
})
console.log('updateList::', updateList)
// return
setEstimateContextState({
itemList: updateList,
})
@ -556,7 +560,6 @@ export default function Estimate({ params }) {
return { ...item, ...updates }
} else if (item.paDispOrder === dispOrder) {
return { ...item, delFlg: '0' }
// return { ...item, delFlg: '1' }
} else {
return item
}
@ -569,14 +572,16 @@ export default function Estimate({ params }) {
bomItem.dispOrder = (index + 1 + maxItemDispOrder).toString()
bomItem.paDispOrder = dispOrder
bomItem.salePrice = '0'
//unitPrice??
bomItem.saleTotPrice = '0'
bomItem.unitPrice = '0'
bomItem.amount = bomItem.bomAmount
} else {
bomItem.dispOrder = (index + 1 + Number(dispOrder)).toString()
bomItem.paDispOrder = dispOrder
bomItem.salePrice = '0'
//unitPrice??
bomItem.saleTotPrice = '0'
bomItem.unitPrice = '0'
bomItem.amount = bomItem.bomAmount
}
bomItem.delFlg = '0'
@ -620,6 +625,8 @@ export default function Estimate({ params }) {
}
})
console.log('updateList::', updateList)
let delCnt = 0
updateList.map((item) => {
if (item.delFlg === '1') {
@ -696,15 +703,16 @@ export default function Estimate({ params }) {
estimateContextState.itemList.map((item) => {
if (item.delFlg === '0') {
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', ''))
let price = Number(item.saleTotPrice?.replaceAll(',', ''))
console.log('amount::', amount)
let salePrice = Number(item.salePrice?.replaceAll(',', ''))
let saleTotPrice = Number(item.saleTotPrice?.replaceAll(',', ''))
if (isNaN(amount)) {
amount = 0
}
if (isNaN(price)) {
price = 0
if (isNaN(saleTotPrice)) {
saleTotPrice = 0
}
if (isNaN(salePrice)) {
@ -715,9 +723,7 @@ export default function Estimate({ params }) {
const volKw = (item.pnowW * amount) / 1000
totVolKw += volKw
}
// const price
supplyPrice += price
// const saleTotPrice
totAmount += amount
if (item.pkgMaterialFlg === '1') {
const pkgPrice = amount * salePrice
@ -725,6 +731,7 @@ export default function Estimate({ params }) {
//YJSS PKG(1) * (supplyPrice)
addSupplyPrice += pkgPrice
}
if (!item.paDispOrder) {
//paDispOrder
if (item.pkgMaterialFlg === '0') {
@ -735,7 +742,7 @@ export default function Estimate({ params }) {
}
})
supplyPrice += addSupplyPrice
supplyPrice = addSupplyPrice + Number(estimateContextState.pkgTotPrice)
vatPrice = supplyPrice * 0.1
totPrice = supplyPrice + vatPrice
setEstimateContextState({
@ -1145,15 +1152,15 @@ export default function Estimate({ params }) {
</div>
<div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.supplyPrice')}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimalToFixed(estimateContextState?.supplyPrice, 2)}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimal(estimateContextState?.supplyPrice)}</div>
</div>
<div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.vatPrice')}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimalToFixed(estimateContextState?.vatPrice, 2)}</div>
<div className="estimate-name blue">{convertNumberToPriceDecimal(estimateContextState?.vatPrice)}</div>
</div>
<div className="estimate-box">
<div className="estimate-tit">{getMessage('estimate.detail.sepcialEstimateProductInfo.totPrice')}</div>
<div className="estimate-name red">{convertNumberToPriceDecimalToFixed(estimateContextState?.totPrice, 2)}</div>
<div className="estimate-name red">{convertNumberToPriceDecimal(estimateContextState?.totPrice)}</div>
</div>
</div>
</div>
@ -1189,7 +1196,7 @@ export default function Estimate({ params }) {
<th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgWeight')}</th>
<td>{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)}</td>
<th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgPrice')}</th>
<td>{convertNumberToPriceDecimalToFixed(estimateContextState?.pkgTotPrice, 2)}</td>
<td>{convertNumberToPriceDecimal(estimateContextState?.pkgTotPrice)}</td>
</tr>
</tbody>
</table>
@ -1405,7 +1412,7 @@ export default function Estimate({ params }) {
</div> */}
</div>
</td>
<td className="al-r">{convertNumberToPriceDecimalToFixed(item?.saleTotPrice?.replaceAll(',', ''), 2)}</td>
<td className="al-r">{convertNumberToPriceDecimal(item?.saleTotPrice?.replaceAll(',', ''))}</td>
{/* {item?.showSaleTotPrice === '0' ? (
<td className="al-r"></td>
) : (

View File

@ -80,7 +80,7 @@ export const useEstimateController = (planNo) => {
itemId: '', //제품번호
itemNo: '',
itemName: '', //형명
amount: '0', //수량
amount: '', //수량
unitPrice: '0',
unit: '', //단위
salePrice: '', //단가
@ -88,6 +88,7 @@ export const useEstimateController = (planNo) => {
itemChangeFlg: '1', //추가시 체인지플래그 1로
partAdd: '1', //NEW 체인지 플래그
delFlg: '0', //삭제 플래그 0 삭제하면 1
// addFlg: '1', //제품추가해서 추가된건지 구분값
},
],
})