/// <summary> /// /// </summary> /// <param name="modelType">1:交班 2:日结</param> /// <param name="recordId"></param> public FormSalesReport(int modelType, object recordId) { InitializeComponent(); this.lbWeather.Visible = false; this.cmbWeather.Visible = false; this.dgvSalesReport.BackgroundColor = SystemColors.ButtonFace; m_ModelType = modelType; if (modelType == 1) { btnSalesReport.Text = "交班"; btnSalesReport.Enabled = false; btnSalesReport.BackColor = ConstantValuePool.DisabledColor; this.Text = "交班报表"; Guid handoverRecordId = recordId == null ? Guid.Empty : (Guid)recordId; bizReport = BusinessReportService.GetInstance().GetReportDataByHandoverRecordId(handoverRecordId); } else if (modelType == 2) { btnSalesReport.Text = "日结"; btnSalesReport.Enabled = false; btnSalesReport.BackColor = ConstantValuePool.DisabledColor; this.Text = "日结报表"; string dailyStatementNo = recordId.ToString(); bizReport = BusinessReportService.GetInstance().GetReportDataByDailyStatement(dailyStatementNo); } }
protected void btnGetReportsByTaxRatesBetweenDates_Click(object sender, EventArgs e) { this.ReportViewerTaxRateWise.ProcessingMode = ProcessingMode.Local; this.ReportViewerTaxRateWise.LocalReport.ReportPath = base.Server.MapPath("~/Reports/rpt_GetAllTaxesTaxRateWise.rdlc"); try { DataSetInvoice invoice = BusinessReport.GetInvoiceDatesAllByTaxRate("usp_GetAllTaxesGroupByTaxRates", DateTime.Parse(this.txtFromDate.Text.ToString()), DateTime.Parse(this.txtToDate.Text.ToString())); if (invoice.Tables[1].Rows.Count > 0) { ReportDataSource item = new ReportDataSource("DataSetInvoice", invoice.Tables[1]); this.ReportViewerTaxRateWise.LocalReport.DataSources.Clear(); this.ReportViewerTaxRateWise.LocalReport.DataSources.Add(item); } else { ReportDataSource item = new ReportDataSource("DataSetInvoice", invoice.Tables[1]); this.ReportViewerTaxRateWise.LocalReport.DataSources.Clear(); this.ReportViewerTaxRateWise.LocalReport.DataSources.Add(item); this.alertDanger.Visible = true; this.lblDanger.Text = "No Report Content!"; } } catch (Exception exception) { this.lblDanger.Text = exception.Message; } }
/// <summary> /// 获取日结营业额统计 /// </summary> /// <param name="dailyStatementNo">日结号</param> /// <returns></returns> public BusinessReport GetReportDataByDailyStatement(string dailyStatementNo) { const int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.DAILY_STATEMENT_NO; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_REPORTDATABYDAILYSTATEMENT), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //dailyStatementNo byte[] tempByte = Encoding.UTF8.GetBytes(dailyStatementNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DAILY_STATEMENT_NO; BusinessReport bizReport = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); bizReport = JsonConvert.DeserializeObject <BusinessReport>(strReceive); } socket.Close(); } return(bizReport); }
/// <summary> /// 获取日结营业额统计 /// </summary> public static byte[] GetReportDataByDailyStatement(byte[] itemBuffer) { byte[] objRet = null; string dailyStatementNo = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.DAILY_STATEMENT_NO).Trim('\0'); BusinessReport bizReport = BusinessReportService.GetInstance().GetReportDataByDailyStatement(dailyStatementNo); if (bizReport == null) { //数据获取失败 objRet = new byte[ParamFieldLength.PACKAGE_HEAD]; Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32); Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32); } else { string json = JsonConvert.SerializeObject(bizReport); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length; objRet = new byte[transCount]; Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32); Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32); Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length); } return(objRet); }
/// <summary> /// 获取营业额统计 /// </summary> public static byte[] GetReportDataByHandoverRecordID(byte[] itemBuffer) { byte[] objRet = null; string handoverRecordId = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.HANDOVER_RECORD_ID).Trim('\0'); BusinessReport bizReport = null; if (!string.IsNullOrEmpty(handoverRecordId)) { bizReport = BusinessReportService.GetInstance().GetReportDataByHandoverRecordId(new Guid(handoverRecordId)); } if (bizReport == null) { //数据获取失败 objRet = new byte[ParamFieldLength.PACKAGE_HEAD]; Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32); Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32); } else { string json = JsonConvert.SerializeObject(bizReport); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length; objRet = new byte[transCount]; Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32); Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32); Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length); } return(objRet); }
public override global::System.Data.DataSet Clone() { BusinessReport cln = ((BusinessReport)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { BusinessReport ds = new BusinessReport(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
/// <summary> /// /// </summary> /// <param name="modelType">1:交班 2:日结</param> public FormSalesReport(int modelType) { InitializeComponent(); this.dgvSalesReport.BackgroundColor = SystemColors.ButtonFace; m_ModelType = modelType; if (modelType == 1) { this.lbWeather.Visible = false; this.cmbWeather.Visible = false; btnSalesReport.Text = "交班"; this.Text = "交班报表"; bizReport = BusinessReportService.GetInstance().GetReportDataByHandover(ConstantValuePool.BizSettingConfig.DeviceNo); } else if (modelType == 2) { this.cmbWeather.SelectedIndex = 0; btnSalesReport.Text = "日结"; this.Text = "日结报表"; bizReport = BusinessReportService.GetInstance().GetReportDataByDailyStatement(string.Empty); } }
/// <summary> /// 获取营业额统计 /// </summary> /// <param name="deviceNo">设备号</param> /// <returns></returns> public BusinessReport GetReportDataByHandover(string deviceNo) { BusinessReport reportData = null; try { _daoManager.OpenConnection(); //日结 string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo(); if (!string.IsNullOrEmpty(dailyStatementNo)) { BusinessReport businessReport = _businessReportDao.GetTurnoverByHandover(dailyStatementNo, deviceNo); int workSequence = businessReport.WorkSequence; IList <OrderDiscountSum> orderDiscountSumList = _businessReportDao.GetOrderDiscountSumByHandover(dailyStatementNo, workSequence); IList <OrderPayoffSum> orderPayoffSumList = _businessReportDao.GetOrderPayoffSumByHandover(dailyStatementNo, workSequence); IList <ItemsPrice> itemsPriceList = _businessReportDao.GetItemsPriceByHandover(dailyStatementNo, workSequence); IList <SalesPriceByDepart> priceByDepartList = new List <SalesPriceByDepart>(); if (itemsPriceList.Count > 0) { string curDepartName = itemsPriceList[0].DepartName; decimal totalDepartPrice = 0; decimal totalItemsNum = 0; IList <ItemsPrice> tempItemsPriceList = new List <ItemsPrice>(); foreach (ItemsPrice item in itemsPriceList) { if (item.DepartName != curDepartName) { SalesPriceByDepart salesPrice = new SalesPriceByDepart(); salesPrice.DepartName = curDepartName; salesPrice.TotalDepartPrice = totalDepartPrice; salesPrice.TotalItemsNum = totalItemsNum; salesPrice.ItemsPriceList = tempItemsPriceList; priceByDepartList.Add(salesPrice); curDepartName = item.DepartName; totalDepartPrice = item.ItemsTotalPrice; totalItemsNum = item.ItemsTotalQty; tempItemsPriceList = new List <ItemsPrice>(); } else { totalDepartPrice += item.ItemsTotalPrice; totalItemsNum += item.ItemsTotalQty; } tempItemsPriceList.Add(item); } SalesPriceByDepart tempSalesPrice = new SalesPriceByDepart { DepartName = curDepartName, TotalDepartPrice = totalDepartPrice, TotalItemsNum = totalItemsNum, ItemsPriceList = tempItemsPriceList }; priceByDepartList.Add(tempSalesPrice); } reportData = new BusinessReport { WorkSequence = businessReport.WorkSequence, LastHandoverTime = businessReport.LastHandoverTime, TotalRevenue = businessReport.TotalRevenue, CutOffTotalPrice = businessReport.CutOffTotalPrice, DiscountTotalPrice = businessReport.DiscountTotalPrice, ActualTotalIncome = businessReport.ActualTotalIncome, TotalServiceFee = businessReport.TotalServiceFee, BillTotalQty = businessReport.BillTotalQty, PeopleTotalNum = businessReport.PeopleTotalNum, orderDiscountSumList = orderDiscountSumList, orderPayoffSumList = orderPayoffSumList, salesPriceByDepartList = priceByDepartList }; } } catch (Exception exception) { reportData = null; LogHelper.GetInstance().Error("[GetReportDataByHandover]参数:deviceNo_" + deviceNo, exception); } finally { _daoManager.CloseConnection(); } return(reportData); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); BusinessReport ds = new BusinessReport(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "BusinessReportDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public async Task <ActionResult <IEnumerable <BusinessReport> > > GetBusinessAverageForCompany(int id) { List <BusinessReport> listCC = new List <BusinessReport>(); BusinessReport br = new BusinessReport(); var cc = context.Carcompanies.Include(x => x.Cars).ToList().SingleOrDefault(x => x.Id == id).Cars.ToList(); int brojAutomobila = cc.Count(); var idCompany = cc[0].CarCompany.Id; var rez = context.ReservationCar.ToList(); DateTimeFormatInfo mfi = new DateTimeFormatInfo(); List <ReservationCar> listReservationDay = new List <ReservationCar>(); List <ReservationCar> listReservationWeek = new List <ReservationCar>(); List <ReservationCar> listReservationMonth = new List <ReservationCar>(); var danasnjiDatum = DateTime.Now; var dt = DateTime.Now.DayOfWeek; DateTime startOfWeek = danasnjiDatum.AddDays(1 - (int)danasnjiDatum.DayOfWeek); DateTime endOfWeek = startOfWeek.AddDays(4); var mesec = danasnjiDatum.Month; var nazivMeseca = mfi.GetMonthName(mesec).ToString(); int rezDan = 0; int rezMesec = 0; var nedeljaTrenutna = CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Monday); foreach (var pom in rez) { var nedelja = CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(pom.Day1, CalendarWeekRule.FirstDay, DayOfWeek.Monday); if (nedelja == nedeljaTrenutna) { listReservationWeek.Add(pom); } if (DateTime.Compare(danasnjiDatum.Date, pom.Day1.Date) == 0) { listReservationDay.Add(pom); } else if (DateTime.Compare(danasnjiDatum.Date, pom.Day1.Date) > 0) { if (DateTime.Compare(danasnjiDatum.Date, pom.Day1.Date) <= 0) { listReservationDay.Add(pom); } } if (mesec == pom.Day1.Month) { listReservationMonth.Add(pom); } } var companyListDay = listReservationDay.FindAll(x => x.IdCompany == idCompany.ToString()); var companyListMonth = listReservationMonth.FindAll(x => x.IdCompany == idCompany.ToString()); var companyListWeek = listReservationWeek.FindAll(x => x.IdCompany == idCompany.ToString()); br.ratingPerDay = companyListDay.Count().ToString(); string[] parsiraj = danasnjiDatum.ToString().Split(" "); br.Today = parsiraj[0]; br.ratingPerMonth = companyListMonth.Count().ToString(); br.Month = nazivMeseca; br.ratingPerWeek = listReservationWeek.Count().ToString(); br.StartDayOdWeek = startOfWeek.ToString().Split(" ")[0]; br.EndDayOdWeek = endOfWeek.ToString().Split(" ")[0]; br.CarsCount = brojAutomobila.ToString(); listCC.Add(br); return(listCC); }
public async Task <ActionResult <IEnumerable <BusinessReport> > > GetBusinessReportForAircompany(int id) { List <BusinessReport> retVal = new List <BusinessReport>(); BusinessReport br = new BusinessReport(); var flights = context.Aircompanies.Include(x => x.Flights).SingleOrDefault(x => x.Id == id).Flights.ToList(); int noFlights = flights.Count(); var idCompany = id; var reservations = context.FlightReservations.ToList(); reservations.RemoveAll(x => !flights.Any(p => p.Id == x.FlightId)); DateTimeFormatInfo mfi = new DateTimeFormatInfo(); List <FlightReservation> listReservationDay = new List <FlightReservation>(); List <FlightReservation> listReservationWeek = new List <FlightReservation>(); List <FlightReservation> listReservationMonth = new List <FlightReservation>(); var danasnjiDatum = DateTime.Now; var dt = DateTime.Now.DayOfWeek; DateTime startOfWeek = danasnjiDatum.AddDays(1 - (int)danasnjiDatum.DayOfWeek); DateTime endOfWeek = startOfWeek.AddDays(4); var mesec = danasnjiDatum.Month; var nazivMeseca = mfi.GetMonthName(mesec).ToString(); int rezDan = 0; int rezMesec = 0; var nedeljaTrenutna = CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Monday); foreach (var pom in reservations) { Flight f = context.Flights.SingleOrDefault(x => x.Id == pom.FlightId); var nedelja = CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(f.TakeOff, CalendarWeekRule.FirstDay, DayOfWeek.Monday); if (nedelja == nedeljaTrenutna) { listReservationWeek.Add(pom); } if (DateTime.Compare(danasnjiDatum.Date, f.TakeOff.Date) == 0) { listReservationDay.Add(pom); } else if (DateTime.Compare(danasnjiDatum.Date, f.TakeOff.Date) > 0) { if (DateTime.Compare(danasnjiDatum.Date, f.TakeOff.Date) <= 0) { listReservationDay.Add(pom); } } if (mesec == f.TakeOff.Month) { listReservationMonth.Add(pom); } } br.ratingPerDay = listReservationDay.Count().ToString(); string[] parsiraj = danasnjiDatum.ToString().Split(" "); br.Today = parsiraj[0]; br.ratingPerMonth = listReservationDay.Count().ToString(); br.Month = nazivMeseca; br.ratingPerWeek = listReservationWeek.Count().ToString(); br.StartDayOdWeek = startOfWeek.ToString().Split(" ")[0]; br.EndDayOdWeek = endOfWeek.ToString().Split(" ")[0]; br.CarsCount = noFlights.ToString(); retVal.Add(br); return(retVal); }