| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use oEdtk::Main; | ||
| 7 | use oEdtk::Config qw(config_read); | ||
| 8 | use oEdtk::DBAdmin qw(db_connect); | ||
| 9 | use oEdtk::Outmngr qw(omgr_check_seqlot_ref); | ||
| 10 | |||
| 11 | if ( @ARGV < 1 or $ARGV[0] =~ /-h/i ) { | ||
| 12 | warn "Usage: $0 <seqlot_ref|idldoc_ref [idseqpg_ref]>\n\n"; | ||
| 13 | warn "\tThis looks statitics for checked docs in output manager (index db)\n"; | ||
| 14 | exit 1; | ||
| 15 | } | ||
| 16 | |||
| 17 | my $cfg = config_read('EDTK_STATS'); | ||
| 18 | my $dbh = db_connect( $cfg, 'EDTK_DBI_STATS', { AutoCommit => 1, RaiseError => 1 } ); | ||
| 19 | |||
| 20 | my $rows = omgr_check_seqlot_ref( $dbh, $ARGV[0], $ARGV[1] ); | ||
| 21 | |||
| 22 | if ( !scalar @{$rows} ) { | ||
| 23 | warn "INFO: no associated data.\n"; | ||
| 24 | exit; | ||
| 25 | } | ||
| 26 | |||
| 27 | my $fmt = shift(@$rows); | ||
| 28 | my $head = shift(@$rows); | ||
| 29 | printf $$fmt . "\n", @$head; | ||
| 30 | |||
| 31 | foreach my $row (@$rows) { | ||
| 32 | printf $$fmt . "\n", @$row; | ||
| 33 | } | ||
| 34 |