示例#1
0
 /// <summary>
 /// 作用:验证该笔账单是否是时间范围内
 /// 作者:汪建龙
 /// 编写时间:2016年11月22日10:03:06
 /// </summary>
 /// <param name="billone"></param>
 /// <param name="year"></param>
 /// <param name="month"></param>
 /// <returns></returns>
 public static bool CheckTime(BillOne billone, int year, int month)
 {
     if (billone == null || year == 0 || month == 0)
     {
         return(false);
     }
     if (billone.Time.HasValue)
     {
         if (billone.Time.Value.Year == year && billone.Time.Value.Month == month)
         {
             return(true);
         }
     }
     return(false);
 }
示例#2
0
        /// <summary>
        /// 作用:比较两个对账记录逻辑-评估公司银行
        /// 作者:汪建龙
        /// 编写时间:2016年11月16日15:40:58
        /// </summary>
        /// <param name="billOne"></param>
        /// <param name="pre"></param>
        /// <returns></returns>
        public static bool CheckLogic(BillOne billOne, BillOne pre)
        {
            if (billOne == null || pre == null)
            {
                return(false);
            }

            if (billOne.SerialNumber == (pre.SerialNumber + 1))//验证序号前后是否递增
            {
                //验证账户余额 前后收支一致
                if (billOne.Budget == Budget.Income && Math.Abs(pre.Balance + billOne.Money - billOne.Balance) < 0.01)//当收入时,上一笔余额+当前金额=当前余额
                {
                    return(true);
                }
                else if (billOne.Budget == Budget.Expense && Math.Abs(pre.Balance - billOne.Money - billOne.Balance) < 0.01) //当支出时,上一笔余额-当前金额=当前余额
                {
                    return(true);
                }
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// 作用:分析获得BillOne对象实例
        /// 作者:汪建龙
        /// 编写时间:2016年11月12日17:30:26
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private static BillOne Analyze(IRow row)
        {
            if (row == null)
            {
                return(null);
            }
            var array = GetCellValue(row, CurrentHead.Length);

            var a     = 0;
            var b     = .0;
            var entry = new BillOne {
                SerialNumber = int.TryParse(array[0], out a) ? a : 0,
                Date         = array[1],
                Time         = GetDateTime(array[1]),
                Voucher      = array[3],
                Balance      = double.TryParse(array[6], out b) ? b : .0,
                CounterPart  = array[7],
                Account      = array[8],
                Summary      = array[9],
                Remark       = array[10]
            };

            if (string.IsNullOrEmpty(array[4]))
            {
                if (!string.IsNullOrEmpty(array[5]))
                {
                    entry.Budget = Budget.Income;
                    entry.Money  = double.TryParse(array[5], out b) ? b : .0;
                }
            }
            else
            {
                entry.Budget = Budget.Expense;
                entry.Money  = double.TryParse(array[4], out b) ? b : .0;
            }

            return(entry);
        }