private string saveData() { int year = Int32.Parse(Request.Form["year"]); int month = Int32.Parse(Request.Form["month"]); float num = float.Parse(Request.Form["num"]); string type = Request.Form["type"]; string sector = Request.Form["sector"]; string itemnm = ""; if (Int32.Parse(type) == 1) { itemnm = "FixedAssetsCost"; } else if (Int32.Parse(type) == 2) { itemnm = "FinancialCost"; } else if (Int32.Parse(type) == 3) { itemnm = "RdCost"; } else if (Int32.Parse(type) == 4) { itemnm = "HeadOfficeManageCost"; } else if (Int32.Parse(type) == 5) { itemnm = "IncomeTax"; } else if (Int32.Parse(type) == 6) { itemnm = "ValueAddedTax"; } else if (Int32.Parse(type) == 7) { itemnm = "AdditionalTax"; } else if (Int32.Parse(type) == 8) { itemnm = "StampTax"; } return(ItemSettingManage.saveOrUpdateFinancialData(year, month, itemnm, num, sector)); }
private string getSector() { JArray jArray = new JArray(); DataTable dt = ItemSettingManage.getSector(); int count = dt.Rows.Count; if (dt == null || count == 0) { return("出错"); } else { for (int i = 0; i < count; i++) { DataRow dr = dt.Rows[i]; JObject jObject = new JObject(); jObject.Add("sector", dr["Sector"].ToString()); jArray.Add(jObject); } } return(jArray.ToString()); }
public static string DataArchive(DataRow dataRow, int year, int month) { string feeDetail = dataRow["feedetail"].ToString(); string relatSector = dataRow["feearea"].ToString(); float money = float.Parse(dataRow["money"].ToString()); // 找到数据库中保存的报销项目 string feeAccount = ""; DataTable dt = getRelativeAccount(feeDetail); if (dt == null || dt.Rows.Count == 0) { return(""); } else { feeAccount = dt.Rows[0]["feeAccount"].ToString(); if ("开发费用金额".Equals(feeAccount)) { feeAccount = "DevelopmentCost"; } else if ("销售总监费用".Equals(feeAccount)) { feeAccount = "SalesDirectorCost"; } else if ("市场学术费".Equals(feeAccount)) { feeAccount = "MarketCost"; } else if ("市场调节基金".Equals(feeAccount)) { feeAccount = "MarketReadjustmentCost"; } else if ("区域中心费用".Equals(feeAccount)) { feeAccount = "RegionalCenterCost"; } else if ("区域中心费用VIP".Equals(feeAccount)) { feeAccount = "RegionalCenterVipCost"; } else if ("商务费用金额".Equals(feeAccount)) { feeAccount = "BusinessCost"; } else if ("产品发展基金".Equals(feeAccount)) { feeAccount = "ProductDevelopmentFundCost"; } else if ("实验费(TF)金额".Equals(feeAccount)) { feeAccount = "TfCost"; } } // 找到数据库中对应的盈利中心 string sector = ""; dt = getRelativeSector(relatSector); if (dt == null || dt.Rows.Count == 0) { return(""); } else { sector = dt.Rows[0]["sector"].ToString(); } DataTable oldMoneyDt = ItemSettingManage.getOldMoney(feeAccount, year, month, sector); float oldmoney = 0; if (oldMoneyDt != null && oldMoneyDt.Rows.Count != 0) { object feeAccountObj = oldMoneyDt.Rows[0][feeAccount]; if (feeAccountObj != null) { oldmoney = float.Parse(feeAccountObj.ToString()); } } SqlExceRes sqlRes = new SqlExceRes(ItemSettingInfoSrc.saveOrUpdateFinancialData(year, month, feeAccount, money + oldmoney, sector)); return(sqlRes.GetResultString("提交成功!", "提交失败", "提交失败")); }
private string dataArchive(DataRow dataRow, int year, int month) { return(ItemSettingManage.DataArchive(dataRow, year, month)); }
private string getData() { string sector = Request.Form["sector"]; // 区分是财务部还是人事部 //UserInfo user = (UserInfo)Session["user"]; UserInfo user = (UserInfo)Session["user"]; DataSet ds = UserInfoSrv.GetDepartmentPostList(user); JArray jArray = new JArray(); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows[0]["departmentId"] != null) { int departmentId = Int32.Parse(ds.Tables[0].Rows[0]["departmentId"].ToString()); DateTime time = DateTime.Now; DataTable table = ItemSettingManage.getData(time.Year, time.Month, sector); // 如果是财务部 if (departmentId == 1) { JObject jObject = new JObject(); jObject.Add("index", 1); jObject.Add("item", "固定资产分摊"); jObject = HandleEmptyJObject(jObject, "FixedAssetsCost", table); jArray.Add(jObject); jObject = new JObject(); jObject.Add("index", 2); jObject.Add("item", "财务费用金额"); jObject = HandleEmptyJObject(jObject, "FinancialCost", table); jArray.Add(jObject); jObject = new JObject(); jObject.Add("index", 3); jObject.Add("item", "研发费用金额"); jObject = HandleEmptyJObject(jObject, "RdCost", table); jArray.Add(jObject); jObject = new JObject(); jObject.Add("index", 4); jObject.Add("item", "总部管理费用"); jObject = HandleEmptyJObject(jObject, "HeadOfficeManageCost", table); jArray.Add(jObject); jObject = new JObject(); jObject.Add("index", 5); jObject.Add("item", "所得税"); jObject = HandleEmptyJObject(jObject, "IncomeTax", table); jArray.Add(jObject); jObject = new JObject(); jObject.Add("index", 6); jObject.Add("item", "增值税"); jObject = HandleEmptyJObject(jObject, "ValueAddedTax", table); jArray.Add(jObject); jObject = new JObject(); jObject.Add("index", 7); jObject.Add("item", "附加税"); jObject = HandleEmptyJObject(jObject, "AdditionalTax", table); jArray.Add(jObject); jObject = new JObject(); jObject.Add("index", 8); jObject.Add("item", "印花税"); jObject = HandleEmptyJObject(jObject, "StampTax", table); jArray.Add(jObject); } // 或者是人事部 else if (departmentId == 101) { JObject jObject = new JObject(); jObject.Add("index", 1); jObject.Add("item", "工资社保金额"); jObject.Add("num", 0); jArray.Add(jObject); } else { return("该用户权限不足"); } } else { return("查询数据为空"); } return(jArray.ToString()); }