견적서 상세

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
let supplyPrice = 0
let vatPrice = 0
let totPrice = 0
let addPkgPrice = 0
if (state.estimateType === 'YJOD') {
state.itemList.map((item) => { state.itemList.map((item) => {
if (item.delFlg === '0') { if (item.delFlg === '0') {
amount = item.amount.replace(/[^0-9]/g, '').replaceAll(',', '') const amount = Number(item.amount.replace(/[^0-9]/g, '').replaceAll(',', ''))
totAmount += Number(amount) const price = Number(item.saleTotPrice.replaceAll(',', ''))
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({ setState({
totAmount: totAmount, 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,16 +1107,15 @@ 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?.paDispOrder ? true : false} disabled={!!item?.paDispOrde}
onChange={() => onChangeSelect(item.dispOrder)} onChange={() => onChangeSelect(item.dispOrder)}
checked={selection.has(item.dispOrder) ? true : false} checked={!!selection.has(item.dispOrder)}
/> />
<label htmlFor={item?.dispOrder}></label> <label htmlFor={item?.dispOrder}></label>
</div> </div>
@ -1067,7 +1139,7 @@ export default function Estimate({ params }) {
getOptionLabel={(x) => x.itemName} getOptionLabel={(x) => x.itemName}
getOptionValue={(x) => x.itemId} getOptionValue={(x) => x.itemId}
isClearable={false} isClearable={false}
isDisabled={item?.paDispOrder ? true : false} isDisabled={!!item?.paDispOrder}
value={displayItemList.filter(function (option) { value={displayItemList.filter(function (option) {
return option.itemId === item.itemId return option.itemId === item.itemId
})} })}
@ -1104,7 +1176,7 @@ export default function Estimate({ params }) {
type="text" type="text"
className="input-light al-r" className="input-light al-r"
value={item?.amount} value={item?.amount}
disabled={item.itemId === '' ? true : item?.paDispOrder ? true : false} disabled={item.itemId === '' || !!item?.paDispOrder}
onChange={(e) => { onChange={(e) => {
onChangeAmount(e.target.value, item.dispOrder, index) onChangeAmount(e.target.value, item.dispOrder, index)
}} }}
@ -1118,19 +1190,13 @@ export default function Estimate({ params }) {
<input <input
type="text" type="text"
className="input-light al-r" className="input-light al-r"
value={item?.salePrice} value={convertNumberToPriceDecimal(item?.salePrice.replaceAll(',', ''))}
disabled={ disabled={
state?.estimateType === 'YJSS' state?.estimateType === 'YJSS'
? item?.paDispOrder ? item?.paDispOrder
? true ? true
: item.pkgMaterialFlg === '1' : item.pkgMaterialFlg !== '1'
? false : item.itemId === '' || !!item?.paDispOrder
: true
: item.itemId === ''
? true
: item?.paDispOrder
? true
: false
} }
onChange={(e) => { onChange={(e) => {
onChangeSalePrice(e.target.value, item.dispOrder, index) onChangeSalePrice(e.target.value, item.dispOrder, index)
@ -1142,9 +1208,8 @@ export default function Estimate({ params }) {
</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",