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

Function quickbooks_entry

plugins/bkpr/incomestmt.c:764–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

762}
763
764static 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
798const struct csv_fmt csv_fmts[] = {
799 {

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