Skip to content

fix(sales): UI-walk P0s + SK-02/SK-07 (owner rulings 2026-10-28) - #1182

Merged
waritctd merged 3 commits into
developfrom
fix/sales-p0-ui-walk-2026-10-28
Oct 28, 2026
Merged

waritctd merged 3 commits into
developfrom
fix/sales-p0-ui-walk-2026-10-28

Conversation

@waritctd

@waritctd waritctd commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes the P0s found by clicking every sales-pipeline path on main against a real backend (2026-10-28), plus SK-02 and SK-07 from the designer → buyer skip-route walk. Owner rulings 2026-10-28.

Changes

  • QA-01 deposit receipt: account's ยืนยันรับมัดจำ books the notice's VAT-inclusive totalPayable (was pre-VAT depositAmount).
  • QA-02 commission gross: the finance/commission forms pre-fill, compare and default to the VAT-inclusive payable, labelled ยอดรับจริง (รวม VAT). CommissionCalculator math unchanged; it matches the owner's commission workbooks (received incl. VAT − deductions) ÷ 1.07. Commissions recorded before this stay as they are (ruling).
  • QA-03 direct-quotation payable: a confirmed DEAL_DIRECT quotation (status stays APPROVED) counts toward the payable; ACCEPTED ranks above APPROVED in payableAmountSelect, paymentTermsRowSql and findPayableQuotation. Once the order is confirmed from a direct quotation, it can't be revised or cloned, and no other direct quotation on the deal can be submitted or approved (409). The now-dead post-confirm deposit-policy sync in approve is removed. Revise is hidden while the confirmation state is unknown.
  • QA-04 stock flag: each pricing-request line has a จากสต็อก tick seeded from the deal line, sending stockSource: IN_THAILAND; stock lines don't need ประเทศต้นทาง; the CEO types the price.
  • QA-05 rewind: ⋯ แก้ไขสถานะ can't move a deal at/after ORDER_RECEIVED below it (409, not offered). Earlier rewinds still work.
  • SK-02: every ยืนยันคำสั่งซื้อ entry asks first (dialog, "ย้อนกลับไม่ได้").
  • SK-07: each tax invoice keeps VAT = round2(net × 7%). Once a remaining invoice is ISSUED, the payable = deposit notice total_payable + remaining invoice grand_total, so outstanding and the final receipt follow the issued documents. The remaining-invoice workbook/PDF prints the stored VAT and total instead of template formulas.

Test coverage (tests written first, each shown red before its fix; Opus reverted every fix hunk and saw its tests go red)

  • QA-01: OrderConfirmationIntegrationTest.fullChain_…, PaymentTrackIntegrationTest.requiredPath_… (revised; they pinned the pre-VAT value).
  • QA-02: FinanceDealPage.test.jsx RECORD_INVOICE (pre-fill, label, submitted amount), CommissionPage.test.jsx, CommissionAutoCreateIntegrationTest (default), CommissionDealLinkageIntegrationTest (gross = payable → no mismatch; 7% below → mismatch).
  • QA-03: FinancePayableVatAndDueIntegrationTest A2 (payable, payable document, not fully paid after deposit, payment terms + account scope, guards: approved PCR quotation and unconfirmed direct quotation not payable, ACCEPTED outranks in all three queries); DealQuotationConfirmOrderIntegrationTest (revise/clone/submit/approve after confirm → 409, v1 stays payable, policy unchanged; pre-confirm flows still work); quotationMeta.test, QuotationEditorPage.test, mockApi.promoteToDeal.test.
  • QA-04: PricingRequestCreateModal.test.jsx "stock flag per line" (seed, toggle on/off, payload, no origin country needed).
  • QA-05: StageDecisionIntegrationTest (below-10 refused + not offered after order; ≥10 moves and pre-order 5→3 still work), mockApi.stageDecisionsRoute.test.js.
  • SK-02: TicketDetailPage.test.jsx (sticky primary + accepted-designer primary), PricingRequestDetailPage.test.jsx (dialog shown, cancel → no call, confirm → one call).
  • SK-07: RemainingInvoiceServiceIntegrationTest.issuedRemainingInvoice_outstandingAndFinalPaymentFollowTheIssuedDocuments, RemainingInvoiceRendererTest.storedVatAndGrandTotal_areWrittenAsValues_deal11, DepositNoticeServiceTest (deal 11 numbers; pins existing per-document VAT, not red-first).

Deliberately not covered: CommissionCalculator (unchanged); IN_TRANSIT/ETA in the PCR modal (the tick means in Thailand); the BALANCE receipt on its own (derived); the old-engine "0% deal whose revision adds a deposit" case (now unreachable; 5 #1173 tests that revised a confirmed quotation were deleted for that reason).

Known, not in this PR

  • Before deploy: deals already FULLY_PAID with an issued remaining invoice may show a 1-satang balance under the new payable. Run a read-only prod check first (query in the review notes).
  • Stranded PENDING_APPROVAL direct quotations opened before an order confirm: approving them now 409s; drafts can still be cancelled.
  • The dashboard's own payable SQL (DashboardRepository) disagrees with finance; separate follow-up.
  • The legacy "ลูกค้ายืนยัน" button on old-engine deals has no dialog.
  • The remaining invoice's reference stays blank on the legacy path (needs a ruling).

🤖 Generated with Claude Code

…on gross, direct-quote payable, stock flag at PCR, no rewind below ขั้น 10 (owner rulings 2026-10-28)

- QA-01 confirmDepositPaid books the notice's VAT-inclusive totalPayable.
- QA-02 commission gross pre-fill/compare/default = VAT-inclusive payable, labelled ยอดรับจริง (รวม VAT); CommissionCalculator unchanged (matches the owner's workbooks).
- QA-03 a confirmed DEAL_DIRECT quotation counts toward payable; ACCEPTED > APPROVED in all three payable queries; a confirmed direct quotation can't be revised, cloned, or superseded by another direct quotation.
- QA-04 pricing-request lines carry จากสต็อก (stockSource IN_THAILAND) seeded from the deal; stock lines skip ประเทศต้นทาง; CEO types the price.
- QA-05 ⋯ แก้ไขสถานะ can't move a deal at/after ORDER_RECEIVED below it (409, not offered).
- SK-02 ยืนยันคำสั่งซื้อ always asks first.
- SK-07 each tax invoice keeps round2(net x 7%) VAT; once a remaining invoice is issued, outstanding and the final receipt follow the issued documents; the remaining-invoice workbook prints stored VAT/total.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
demo-glr Ready Ready Preview Oct 28, 2026 4:14pm UTC

Request Review

…confirm, one answered-quotation rule keyed on the promotion event, keep IN_TRANSIT on re-tick, shared ConfirmOrderDialog

- Confirm-order cancels the deal's other DEAL_DIRECT quotations in DRAFT/PENDING_APPROVAL (one CANCELLED event each), so none is stranded in the approver's queue.
- TicketRepository.ANSWERED_QUOTATION_SQL: ACCEPTED, or an APPROVED DEAL_DIRECT quotation named by the DEAL_PROMOTED_FROM_QUOTATION event; used by payableAmountSelect, paymentTermsRowSql and FinanceDealRepository.findPayableQuotation (inline copy removed).
- PCR modal: re-ticking จากสต็อก restores a loaded IN_TRANSIT source.
- ConfirmOrderDialog shared by DealQuotationPanel, PricingRequestDetailPage and TicketDetailPage.
- Javadoc fixes (GLA-136 doc back on hasPromotionFromQuotationEvent; orderConfirmationOf).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ับจริง (QA-02 ruling 2026-10-28)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 55706fd1 Deployed Oct 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant