private MyobTransaction ToDebitLine(CiviCrmFormat item, CiviCrmFormat gst) { return(new MyobTransaction { Date = item.Date, Memo = item.ContributionId, AccountNumber = item.FinancialAccountCodeDebit, IsCredit = "N", Amount = CombinedTransactionAmount(item, gst) }); }
private MyobTransaction ToGstLine(CiviCrmFormat item) { return(new MyobTransaction { Date = item.Date, Memo = item.ContributionId, AccountNumber = item.FinancialAccountCodeCredit, IsCredit = "Y", Amount = item.Amount }); }
private MyobTransaction ToCreditLine(CiviCrmFormat transaction, CiviCrmFormat gst) { return(new MyobTransaction { Date = transaction.Date, Memo = transaction.ContributionId, AccountNumber = transaction.FinancialAccountCodeCredit, IsCredit = "Y", Amount = CombinedCreditTransactionAmount(transaction, gst) }); }
private string CombinedTransactionAmount(CiviCrmFormat transaction, CiviCrmFormat gst) { if (gst == null || (_gstAccounts.Contains(transaction.FinancialAccountCodeDebit) && _nonGstAccounts.Contains(transaction.FinancialAccountCodeCredit)) || string.Compare(transaction.FinancialType, "Donation", StringComparison.InvariantCultureIgnoreCase) == 0 ) { return(transaction.Amount); } var total = decimal.Parse(gst.Amount, NumberStyles.Currency) + decimal.Parse(transaction.Amount, NumberStyles.Currency); return($"{total:C2}"); }
private string CombinedCreditTransactionAmount(CiviCrmFormat transaction, CiviCrmFormat gst) { if (gst == null || !_gstForCreditAccounts.Contains(transaction.FinancialAccountCodeCredit)) { return(transaction.Amount); } var amount = decimal.Parse(transaction.Amount, NumberStyles.Currency); var intAmount = (int)amount; if (amount == intAmount) { return($"{amount:C2}"); } var total = decimal.Parse(gst.Amount, NumberStyles.Currency) + amount; return($"{total:C2}"); }
private CiviCrmFormat FindMatchingGstTransaction(List <CiviCrmFormat> gstTransactions, CiviCrmFormat transaction) { var gstTransaction = _gstAccounts.Contains(transaction.FinancialAccountCodeDebit) ? gstTransactions.FirstOrDefault(g => g.ContributionId == transaction.ContributionId && _gstAccounts.Contains(transaction.FinancialAccountCodeDebit)) : null; return(gstTransaction); }