| 762 | } |
| 763 | |
| 764 | static void quickbooks_entry(const tal_t *ctx, FILE *csvf, struct income_event *ev) |
| 765 | { |
| 766 | /* "Make sure the dates are in one format. |
| 767 | * We recommend you use: dd/mm/yyyy." |
| 768 | * from: https://quickbooks.intuit.com/learn-support/global/bank-transactions/import-bank-transactions-using-excel-csv-files/00/381530 */ |
| 769 | time_t tv; |
| 770 | tv = ev->timestamp; |
| 771 | /* datefmt: dd/mm/yyyy */ |
| 772 | char timebuf[sizeof("dd/mm/yyyy")]; |
| 773 | strftime(timebuf, sizeof(timebuf), "%d/%m/%Y", gmtime(&tv)); |
| 774 | |
| 775 | /* New line! */ |
| 776 | fprintf(csvf, "\n"); |
| 777 | |
| 778 | fprintf(csvf, "%s", timebuf); |
| 779 | fprintf(csvf, ","); |
| 780 | |
| 781 | /* Description */ |
| 782 | fprintf(csvf, "%s (%s) %s: %s", |
| 783 | ev->tag, ev->acct_name, asset_type_name(), |
| 784 | ev->desc ? csv_safe_str(ev, ev->desc) : "no desc"); |
| 785 | fprintf(csvf, ","); |
| 786 | |
| 787 | /* Credit */ |
| 788 | if (!amount_msat_is_zero(ev->credit)) |
| 789 | fprintf(csvf, "%s", fmt_amount_msat_btc(ctx, ev->credit, false)); |
| 790 | |
| 791 | fprintf(csvf, ","); |
| 792 | |
| 793 | /* Debit */ |
| 794 | if (!amount_msat_is_zero(ev->debit)) |
| 795 | fprintf(csvf, "%s", fmt_amount_msat_btc(ctx, ev->debit, false)); |
| 796 | } |
| 797 | |
| 798 | const struct csv_fmt csv_fmts[] = { |
| 799 | { |
nothing calls this directly
no test coverage detected