Last warning: You are still sending messages to my private address, which is inappropriate. I read the beginner's list and will see any messages you send there, so do many other people who my be able to help you better/faster than me. These people want to help you, that's why the list exists. Please direct all future inquiries to [EMAIL PROTECTED] as I will ignore any further messages sent directly to me.

On Wednesday, October 8, 2003, at 10:47 PM, vaishali wrote:

This total cost is count of the field receiver ie in above example

sender: xyz.abc
department: xxx
branch: yyy
--------------------------------------------------------
receiver                    sent
-------------------------------------------------------
4423432432                  2003-09-09 09:09:00
65465466546                 2003-08-06 01:10:10
---------------------------------------------------------
Total Cost: 2
or Total count

ie a sender xyz.abc has sent two sms messages the cost of sms messages is Rs 1 so
the total cost is 2 ie messages send * Rs.1 = 2

Okay, I understand what you want now. Unfortunately, I could not find the place in your code where you are printing the footer, to offer a fix.


You are already keeping track of the count in the %seen variable. $seen{$temp_sender2} will give you the count, at any give time. Thus "Total Cost: $seen{$temp_sender2}\n" should give you the last line, wherever you are outputting it.

Now if your problem is that you can't figure out where to work in the footer, that may be a little tricky. You could always read the database table into a large data structure, making it easier for you to output statistics. Or, with your current approach, you could keep track of the last sender:

my $last_sender; # must come before while loop

while (my $row=$sth->fetchrow_arrayref()) {

# ...


print $/,$/,'sender :',$temp_sender2,$/,'Department:',$lp1{$temp_sender1}{'department'},$/ ,'Branch:',$lp1{$temp_sender1}{'branch'},$/,$header if(!$seen{$temp_sender2}++);

# replace the above line with something like:


if (not $seen{$temp_sender2}++) {
        print '-' x 58, "\nTotal Cost: $seen{$last_sender}\n" if $last_sender;
        print "\n\nsender  :$temp_sender2\n",
        "Department:$lp1{$temp_sender1}{department}\n",
        "Branch:$lp1{$temp_sender1}{branch}\n",
        "$header";
}

print $row->[1],(' ' x (28-length($row->[1]))),
      $row->[2],(' ' x (22-length($row->[2]))),$/;

$last_sender = $temp_sender2;


}

Hope that helps.


James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to