Bansari Akhani commited on
Commit
dcf70fd
·
1 Parent(s): 7e9ad41

added option to search all invoces with status filter, fetch pm only for first location and added relavant comment for the same

Browse files
src/controllers/invoice/invoice.controller.ts CHANGED
@@ -242,7 +242,7 @@ const buildInvoiceWhereClause = (filter: Record<string, any>): any => {
242
  whereClause.payment_status = { [Op.eq]: filter.payment_status };
243
  }
244
 
245
- if (filter.status) {
246
  whereClause.status = { [Op.eq]: filter.status };
247
  }
248
 
@@ -340,6 +340,9 @@ export const getAllInvoices = async (req: AuthenticatedRequest, res: Response):
340
  return invoice;
341
  }
342
  }
 
 
 
343
  }
344
  return null;
345
  })
 
242
  whereClause.payment_status = { [Op.eq]: filter.payment_status };
243
  }
244
 
245
+ if (filter.status && filter.status != '*') {
246
  whereClause.status = { [Op.eq]: filter.status };
247
  }
248
 
 
340
  return invoice;
341
  }
342
  }
343
+ // TODO: Check with client if there is any possibility of having different Building in same invoice. and if so, will they have same PM assigned ?
344
+ // For now assuming it will be same, checking associated PM for first bill split item location only.
345
+ break;
346
  }
347
  return null;
348
  })