@shisyamo4131/air-guard-v2-schemas 1.3.1-dev.20 → 1.3.1-dev.22
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 +1 -1
- package/src/Billing.js +76 -5
- package/src/OperationResult.js +1 -1
package/package.json
CHANGED
package/src/Billing.js
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @prop {string} customerId - customer document id
|
|
8
8
|
* @prop {string} siteId - site document id
|
|
9
|
-
* @prop {
|
|
10
|
-
* @prop {Date}
|
|
11
|
-
* @prop {Date} paymentDueDate - payment due date
|
|
9
|
+
* @prop {Date} billingDateAt - billing date
|
|
10
|
+
* @prop {Date} paymentDueDateAt - payment due date
|
|
12
11
|
*
|
|
13
12
|
* @prop {Array} paymentRecords - payment records (not implemented yet)
|
|
14
13
|
*
|
|
@@ -17,6 +16,10 @@
|
|
|
17
16
|
* @prop {Object} adjustment - adjustment
|
|
18
17
|
* @prop {string} remarks - remarks
|
|
19
18
|
*
|
|
19
|
+
* @prop {string} billingMonth - billing month (YYYY-MM format) (read-only)
|
|
20
|
+
* @prop {Date} billingDate - billing date (YYYY-MM-DD format) (read-only)
|
|
21
|
+
* @prop {string} paymentDueMonth - payment due month (YYYY-MM format) (read-only)
|
|
22
|
+
* @prop {Date} paymentDueDate - payment due date (YYYY-MM-DD format) (read-only)
|
|
20
23
|
* @prop {number} subtotal - subtotal (excluding tax) (computed-readonly)
|
|
21
24
|
* @prop {number} taxAmount - tax amount (computed-readonly)
|
|
22
25
|
* @prop {number} totalAmount - total amount (including tax) (computed-readonly)
|
|
@@ -37,8 +40,7 @@ const STATUS = {
|
|
|
37
40
|
const classProps = {
|
|
38
41
|
customerId: defField("customerId", { required: true }),
|
|
39
42
|
siteId: defField("siteId", { required: true }),
|
|
40
|
-
|
|
41
|
-
billingDateAt: defField("dateAt"),
|
|
43
|
+
billingDateAt: defField("dateAt", { required: true }),
|
|
42
44
|
paymentDueDateAt: defField("dateAt"),
|
|
43
45
|
|
|
44
46
|
// 入金管理用配列(現時点では未使用 将来の拡張用)
|
|
@@ -66,6 +68,75 @@ export default class Billing extends FireModel {
|
|
|
66
68
|
afterInitialize(item = {}) {
|
|
67
69
|
super.afterInitialize(item);
|
|
68
70
|
|
|
71
|
+
// billingDate (YYYY-MM-DD) と billingMonth (YYYY-MM) の計算用プロパティを定義
|
|
72
|
+
Object.defineProperties(this, {
|
|
73
|
+
billingDate: {
|
|
74
|
+
configurable: true,
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get() {
|
|
77
|
+
if (!this.billingDateAt) return null;
|
|
78
|
+
const jstDate = new Date(
|
|
79
|
+
this.billingDateAt.getTime() + 9 * 60 * 60 * 1000
|
|
80
|
+
); /* JST補正 */
|
|
81
|
+
const year = jstDate.getUTCFullYear();
|
|
82
|
+
const month = jstDate.getUTCMonth() + 1;
|
|
83
|
+
const day = jstDate.getUTCDate();
|
|
84
|
+
return `${year}-${String(month).padStart(2, "0")}-${String(
|
|
85
|
+
day
|
|
86
|
+
).padStart(2, "0")}`;
|
|
87
|
+
},
|
|
88
|
+
set(v) {},
|
|
89
|
+
},
|
|
90
|
+
billingMonth: {
|
|
91
|
+
configurable: true,
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get() {
|
|
94
|
+
if (!this.billingDateAt) return null;
|
|
95
|
+
const jstDate = new Date(
|
|
96
|
+
this.billingDateAt.getTime() + 9 * 60 * 60 * 1000
|
|
97
|
+
); /* JST補正 */
|
|
98
|
+
const year = jstDate.getUTCFullYear();
|
|
99
|
+
const month = jstDate.getUTCMonth() + 1;
|
|
100
|
+
return `${year}-${String(month).padStart(2, "0")}`;
|
|
101
|
+
},
|
|
102
|
+
set(v) {},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
Object.defineProperties(this, {
|
|
107
|
+
paymentDueDate: {
|
|
108
|
+
configurable: true,
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get() {
|
|
111
|
+
if (!this.paymentDueDateAt) return null;
|
|
112
|
+
const jstDate = new Date(
|
|
113
|
+
this.paymentDueDateAt.getTime() + 9 * 60 * 60 * 1000
|
|
114
|
+
); /* JST補正 */
|
|
115
|
+
const year = jstDate.getUTCFullYear();
|
|
116
|
+
const month = jstDate.getUTCMonth() + 1;
|
|
117
|
+
const day = jstDate.getUTCDate();
|
|
118
|
+
return `${year}-${String(month).padStart(2, "0")}-${String(
|
|
119
|
+
day
|
|
120
|
+
).padStart(2, "0")}`;
|
|
121
|
+
},
|
|
122
|
+
set(v) {},
|
|
123
|
+
},
|
|
124
|
+
paymentDueMonth: {
|
|
125
|
+
configurable: true,
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get() {
|
|
128
|
+
if (!this.paymentDueDateAt) return null;
|
|
129
|
+
const jstDate = new Date(
|
|
130
|
+
this.paymentDueDateAt.getTime() + 9 * 60 * 60 * 1000
|
|
131
|
+
); /* JST補正 */
|
|
132
|
+
const year = jstDate.getUTCFullYear();
|
|
133
|
+
const month = jstDate.getUTCMonth() + 1;
|
|
134
|
+
return `${year}-${String(month).padStart(2, "0")}`;
|
|
135
|
+
},
|
|
136
|
+
set(v) {},
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
69
140
|
// 小計(税抜)を計算
|
|
70
141
|
Object.defineProperty(this, "subtotal", {
|
|
71
142
|
get() {
|
package/src/OperationResult.js
CHANGED
|
@@ -574,7 +574,7 @@ export default class OperationResult extends Operation {
|
|
|
574
574
|
}
|
|
575
575
|
|
|
576
576
|
// Sync customerId if siteId changed
|
|
577
|
-
if (this.siteId === this._beforeData.siteId) return;
|
|
577
|
+
if (this.siteId === this._beforeData.siteId && this.customerId) return;
|
|
578
578
|
await this._syncCustomerId();
|
|
579
579
|
}
|
|
580
580
|
|