feat(cashier): GL Entries view in Closing Cash Report
- New 'GL View' toggle button in header — switches between denomination report and GL entries table - GL table: Voucher No, A/C No, A/C Name (customer), DR (red), CR (green) - Filters: Teller Head dropdown → Cashier dropdown (cascading) - Load button resets to denomination view (showGl = false) - Header shows Total DR / Total CR summary - DR rows: light red bg; CR rows: light green bg Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
1aa46397a6
commit
3be2f96210
@@ -36,6 +36,20 @@ export class ClosingCashReportComponent implements OnInit {
|
||||
loading = false;
|
||||
loaded = false;
|
||||
|
||||
// GL View
|
||||
showGl = false;
|
||||
glRows: any[] = [];
|
||||
glTotalDr = 0;
|
||||
glTotalCr = 0;
|
||||
glLoading = false;
|
||||
glLoaded = false;
|
||||
|
||||
// Filters for GL
|
||||
tellers: any[] = [];
|
||||
cashiers: any[] = [];
|
||||
selectedTellerId: number | null = null;
|
||||
selectedCashierId: number | null = null;
|
||||
|
||||
get noteRows(): any[] {
|
||||
return this.rows.filter((r) => r.kind !== 'coin');
|
||||
}
|
||||
@@ -53,9 +67,11 @@ export class ClosingCashReportComponent implements OnInit {
|
||||
const d = new Date();
|
||||
this.date = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
||||
this.load();
|
||||
this.service.getTellers().subscribe({ next: (t: any[]) => (this.tellers = t || []), error: () => {} });
|
||||
}
|
||||
|
||||
load(): void {
|
||||
this.showGl = false;
|
||||
this.loading = true;
|
||||
this.service.closingCashReport(this.date).subscribe({
|
||||
next: (res: any) => {
|
||||
@@ -78,4 +94,51 @@ export class ClosingCashReportComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
toggleGl(): void {
|
||||
this.showGl = !this.showGl;
|
||||
if (this.showGl && !this.glLoaded) {
|
||||
this.loadGl();
|
||||
}
|
||||
}
|
||||
|
||||
onTellerChange(): void {
|
||||
this.selectedCashierId = null;
|
||||
this.cashiers = [];
|
||||
if (this.selectedTellerId) {
|
||||
this.service.getCashiersForTeller(this.selectedTellerId).subscribe({
|
||||
next: (res: any) => (this.cashiers = res?.cashiers || res || []),
|
||||
error: () => {}
|
||||
});
|
||||
}
|
||||
this.glLoaded = false;
|
||||
this.loadGl();
|
||||
}
|
||||
|
||||
onCashierChange(): void {
|
||||
this.glLoaded = false;
|
||||
this.loadGl();
|
||||
}
|
||||
|
||||
loadGl(): void {
|
||||
this.glLoading = true;
|
||||
this.service
|
||||
.getGlEntries(this.date, this.selectedCashierId || undefined, this.selectedTellerId || undefined)
|
||||
.subscribe({
|
||||
next: (res: any) => {
|
||||
this.glRows = res?.rows || [];
|
||||
this.glTotalDr = Number(res?.totalDr || 0);
|
||||
this.glTotalCr = Number(res?.totalCr || 0);
|
||||
this.glLoading = false;
|
||||
this.glLoaded = true;
|
||||
},
|
||||
error: () => {
|
||||
this.glRows = [];
|
||||
this.glTotalDr = 0;
|
||||
this.glTotalCr = 0;
|
||||
this.glLoading = false;
|
||||
this.glLoaded = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user