hck purchase orders

This commit is contained in:
omair saleh
2022-10-26 17:02:45 +08:00
parent 7edb5bd8b1
commit 90aaa80f0c
+4 -1
View File
@@ -208,17 +208,19 @@ Route::get('/transactions/supplier/{id}/mock_up', 'Transactions\DownloadMockUpWh
Route::get('/notifications/list', 'Notifications\ListNotificationsController@list')->name('notifications.list');
Route::get('/supplier/pi/export', function(){
$groups = \App\Models\Group::where('issuer', 2210)->whereMonth('created_at', 7)->whereYear('created_at', 2022)->get();
$groups = \App\Models\Group::where('issuer', 2956)->whereMonth('created_at', 9)->whereYear('created_at', 2022)->get();
echo '<table>';
$i = 0;
foreach ($groups as $group){
foreach ($group->transactions as $transaction){
$booking = $purchaseOrder = $transaction->owner->owner;
$bill = $booking->transactions()->where('type', TransactionType::PAYMENT)->first()->transactions()->first();
$purchaseOrder = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->where('status', ApprovalStatus::APPROVED)->first();
if(!$purchaseOrder) {
echo '<tr>';
echo '<td>-</td>';
echo '<td>'.$bill->created_at.'</td>';
echo '<td style="color: red">warning, booking ref.'.$booking->marking.' doesn\'t have purchase order</td>';
echo '<td>0</td>';
echo '<td>0</td>';
@@ -231,6 +233,7 @@ Route::get('/supplier/pi/export', function(){
$i++;
echo '<tr>';
echo '<td>'.$i.'</td>';
echo '<td>'.$bill->created_at.'</td>';
echo '<td>'.$item->product_name.'</td>';
echo '<td>'.$item->quantity.'</td>';
echo '<td>'.$item->price * (1/$group->currency_rate).'</td>';