Esempio n. 1
0
        public JsonResult GetFinanceConfig()
        {
            ResultInfo <List <PickerSelect> > info = new ResultInfo <List <PickerSelect> >()
            {
                IsSuccess = false
            };

            info.Data = FinanceConfigDBOperate.GetConfigDataByDepartId(CookieOperate.MemberCookie.DepartId);
            if (info.Data != null && info.Data.Count > 0)
            {
                info.IsSuccess = true;
            }
            return(Json(info));
        }
Esempio n. 2
0
        public static DataTable ConventImportDt(DataTable dt, CompanyUser admin)
        {
            DataTable newDt = new DataTable();

            #region 反射获得列名
            var            objType    = typeof(FinanceReport);
            PropertyInfo[] properties = objType.GetProperties();
            string[]       outColName = new string[] { "Id", "ModifyDate" };
            foreach (var item in properties)
            {
                var name = item.Name;
                if (outColName.Contains(name))
                {
                    continue;
                }
                newDt.Columns.Add(new DataColumn()
                {
                    ColumnName = item.Name
                });
            }
            #endregion

            //财务类别
            var list = FinanceConfigDBOperate.GetList("Report", admin.CompanyId);

            #region  数据处理
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr         = newDt.NewRow();
                string  Object     = dt.Rows[i][1].ToString();//科目
                var     objectName = list.FirstOrDefault(a => a.Value == Object);
                if (objectName == null)
                {
                    continue;
                }
                dr[0] = objectName.Id;                                  //报表编号类型
                dr[1] = Object;                                         //报表类型名称
                dr[2] = dt.Rows[i][2].ToString();                       //科目
                decimal money = CommonMethod.GetDecimal(dt.Rows[i][3]); //支出
                int     type  = 2;                                      //1收入 2支出
                if (money == 0)
                {                                                       //收入
                    type  = 1;
                    money = CommonMethod.GetDecimal(dt.Rows[i][4]);
                }
                dr[3]  = money.ToString();
                dr[4]  = type.ToString();
                dr[5]  = dt.Rows[i][7];//备注
                dr[6]  = admin.UserName;
                dr[7]  = CommonMethod.GetDateTime(dt.Rows[i][0]);
                dr[8]  = dt.Rows[i][5];//
                dr[9]  = dt.Rows[i][6];
                dr[10] = admin.CompanyId;
                dr[11] = DateTime.Now.ToString();
                dr[12] = "0";
                newDt.Rows.Add(dr);
            }
            #endregion

            return(newDt);
        }