예제 #1
0
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                var all = list.Where(r => r.BusinessScopeCode == "中药材" || r.BusinessScopeCode == "中药饮片");
                bList.Clear();
                foreach (var c in all)
                {
                    bList.Add(c);
                }
                this.dataGridView1.Columns["Column9"].Visible = false;
                this.dataGridView1.Columns["Column7"].Visible = false;
                this.dataGridView2.Columns["dataGridViewTextBoxColumn7"].Visible = false;
                this.dataGridView2.Columns["dataGridViewTextBoxColumn8"].Visible = false;
                salesDrugType = SalesDrugType.ChineseDrug;
            }
            else
            {
                var all = list.Where(r => r.BusinessScopeCode != "中药材" && r.BusinessScopeCode != "中药饮片");

                bList.Clear();
                foreach (var c in all)
                {
                    bList.Add(c);
                }
                this.dataGridView1.Columns["origin"].Visible    = false;
                this.dataGridView2.Columns["colOrigin"].Visible = false;
                salesDrugType = SalesDrugType.Drug;
            }
        }
예제 #2
0
        //新增构造函数
        public Form_SalesOrder()
        {
            InitializeComponent();

            this.invoicer.Text      = Pharmacy.AppClient.Common.AppClientContext.CurrentUser.Employee.Name;
            this.lblCreateDate.Text = DateTime.Now.Date.ToLongDateString();

            #region 列表处理
            this.dataGridView1.RowPostPaint += (s, e) => DataGridViewOperator.SetRowNumber(this.dataGridView1, e);
            this.dataGridView1.CellClick    += dataGridView1_CellClick;

            this.dataGridView1.CellMouseDown += (s, e) =>       //选定列表中的药品id,给右键菜单使用
            {
                if (this.dataGridView1.Rows.Count <= 0)
                {
                    return;
                }
                var c = this.dataGridView1.CurrentRow.DataBoundItem as SalesOrderDetailModel;
                this.BaseRightMenu.DrugId = c.DrugInfoId;
            };

            this.BaseRightMenu = new UI.Forms.BaseForm.BasicInfoRightMenu(this.dataGridView1); //右键支持
            this.BaseRightMenu.InsertDrugBasicInfo();                                          //加入药品基本信息查询功能

            this.BaseRightMenu.InserMenu("删除该品种", () =>
            {
                if (this.dataGridView1.Rows.Count <= 0)
                {
                    return;
                }
                var c = MessageBox.Show("确定需要删除该品种吗", "提示", MessageBoxButtons.OKCancel);
                if (c == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
                this.DeleteDrug();
            });
            #endregion

            #region  择客户单位
            this.textBox1.Focus();
            this.textBox1.KeyDown += (s, e) =>
            {
                if (e.KeyCode != Keys.Return)
                {
                    return;
                }
                using (Common.FormPurchaseSelector frm = new Common.FormPurchaseSelector(this.textBox1.Text.Trim()))
                {
                    var re = frm.ShowDialog();
                    if (re == System.Windows.Forms.DialogResult.OK)
                    {
                        this.CurrentPurchaseUnit  = frm.Result;
                        this.txtPurchaseName.Text = this.CurrentPurchaseUnit.Name;

                        this.BaseRightMenu.InsertPurchaseUnitBasicInfo();           //加入右键查询该客户的基本信息查询界面

                        #region 当前客户单位的采购员
                        var c = this.PharmacyDatabaseService.GetPurchaseUnitBuyersByPurchaseUnitId(this.CurrentPurchaseUnit.Id, out msg).OrderBy(r => r.Name).ToList();

                        c.Add(new PurchaseUnitBuyer {
                            Id   = Guid.Empty,
                            Name = "请选择"
                        });
                        this.cmbPurchaseUnitBuyer.DisplayMember = "Name";
                        this.cmbPurchaseUnitBuyer.ValueMember   = "Id";
                        this.cmbPurchaseUnitBuyer.DataSource    = c;
                        if (c.Count > 0)
                        {
                            this.cmbPurchaseUnitBuyer.SelectedIndex = 0;
                            this.CurrentPurchaseUnitBuyer           = c.First();
                        }
                        #endregion
                    }
                }
            };
            #endregion

            #region 客户采购员选择
            this.cmbPurchaseUnitBuyer.SelectedIndexChanged += (s, e) =>
            {
                this.CurrentPurchaseUnitBuyer = this.cmbPurchaseUnitBuyer.SelectedItem as PurchaseUnitBuyer;
            };
            #endregion

            #region 提货方式
            var pickupGoodTypeList = EnumToListHelper.ConverEnumToList(typeof(PickUpGoodType));
            this.cmbPickUpGoods.DisplayMember = "Name";
            this.cmbPickUpGoods.ValueMember   = "Id";
            this.cmbPickUpGoods.DataSource    = pickupGoodTypeList;
            this.cmbPickUpGoods.SelectedValue = (int)this.CurrentPickUpGoodType;
            #endregion

            #region 品种类型选择下拉列表
            var drugTypeList = EnumToListHelper.ConverEnumToList(typeof(SalesDrugType));
            this.comboBox1.DisplayMember         = "Name";
            this.comboBox1.ValueMember           = "Id";
            this.comboBox1.DataSource            = drugTypeList;
            this.comboBox1.SelectedIndex         = 0;
            this.comboBox1.SelectedIndexChanged += (s, e) =>
            {
                this.CurrentSalesDrugType       = (SalesDrugType)this.comboBox1.SelectedIndex;
                this.toolStripStatusLabel2.Text = ((MyLibs.EnumTypeList) this.comboBox1.SelectedItem).Name;
            };

            #endregion

            #region 销售人员名单绑定列表
            System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
            xmlDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "BugsBox.Pharmacy.AppClient.SalePriceType.xml");
            System.Xml.XmlNodeList xmlNode = xmlDocument.SelectNodes("/SalePriceType/priceType");

            xmlNode = xmlDocument.SelectNodes("/SalePriceType/salerRoleName");
            string salerRoleName = xmlNode[0].Attributes[0].Value.ToString();
            var    SalerNames    = this.PharmacyDatabaseService.GetUserByPosition(salerRoleName, string.Empty, string.Empty).OrderBy(r => r.Employee.Name).ToList();//根据角色获取用户
            var    UE            = (from i in SalerNames
                                    select new SalerNames
            {
                Id = i.Id,
                EName = i.Employee.Name
            }).ToList();
            //插入一条“请选择”
            UE.Insert(0, new SalerNames
            {
                Id    = Guid.Empty,
                EName = "请选择销售员"
            });

            this.cmbSalesMan.ValueMember   = "Id";
            this.cmbSalesMan.DisplayMember = "EName";
            this.cmbSalesMan.DataSource    = UE;
            this.cmbSalesMan.SelectedIndex = 0;
            #endregion
        }