Skip to content

Commit b54ae91

Browse files
committed
Format code via pint
1 parent 9545efb commit b54ae91

5 files changed

Lines changed: 23 additions & 23 deletions

File tree

app/Http/Controllers/AssetController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function calcDepreciationValues($expense, $year)
3232
$expense->firstYear = $costPerMonth * (12 - (Carbon::parse($expense->payment_date)->month - 1));
3333
$expense->middleYear = $expense->net / $expense->depreciation;
3434
$expense->lastYear = $costPerMonth * ((Carbon::parse($expense->payment_date)->month - 1));
35-
if($expense->yearsInUse == 0) {
35+
if ($expense->yearsInUse == 0) {
3636
$expense->residualValue = $expense->net;
3737
} elseif ($expense->yearsInUse > $expense->depreciation) {
3838
$expense->residualValue = 0;

app/Http/Controllers/StatementController.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,63 +19,63 @@ public function index(Request $request)
1919

2020
$costTypes = CostType::all();
2121

22-
//calculate all needed number for revenues
22+
// calculate all needed number for revenues
2323
$revenues = Revenue::whereYear('payment_date', $year)->get();
2424
$revTaxSum = $revenues->sum('tax');
2525
$revNetSum = $revenues->sum('net');
2626

27-
//calculate vat payments
27+
// calculate vat payments
2828
$vatNotices = VatNotice::whereYear('notice_date', $year)->get();
29-
//This is the sum of all received payments from the financial office during the year (months where expenses are higher than revenues)
29+
// This is the sum of all received payments from the financial office during the year (months where expenses are higher than revenues)
3030
$receivedVatPayments = 0;
31-
//This is the sum of all payments to the financial office during the year (months where revenues are higher than expenses)
31+
// This is the sum of all payments to the financial office during the year (months where revenues are higher than expenses)
3232
$alreadyPaidVat = 0;
3333
foreach ($vatNotices as $notice) {
34-
//for each vat notice, we calculate the difference between received vat (from revenues) and paid vat (from expenses)
34+
// for each vat notice, we calculate the difference between received vat (from revenues) and paid vat (from expenses)
3535
$noticeBalance = $notice->vat_received - $notice->vat_paid;
36-
//if the difference is positive, it means we already had to pay the vat to the financial office, so we add it to the alreadyPaidVat
36+
// if the difference is positive, it means we already had to pay the vat to the financial office, so we add it to the alreadyPaidVat
3737
if ($noticeBalance > 0) {
3838
$alreadyPaidVat += $noticeBalance;
39-
//if the difference is negative, it means we received money from the financial office, so we add it to the receivedVatPayments
39+
// if the difference is negative, it means we received money from the financial office, so we add it to the receivedVatPayments
4040
} else {
4141
$receivedVatPayments += -1 * $noticeBalance;
4242
}
4343
}
4444
$revTotal = $revNetSum + $revTaxSum + $receivedVatPayments;
4545

46-
//--------------------------------------------------------------------------------------------------------------
46+
// --------------------------------------------------------------------------------------------------------------
4747

48-
//get all travel allowances for the year
48+
// get all travel allowances for the year
4949
$travelAllowance = TravelAllowance::whereYear('travel_date', $year)->get();
5050

51-
//get all expenses for the year
51+
// get all expenses for the year
5252
$costsByCostType = Expense::join('cost_types', 'expenses.cost_type_id', '=', 'cost_types.id')
5353
->groupBy('cost_types.id')
5454
->select('cost_types.id', 'cost_types.elster_id', 'cost_types.full_name', 'cost_types.description', DB::raw('SUM(expenses.net) * cost_types.ratio as total_net'), DB::raw('SUM(expenses.tax) * cost_types.ratio as total_tax'))
5555
->whereYear('payment_date', $year)
5656
->groupBy('cost_type_id')
5757
->get();
5858

59-
//tax is calculated from ALL expenses of the year including afa
59+
// tax is calculated from ALL expenses of the year including afa
6060
$expTaxSum = $costsByCostType->sum('total_tax');
6161

62-
//remove afa from costs
62+
// remove afa from costs
6363
$costsByCostType = $costsByCostType->reject(function ($value) {
6464
return $value->id == 6;
6565
});
6666

67-
//get all depreciations for the year
67+
// get all depreciations for the year
6868
$expensesWithTypeAfa = Expense::whereHas('costType', function ($query) {
6969
$query->where('id', 6);
7070
})->get();
7171

72-
//calculate afa for the year
72+
// calculate afa for the year
7373
$afaSum = AssetController::calcAfaForYear($expensesWithTypeAfa, $year);
7474

75-
//calculate travel allowance for the year
75+
// calculate travel allowance for the year
7676
$expTravel = $travelAllowance->sum('refund');
7777

78-
//add afa, tax and travel allowance to costs
78+
// add afa, tax and travel allowance to costs
7979
$expAfaObject = new Expense;
8080
$expAfaObject->total_net = $afaSum;
8181
$expAfaObject->full_name = $costTypes->where('id', 6)->first()->full_name;
@@ -110,10 +110,10 @@ public function index(Request $request)
110110
$payedVat['total_net'] += $alreadyPaidVat;
111111
}
112112

113-
//sort costs by elster_id to use them in the statement view in the correct order
113+
// sort costs by elster_id to use them in the statement view in the correct order
114114
$costsByCostType = $costsByCostType->sortBy('elster_id');
115115

116-
//sum of all expenses, including afa of current year
116+
// sum of all expenses, including afa of current year
117117
$expTotal = $costsByCostType->sum('total_net');
118118

119119
return view('statement', [

app/Http/Controllers/TravelAllowanceController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function destroy($id)
111111
private function validator(Request $request)
112112
{
113113
$messages = [
114-
//please use all fields from the validator to create custom messages in German
114+
// please use all fields from the validator to create custom messages in German
115115
'travel_date' => 'Bitte geben Sie ein gültiges Reisedatum ein.',
116116
'start' => 'Bitte geben Sie eine gültige Startzeit ein.',
117117
'end' => 'Bitte geben Sie eine gültige Endzeit ein.',

database/seeders/ExpenseSeeder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ExpenseSeeder extends Seeder
1313
*/
1414
public function run(): void
1515
{
16-
//create an expense for each cost type with random values and a unique invoice number
16+
// create an expense for each cost type with random values and a unique invoice number
1717
foreach (CostType::all() as $cost_type) {
1818
Expense::factory()->specificTypeYearsBack($cost_type->id, 0)->create();
1919
Expense::factory()->specificTypeYearsBack($cost_type->id, 1)->create();

tests/Feature/VatNoticeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function test_vat_notice_page_calcs_remaining_tax(): void
5858
$exp1 = Expense::factory()->create();
5959
$exp2 = Expense::factory()->create();
6060

61-
$totalReceivedTax = $rev1->tax + $rev2->tax; //Steuereinnahmen Gesamt
62-
$totalPaidTax = $exp1->tax + $exp2->tax; //Gezahlte Steuern Gesamt
61+
$totalReceivedTax = $rev1->tax + $rev2->tax; // Steuereinnahmen Gesamt
62+
$totalPaidTax = $exp1->tax + $exp2->tax; // Gezahlte Steuern Gesamt
6363

6464
$vatNotice1 = VatNotice::factory()->create();
6565
$vatNotice2 = VatNotice::factory()->create();

0 commit comments

Comments
 (0)