Ejemplo n.º 1
0
        public static List <GLJournalEntrysInfo> GetCreditEntrys(List <String> lstAccounts, DateTime?startDate, DateTime?endDate, String strConditionQuery, bool isIncludeChildren)
        {
            List <GLJournalEntrysInfo> lstResults  = new List <GLJournalEntrysInfo>();
            GLAccountsController       accountCtrl = new GLAccountsController();

            foreach (String strAccNo in lstAccounts)
            {
                GLAccountsInfo accInfo = accountCtrl.GetObjectByNo(strAccNo) as GLAccountsInfo;
                if (accInfo != null)
                {
                    lstResults.AddRange(GetCreditEntrys(accInfo, startDate, endDate, strConditionQuery, isIncludeChildren));
                }
            }
            return(lstResults);
        }
Ejemplo n.º 2
0
        public static double GetAccountAmount(AccountType type, List <String> lstAccounts, DateTime?startDate, DateTime?endDate, String strConditionQuery, bool isIncludeChildren)
        {
            double debitTot  = 0;
            double creditTot = 0;

            GLAccountsController accountCtrl = new GLAccountsController();

            foreach (String strAccNo in lstAccounts)
            {
                GLAccountsInfo accInfo = accountCtrl.GetObjectByNo(strAccNo) as GLAccountsInfo;
                if (accInfo != null)
                {
                    debitTot  += GetDebitAmount(accInfo, startDate, endDate, strConditionQuery, isIncludeChildren);
                    creditTot += GetCreditAmount(accInfo, startDate, endDate, strConditionQuery, isIncludeChildren);
                }
            }

            if (type == AccountType.Debit)
            {
                return(debitTot - creditTot);
            }
            else if (type == AccountType.Credit)
            {
                return(creditTot - debitTot);
            }
            else
            {
                if (debitTot > creditTot)
                {
                    debitTot -= creditTot;
                    return(debitTot - creditTot);
                }
                else
                {
                    creditTot -= debitTot;
                    return(creditTot - debitTot);
                }
            }
        }