Replies: 1 comment
-
I would strongly advise you to move all of the calculation to one single service class. There is a lot of code duplication going on between those two files, which makes it hard to find the mistake. I'm sure during this process you will find the offending part of the code. (I just compared the two getDuration() methods line by line and they seem to be ok.) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have functionality to handle night shifts and calculate durations, counts, and overtime based on these shifts. This data is correctly displayed on the web page. However, when exporting this data to Excel using the RecordsExport class, the night shift calculations appear to be incorrect.
Display Page Output:
Name: john Doe Shift: Night Shift Check-In: 16 Jul, 16:19 Check-Out: 17 Jul, 05:57 Duration: 13 hr 38 min Count: 13.63 Overtime: 0.00 Exported Data Output:
Name: john Doe Check-In: 16 Jul, 05:40 Check-Out: 16 Jul, 17:07 Duration: 11 hr 26 min Count: 11.43 Overtime: 3.43
this is the code for the display
`<?php
namespace App\Orchid\Layouts;
use App\Models\DailySummary;
use App\Models\Shift;
use App\Models\PersonShift;
use App\Models\ShiftLocation;
use App\Models\Record;
use App\Models\Person;
use Carbon\Carbon;
use Orchid\Screen\Layouts\Table;
use Orchid\Screen\TD;
class RecordListLayout extends Table
{
protected $target = 'records';
}
`
and this a code for exporting
` <?php
namespace App\Exports;
use App\Models\Person;
use App\Models\Record;
use Carbon\Carbon;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class RecordsExport implements FromQuery, WithHeadings, WithMapping, WithColumnFormatting, ShouldAutoSize, WithStyles
{
use Exportable;
}`
Beta Was this translation helpful? Give feedback.
All reactions