feat(clerk): add collection flow — multi-DR savings to CR GL with maker-checker
- Transaction entry: detect collection mode (N DR savings → 1 CR GL) and disbursement mode (1 DR GL → N CR savings); build dbCr-tagged payload for backend - Disbursement review: show 'GL Credit (Target)' / 'Debit Entries' labels for collection; fix double-count by summing only DR entries for collection totals; dynamic approve button text - My disbursement requests: add DR/CR badge column in expanded credit-entries preview - My requests / withdrawal-requests: minor consistency updates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
efb01d5441
commit
6cccb58c04
@@ -18,11 +18,12 @@ import { of } from 'rxjs';
|
||||
import { ClerkDisbursementService } from '../../cashier/clerk-disbursement.service';
|
||||
|
||||
interface CreditEntry {
|
||||
accountId: number;
|
||||
accountId?: number;
|
||||
accountNo: string;
|
||||
accountName: string;
|
||||
accountType: string;
|
||||
amount: number;
|
||||
dbCr?: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -69,8 +70,9 @@ export class DisbursementReviewComponent implements OnInit {
|
||||
this.loading = false;
|
||||
if (res?.credit_entries) {
|
||||
try {
|
||||
this.creditEntries =
|
||||
const raw: any[] =
|
||||
typeof res.credit_entries === 'string' ? JSON.parse(res.credit_entries) : res.credit_entries;
|
||||
this.creditEntries = raw.map((e) => ({ ...e, amount: parseFloat(e.amount) || 0 }));
|
||||
} catch {
|
||||
this.creditEntries = [];
|
||||
}
|
||||
@@ -112,8 +114,21 @@ export class DisbursementReviewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
get isCollectionMode(): boolean {
|
||||
return this.creditEntries.some((e) => e.dbCr === 'Dr');
|
||||
}
|
||||
|
||||
get drEntries(): CreditEntry[] {
|
||||
return this.creditEntries.filter((e) => e.dbCr === 'Dr');
|
||||
}
|
||||
|
||||
get crEntries(): CreditEntry[] {
|
||||
return this.creditEntries.filter((e) => e.dbCr !== 'Dr');
|
||||
}
|
||||
|
||||
totalCreditAmount(): number {
|
||||
return this.creditEntries.reduce((sum, e) => sum + (e.amount ?? 0), 0);
|
||||
const entries = this.isCollectionMode ? this.drEntries : this.crEntries;
|
||||
return entries.reduce((sum, e) => sum + (e.amount ?? 0), 0);
|
||||
}
|
||||
|
||||
statusClass(status: string): string {
|
||||
|
||||
Reference in New Issue
Block a user