示例#1
0
 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)
     });
 }
示例#2
0
 private MyobTransaction ToGstLine(CiviCrmFormat item)
 {
     return(new MyobTransaction
     {
         Date = item.Date,
         Memo = item.ContributionId,
         AccountNumber = item.FinancialAccountCodeCredit,
         IsCredit = "Y",
         Amount = item.Amount
     });
 }
示例#3
0
 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)
     });
 }
示例#4
0
        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}");
        }
示例#5
0
        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}");
        }
示例#6
0
        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);
        }