public void ShowHistory() { Cfhead dr = this.SelectRow; XtraDialogForm di = new XtraDialogForm(); di.CancelButton = new SimpleButton(); di.AutoSize = true; di.StartPosition = FormStartPosition.CenterParent; di.ShowInTaskbar = false; di.Text = "患者处方历史记录"; di.MaximizeBox = di.MinimizeBox = false; di.FormBorderStyle = FormBorderStyle.Fixed3D;; TableControl tc = new TableControl(dr); di.Controls.Add(tc); di.ShowDialog(); }
public TableControl(Cfhead dr) { InitializeComponent(); List <Cfhead> lst; if (string.IsNullOrEmpty(dr.did)) { lst = new CfheadManager().GetListByPatientAndAddress(dr.patient, dr.address); } else { lst = new CfheadManager().GetListByDid(dr.did); } this.gridControl1.DataSource = lst; Cfhead first = lst.First(); txtPatient.Text = first.patient; txtAge.Text = first.age; txtPhone.Text = first.phone.Replace(first.phone.Substring(4, 4), "****"); txtId.Text = string.IsNullOrEmpty(first.did)? "无": first.did.Replace(first.did.Substring(first.did.Length - 4, 4), "****"); txtAddress.Text = first.address; int tianShu = lst.Select(item => item.pid).Distinct().Count(); int ciShu = lst.Count(); double?price = lst.Select(item => item.totalprice).Sum(); lblXJ.Text = string.Format("处方数量:{0:N0}张,就诊天数:{1:N0}天,总金额:{2:N2}元", ciShu, tianShu, price); txtAddress.Size = new Size(400, 20); lblXJ.Size = new Size(400, 20); this.tableLayoutPanel1.SetColumnSpan(txtAddress, 2); this.tableLayoutPanel1.SetColumnSpan(lblXJ, 3); this.gridView1.OptionsView.ColumnAutoWidth = true; this.gridView1.FocusedRowChanged += ShowDetail; int index = lst.FindIndex(item => item.opertime == dr.opertime); System.Diagnostics.Debug.WriteLine(index.ToString()); if (index == 0) { LoadDetail(0); } else { gridView1.MoveBy(index); } }
public FyForm() { InitializeComponent(); InitFilterPanel(); FFVM = mvvmContext.GetViewModel <FyFormViewModel>(); mvvmContext.SetBinding(this.dateBegin, e => e.Text, "BeginTime"); mvvmContext.SetBinding(this.dateEnd, e => e.Text, "EndTime"); mvvmContext.SetBinding(this.txtDoctor, e => e.EditValue, "Doctor"); mvvmContext.SetBinding(this.txtPatient, e => e.EditValue, "Patient"); mvvmContext.SetBinding(this.gridControl1, e => e.DataSource, "cfhead"); mvvmContext.SetBinding(this.gridControl2, e => e.DataSource, "Dv"); mvvmContext.BindCommand <FyFormViewModel>(this.btnQuery, x => x.Query()); mvvmContext.BindCommand <FyFormViewModel>(this.btnImport, x => x.Import()); this.btnExportExcel.Click += (x, y) => { XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ShowGridLines = false, SheetName = "门诊处方汇总表", ShowPageTitle = DevExpress.Utils.DefaultBoolean.True, ShowTotalSummaries = DevExpress.Utils.DefaultBoolean.True, }; op.BandedLayoutMode = DevExpress.Export.BandedLayoutMode.LinearBandsAndColumns; this.gridControl2.ExportToXlsx(@"C:\Users\Lenovo\Desktop\处方明细汇总表.xlsx", op); }; mvvmContext.SetBinding(this.comDoctor, e => e.Text, "SelectDate"); mvvmContext.SetBinding(this.lblTotlprice, e => e.Text, "Huizong"); this.gridView1.FocusedRowChanged += (x, y) => { Cfhead obj; if (y.FocusedRowHandle < 0) { obj = null; } obj = this.gridView1.GetRow(y.FocusedRowHandle) as Cfhead; mvvmContext.GetViewModel <FyFormViewModel>().SelectRow = obj; // MessageBox.Show(obj.opertime); }; this.gridView1.RowClick += (s, e) => { if (e.Clicks == 2) { GridView gv = s as GridView; Cfhead dr = gv.GetRow(e.RowHandle) as Cfhead; XtraDialogForm di = new XtraDialogForm(); di.CancelButton = new SimpleButton(); di.AutoSize = true; di.StartPosition = FormStartPosition.CenterParent; di.ShowInTaskbar = false; di.Text = "患者处方历史记录"; di.MaximizeBox = di.MinimizeBox = false; di.FormBorderStyle = FormBorderStyle.Fixed3D;; TableControl tc = new TableControl(dr); di.Controls.Add(tc); di.ShowDialog(); } }; mvvmContext.BindCommand <FyFormViewModel>(this.btnDelete, x => x.DeleteRow()); this.gridView3.RowClick += (x, y) => { MessageBox.Show("hehe"); }; Init(); this.toggleSwitch1_Toggled(this.toggleSwitch1, new EventArgs()); }