示例#1
0
mytype = getTranType(type,direction)

print '<H2>Details for %s: %s</H2>'%(mytype,description)
print '<p>Date: %s</p>'%tranDate

cursor.execute('SELECT manufacturer,brand,name,quantity,pricePerItem FROM TransItem LEFT JOIN Item USING (itemId) WHERE tranId = ?',
               (tranId,))

print '<TABLE BORDER=1><TR><TH>Item</TH><TH>qty</TH><TH>unit price</TH><TH>tot price</TH>'
totalPrice = 0
for (manufacturer,brand,name,quantity,pricePerItem) in cursor:
    itemsTotalPrice = (int(quantity)*int(pricePerItem))
    totalPrice += itemsTotalPrice
    print '<TR>'
    print cell(getItemName(manufacturer,brand,name))
    print cell(quantity)
    print moneyCell(pricePerItem)
    print moneyCell(itemsTotalPrice)
    print '</TR>'

print "<TR><TD COLSPAN=3 ALIGN=RIGHT>Shipping:</TD>",moneyCell(shipping),"</TR>"
totalPrice += shipping
print "<TR><TD COLSPAN=3 ALIGN=RIGHT><b>Total:</b></TD>",moneyCell(totalPrice),"</TR>"
print "</TABLE>"

print "<FORM name=modTran ACTION=saleDetails.py>"
print "<INPUT TYPE=hidden NAME=tranId VALUE=%s>"%tranId
print "Actual shipping costs: <INPUT TYPE=TEXT CLASS=money NAME=actualShipping ID=actualShipping VALUE=%s SIZE=5 onBlur='moneyFormat(event.target)'/>"%centsToString(actualShipping)
print "Tracking number: <INPUT TYPE=TEXT NAME=tracking ID=tracking VALUE=%s SIZE=25/>"%tracking
print "<BR />"
示例#2
0
文件: sales.py 项目: lezzgiles/esp
GROUP BY tranId
ORDER BY tranDate DESC, tranid DESC
LIMIT 200
''')
print "<H2>Last 200 sales:</H2>"
print "<TABLE BORDER=1 class='listthings sortable'>"
print "<TR><TH>Type</TH><TH>Date</TH><TH>Buyer</TH><TH>Total cost</TH><TH></TH></TR>"
for (tranId,type,direction,tranDate,buyer,shipping,totalCost) in cursor:
    if type == 'REAL':
        if direction == 'ADD':
            typeDetail = 'Purchase'
        else:
            typeDetail = 'Sale'
    else:
        if direction == 'ADD':
            typeDetail = 'Reconcile<br />add'
        else:
            typeDetail = 'Reconcile<br />del'

    
    print "<TR>"
    print cell(typeDetail)
    print cell(tranDate)
    print cell(buyer)
    print moneyCell(int(shipping)+int(totalCost))
    print "<TD>",gotoButton('See details','saleDetails.py?tranId=%s'%tranId),"</TD>"
    print "</TR>"
print "</TABLE>"

printFooter()
示例#3
0
cursor.execute('''
SELECT
    tranId,type,direction,tranDate,description,shipping,SUM(quantity*pricePerItem)
FROM Trans
LEFT JOIN TransItem USING (tranId)
WHERE direction == 'ADD'
GROUP BY tranId
ORDER BY tranDate DESC, tranid DESC
LIMIT 200
''')

print "<H2>Last 200 purchases</H2>"
print "<TABLE BORDER=1 class='listthings sortable'>"
print "<TR><TH>Type</TH><TH>Date</TH><TH>Seller</TH><TH>Total cost</TH><TH></TH></TR>"
for (tranId,type,direction,tranDate,seller,shipping,totalCost) in cursor:
    typeDetail = getTranType(type,direction)
    
    print "<TR>"
    print cell(typeDetail)
    print cell(tranDate)
    print cell(seller)
    print moneyCell(int(shipping)+int(totalCost))
    print "<TD>",gotoButton('See details','purchaseDetails.py?tranId=%s'%tranId),"</TD>"
    print "</TR>"
print "</TABLE>"



printFooter()