narinder1231 commited on
Commit
b077308
·
1 Parent(s): d747060

fix vendor retrieval logic in isVendorHasDefaultBillsplitAccount function

Browse files
src/controllers/propertyware/vendors.controller.ts CHANGED
@@ -27,10 +27,8 @@ export const fetchVendorsData = async (req: Request, res: Response) => {
27
 
28
  export const isVendorHasDefaultBillsplitAccount = async (vendorId: number) => {
29
  try {
30
- const vendor = await PWVendors.findByPk(vendorId, {
31
- attributes: ['default_bill_split'],
32
- });
33
-
34
  if (vendor && vendor.default_bill_split) {
35
  const accNumber = vendor.default_bill_split.toString();
36
  const GLaccount = await PWGlaccounts.findOne({ where: { account_number: accNumber } });
 
27
 
28
  export const isVendorHasDefaultBillsplitAccount = async (vendorId: number) => {
29
  try {
30
+ const vendor = await PWVendors.findOne({ where: { pw_id: vendorId }, attributes: ['default_bill_split'] });
31
+
 
 
32
  if (vendor && vendor.default_bill_split) {
33
  const accNumber = vendor.default_bill_split.toString();
34
  const GLaccount = await PWGlaccounts.findOne({ where: { account_number: accNumber } });