AccOS Pro

Master Data ของระบบ
มีอะไร & ควรเพิ่มอะไร?

วิเคราะห์ข้อมูลพื้นฐาน (Master Data) ที่ระบบ AccOS Pro มีอยู่แล้ว เทียบกับสิ่งที่โปรแกรมบัญชีอันดับ 1 ของไทยควรมี เพื่อให้ครบถ้วนที่สุด

15
Master Data Tables
ที่มีอยู่แล้ว
60+
Seed Records
ข้อมูลเริ่มต้น
12
ควรเพิ่ม
Master Data ที่ขาด
8
ควรปรับปรุง
ที่มีอยู่แล้ว

Master Data ที่มีอยู่แล้ว (15 Tables)

ตารางพื้นฐานที่มี schema ใน schema-pg.ts แล้ว

กลุ่มที่ 1: โครงสร้างองค์กร (Organization Structure)

companies มีแล้ว

ข้อมูลบริษัท: ชื่อ, เลขผู้เสียภาษี, ที่อยู่, logo, fiscal year start

Fields: name, taxId, address, logoUrl, fiscalYearStart, baseCurrency
users มีแล้ว

ผู้ใช้ระบบ: ชื่อ, อีเมล, password hash, บทบาท

Fields: name, email, password, role, isActive
memberships มีแล้ว

สิทธิ์ผู้ใช้ต่อบริษัท: user x company x role (RBAC)

Fields: userId, companyId, role
company_branches มีแล้ว

สาขาของบริษัท: ชื่อสาขา, ที่อยู่, เลขประจำตัวผู้เสียภาษี

Fields: name, branchCode, address, taxId, isHeadquarters

กลุ่มที่ 2: บัญชี (Accounting Master)

accounts (Chart of Accounts) มีแล้ว

ผังบัญชี Thai GAAP: รหัสบัญชี, ชื่อบัญชี, หมวดหมู่ (asset/liability/equity/revenue/expense), normalBalance

Fields: code, name, category, subCategory, normalBalance, isHeader, isSystem, isActive
fiscal_periods มีแล้ว

งวดบัญชีรายเดือน/รายปี + period lock status

Fields: startDate, endDate, status, isLocked
cost_centers มีแล้ว

ศูนย์ต้นทุน: รหัส, ชื่อ, สถานะ (สำหรับวิเคราะห์ต้นทุนแยกตามแผนก/โครงการ)

Fields: code, name, description, isActive
projects มีแล้ว

โครงการ: รหัส, ชื่อ, วันเริ่ม-สิ้นสุด, งบประมาณ (สำหรับ Job Costing)

Fields: code, name, startDate, endDate, budget, status
budgets มีแล้ว

งบประมาณรายบัญชี: ระบุจำนวนเงินต่องวดต่อบัญชี

Fields: accountId, periodId, amount, notes

กลุ่มที่ 3: คู่ค้า (Business Partners)

customers มีแล้ว

ลูกค้า: ชื่อ, เลขผู้เสียภาษี, ที่อยู่, เบอร์โทร, อีเมล, creditTerms

Fields: name, taxId, address, phone, email, contactPerson, creditTermsDays, isActive
vendors มีแล้ว

เจ้าหนี้การค้า: ชื่อ, เลขผู้เสียภาษี, ประเภท (บุคคล/นิติ), WHT rate

Fields: name, taxId, payerType, defaultWhtRate, address, phone, isActive

กลุ่มที่ 4: สินค้าและคลังสินค้า (Products & Inventory)

products มีแล้ว

สินค้า/บริการ: ชื่อ, SKU, ราคาซื้อ, ราคาขาย, unitOfMeasure, VAT rate

Fields: name, sku, description, unitPrice, costPrice, unitOfMeasure, category, isService, vatRate
warehouses มีแล้ว

คลังสินค้า: ชื่อคลัง, ที่อยู่, สถานะ

Fields: name, code, address, isActive

กลุ่มที่ 5: ธนาคารและทรัพย์สิน (Banking & Assets)

bank_accounts มีแล้ว

บัญชีธนาคาร: ชื่อธนาคาร, เลขที่บัญชี, GL account, current balance

Fields: name, bankName, accountNumber, accountId (GL), currentBalance, isActive
assets มีแล้ว

ทะเบียนทรัพย์สิน: ชื่อ, วันที่ซื้อ, ราคาทุน, method, อายุการใช้งาน

Fields: name, purchaseDate, cost, salvageValue, usefulLifeMonths, depreciationMethod, accumulatedDepreciation

กลุ่มที่ 6: พนักงานและเงินเดือน (HR & Payroll)

employees มีแล้ว

พนักงาน: ชื่อ, ตำแหน่ง, เลข ปชช., วันเริ่มงาน, เงินเดือน

Fields: firstName, lastName, nationalId, position, department, hireDate, baseSalary, bankAccountId

Master Data ที่ควรมีเพิ่ม (12 รายการ)

สิ่งที่โปรแกรมบัญชีอันดับ 1 ของไทยจำเป็นต้องมี

ความสำคัญสูง (Critical) - 5 รายการ

1. ธนาคาร (Banks)

รายชื่อธนาคารพาณิชย์ทั้งหมดในประเทศไทย พร้อมรหัสธนาคาร (Bank Code) สำหรับ use ในระบบ e-Payment, PromptPay, โอนเงินอัตโนมัติ

Critical
ทำไมต้องมี:
  • ระบบ bank_accounts มี bankName เป็น string ธรรมดา - ไม่มี master data ของธนาคารจริง
  • ต้องใช้ Bank Code สำหรับ e-Payment, โอนเงินผ่านระบบ banking API
  • PromptPay ต้องใช้ Bank Code + เลขผู้เสียภาษี/ปชช.
  • Standard chart of accounts แต่ละธนาคารมี GL code ต่างกัน
Fields ที่แนะนำ:
id code (เช่น "002" = KrungThai) nameTh nameEn swiftCode logoUrl supportsPromptPay

2. แผนก (Departments)

โครงสร้างองค์กร - แผนก/ฝ่ายงาน สำหรับจัดกลุ่มพนักงาน, ต้นทุน, และวิเคราะห์กำไรขาดทุนแยกตามแผนก

Critical
ทำไมต้องมี:
  • ตอนนี้ employees มี field department เป็น string - ไม่มี FK ไป master data
  • ต้องใช้สำหรับรายงาน P&L แยกตามแผนก (Departmental P&L)
  • ใช้ใน expense allocation (กระจายค่าใช้จ่ายร่วมแยกตามสัดส่วนแผนก)
  • ใช้ใน cost center mapping
Fields ที่แนะนำ:
id code name parentId (hierarchy) headEmployeeId isActive

3. วิธีการชำระเงิน (Payment Methods)

ประเภทวิธีชำระเงิน: เงินสด, เช็ค, โอนเงิน, PromptPay, QR Code, บัตรเครดิต, บัตรเดบิต

Critical
ทำไมต้องมี:
  • ตอนนี้ไม่มี master data วิธีชำระเงิน - เลือกได้เฉพาะ bank account
  • ต้องใช้สำหรับ cash management report
  • ต้องใช้สำหรับ bank reconciliation - จับคู่ transaction ตาม payment method
  • e-Tax ต้องระบุวิธีชำระเงิน
Fields ที่แนะนำ:
id code name (เงินสด/เช็ค/โอน/PromptPay) type (cash/bank/credit/electronic) defaultAccountId (GL) isActive

4. อัตราภาษี (Tax Rates)

Master data อัตราภาษีทั้งหมด: VAT 7%, WHT 1%, 2%, 3%, 5%, 10%, 15%, เงินได้ types 40(1)-40(6)

Critical
ทำไมต้องมี:
  • ตอนนี้อัตราภาษี hardcode ใน tax-engine.ts - ไม่ได้อยู่ใน database
  • กฎหมายภาษีเปลี่ยนบ่อย (เช่น VAT อาจเพิ่ม/ลด) - ต้องปรับได้โดยไม่ต้องแก้โค้ด
  • WHT rate แต่ละประเภทเงินได้ต่างกัน - ต้อง update ได้ตามประกาศสรรพากร
  • ต้องใช้ versioning - เก็บประวัติว่าอัตราไหนใช้ช่วงไหน
Fields ที่แนะนำ:
id type (VAT/WHT/PIT/CIT) code (เช่น "WHT_40_1") name rate (percent) effectiveFrom effectiveTo isActive

5. สกุลเงิน (Currencies)

สกุลเงินที่รองรับ: THB, USD, EUR, JPY, CNY, GBP ฯลฯ + Exchange Rate history

Critical
ทำไมต้องมี:
  • companies มี field baseCurrency แต่ไม่มี master data สกุลเงินจริง
  • Multi-currency transaction ต้องใช้ exchange rate ณ วันทำรายการ
  • GL gain/loss on exchange ต้องคำนวณจาก rate history
  • รายงานงบการเงินต้องแปลงสกุลเงินได้
Fields ที่แนะนำ:
currencies: id, code (THB), nameTh, nameEn, symbol, decimalPlaces
exchange_rates: id, fromCurrency, toCurrency, rate, effectiveDate

ความสำคัญปานกลาง (Important) - 4 รายการ

6. หน่วยนับ (Units of Measure)

หน่วยสินค้า: ชิ้น, กล่อง, ลัง, กก., ลิตร, หน, ม., ตร.ม. ฯลฯ + Conversion factors

Important
เหตุผล: products มี unitOfMeasure เป็น string ธรรมดา - ไม่มี conversion (1 ลัง = 12 ชิ้น) ทำให้ stock calculation ผิดได้

7. กลุ่มสินค้า (Product Categories)

จัดกลุ่มสินค้า/บริการ: อาหาร, เครื่องดื่ม, วัสดุสำนักงาน, ค่าบริการ, ฯลฯ

Important
เหตุผล: products มี field category เป็น string - ไม่มี hierarchical categories ทำให้รายงานยอดขายแยกกลุ่มสินค้าทำได้ยาก

8. วันหยุด (Holidays)

วันหยุดนักขัตฤกษ์ + วันหยุดบริษัท สำหรับคำนวณเงินเดือน (วันทำงานจริง, OT rate, ลา)

Important
เหตุผล: payroll-engine ต้องคำนวณ daily rate จากวันทำงานจริง - ต้องรู้ว่าวันไหนหยุด, วันไหนมี OT premium

9. ตำแหน่งงาน (Positions / Job Titles)

ตำแหน่งงาน: ผู้จัดการ, พนักงานบัญชี, พนักงานขาย, พนักงานคลัง ฯลฯ

Important
เหตุผล: employees มี position เป็น string - ต้องมี master data เพื่อรายงาน headcount, salary range analysis

ควรพิจารณา (Nice-to-Have) - 3 รายการ

10. นโยบายการเงิน (Financial Policies)

นโยบายบัญชี: depreciation method default, rounding rules, fiscal year, consolidation rules

Nice-to-Have

11. ใบอนุญาต/สัญญา (Licenses / Contracts)

ใบอนุญาตประกอบธุรกิจ, สัญญาเช่า, สัญญาจ้าง ที่มีวันหมดอายุ

Nice-to-Have

12. กลุ่มลูกค้า/เจ้าหนี้ (Customer/Vendor Groups)

จัดกลุ่มคู่ค้า: ลูกค้า VIP, ลูกค้าต่างประเทศ, เจ้าหนี้รายใหญ่, เจ้าหนี้ท้องถิ่น

Nice-to-Have

Master Data ที่มีอยู่แล้ว ควรปรับปรุง (8 รายการ)

สิ่งที่ schema มีอยู่แล้วแต่ต้องเพิ่ม fields/relationships

1. customers - ควรเพิ่ม:

groupName taxType (vat-register / non-vat) paymentTerms creditLimit defaultAccountId (GL) priceLevel

2. vendors - ควรเพิ่ม:

groupName taxType (vat-register / non-vat) paymentTermsDays creditLimit defaultAccountId (GL) bankName / bankAccount

3. bank_accounts - ควรเพิ่ม:

FK → banks (master data ธนาคาร) accountName (ชื่อบัญชีตามธนาคาร) accountType (savings/current/foreign) currencyCode openingBalance swiftCode

4. employees - ควรเพิ่ม:

FK → departments FK → positions socialSecurityId taxGroupId providentFundRate terminationDate

5. products - ควรเพิ่ม:

FK → product_categories FK → units_of_measure barcode reorderLevel standardCost incomeAccountId + expenseAccountId (GL mapping)

6. accounts (COA) - ควรเพิ่ม:

taxType (VAT-INPUT, VAT-OUTPUT, WHT-PAYABLE, NONE) isCashFlowStatement ( Operating/Investing/Financing ) isBalanceSheet / isIncomeStatement exchangeGainAccountId / exchangeLossAccountId

7. assets - ควรเพิ่ม:

FK → employees (ผู้รับผิดชอบ) FK → warehouses (สถานที่เก็บ) assetCode (รหัสทรัพย์สิน) serialNumber warrantyExpiry disposalDate / disposalAmount

8. companies - ควรเพิ่ม:

registrationType (จำกัดมหาชน/จำกัด/บุคคลธรรมดา) industry / businessType website phone / email taxBranchId (สำนักงานสรรพากร)

Priority Matrix: ลำดับความสำคัญ

ลำดับ Master Data ประเภท ผลกระทบ EFFORT
1ธนาคาร (Banks)Criticale-Payment, PromptPay, Bank Recon2-3 days
2อัตราภาษี (Tax Rates)CriticalTax engine, WHT, VAT calculation3-4 days
3วิธีชำระเงิน (Payment Methods)CriticalPayment processing, Cash report1-2 days
4แผนก (Departments)CriticalDept P&L, Expense allocation, Payroll2-3 days
5สกุลเงิน (Currencies)CriticalMulti-currency, FX gain/loss3-4 days
6หน่วยนับ (UoM)ImportantInventory accuracy, Stock conversion1 day
7กลุ่มสินค้า (Product Categories)ImportantSales report by category1 day
8วันหยุด (Holidays)ImportantPayroll daily rate, OT calculation1 day
9ตำแหน่งงาน (Positions)ImportantHR reports, Headcount analysis1 day
10Customer/Vendor GroupsNiceSegmented reporting1 day
11นโยบายการเงินNiceDefault rules, Config1-2 days
12ใบอนุญาต/สัญญาNiceAlerts, Compliance2 days