FPSMS-frontend
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

48 rader
1.1 KiB

  1. import { Uom } from "../api/settings/uom";
  2. export const manhourFormatter = new Intl.NumberFormat("en-HK", {
  3. minimumFractionDigits: 2,
  4. maximumFractionDigits: 2,
  5. });
  6. export const moneyFormatter = new Intl.NumberFormat("en-HK", {
  7. style: "currency",
  8. currency: "HKD",
  9. });
  10. export const decimalFormatter = new Intl.NumberFormat("en-HK", {
  11. minimumFractionDigits: 2,
  12. })
  13. export const integerFormatter = new Intl.NumberFormat("en-HK", {
  14. })
  15. export const INPUT_DATE_FORMAT = "YYYY-MM-DD";
  16. export const OUTPUT_DATE_FORMAT = "YYYY/MM/DD";
  17. export const OUTPUT_TIME_FORMAT = "HH:mm:ss";
  18. export const stockInLineStatusMap: { [status: string]: number } = {
  19. "draft": 0,
  20. "pending": 1,
  21. "qc": 2,
  22. "determine1": 3,
  23. "determine2": 4,
  24. "determine3": 5,
  25. "receiving": 6,
  26. "received": 7,
  27. "completed": 8,
  28. "rejected": 9,
  29. };
  30. export const calculateWeight = (qty: number, uom: Uom) => {
  31. return qty * (uom.unit2Qty || 1) * (uom.unit3Qty || 1) * (uom.unit4Qty || 1);
  32. }
  33. export const returnWeightUnit = (uom: Uom) => {
  34. return uom.unit4 || uom.unit3 || uom.unit2 || uom.unit1;
  35. }