INNER JOIN Trans USING (tranId) WHERE itemId = ? ORDER BY tranDate DESC ''',(itemId,)) print "<TABLE BORDER=1 class=listthings><TR>" print "<TH>Date</TH>" print "<TH>Type</TH>" print "<TH>Party</TH>" print "<TH>Qty</TH>" print "<TH>Price/item</TH>" print "<TH>Prorated<br />shipping</TH>" print "<TH>Total<br />per unit</TH>" print "</TR>" for (quantity,pricePerItem,purchaseDate,type,direction,description,proratedShipping) in cursor: if not proratedShipping: proratedShipping = 0 tranType = getTranType(type,direction) print "<TR>" print "<TD>%s</TD>"%purchaseDate print "<TD>%s</TD>"%tranType print "<TD>%s</TD>"%description print "<TD>%d</TD>"%quantity print "<TD>%s</TD>"%centsToDollarString(pricePerItem) print "<TD>%s</TD>"%centsToDollarString(proratedShipping) print "<TD>%s</TD>"%centsToDollarString(pricePerItem+proratedShipping) print "</TR>" print "</TABLE>" printFooter()
cursor.execute(''' SELECT expenseId,expDate,description,amount FROM expense ORDER BY expDate ''') print ''' <TABLE BORDER=1 class='listthings sortable'> <TR> <TH>Date</TH> <TH>Description</TH> <TH>Amount</TH> <TH></TH> </TR> ''' for (expenseId,date,description,amount) in cursor: print '<TR>' print '<TD>%s</TD>'%date print '<TD>%s</TD>'%description print '<TD>%s</TD>'%centsToDollarString(amount) print '<TD>' print gotoButton('Edit','editExpense.py?expenseId=%s'%expenseId) print gotoButton('Delete','expenses.py?deleteId=%s'%expenseId) print '</TD>' print '</TR>' print '</TABLE>' printFooter()