private void toolStripButton1_Click(object sender, EventArgs e) { using (DataGridView dgv = new DataGridView()) { var c = this.PharmacyDatabaseService.GetRolewithModule().OrderBy(r => r.RoleName); var d = from i in c group i by i.RoleName into g let auths = g.Select(r => r.ModuleName) let authkeys = g.Select(r => r.ModuleAuthKey) select new Business.Models.RoleWithModuleModel { ModuleAuthKey = String.Join(",", authkeys), ModuleName = String.Join(",", auths), RoleName = g.FirstOrDefault().RoleName, RoleCode = g.FirstOrDefault().RoleCode, RoleDescription = g.FirstOrDefault().RoleDescription }; this.Controls.Add(dgv); dgv.Name = "RoleWithModule"; dgv.DataSource = d.ToList(); MyExcelUtls.DataGridview2Sheet(dgv, "岗位权限分配表"); } }
private void toolStripButton1_Click(object sender, EventArgs e) { using (DataGridView dgv = new DataGridView()) { this.Controls.Add(dgv); var c = this.PharmacyDatabaseService.GetRolewithUser().OrderBy(r => r.EmployeeName); var d = from i in c group i by i.EmployeeName into g let roles = g.Select(r => r.RoleName) let rolecode = g.Select(r => r.RoleCode) select new Business.Models.RoleWithUserModel { RoleName = String.Join(",", roles), EmployeeName = g.FirstOrDefault().EmployeeName, Password = g.FirstOrDefault().Password, RoleCode = String.Join(",", rolecode), RoleDescription = string.Empty, UserAcount = g.FirstOrDefault().UserAcount }; dgv.DataSource = d.OrderBy(r => r.EmployeeName).ToList(); dgv.AutoGenerateColumns = false; MyExcelUtls.DataGridview2Sheet(dgv, "员工岗位分配表"); } }
private void toolStripButton5_Click(object sender, EventArgs e) { if (this.dataGridView1.Rows.Count <= 0) { return; } MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "销售管理、税票费情况(" + DateTime.Now.ToLongDateString() + ")"); }
private void toolStripButton3_Click(object sender, EventArgs e) { if (this.dataGridView1.Rows.Count <= 0) { return; } MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "采购入库单"); }
private void toolStripButton1_Click_1(object sender, EventArgs e) { if (this.dataGridView1.Rows.Count <= 0) { return; } string s = this._order == null ? "" : this._order.DocumentNumber; MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "采购订单" + s); }
private void button2_Click(object sender, EventArgs e) { this.dataGridView1.EndEdit(); if (this.dataGridView1.Rows.Count <= 0) { MessageBox.Show("盘存数据为空!无导出数据!"); return; } MyExcelUtls.DataGridview2Sheet(this.dataGridView1, this.comboBox1.Text + "库存"); //Search(); }
//右键菜单事件 private void GetDrugInfo(int Method) { if (this.dgvMain.SelectedRows.Count <= 0) { return; } var c = this.dgvMain.SelectedRows[0].DataBoundItem as Business.Models.DrugInfoModel; DrugInfo di = this.PharmacyDatabaseService.GetDrugInfo(out msg, c.id); if (di == null) { return; } if (Method == 0) { UI.UserControls.ucGoodsInfo ucControl = new UserControls.ucGoodsInfo(di); Form f = new Form(); f.WindowState = FormWindowState.Normal; f.StartPosition = FormStartPosition.CenterScreen; f.Text = di.ProductGeneralName; f.AutoSize = true; f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; Panel p = new Panel(); p.AutoSize = true; p.Controls.Add(ucControl); f.Controls.Add(p); SetControls.SetControlReadonly(f, true); f.ShowDialog(); } if (Method == 1) { Forms.Approval.FormApprovalFlowCenter form = new Forms.Approval.FormApprovalFlowCenter(di, di.FlowID, false); form.ShowDialog(); } if (Method == 2) { MyExcelUtls.DataGridview2Sheet(this.dgvMain, "已锁定品种信息查询结果"); } }
public Form_OutInventoryCheck() { InitializeComponent(); #region 表格初始化和右键 this.dataGridView1.RowPostPaint += (s, e) => DataGridViewOperator.SetRowNumber(this.dataGridView1, e); this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; this.dataGridView1.ReadOnly = true; BaseRightMenu brm = new BaseRightMenu(this.dataGridView1); #endregion #region 控件事件 this.toolStripButton1.Click += (s, e) => GetData(); this.button1.Click += (s, e) => GetData(); this.toolStripButton2.Click += (s, e) => { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "出库复核查询结果"); }; this.button2.Click += (s, e) => { this.q = new DrugOutInventoryCheckQueryModel { DTF = DateTime.Now.Date, DTT = DateTime.Now.Date }; this.drugOutInventoryCheckQueryModelBindingSource.Clear(); this.drugOutInventoryCheckQueryModelBindingSource.Add(this.q); }; #endregion #region 绑定 this.drugOutInventoryCheckQueryModelBindingSource.Add(this.q); #endregion }
private void toolStripButton3_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "药品养护单"); }
private void toolStripButton2_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dgvDrugDetailList, "报损申请单" + DateTime.Now.Ticks); }
private void toolStripButton1_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, this.toolStripLabel1.Text); }
private void toolStripButton1_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dgvMain, "药品销售记录查询单"); }
public FormOrderReturnDetailIndex() { InitializeComponent(); BugsBox.Pharmacy.UI.Common.BaseRightMenu brm = new BugsBox.Pharmacy.UI.Common.BaseRightMenu(this.dataGridView1); brm.InsertMenuItem("导出查询结果", delegate() { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "销售品种退货记录"); }); brm.InsertMenuItem("查看销退详情", delegate() { if (this.dataGridView1.CurrentRow == null) { return; } var m = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.SalesOrderReturnDetailModel; var orderReturn = PharmacyDatabaseService.GetSalesOrderReturn(out msg, m.SalesOrderReturnId); using (FormSalesOrderReturn frm = new FormSalesOrderReturn(orderReturn)) { frm.ShowDialog(); } }); brm.InsertMenuItem("查看销售单", delegate() { if (this.dataGridView1.CurrentRow == null) { return; } var m = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.SalesOrderReturnDetailModel; SalesOrder so = this.PharmacyDatabaseService.GetSalesOrder(out msg, m.SalesOrderId); using (FormSalesOrderEdit frm = new FormSalesOrderEdit(so, true)) { frm.ShowDialog(); } }); Business.Models.SalesOrderReturnDetailQueryModel q = null; //初始化查询条件 Action InitQuery = () => { this.dateTimePicker1.Value = DateTime.Now.Date.AddDays(-3); this.dateTimePicker2.Value = DateTime.Now.Date; q = new Business.Models.SalesOrderReturnDetailQueryModel { DTF = this.dateTimePicker1.Value, DTT = this.dateTimePicker2.Value.AddDays(1) }; this.salesOrderReturnDetailQueryModelBindingSource.Clear(); this.salesOrderReturnDetailQueryModelBindingSource.Add(q); }; InitQuery(); #region 初始化表格控件 this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.ReadOnly = true; this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; this.dataGridView1.RowPostPaint += (s, e) => DataGridViewOperator.SetRowNumber(this.dataGridView1, e); this.dataGridView1.AllowUserToOrderColumns = true; #endregion #region 钮事件 this.toolStripButton1.Click += (s, e) => { this.Validate(); q.DTT = this.dateTimePicker2.Value.AddDays(1); q.DTF = this.dateTimePicker1.Value; var re = this.PharmacyDatabaseService.GetSalesOrderReturnDetailModels(q, out msg).ToList(); re.Add(new Business.Models.SalesOrderReturnDetailModel { ProductGeneralName = "合计", ReturnAmount = re.Sum(r => r.ReturnAmount), Price = re.Sum(r => decimal.Round(r.ReturnAmount * r.UnitPrice, 4)) }); this.dataGridView1.DataSource = re; this.dataGridView1.Columns["DrugInfoId"].Visible = false; this.dataGridView1.Columns["CreateTime"].Visible = false; this.dataGridView1.Columns["ReturnEmName"].Visible = false; this.dataGridView1.Columns["Id"].Visible = false; this.dataGridView1.Columns["SalesOrderId"].Visible = false; this.dataGridView1.Columns["SalesOrderReturnId"].Visible = false; Business.Models.SalesOrderReturnDetailModel m = new Business.Models.SalesOrderReturnDetailModel(); PropertyInfo[] pis = m.GetType().GetProperties(); foreach (PropertyInfo pi in pis) { int a = (pi.GetCustomAttributes(typeof(DataMemberAttribute), false)[0] as DataMemberAttribute).Order; if (a < 0) { continue; } this.dataGridView1.Columns[pi.Name].DisplayIndex = a; } }; this.toolStripButton2.Click += (s, e) => { InitQuery(); }; this.toolStripButton3.Click += (s, e) => { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "销售品种退货记录"); }; #endregion }
private void toolStripButton2_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "配送入库退货单查询结果"); }
public FormInstrumentsQuery() { InitializeComponent(); #region 右键支持 BaseForm.BasicInfoRightMenu cms = new BaseForm.BasicInfoRightMenu(this.dataGridView1); cms.InserMenu("查看医疗器械信息", delegate() { this.InstrumentDetailOpen(FormStatusEnum.Read); }); cms.InserMenu("修改医疗器械信息", delegate() { this.InstrumentDetailOpen(FormStatusEnum.Edit); }); cms.InserMenu("导出当前查询结果列表", delegate() { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "医疗器械信息查询结果列表"); }); cms.InserMenu("导出当前器械审批表", delegate() { var u = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.InstrumentsModel; byte[] b = this.PharmacyDatabaseService.GetUpdateFiles("ApprovalFiles\\医疗器械.doc").FirstOrDefault().bytes; using (System.IO.FileStream fs = new System.IO.FileStream("File", System.IO.FileMode.OpenOrCreate)) { fs.Write(b, 0, b.Length); fs.Close(); CreateWinWord cww = new CreateWinWord(); cww.Inst = u; if (cww.CreateWord(fs.Name, u.ProductGeneralName, 0)) { MessageBox.Show(u.ProductGeneralName + ":审批信息表导出成功!"); this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "导出首营医疗器械信息审批表成功!品种名称:" + u.ProductGeneralName); } else { this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "导出首营医疗器械信息审批表失败!品种名称:" + u.ProductGeneralName); } fs.Dispose(); } }); #endregion #region datagridview1事件 this.dataGridView1.AutoGenerateColumns = true; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowPostPaint += (sender, ex) => DataGridViewOperator.SetRowNumber((DataGridView)sender, ex); this.dataGridView1.CellMouseDoubleClick += (sender, e) => { if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } if (e.Button == System.Windows.Forms.MouseButtons.Left) { this.InstrumentDetailOpen(FormStatusEnum.Read); } }; #endregion #region 文本框键盘事件 this.textBox1.KeyDown += (sender, e) => { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter) { this.InstrumentsQuery(); } }; #endregion #region 分页控件事件 this.pagerControl1.DataPaging += pagerControl1_DataPaging; #endregion }
//ToolTip tooltip = new ToolTip //{ // AutoPopDelay = 3000, // UseAnimation = true, // UseFading = true, // InitialDelay = 500, // IsBalloon = true, // ReshowDelay = 500, // ToolTipTitle = "使用提示", // ToolTipIcon = ToolTipIcon.Info, //}; #endregion public FormRewardListDetails(SalesOrderForVATModel m) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterScreen; this.WindowState = FormWindowState.Maximized; var purchaseunit = this.PharmacyDatabaseService.GetPurchaseUnit(out msg, m.PurchaseUnitId); this.textBox2.Text = purchaseunit.Bank; var setting = AppClientContext.GetCurrentSalePriceControlRulesModel(); if (setting != null) { textBox1.Text = setting.SalesOrderDefaultTaxRate.DefaultTaxRate.ToString(); } this.dataGridView1.ReadOnly = true; this.dataGridView1.RowPostPaint += (s, e) => DataGridViewOperator.SetRowNumber(this.dataGridView1, e); this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; this.toolStripButton3.Enabled = false; var cellstyle = new DataGridViewCellStyle { BackColor = Color.Yellow, }; Action RefreshData = () => { var u = this.PharmacyDatabaseService.GetSalesOrderDetailForVATModels(m.Id, out msg); this.dataGridView1.DataSource = u.ToList(); this.dataGridView1.Columns["SalesOrderId"].Visible = false; this.dataGridView1.Columns["SalesOrderDetailId"].Visible = false; this.dataGridView1.Columns["VAT"].Visible = false; this.dataGridView1.Columns["Discount"].DefaultCellStyle = cellstyle; }; RefreshData(); this.toolStripButton1.Click += (s, e) => RefreshData(); this.button1.Click += (s, e) => { decimal vatrate; if (!decimal.TryParse(this.textBox1.Text.Trim(), out vatrate)) { MessageBox.Show("清单税率请填写数字"); textBox1.Focus(); return; } string bank = this.textBox2.Text.Trim(); var b = this.PharmacyDatabaseService.SaveVATCode(m.Id, string.Empty, string.Empty, vatrate, bank, out msg); MessageBox.Show(b ? "保存成功!" : msg); if (b) { RefreshData(); this.toolStripButton3.Enabled = true; } }; this.toolStripButton3.Click += (s, e) => { this.dataGridView1.EndEdit(); this.Validate(); var list = this.dataGridView1.DataSource as List <Business.Models.SalesOrderDetailForVATModel>; this.PharmacyDatabaseService.SaveVATForSalesOrderDetails(list.ToArray(), out msg); if (string.IsNullOrEmpty(msg)) { MessageBox.Show("保存成功!"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show(msg); } }; this.toolStripButton4.Click += (s, e) => { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, m.SaleOrderDocumentNumber + "劳务清单"); }; this.dataGridView1.CellEnter += (s, e) => { if (dataGridView1.Columns[e.ColumnIndex].Name == "Discount") { this.dataGridView1.ReadOnly = false; } else { this.dataGridView1.ReadOnly = true; } }; this.Shown += (s, e) => { }; }
private void toolStripbtnOutput_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "库存缺货单"); }
private void toolStripButton2_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, this.IsSupplyer ? "供货单位" : "客户单位" + "资质近效期列表"); }
private void button1_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "采购记录汇总"); }
private void toolStripButton4_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "采购、销售管理、税票统计结果"); }
private void button1_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "销售统计(" + dtFrom.Value.ToLongDateString() + "至:" + dtTo.Value.ToLongDateString() + ")"); }
private void toolStripButton1_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dgvOutInventory, "销售出库拣货复核查询结果"); }
//右键菜单事件 private void GetDrugInfo(int Method) { if (this.dataGridView1.SelectedRows.Count <= 0) { return; } var c = this.dataGridView1.SelectedRows[0].DataBoundItem as Business.Models.DrugInfoModel; DrugInfo di = this.PharmacyDatabaseService.GetDrugInfo(out msg, c.id); if (di == null) { return; } if (Method == 0) { UI.UserControls.ucGoodsInfo ucControl = new UserControls.ucGoodsInfo(di); Form f = new Form(); f.WindowState = FormWindowState.Normal; f.StartPosition = FormStartPosition.CenterScreen; f.Text = di.ProductGeneralName; f.AutoSize = true; f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; Panel p = new Panel(); p.AutoSize = true; p.Controls.Add(ucControl); f.Controls.Add(p); SetControls.SetControlReadonly(f, true); f.ShowDialog(); } if (Method == 1) { FormApprovalFlowCenter form = new FormApprovalFlowCenter(di, di.FlowID, false); form.ShowDialog(); } if (Method == 2) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "品种信息查询结果"); } if (Method == 3) { var u = this.dataGridView1.SelectedRows[0].DataBoundItem as Business.Models.DrugInfoModel; byte[] b = this.PharmacyDatabaseService.GetUpdateFiles("ApprovalFiles\\9047DBCF-CD15-4904-8786-006A76DD4799").FirstOrDefault().bytes; using (System.IO.FileStream fs = new System.IO.FileStream("File", System.IO.FileMode.OpenOrCreate)) { fs.Write(b, 0, b.Length); fs.Close(); CreateWinWord cww = new CreateWinWord(); cww.d = u; if (cww.CreateWord(fs.Name, u.ProductGeneralName, 2)) { MessageBox.Show(u.ProductGeneralName + ":审批信息表导出成功!"); this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "导出首营信息审批表成功!品种名称:" + di.ProductGeneralName); } else { this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "导出首营信息审批表失败!品种名称:" + di.ProductGeneralName); } fs.Dispose(); } } if (Method == 4) { var u = this.dataGridView1.SelectedRows[0].DataBoundItem as Business.Models.DrugInfoModel; Form_DrugQualityTrace frm = new Form_DrugQualityTrace(u.id, u.ProductGeneralName); frm.ShowDialog(); frm.Dispose(); } }
private void button2_Click(object sender, EventArgs e) { string msg = string.Empty; MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "可用库存表"); }
private void toolStripButton2_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dgvMain, "已锁定客户查询结果"); }
private void toolStripButton2_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView2, "直调销售单据" + DateTime.Now.Ticks.ToString()); }
private void toolStripButton2_Click(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, DateTime.Now.ToLongDateString() + "资质近效期列表"); }
private void toolStripButton1_Click_1(object sender, EventArgs e) { MyExcelUtls.DataGridview2Sheet(this.dgvDrugDetailList, "不合格药品申请"); }