견적서

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

View File

@ -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: true,
}, },
], ],
}) })