line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CFDI::Macros::Excel; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
210
|
use CFDI::Parser::Path; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
6
|
1
|
|
|
1
|
|
222
|
use CFDI::Parser::XML; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
7
|
1
|
|
|
1
|
|
232
|
use CFDI::Location::XPath; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
8
|
1
|
|
|
1
|
|
294
|
use CFDI::Report::Default; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
74
|
|
9
|
1
|
|
|
1
|
|
215
|
use CFDI::Output::CSV; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
493
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
|
|
|
|
|
|
our @EXPORT = qw(xcel xcel2 xcel3 xcel4 xcel5 excel excel2 excel3 excel4 excel5); |
13
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = 0.21; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub reporte(_){ |
18
|
0
|
0
|
|
0
|
0
|
|
return unless my @xml = findxml $_[0]; |
19
|
0
|
|
|
|
|
|
push @xpathheader,'xml'; |
20
|
0
|
|
|
|
|
|
my $reporte = [\@xpathheader]; |
21
|
0
|
|
|
|
|
|
foreach my $xml (@xml){ |
22
|
0
|
|
|
|
|
|
my $content = eval{parse $xml}; |
|
0
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
warn("$xml: $@"),next if $@; |
24
|
0
|
|
|
|
|
|
my $xpath = CFDI::Location::XPath->new($content); |
25
|
0
|
|
|
|
|
|
my @reg = map{xpath$xpath}@xpathdata; |
|
0
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
next unless @reg; |
27
|
0
|
|
|
|
|
|
push @reg,$xml; |
28
|
0
|
|
|
|
|
|
$$reporte[$#$reporte+1] = \@reg; |
29
|
|
|
|
|
|
|
} |
30
|
0
|
|
|
|
|
|
$reporte; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub excel{ |
34
|
0
|
|
|
0
|
0
|
|
$|=1; |
35
|
0
|
|
0
|
|
|
|
my $path = shift @_ || shift @ARGV || '.'; |
36
|
0
|
|
|
|
|
|
my $c = (caller 1)[3]; |
37
|
0
|
0
|
|
|
|
|
my $name = $c ? $c : 'excel'; |
38
|
0
|
|
|
|
|
|
$name =~ s/.*:://; |
39
|
0
|
|
|
|
|
|
print "Generando reporte $name...$/"; |
40
|
0
|
|
|
|
|
|
my $reporte = reporte $path; |
41
|
0
|
|
|
|
|
|
my $xml = $#$reporte; |
42
|
0
|
|
|
|
|
|
print "Reporte completado: procesados $xml xml$/"; |
43
|
0
|
|
|
|
|
|
my $csv = output $reporte; |
44
|
0
|
|
|
|
|
|
my@t=localtime;$t[4]++;$t[5]+=1900; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
my $t = join'',map{2>length$_?"0$_":$_}reverse@t[0..5]; |
|
0
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $file = "$name-$t.csv"; |
47
|
0
|
0
|
|
|
|
|
open EXCEL,'>',$file or die $!; |
48
|
0
|
0
|
|
|
|
|
print EXCEL $csv if defined $csv; |
49
|
0
|
0
|
|
|
|
|
close EXCEL or warn $!; |
50
|
0
|
|
|
|
|
|
print "Reporte guardado como: $file$/"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
*xcel = *excel; |
54
|
|
|
|
|
|
|
*xcel2 = *excel2; |
55
|
|
|
|
|
|
|
*xcel3 = *excel3; |
56
|
|
|
|
|
|
|
*xcel4 = *excel4; |
57
|
|
|
|
|
|
|
*xcel5 = *excel5; |
58
|
0
|
|
|
0
|
0
|
|
sub excel2{require CFDI::Report::Excel2;CFDI::Report::Excel2->import;&excel} |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
0
|
0
|
|
sub excel3{require CFDI::Report::Excel3;CFDI::Report::Excel3->import;&excel} |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
0
|
|
sub excel4{require CFDI::Report::Excel4;CFDI::Report::Excel4->import;&excel} |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
0
|
|
sub excel5{require CFDI::Report::Excel5;CFDI::Report::Excel5->import;&excel} |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |