Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#2 INVENTORY REPORT BY VENDOR Page No. 1 VEN ITEM DWT DWT COST DOR COST ----------------------------------- ??? 2241 0.00 0.00 165.00 ??? 2391 0.00 0.00 185.00 ??? 2443 0.00 0.00 395.00 #ITEMS TOTAL DWT TOTAL DWT COST -------------------------------- 41 63.95 93920.00 #2 INVENTORY REPORT BY VENDOR Page No. 1 VEN ITEM DWT DWT COST DOR COST ----------------------------------- A&A 2743 0.00 0.00 225.00 #ITEMS TOTAL DWT TOTAL DWT COST ------------------------------- 3 0.00 0.00
The vendor A&A's totals give the information for the previous vendor ???
Heres my script:
use DBI; require formats.pl; $dbh = DBI->connect("dbi:SQLite:dbname=K&M","","") || die "\nCan't ope +n Database!\n"; $row = $dbh->selectrow_arrayref( "SELECT COUNT(*) from INV" ); $count = $row->[0]; $results = $dbh->selectall_arrayref("SELECT * FROM INV ORDER BY VENDOR +, CODE"); open INVENTORY,">print.txt"; select INVENTORY; my $inventory_format = select(INVENTORY); $^L = ""; $= = 54; select($inventory_format); for(my $i=0; $i <= $count; $i++) { $user = $results->[$i]; if ($vendor ne $user->[6]) { $left=$-; $dap=$%; close($inventory_format); close INVENTORY; open TOTALS,">>print.txt"; select TOTALS; my $totals_format = select(TOTALS); $^L = ""; $= = 54; select($totals_format); $-=$left; write; $left=$-; for(my $y=$left;$y>=1;$y--){ print "\n"; } $TOTAL_ITEMS=0; $TOTAL_DWT=0; $TOTAL_DWT_COST=0; $TOTAL_COST=0; $TOTAL_PRICE=0; open INVENTORY,">>print.txt"; select INVENTORY; my $inventory_format = select(INVENTORY); $^L = ""; $= = 54; select($inventory_format); $- = 0; } $vendor=$user->[6]; write; $TOTAL_ITEMS++; $TOTAL_DWT+=$user->[1]; $TOTAL_DWT_COST+=$user->[0]; $TOTAL_COST+=$user->[2]; $TOTAL_PRICE+=$user->[3]; }
I would just like to thank anyone in advance for taking the time to figure out what the heck I'm talking about, because I feel like my explination isn't very good. Thank you in advance for any help you could possible give.
|
|---|