Leser: 4
6 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
use Win32::OLE; ... my $application = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application'); # get already active Excel $application->{'Visible'} = 0; my $workbook = $application->Workbooks->Add(); my $worksheet = $workbook->Worksheets(1); my $now_time = time; my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($now_time); my $start_time = $now_time - (($mday > $bscope ? ($mday -1) : $bscope) * 86400); $worksheet->Cells(1, 1)->{'Value'} = 'Wochentag'; $worksheet->Cells(1, 1)->Font->{'FontStyle'} = "Fett"; $worksheet->Cells(1, 2)->{'Value'} = 'Datum'; $worksheet->Cells(1, 2)->Font->{'FontStyle'} = "Fett"; $worksheet->Cells(1, 3)->{'Value'} = 'Arbeitszeit (h)'; $worksheet->Cells(1, 3)->Font->{'FontStyle'} = "Fett"; my $wosum = 0; for (my $t = $start_time, my $i = 2; $t < $now_time; $t += 86400) { my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($t); my $iDay = sprintf ("%04d-%02d-%02d", $year + 1900, $mon + 1, $mday); (my $tt = $arbzeit{$iDay}) =~ s/,/\./; if ($mday == 1) { $worksheet->Cells($i, 2)->{'Value'} = 'Summe'; $worksheet->Cells($i, 2)->Font->{'FontStyle'} = "Fett"; $worksheet->Cells($i, 3)->{'Value'} = $wosum; $worksheet->Cells($i, 3)->Font->{'FontStyle'} = "Fett"; $wosum = 0; $i+= 2; $worksheet->Cells($i, 1)->{'Value'} = 'Monat ' . ($mon + 1); $worksheet->Cells($i, 1)->Font->{'FontStyle'} = "Fett"; $i++; } $worksheet->Cells($i, 1)->{'Value'} = qw/So Mo Di Mi Do Fr Sa/[$wday]; $worksheet->Cells($i, 2)->{'Value'} = $iDay; $worksheet->Cells($i, 3)->{'Value'} = exists $arbzeit{$iDay} ? $arbzeit{$iDay} : "-"; if ($tt > 10) { $worksheet->Cells($i, 3)->Font->{'ColorIndex'} = 3; } if ($tt == 7.6) { $worksheet->Cells($i, 4)->{'Value'} = 'Urlaub?'; } if ($wday == 0 || $wday == 6) { $worksheet->Cells($i, 1)->Font->{'ColorIndex'} = 5; $worksheet->Cells($i, 1)->Font->{'FontStyle'} = "Kursiv"; $worksheet->Cells($i, 2)->Font->{'ColorIndex'} = 5; $worksheet->Cells($i, 2)->Font->{'FontStyle'} = "Kursiv"; $worksheet->Cells($i, 3)->Font->{'ColorIndex'} = 3; $worksheet->Cells($i, 3)->Font->{'FontStyle'} = "Kursiv"; } $wosum += $tt; if ($wday == 0) { $i++; $worksheet->Cells($i, 2)->{'Value'} = 'Summe'; $worksheet->Cells($i, 2)->Font->{'FontStyle'} = "Fett"; $worksheet->Cells($i, 3)->{'Value'} = $wosum; $worksheet->Cells($i, 3)->Font->{'FontStyle'} = "Fett"; $wosum = 0; } $i++; } $application->{'Visible'} = 1; $workbook->{'Saved'} = 1;
6 Einträge, 1 Seite |