當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Vehicle::getEmployeesCut方法代碼示例

本文整理匯總了PHP中Vehicle::getEmployeesCut方法的典型用法代碼示例。如果您正苦於以下問題:PHP Vehicle::getEmployeesCut方法的具體用法?PHP Vehicle::getEmployeesCut怎麽用?PHP Vehicle::getEmployeesCut使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Vehicle的用法示例。


在下文中一共展示了Vehicle::getEmployeesCut方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getProcessedVehiclesSum

 public static function getProcessedVehiclesSum($start, $end)
 {
     $processedList = DB::select(DB::raw("SELECT e_v.vehicle_fk, COUNT(*) as quantity\n                                    FROM employees_vehicles AS e_v, invoices AS inv\n                                    WHERE inv.date >= '{$start}'\n                                    AND inv.date <= '{$end}'\n                                    AND inv.id = e_v.invoice_fk\n                                    AND inv.deleted_at IS NULL\n                                    AND e_v.deleted_at IS NULL\n                                    GROUP BY e_v.vehicle_fk"));
     $totalSum = 0;
     foreach ($processedList as $process) {
         $price = Vehicle::getEmployeesCut($process->vehicle_fk);
         $total = $price * $process->quantity;
         $totalSum += $total;
     }
     return $totalSum;
 }
開發者ID:dbakiu,項目名稱:dvc,代碼行數:11,代碼來源:InvoiceElement.php

示例2: displayEmployeeWages

 public function displayEmployeeWages()
 {
     // If the start date is defined, get the salaries for that certain period, otherwise, get the total amount.
     if (null !== Input::get('startDate')) {
         $start = date("Y-m-d", strtotime(Input::get('startDate')));
         $end = date("Y-m-d", strtotime(Input::get('endDate')));
     } else {
         $start = "1970-01-01";
         $end = "3000-01-01";
     }
     $wageList = [];
     $processedVehiclesList = Employee::getTotalSalaries($start, $end);
     $employeesList = Employee::getEmployeesList();
     $totalEmployeeWagesSum = 0;
     foreach ($processedVehiclesList as $processed) {
         // Initiliaze if not set.
         if (!isset($wageList[$processed->employee_fk])) {
             $wageList[$processed->employee_fk] = 0;
         }
         $price = Vehicle::getEmployeesCut($processed->vehicle_fk);
         $total = $price * $processed->quantity;
         $wageList[$processed->employee_fk] += $total;
         $totalEmployeeWagesSum += $total;
     }
     //
     $employeeWages = [];
     foreach ($wageList as $employeeId => $wage) {
         foreach ($employeesList as $id => $name) {
             if ($id == $employeeId) {
                 $employeeWages[$name] = $wage;
             }
             if (!array_key_exists($id, $wageList)) {
                 $employeeWages[$name] = 0;
             }
         }
     }
     arsort($employeeWages);
     $startDate = date("d/m/Y", strtotime($start));
     $endDate = date("d/m/Y", strtotime($end));
     return View::make('employee.table')->with(['employeeWages' => $employeeWages, 'totalEmployeeWages' => $totalEmployeeWagesSum, 'startDate' => $startDate, 'endDate' => $endDate]);
 }
開發者ID:dbakiu,項目名稱:dvc,代碼行數:41,代碼來源:EmployeeController.php


注:本文中的Vehicle::getEmployeesCut方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。