Skip to content

Commit

Permalink
Update overhead value to 0.048 in calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
tvup committed Apr 30, 2024
1 parent 1329a9f commit 9a53df4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ElController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function preliminaryInvoiceWithSmartMe(Request $request) : Response|JsonR
$user->smartme_username,
$user->smartme_password];

return $this->getPreliminaryInvoice(auth()->user()->refresh_token, null, SourceEnum::DATAHUB, $smartMeCredentials, now()->startOfMonth(), now(), 'DK2', 25, 1, auth()->user());
return $this->getPreliminaryInvoice(auth()->user()->refresh_token, null, SourceEnum::DATAHUB, $smartMeCredentials, now()->startOfMonth(), now(), 'DK2', 23.20, 0.048, auth()->user());
} catch (ElOverblikApiException $exception) {
return response($exception->getMessage(), $exception->getCode())
->header('Content-Type', 'text/plain');
Expand All @@ -60,7 +60,7 @@ public function preliminaryInvoiceWithSmartMe(Request $request) : Response|JsonR
* @throws DataUnavailableException
* @throws ElOverblikApiException
*/
private function getPreliminaryInvoice(string $refreshToken, array $ewiiCredentials = null, SourceEnum $dataSource = SourceEnum::POWERUSE, array $smartMeCredentials = null, string $start_date = null, string $end_date = null, string $price_area = 'DK2', float $subscription = 23.20, float $overhead = 0.015, User $user = null) : Response|JsonResponse
private function getPreliminaryInvoice(string $refreshToken, array $ewiiCredentials = null, SourceEnum $dataSource = SourceEnum::POWERUSE, array $smartMeCredentials = null, string $start_date = null, string $end_date = null, string $price_area = 'DK2', float $subscription = 23.20, float $overhead = 0.048, User $user = null) : Response|JsonResponse
{
if (!$start_date) {
$start_date = Carbon::now()->startOfMonth()->toDateString();
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/ElController.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function delete(string $refreshToken) : Response
* @throws DataUnavailableException
* @throws ElOverblikApiException
*/
private function getPreliminaryInvoice(string $refreshToken, array $smartMeCredentials = null, string $start_date = null, string $end_date = null, string $price_area = 'DK2', float $subscription = 23.20, float $overhead = 0.015, User $user = null) : Response|JsonResponse
private function getPreliminaryInvoice(string $refreshToken, array $smartMeCredentials = null, string $start_date = null, string $end_date = null, string $price_area = 'DK2', float $subscription = 23.20, float $overhead = 0.048, User $user = null) : Response|JsonResponse
{
if (!$start_date) {
$start_date = Carbon::now()->startOfMonth()->toDateString();
Expand All @@ -280,7 +280,7 @@ private function getPreliminaryInvoice(string $refreshToken, array $smartMeCrede
* @return JsonResponse
* @throws ElOverblikApiException
*/
private function getUsageCost(array $meterData, string $refreshToken = null, string $price_area = 'DK2', float $overhead = 0.015, User $user = null) : JsonResponse
private function getUsageCost(array $meterData, string $refreshToken = null, string $price_area = 'DK2', float $overhead = 0.048, User $user = null) : JsonResponse
{
$bill = $this->preliminaryInvoiceService->getCostOfCustomUsage($meterData, $refreshToken, $price_area, $overhead, $user);

Expand Down
4 changes: 2 additions & 2 deletions app/Services/GetPreliminaryInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(GetMeteringData $meteringDataService, GetDatahubPric
* @throws DataUnavailableException
* @throws ElOverblikApiException
*/
public function getBill(string $start_date, string $end_date, string $price_area, array $smartMeCredentials = null, SourceEnum $dataSource = SourceEnum::POWERUSE, string $refreshToken = null, float|string $subscription_at_elsupplier = 23.20, float|string $overhead = 0.015, User $user = null): array
public function getBill(string $start_date, string $end_date, string $price_area, array $smartMeCredentials = null, SourceEnum $dataSource = SourceEnum::POWERUSE, string $refreshToken = null, float|string $subscription_at_elsupplier = 23.20, float|string $overhead = 0.048, User $user = null): array
{
$overhead = str_replace(',', '.', strval($overhead));
if (Carbon::parse($end_date)->greaterThan(Carbon::now()->startOfDay())) {
Expand Down Expand Up @@ -284,7 +284,7 @@ public function getBill(string $start_date, string $end_date, string $price_area
return $bill;
}

public function getCostOfCustomUsage(array $meterData, string $refreshToken, string $price_area, float|string $overhead = 0.015, User $user = null): array
public function getCostOfCustomUsage(array $meterData, string $refreshToken, string $price_area, float|string $overhead = 0.048, User $user = null): array
{
if (is_string($overhead)) {
$overhead = str_replace(',', '.', $overhead);
Expand Down
2 changes: 1 addition & 1 deletion resources/views/el-custom.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<div class="form-group">
<label for="exampleInputEmail1">Elleverandørens tillæg til spotprisen eks. moms i kr.</label>
<input type="text" name="overhead" id="overhead" class="form-control" required="" value="{{ old('overhead') ? : 0.015}}">
<input type="text" name="overhead" id="overhead" class="form-control" required="" value="{{ old('overhead') ? : 0.048}}">
</div>


Expand Down
2 changes: 1 addition & 1 deletion resources/views/el.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</div>
<div class="form-group">
<label for="overhead">{{ __('Overhead by balance supplier on spot price ex. VAT in DKK.') }}</label>
<input type="text" name="overhead" id="overhead" class="form-control" required="" value="{{ old('overhead') ? : 0.015}}">
<input type="text" name="overhead" id="overhead" class="form-control" required="" value="{{ old('overhead') ? : 0.048}}">
</div>


Expand Down
12 changes: 6 additions & 6 deletions tests/Services/GetPreliminaryInvoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ public function testGetBill() : void
'Elafgift' => 24.35,
'Nettarif C time' => 10.69,
'Spotpris' => 11.38,
'Overhead' => 0.53,
'Overhead' => 1.61,
'Netabo C forbrug skabelon/flex (forholdsvis antal dage pr. måned, månedspris: 21)' => 0.68,
'Elabonnement (forholdsvis antal dage pr. måned, månedspris: 23.2)' => 0.75,
'Moms' => 13.03,
'Total' => 65.15,
'Moms' => 13.3,
'Total' => 66.5,
'Statistik' => [
'Gennemsnitspris, strøm inkl. moms' => '0.44 kr./kWh',
'Gennemsnitspris, alt tarifering inkl. moms' => '1.88 kr./kWh',
'Gennemsnitspris, i alt (abonnementer indregnet) inkl. moms' => '1.93 kr./kWh',
'Gennemsnitspris, strøm inkl. moms' => '0.48 kr./kWh',
'Gennemsnitspris, alt tarifering inkl. moms' => '1.92 kr./kWh',
'Gennemsnitspris, i alt (abonnementer indregnet) inkl. moms' => '1.97 kr./kWh',
],
];

Expand Down

0 comments on commit 9a53df4

Please sign in to comment.