in reply to Re: The day before a specific date
in thread The day before a specific date

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: The day before a specific date
by eyepopslikeamosquito (Archbishop) on Jun 01, 2023 at 08:28 UTC
      Sorry tybalt89 and others. Here is the table that this will fit into. $dsrd = the date the script will provide.
      print "<tr><td colspan=12 class=\" f-width td-border0\"><label name=\" +Rep_name\" size=\"45\" class=\"font-large font-faceA\">REPORT NAME: & +nbsp; <B>$Rep_name</label></B></td></tr>\n"; #print "<td class=\"s-width td-border0\"><span name=\"Rep_name\" type= +\"text\" value=\"$Rep_name\" size=\"10\" class=\"font-large align-cen +ter\" /></td></tr>\n"; print "<tr><td colspan=12 class=\"l-width td-border0\"><label name=\"D +srd\" size=\"35\" class=\"font-large font-faceA\">DAILY SALES REPORT +DATE: <font face=arial size=2><B>(Enter date as \"MM/DD/YYYY\")</B></ +font></label></td>\n"; print "<td class=\"l-width td-border0\"><input type=\"text\" name=\"Ds +rd\" value=\"$Dsrd\" size=\"10\" class=\"font-large align-center\" /> +</td></tr>\n"; print "<tr><td colspan=12 class=\"m-width td-border0\"><label name=\"D +sr_notes\" size=\"25\" class=\"font-large font-faceA\">DAILY SALES RE +PORT NOTES: &nbsp; &nbsp; <input type=\"text\" class=\"font-large fon +t-faceA\" name=\"Dsr_notes\" size=\"20\" value=\"$Dsr_notes\"></td>< +/tr>\n"; &get_yesterday; open(RPTDET, "<reports/amdsrdet.txt") or die "Cannot open amdsrdet.txt +"; flock RPTDET,2; seek(RPTDET,0,0); @rptdet = <RPTDET>; close(RPTDET); foreach $line (@rptdet) { $r_line = split(/\n/,$line); ($rpt_dt,$dsrd,$rpt_nts,$dsr_notes,$repcr_dt,$repcr_date,$rpt_cd,$ +rep,$sess_nbr,$session,$rpt_usr,$user,$tdy_pre_coh,$pre_coh,$td_sls_d +,$td_sls,$tot_exp_d,$tot_exp,$fin_coh_d,$fin_coh,$tdy_grpft_d,$tdy_gr +pft,$cash_xfr_desc,$cash_xfr_d,$cash_xfr_v,$tdy_cscnt_d,$tdy_custcnt, +$groc_d,$groc,$meats_desc,$meats_d,$meats_v,$fish_desc,$fish_d,$fish_ +v,$rice_d,$rice,$trans_d,$trans,$phwf_d,$phwf,$elec_d,$elec,$wtr_bill +_d,$wtr_bill,$loan_d,$loan,$pyrlA_desc,$pyrlA_d,$pyrlA_v,$van_desc,$v +an_d,$van_v,$legal2_desc,$legal2_d,$legal2_v,$legal3_desc,$legal3_d,$ +legal3_v,$misc1_desc,$misc1_d,$misc1_v,$misc2_desc,$misc2_d,$misc2_v) + = split(/\,/,$r_line); if($dsrd eq $yesterday) { $Lcoh = $pre_coh; }else { next; } } print "<tr><td colspan=12 class=\"l-width td-border0\"><label name=\"L +coh\" size=\"35\" class=\"font-large font-faceA\"> LAST CASH ON HAND: + </label></td>\n"; print "<td class=\"s-width td-border0 font-faceA font-large align-cent +er font-bold\" name=\"Lcoh\" type=\"text\" value=\"$Lcoh\" size=\"10\ +">$Lcoh</td></tr>\n"; print "<tr><td colspan=12 class=\"l-width td-border0\"><label name=\"P +re_coh\" size=\"35\" class=\"font-large font-faceA\"> CURRENT CASH ON + HAND: <font face=arial size=3><B>(Enter as 000.00)</B></font></label +></td>\n"; print "<td class=\"s-width td-border0\"><input name=\"Pre_coh\" type=\ +"text\" value=\"$Pre_coh\" size=\"10\" class=\"font-large align-right +\" /></td></tr>\n"; print "<tr><td colspan=12 class=\"f-width font-medium2 td-border0 font +-faceT font-red font-bold\">Enter \"Current Cash on Hand\" Amount or +you will have to start over!</td></tr>\n"; print "<P><tr><td colspan=12 class=\"l-width td-border0\"><label name= +\"User\" size=\"35\" class=\"font-large font-faceA\">REPORT WRITER:</ +label></td>\n"; print "<td class=\"s-width td-border0 font-faceA font-large align-cent +er font-bold\" name=\"User\" type=\"text\" value=\"$User\" size=\"10\ +">$User</td></tr></table>\n";
      The $yesterday I am seeking will allow me to go back into data file and find what I need to provide for the report created by the table here. Thanks.

        Thank you for posting your code.

        A good first step is to reduce the code to the minimum code needed for reproducing the problem. This helps us understand the code quicker, and likely it also helps you to understand the structure of your code better.

        Can you please post the code without the HTML generation as a new reply, to your node? The generation of an output file is likely also not relevant to the problem.

        Hi jpys, you wrote
        $dsrd = the date the script will provide.
        I think you could avoid some of the confusion by showing us, what
        print chr(39) . $dsrd . chr(39);
        really gives you. Just put that in your script, and paste your output between <code> and </code> in a post.