Merge branch 'do_packing_list_auto_fill' into 'development'

created at

See merge request CIEFWorldwideSdnBhd/exchange-2.0!74
This commit is contained in:
Leong Chee Siong
2022-01-10 06:43:21 +00:00
3 changed files with 8 additions and 9 deletions
@@ -14,7 +14,7 @@ use App\Models\Transaction;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class AutoPackingListFillLogic extends AbstractControllerLogic
class AutoPurchaseOrderFillLogic extends AbstractControllerLogic
{
/**
@@ -46,13 +46,12 @@ class AutoPackingListFillLogic extends AbstractControllerLogic
*/
public function logic(Request $request) : JsonResponse
{
$booking = Booking::where('created_at', '>', '01-07-2021')
$booking = Booking::whereMonth('created_at', 7)
->whereYear('created_at', 2021)
->whereDoesntHave('transactions', function($q){
$q->where('type', TransactionType::PURCHASE_ORDER);
$q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]);
})
->get();
foreach ($booking as $key => $row) {
$amount = $row->fix_amount;
@@ -2,18 +2,18 @@
namespace App\Http\Controllers\Bookings;
use App\Classes\Modules\Bookings\ControllersLogic\AutoPackingListFillLogic;
use App\Classes\Modules\Bookings\ControllersLogic\AutoPurchaseOrderFillLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class AutoPackingListFillController
class AutoPurchaseOrderFillController
{
/**
* @param Request $request
* @param AutoPackingListFillLogic $logic
* @param AutoPurchaseOrderFillLogic $logic
* @return JsonResponse
*/
public function auto(Request $request, AutoPackingListFillLogic $logic): JsonResponse {
public function auto(Request $request, AutoPurchaseOrderFillLogic $logic): JsonResponse {
return $logic->execute($request);
}
+1 -1
View File
@@ -33,6 +33,6 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking
Route::post('{id}/proforma/create', 'CreateProformaInvoiceTransaction@create')->name('proforma.create');
Route::post('/auto-packing-list-fill', 'AutoPackingListFillController@auto')->name('assign');
Route::post('/auto-purchase-order-fill', 'AutoPurchaseOrderFillController@auto')->name('assign');
});