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

Function quickbooks_entry

plugins/bkpr/incomestmt.c:790–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790static void quickbooks_entry(const tal_t *ctx, FILE *csvf, struct income_event *ev)
791{
792 /* "Make sure the dates are in one format.
793 * We recommend you use: dd/mm/yyyy."
794 * from: https://quickbooks.intuit.com/learn-support/global/bank-transactions/import-bank-transactions-using-excel-csv-files/00/381530 */
795 time_t tv;
796 tv = ev->timestamp;
797 /* datefmt: dd/mm/yyyy */
798 char timebuf[sizeof("dd/mm/yyyy")];
799 strftime(timebuf, sizeof(timebuf), "%d/%m/%Y", gmtime(&tv));
800
801 /* New line! */
802 fprintf(csvf, "\n");
803
804 fprintf(csvf, "%s", timebuf);
805 fprintf(csvf, ",");
806
807 /* Description */
808 fprintf(csvf, "%s (%s) %s: %s",
809 ev->tag, ev->acct_name, ev->currency,
810 ev->desc ? csv_safe_str(ev, ev->desc) : "no desc");
811 fprintf(csvf, ",");
812
813 /* Credit */
814 if (!amount_msat_zero(ev->credit))
815 fprintf(csvf, "%s", fmt_amount_msat_btc(ctx, ev->credit, false));
816
817 fprintf(csvf, ",");
818
819 /* Debit */
820 if (!amount_msat_zero(ev->debit))
821 fprintf(csvf, "%s", fmt_amount_msat_btc(ctx, ev->debit, false));
822}
823
824const struct csv_fmt csv_fmts[] = {
825 {

Callers

nothing calls this directly

Calls 3

csv_safe_strFunction · 0.85
amount_msat_zeroFunction · 0.85
fmt_amount_msat_btcFunction · 0.85

Tested by

no test coverage detected