견적서 상세
This commit is contained in:
parent
a5e49e6b23
commit
140df034e4
@ -235,6 +235,15 @@ export default function Estimate({ params }) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//비워주기
|
||||||
|
setEstimateContextState({
|
||||||
|
pkgAsp: '0',
|
||||||
|
pkgTotPrice: '0',
|
||||||
|
})
|
||||||
|
|
||||||
|
//YJOD로 돌아가도 UNIT_PRICE로 프라이싱 실행해서 정가로 셋팅
|
||||||
|
handlePricing('UNIT_PRICE')
|
||||||
}
|
}
|
||||||
|
|
||||||
setItemChangeYn(true)
|
setItemChangeYn(true)
|
||||||
@ -312,7 +321,11 @@ export default function Estimate({ params }) {
|
|||||||
data.data2.map((item2) => {
|
data.data2.map((item2) => {
|
||||||
if (item2) {
|
if (item2) {
|
||||||
if (item2.itemId === item.itemId) {
|
if (item2.itemId === item.itemId) {
|
||||||
updateList.push({ ...item, salePrice: item2.unitPrice, saleTotPrice: (item.amount * item2.unitPrice).toString() })
|
updateList.push({
|
||||||
|
...item,
|
||||||
|
salePrice: item2.unitPrice === null ? '0' : item2.unitPrice,
|
||||||
|
saleTotPrice: (item.amount * item2.unitPrice).toString(),
|
||||||
|
})
|
||||||
checkYn = true
|
checkYn = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,6 +398,7 @@ export default function Estimate({ params }) {
|
|||||||
})
|
})
|
||||||
//아이템들 중 조건에 맞는애들 뽑아서 상단 공급가액 부가세 총액 수정
|
//아이템들 중 조건에 맞는애들 뽑아서 상단 공급가액 부가세 총액 수정
|
||||||
setItemChangeYn(true)
|
setItemChangeYn(true)
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,8 +495,8 @@ export default function Estimate({ params }) {
|
|||||||
|
|
||||||
if (estimateContextState.estimateType === 'YJSS') {
|
if (estimateContextState.estimateType === 'YJSS') {
|
||||||
if (res.pkgMaterialFlg === '0') {
|
if (res.pkgMaterialFlg === '0') {
|
||||||
updates.showSalePrice = '0'
|
//updates.showSalePrice = '0'
|
||||||
updates.showSaleTotPrice = '0'
|
//updates.showSaleTotPrice = '0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//104671
|
//104671
|
||||||
@ -592,8 +606,8 @@ export default function Estimate({ params }) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
estimateContextState.itemList.map((item) => {
|
estimateContextState.itemList.map((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(',', ''))
|
let amount = Number(item?.amount?.replace(/[^0-9]/g, '').replaceAll(',', ''))
|
||||||
if (isNaN(amount)) {
|
if (isNaN(amount)) {
|
||||||
@ -616,6 +630,7 @@ export default function Estimate({ params }) {
|
|||||||
|
|
||||||
vatPrice = supplyPrice * 0.1
|
vatPrice = supplyPrice * 0.1
|
||||||
totPrice = supplyPrice + vatPrice
|
totPrice = supplyPrice + vatPrice
|
||||||
|
|
||||||
setEstimateContextState({
|
setEstimateContextState({
|
||||||
totAmount: totAmount,
|
totAmount: totAmount,
|
||||||
totVolKw: totVolKw.toFixed(3),
|
totVolKw: totVolKw.toFixed(3),
|
||||||
@ -651,21 +666,21 @@ export default function Estimate({ params }) {
|
|||||||
const volKw = (item.pnowW * amount) / 1000
|
const volKw = (item.pnowW * amount) / 1000
|
||||||
totVolKw += volKw
|
totVolKw += volKw
|
||||||
}
|
}
|
||||||
if (item.pkgMaterialFlg === '1') {
|
|
||||||
const pkgPrice = amount * salePrice
|
|
||||||
//YJSS는 PKG제외상품들만(1) 모아서 수량 * 단가를 공급가액(supplyPrice)에 추가로 더해줌
|
|
||||||
addSupplyPrice += pkgPrice
|
|
||||||
supplyPrice += price
|
|
||||||
}
|
|
||||||
|
|
||||||
// const price
|
// const price
|
||||||
|
supplyPrice += price
|
||||||
totAmount += amount
|
totAmount += amount
|
||||||
|
if (item.pkgMaterialFlg === '1') {
|
||||||
|
const pkgPrice = amount * salePrice
|
||||||
|
//다시계산하기
|
||||||
|
//YJSS는 PKG제외상품들만(1) 모아서 수량 * 단가를 공급가액(supplyPrice)에 추가로 더해줌
|
||||||
|
addSupplyPrice += pkgPrice
|
||||||
|
}
|
||||||
if (!item.paDispOrder) {
|
if (!item.paDispOrder) {
|
||||||
//paDispOrder
|
//paDispOrder
|
||||||
if (item.pkgMaterialFlg === '0') {
|
if (item.pkgMaterialFlg === '0') {
|
||||||
item.showSalePrice = '0'
|
//item.showSalePrice = '0'
|
||||||
item.showSaleTotPrice = '0'
|
//item.showSaleTotPrice = '0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1115,7 +1130,7 @@ export default function Estimate({ params }) {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="input-light"
|
className="input-light"
|
||||||
value={estimateContextState?.pkgAsp}
|
value={estimateContextState?.estimateType === 'YJSS' ? estimateContextState?.pkgAsp : '0'}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
onChangePkgAsp(e.target.value)
|
onChangePkgAsp(e.target.value)
|
||||||
}}
|
}}
|
||||||
@ -1321,7 +1336,8 @@ export default function Estimate({ params }) {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
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(',', ''))}
|
||||||
|
value={convertNumberToPriceDecimal(item?.salePrice?.replaceAll(',', ''))}
|
||||||
disabled={
|
disabled={
|
||||||
estimateContextState?.estimateType === 'YJSS'
|
estimateContextState?.estimateType === 'YJSS'
|
||||||
? item?.paDispOrder
|
? item?.paDispOrder
|
||||||
@ -1340,11 +1356,12 @@ export default function Estimate({ params }) {
|
|||||||
</div> */}
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
{item?.showSaleTotPrice === '0' ? (
|
<td className="al-r">{convertNumberToPriceDecimalToFixed(item?.saleTotPrice?.replaceAll(',', ''), 2)}</td>
|
||||||
|
{/* {item?.showSaleTotPrice === '0' ? (
|
||||||
<td className="al-r"></td>
|
<td className="al-r"></td>
|
||||||
) : (
|
) : (
|
||||||
<td className="al-r">{convertNumberToPriceDecimalToFixed(item?.saleTotPrice?.replaceAll(',', ''), 2)}</td>
|
<td className="al-r">{convertNumberToPriceDecimalToFixed(item?.saleTotPrice?.replaceAll(',', ''), 2)}</td>
|
||||||
)}
|
)} */}
|
||||||
</tr>
|
</tr>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -80,7 +80,7 @@ export const useEstimateController = (planNo) => {
|
|||||||
itemId: '', //제품번호
|
itemId: '', //제품번호
|
||||||
itemNo: '',
|
itemNo: '',
|
||||||
itemName: '', //형명
|
itemName: '', //형명
|
||||||
amount: '', //수량
|
amount: '0', //수량
|
||||||
unitPrice: '0',
|
unitPrice: '0',
|
||||||
unit: '', //단위
|
unit: '', //단위
|
||||||
salePrice: '', //단가
|
salePrice: '', //단가
|
||||||
@ -185,15 +185,16 @@ export const useEstimateController = (planNo) => {
|
|||||||
return alert(getMessage('estimate.detail.save.requiredItem'))
|
return alert(getMessage('estimate.detail.save.requiredItem'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('최종 아이템 정보::;', estimateData.itemList)
|
||||||
estimateData.itemList.map((item) => {
|
estimateData.itemList.map((item) => {
|
||||||
item.amount = item.amount.replaceAll(',', '')
|
item.amount = item.amount?.replaceAll(',', '')
|
||||||
item.salePrice = parseFloat(item.salePrice.replaceAll(',', '')).toFixed(2)
|
item.salePrice = parseFloat(item.salePrice?.replaceAll(',', '')).toFixed(2)
|
||||||
item.saleTotPrice = parseFloat(item.saleTotPrice.replaceAll(',', '')).toFixed(2)
|
item.saleTotPrice = parseFloat(item.saleTotPrice?.replaceAll(',', '')).toFixed(2)
|
||||||
})
|
})
|
||||||
console.log('최종 정보::;', estimateData)
|
|
||||||
|
|
||||||
|
console.log('최종 정보::;', estimateData)
|
||||||
//2. 상세데이터 저장
|
//2. 상세데이터 저장
|
||||||
// return
|
return
|
||||||
try {
|
try {
|
||||||
await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => {
|
await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => {
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user