コード例 #1
0
 //-------------------------------------------------------------------------------------------
 private List<Accounting_OFXLedgerItem> LoadCreditCardStatement(DateTime startAt, DateTime endAt)
 {
     Accounting_Accounts account = GetAccount();
        List<Accounting_OFXLedgerItem> items = new List<Accounting_OFXLedgerItem>();
        nsoftware.InEBank.Ccstatement statement = GetCreditCardStatement(account, startAt, endAt);
        for (int i = 0; i < statement.Transactions.Count; i++)
        {
             TransactionDetail detail = statement.Transactions[i];
             Accounting_OFXLedgerItem item = new Accounting_OFXLedgerItem();
             item.LedgerItem = new Accounting_LedgerItems();
             //string md5 = Weavver.Utilities.Common.MD5(detail.Date + detail.PayeeName + detail.Amount);
             item.LedgerItem.Id = Guid.NewGuid();
             item.LedgerItem.OrganizationId = OrganizationId;
             item.LedgerItem.AccountId = AccountId;
             item.LedgerItem.LedgerType = account.LedgerType;
             item.LedgerItem.ExternalId = detail.FITID;
             item.LedgerItem.PostAt = DateTime.Parse(detail.DatePosted).ToUniversalTime();
             //// statement.Transactions[i].TypeDescription: Credit/Debit
             item.LedgerItem.Memo = detail.PayeeName;
             if (detail.TxType == TTxTypes.ttCredit)
             {
                  item.LedgerItem.Code = CodeType.Payment.ToString();
             }
             else
             {
                  item.LedgerItem.Code = CodeType.Withdrawal.ToString();
             }
             item.LedgerItem.Amount = Convert.ToDecimal(statement.Transactions[i].Amount);
             items.Add(item);
        }
        return items;
 }
コード例 #2
0
        //-------------------------------------------------------------------------------------------
        private List<Accounting_OFXLedgerItem> LoadBankStatement(DateTime startDate, DateTime endDate)
        {
            Accounting_Accounts account = GetAccount();
               nsoftware.InEBank.Bankstatement statement = GetBankStatement(account, startDate, endDate);

               List<Accounting_OFXLedgerItem> items = new List<Accounting_OFXLedgerItem>();
               for (int i = 0; i < statement.Transactions.Count; i++)
               {
                    TransactionDetail detail = statement.Transactions[i];
                    Accounting_OFXLedgerItem item = new Accounting_OFXLedgerItem();
                    item.LedgerItem = new Accounting_LedgerItems();
                    item.LedgerItem.Id = Guid.NewGuid();
                    item.LedgerItem.OrganizationId = OrganizationId;
                    item.LedgerItem.AccountId = account.Id;
                    item.LedgerItem.LedgerType = account.LedgerType;
                    // Weavver.Utilities.Common.MD5(detail.Date + detail.PayeeName + detail.Amount);
                    item.LedgerItem.ExternalId = detail.FITID;
                    item.LedgerItem.PostAt = DateTime.Parse(detail.DatePosted).ToUniversalTime();
                    if (detail.Memo == "Withdrawal Draft")
                    {
                         item.CheckNumber = Convert.ToInt32(detail.CheckNumber);
                         item.LedgerItem.Memo = "Check #" + detail.CheckNumber; // converting removes leading zeroes
                         // later:
                         // cross reference the check number against #checks
                         // double check the amount matches
                         // link the transactions
                         // mark the check as cleared
                    }
                    else if (detail.TypeDescription == "Debit")
                    {
                         if (detail.Memo.Contains(detail.PayeeName))
                              item.LedgerItem.Memo = detail.Memo;
                         else
                              item.LedgerItem.Memo = detail.PayeeName + detail.Memo;
                    }
                    else if (detail.TypeDescription == "Credit")
                    {
                         if (statement.Transactions[i].Memo.Contains(detail.PayeeName))
                              item.LedgerItem.Memo = detail.Memo;
                         else
                              item.LedgerItem.Memo = detail.PayeeName + detail.Memo;
                    }
                    else if (detail.TxType == nsoftware.InEBank.TTxTypes.ttATM)
                    {
                         item.LedgerItem.Memo = detail.PayeeName;
                    }
                    else if (detail.TxType == nsoftware.InEBank.TTxTypes.ttCheck)
                    {
                         //BILL PAY CHECK
                         if (detail.PayeeName == "BILL PAY CHECK")
                         {
                              item.LedgerItem.Memo = "BILL PAY CHECK " + detail.CheckNumber;
                         }
                         else
                         {
                              item.LedgerItem.Memo = detail.TypeDescription + " " + detail.CheckNumber;
                         }
                         item.CheckNumber = Int32.Parse(detail.CheckNumber);
                    }
                    else
                    {
                         // a catch all
                         item.LedgerItem.Memo = detail.TypeDescription + " " + detail.CheckNumber;
                    }
                    item.LedgerItem.Amount = Convert.ToDecimal(detail.Amount);
                    if (item.LedgerItem.Amount < 0)
                    {
                         item.LedgerItem.Code = CodeType.Withdrawal.ToString();
                    }
                    else
                    {
                         item.LedgerItem.Code = CodeType.Deposit.ToString();
                    }

                    //row[4] = Accounting.MatchAndLog((DateTime)row[1], row[2].ToString(), (decimal)row[3]);

                    items.Add(item);
               }
               return items;
        }