payservedb 5.4.3 → 5.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -163,6 +163,7 @@ const models = {
163
163
  BookingReservation: require('./src/models/bookingreservation'),
164
164
  BookingConfig: require('./src/models/bookingconfig'),
165
165
  BookingAnalytics: require('./src/models/bookinganalytics'),
166
+ BookingInvoice: require('./src/models/booking_invoice'),
166
167
  RevenueRecord: require('./src/models/bookingrevenuerecord'),
167
168
  GLAccount: require('./src/models/gl_accounts'),
168
169
  GLEntry: require('./src/models/gl_entries'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "5.4.3",
3
+ "version": "5.4.5",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,152 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ // Define the schema for Booking Invoices
4
+ const bookingInvoiceSchema = new mongoose.Schema({
5
+ invoiceNumber: {
6
+ type: String,
7
+ required: true,
8
+ unique: true,
9
+ },
10
+ facilityId: {
11
+ type: mongoose.Schema.Types.ObjectId,
12
+ ref: 'Facility',
13
+ required: true
14
+ },
15
+ invoiceId: {
16
+ type: String,
17
+ required: true,
18
+ unique: true
19
+ },
20
+ bookingReservationId: {
21
+ type: mongoose.Schema.Types.ObjectId,
22
+ ref: 'BookingReservation',
23
+ required: true
24
+ },
25
+ unitId: {
26
+ type: mongoose.Schema.Types.ObjectId,
27
+ ref: 'Unit',
28
+ required: true
29
+ },
30
+ guestInfo: {
31
+ name: {
32
+ type: String,
33
+ required: true
34
+ },
35
+ email: {
36
+ type: String,
37
+ required: true
38
+ },
39
+ phone: {
40
+ type: String,
41
+ required: true
42
+ },
43
+ idNumber: {
44
+ type: String
45
+ }
46
+ },
47
+ issueDate: {
48
+ type: Date,
49
+ default: Date.now,
50
+ required: true
51
+ },
52
+ dueDate: {
53
+ type: Date,
54
+ required: true
55
+ },
56
+ checkIn: {
57
+ type: Date,
58
+ required: true
59
+ },
60
+ checkOut: {
61
+ type: Date,
62
+ required: true
63
+ },
64
+ basePrice: {
65
+ type: Number,
66
+ required: true
67
+ },
68
+ totalAmount: {
69
+ type: Number,
70
+ required: true
71
+ },
72
+ additionalServices: [{
73
+ serviceId: {
74
+ type: mongoose.Schema.Types.ObjectId,
75
+ ref: 'ValueAddedService'
76
+ },
77
+ serviceName: {
78
+ type: String,
79
+ required: true
80
+ },
81
+ quantity: {
82
+ type: Number,
83
+ default: 1
84
+ },
85
+ price: {
86
+ type: Number,
87
+ required: true
88
+ }
89
+ }],
90
+ discountAmount: {
91
+ type: Number,
92
+ default: 0
93
+ },
94
+ taxAmount: {
95
+ type: Number,
96
+ default: 0
97
+ },
98
+ paymentMethod: {
99
+ type: String,
100
+ enum: ['Cash', 'Card', 'Bank Transfer', 'Mobile Money', 'Other'],
101
+ required: true
102
+ },
103
+ paymentStatus: {
104
+ type: String,
105
+ enum: ['Pending', 'Paid', 'Partially Paid', 'Refunded', 'Cancelled'],
106
+ default: 'Pending'
107
+ },
108
+ paymentHistory: [{
109
+ amount: {
110
+ type: Number,
111
+ required: true
112
+ },
113
+ paymentMethod: {
114
+ type: String,
115
+ enum: ['Cash', 'Card', 'Bank Transfer', 'Mobile Money', 'Other'],
116
+ required: true
117
+ },
118
+ transactionId: String,
119
+ date: {
120
+ type: Date,
121
+ default: Date.now
122
+ },
123
+ notes: String
124
+ }],
125
+ currencyId: {
126
+ type: mongoose.Schema.Types.ObjectId,
127
+ ref: 'Currency',
128
+ required: true
129
+ },
130
+ status: {
131
+ type: String,
132
+ enum: ['active', 'cancelled', 'void'],
133
+ default: 'active'
134
+ },
135
+ notes: {
136
+ type: String
137
+ },
138
+ createdBy: {
139
+ type: mongoose.Schema.Types.ObjectId,
140
+ ref: 'User'
141
+ },
142
+ updatedBy: {
143
+ type: mongoose.Schema.Types.ObjectId,
144
+ ref: 'User'
145
+ }
146
+ }, {
147
+ timestamps: true
148
+ });
149
+
150
+ const BookingInvoice = mongoose.model('BookingInvoice', bookingInvoiceSchema);
151
+
152
+ module.exports = BookingInvoice;
@@ -35,7 +35,7 @@ const vasInvoiceSchema = new mongoose.Schema({
35
35
  status: {
36
36
  type: String,
37
37
  required: true,
38
- enum: ['Pending', 'Paid', 'Partially Paid', 'Cancelled', 'Overdue', 'Unpaid'],
38
+ enum: ['Pending', 'Paid', 'Partially Paid', 'Cancelled', 'Overdue', 'Unpaid', 'Void'],
39
39
  default: 'Pending'
40
40
  },
41
41
  unit: {