견적서

This commit is contained in:
basssy 2024-11-27 18:12:02 +09:00
parent c7188da100
commit 4fccfbb621
2 changed files with 39 additions and 22 deletions

View File

@ -123,6 +123,7 @@ export default function Estimate({ params }) {
if (estimateContextState?.estimateOption) {
res.map((row) => {
let estimateOption = estimateContextState?.estimateOption?.split('、')
// console.log(':::', estimateOption)
row.check = false
estimateOption.map((row2) => {
if (row.pkgYn === '0') {
@ -207,8 +208,12 @@ export default function Estimate({ params }) {
// set
useEffect(() => {
if (isNotEmptyArray(estimateContextState.fileList)) {
//
setFiles([])
setOriginFiles(estimateContextState.fileList)
}
// setFiles([])
}, [estimateContextState?.fileList])
//
@ -520,12 +525,14 @@ export default function Estimate({ params }) {
updates.pkgMaterialFlg = res.pkgMaterialFlg
updates.pnowW = res.pnowW
updates.salePrice = res.salePrice
// updates.salePrice = ''
updates.specification = res.specification
updates.unit = res.unit
updates.specialNoteCd = res.spnAttrCds
updates.itemGroup = res.itemGroup
updates.delFlg = '0' // 0
updates.saleTotPrice = (res.salePrice * estimateContextState.itemList[index].amount).toString()
// updates.saleTotPrice = ''
updates.amount = ''
if (estimateContextState.estimateType === 'YJSS') {
@ -539,7 +546,11 @@ export default function Estimate({ params }) {
updateList = estimateContextState.itemList.map((item) => {
if (item.dispOrder === dispOrder) {
return { ...item, ...updates }
if (item?.addFlg) {
return { ...item, ...updates, saleTotPrice: '' }
} else {
return { ...item, ...updates, salePrice: '', saleTotPrice: '' }
}
} else if (item.paDispOrder === dispOrder) {
//
return { ...item, delFlg: '1' }
@ -557,14 +568,12 @@ export default function Estimate({ params }) {
bomItem.salePrice = '0'
bomItem.saleTotPrice = '0'
bomItem.unitPrice = '0'
// bomItem.amount = null
} else {
bomItem.dispOrder = (index + 1 + Number(dispOrder)).toString()
bomItem.paDispOrder = dispOrder
bomItem.salePrice = '0'
bomItem.saleTotPrice = '0'
bomItem.unitPrice = '0'
// bomItem.amount = null
}
bomItem.delFlg = '0'
@ -639,7 +648,7 @@ export default function Estimate({ params }) {
estimateContextState.itemList.sort((a, b) => {
return a.dispOrder - b.dispOrder
})
console.log('YJOD 토탈만들어주기::::::::::', estimateContextState.itemList)
// console.log('YJOD ::::::::::', estimateContextState.itemList)
let pushData = []
let uniquSet = new Set()
@ -660,25 +669,33 @@ export default function Estimate({ params }) {
}
})
let estimateOption = estimateContextState?.estimateOption?.split('、')
let removeEstimateOption = estimateOption.filter((option) => pushData.includes(option))
// let estimateOptionString = estimateOption.join('')
// console.log('::', estimateOption)
let removeEstimateOption = estimateOption.filter((option) => !pushData.includes(option))
// console.log('?? ', removeEstimateOption)
let removeEstimateOptionString = removeEstimateOption.join('、')
// console.log('SpecialNoteLis::', specialNoteList)
specialNoteList.map((row) => {
row.check = false
estimateOption.map((row2) => {
if (row.pkgYn === '0') {
if (row2 === row.code) {
row.check = true
}
} else {
console.log('제품가대세팅::::', row.code)
console.log('removeEstimateOption::::', removeEstimateOption)
return
}
})
})
// specialNoteList.map((row) => {
// row.check = false
// estimateOption.map((row2) => {
// if (row.pkgYn === '0') {
// if (row2 === row.code) {
// row.check = true
// }
// } else {
// // console.log('::', removeEstimateOptionString)
// if (row.code.includes(removeEstimateOptionString)) {
// // console.log('removeEstimateOption::::', removeEstimateOption)
// // row.check = false
// return
// } else {
// // console.log('::::', row.code)
// // row.check = true
// }
// }
// })
// })
estimateContextState.itemList.map((item) => {
delete item.showSalePrice
@ -701,7 +718,6 @@ export default function Estimate({ params }) {
// const price
totAmount += amount
supplyPrice += price
console.log('공급가액::::::::::::::::::::::', supplyPrice)
}
})
@ -717,7 +733,7 @@ export default function Estimate({ params }) {
})
} else {
//YJSS
console.log('YJSS 토탈만들어주기::::::::::', estimateContextState.itemList)
// console.log('YJSS ::::::::::', estimateContextState.itemList)
estimateContextState.itemList.sort((a, b) => {
return a.dispOrder - b.dispOrder
})

View File

@ -88,6 +88,7 @@ export const useEstimateController = (planNo) => {
itemChangeFlg: '1', //추가시 체인지플래그 1로
partAdd: '1', //NEW 체인지 플래그
delFlg: '0', //삭제 플래그 0 삭제하면 1
addFlg: true,
},
],
})