Repository navigation
fix(dashboard): money tiles match finance (QA-17, QA-18) - #1205
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
waritctd
added a commit
that referenced
this pull request
Oct 29, 2026
- SM leaderboard = this month's cash per rep (same rows as the CEO panel) - cashReceivedThisMonth = sum of the per-rep rows (one query) - pin the rep panel's largest-first order; drop unused DashboardSummaryDto.of overload; fix stale comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner rulings 2026-10-29: - Account รอรับมัดจำ = deposit due (latest ISSUED deposit notice total_payable, new TicketSummaryDto.depositDue, hidden from import). - ค้างรับ = /finance คงค้างรวม on account, CEO and SM (shared dashboardMoney.js). - Account รอชำระส่วนที่เหลือ counts the deals the to-do offers that step for. - CEO + SM show เงินรับแล้ว (เดือนนี้) (receipts in the Bangkok month, new cashReceivedThisMonth on the dashboard summary for account/ceo/sales_manager), ค้างรับ and ยอดคาดการณ์ (ACTIVE deals before ขั้น 10). Old month-sales, closed-count and pipeline tiles removed. - CEO ยอดตามทีม/ฝ่าย = this month's cash per rep (cashReceivedByRep). - Paid-sum sign rule shared via TicketRepository.SIGNED_RECEIPT_SUM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- SM leaderboard = this month's cash per rep (same rows as the CEO panel) - cashReceivedThisMonth = sum of the per-rep rows (one query) - pin the rep panel's largest-first order; drop unused DashboardSummaryDto.of overload; fix stale comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cap) financeOutstanding / forecastValue on /api/dashboard/summary for account/ceo/sales_manager, one SQL reusing payableAmountSelect, paidAmountSelect, paymentOverduePredicate, the account list scope and the commission-recorded fragment. Account, CEO, SM and the /finance header read the same figure (CEO /finance hero relabelled ค้างรับทั้งหมด). Shared case table money-cases.json pins the SQL against nextAccountAction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y cache key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
waritctd
force-pushed
the
fix/dashboard-money-matches-finance
branch
from
October 29, 2026 15:26
2211d71 to
b98d69b
Compare
waritctd
added a commit
that referenced
this pull request
Oct 29, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P2 batch 2 from the sales-pipeline UI walks. The account, CEO and sales-manager dashboards each used their own money rules, and none matched /finance. Each tile now follows a definition Ploy ruled on 2026-10-29.
Rulings
total_payable(฿85,418.10). NewTicketSummaryDto.depositDue, hidden from importdashboardMoney.financeOutstanding)AWAITING_FINAL_PAYMENT, so it showed "0 ดีล" while the to-do had itemsoffersFinalPayment)cashReceivedThisMonthfor account/ceo/sales_manager only), ค้างรับ and ยอดคาดการณ์ (ACTIVE deals before ขั้น 10)updatedAtcashReceivedThisMonthcashReceivedByRep). The rows add up to เงินรับแล้วNo payable SQL was copied. The paid-sum sign rule is now one constant,
TicketRepository.SIGNED_RECEIPT_SUM, used bypaidAmountSelectand by the dashboard.depositDueis read inside the existing per-row statement, so the statement count is unchanged (TicketActionsQueryCountIntegrationTestis green).Test coverage (written first and shown red before implementing)
dashboardMoney.test.js(new):AccountOverview.test.jsx:CeoOverview.test.jsx,ManagerOverview.test.jsx:DashboardServiceTest:DashboardRepositoryIntegrationTest:TicketDepositDueIntegrationTest(new):depositDueis null for every other payment status and for import.Deliberately not covered:
—).mockApi.js).Verification
docs/api/response-fields.jsonwas regenerated. It also picks up one unrelated existing drift line,PricingRequestSummaryDto.parentPricingRequestId, whichsalesActions.jsalready reads.Code review (medium) — fixed before merge
cashReceivedByRep, the same rows as the CEO panel), not by closed deals × deal value. There is no top-5 cut, so CEO and SM agree.cashReceivedThisMonthis now the sum of the per-rep rows, computed in one query. The total equals the rep rows by construction.DashboardSummaryDto.ofoverload and two stale comments are removed.deposit_dueis a per-row lookup inside a statement that already runs for each row.ค้างรับ and ยอดคาดการณ์ as server totals (no 500-row cap)
Ploy asked for this in the same PR.
/api/dashboard/summarynow hasfinanceOutstandingandforecastValue, served to account, ceo and sales_manager only.payableAmountSelect,paidAmountSelect,paymentOverduePredicate, the account list scope (nowaccountScopePredicate(), shared withappendRoleScope) and the commission-recorded fragment.dashboardMoney.jsis deleted. Each screen fetches the summary through one shared function,fetchDashboardSummary.backend/src/test/resources/dashboard/money-cases.jsonholds 23 deal shapes.moneyCases.test.jschecks the productionnextAccountActionagainst them, andDashboardMoneyTotalsIntegrationTestchecks the SQL against the same shapes.quotation_issuedguard in the SQL turns the case-table test red.TicketIaAuthzMatrixIntegrationTestandTicketScopeIntegrationTest, plus 877 vitest tests.9e815afe(fix(deals): status chips and labels follow the deal's real state (P2 batch 1) #1202 and fix(deal): skip route reads true — เสนอราคา ▾ trigger, ข้าม on never-visited stages #1206). Every commit is patch-identical after the rebase (checked withgit range-diff). Re-tested after the rebase: 9 backend classes green and 883 vitest tests passing.docs/api/response-fields.jsonwas regenerated:TicketSummaryDto.closedAt, which the CEO dashboard no longer reads.ImportRequestCoverageResponse.hasUncoveredFactories, which develop already reads.🤖 Generated with Claude Code