Here is the deal, I am passing a parameter to this program form a form i.e., FY01, CY01 etc. (where FY= fiscal year and CY = calendar year). The problem is that when I try to get the program to get me output for a specific date range, it's acting weird and the output is not falling in the given range. The second question I had was that if I select "calendar year" in the form I don't want it to still rearrange in "fiscal year" format (e.g., q1, q2, …). This is running with "w" on and i can't use strict.
#TEST By FY or CY###
my $go = param('go');
if ($go eq "FY02") {
$sdate = "2001/06/01" && $edate = "2002/05/31";
} elsif ($go eq "CY02") {
$sdate = "2002/01/01" && $edate = "2002/12/31";
} elsif ($go eq "FY01") {
$sdate = "2000/06/01" && $edate = "2001/05/31";
} elsif ($go eq "CY01") {
$sdate = "2001/01/01" && $edate = "2001/12/31";
} elsif ($go eq "FY00") {
$sdate = "1999/06/01" && $edate = "2000/05/31";
} else {
$sdate = "2000/01/01" && $edate = "2000/12/31";
}
@ofld = ("?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "
+?", "?", "?", "?", "?");
foreach $line (@loads) {
@flds = split (/!/, $line, 17);
next if $sdate lt $flds[$DTE] && $flds[$DTE] lt $edate;
+ #date range
foreach $field (@flds) {
$field =~ s/\s+$//;
if ($field =~ m!(....)/(..)/(..)!) { #r
+eorg. date style
$field = "$2/$3/$1";
}
}
$flds[1] = $syst{$flds[1]} || $flds[1];
{
my ($m, $d, $y) = split (m!/!, $flds[$DTE]);
+ #take date and strip "/"
my $fq = int (($m + 6) % 12 / 3) % 4 + 1; #
+get fiscal quarter
my $fy = $y + ($m > 5 ? 1 : 0); #ge
+t fiscal year
$flds[$VIR] = sprintf "FY %04d Quarter %d", $fy, $fq;
+ #assign to virtual field
}
&test_break ();
print "<tr valign=\"top\">\n";
foreach $spec (@$OUTPUT) {
|
|
|
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.