Skip to content

Some syntax issues? #24

@RaNo99

Description

@RaNo99

Hi @ncortines I tried running the script for 2020 tax year, and I had to change boolean compounds order at the beginning of processSaleDetails to:

        const saleDateString = sale.withdrawalDate || sale.order.uniqueFillDate
        return getExchangeRate(new Date(saleDateString))
            .then(sellExchangeRate => {
                const longTermCostTransactions = (sale.costBasis && sale.costBasis.longTerm && sale.costBasis.longTerm.rows) || []
                const shortTermCostTransactions = (sale.costBasis && sale.costBasis.shortTerm && sale.costBasis.shortTerm.rows) || []

because sale.order arrived undefined, and so did sale.costBasis. Not sure why.

Also, I'm getting Uncaught (in promise) TypeError: can't convert undefined to object in stringifyList. The stringified data is as follows:

0: "sales summary:"
​"1.0.date": "2020-08-06"
​"1.0.settlement date": "2020-08-10"
​"1.0.quantity": "0.00"
​"1.0.exchange rate": "3.71"
​"1.0.earnings usd": "0.00"
​"1.0.earnings pln": "0.00"
​"1.0.cost pln": "0.00"
​"1.0.fees usd": "50.05"
​"1.0.fees pln": "185.90"
​"1.0.cost + fees pln": "185.90"
​2: "total earnings pln (PIT-38 p. 22): 0.00"
​3: "total earnings cost (with fees) pln (PIT-38 p. 23): 666.66"
​4: "total profit pln (PIT/ZG p. 32): -666.66"
​5: "breakdown of sale from 2020-08-06:"
​7: "dividends summary:"
​"8.0.date": "2020-07-22"
​"8.0.exchange rate": "3.88"
​"8.0.amount usd": "66.66"
​"8.0.amount pln": "66.66"
​9: "total dividend earnings pln: 66.66"
​10: "total dividend 19% tax pln (PIT-38 p. 45): 66.66"
​11: "total dividend 15% (*) tax withhold (PIT-38 p. 46): 66.66"
​12: "(*) Assuming you filled in W-8BEN. Otherwise adjust this number"

I changed some sensitive data to "666"/"66", but what's also interesting is that the "total profit pln" field has a negative value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions