show DKK balance

This commit is contained in:
Thomas Steen Rasmussen 2020-09-03 01:32:26 +02:00
parent 31d399bf5a
commit 1dd13d6090
4 changed files with 79 additions and 8 deletions

View file

@ -5,10 +5,8 @@
<th>Date</th> <th>Date</th>
<th>Pos</th> <th>Pos</th>
<th>Responsible</th> <th>Responsible</th>
<th>Bank Start</th> <th>DKK Cash iZettle</th>
<th>Pos Start</th> <th>DKK Balance</th>
<th>Bank End</th>
<th>Pos End</th>
<th>Hax Income</th> <th>Hax Income</th>
<th>Hax Sold iZettle</th> <th>Hax Sold iZettle</th>
<th>Hax Sold Website</th> <th>Hax Sold Website</th>
@ -23,10 +21,13 @@
<td><a href="{% url 'backoffice:posreport_detail' camp_slug=camp.slug pos_slug=pos.slug posreport_uuid=pr.uuid %}">{{ pr.date }}</a></td> <td><a href="{% url 'backoffice:posreport_detail' camp_slug=camp.slug pos_slug=pos.slug posreport_uuid=pr.uuid %}">{{ pr.date }}</a></td>
<td>{{ pr.pos.name }}</td> <td>{{ pr.pos.name }}</td>
<td>Bank: {{ pr.bank_responsible }}<br>Pos: {{ pr.pos_responsible }}</td> <td>Bank: {{ pr.bank_responsible }}<br>Pos: {{ pr.pos_responsible }}</td>
<td>{{ pr.bank_start_hax }} HAX / {{ pr.bank_count_dkk_start }} DKK</td> <td>{{ pr.dkk_sales_izettle }} DKK</td>
<td>{{ pr.pos_start_hax }} HAX / {{ pr.pos_count_dkk_start }} DKK</td> <td class="text-right">
<td>{{ pr.bank_end_hax }} HAX / {{ pr.bank_count_dkk_end }} DKK</td> {{ pr.bank_count_dkk_start }}<br>
<td>{{ pr.pos_end_hax }} HAX / {{ pr.pos_count_dkk_end }} DKK</td> + {{ pr.dkk_sales_izettle }}<br>
- {{ pr.bank_count_dkk_end }}<br>
<b>= {{ pr.dkk_balance }}</b>
</td>
<td>{{ pr.pos_json_sales.1 }} HAX ({{ pr.pos_json_sales.0 }} tx)</td> <td>{{ pr.pos_json_sales.1 }} HAX ({{ pr.pos_json_sales.0 }} tx)</td>
<td>{{ pr.hax_sold_izettle }} HAX</td> <td>{{ pr.hax_sold_izettle }} HAX</td>
<td>{{ pr.hax_sold_website }} HAX</td> <td>{{ pr.hax_sold_website }} HAX</td>

View file

@ -55,6 +55,39 @@ PosReport {{ posreport.date }} {{ posreport.pos.name }} | Pos | BackOffice | {{
<th>All OK?</th> <th>All OK?</th>
<td>{{ posreport.allok | truefalseicon }}</p> <td>{{ posreport.allok | truefalseicon }}</p>
</tr> </tr>
<tr>
<th>DKK cash sales from iZettle</th>
<td>{{ posreport.dkk_sales_izettle }} DKK</td>
</tr>
<tr>
<th>DKK balance</th>
<td>
<table class="table table-condensed">
<tbody>
<tr>
<td class="text-right">&nbsp;</td>
<td class="text-right">{{ posreport.bank_count_dkk_start }} DKK</td>
<td>Bank start count</td>
</tr>
<tr>
<td class="text-right">-</td>
<td class="text-right">{{ posreport.dkk_sales_izettle }} DKK</td>
<td>DKK cash income through iZettle</td>
</tr>
<tr>
<td class="text-right">-</td>
<td class="text-right">{{ posreport.bank_count_dkk_end }} DKK</td>
<td>Returned to the bank at day end</td>
</tr>
<tr>
<td class="text-right">=</td>
<td class="text-right"><b>{{ posreport.dkk_balance }} DKK</b></td>
<td><b>Final balance.<br>Negative means the POS returned too many DKK, positive means the POS returned too few DKK.</b></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr> <tr>
<th>Hax Sold from iZettle</th> <th>Hax Sold from iZettle</th>
<td>{{ posreport.hax_sold_izettle }} HAX</td> <td>{{ posreport.hax_sold_izettle }} HAX</td>

View file

@ -0,0 +1,20 @@
# Generated by Django 3.1 on 2020-09-02 23:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("economy", "0017_posreport_hax_sold_website"),
]
operations = [
migrations.AddField(
model_name="posreport",
name="dkk_sales_izettle",
field=models.PositiveIntegerField(
default=0, help_text="The total DKK amount in iZettle cash sales"
),
),
]

View file

@ -555,6 +555,10 @@ class PosReport(CampRelatedModel, UUIDModel):
blank=True, help_text="Any comments about this PosReport", blank=True, help_text="Any comments about this PosReport",
) )
dkk_sales_izettle = models.PositiveIntegerField(
default=0, help_text="The total DKK amount in iZettle cash sales"
)
hax_sold_izettle = models.PositiveIntegerField( hax_sold_izettle = models.PositiveIntegerField(
default=0, help_text="The number of HAX sold through the iZettle from the POS", default=0, help_text="The number of HAX sold through the iZettle from the POS",
) )
@ -840,3 +844,16 @@ class PosReport(CampRelatedModel, UUIDModel):
balance -= self.bank_end_hax balance -= self.bank_end_hax
# all good # all good
return balance return balance
@property
def dkk_balance(self):
"""Return the DKK balance all things considered."""
balance = 0
# start with the bank count at the start of the day
balance += self.bank_count_dkk_start
# then add the iZettle sales for the day
balance += self.dkk_sales_izettle
# then substract what was returned to the bank at days end
balance -= self.bank_count_dkk_end
# all good
return balance