견적서 상세
This commit is contained in:
parent
3223a85840
commit
7478c21b73
@ -198,6 +198,8 @@ export default function Estimate({ params }) {
|
|||||||
setStorePriceList(res.data)
|
setStorePriceList(res.data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
setItemChangeYn(true)
|
||||||
}
|
}
|
||||||
}, [state?.estimateType])
|
}, [state?.estimateType])
|
||||||
|
|
||||||
@ -305,6 +307,21 @@ export default function Estimate({ params }) {
|
|||||||
setSelection(newSelection)
|
setSelection(newSelection)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//주택PKG input 변경
|
||||||
|
const onChangePkgAsp = (value) => {
|
||||||
|
if (state.estimateType === 'YJSS') {
|
||||||
|
//현재 PKG용량값 가져오기
|
||||||
|
|
||||||
|
let totVolKw = state.totVolKw * 1000
|
||||||
|
let pkgTotPrice = value * totVolKw
|
||||||
|
|
||||||
|
setState({
|
||||||
|
pkgAsp: value,
|
||||||
|
pkgTotPrice: pkgTotPrice.toFixed(3),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 수량 변경
|
// 수량 변경
|
||||||
const onChangeAmount = (value, dispOrder, index) => {
|
const onChangeAmount = (value, dispOrder, index) => {
|
||||||
//itemChangeFlg = 1, partAdd = 0 셋팅
|
//itemChangeFlg = 1, partAdd = 0 셋팅
|
||||||
@ -397,7 +414,8 @@ export default function Estimate({ params }) {
|
|||||||
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 * state.itemList[index].amount
|
// updates.saleTotPrice = res.salePrice * state.itemList[index].amount
|
||||||
|
updates.saleTotPrice = '0' //추가때는 수량을 안받아서 합계를 무조건 0으로
|
||||||
//104671
|
//104671
|
||||||
let bomList = res.itemBomList
|
let bomList = res.itemBomList
|
||||||
|
|
||||||
@ -477,31 +495,79 @@ export default function Estimate({ params }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (itemChangeYn) {
|
if (itemChangeYn) {
|
||||||
// console.log('아이템 상태 가져오기::::::::::', state.itemList)
|
|
||||||
// console.log('토탈쪽 셋팅해주기위한 함수::::::', itemList)
|
|
||||||
//delFlg 0인거 중에..
|
|
||||||
//수량(PCS) : totAmount
|
|
||||||
//용량( Kw) : totVolKw
|
|
||||||
//공급가액 : supplyPrice
|
|
||||||
//부가세(10%) : vatPrice
|
|
||||||
//총액 :totPrice
|
|
||||||
|
|
||||||
let totAmount = 0
|
let totAmount = 0
|
||||||
let amount = 0
|
let totVolKw = 0
|
||||||
state.itemList.map((item) => {
|
let supplyPrice = 0
|
||||||
if (item.delFlg === '0') {
|
let vatPrice = 0
|
||||||
amount = item.amount.replace(/[^0-9]/g, '').replaceAll(',', '')
|
let totPrice = 0
|
||||||
totAmount += Number(amount)
|
let addPkgPrice = 0
|
||||||
}
|
if (state.estimateType === 'YJOD') {
|
||||||
})
|
state.itemList.map((item) => {
|
||||||
|
if (item.delFlg === '0') {
|
||||||
|
const amount = Number(item.amount.replace(/[^0-9]/g, '').replaceAll(',', ''))
|
||||||
|
const price = Number(item.saleTotPrice.replaceAll(',', ''))
|
||||||
|
|
||||||
setState({
|
if (item.moduleFlg === '1') {
|
||||||
totAmount: totAmount,
|
//용량(Kw)은 모듈플래그 1만 합산
|
||||||
})
|
const volKw = (item.pnowW * amount) / 1000
|
||||||
|
totVolKw += volKw
|
||||||
|
}
|
||||||
|
// const price
|
||||||
|
totAmount += amount
|
||||||
|
supplyPrice += price
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vatPrice = supplyPrice * 0.1
|
||||||
|
totPrice = supplyPrice + vatPrice
|
||||||
|
|
||||||
|
setState({
|
||||||
|
totAmount: totAmount,
|
||||||
|
totVolKw: totVolKw.toFixed(3),
|
||||||
|
supplyPrice: supplyPrice.toFixed(3),
|
||||||
|
vatPrice: vatPrice.toFixed(3),
|
||||||
|
totPrice: totPrice.toFixed(3),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
//YJSS
|
||||||
|
state.itemList.map((item) => {
|
||||||
|
if (item.delFlg === '0') {
|
||||||
|
const amount = Number(item.amount.replace(/[^0-9]/g, '').replaceAll(',', ''))
|
||||||
|
const price = Number(item.saleTotPrice.replaceAll(',', ''))
|
||||||
|
const salePrice = Number(item.salePrice.replaceAll(',', ''))
|
||||||
|
|
||||||
|
if (item.moduleFlg === '1') {
|
||||||
|
//용량(Kw)은 모듈플래그 1만 합산
|
||||||
|
const volKw = (item.pnowW * amount) / 1000
|
||||||
|
totVolKw += volKw
|
||||||
|
}
|
||||||
|
if (item.pkgMaterialFlg === '1') {
|
||||||
|
const pkgPrice = amount * salePrice
|
||||||
|
//YJSS는 PKG제외상품들만 모아서 수량 * 단가를 공급가액에 추가로 더해줌
|
||||||
|
addPkgPrice += pkgPrice
|
||||||
|
}
|
||||||
|
|
||||||
|
// const price
|
||||||
|
totAmount += amount
|
||||||
|
supplyPrice += price
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vatPrice = supplyPrice * 0.1
|
||||||
|
totPrice = supplyPrice + vatPrice
|
||||||
|
|
||||||
|
setState({
|
||||||
|
totAmount: totAmount,
|
||||||
|
totVolKw: totVolKw.toFixed(3),
|
||||||
|
supplyPrice: supplyPrice.toFixed(3),
|
||||||
|
vatPrice: vatPrice.toFixed(3),
|
||||||
|
totPrice: totPrice.toFixed(3),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
setItemChangeYn(false)
|
setItemChangeYn(false)
|
||||||
}
|
}
|
||||||
}, [itemChangeYn])
|
}, [itemChangeYn, state.itemList])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="sub-content estimate">
|
<div className="sub-content estimate">
|
||||||
@ -915,13 +981,20 @@ export default function Estimate({ params }) {
|
|||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<div className="input-wrap">
|
<div className="input-wrap">
|
||||||
<input type="text" className="input-light" />
|
<input
|
||||||
|
type="text"
|
||||||
|
className="input-light"
|
||||||
|
defaultValue={state?.pkgAsp}
|
||||||
|
onChange={(e) => {
|
||||||
|
onChangePkgAsp(e.target.value)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgWeight')}</th>
|
<th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgWeight')}</th>
|
||||||
<td>{getMessage('estimate.detail.sepcialEstimateProductInfo.calcFormula1')}</td>
|
<td>{convertNumberToPriceDecimal(state?.totVolKw)}</td>
|
||||||
<th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgPrice')}</th>
|
<th>{getMessage('estimate.detail.sepcialEstimateProductInfo.pkgPrice')}</th>
|
||||||
<td>{getMessage('estimate.detail.sepcialEstimateProductInfo.calcFormula2')}</td>
|
<td>{convertNumberToPriceDecimal(state?.pkgTotPrice)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -1034,117 +1107,109 @@ export default function Estimate({ params }) {
|
|||||||
state.itemList.map((item, index) => {
|
state.itemList.map((item, index) => {
|
||||||
if (item.delFlg === '0') {
|
if (item.delFlg === '0') {
|
||||||
return (
|
return (
|
||||||
<>
|
<tr key={item?.dispOrder || index}>
|
||||||
<tr key={fixedKey}>
|
<td className="al-c">
|
||||||
<td className="al-c">
|
<div className="d-check-box light no-text">
|
||||||
<div className="d-check-box light no-text">
|
<input
|
||||||
<input
|
type="checkbox"
|
||||||
type="checkbox"
|
id={item?.dispOrder}
|
||||||
id={item?.dispOrder}
|
disabled={!!item?.paDispOrde}
|
||||||
disabled={item?.paDispOrder ? true : false}
|
onChange={() => onChangeSelect(item.dispOrder)}
|
||||||
onChange={() => onChangeSelect(item.dispOrder)}
|
checked={!!selection.has(item.dispOrder)}
|
||||||
checked={selection.has(item.dispOrder) ? true : false}
|
/>
|
||||||
|
<label htmlFor={item?.dispOrder}></label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="al-r">{item?.dispOrder}</td>
|
||||||
|
<td>
|
||||||
|
<div className="form-flex-wrap">
|
||||||
|
<div className="select-wrap mr5">
|
||||||
|
<Select
|
||||||
|
id="long-value-select1"
|
||||||
|
instanceId="long-value-select1"
|
||||||
|
className="react-select-custom"
|
||||||
|
classNamePrefix="custom"
|
||||||
|
placeholder="Select"
|
||||||
|
options={displayItemList}
|
||||||
|
onChange={(e) => {
|
||||||
|
if (isObjectNotEmpty(e)) {
|
||||||
|
onChangeDisplayItem(e.itemId, item.dispOrder, index)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
getOptionLabel={(x) => x.itemName}
|
||||||
|
getOptionValue={(x) => x.itemId}
|
||||||
|
isClearable={false}
|
||||||
|
isDisabled={!!item?.paDispOrder}
|
||||||
|
value={displayItemList.filter(function (option) {
|
||||||
|
return option.itemId === item.itemId
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={item?.dispOrder}></label>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
{item?.itemChangeFlg === '1' && (
|
||||||
<td className="al-r">{item?.dispOrder}</td>
|
<div className="btn-area">
|
||||||
<td>
|
<span className="tb_ico change_check"></span>
|
||||||
<div className="form-flex-wrap">
|
|
||||||
<div className="select-wrap mr5">
|
|
||||||
<Select
|
|
||||||
id="long-value-select1"
|
|
||||||
instanceId="long-value-select1"
|
|
||||||
className="react-select-custom"
|
|
||||||
classNamePrefix="custom"
|
|
||||||
placeholder="Select"
|
|
||||||
options={displayItemList}
|
|
||||||
onChange={(e) => {
|
|
||||||
if (isObjectNotEmpty(e)) {
|
|
||||||
onChangeDisplayItem(e.itemId, item.dispOrder, index)
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
getOptionLabel={(x) => x.itemName}
|
|
||||||
getOptionValue={(x) => x.itemId}
|
|
||||||
isClearable={false}
|
|
||||||
isDisabled={item?.paDispOrder ? true : false}
|
|
||||||
value={displayItemList.filter(function (option) {
|
|
||||||
return option.itemId === item.itemId
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
{item?.itemChangeFlg === '1' && (
|
)}
|
||||||
<div className="btn-area">
|
</div>
|
||||||
<span className="tb_ico change_check"></span>
|
</td>
|
||||||
</div>
|
<td>
|
||||||
|
<div className="form-flex-wrap">
|
||||||
|
<div className="name">{item?.itemNo}</div>
|
||||||
|
<div className="icon-wrap">
|
||||||
|
{item?.fileUploadFlg === '1' && <span className="tb_ico file_check"></span>}
|
||||||
|
{item?.specialNoteCd && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="grid-tip"
|
||||||
|
onClick={() => {
|
||||||
|
setProductFeaturesPopupOpen(true)
|
||||||
|
setShowProductFeatureData(item?.specialNoteCd)
|
||||||
|
}}
|
||||||
|
></button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</div>
|
||||||
<td>
|
</td>
|
||||||
<div className="form-flex-wrap">
|
<td>
|
||||||
<div className="name">{item?.itemNo}</div>
|
<div className="input-wrap" style={{ width: '100%' }}>
|
||||||
<div className="icon-wrap">
|
<input
|
||||||
{item?.fileUploadFlg === '1' && <span className="tb_ico file_check"></span>}
|
type="text"
|
||||||
{item?.specialNoteCd && (
|
className="input-light al-r"
|
||||||
<button
|
value={item?.amount}
|
||||||
type="button"
|
disabled={item.itemId === '' || !!item?.paDispOrder}
|
||||||
className="grid-tip"
|
onChange={(e) => {
|
||||||
onClick={() => {
|
onChangeAmount(e.target.value, item.dispOrder, index)
|
||||||
setProductFeaturesPopupOpen(true)
|
}}
|
||||||
setShowProductFeatureData(item?.specialNoteCd)
|
/>
|
||||||
}}
|
</div>
|
||||||
></button>
|
</td>
|
||||||
)}
|
<td>{item.unit}</td>
|
||||||
</div>
|
<td>
|
||||||
</div>
|
<div className="form-flex-wrap">
|
||||||
</td>
|
<div className="input-wrap mr5">
|
||||||
<td>
|
|
||||||
<div className="input-wrap" style={{ width: '100%' }}>
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="input-light al-r"
|
className="input-light al-r"
|
||||||
value={item?.amount}
|
value={convertNumberToPriceDecimal(item?.salePrice.replaceAll(',', ''))}
|
||||||
disabled={item.itemId === '' ? true : item?.paDispOrder ? true : false}
|
disabled={
|
||||||
|
state?.estimateType === 'YJSS'
|
||||||
|
? item?.paDispOrder
|
||||||
|
? true
|
||||||
|
: item.pkgMaterialFlg !== '1'
|
||||||
|
: item.itemId === '' || !!item?.paDispOrder
|
||||||
|
}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
onChangeAmount(e.target.value, item.dispOrder, index)
|
onChangeSalePrice(e.target.value, item.dispOrder, index)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
{/* <div className="btn-area">
|
||||||
<td>{item.unit}</td>
|
|
||||||
<td>
|
|
||||||
<div className="form-flex-wrap">
|
|
||||||
<div className="input-wrap mr5">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-light al-r"
|
|
||||||
value={item?.salePrice}
|
|
||||||
disabled={
|
|
||||||
state?.estimateType === 'YJSS'
|
|
||||||
? item?.paDispOrder
|
|
||||||
? true
|
|
||||||
: item.pkgMaterialFlg === '1'
|
|
||||||
? false
|
|
||||||
: true
|
|
||||||
: item.itemId === ''
|
|
||||||
? true
|
|
||||||
: item?.paDispOrder
|
|
||||||
? true
|
|
||||||
: false
|
|
||||||
}
|
|
||||||
onChange={(e) => {
|
|
||||||
onChangeSalePrice(e.target.value, item.dispOrder, index)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/* <div className="btn-area">
|
|
||||||
<span className="tb_ico open_check">OPEN아이콘 처리</span>
|
<span className="tb_ico open_check">OPEN아이콘 처리</span>
|
||||||
</div> */}
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="al-r">{item?.saleTotPrice}</td>
|
<td className="al-r">{convertNumberToPriceDecimal(item?.saleTotPrice.replaceAll(',', ''))}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
|
|||||||
@ -838,8 +838,6 @@
|
|||||||
"estimate.detail.sepcialEstimateProductInfo.pkgUnitPrice": "住宅PKG単価 (W)",
|
"estimate.detail.sepcialEstimateProductInfo.pkgUnitPrice": "住宅PKG単価 (W)",
|
||||||
"estimate.detail.sepcialEstimateProductInfo.pkgWeight": "PKG容量 (Kw)",
|
"estimate.detail.sepcialEstimateProductInfo.pkgWeight": "PKG容量 (Kw)",
|
||||||
"estimate.detail.sepcialEstimateProductInfo.pkgPrice": "PKG金額",
|
"estimate.detail.sepcialEstimateProductInfo.pkgPrice": "PKG金額",
|
||||||
"estimate.detail.sepcialEstimateProductInfo.calcFormula1": "(モジュール容量 × 数量)÷1000",
|
|
||||||
"estimate.detail.sepcialEstimateProductInfo.calcFormula2": "PKG単価 (W)×PKG容量(W)",
|
|
||||||
"estimate.detail.header.showPrice": "価格表示",
|
"estimate.detail.header.showPrice": "価格表示",
|
||||||
"estimate.detail.header.unitPrice": "定価",
|
"estimate.detail.header.unitPrice": "定価",
|
||||||
"estimate.detail.showPrice.pricingBtn": "Pricing",
|
"estimate.detail.showPrice.pricingBtn": "Pricing",
|
||||||
|
|||||||
@ -848,8 +848,6 @@
|
|||||||
"estimate.detail.sepcialEstimateProductInfo.pkgUnitPrice": "주택PKG단가 (W)",
|
"estimate.detail.sepcialEstimateProductInfo.pkgUnitPrice": "주택PKG단가 (W)",
|
||||||
"estimate.detail.sepcialEstimateProductInfo.pkgWeight": "PKG 용량 (Kw)",
|
"estimate.detail.sepcialEstimateProductInfo.pkgWeight": "PKG 용량 (Kw)",
|
||||||
"estimate.detail.sepcialEstimateProductInfo.pkgPrice": "PKG 금액",
|
"estimate.detail.sepcialEstimateProductInfo.pkgPrice": "PKG 금액",
|
||||||
"estimate.detail.sepcialEstimateProductInfo.calcFormula1": "(모듈용량 * 수량)÷100",
|
|
||||||
"estimate.detail.sepcialEstimateProductInfo.calcFormula2": "PKG단가(W) * PKG용량(W)",
|
|
||||||
"estimate.detail.header.showPrice": "가격표시",
|
"estimate.detail.header.showPrice": "가격표시",
|
||||||
"estimate.detail.header.unitPrice": "정가",
|
"estimate.detail.header.unitPrice": "정가",
|
||||||
"estimate.detail.showPrice.pricingBtn": "Pricing",
|
"estimate.detail.showPrice.pricingBtn": "Pricing",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user