using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.UI.StatisticalInquiry { public partial class FrmStoredValueReport : LYFZ.ComponentLibrary.BaseContentsFormMain { public FrmStoredValueReport() { InitializeComponent(); this.UcNavigationTool.LabTitle = "储值卡统计表"; rdoDay.Click += rdoDay_Click; rdoMouth.Click += rdoMouth_Click; rdoYear.Click += rdoYear_Click; btnQuery.Click += btnQuery_Click; this.Load += FrmStoredValueReport_Load; dtpStart.ValueChanged += dtpStart_ValueChanged; dtpEnd.ValueChanged += dtpEnd_ValueChanged; } void dtpStart_ValueChanged(object sender, EventArgs e) { if(rdoDay.Checked) { dtpEnd.Value = dtpStart.Value; } else if(rdoMouth.Checked) { dtpStart.Value = new DateTime(dtpStart.Value.Year, dtpStart.Value.Month, 1); DateTime tempDateTime = new DateTime(dtpStart.Value.Year, dtpStart.Value.Month, 1); tempDateTime = tempDateTime.AddMonths(1); dtpEnd.Value = tempDateTime.AddDays(-1); } else if(rdoYear.Checked) { dtpStart.Value = new DateTime(dtpStart.Value.Year, 1, 1); dtpEnd.Value = new DateTime(dtpStart.Value.Year, 12, 31); } //btnQuery_Click(null, null); } void dtpEnd_ValueChanged(object sender, EventArgs e) { if (rdoDay.Checked) { dtpStart.Value = dtpEnd.Value; } else if (rdoMouth.Checked) { dtpStart.Value = new DateTime(dtpEnd.Value.Year, dtpEnd.Value.Month, 1); DateTime tempDateTime = new DateTime(dtpEnd.Value.Year, dtpEnd.Value.Month, 1); tempDateTime = tempDateTime.AddMonths(1); dtpEnd.Value = tempDateTime.AddDays(-1); } else if (rdoYear.Checked) { dtpStart.Value = new DateTime(dtpEnd.Value.Year, 1, 1); dtpEnd.Value = new DateTime(dtpEnd.Value.Year, 12, 31); } //btnQuery_Click(null, null); } void FrmStoredValueReport_Load(object sender, EventArgs e) { dtpStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); dtpEnd.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); rdoDay.Checked = true; } public virtual void btnQuery_Click(object sender, EventArgs e) { } void rdoYear_Click(object sender, EventArgs e) { dtpStart.Value = new DateTime(DateTime.Now.Year, 1, 1); dtpEnd.Value = new DateTime(DateTime.Now.Year, 12, 31); //btnQuery_Click(null, null); } void rdoMouth_Click(object sender, EventArgs e) { dtpStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); DateTime endDataTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); endDataTime = endDataTime.AddMonths(1); dtpEnd.Value = endDataTime.AddDays(-1); //btnQuery_Click(null, null); } void rdoDay_Click(object sender, EventArgs e) { dtpStart.Value = DateTime.Now; dtpEnd.Value = DateTime.Now; //btnQuery_Click(null, null); } } }