Spaces:
Runtime error
Runtime error
Bansari Akhani commited on
Commit ·
55b9836
1
Parent(s): c9a0f3f
change default bill split account logic
Browse files
src/controllers/propertyware/vendors.controller.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Request, Response } from 'express';
|
|
| 3 |
import { logger } from '../../utils/logger';
|
| 4 |
import { syncVendorsFromJsonService } from '../../shared/services/vendors.service';
|
| 5 |
import PWVendors from '../../models/pwVendors';
|
|
|
|
| 6 |
|
| 7 |
export const fetchVendorsData = async (req: Request, res: Response) => {
|
| 8 |
try {
|
|
@@ -30,7 +31,10 @@ export const isVendorHasDefaultBillsplitAccount = async (vendorId: number) => {
|
|
| 30 |
});
|
| 31 |
|
| 32 |
if (vendor && vendor.default_bill_split) {
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
return null;
|
|
|
|
| 3 |
import { logger } from '../../utils/logger';
|
| 4 |
import { syncVendorsFromJsonService } from '../../shared/services/vendors.service';
|
| 5 |
import PWVendors from '../../models/pwVendors';
|
| 6 |
+
import PWGlaccounts from '../../models/pwGlaccounts';
|
| 7 |
|
| 8 |
export const fetchVendorsData = async (req: Request, res: Response) => {
|
| 9 |
try {
|
|
|
|
| 31 |
});
|
| 32 |
|
| 33 |
if (vendor && vendor.default_bill_split) {
|
| 34 |
+
const accNumber = vendor.default_bill_split.toString();
|
| 35 |
+
const GLaccount = await PWGlaccounts.findOne({ where: { account_number: accNumber } });
|
| 36 |
+
if (GLaccount)
|
| 37 |
+
return GLaccount.pw_id;
|
| 38 |
}
|
| 39 |
|
| 40 |
return null;
|