delete duplicated invoice

This commit is contained in:
edmondlang
2023-03-09 12:46:00 +08:00
parent 2de60c8262
commit eeb7bb77bb
+2 -4
View File
@@ -845,7 +845,6 @@ Route::get('/invoices/show-duplicated', function(Request $request){
Route::get('/invoices/delete-duplicated', function(Request $request){
$duplicatedInvoices = DB::table('transactions')
->where('type', TransactionType::SHIPPING_INVOICE)
// ->where('status', '!=' , ApprovalStatus::COMPLETED)
->where('status', '!=' , ApprovalStatus::EXPIRED)
->where('deleted_at', null)
->select('owner_id', DB::raw('count(*) as count'))
@@ -863,9 +862,8 @@ Route::get('/invoices/delete-duplicated', function(Request $request){
// if have completed invoice (verified payment)
if (count($paidInvoice)) {
// $packingList->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->where('status', '!=', ApprovalStatus::COMPLETED)->delete();
// continue;
dump($order->reference . ' -has payment');
$packingList->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->where('status', '!=', ApprovalStatus::COMPLETED)->delete();
continue;
} else {
dump($order->reference . ' -no');
}