| 1 | package XBRL::JPFR::Context; | ||
| 2 | |||
| 3 | our $VERSION = '0.01'; | ||
| 4 | |||
| 5 | #use strict; | ||
| 6 | use warnings; | ||
| 7 | use Carp; | ||
| 8 | use Hash::Merge qw(merge); | ||
| 9 | use Clone qw(clone); | ||
| 10 | use Data::Dumper; | ||
| 11 | |||
| 12 | my @org_fields = qw(id scheme identifier startDate endDate label dimension duration); | ||
| 13 | my @fields = qw(lang rolelink); | ||
| 14 | XBRL::JPFR::Context->mk_accessors(@fields); | ||
| 15 | use base qw(XBRL::Context); | ||
| 16 | |||
| 17 | my %default = ( | ||
| 18 | 'lang' => 'ja', | ||
| 19 | 'rolelink' => 'http://www.xbrl.org/2003/role/link', | ||
| 20 | ); | ||
| 21 | |||
| 22 | sub new() { | ||
| 23 | my ($class, $xml, $labels, $prefix, $args) = @_; | ||
| 24 | $args = {} if !$args; | ||
| 25 | $args = merge($args, \%default); | ||
| 26 | my $self = $class->SUPER::new($xml); | ||
| 27 | bless $self, $class; | ||
| 28 | foreach (keys %$args) { | ||
| 29 | $self->$_($$args{$_}); | ||
| 30 | } | ||
| 31 | $self->make_label($self->lang(), $labels, $prefix); | ||
| 32 | |||
| 33 | return $self; | ||
| 34 | } | ||
| 35 | |||
| 36 | sub dimension_label { | ||
| 37 | my ($self, $labels) = @_; | ||
| 38 | my $dims = $self->dimension(); | ||
| 39 | foreach my $dim (@$dims) { | ||
| 40 | foreach my $key ('dim', 'val') { | ||
| 41 | my $id_short = $$dim{$key}; | ||
| 42 | $id_short =~ s/:/_/; | ||
| 43 | my $role = "http://www.xbrl.org/2003/role/verboseLabel"; | ||
| 44 | my $label = $$labels{$id_short}{$$self{'rolelink'}}{$role} if $$labels{$id_short}{$$self{'rolelink'}}{$role}; | ||
| 45 | $role = "http://www.xbrl.org/2003/role/label"; | ||
| 46 | $label = $$labels{$id_short}{$$self{'rolelink'}}{$role} if !$label; | ||
| 47 | if ($label) { | ||
| 48 | $$dim{"${key}_label"} = $label | ||
| 49 | } | ||
| 50 | else { | ||
| 51 | warn "No dimension label($id_short)"; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | sub date_label_ja { | ||
| 58 | my ($self) = @_; | ||
| 59 | my $date = '2001/01/01'; | ||
| 60 | if ($self->startDate() && $self->endDate()) { | ||
| 61 | my ($sy, $sm, $sd) = $self->startDate()->value(); | ||
| 62 | my ($ey, $em, $ed) = $self->endDate()->value(); | ||
| 63 | map {$_ = Encode::encode('UTF-8', $_)} ($sy, $sm, $sd, $ey, $em, $ed); # Why ? | ||
| 64 | $date = sprintf "自%d年%02d月%02d日 至%d年%02d月%02d日", $sy, $sm, $sd, $ey, $em, $ed; | ||
| 65 | } | ||
| 66 | elsif ($self->endDate()) { | ||
| 67 | my ($ey, $em, $ed) = $self->endDate()->value(); | ||
| 68 | map {$_ = Encode::encode('UTF-8', $_)} ($ey, $em, $ed); | ||
| 69 | $date = sprintf "%d年%02d月%02d日", $ey, $em, $ed; | ||
| 70 | } | ||
| 71 | return $date; | ||
| 72 | } | ||
| 73 | |||
| 74 | sub make_label { | ||
| 75 | my ($self, $lang, $labels, $prefix) = @_; | ||
| 76 | my $label_func = "make_label_$lang"; | ||
| 77 | &$label_func($self, $$labels{$lang}, $prefix); | ||
| 78 | } | ||
| 79 | |||
| 80 | sub make_label_en { | ||
| 81 | } | ||
| 82 | |||
| 83 | BEGIN { | ||
| 84 | |||
| 85 | my %labels = ( | ||
| 86 | FilingDate => '提出日', | ||
| 87 | DateOfEvent => '基準日', | ||
| 88 | DocumentInfo => '提出書類情報', | ||
| 89 | CG => 'コーポレート・ガバナンス', | ||
| 90 | Interim => '中間期', | ||
| 91 | Current => { | ||
| 92 | Year => '当期', | ||
| 93 | YTD => '当四半期累計期間', | ||
| 94 | Quarter => '当四半期会計期間', | ||
| 95 | }, | ||
| 96 | Prior => { | ||
| 97 | Quarter => '前四半期会計期間', | ||
| 98 | 1 => { | ||
| 99 | Year => '前年度', | ||
| 100 | Interim => '前中間期', | ||
| 101 | YTD => '1年度前同四半期累計期間', | ||
| 102 | Quarter => '1年度前同四半期会計期間', | ||
| 103 | }, | ||
| 104 | 2 => { | ||
| 105 | Year => '前々年度', | ||
| 106 | Interim => '前々中間期', | ||
| 107 | YTD => '2年度前同四半期累計期間', | ||
| 108 | Quarter => '2年度前同四半期会計期間', | ||
| 109 | }, | ||
| 110 | 3 => { | ||
| 111 | Year => '3年度前', | ||
| 112 | Interim => '3年度前中間期', | ||
| 113 | YTD => '3年度前同四半期累計期間', | ||
| 114 | Quarter => '3年度前同四半期会計期間', | ||
| 115 | }, | ||
| 116 | 4 => { | ||
| 117 | Year => '4年度前', | ||
| 118 | Interim => '4年度前中間期', | ||
| 119 | YTD => '4年度前同四半期累計期間', | ||
| 120 | Quarter => '4年度前同四半期会計期間', | ||
| 121 | }, | ||
| 122 | 5 => { | ||
| 123 | Year => '5年度前', | ||
| 124 | Interim => '5年度前中間期', | ||
| 125 | YTD => '5年度前同四半期累計期間', | ||
| 126 | Quarter => '5年度前同四半期会計期間', | ||
| 127 | }, | ||
| 128 | 6 => { | ||
| 129 | Year => '6年度前', | ||
| 130 | Interim => '6年度前中間期', | ||
| 131 | YTD => '6年度前同四半期累計期間', | ||
| 132 | Quarter => '6年度前同四半期会計期間', | ||
| 133 | }, | ||
| 134 | 7 => { | ||
| 135 | Year => '7年度前', | ||
| 136 | Interim => '7年度前中間期', | ||
| 137 | YTD => '7年度前同四半期累計期間', | ||
| 138 | Quarter => '7年度前同四半期会計期間', | ||
| 139 | }, | ||
| 140 | 8 => { | ||
| 141 | Year => '8年度前', | ||
| 142 | Interim => '8年度前中間期', | ||
| 143 | YTD => '8年度前同四半期累計期間', | ||
| 144 | Quarter => '8年度前同四半期会計期間', | ||
| 145 | }, | ||
| 146 | 9 => { | ||
| 147 | Year => '9年度前', | ||
| 148 | Interim => '9年度前中間期', | ||
| 149 | YTD => '9年度前同四半期累計期間', | ||
| 150 | Quarter => '9年度前同四半期会計期間', | ||
| 151 | }, | ||
| 152 | }, | ||
| 153 | Last => { | ||
| 154 | Quarter => '前四半期会計期間', | ||
| 155 | 1 => { | ||
| 156 | Quarter => '1年度前の前四半期会計期間', | ||
| 157 | }, | ||
| 158 | 2 => { | ||
| 159 | Quarter => '2年度前の前四半期会計期間', | ||
| 160 | }, | ||
| 161 | 3 => { | ||
| 162 | Quarter => '3年度前の前四半期会計期間', | ||
| 163 | }, | ||
| 164 | 4 => { | ||
| 165 | Quarter => '4年度前の前四半期会計期間', | ||
| 166 | }, | ||
| 167 | 5 => { | ||
| 168 | Quarter => '5年度前の前四半期会計期間', | ||
| 169 | }, | ||
| 170 | 6 => { | ||
| 171 | Quarter => '6年度前の前四半期会計期間', | ||
| 172 | }, | ||
| 173 | 7 => { | ||
| 174 | Quarter => '7年度前の前四半期会計期間', | ||
| 175 | }, | ||
| 176 | 8 => { | ||
| 177 | Quarter => '8年度前の前四半期会計期間', | ||
| 178 | }, | ||
| 179 | 9 => { | ||
| 180 | Quarter => '9年度前の前四半期会計期間', | ||
| 181 | }, | ||
| 182 | } | ||
| 183 | ); | ||
| 184 | |||
| 185 | # 2684/S00057FU/jpfr-q2r-E03369-000-2009-12-31-01-2010-02-12.xbrl | ||
| 186 | # No relative duration nor instant(edinet,Pruir1QuarterConsolidatedInstant) | ||
| 187 | # 4684/S00039KN/jpfr-q1r-E05025-000-2009-06-30-01-2009-08-07.xbrl | ||
| 188 | # No relative duration nor instant(edinet,Prior1LastQuarterConsolidatedInstant) | ||
| 189 | # 4686 | ||
| 190 | # No relative duration nor instant(edinet,Prior1LastQuarterConsolidatedInstant) | ||
| 191 | # 7921 | ||
| 192 | # No relative duration nor instant(edinet,Prior1NonYearConsolidatedInstant) | ||
| 193 | # 8697 | ||
| 194 | # No relative duration nor instant(edinet,Prir1QuarterConsolidatedInstant) | ||
| 195 | sub find_relative_ja { | ||
| 196 | my ($id) = @_; | ||
| 197 | $id =~ s/NonConsolidated|Consolidated|Instant|Duration//g; | ||
| 198 | my @keys = grep {$_ ne ''} split /(Current|Prior|Last|Year|Interim|YTD|Quarter|\d)/, $id; | ||
| 199 | #print "$id ".Dumper(\@keys); | ||
| 200 | my $ls = \%labels; | ||
| 201 | foreach my $key (@keys) { | ||
| 202 | return undef if !exists $$ls{$key}; | ||
| 203 | if (ref $$ls{$key}) { | ||
| 204 | $ls = $$ls{$key}; | ||
| 205 | } | ||
| 206 | else { | ||
| 207 | return $$ls{$key}; | ||
| 208 | } | ||
| 209 | } | ||
| 210 | return undef; | ||
| 211 | } | ||
| 212 | |||
| 213 | sub make_label_ja { | ||
| 214 | my ($self, $labels, $prefix) = @_; | ||
| 215 | if ($self->scheme() =~ /edinet/) { | ||
| 216 | make_label_ja_edinet($self, $labels, $prefix); | ||
| 217 | } | ||
| 218 | elsif ($self->scheme() =~ /tse/) { | ||
| 219 | make_label_ja_tdnet($self, $labels, $prefix); | ||
| 220 | } | ||
| 221 | |||
| 222 | $self->dimension_label($labels); | ||
| 223 | } | ||
| 224 | |||
| 225 | # 9399/S000D6KG/jpfr-asr-E05951-000-2012-12-31-01-2013-04-02.xbrl | ||
| 226 | # CurrentYearConsolidatedDuration{,_2}: have different unitRefs(Yen and USD) | ||
| 227 | sub make_label_ja_edinet { | ||
| 228 | my ($self, $labels, $prefix) = @_; | ||
| 229 | my $id = $self->id(); | ||
| 230 | my @ids = split /_/, $id, 2; | ||
| 231 | |||
| 232 | my $rel = find_relative_ja($ids[0]); | ||
| 233 | if (!$rel) { | ||
| 234 | warn "No relative duration nor instant(edinet,$id)"; | ||
| 235 | $rel = ""; | ||
| 236 | } | ||
| 237 | |||
| 238 | my $cn; | ||
| 239 | if ($id =~ /NonConsolidated/) { | ||
| 240 | $cn = "個別"; | ||
| 241 | } | ||
| 242 | elsif ($id =~ /Consolidated/) { | ||
| 243 | $cn = "連結"; | ||
| 244 | } | ||
| 245 | else { | ||
| 246 | # FIXME: | ||
| 247 | # http://www.fsa.go.jp/search/20130821/2b_1.pdf: P31 | ||
| 248 | # EDINET 2013-08-31 基準では連結の判別が不能? | ||
| 249 | # 連結・個別の区別がされない箇所(「大株主の状況」等)がある。 | ||
| 250 | # そのリストもない。 | ||
| 251 | $cn = ""; | ||
| 252 | } | ||
| 253 | |||
| 254 | my $di; | ||
| 255 | if ($id =~ /Instant/) { | ||
| 256 | $di = "時点"; | ||
| 257 | } | ||
| 258 | elsif ($id =~ /Duration/) { | ||
| 259 | $di = "期間"; | ||
| 260 | } | ||
| 261 | elsif ($id =~ /DocumentInfo|DateOfEvent|CG/) { | ||
| 262 | } | ||
| 263 | else { | ||
| 264 | warn "No duration nor instant(edinet,$id)"; | ||
| 265 | $di = ""; | ||
| 266 | } | ||
| 267 | |||
| 268 | my $mem_label; | ||
| 269 | my $label; | ||
| 270 | if (@ids == 1) { | ||
| 271 | if ($id =~ /FilingDate|DocumentInfo|DateOfEvent|CG/) { | ||
| 272 | $label = $rel; | ||
| 273 | } | ||
| 274 | else { | ||
| 275 | $label = "$rel${di}"; | ||
| 276 | $label .= "_$cn"; | ||
| 277 | } | ||
| 278 | } | ||
| 279 | elsif (@ids == 2) { | ||
| 280 | if ($id =~ /FilingDate|DocumentInfo|DateOfEvent|CG/) { | ||
| 281 | $label = $rel; | ||
| 282 | } | ||
| 283 | else { | ||
| 284 | $label = "$rel${di}"; | ||
| 285 | $label .= "_$cn"; | ||
| 286 | } | ||
| 287 | my @mem_labels = $self->get_member_labels($ids[1], $labels, $prefix); | ||
| 288 | $label = join '_', $label, @mem_labels; | ||
| 289 | } | ||
| 290 | |||
| 291 | my $date = $self->date_label_ja(); | ||
| 292 | $label .= "_$date" if $date; | ||
| 293 | |||
| 294 | $self->label($label); | ||
| 295 | } | ||
| 296 | |||
| 297 | sub get_member_labels { | ||
| 298 | my ($self, $mem, $labels, $prefix) = @_; | ||
| 299 | (undef, $mem) = split /_/, $mem, 2 if $mem =~ /NonConsolidatedMember/; | ||
| 300 | return () if !defined $mem; | ||
| 301 | my @mems = $mem =~ /^jp/ ? ($mem) : split /_/, $mem; | ||
| 302 | my @mem_labels; | ||
| 303 | foreach my $mem (@mems) { | ||
| 304 | my $mem_label; | ||
| 305 | if ($mem =~ /^\d+$/) { | ||
| 306 | $mem_label = $mem; | ||
| 307 | } | ||
| 308 | elsif ($mem =~ /^jp[a-z]{3}\d{6}/) { | ||
| 309 | # jplvh030000-lvh_E03530-000_FilerLargeVolumeHolder1Member が | ||
| 310 | # jplvh030000-lvh_E03530-000FilerLargeVolumeHolder1Member となっている | ||
| 311 | $mem =~ s/(\d{3})([A-Z])/$1_$2/; | ||
| 312 | my $id_short = $mem; | ||
| 313 | my $role = "http://www.xbrl.org/2003/role/verboseLabel"; | ||
| 314 | $mem_label = $$labels{$id_short}{$$self{'rolelink'}}{$role} if $$labels{$id_short}{$$self{'rolelink'}}{$role}; | ||
| 315 | $role = "http://www.xbrl.org/2003/role/label"; | ||
| 316 | $mem_label = $$labels{$id_short}{$$self{'rolelink'}}{$role} if !$mem_label; | ||
| 317 | } | ||
| 318 | else { | ||
| 319 | foreach my $pref ('jppfs_cor', 'jpcrp_cor', 'jplvh_cor', 'ifrs', $prefix) { | ||
| 320 | my $id_short = "${pref}_$mem"; | ||
| 321 | my $role = "http://www.xbrl.org/2003/role/verboseLabel"; | ||
| 322 | $mem_label = $$labels{$id_short}{$$self{'rolelink'}}{$role} if $$labels{$id_short}{$$self{'rolelink'}}{$role}; | ||
| 323 | $role = "http://www.xbrl.org/2003/role/label"; | ||
| 324 | $mem_label = $$labels{$id_short}{$$self{'rolelink'}}{$role} if !$mem_label; | ||
| 325 | last if $mem_label; | ||
| 326 | } | ||
| 327 | } | ||
| 328 | if (!$mem_label) { | ||
| 329 | warn "No member label($mem)"; | ||
| 330 | push @mem_labels, $mem; | ||
| 331 | } | ||
| 332 | else { | ||
| 333 | push @mem_labels, $mem_label; | ||
| 334 | } | ||
| 335 | } | ||
| 336 | return @mem_labels; | ||
| 337 | } | ||
| 338 | |||
| 339 | sub make_label_ja_tdnet { | ||
| 340 | my ($self, $labels, $prefix) = @_; | ||
| 341 | my $id = $self->id(); | ||
| 342 | |||
| 343 | my $di; | ||
| 344 | if ($id =~ /Instant/) { | ||
| 345 | $di = "時点"; | ||
| 346 | } | ||
| 347 | elsif ($id =~ /Duration/) { | ||
| 348 | $di = "期間"; | ||
| 349 | } | ||
| 350 | elsif ($id =~ /DocumentInfo|DateOfEvent|CG/) { | ||
| 351 | } | ||
| 352 | else { | ||
| 353 | warn "No duration nor instant(tdnet,$id)"; | ||
| 354 | $di = ""; | ||
| 355 | } | ||
| 356 | |||
| 357 | my $cn; | ||
| 358 | if ($id =~ /NonConsolidated/) { | ||
| 359 | $cn = "個別"; | ||
| 360 | } | ||
| 361 | elsif ($id =~ /Consolidated/) { | ||
| 362 | $cn = "連結"; | ||
| 363 | } | ||
| 364 | else { | ||
| 365 | #warn "No nonconsolidated nor consolidated(tdnet,$id)"; | ||
| 366 | $cn = ""; | ||
| 367 | } | ||
| 368 | |||
| 369 | my $rel; | ||
| 370 | if ($id =~ /CurrentYear/) { | ||
| 371 | # 年間配当スケジュール軸(AnnualDividendPaymentScheduleAxis) | ||
| 372 | if ($id =~ /FirstQuarterMember/) { | ||
| 373 | $rel = "当期第1四半期末_${cn}"; | ||
| 374 | } | ||
| 375 | elsif ($id =~ /SecondQuarterMember/) { | ||
| 376 | $rel = "当期第2四半期末_${cn}"; | ||
| 377 | } | ||
| 378 | elsif ($id =~ /ThirdQuarterMember/) { | ||
| 379 | $rel = "当期第3四半期末_${cn}"; | ||
| 380 | } | ||
| 381 | elsif ($id =~ /YearEndMember/) { | ||
| 382 | $rel = "当期期末_${cn}"; | ||
| 383 | } | ||
| 384 | elsif ($id =~ /AnnualMember/) { | ||
| 385 | $rel = "当期合計_${cn}"; | ||
| 386 | } | ||
| 387 | # | ||
| 388 | else { | ||
| 389 | $rel = "当期${di}_${cn}"; | ||
| 390 | } | ||
| 391 | } | ||
| 392 | elsif ($id =~ /CurrentAccumulatedQ1/) { | ||
| 393 | $rel = "当期第1四半期累計${di}_${cn}"; | ||
| 394 | } | ||
| 395 | elsif ($id =~ /CurrentAccumulatedQ2/) { | ||
| 396 | $rel = "当期第2四半期累計${di}_${cn}"; | ||
| 397 | } | ||
| 398 | elsif ($id =~ /CurrentAccumulatedQ3/) { | ||
| 399 | $rel = "当期第3四半期累計${di}_${cn}"; | ||
| 400 | } | ||
| 401 | elsif ($id =~ /NextYear/) { | ||
| 402 | $rel = "次期${di}_${cn}"; | ||
| 403 | } | ||
| 404 | elsif ($id =~ /Next2Year/) { | ||
| 405 | $rel = "次々期${di}_${cn}"; | ||
| 406 | } | ||
| 407 | elsif ($id =~ /NextAccumulatedQ1/) { | ||
| 408 | $rel = "次期第1四半期累計${di}_${cn}"; | ||
| 409 | } | ||
| 410 | elsif ($id =~ /NextAccumulatedQ2/) { | ||
| 411 | $rel = "次期第2四半期累計${di}_${cn}"; | ||
| 412 | } | ||
| 413 | elsif ($id =~ /NextAccumulatedQ3/) { | ||
| 414 | $rel = "次期第3四半期累計${di}_${cn}"; | ||
| 415 | } | ||
| 416 | elsif ($id =~ /PriorYear/) { | ||
| 417 | # 年間配当スケジュール軸(AnnualDividendPaymentScheduleAxis) | ||
| 418 | if ($id =~ /FirstQuarterMember/) { | ||
| 419 | $rel = "前期第1四半期末_${cn}"; | ||
| 420 | } | ||
| 421 | elsif ($id =~ /SecondQuarterMember/) { | ||
| 422 | $rel = "前期第2四半期末_${cn}"; | ||
| 423 | } | ||
| 424 | elsif ($id =~ /ThirdQuarterMember/) { | ||
| 425 | $rel = "前期第3四半期末_${cn}"; | ||
| 426 | } | ||
| 427 | elsif ($id =~ /YearEndMember/) { | ||
| 428 | $rel = "前期期末_${cn}"; | ||
| 429 | } | ||
| 430 | elsif ($id =~ /AnnualMember/) { | ||
| 431 | $rel = "前期合計_${cn}"; | ||
| 432 | } | ||
| 433 | # | ||
| 434 | else { | ||
| 435 | $rel = "前期${di}_${cn}"; | ||
| 436 | } | ||
| 437 | } | ||
| 438 | elsif ($id =~ /PriorAccumulatedQ1/) { | ||
| 439 | $rel = "前期第1四半期累計${di}_${cn}"; | ||
| 440 | } | ||
| 441 | elsif ($id =~ /PriorAccumulatedQ2/) { | ||
| 442 | $rel = "前期第2四半期累計${di}_${cn}"; | ||
| 443 | } | ||
| 444 | elsif ($id =~ /PriorAccumulatedQ3/) { | ||
| 445 | $rel = "前期第3四半期累計${di}_${cn}"; | ||
| 446 | } | ||
| 447 | else { | ||
| 448 | $rel = find_relative_ja($id); | ||
| 449 | if (!$rel) { | ||
| 450 | warn "No relative duration nor instant(tdnet,$id)"; | ||
| 451 | $rel = ""; | ||
| 452 | } | ||
| 453 | elsif ($id =~ /FilingDate|DocumentInfo|DateOfEvent|CG/) { | ||
| 454 | } | ||
| 455 | else { | ||
| 456 | $rel = "$rel${di}_${cn}"; | ||
| 457 | } | ||
| 458 | } | ||
| 459 | |||
| 460 | my $fr; | ||
| 461 | if ($id =~ /CurrentMember_ResultMember/) { | ||
| 462 | $fr = "今回実績"; | ||
| 463 | } | ||
| 464 | elsif ($id =~ /PreviousMember_ResultMember/) { | ||
| 465 | $fr = "前回実績"; | ||
| 466 | } | ||
| 467 | elsif ($id =~ /CurrentMember_ForecastMember/) { | ||
| 468 | $fr = "今回予想"; | ||
| 469 | } | ||
| 470 | elsif ($id =~ /PreviousMember_ForecastMember/) { | ||
| 471 | $fr = "前回予想"; | ||
| 472 | } | ||
| 473 | elsif ($id =~ /CurrentMember_LowerMember/) { | ||
| 474 | $fr = "今回下限"; | ||
| 475 | } | ||
| 476 | elsif ($id =~ /PreviousMember_LowerMember/) { | ||
| 477 | $fr = "前回下限"; | ||
| 478 | } | ||
| 479 | elsif ($id =~ /CurrentMember_UpperMember/) { | ||
| 480 | $fr = "今回上限"; | ||
| 481 | } | ||
| 482 | elsif ($id =~ /PreviousMember_UpperMember/) { | ||
| 483 | $fr = "前回上限"; | ||
| 484 | } | ||
| 485 | elsif ($id =~ /ResultMember/) { | ||
| 486 | $fr = "実績"; | ||
| 487 | } | ||
| 488 | elsif ($id =~ /ForecastMember/) { | ||
| 489 | $fr = "予想"; | ||
| 490 | } | ||
| 491 | elsif ($id =~ /LowerMember/) { | ||
| 492 | $fr = "下限"; | ||
| 493 | } | ||
| 494 | elsif ($id =~ /UpperMember/) { | ||
| 495 | $fr = "上限"; | ||
| 496 | } | ||
| 497 | else { | ||
| 498 | #warn "No result nor forecast member(tdnet,$id)"; | ||
| 499 | $fr = ""; | ||
| 500 | } | ||
| 501 | |||
| 502 | my $label = $rel; | ||
| 503 | $label .= "_$fr"; | ||
| 504 | my $date = $self->date_label_ja(); | ||
| 505 | $label .= "_$date" if $date; | ||
| 506 | |||
| 507 | $self->label($label); | ||
| 508 | } | ||
| 509 | |||
| 510 | } # BEGIN | ||
| 511 | |||
| 512 | sub freeze { | ||
| 513 | my ($self) = @_; | ||
| 514 | $$self{'startDate'} = $$self{'startDate'} ? $$self{'startDate'}->printf("%Y/%m/%d") : ''; | ||
| 515 | $$self{'endDate'} = $$self{'endDate'} ? $$self{'endDate'}->printf("%Y/%m/%d") : ''; | ||
| 516 | return $self; | ||
| 517 | } | ||
| 518 | |||
| 519 | |||
| 520 | =head1 XBRL::JPFR::Context | ||
| 521 | |||
| 522 | XBRL::JPFR::Context - OO Module for Encapsulating XBRL::JPFR Contexts | ||
| 523 | |||
| 524 | =head1 SYNOPSIS | ||
| 525 | |||
| 526 | use XBRL::JPFR::Context; | ||
| 527 | |||
| 528 | my $context = XBRL::JPFR::Context->new($context_xml); | ||
| 529 | |||
| 530 | =head1 DESCRIPTION | ||
| 531 | |||
| 532 | This module is part of the XBRL::JPFR modules group and is intended for use with XBRL::JPFR. | ||
| 533 | |||
| 534 | =item new | ||
| 535 | |||
| 536 | Object constructor takes a scalar containing the XML representing the context | ||
| 537 | |||
| 538 | =back | ||
| 539 | |||
| 540 | =head1 AUTHOR | ||
| 541 | |||
| 542 | Tetsuya Yamamoto <yonjouhan@gmail.com> | ||
| 543 | |||
| 544 | =head1 SEE ALSO | ||
| 545 | |||
| 546 | Modules: XBRL XBRL::JPFR XBRL::Context | ||
| 547 | |||
| 548 | =head1 COPYRIGHT AND LICENSE | ||
| 549 | |||
| 550 | Copyright (C) 2015 by Tetsuya Yamamoto | ||
| 551 | |||
| 552 | This library is free software; you can redistribute it and/or modify | ||
| 553 | it under the same terms as Perl itself, either Perl version 5.10 or, | ||
| 554 | at your option, any later version of Perl 5 you may have available. | ||
| 555 | |||
| 556 | |||
| 557 | =cut | ||
| 558 | |||
| 559 | |||
| 560 | 1; |