견적서 상세

This commit is contained in:
basssy 2024-11-18 16:55:46 +09:00
parent 3223a85840
commit 7478c21b73
3 changed files with 186 additions and 125 deletions

View File

@ -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

View File

@ -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",

View File

@ -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",