nbpy2017: Handle complimentary tickets.

The conference is offering these to people who proposed talks this year.
This commit is contained in:
Brett Smith 2018-09-28 08:31:24 -04:00
parent 4df5748a4f
commit a135e71a4a
3 changed files with 23 additions and 20 deletions

View file

@ -82,14 +82,17 @@ class Invoice2017:
self.shirts_sold = decimal.Decimal(0) self.shirts_sold = decimal.Decimal(0)
self.shirt_rate = self.STANDARD_SHIRT_RATE self.shirt_rate = self.STANDARD_SHIRT_RATE
for description, qty, unit_price, total in rows_text: for description, qty, unit_price, total in rows_text:
if qty is None:
continue
total = strparse.currency_decimal(total)
self.amount += total
if description.startswith('Ticket - '): if description.startswith('Ticket - '):
self.tickets_sold += 1 if total > 0:
self.tickets_sold += 1
elif description.startswith('T-Shirt - '): elif description.startswith('T-Shirt - '):
self.shirts_sold += 1 self.shirts_sold += 1
elif description.startswith('Early Bird ('): elif description.startswith('Early Bird ('):
self.ticket_rate = self.DISCOUNT_TICKET_RATE self.ticket_rate = self.DISCOUNT_TICKET_RATE
if qty:
self.amount += strparse.currency_decimal(total)
def _read_invoice_activity(self, table, first_row_text, rows_text): def _read_invoice_activity(self, table, first_row_text, rows_text):
self.actions = [{ self.actions = [{

View file

@ -238,9 +238,9 @@
- payee: Python Person C - payee: Python Person C
ledger template: nbpy2017 invoice ledger entry ledger template: nbpy2017 invoice ledger entry
date: !!python/object/apply:datetime.date [2017, 9, 5] date: !!python/object/apply:datetime.date [2017, 9, 5]
amount: !!python/object/apply:decimal.Decimal ["55.00"] amount: !!python/object/apply:decimal.Decimal ["30.00"]
tickets_sold: !!python/object/apply:decimal.Decimal ["1"] tickets_sold: !!python/object/apply:decimal.Decimal ["0"]
ticket_rate: !!python/object/apply:decimal.Decimal ["21.25"] ticket_rate: !!python/object/apply:decimal.Decimal ["42.50"]
shirts_sold: !!python/object/apply:decimal.Decimal ["1"] shirts_sold: !!python/object/apply:decimal.Decimal ["1"]
shirt_rate: !!python/object/apply:decimal.Decimal ["25.50"] shirt_rate: !!python/object/apply:decimal.Decimal ["25.50"]
status: Invoice status: Invoice
@ -250,9 +250,9 @@
- payee: Python Person C - payee: Python Person C
ledger template: nbpy2017 payment ledger entry ledger template: nbpy2017 payment ledger entry
date: !!python/object/apply:datetime.date [2017, 9, 5] date: !!python/object/apply:datetime.date [2017, 9, 5]
amount: !!python/object/apply:decimal.Decimal ["55.00"] amount: !!python/object/apply:decimal.Decimal ["30.00"]
tickets_sold: !!python/object/apply:decimal.Decimal ["1"] tickets_sold: !!python/object/apply:decimal.Decimal ["0"]
ticket_rate: !!python/object/apply:decimal.Decimal ["21.25"] ticket_rate: !!python/object/apply:decimal.Decimal ["42.50"]
shirts_sold: !!python/object/apply:decimal.Decimal ["1"] shirts_sold: !!python/object/apply:decimal.Decimal ["1"]
shirt_rate: !!python/object/apply:decimal.Decimal ["25.50"] shirt_rate: !!python/object/apply:decimal.Decimal ["25.50"]
status: Payment status: Payment

View file

@ -172,10 +172,10 @@
<th class="text-right">Total</th> <th class="text-right">Total</th>
</tr> </tr>
<tr> <tr>
<td>Ticket - Unaffiliated Individual</td> <td>Ticket - Talk Proposer</td>
<td class="text-right">1</td> <td class="text-right">1</td>
<td class="text-right">$50.00</td> <td class="text-right">$0.00</td>
<td class="text-right">$50.00</td> <td class="text-right">$0.00</td>
</tr> </tr>
<tr> <tr>
<td>T-Shirt - Men&#39;s/Straight Cut Size M</td> <td>T-Shirt - Men&#39;s/Straight Cut Size M</td>
@ -184,18 +184,18 @@
<td class="text-right">$30.00</td> <td class="text-right">$30.00</td>
</tr> </tr>
<tr> <tr>
<td>Early Bird (Ticket - Unaffiliated Individual)</td> <td>Tutorials - Notify me when tutorials are open</td>
<td class="text-right">1</td> <td class="text-right">1</td>
<td class="text-right">$-25.00</td> <td class="text-right">$-0.00</td>
<td class="text-right">$-25.00</td> <td class="text-right">$-0.00</td>
</tr> </tr>
<tr> <tr>
<th colspan="3">TOTAL</th> <th colspan="3">TOTAL</th>
<td class="text-right">$55.00</td> <td class="text-right">$30.00</td>
</tr> </tr>
<tr> <tr>
<td colspan="3">Includes donation eligible for tax deduction in the USA:</td> <td colspan="3">Includes donation eligible for tax deduction in the USA:</td>
<td class="text-right">$8.25</td> <td class="text-right">$4.25</td>
</tr> </tr>
</table> </table>
</div> </div>
@ -210,7 +210,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="3">Balance due:</td> <td colspan="3">Balance due:</td>
<td class="text-right">$55.00</td> <td class="text-right">$30.00</td>
</tr> </tr>
</table> </table>
</div> </div>
@ -227,12 +227,12 @@
<tr> <tr>
<td>Sept. 5, 2017, 9:14 p.m.</td> <td>Sept. 5, 2017, 9:14 p.m.</td>
<td>Paid with Stripe reference: ch_daer0ahwoh9oDeiqu2eimoD7</td> <td>Paid with Stripe reference: ch_daer0ahwoh9oDeiqu2eimoD7</td>
<td>55.00</td> <td>30.00</td>
</tr> </tr>
<tr> <tr>
<td>Sept. 8, 2017, 3:20 p.m.</td> <td>Sept. 8, 2017, 3:20 p.m.</td>
<td>Generated credit note 31</td> <td>Generated credit note 31</td>
<td>-55.00</td> <td>-30.00</td>
</tr> </tr>
</table> </table>
</div> </div>