Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

help in billing process

by oikool (Novice)
on Jan 24, 2014 at 07:36 UTC ( [id://1071891]=perlquestion: print w/replies, xml ) Need Help??

oikool has asked for the wisdom of the Perl Monks concerning the following question:

hi.. im new to perl. I need help on how to create a bill based on calender. If its a week old plan or before the plan expires i need to create a bill. i have done this much

#!/usr/local/bin/perl @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun); ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek +, $dayOfYear, $daylightSavings) = localtime(); $year = 1900 + $yearOffset; $theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$mont +h] $dayOfMonth, $year"; print $theTime; use strict; use warnings; $timefile="/home/$theTime-time.txt "; open (MYFILE, '>',$timefile); my $count=0; printf "Time value:",$theTime; print MYFILE $theTime; close (MYFILE);

Replies are listed 'Best First'.
Re: help in billing process
by 2teez (Vicar) on Jan 24, 2014 at 08:02 UTC

    Hi oikool
    Some help has been giving to you on Calender billing_prt, which you have not obviously yielded to.
    Please do, then show what you are getting that is different to what you wanted.
    Some other CPAN modules has also be mentioned in your previous post. Have you tired them out?

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me
Re: help in billing process
by Anonymous Monk on Jan 24, 2014 at 07:53 UTC
Re: help in billing process
by oikool (Novice) on Jan 24, 2014 at 10:47 UTC
    #!/usr/local/bin/perl @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun); ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek +, $dayOfYear, $daylightSavings) = localtime(); $year = 1900 + $yearOffset; $theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$mont +h] $dayOfMonth, $year"; print $theTime; use Date::Calc qw(Delta_Days); my @abbr = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); $today[0] += 1900; for (my $i=$month; $i<=12; $i++) { $today[1]++; if($dayOfMonth==1) { my $days = Delta_Days($dayOfMonth, 7); print "these many days $days are used for billing $days \n +"; exit 0; } }

    i hope this code is fine

Re: help in billing process
by oikool (Novice) on Jan 24, 2014 at 09:13 UTC

    i'm trying to do timestamp, that takes difference of the two dates. but i know to convert only one particular date to timestamp ... so how should i make difference between any two dates??

    use Time::Local; my $date = '23.10.2011 11:35:00'; my ($mday,$mon,$year,$hour,$min,$sec) = split(/[\s.:]+/, $date); my $time = timelocal($sec,$min,$hour,$mday,$mon-1,$year); print $time,"\n",scalar localtime $time;

      Can you extend that approach to a second date?

        thats wt i didnt know how to do :/

Re: help in billing process
by oikool (Novice) on Jan 24, 2014 at 11:35 UTC

    thanks marto will look on to those links :)

      If you are replying to someone click the 'reply' link associated with their comment. Currently you're replying to yourself, hence all the notifications you'll be getting. Tutorials -> Understanding and Using PerlMonks.

Re: help in billing process
by pemungkah (Priest) on Jan 24, 2014 at 17:01 UTC
    Have you seen mjd's recent series of blog posts on Moonpig? I would seriously recommend looking at it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1071891]
Approved by hdb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-29 00:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found