Fixes for the import process and some strange cases where Wallets have no transactions. Also show the users' name instead of username

This commit is contained in:
2012-04-29 23:31:35 +01:00
parent 04e021b4d1
commit 35914a5958
2 changed files with 6 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ def import_wallet_journal(corporation_id):
except Error, e:
print e
else:
if type(res.entries) == str: return None
entries = res.entries.SortedBy('refID', reverse=True)
if len(entries) == rowCount:
rows = get_records(corp, fromID=entries[-1].refID)
@@ -33,12 +34,14 @@ def import_wallet_journal(corporation_id):
# Process Rows
rows = get_records(corp).SortedBy('refID', reverse=True)
rows = get_records(corp)
if rows is None: return
rows = rows.SortedBy('refID', reverse=True)
logging.info("Total rows: %s" % len(rows))
totals = {}
for record in rows:
if int(record.refID) > corp.last_transaction:
if int(record.refTypeID) in [int(x.trim()) for x in managerconf.get('pac.tax_refids', '85,99').split(',')]:
if int(record.refTypeID) in [int(x.strip()) for x in managerconf.get('pac.tax_refids', '85,99').split(',')]:
#print record.refID, int(record.refTypeID), record.amount
dt = datetime.fromtimestamp(record.date).replace(tzinfo=utc)
if not totals.has_key('%s-%s' % (dt.year, dt.month)):

View File

@@ -22,7 +22,7 @@
<thead>
<tbody>
{% for obj in object_list %}
<tr><td><a href="{% url corporation-detail obj.pk %}">{{ obj.name }}</a></td><td>{% if obj.contact %}{{ obj.contact.username }}{% else %}<a href="{% url corporation-updatecontact obj.pk %}">Assign Contact</a>{% endif %}</td><td>{{ obj.ceo }}</td><td>{{ obj.tax_rate }}%</td><td><span class="{% if obj.balance >= 0 %}positive{% else %}negative{% endif %}">{{ obj.balance|intcomma }} ISK</span></td></tr>
<tr><td><a href="{% url corporation-detail obj.pk %}">{{ obj.name }}</a></td><td>{% if obj.contact %}{{ obj.contact.first_name }}{% else %}<a href="{% url corporation-updatecontact obj.pk %}">Assign Contact</a>{% endif %}</td><td>{{ obj.ceo }}</td><td>{{ obj.tax_rate }}%</td><td><span class="{% if obj.balance >= 0 %}positive{% else %}negative{% endif %}">{{ obj.balance|intcomma }} ISK</span></td></tr>
{% endfor %}
<tr><th colspan="4">Total Outstanding</th><th><span class="{% if total >= 0 %}positive{% else %}negative{% endif %}"><b>{{ total|intcomma }} ISK</b></span></th></tr>
</tbody>