@tomei/finance 0.6.8 → 0.6.9
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
package/src/document/document.ts
CHANGED
|
@@ -131,57 +131,36 @@ export default class Document extends AccountSystemEntity {
|
|
|
131
131
|
return 'finance_Document';
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
constructor(dbTransaction?: any,
|
|
134
|
+
constructor(dbTransaction?: any, documentData?: any) {
|
|
135
135
|
super();
|
|
136
136
|
if (dbTransaction) {
|
|
137
137
|
this._DbTransaction = dbTransaction;
|
|
138
138
|
}
|
|
139
|
-
if (
|
|
140
|
-
this.
|
|
141
|
-
this.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
this.UpdatedAt = documentData.UpdatedAt;
|
|
165
|
-
this.DocPDFFileMediaId = documentData.DocPDFFileMediaId;
|
|
166
|
-
this.DocHTMLFileMediaId = documentData.DocHTMLFileMediaId;
|
|
167
|
-
this.AccSystemRefId = documentData.AccSystemRefId;
|
|
168
|
-
this.PostedToAccSystemYN = documentData.PostedToAccSystemYN;
|
|
169
|
-
this.PostedById = documentData.PostedById;
|
|
170
|
-
this.PostedDateTime = documentData.PostedDateTime;
|
|
171
|
-
this.UseAccSystemDocYN = documentData.UseAccSystemDocYN;
|
|
172
|
-
this.IsNewRecord = false;
|
|
173
|
-
} else {
|
|
174
|
-
const notFoundError = new RecordNotFoundError(
|
|
175
|
-
'FinanceDocumentErrMsg',
|
|
176
|
-
'No Record Found.',
|
|
177
|
-
);
|
|
178
|
-
throw notFoundError;
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
.catch((err) => {
|
|
182
|
-
// tslint:disable-next-line:no-console
|
|
183
|
-
console.log('Document Class constructor err: ', err);
|
|
184
|
-
});
|
|
139
|
+
if (documentData) {
|
|
140
|
+
this.DocType = documentData.DocType;
|
|
141
|
+
this.DocDate = documentData.DocDate;
|
|
142
|
+
this.CompanyId = documentData.CompanyId;
|
|
143
|
+
this.Currency = documentData.Currency;
|
|
144
|
+
this.Amount = documentData.Amount;
|
|
145
|
+
this.Description = documentData.Description;
|
|
146
|
+
this.Status = documentData.Status;
|
|
147
|
+
this.IssuedById = documentData.IssuedById;
|
|
148
|
+
this.IssuedToId = documentData.IssuedToId;
|
|
149
|
+
this.IssuedToType = documentData.IssuedToType;
|
|
150
|
+
this.RelatedObjectId = documentData.RelatedObjectId;
|
|
151
|
+
this.RelatedObjectType = documentData.RelatedObjectType;
|
|
152
|
+
this.CreatedById = documentData.CreatedById;
|
|
153
|
+
this.CreatedAt = documentData.CreatedAt;
|
|
154
|
+
this.UpdatedById = documentData.UpdatedById;
|
|
155
|
+
this.UpdatedAt = documentData.UpdatedAt;
|
|
156
|
+
this.DocPDFFileMediaId = documentData.DocPDFFileMediaId;
|
|
157
|
+
this.DocHTMLFileMediaId = documentData.DocHTMLFileMediaId;
|
|
158
|
+
this.AccSystemRefId = documentData.AccSystemRefId;
|
|
159
|
+
this.PostedToAccSystemYN = documentData.PostedToAccSystemYN;
|
|
160
|
+
this.PostedById = documentData.PostedById;
|
|
161
|
+
this.PostedDateTime = documentData.PostedDateTime;
|
|
162
|
+
this.UseAccSystemDocYN = documentData.UseAccSystemDocYN;
|
|
163
|
+
this.IsNewRecord = false;
|
|
185
164
|
}
|
|
186
165
|
}
|
|
187
166
|
|
|
@@ -214,7 +193,6 @@ export default class Document extends AccountSystemEntity {
|
|
|
214
193
|
|
|
215
194
|
public static async initDocument(dbTransaction: any, docNo: string) {
|
|
216
195
|
try {
|
|
217
|
-
const document = new Document(dbTransaction);
|
|
218
196
|
const documentData = await this._RepositoryBase.findOne({
|
|
219
197
|
where: {
|
|
220
198
|
DocNo: docNo,
|
|
@@ -226,31 +204,34 @@ export default class Document extends AccountSystemEntity {
|
|
|
226
204
|
],
|
|
227
205
|
});
|
|
228
206
|
if (documentData) {
|
|
229
|
-
document
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
207
|
+
const document = new Document(dbTransaction, {
|
|
208
|
+
DocNo: documentData.DocNo,
|
|
209
|
+
DocType: documentData.DocType,
|
|
210
|
+
CompanyId: documentData.CompanyId,
|
|
211
|
+
DocDate: documentData.DocDate,
|
|
212
|
+
Currency: documentData.Currency,
|
|
213
|
+
Amount: documentData.Amount,
|
|
214
|
+
Description: documentData.Description,
|
|
215
|
+
Status: documentData.Status,
|
|
216
|
+
IssuedById: documentData.IssuedById,
|
|
217
|
+
IssuedToId: documentData.IssuedToId,
|
|
218
|
+
IssuedToType: documentData.IssuedToType,
|
|
219
|
+
RelatedObjectId: documentData.RelatedObjectId,
|
|
220
|
+
RelatedObjectType: documentData.RelatedObjectType,
|
|
221
|
+
CreatedById: documentData.CreatedById,
|
|
222
|
+
CreatedAt: documentData.CreatedAt,
|
|
223
|
+
UpdatedById: documentData.UpdatedById,
|
|
224
|
+
UpdatedAt: documentData.UpdatedAt,
|
|
225
|
+
DocPDFFileMediaId: documentData.DocPDFFileMediaId,
|
|
226
|
+
DocHTMLFileMediaId: documentData.DocHTMLFileMediaId,
|
|
227
|
+
AccSystemRefId: documentData.AccSystemRefId,
|
|
228
|
+
PostedToAccSystemYN: documentData.PostedToAccSystemYN,
|
|
229
|
+
PostedById: documentData.PostedById,
|
|
230
|
+
PostedDateTime: documentData.PostedDateTime,
|
|
231
|
+
UseAccSystemDocYN: documentData.UseAccSystemDocYN,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
return document;
|
|
254
235
|
} else {
|
|
255
236
|
const notFoundError = new ClassError(
|
|
256
237
|
'Document',
|
|
@@ -260,7 +241,6 @@ export default class Document extends AccountSystemEntity {
|
|
|
260
241
|
|
|
261
242
|
throw notFoundError;
|
|
262
243
|
}
|
|
263
|
-
return documentData;
|
|
264
244
|
} catch (error) {
|
|
265
245
|
throw error;
|
|
266
246
|
}
|