mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
fill up po calculation
This commit is contained in:
+18
-9
@@ -563,7 +563,9 @@ Route::get('/po/outsource/check', function(){
|
||||
$bookings = Booking::whereIn('marking', [34735, 43980, 35339, 28104, 40185, 46648, 34192, 21512, 84607, 31319, 23566, 48372, 59239, 72665, 81127, 46881, 41055, 67368, 41817, 60443, 28958, 46782, 98512, 43356, 78469, 88173, 52592, 77036, 76750, 77732, 31980, 57146, 38544, 78567, 98297, 90128, 43680, 86478, 80340, 41961, 26857, 33992, 79929, 53226, 88107, 31187, 68015, 43762, 34928, 55525, 44528, 57146, 31980, 27399, 63141, 74987, 85935, 37032, 95911, 59511, 47395, 97293, 43906, 74944, 53418, 61988, 81406, 83889, 83359, 66896, 21425, 61124, 23536, 56129, 21116, 64213, 72950, 20502, 20067, 64213, 59854, 44783, 35681, 74828, 28179, 32961, 46412, 99908, 49008, 77655, 45250, 65047, 37167, 90598, 26275, 58013, 38994, 63187, 33219, 52669, 79885, 74828, 91775, 29282, 46781, 96415, 36318, 84491, 32659, 23846, 38994, 65329, 25936, 68209, 72866, 63231, 32216, 82977, 24819, 32600, 38019, 80872, 65505, 37236, 82262, 30815, 59033, 46776, 87317, 89548, 36548, 54468, 35340, 98242, 29234, 47129, 67047, 64210, 36698, 39353, 86435, 65240, 37116, 71007, 40148, 88187, 76368, 91155, 57040, 95456, 29961, 66447, 43023, 29396, 30637, 60789, 84221, 35805, 44552, 35524, 43457, 22810, 83545, 92252, 83603, 59797, 40526, 32520, 71011, 95151, 90464, 78629, 61225, 74864, 73518, 53793, 26478, 57640, 43674, 23476, 76683, 23920, 22810, 44603, 56291, 23580, 94241, 51565, 83769, 63123, 58369, 99399, 41098, 60942, 69442, 80963, 48392, 73169, 59764, 66099, 21107, 33029, 38288, 32223, 55931, 43685, 24267, 83865, 52066, 61501, 83210, 20731, 55951, 82502, 66618, 62216, 22020, 42402, 99644, 35305, 49263, 37387, 73928, 92279, 26445, 83497, 96740, 38374, 29273, 94073, 99785, 21502, 51269, 31609, 97369, 73078, 28982, 64902, 41380, 87008, 59377, 39441, 81341, 62750, 29410, 85975, 37215, 43386, 80627, 79967, 81729, 81738, 58658, 40579, 56179, 37548, 72436, 77165, 32069, 97447, 84575, 49167, 45507, 96371, 90835, 27942, 87691, 30431, 47815, 82960, 43228, 87534, 93737, 98938, 69548, 82923, 48463, 24385, 96569, 53812, 32926, 54418, 34399, 53189, 49377, 27036, 68832, 72799, 76120, 78203, 87009, 86992, 97722, 96262, 95551, 77632, 54408, 33931, 62397, 58343, 52347, 59419, 50339, 54941, 31199, 92385, 90028, 90379, 43070, 25357, 24591, 60276, 91851, 96371, 81886, 24377, 21236, 66737, 93637, 85844, 23130, 75659, 27318, 43587, 46555, 28903, 44930, 52377, 20387, 40705, 79255, 29196, 30968, 76319, 54600, 29881, 37920, 43319, 35893, 65863, 33102, 71589, 45905, 49031, 97435, 70157, 78795, 47570, 71881, 92076, 45847, 35957, 58785, 84896, 65918, 25550, 49031, 50624, 83286, 63111, 21402, 56300, 77238, 21271, 21984, 30500, 76170, 95325, 22888, 84895, 26100, 84952, 49302, 41944, 43703, 84028, 53672, 49162, 28342, 47182, 70484, 59467, 85415, 20202, 97967, 58011, 85807, 79868, 81192, 86985, 43867, 47473, 28063, 68849, 61628, 96641, 37285, 58384, 86505, 51720, 63951, 91958, 28082, 46229, 57439, 55178, 96813, 34444, 28100, 75967, 33204, 75922, 68707, 71960, 34769, 29161, 49088, 79773, 91131, 53033, 77611, 81034, 72625, 36273, 78240, 34647, 21838, 73195, 83282, 60911, 29019, 98859, 44064, 82113, 51118, 54681, 59751, 64347, 21623, 47023, 62168, 23466, 62137, 85432, 85043, 41984, 30417, 40616, 97170, 69106, 81484, 68902, 78149, 62438, 67710, 57370, 99207, 64271, 33959, 60821, 51292, 44130, 28469, 77069, 91088, 47702, 89046, 84958, 41601, 99752, 72976, 26393, 85548, 32920, 86353, 97430, 71507, 36667, 57059, 71148, 44588, 35807, 80213, 89884, 76616, 35999, 79860, 37284, 72249, 32885, 70622, 47036, 97366, 60483, 89171, 37048, 34227, 76290, 46761, 31389, 73977, 54421, 87527, 75925, 68236, 31131, 43871, 54753, 90896, 41653, 82304, 87123, 80391, 42368, 35553, 60587, 30941, 31843, 25076])
|
||||
->get();
|
||||
|
||||
$averageItems = 5;
|
||||
$totalItems = 0;
|
||||
$pay = 0;
|
||||
|
||||
foreach ($bookings as $booking){
|
||||
$po = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION])->first();
|
||||
@@ -573,19 +575,26 @@ Route::get('/po/outsource/check', function(){
|
||||
continue;
|
||||
}
|
||||
|
||||
$items = $po->transactionDetails()->get();
|
||||
// $items = $po->transactionDetails()->get();
|
||||
//
|
||||
// foreach ($items as $item){
|
||||
// $activity = Activity::where('causer_id', 4332)->where('subject_id', $item->id)->where('subject_type', \App\Models\TransactionDetail::class)->get();
|
||||
// if($activity) {
|
||||
// $totalItems++;
|
||||
// }
|
||||
// }
|
||||
// // check activities by user
|
||||
$itemsCount = $po->transactionDetails()->count();
|
||||
$totalItems += $itemsCount;
|
||||
|
||||
$sum = $itemsCount / $averageItems;
|
||||
|
||||
$pay += $sum < 1 ? 1 : round($sum);
|
||||
|
||||
foreach ($items as $item){
|
||||
$activity = Activity::where('causer_id', 4332)->where('subject_id', $item->id)->where('subject_type', \App\Models\TransactionDetail::class)->get();
|
||||
dump($activity);
|
||||
if($activity) {
|
||||
$totalItems++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<h3>Total Items: '.$totalItems.'</h3>';
|
||||
echo '<h3>Total Pay: '.$totalItems * 0.2 .'</h3>';
|
||||
echo '<h3>Total Pay: '.$pay.'</h3>';
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user