สมอง SML

คลังความรู้ / ถาม-ตอบ

#faq#glossary#database#terms

คำศัพท์บัญชีภาษาไทยคือตารางและคอลัมน์ไหน

ตอบสั้น: เอกสารซื้อ-ขาย-สต็อกทั้งหมดเก็บที่ตารางหัว ic_trans กับตารางรายการ ic_trans_detail (แยกชนิดด้วย trans_flag) ส่วนเงินสด/เช็คอยู่ cb_trans* และรายการบัญชีอยู่ gl_journal* ตารางด้านล่างจับคู่คำที่คนพูดกับคอลัมน์จริง (ตรวจจาก DDL และฟิลด์ใน trans.go)

รายละเอียด

คำที่ใช้ ตาราง.คอลัมน์ อ่านต่อ
เลขที่เอกสาร / วันที่เอกสาร ic_trans.doc_no / doc_date (cb_trans, gl_journal มีชื่อเดียวกัน) เลขที่เอกสาร วันที่เอกสาร และรหัสรูปแบบ (doc_no / doc_date / doc_format_code)
ชนิดเอกสาร (ขาย ซื้อ รับคืน) ic_trans.trans_flag คู่กับ trans_type ชนิดเอกสาร / รหัสเอกสาร (document type / trans_flag)
รูปแบบ/รหัสเลขที่เอกสาร ic_trans.doc_format_code → erp_doc_format.code, format เลขที่เอกสารรันอย่างไร ตั้งรูปแบบเลขที่ที่ไหน
ลูกค้า / เจ้าหนี้ในเอกสาร ic_trans.cust_code คอลัมน์เดียวใช้ทั้งสองฝั่ง ชี้ ar_customer.code หรือ ap_supplier.code ลูกหนี้/ลูกค้า และเจ้าหนี้/ผู้จำหน่าย (party / cust_code / ar_customer / ap_supplier)
เงินสด / เงินเชื่อ ic_trans.inquiry_type ประเภทรายการ เงินสด/เงินเชื่อ (inquiry type / inquiry_type)
เครดิต (วัน) / ครบกำหนด ic_trans.credit_day / due_date เครดิต วันครบกำหนด และวงเงินสินเชื่อ (credit_day / due_date / credit_money)
เอกสารอ้างอิง / เลขที่ที่ดึงมา หัว ic_trans.doc_ref; บรรทัด ic_trans_detail.ref_doc_no เอกสารอ้างอิง และการดึงเอกสาร (doc_ref / ref_doc_no / doc_ref_type)
ยกเลิก / อนุมัติ ic_trans.last_status / approve_status สถานะยกเลิก/อนุมัติเอกสาร (last_status / approve_status / cancel flag)
ประเภทภาษี / อัตรา ic_trans.vat_type, vat_rate; แถวภาษีซื้อ-ขายใน gl_journal_vat_buy / gl_journal_vat_sale ประเภทภาษี แยกนอก/รวมใน และภาษีซื้อ-ขาย (VAT type / vat_type / gl_journal_vat_buy / gl_journal_vat_sale)
ยอดรวมท้ายเอกสาร ic_trans.total_value, total_discount, total_before_vat, total_vat_value, total_amount ยอดรวมท้ายเอกสาร (document totals / total_value / total_amount)
สินค้า / ประเภท / วิธีต้นทุน ic_inventory.code; item_type; cost_type (บรรทัดเอกสารใช้ ic_trans_detail.item_code) ประเภทสินค้า และประเภทภาษีของสินค้า (item type / item_type / tax_type), ประเภทต้นทุน ต้นทุนเฉลี่ย/LOT/FIFO (cost type / cost_type / average_cost)
จำนวน ราคา ส่วนลด ยอดบรรทัด ic_trans_detail.qty, price, discount, sum_amount; หน่วย unit_code ราคา ส่วนลด และของแถม (price / discount word / price_type / is_permium), หน่วยนับ ตัวตั้ง/ตัวหาร และหน่วยนับขนาน (unit / stand_value / divide_value / unit_type)
คลัง / ที่เก็บ ic_trans_detail.wh_code, shelf_code; master ic_warehouse, ic_wh_shelf คลังสินค้าและที่เก็บ (warehouse / shelf / wh_code / shelf_code)
ยอดคงเหลือ / ต้นทุนเฉลี่ย ic_inventory.balance_qty, average_cost (คำนวณซ้ำจากแถวเอกสาร) ยอดคงเหลือสินค้า และต้นทุนเฉลี่ย (stock balance / balance_qty / average_cost / sum_of_cost)
ผังบัญชี / รายการบัญชี gl_chart_of_account.code; gl_journal (หัว), gl_journal_detail.account_code, debit, credit ผังบัญชี และประเภทบัญชี (chart of account / gl_chart_of_account), สมุดรายวัน รายการบัญชี และผ่านรายการ (GL journal / gl_journal / gl_journal_detail)
งวดบัญชี erp_account_period (period_year, period_number, date_start, date_end, status) งวดบัญชี ปิดงวด และสิ้นปี (account period / erp_account_period / checkOpenPeriod)
รับ/จ่ายเงิน โอน เช็ค cb_trans, cb_trans_detail, cb_chq_list.status การรับ/จ่ายเงินในเอกสาร เงินสด โอน เช็ค บัตร (payment tenders / cb_trans / doc_type), เช็ครับ/เช็คจ่าย และสถานะเช็ค (cheque / cb_chq_list.status / chq_type)
ภาษีหัก ณ ที่จ่าย gl_wht_list ภาษีหัก ณ ที่จ่าย / ภาษีถูกหัก (withholding tax / gl_wht_list)
ปี พ.ศ./ค.ศ. erp_option.year_type ปี พ.ศ. / ค.ศ. และประเภทปี (Buddhist year / erp_option.year_type)
  • ชื่อฟิลด์ที่หน้าจอส่งเข้า backend ตรงกับคอลัมน์ในรูปแบบ camelCase เช่น custCode, docRef, creditDay, discountWord (trans.go:101-130) และบรรทัดสินค้า itemCode, whCode, sumAmount, refDocNo (trans.go:33-65)
  • ยอดคงเหลือสต็อกและต้นทุนไม่ใช่ข้อมูลที่กรอกเอง ระบบคำนวณใหม่จากแถวเอกสารตามชนิด trans_flag (stock_rebuild.go:18)

ข้อควรระวัง

  • คอลัมน์โอนเงินใน cb_trans สะกดว่า tranfer_amount (ขาด s) เป็นชื่อจริงใน DB (02_data_schema.sql:2181) ค้นด้วย transfer_amount จะไม่เจอ
  • cust_code ใช้ร่วมกันทั้งลูกหนี้และเจ้าหนี้ ต้องดู trans_flag ว่าเป็นฝั่งไหน ส่วน cb_trans ใช้ชื่อ ap_ar_code
  • เลขประจำตัวผู้เสียภาษีมีชื่อคอลัมน์ต่างกันในแต่ละตาราง ดู เลขประจำตัวผู้เสียภาษี และสาขา (tax_id / tax_no / branch_type / branch_code)

ดูเพิ่ม

ที่มาในโค้ด

  • scripts/sql/02_data_schema.sql:6571 (ic_trans), :6754 (ic_trans_detail), :5199 (ic_inventory), :4355 (gl_journal_detail), :2473 (erp_account_period), :2157 (cb_trans), :2181 (tranfer_amount), :2058 (cb_chq_list), :4728 (gl_wht_list), :2993 (erp_option)
  • backend/internal/application/process/trans.go:33-65 (TransLine), :101-130 (SaveTransInput)
  • backend/internal/application/process/stock_rebuild.go:18