Changeset - a135e71a4a31
[Not reviewed]
0 3 0
Brett Smith - 6 years ago 2018-09-28 12:31:24
brettcsmith@brettcsmith.org
nbpy2017: Handle complimentary tickets.

The conference is offering these to people who proposed talks this year.
3 files changed with 23 insertions and 20 deletions:
0 comments (0 inline, 0 general)
import2ledger/importers/nbpy2017.py
Show inline comments
...
 
@@ -84,4 +84,9 @@ class Invoice2017:
 
        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 - '):
 
                self.tickets_sold += 1
 
                if total > 0:
 
                    self.tickets_sold += 1
 
            elif description.startswith('T-Shirt - '):
...
 
@@ -90,4 +95,2 @@ class Invoice2017:
 
                self.ticket_rate = self.DISCOUNT_TICKET_RATE
 
            if qty:
 
                self.amount += strparse.currency_decimal(total)
 

	
tests/data/imports.yml
Show inline comments
...
 
@@ -240,5 +240,5 @@
 
      date: !!python/object/apply:datetime.date [2017, 9, 5]
 
      amount: !!python/object/apply:decimal.Decimal ["55.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["1"]
 
      ticket_rate: !!python/object/apply:decimal.Decimal ["21.25"]
 
      amount: !!python/object/apply:decimal.Decimal ["30.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["0"]
 
      ticket_rate: !!python/object/apply:decimal.Decimal ["42.50"]
 
      shirts_sold: !!python/object/apply:decimal.Decimal ["1"]
...
 
@@ -252,5 +252,5 @@
 
      date: !!python/object/apply:datetime.date [2017, 9, 5]
 
      amount: !!python/object/apply:decimal.Decimal ["55.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["1"]
 
      ticket_rate: !!python/object/apply:decimal.Decimal ["21.25"]
 
      amount: !!python/object/apply:decimal.Decimal ["30.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["0"]
 
      ticket_rate: !!python/object/apply:decimal.Decimal ["42.50"]
 
      shirts_sold: !!python/object/apply:decimal.Decimal ["1"]
tests/data/nbpy2017c.html
Show inline comments
...
 
@@ -174,6 +174,6 @@
 
          <tr>
 
            <td>Ticket - Unaffiliated Individual</td>
 
            <td>Ticket - Talk Proposer</td>
 
            <td class="text-right">1</td>
 
            <td class="text-right">$50.00</td>
 
            <td class="text-right">$50.00</td>
 
            <td class="text-right">$0.00</td>
 
            <td class="text-right">$0.00</td>
 
          </tr>
...
 
@@ -186,6 +186,6 @@
 
          <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">$-25.00</td>
 
            <td class="text-right">$-25.00</td>
 
            <td class="text-right">$-0.00</td>
 
            <td class="text-right">$-0.00</td>
 
          </tr>
...
 
@@ -193,3 +193,3 @@
 
          <th colspan="3">TOTAL</th>
 
          <td class="text-right">$55.00</td>
 
          <td class="text-right">$30.00</td>
 
        </tr>
...
 
@@ -197,3 +197,3 @@
 
      <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>
...
 
@@ -212,3 +212,3 @@
 
          <td colspan="3">Balance due:</td>
 
          <td class="text-right">$55.00</td>
 
          <td class="text-right">$30.00</td>
 
        </tr>
...
 
@@ -229,3 +229,3 @@
 
        <td>Paid with Stripe reference: ch_daer0ahwoh9oDeiqu2eimoD7</td>
 
        <td>55.00</td>
 
        <td>30.00</td>
 
      </tr>
...
 
@@ -234,3 +234,3 @@
 
        <td>Generated credit note 31</td>
 
        <td>-55.00</td>
 
        <td>-30.00</td>
 
      </tr>
0 comments (0 inline, 0 general)