ncortines / morgan-stanley-pl

MIT License
42 stars 8 forks source link

Unable to process ESSP-funded Sale records #23

Open ojablkach opened 1 year ago

ojablkach commented 1 year ago

Screenshot 2023-01-16 at 10 58 47 any idea why I get this after checking 2022 year?

ncortines commented 1 year ago

Uncaught ReferenceError: Footer is not defined

No idea about this. The script does not contain references to Footer. Have you modified the script?

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading "longTerm')

Something may have changed in the internal API and it seems to be affecting the processing of some Sale records. Unfortunately I'm not able to see this error using my account/data.

At lines 188 and 189:

const longTermCostTransactions = (sale.costBasis.longTerm && sale.costBasis.longTerm.rows) || []
const shortTermCostTransactions = (sale.costBasis.shortTerm && sale.costBasis.shortTerm.rows) || []

Seems like sale.costBasis is undefined. Could you please add at line 188 this line and run it again? (should be inserted before the two lines cited above)

console.info(JSON.stringify(sale, undefined, 2))

That console log should print one of more times. Please remove sensitive USD/PLN amounts data and send it over to me (or simply add it in a comment here)

The rest of the errors (GET...) are normal.

Thanks

ojablkach commented 1 year ago

same result after i added the line, footer dont know why it was there probably I copied something with the code its not showing any more

Screenshot 2023-01-16 at 13 09 26
ojablkach commented 1 year ago

this need to be at line 188 or 189 as on the screen as the explanation where to put it is misleading and I'm not a dev ;)

Screenshot 2023-01-16 at 13 19 33

ojablkach commented 1 year ago
{
  "bookValuePerUnit": {
    "amount": "129.377249",
    "currency": "USD"
  },
  "cashDeliveryInstructions": {
    "bankReference": {
      "accountHolderName": "-------",
      "deliveryMethodType": "CASH_WIRE",
      "mainSection": {
        "accountCurrency": "PLN",
        "accountNumber": "",
        "auBankBsbNumber": "",
        "bankBsbNumber": "",
        "bankName": "-----",
        "bankReferenceType": "EUR",
        "branchAddress": "------",
        "branchName": "XXX",
        "cdnBankFinNumber": "",
        "cdnTransitNumber": "",
        "domiciledCountry": "PL",
        "intlBankIbanNumber": "------",
        "memo": "",
        "nationalIdentifier": "",
        "sicCode": "",
        "swiftBicNumber": "PPABPLPK",
        "ukBankSortCode": "",
        "usBankAbaNumber": "",
        "zaBranchCode": ""
      },
      "subAccountHolderName": "",
      "subAccountHolderNumber": ""
    },
    "currencyControlMessage": "",
    "deliveryMethodLabel": "Transfer funds via wire (USD or Currency)",
    "digitalSharesIssued": false,
    "digitalSharesNotIssued": false,
    "disbursementDate": "2022-12-16",
    "drsAgentName": "",
    "drsIdentifierLabel": "",
    "drsIdentifierValue": "",
    "shouldMaskBrokerageAccountNumber": false,
    "transferToEsppSavingsPlanName": ""
  },
  "enteredDuringBlackout": false,
  "historical": false,
  "listItem": {
    "actionDescription": "",
    "awardNamePlural": "",
    "awardNameSingular": "",
    "awardTypeOrPlanNames": "Pegasystems ESPP",
    "createdInstant": "2022-12-13T13:44:00.741Z",
    "exchange": "NASDAQ",
    "fundCurrency": "USD",
    "fundPK": "31047501515",
    "fundType": "STOCK",
    "orderReferenceNumber": "DTB 02100",
    "proceedsSummaries": [
      {
        "moneyValue": {
          "amount": "1661.199997",
          "currency": "PLN"
        }
      }
    ],
    "quantity": "10.004",
    "realtimeTransactionPK": "358044281822",
    "referenceNumber": "WRC74BC1938-1EE",
    "savingsPlanPK": "127281947724",
    "settlementDate": "2022-12-15",
    "shareWithdrawal": false,
    "spfWithdrawalPKs": [
      "358046352459"
    ],
    "status": "COMPLETE",
    "statusCancelled": false,
    "statusComplete": true,
    "statusDescription": "Complete",
    "statusExpired": false,
    "statusPendingDistribution": false,
    "statusUnderReview": false,
    "symbol": "PEGA",
    "symbolDescription": "PEGA - NASDAQ",
    "transactionDate": "2022-12-13",
    "txApiType": "WITHDRAWAL_REALTIME_TRANSACTION",
    "txNoun": "Sale",
    "withdrawalQuantityType": "UNITS",
    "withdrawalType": "ADHOC"
  },
  "moneySources": [
    {
      "moneySource": "EE",
      "moneySourceLabel": "Employee",
      "quantity": "10.004",
      "quantityType": "UNITS",
      "quantityTypeDescription": "Units",
      "requestedWithdrawalQuantity": "10.004"
    }
  ],
  "order": [
    {
      "exchangeFriendlyTzShortName": "EST",
      "fillsIfNotTooMany": [
        {
          "fillDateTime": "2022-12-13T09:30:03",
          "fillPrice": {
            "amount": "38.18",
            "currency": "USD"
          },
          "fillQuantity": "10"
        },
        {
          "fillDateTime": "2022-12-13T09:30:03",
          "fillPrice": {
            "amount": "38.18",
            "currency": "USD"
          },
          "fillQuantity": "0.004"
        }
      ],
      "formattedSymbolAndExchange": "PEGA:NASDAQ",
      "goodTillCancel": true,
      "limitOrder": true,
      "limitPrice": {
        "amount": "36.6",
        "currency": "USD"
      },
      "orderDate": "2022-12-13",
      "orderQuantity": "10",
      "orderReferenceNumber": "DTB 02100",
      "orderStatusDescription": "Order is done",
      "orderSubType": "LIMIT_GOOD_TILL_CANCEL",
      "settlementDate": "2022-12-15",
      "totalFillQuantity": "10.004",
      "uniqueFillDate": "2022-12-13",
      "weightedAverageFillPrice": {
        "amount": "38.18",
        "currency": "USD"
      }
    }
  ],
  "planName": "Pegasystems ESPP",
  "realtimeTransactionPK": "358044281822",
  "referenceNumber": "WRC74BC1938-1EE",
  "settlementDate": "2022-12-15",
  "sharesForfeited": "0",
  "simpleFundInfo": {
    "cash": false,
    "currency": "USD",
    "exchange": "NASDAQ",
    "fundPK": "31047501515",
    "longName": "PEGA - NASDAQ",
    "privateStock": false,
    "shortName": "PEGA:NASDAQ",
    "unitBased": false
  },
  "status": "COMPLETE",
  "statusDescription": "Complete",
  "subTypeDescription": "",
  "summary": {
    "summarySold": {
      "companyProceeds": {
        "amount": "0",
        "currency": "USD"
      },
      "companyProceedsRatio": 0,
      "fees": {
        "amount": "0.01",
        "currency": "USD"
      },
      "feesRatio": 0.000026181437360911114,
      "grossProceeds": {
        "amount": "381.95",
        "currency": "USD"
      },
      "netProceeds": {
        "amount": "381.94",
        "currency": "USD"
      },
      "netProceedsRatio": 0.9999738185626391,
      "taxes": {
        "amount": "0",
        "currency": "USD"
      },
      "taxesRatio": 0
    }
  },
  "totalBookValue": {
    "amount": "1294.29",
    "currency": "USD"
  },
  "txApiType": "WITHDRAWAL_REALTIME_TRANSACTION",
  "txBreakdown": {
    "blocks": [
      {
        "headerText": "Breakdown",
        "headerTextSuffix": "",
        "maxFractionalDigitsForNumberFP": 3,
        "rows": [
          {
            "labelText": "Shares To Be Sold",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "DATA",
            "strongStyle": false,
            "valueMoneyIsPerUnitAmount": false,
            "valueNumberFP": "10.004"
          },
          {
            "labelText": "Market Price per Unit",
            "labelTextSuffix": "",
            "operatorText": "×",
            "rowType": "DATA",
            "strongStyle": false,
            "valueMoney": {
              "amount": "38.18",
              "currency": "USD"
            },
            "valueMoneyIsPerUnitAmount": true
          },
          {
            "labelText": "",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "LINE",
            "strongStyle": false,
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "Proceeds",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "DATA",
            "strongStyle": false,
            "valueMoney": {
              "amount": "381.95",
              "currency": "USD"
            },
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "Supplemental Transaction Fee",
            "labelTextSuffix": "",
            "operatorText": "-",
            "rowType": "DATA",
            "strongStyle": false,
            "valueMoney": {
              "amount": "0.01",
              "currency": "USD"
            },
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "LINE",
            "strongStyle": false,
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "Net Proceeds",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "DATA",
            "strongStyle": false,
            "valueMoney": {
              "amount": "381.94",
              "currency": "USD"
            },
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "Currency Conversion",
            "labelTextSuffix": "",
            "operatorText": "×",
            "rowType": "DATA",
            "strongStyle": false,
            "valueConversionRateOrFactor": 4.34937424,
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "LINE",
            "strongStyle": false,
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "Converted Net Proceeds",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "DATA",
            "strongStyle": true,
            "valueMoney": {
              "amount": "1661.199997",
              "currency": "PLN"
            },
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "LINE",
            "strongStyle": false,
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "Ordinary Income",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "DATA",
            "strongStyle": false,
            "valueMoney": {
              "amount": "194.06",
              "currency": "USD"
            },
            "valueMoneyIsPerUnitAmount": false
          },
          {
            "labelText": "Capital Gain or Loss",
            "labelTextSuffix": "",
            "operatorText": "",
            "rowType": "DATA",
            "strongStyle": false,
            "valueMoney": {
              "amount": "-912.04",
              "currency": "USD"
            },
            "valueMoneyIsPerUnitAmount": false
          }
        ]
      }
    ],
    "showAmountDue": false,
    "showCurrency": true
  },
  "typeDescription": "Ad Hoc",
  "withdrawalDate": "2022-12-13"
}
ncortines commented 1 year ago

Thanks for the screen share session :)

Seems like the problem is ESPP-funded sale records are missing the costBasis section, which is surprising.

We need to contact Morgan Stanley and ask them to include this information.

Without it, we won't be able to accurately report to the treasury department.

ncortines commented 1 year ago

Thanks for reaching out to Morgan Stanley.

To summarise, there is a way to get to the data, but it's a tedious manual process:

  1. Go to Portfolio
  2. Go to Share Purchase and Holdings
  3. Find Pegasystems ESSP and click details
  4. Find the Sale record and click on it to get a new report containing the missing Cost Basis information
ncortines commented 1 year ago

Latest information from MS is that they are not planning to fix the Sale report because it's too much of an effort.

RaNo99 commented 1 year ago

Thanks for reaching out to Morgan Stanley.

To summarise, there is a way to get to the data, but it's a tedious manual process:

1. Go to _Portfolio_

2. Go to _Share Purchase and Holdings_

3. Find _Pegasystems ESSP_ and click _details_

4. Find the _Sale_ record and click on it to get a new report containing the missing Cost Basis information

After clicking detals, I'm seeing two sections:

In which of these two do you see the Sale records? I don't see any. Maybe because I had sales only before 05-Mar-2022 and I don't know how to remove the time limitation for that section :(

ncortines commented 1 year ago

@RaNo99 I haven's joined ESPP program so I can't really help much other than relaying the instructions that @ojablkach got from MS.

ncortines commented 1 year ago

@RaNo99 these are the instructions I got from a different threat: