Skip to content

Sale for Cashier: Credit bills persist with no creditCompany, so they never reach debtor reporting #22462

Description

@buddhika75

Problem

PharmacySaleForCashierController.settlePreBillAndNavigateToPrint() persists the cashier
PreBill with creditCompany = null and toInstitution = null, even when the payment method
is Credit and a credit company was selected on the page.

BillBeanController.setPaymentMethodData(...) only sets creditBill = true for credit
payment types — it never populates creditCompany or toInstitution. And
syncStaffSelectionFromPaymentDetails(), which back-fills the counterparty, syncs only
toStaff and is reachable exclusively from errorCheckOnPaymentMethod(), which the cashier
settle path never calls.

Impact

A "Sale for Cashier" bill paid by Credit is stored with creditBill = true but no credit
counterparty, so it does not appear in credit-company debtor reporting. The debt is
effectively invisible against the company.

How it was found

While building the native-SQL replacement for this page (#20261). The native
implementation deliberately fixes this — it records both toInstitution and creditCompany
— so bills created by the native page will differ from historical legacy bills in this
column. Raising the legacy defect separately so the divergence is a known, deliberate one
rather than a surprise.

Suggested scope

  1. Populate the credit counterparty on the legacy cashier settle path.
  2. Decide whether historical legacy cashier Credit bills need a backfill for reporting
    consistency across the switchover.

Related: #20261, master #22442

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions