update debtors import

This commit is contained in:
omair saleh
2022-03-20 14:27:48 +08:00
parent 86f800fca2
commit f9d246b9f6
@@ -60,7 +60,9 @@ class ExportsNullDebtors implements FromQuery, WithHeadings, WithHeadingRow, Wit
*/
public function query()
{
return Company::where('debtor', '=', null)->where('business_type', BusinessType::IMPORTER)->where('status', ApprovalStatus::APPROVED)->whereHas('transactions', function($query){
return Company::where(function($query){
$query->whereNull('debtor')->orWhere('debtor', '');
})->where('business_type', BusinessType::IMPORTER)->where('status', ApprovalStatus::APPROVED)->whereHas('transactions', function($query){
return $query->whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP])->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED, ApprovalStatus::PENDING_VERIFICATION]);
});
}