견적서

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

View File

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