# HQLAND - HƯỚNG DẪN PHIÊN LÀM VIỆC TIẾP THEO > File này giúp AI Agent nhanh chóng bắt nhịp khi bạn chuyển sang máy tính khác. > **Cập nhật:** 24/04/2026 --- ## ⚠️ THÔNG BÁO QUAN TRỌNG Có **rất nhiều file thay đổi CHƯA COMMIT**. Bạn cần commit trước khi chuyển máy! ```bash git add -A git commit -m "Hoan thien core finance v2 - Calculation Pipeline, Form Templates" git push origin main ``` --- ## 1. NHỮNG GÌ VỪA HOÀN THÀNH ### ✅ Kiến trúc mới: Calculation Pipeline - Tính toán giá BĐS tường minh, step-by-step với làm tròn tại mỗi bước - `RoundingRule`: NONE, UNIT (đồng), THOUSAND, MILLION - `CalculationStep`: Định nghĩa từng bước (tên, công thức, làm tròn, ghi đè) - `CalculationResult`: Lưu snapshot + price_sheet cho phiếu tính giá - `PriceCalculationService`: Pipeline chuyên BĐS (QSDĐ + Móng → Subtotal → CK → Net → VAT → Total) - `Contract::calculation_log`: JSONB lưu toàn bộ quá trình tính toán ### ✅ Module mới: Form Templates (Biểu mẫu in ấn) - **Mail Merge Engine:** Admin tự tạo template HTML, chèn `{{ma_truong}}` - **FormField:** Định nghĩa nguồn dữ liệu (db_column, db_relation, formula, input, static) - **FormPrintLog:** Lưu snapshot khi in - **FormTemplateResource:** CRUD trong Filament với RichEditor WYSIWYG + Repeater fields - Layout: 3 section xếp dọc (Thông tin → Trường dữ liệu → Nội dung mẫu in) ### ✅ Các fix trước đó - EditAction namespace, User FilamentUser, ContractForm tạo lịch tự động - Payment validation, PaymentsTable đối soát, ContractsTable công nợ - PaymentFine/Appendix/Settlement Resources, Dashboard widgets --- ## 2. CẤU HÌNH DATABASE ### Chạy migrate trên production (NẾU CHƯA CHẠY) ```bash DB_HOST=127.0.0.1 php artisan migrate --force ``` Các migration quan trọng: - `2026_04_24_083000_add_payment_template_id_to_contracts` - `2026_04_28_013900_add_calculation_log_to_contracts` - `2026_04_28_020000_create_form_templates_tables` --- ## 3. TEST ```bash DB_HOST=127.0.0.1 ./vendor/bin/pest --filter="ContractFinanceFlowTest|ContractResourceRenderTest" ``` --- ## 4. VIỆC CẦN LÀM TIẾP THEO - [ ] **Notification:** Cảnh báo đợt thanh toán sắp đến hạn - [ ] **Export Excel:** Báo cáo công nợ khách hàng - [ ] **In ấn thực tế:** Tích hợp MailMergeService với action "In" trong ContractResource --- ## 5. TÀI KHOẢN - **Email:** admin@phuongtc.com - **Password:** 1Qazxsw2@!321 --- *Commit ngay lập tức trước khi tắt máy!*