tango-api-schema 2.6.47 → 2.6.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-api-schema",
3
- "version": "2.6.47",
3
+ "version": "2.6.48",
4
4
  "description": "tangoEye model schema",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,154 +1,157 @@
1
- import mongoose from 'mongoose';
2
-
3
- const invoiceSchema = new mongoose.Schema(
4
- {
5
- clientId: {
6
- type:String
7
- },
8
- invoice: {
9
- type:String,
10
- },
11
- invoiceIndex: {
12
- type:String,
13
- },
14
- stores: {
15
- type:Number
16
- },
17
- // For TINV (advance quarterly/half-yearly/yearly) invoices: the actual
18
- // list of stores covered, captured at generation time, with each store's
19
- // products and their working days.
20
- storeDetails: [
21
- {
22
- storeId: { type: String },
23
- storeName: { type: String },
24
- products: [
25
- {
26
- productName: { type: String },
27
- workingdays: { type: Number },
28
- },
29
- ],
30
- },
31
- ],
32
- companyName:{
33
- type:String,
34
- },
35
- monthOfbilling:{
36
- type:String,
37
- },
38
- companyAddress:{
39
- type:String,
40
- },
41
- PlaceOfSupply: {
42
- type:String,
43
- },
44
- GSTNumber: {
45
- type:String,
46
- },
47
- products:{
48
- type:Array
49
- },
50
- tax:{
51
- type:Array
52
- },
53
- amount:{
54
- type:Number
55
- },
56
- totalAmount:{
57
- type:Number
58
- },
59
- paymentMethod:{
60
- type:String
61
- },
62
- status:{
63
- type:String,
64
- default:'pendingCsm',
65
- enum:['pendingCsm','pendingFinance','pendingApproval','approved']
66
- },
67
- receivedAmount:{
68
- type:Number
69
- },
70
- billingDate:{
71
- type:Date
72
- },
73
- dueDate:{
74
- type:Date
75
- },
76
- paidDate:{
77
- type:Date
78
- },
79
- paymentType: {
80
- type:String,
81
- enum: ['online','banktransfer']
82
- },
83
- paymentReferenceId: {
84
- type:String
85
- },
86
- fromDate:{
87
- type:Date
88
- },
89
- toDate:{
90
- type:Date
91
- },
92
- currency: {
93
- type:String
94
- },
95
- orderId: {
96
- type:String
97
- },
98
- groupName: {
99
- type:String
100
- },
101
- groupId: {
102
- type:String
103
- },
104
- // Purchase order this invoice is mapped to (reduces the PO's remaining
105
- // balance). Empty when the invoice isn't tied to a PO.
106
- purchaseOrderNumber: {
107
- type:String
108
- },
109
- discountAmount: {
110
- type:Number
111
- },
112
- discountPercentage: {
113
- type:Number
114
- },
115
- paymentStatus:{
116
- type:String,
117
- default:'unpaid',
118
- // 'partial' = paidAmount > 0 && paidAmount < totalAmount.
119
- // Server derives this in recordPayment so the value stays in sync.
120
- enum: ['paid','unpaid','partial']
121
- },
122
- // Running total of all payments recorded against this invoice. Sum of
123
- // paymentHistory[].amount; persisted for easy querying / display so
124
- // the frontend doesn't need to re-sum every render.
125
- paidAmount:{
126
- type:Number,
127
- default:0
128
- },
129
- // Append-only audit trail. Each entry is one payment received from
130
- // the client. recordedAt is server-set; the rest comes from the form.
131
- paymentHistory:[{
132
- amount:{type:Number, required:true},
133
- date:{type:Date, required:true},
134
- method:{type:String, enum:['banktransfer','upi','cheque','card','cash','other']},
135
- reference:{type:String},
136
- notes:{type:String},
137
- recordedBy:{type:String},
138
- recordedAt:{type:Date, default:Date.now}
139
- }],
140
- advanceInvoice:{
141
- type:Boolean,
142
- default:false
143
- },
144
- tempIndex:{ type:Number },
145
- advancePeriod:{ type:String },
146
- advanceMonths:{ type:Number },
147
- },{
148
- strict: true,
149
- versionKey: false,
150
- timestamps: true,
151
- }
152
- )
153
-
1
+ import mongoose from 'mongoose';
2
+
3
+ const invoiceSchema = new mongoose.Schema(
4
+ {
5
+ clientId: {
6
+ type:String
7
+ },
8
+ invoice: {
9
+ type:String,
10
+ },
11
+ invoiceIndex: {
12
+ type:String,
13
+ },
14
+ stores: {
15
+ type:Number
16
+ },
17
+ // For TINV (advance quarterly/half-yearly/yearly) invoices: the actual
18
+ // list of stores covered, captured at generation time, with each store's
19
+ // products and their working days.
20
+ storeDetails: [
21
+ {
22
+ storeId: { type: String },
23
+ storeName: { type: String },
24
+ products: [
25
+ {
26
+ productName: { type: String },
27
+ workingdays: { type: Number },
28
+ },
29
+ ],
30
+ },
31
+ ],
32
+ companyName:{
33
+ type:String,
34
+ },
35
+ monthOfbilling:{
36
+ type:String,
37
+ },
38
+ companyAddress:{
39
+ type:String,
40
+ },
41
+ PlaceOfSupply: {
42
+ type:String,
43
+ },
44
+ GSTNumber: {
45
+ type:String,
46
+ },
47
+ products:{
48
+ type:Array
49
+ },
50
+ tax:{
51
+ type:Array
52
+ },
53
+ amount:{
54
+ type:Number
55
+ },
56
+ totalAmount:{
57
+ type:Number
58
+ },
59
+ paymentMethod:{
60
+ type:String
61
+ },
62
+ status:{
63
+ type:String,
64
+ default:'pendingCsm',
65
+ enum:['pendingCsm','pendingFinance','pendingApproval','approved']
66
+ },
67
+ receivedAmount:{
68
+ type:Number
69
+ },
70
+ billingDate:{
71
+ type:Date
72
+ },
73
+ dueDate:{
74
+ type:Date
75
+ },
76
+ paymentTerm:{
77
+ type:Number
78
+ },
79
+ paidDate:{
80
+ type:Date
81
+ },
82
+ paymentType: {
83
+ type:String,
84
+ enum: ['online','banktransfer']
85
+ },
86
+ paymentReferenceId: {
87
+ type:String
88
+ },
89
+ fromDate:{
90
+ type:Date
91
+ },
92
+ toDate:{
93
+ type:Date
94
+ },
95
+ currency: {
96
+ type:String
97
+ },
98
+ orderId: {
99
+ type:String
100
+ },
101
+ groupName: {
102
+ type:String
103
+ },
104
+ groupId: {
105
+ type:String
106
+ },
107
+ // Purchase order this invoice is mapped to (reduces the PO's remaining
108
+ // balance). Empty when the invoice isn't tied to a PO.
109
+ purchaseOrderNumber: {
110
+ type:String
111
+ },
112
+ discountAmount: {
113
+ type:Number
114
+ },
115
+ discountPercentage: {
116
+ type:Number
117
+ },
118
+ paymentStatus:{
119
+ type:String,
120
+ default:'unpaid',
121
+ // 'partial' = paidAmount > 0 && paidAmount < totalAmount.
122
+ // Server derives this in recordPayment so the value stays in sync.
123
+ enum: ['paid','unpaid','partial']
124
+ },
125
+ // Running total of all payments recorded against this invoice. Sum of
126
+ // paymentHistory[].amount; persisted for easy querying / display so
127
+ // the frontend doesn't need to re-sum every render.
128
+ paidAmount:{
129
+ type:Number,
130
+ default:0
131
+ },
132
+ // Append-only audit trail. Each entry is one payment received from
133
+ // the client. recordedAt is server-set; the rest comes from the form.
134
+ paymentHistory:[{
135
+ amount:{type:Number, required:true},
136
+ date:{type:Date, required:true},
137
+ method:{type:String, enum:['banktransfer','upi','cheque','card','cash','other']},
138
+ reference:{type:String},
139
+ notes:{type:String},
140
+ recordedBy:{type:String},
141
+ recordedAt:{type:Date, default:Date.now}
142
+ }],
143
+ advanceInvoice:{
144
+ type:Boolean,
145
+ default:false
146
+ },
147
+ tempIndex:{ type:Number },
148
+ advancePeriod:{ type:String },
149
+ advanceMonths:{ type:Number },
150
+ },{
151
+ strict: true,
152
+ versionKey: false,
153
+ timestamps: true,
154
+ }
155
+ )
156
+
154
157
  export default mongoose.model('invoice', invoiceSchema);