本文整理汇总了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;
}
示例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]);
}