견적서 상세
This commit is contained in:
parent
3223a85840
commit
7478c21b73
@ -198,6 +198,8 @@ export default function Estimate({ params }) {
|
||||
setStorePriceList(res.data)
|
||||
}
|
||||
})
|
||||
|
||||
setItemChangeYn(true)
|
||||
}
|
||||
}, [state?.estimateType])
|
||||
|
||||
@ -305,6 +307,21 @@ export default function Estimate({ params }) {
|
||||
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) => {
|
||||
//itemChangeFlg = 1, partAdd = 0 셋팅
|
||||
@ -397,7 +414,8 @@ export default function Estimate({ params }) {
|
||||
updates.specialNoteCd = res.spnAttrCds
|
||||
updates.itemGroup = res.itemGroup
|
||||
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
|
||||
let bomList = res.itemBomList
|
||||
|
||||
@ -477,31 +495,79 @@ export default function Estimate({ params }) {
|
||||
|
||||
useEffect(() => {
|
||||
if (itemChangeYn) {
|
||||
// console.log('아이템 상태 가져오기::::::::::', state.itemList)
|
||||
// console.log('토탈쪽 셋팅해주기위한 함수::::::', itemList)
|
||||
//delFlg 0인거 중에..
|
||||
//수량(PCS) : totAmount
|
||||
//용량( Kw) : totVolKw
|
||||
//공급가액 : supplyPrice
|
||||
//부가세(10%) : vatPrice
|
||||
//총액 :totPrice
|
||||
|
||||
let totAmount = 0
|
||||
let amount = 0
|
||||
state.itemList.map((item) => {
|
||||
if (item.delFlg === '0') {
|
||||
amount = item.amount.replace(/[^0-9]/g, '').replaceAll(',', '')
|
||||
totAmount += Number(amount)
|
||||
}
|
||||
})
|
||||
let totVolKw = 0
|
||||
let supplyPrice = 0
|
||||
let vatPrice = 0
|
||||
let totPrice = 0
|
||||
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({
|
||||
totAmount: totAmount,
|
||||
})
|
||||
if (item.moduleFlg === '1') {
|
||||
//용량(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)
|
||||
}
|
||||
}, [itemChangeYn])
|
||||
}, [itemChangeYn, state.itemList])
|
||||
|
||||
return (
|
||||
<div className="sub-content estimate">
|
||||
@ -915,13 +981,20 @@ export default function Estimate({ params }) {
|
||||
</th>
|
||||
<td>
|
||||
<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>
|
||||
</td>
|
||||
<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>
|
||||
<td>{getMessage('estimate.detail.sepcialEstimateProductInfo.calcFormula2')}</td>
|
||||
<td>{convertNumberToPriceDecimal(state?.pkgTotPrice)}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1034,117 +1107,109 @@ export default function Estimate({ params }) {
|
||||
state.itemList.map((item, index) => {
|
||||
if (item.delFlg === '0') {
|
||||
return (
|
||||
<>
|
||||
<tr key={fixedKey}>
|
||||
<td className="al-c">
|
||||
<div className="d-check-box light no-text">
|
||||
<input
|
||||
type="checkbox"
|
||||
id={item?.dispOrder}
|
||||
disabled={item?.paDispOrder ? true : false}
|
||||
onChange={() => onChangeSelect(item.dispOrder)}
|
||||
checked={selection.has(item.dispOrder) ? true : false}
|
||||
<tr key={item?.dispOrder || index}>
|
||||
<td className="al-c">
|
||||
<div className="d-check-box light no-text">
|
||||
<input
|
||||
type="checkbox"
|
||||
id={item?.dispOrder}
|
||||
disabled={!!item?.paDispOrde}
|
||||
onChange={() => onChangeSelect(item.dispOrder)}
|
||||
checked={!!selection.has(item.dispOrder)}
|
||||
/>
|
||||
<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>
|
||||
</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 ? true : false}
|
||||
value={displayItemList.filter(function (option) {
|
||||
return option.itemId === item.itemId
|
||||
})}
|
||||
/>
|
||||
{item?.itemChangeFlg === '1' && (
|
||||
<div className="btn-area">
|
||||
<span className="tb_ico change_check"></span>
|
||||
</div>
|
||||
{item?.itemChangeFlg === '1' && (
|
||||
<div className="btn-area">
|
||||
<span className="tb_ico change_check"></span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<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>
|
||||
</td>
|
||||
<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>
|
||||
<td>
|
||||
<div className="input-wrap" style={{ width: '100%' }}>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div className="input-wrap" style={{ width: '100%' }}>
|
||||
<input
|
||||
type="text"
|
||||
className="input-light al-r"
|
||||
value={item?.amount}
|
||||
disabled={item.itemId === '' || !!item?.paDispOrder}
|
||||
onChange={(e) => {
|
||||
onChangeAmount(e.target.value, item.dispOrder, index)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
<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?.amount}
|
||||
disabled={item.itemId === '' ? true : item?.paDispOrder ? true : false}
|
||||
value={convertNumberToPriceDecimal(item?.salePrice.replaceAll(',', ''))}
|
||||
disabled={
|
||||
state?.estimateType === 'YJSS'
|
||||
? item?.paDispOrder
|
||||
? true
|
||||
: item.pkgMaterialFlg !== '1'
|
||||
: item.itemId === '' || !!item?.paDispOrder
|
||||
}
|
||||
onChange={(e) => {
|
||||
onChangeAmount(e.target.value, item.dispOrder, index)
|
||||
onChangeSalePrice(e.target.value, item.dispOrder, index)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
<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">
|
||||
{/* <div className="btn-area">
|
||||
<span className="tb_ico open_check">OPEN아이콘 처리</span>
|
||||
</div> */}
|
||||
</div>
|
||||
</td>
|
||||
<td className="al-r">{item?.saleTotPrice}</td>
|
||||
</tr>
|
||||
</>
|
||||
</div>
|
||||
</td>
|
||||
<td className="al-r">{convertNumberToPriceDecimal(item?.saleTotPrice.replaceAll(',', ''))}</td>
|
||||
</tr>
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
|
||||
@ -838,8 +838,6 @@
|
||||
"estimate.detail.sepcialEstimateProductInfo.pkgUnitPrice": "住宅PKG単価 (W)",
|
||||
"estimate.detail.sepcialEstimateProductInfo.pkgWeight": "PKG容量 (Kw)",
|
||||
"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.unitPrice": "定価",
|
||||
"estimate.detail.showPrice.pricingBtn": "Pricing",
|
||||
|
||||
@ -848,8 +848,6 @@
|
||||
"estimate.detail.sepcialEstimateProductInfo.pkgUnitPrice": "주택PKG단가 (W)",
|
||||
"estimate.detail.sepcialEstimateProductInfo.pkgWeight": "PKG 용량 (Kw)",
|
||||
"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.unitPrice": "정가",
|
||||
"estimate.detail.showPrice.pricingBtn": "Pricing",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user