Files
sam-react-prod/src/utils/formatAmount.ts
byeongcheolryu 3be5714805 refactor: 품목관리 시스템 리팩토링 및 Sales 페이지 추가
DynamicItemForm 개선:
- 품목코드 자동생성 기능 추가
- 조건부 표시 로직 개선
- 불필요한 컴포넌트 정리 (DynamicField, DynamicSection 등)
- 타입 시스템 단순화

새로운 기능:
- Sales 페이지 마이그레이션 (견적관리, 거래처관리)
- 공통 컴포넌트 추가 (atoms, molecules, organisms, templates)

문서화:
- 구현 문서 및 참조 문서 추가

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 12:48:41 +09:00

30 lines
760 B
TypeScript

/**
* 금액 포맷팅 유틸리티
*
* 1만원 미만: "1,000원"
* 1만원 이상: "1,000만원"
*/
export function formatAmount(amount: number): string {
if (amount < 10000) {
return `${amount.toLocaleString("ko-KR")}`;
} else {
const manwon = Math.round(amount / 10000);
return `${manwon.toLocaleString("ko-KR")}만원`;
}
}
/**
* 금액을 원 단위로 포맷 (항상 "원" 단위)
*/
export function formatAmountWon(amount: number): string {
return `${amount.toLocaleString("ko-KR")}`;
}
/**
* 금액을 만원 단위로 포맷 (항상 "만원" 단위)
*/
export function formatAmountManwon(amount: number): string {
const manwon = Math.round(amount / 10000);
return `${manwon.toLocaleString("ko-KR")}만원`;
}