mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
final-duplicated-invoice-debug
This commit is contained in:
@@ -955,3 +955,45 @@ Route::get('/packing-lists/delete-duplicated', function(Request $request){
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Route::get('/final-duplicated-invoice-debug', function(){
|
||||
$duplicatedTransactions = DB::table('transactions')
|
||||
->select(DB::raw('owner_type, owner_id, receiver, type, GROUP_CONCAT(id) as transaction_ids, COUNT(*) as count'))
|
||||
->groupBy('owner_type', 'owner_id', 'receiver', 'type')
|
||||
->having('count', '>', 1)
|
||||
->get();
|
||||
|
||||
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
|
||||
|
||||
echo '<table style="width: 100%; text-align: center; border: 1px solid black">
|
||||
<tr>
|
||||
<th style="border: 1px solid black" >Owner Type</th>
|
||||
<th style="border: 1px solid black" >Owner Id</th>
|
||||
<th style="border: 1px solid black" >Reveiver</th>
|
||||
<th style="border: 1px solid black" >Transaction type</th>
|
||||
<th style="border: 1px solid black" >Count</th>
|
||||
<th style="border: 1px solid black" >Invoice Ids</th>
|
||||
</tr>';
|
||||
|
||||
foreach ($duplicatedTransactions as $transaction) {
|
||||
$transactionIds = explode(',', $transaction->transaction_ids);
|
||||
|
||||
$duplicatedInvoice = DB::table('transactions')->whereIn('id', $transactionIds)->get();
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td style="border: 1px solid black">' . $transaction->owner_type . '</td>';
|
||||
echo '<td style="border: 1px solid black">' . $transaction->owner_id . '</td>';
|
||||
echo '<td style="border: 1px solid black">' . $transaction->receiver . '</td>';
|
||||
echo '<td style="border: 1px solid black">' . $transaction->type . '</td>';
|
||||
echo '<td style="border: 1px solid black">' . count($transactionIds) . '</td>';
|
||||
echo '<td style="border: 1px solid black">';
|
||||
foreach ($duplicatedInvoice as $invoice) {
|
||||
echo '<p>ID: ' . $invoice->id . '. Status: ' . $approvalStatusArray[$invoice->status] . '. Amount: ' . $invoice->amount . '. Is_Deleted: ' . ($invoice->deleted_at ? 'true' : 'false') . '</p>';
|
||||
}
|
||||
echo'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user