Skip to content

feat: Credit Sales Summary + per-customer Items on Credit tab#323

Open
NotAbdelrahmanelsayed wants to merge 1 commit into
BrainWise-DEV:developfrom
NotAbdelrahmanelsayed:feature/credit-sales-summary
Open

feat: Credit Sales Summary + per-customer Items on Credit tab#323
NotAbdelrahmanelsayed wants to merge 1 commit into
BrainWise-DEV:developfrom
NotAbdelrahmanelsayed:feature/credit-sales-summary

Conversation

@NotAbdelrahmanelsayed

Copy link
Copy Markdown
Contributor

Credit Sales Summary + Per-Customer "Items on Credit" tab

Adds a fast way to answer "who owes the shop money?" and "what did this customer take on credit?" — without opening customers one by one.

What's new

  • Credit Sales button in the POS side rail → opens a summary of every company customer with a net outstanding balance, each row clickable.
  • Clicking a customer drills into the existing Customer Account statement (reusing all existing dues/payment logic).
  • A new "Items on Credit" tab in the Customer Account dialog that aggregates line items across all unpaid invoices, grouped by item, with the net balance as a headline.

Backend

  • pos_next/api/customer_dues.py: new get_credit_customers_summary(pos_profile, company) — one grouped Sales Invoice query (mirrors credit_sales.get_customer_balance math, GROUP BY customer), returns customers with net_balance > 0, their due-invoice counts, and a company-wide total. Permission-guarded + frappe.log_error wrapped.
  • pos_next/api/test_customer_dues.py: unit tests (mixed regular + return invoices; permission guard).

Frontend

  • CreditSalesSummaryDialog.vue (new), CustomerDuesDialog.vue (Statement / Items-on-Credit tabs + items aggregation), ManagementSlider.vue (rail button), posUI.js (dialog registration), POSSale.vue (wiring).
  • Full Arabic localization added to translations/ar.csv; verified end-to-end in EN and AR/RTL.

ℹ️ Screenshots below are from the live build with customer names and amounts redacted (Customer 1…N, E£ •••).


English

Credit Sales summary

summary-en

Customer Account → Statement tab

statement-en

Customer Account → Items on Credit tab

items-en

Arabic (RTL)

ملخص المبيعات الآجلة

summary-ar

كشف الحساب

statement-ar

الأصناف الآجلة

items-ar


Note on scope

This feature extends files (the dues dialog, the main POS page, the UI store, ar.csv) that already carried related in-progress local work, and the page's import graph ties them together. To keep the branch building/running as tested, it therefore also includes that related POS work rather than an artificially split, non-building diff.

🤖 Generated with Claude Code

Add a "who owes the shop money" view reachable from the POS side rail,
plus a per-customer breakdown of items taken on credit.

Backend
- pos_next/api/customer_dues.py: get_credit_customers_summary() (one grouped
  Sales Invoice query, GROUP BY customer, mirrors credit_sales.get_customer_balance
  math), get_customer_due_statement(), and pay_customer_due(). Permission-guarded.
- pos_next/api/test_customer_dues.py: unit tests (returns netting, permission guard).

Frontend
- CreditSalesSummaryDialog.vue: debtor list with total-owed card and
  Arabic-aware client search; rows drill into the customer statement.
- CustomerDuesDialog.vue: Statement / Items-on-Credit tabs; items tab
  aggregates due-invoice line items by item (qty + amount).
- ManagementSlider.vue: new "Credit Sales" rail button.
- posUI.js: register the creditSalesSummary dialog (shortcut suppression).
- POSSale.vue: mount the dialogs + wire the rail action and drill-in.
- utils/searchText.js, composables/useDialogSubmit.js: helpers the dialogs use.
- translations/ar.csv: Arabic for all new strings.

Rebased onto develop so the PR contains only the credit-sales feature.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0193VupL1jxR1L3ShCCqMjfy
@NotAbdelrahmanelsayed NotAbdelrahmanelsayed force-pushed the feature/credit-sales-summary branch from 0ce3799 to dd0db84 Compare June 20, 2026 10:01
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