public FormPurchaseHistoryBySupplyer()
        {
            InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
            this.dataGridView1.RowPostPaint       += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); };

            dtpf.Value = DateTime.Now.AddMonths(-3).Date;
            dtpt.Value = DateTime.Now.Date;
            this.toolStrip1.Items.Insert(5, new ToolStripControlHost(dtpf));
            this.toolStrip1.Items.Insert(7, new ToolStripControlHost(dtpt));
            cms = new Pharmacy.UI.Common.BaseRightMenu(this.dataGridView1);
            cms.InsertMenuItem("查询选中供货商", SupplyStatic);
            cms.InsertMenuItem("采购品种汇总", DrugStatic);
            cms.InsertMenuItem("全部显示", ShowAll);
            cms.InsertMenuItem("统计该药品购销情况", SupplyAndSale);
            cms.InsertMenuItem("abc", GetAbc);
        }
        public FormWareHouseZonePosition()
        {
            InitializeComponent();

            #region 右键打印单条货位条码
            RightMenu = new Pharmacy.UI.Common.BaseRightMenu(this.dataGridView1);
            RightMenu.InsertMenuItem("打印该货位的条码", delegate()
            {
                var re = MessageBox.Show("需要打印该行货位条码码?", "提示", MessageBoxButtons.OKCancel);
                if (re == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }

                if (!System.IO.File.Exists("resources\\名称.lbx"))
                {
                    MessageBox.Show("条码打印模板文件不存在,请增加一个!");
                    return;
                }

                bpac.DocumentClass doc = new DocumentClass();

                doc.Open("resources\\名称.lbx");

                Business.Models.WareHouseZonePositionModel m = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.WareHouseZonePositionModel;
                doc.GetObject("Title").Text = m.WareHouseZoneName + "  " + m.Name;
                doc.SetBarcodeData(0, m.BarCode);
                doc.StartPrint("", PrintOptionConstants.bpoDefault);
                doc.PrintOut(1, PrintOptionConstants.bpoDefault);

                doc.EndPrint();
                doc.Close();
            });
            #endregion

            this.EleModel = SearialiserHelper <Ele_Lab> .DeSerializeFileToObj("EleSetup.bin");

            if (this.EleModel.IsEnabled)
            {
                if (elelab.unart_manage.com_manage.FirstOrDefault() == null)
                {
                    int[] ss = new int[] { int.Parse(this.EleModel.PortName.Substring(3)) };
                    elelab.unart_manage.init_com_sys(ss);
                }
            }
            this.button2.Visible = this.EleModel.IsEnabled;

            this.dataGridView1.RowPostPaint       += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); };
            this.dataGridView1.ReadOnly            = true;
            this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            #region 插入仓库数据到combo和事件
            this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox2.DropDownStyle = ComboBoxStyle.DropDownList;

            var w = this.PharmacyDatabaseService.AllWarehouses(out msg).Where(r => r.Deleted == false).OrderBy(r => r.Name).ToList();
            w.Insert(0, new Models.Warehouse
            {
                Name = "全部",
                Id   = Guid.Empty,
            });
            this.comboBox1.ValueMember   = "Id";
            this.comboBox1.DisplayMember = "Name";
            this.comboBox1.DataSource    = w;
            this.comboBox1.SelectedIndex = 0;

            var wz  = this.PharmacyDatabaseService.AllWarehouseZones(out msg).Where(r => r.Deleted == false).OrderBy(r => r.Name).ToList();
            var wzt = new List <Models.WarehouseZone>();
            wzt.Add(
                new Models.WarehouseZone
            {
                Name = "全部",
                Id   = Guid.Empty,
            });

            this.comboBox2.ValueMember   = "Id";
            this.comboBox2.DisplayMember = "Name";
            this.comboBox2.DataSource    = wzt;
            this.comboBox2.SelectedIndex = 0;

            this.comboBox1.SelectedIndexChanged += (sender, e) =>
            {
                var wzs = wz.Where(r => r.WarehouseId == (Guid)this.comboBox1.SelectedValue).OrderBy(r => r.Name).ToList();

                wzs.Insert(0, new Models.WarehouseZone
                {
                    Name = "全部",
                    Id   = Guid.Empty,
                });
                this.comboBox2.ValueMember   = "Id";
                this.comboBox2.DisplayMember = "Name";
                this.comboBox2.DataSource    = wzs;
                this.comboBox2.SelectedIndex = 0;
            };
            #endregion


            //批量创建
            this.toolStripButton2.Click += (sender, e) =>
            {
                FormWareHouseZonePosition_Editor frm = new FormWareHouseZonePosition_Editor(w, wz);
                frm.Show(this);
            };

            #region 修改ACTION
            Action <object, EventArgs> EditPostionAction = (sender, e) =>
            {
                if (this.dataGridView1.CurrentRow == null)
                {
                    return;
                }
                var c = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.WareHouseZonePositionModel;
                using (FormWareHouseZonePositionEdit frm = new FormWareHouseZonePositionEdit(w, wz, c))
                {
                    var re = frm.ShowDialog();
                    if (re == System.Windows.Forms.DialogResult.OK)
                    {
                        this.toolStripButton1_Click(null, null);
                    }
                }
            };
            #endregion

            //修改
            this.toolStripButton3.Click += (sender, e) => EditPostionAction(sender, e);
            //Datagridview双击修该货位
            this.dataGridView1.CellDoubleClick += (sender, e) =>
            {
                if (e.RowIndex < 0 || e.ColumnIndex < 0)
                {
                    return;
                }
                EditPostionAction(null, null);
            };
        }
Пример #3
0
        public FormPurchaseHistoryBySupplyer()
        {
            InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
            this.dataGridView1.RowPostPaint       += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); };

            dtpf.Value = DateTime.Now.AddMonths(-3).Date;
            dtpt.Value = DateTime.Now.Date;
            this.toolStrip1.Items.Insert(5, new ToolStripControlHost(dtpf));
            this.toolStrip1.Items.Insert(7, new ToolStripControlHost(dtpt));
            cms = new Pharmacy.UI.Common.BaseRightMenu(this.dataGridView1);
            cms.InsertMenuItem("查询选中供货商", SupplyStatic);

            cms.InsertMenuItem("查看选中供货商资料", delegate()
            {
                var u = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.SupplyUnitHistoryDrugList;
                Models.SupplyUnit su         = this.PharmacyDatabaseService.GetSupplyUnit(out msg, u.SupplyUnitId);
                UserControls.ucSupplyUnit us = new UserControls.ucSupplyUnit(su, false);
                Form f         = new Form();
                f.Text         = su.Name;
                f.AutoSize     = true;
                f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                Panel p        = new Panel();
                p.AutoSize     = true;
                p.Controls.Add(us);
                f.Controls.Add(p);
                f.ShowDialog();
            });

            cms.InsertMenuItem("查看选中品种资料", delegate()
            {
                var u = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.SupplyUnitHistoryDrugList;
                Models.DrugInfo di = this.PharmacyDatabaseService.GetDrugInfo(out msg, u.DrugInfoId);
                if (di == null)
                {
                    return;
                }

                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);
                Forms.Common.SetControls.SetControlReadonly(f, true);
                f.ShowDialog();
            });

            cms.InsertMenuItem("按选中品种批号查询", delegate()
            {
                if (this.ListS.Count > 0)
                {
                    var c = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.SupplyUnitHistoryDrugList;
                    if (BtchFrm == null || BtchFrm.IsDisposed)
                    {
                        BtchFrm = new Form_FormPurchaseHistoryBySupplyer_Batch(c.batchNumber);
                    }
                    BtchFrm.StartPosition = FormStartPosition.CenterScreen;
                    BtchFrm.TopMost       = true;
                    BtchFrm.Show(this);
                    BtchFrm.GetBatch += (sender, ex) =>
                    {
                        if (ex.IsPrecise)
                        {
                            var qre = this.ListS.Where(r => r.batchNumber == ex.Batch);
                            this.dataGridView1.DataSource = qre.ToList();
                        }
                        else
                        {
                            var qre = this.ListS.Where(r => r.batchNumber.Contains(ex.Batch));
                            this.dataGridView1.DataSource = qre.ToList();
                        }
                    };
                }
            });
            cms.InsertMenuItem("采购品种汇总", DrugStatic);
            cms.InsertMenuItem("全部显示", ShowAll);
            cms.InsertMenuItem("统计该药品购销情况", SupplyAndSale);
            tsmi = new ToolStripMenuItem("打开采购单");
            cms.InsertStripMenuItems(tsmi, InsertDropDownMenuEvt);
            tsmi = new ToolStripMenuItem("打开验收单");
            cms.InsertStripMenuItems_Checking(tsmi, this.InsertDropDownMenuEvt_Checking);
        }
Пример #4
0
        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
        }
Пример #5
0
 public void InsertDrugBasicInfo()
 {
     brm.InsertMenuItem("经营品种基础信息", this.GetDrugInfo);
 }