Date - Order By Reverted : ps

This commit is contained in:
VE10-Sanjeev 2024-03-26 10:21:29 +05:30
parent c3dbcce675
commit 0e510d1aa3

View File

@ -131,11 +131,12 @@ public function getJoinedData($where, $orderby = [])
->join('users as U2', 'U2.user_id = I.updated_by', 'left')
->select('I.invoice_id,I.wp_api_order_id,I.invoice_number, I.customer_id,concat(C.first_name," ",C.last_name) as customer_name , I.invoice_date, I.due_date, I.subtotal, I.tax, I.discount, I.total_amount,I.status, I.payment_status, I.order_number, I.payment_method,I.invoice_type, I.event_id,E.event_name, I.business_id,B.title as business_name,DATE_FORMAT(I.created_on, "%d/%m/%Y") as created_on_format,I.created_on, I.created_by,concat(U1.first_name," ",U1.last_name) as created_by_name,DATE_FORMAT(I.updated_on, "%d/%m/%Y") as updated_on_format, I.updated_by,concat(U2.first_name," ",U2.last_name) as updated_by_name, I.isactive,C.email as customer_email,C.mobile_no as customer_mobile,I.shipping_address_id,I.shipping_address,I.billing_address_id,I.billing_address,B.address as business_address,B.city as business_city,B.state as business_state,B.postal_code as business_postal_code,B.email as business_email,B.mobile_no as business_mobile_no,S.from_subscription,S.to_subscription,DATEDIFF(S.to_subscription, S.from_subscription) as subscription_in_days,S.scheme_id')
->where($where);
if (!empty($orderby)) {
$query->orderBy($orderby[0], $orderby[1]);
} else {
$query->orderBy('invoice_id', 'DESC');
}
// if (!empty($orderby)) {
// $query->orderBy($orderby[0], $orderby[1]);
// } else {
// $query->orderBy('invoice_id', 'DESC');
// }
$query->orderBy('I.invoice_date', 'DESC');
$query->groupBy('I.invoice_id');
$resultArray = $query->get()->getResultArray();