MCPcopy Create free account
hub / github.com/ElementsProject/lightning / quickbooks_entry

Function quickbooks_entry

plugins/bkpr/incomestmt.c:767–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

asset_type_nameFunction · 0.85
csv_safe_strFunction · 0.85
amount_msat_is_zeroFunction · 0.85
fmt_amount_msat_btcFunction · 0.85

Tested by

no test coverage detected