ODBiC Discussion Board


RE: report - more info, Dave, 06-13-2008

report - thanks Roger!

by Dave, June 16, 2008 19:55

Here is the code in case anyone is interested: If you want subtotals, you would need to output those when the order number changes (if there was a previous order), and then reset your subtotal accumulators to 0 for the new order. (You also need to output a subtotal when the last order is processed, so that code needs to be repeated after the ENDROW.) You want to start a table for the order detail rows in that IFNEW section, but you don't want to close that table until the order number changes, or when you finish the last order. Then, for each row (new order or not), add the qty and price to the subtotal accumulators.

<!--SET FirstOrder=1, qtySubtotal=0, priceSubtotal=0 -->

<!--EACHROW-->

<!--IFNEW OrderNum--> <!--IF NOT $FirstOrder$ --><!--NOTE: finish previous order--> </table> SUM OF Quantity $qtySubtotal$ GRAND TOTAL $priceSubtotal$ <!--ENDIF-->

<table width="100%" border="1"> <tr> <td>$OrderNum$</td> <td>$fullname$</td> </tr> </table>

<!--NOTE: Open detail table and output column header row --> <table width="100%" border="1"> <tr> <th>NAME</th> <th>DESC</th> <th>SIZE</th> <th>Quantity</th> <th>Price</th> <th>TOTAL PRICE</th> </tr>

<!--NOTE: set "not first order" and reset the subtotals --> <!--SET FirstOrder=0, qtySubtotal=0, priceSubtotal=0 --> <!--ENDIF-->

<!--NOTE: process detail row --> <!--SET TotalPrice = $qty$ * $unitprice$, qtySubtotal=$qtySubtotal$+$qty$, priceSubtotal=$priceSubtotal$+$TotalPrice$ -->

<tr> <td>$ID$</td> <td>$Describe$</td> <td>$size$</td> <td>$qty$</td> <td>$unitprice$</td> <td>$totalprice$</td> </tr> <!--ENDROW-->

<!--NOTE: finish off the last order table --> </table> SUM OF Quantity $qtySubtotal$ GRAND TOTAL $priceSubtotal$



Replies:


Post Your Reply:

Name   
E-mail  optional
Topic  
Message:

HTTP Link: 
Link text: 

          


Copyright ©1997-2003, Roger Harris. All rights reserved.