public static List <IncomeStatistics> GetIncomeByPeriod(DateTime start, DateTime end) { try { SqlConnection con = DatabaseFactory.GetConnection(DatabaseFactory.SQL_TYPE_MSSQL).GetConnection(); List <IncomeStatistics> listIncSReturn = new List <IncomeStatistics>(); SqlCommand command = new SqlCommand(); command.Connection = con; command.CommandText = "Statistics_income"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@date_from", new System.Data.SqlTypes.SqlDateTime(start)); command.Parameters.AddWithValue("@date_to", new System.Data.SqlTypes.SqlDateTime(end)); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { //throw new Exception(reader.GetType().ToString()); IncomeStatistics incs = new IncomeStatistics(); incs.OrderDate = reader.GetDateTime(0); incs.DetailTotal = float.Parse(reader.GetValue(1).ToString()); listIncSReturn.Add(incs); } reader.Close(); return(listIncSReturn); } catch (Exception ex) { throw new Exception("Date Start or Date End wrong, please check again !!!!! "); } }
private async Task GetIncomeStatisticsSuccessed(GetIncomeStatisticsDataOutput output) { IncomeStatistics.Clear(); foreach (var item in output?.IncomeStatistics) { IncomeStatistics.Add(new AreaSeriesChart3DModel() { Date = item.Date, Amount = item.Amount }); } await Task.CompletedTask; }
/// <summary> /// 2门诊收入总额 /// </summary> /// <param name="sfyq">收费院区</param> //门诊收入总额 public List <IncomeStatistics> GetOutpatientIncome(DateTime startDateTime, DateTime endDateTime, String sfyq) { List <IncomeStatistics> list_income = new List <IncomeStatistics>(); String command = GetCommandForIncome(startDateTime, endDateTime, sfyq); DbCommand queryCommand = db.GetSqlStringCommand(command); using (IDataReader reader = db.ExecuteReader(queryCommand)) { while (reader.Read()) { IncomeStatistics income = new IncomeStatistics(); income.CashIncome = reader["CashIncome"] is DBNull ? 0 : Convert.ToInt64(reader["CashIncome"]); income.AccountingIncome = reader["AccountingIncome"] is DBNull ? 0 : Convert.ToInt64(reader["AccountingIncome"]); income.ReduceMoney = reader["ReduceMoney"] is DBNull ? 0 : Convert.ToInt64(reader["ReduceMoney"]); income.StoredConsumeMoney = reader["StoredConsumeMoney"] is DBNull ? 0 : Convert.ToInt64(reader["StoredConsumeMoney"]); income.CollectionMoney = reader["CollectionMoney"] is DBNull ? 0 : Convert.ToInt64(reader["CollectionMoney"]); list_income.Add(income); } } return(list_income); }