견적서 상세

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)
}
})
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

View File

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

View File

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