40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
/**
|
|
* BillingManager: Aggregates revenue from OP, Pharmacy, and Lab.
|
|
*/
|
|
|
|
class BillingManager {
|
|
constructor() {
|
|
this.dailyCollections = {
|
|
op: 4500, // Consultation fees
|
|
pharmacy: 12450, // Medicine sales
|
|
lab: 8200 // Diagnostic tests
|
|
};
|
|
this.transactions = [
|
|
{ id: 'TXN-001', dept: 'OP', amount: 500, patient: 'Rahul Verma', status: 'PAID' },
|
|
{ id: 'TXN-002', dept: 'Pharmacy', amount: 1200, patient: 'Anjali Singh', status: 'PAID' },
|
|
{ id: 'TXN-003', dept: 'Lab', amount: 2500, patient: 'Suresh Kumar', status: 'PENDING' }
|
|
];
|
|
}
|
|
|
|
getDailySummary() {
|
|
const total = this.dailyCollections.op + this.dailyCollections.pharmacy + this.dailyCollections.lab;
|
|
return {
|
|
...this.dailyCollections,
|
|
total,
|
|
growth: '+12.5%' // Simulated growth vs yesterday
|
|
};
|
|
}
|
|
|
|
getTransactions() {
|
|
return this.transactions;
|
|
}
|
|
|
|
addRevenue(dept, amount) {
|
|
if (this.dailyCollections[dept.toLowerCase()] !== undefined) {
|
|
this.dailyCollections[dept.toLowerCase()] += amount;
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = new BillingManager();
|