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