本文整理汇总了Python中transaction.Transaction.balance方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.balance方法的具体用法?Python Transaction.balance怎么用?Python Transaction.balance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transaction.Transaction
的用法示例。
在下文中一共展示了Transaction.balance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parsepayout
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import balance [as 别名]
def parsepayout(csvfile):
tadic = {}
# Move the cursor to the first csv row
emptyrows = 0
while csvfile.readline().startswith("Order Number") == False and emptyrows < 10:
emptyrows = emptyrows + 1
if emptyrows == 10:
print "Not a valid csv file:", csvfile.name
return tadic
# Loop the csv rows and add the transactions into a dictionary, where currency is the key
for line in csvfile:
row = line.replace("\n", "").split(",")
ta = Transaction()
ta.chargeddate = datetime.strptime(row[COL_SRC_CHARGEDDATE], dateformat)
ta.orderno = row[COL_SRC_ORDERNO]
ta.currency = row[COL_SRC_CURRENCY]
ta.salesinclvat = float(row[COL_SRC_SALESINCLVAT])
ta.salesexclvat = float(row[COL_SRC_SALESEXCLVAT])
ta.balance = float(row[COL_SRC_BALANCE])
if ta.currency == "EUR":
ta.fxrate = 1.00
else:
ta.fxrate = float(row[COL_SRC_FXRATE])
ta.vat = float(row[COL_SRC_VAT])
ta.payoutdate = datetime.strptime(row[COL_SRC_PAYOUTDATE], dateformat)
ta.country = row[COL_SRC_COUNTRY]
if tadic.has_key(ta.currency):
talist = tadic[ta.currency]
else:
talist = tadic[ta.currency] = []
talist.append(ta)
return tadic