Пример #1
0
        public FormDrugsDestroyDetails()
        {
            InitializeComponent();

            dtF.Value = DateTime.Now.Date.AddDays(-3);
            dtF.Width = 120;
            ToolStripControlHost tsch = new ToolStripControlHost(dtF);

            this.toolStrip1.Items.Insert(2, tsch);
            this.toolStrip1.Items.Insert(3, new ToolStripLabel("至"));

            dtT.Value = DateTime.Now.Date;
            dtT.Width = 120;
            tsch      = new ToolStripControlHost(dtT);
            this.toolStrip1.Items.Insert(4, tsch);

            this.brm = new BaseRightMenu(this.dataGridView1);
            this.brm.InsertMenuItem("查看报损审批信息", this.OpenBreakageApprovalForm);
            this.brm.InsertMenuItem("查看不合格审批信息", this.OpenUnqualicationApprovalForm);

            this.dataGridView1.RowPostPaint += (sender, e) =>
            {
                DataGridViewOperator.SetRowNumber((DataGridView)sender, e);
            };

            Users = this.PharmacyDatabaseService.AllUsers(out msg).ToList();
        }
Пример #2
0
        public ucPurchaseRecord()
        {
            InitializeComponent();
            dtpFrom.Value = DateTime.Now.AddDays(-3);
            dtpTo.Value   = DateTime.Now;
            BindComboBoxSupply();
            var all = PharmacyDatabaseService.AllSupplyUnits(out msg);

            listSupplyer = all.Where(r => r.Valid).ToList();
            this.dataGridView1.RowPostPaint       += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); };
            this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            this.brm = new BaseRightMenu(this.dataGridView1);
        }
Пример #3
0
        public FormOrderReturnIndex()
        {
            InitializeComponent();
            this.dataGridView1.ReadOnly = true;

            var c = this.PharmacyDatabaseService.AllUsers(out msg);

            this.cmbOperator.ValueMember        = "Id";
            this.cmbOperator.DisplayMember      = "Account";
            this.cmbOperator.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            this.cmbOperator.AutoCompleteSource = AutoCompleteSource.ListItems;
            this.cmbOperator.DataSource         = c.ToList();
            if (this.cmbOperator.Items.Count <= 0)
            {
                return;
            }
            this.cmbOperator.SelectedIndex = 0;

            this._brm = new BaseRightMenu(this.dataGridView1);

            #region 行号
            this.dataGridView1.RowPostPaint += (s, e) =>
            {
                DataGridViewOperator.SetRowNumber(this.dataGridView1, e);
            };
            #endregion

            #region  单号合并,右键
            this._brm.InsertMenuItem("按单号合并", this.GroupByROrderNumber);
            #endregion

            #region 分裂单号,右键
            this._brm.InsertMenuItem("分裂单号", delegate()
            {
                if (this._SalesOrderReturnModelList == null)
                {
                    return;
                }
                this.dataGridView1.DataSource = null;
                this.dataGridView1.DataSource = this._SalesOrderReturnModelList;
                this.HideColumns();
            });
            #endregion

            #region 右键打开退单单据和对应的销售单据
            this._brm.InsertMenuItem("打开退单", this.OpenReturnOrder);
            this._brm.InsertMenuItem("打开对应的销售单", OpenSalesOrder);
            #endregion
        }
Пример #4
0
        public FormOutInventoryCenter(object iStatus)
        {
            InitializeComponent();

            #region 初始化Gridview和右键
            this.dgvOutInventory.RowPostPaint       += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); };
            this.dgvOutInventory.AutoGenerateColumns = false;
            this.dgvOutInventory.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            this.dgvOutInventory.RowHeadersVisible   = true;
            this.brm = new BaseRightMenu(this.dgvOutInventory);
            #endregion

            User CurrentUsr = AppClientContext.CurrentUser;
            this.Status = EnumHelper <OutInventoryStatus> .Parse(iStatus.ToString());

            this.Text = UpdateFormTitle(EnumHelper <OutInventoryStatus> .Parse(iStatus.ToString()));
            string name = CurrentUsr.Employee.Name;

            this.toolStripComboBox1.SelectedIndex = 0;

            user = this.PharmacyDatabaseService.GetAllUsers(out msg).ToList();
        }
Пример #5
0
        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
        }
Пример #6
0
        public Form_PurchaseOrderGenerator()
        {
            InitializeComponent();

            this.CurrentListDetail.ListChanged += (s, e) => { this.InputTotalPriceToTextBox2(); };

            #region 采购创建初始化
            this.label10.Text = BugsBox.Pharmacy.AppClient.Common.AppClientContext.CurrentUser.Employee.Name;
            this.label11.Text = DateTime.Now.ToLongDateString();

            var types = EnumToListHelper.ConverEnumToList(typeof(PurchaseDrugTypes)).Where(r => r.Name != PurchaseDrugTypes.食品.ToString()).ToList();//暂时不支持食品类

            this.toolStripComboBox1.ComboBox.DisplayMember = "Name";
            this.toolStripComboBox1.ComboBox.ValueMember   = "Id";
            this.toolStripComboBox1.ComboBox.DataSource    = types;
            this.toolStripComboBox1.ComboBox.SelectedIndex = 0;

            this.toolStripComboBox1.SelectedIndexChanged += toolStripComboBox1_SelectedIndexChanged;

            this.Shown += (s, e) =>
            {
                var tt = new ToolTip
                {
                    ToolTipTitle = "提示!",
                    AutoPopDelay = 5000,
                    InitialDelay = 1000,
                    ReshowDelay  = 500,
                    ShowAlways   = false,
                    ToolTipIcon  = ToolTipIcon.Warning,
                    IsBalloon    = true,
                    UseFading    = true,
                    UseAnimation = true,
                };

                tt.SetToolTip(this.textBox1, "提示");
                tt.Show("从这里开始,先选择一个供货单位!", this.textBox1, 5000);
                this.textBox1.Focus();
            };
            #endregion

            #region 从服务器端读入采购默认税率值
            var sets = this.PharmacyDatabaseService.GetSalePriceControlRules(out msg);
            PurchaseOrderDefaultTaxRate = sets.PurchaseOrderDefaultTaxRate ?? new PurchaseOrderTaxRate
            {
                DefaultTaxRate = 17
            };
            #endregion

            #region  钮事件
            this.toolStripButton1.Click           += (s, e) => this.GetDrugInfo();
            this.toolStripButton3.Click           += (s, e) => this.Submit();
            this.btnGeneratePurchaseRecords.Click += (s, e) => this.Submit();
            this.toolStripButton6.Click           += (s, e) => this.FromXls();
            this.toolStripButton2.Click           += (s, e) => this.DeleteDrugInfo();
            this.FormClosing += (s, e) =>
            {
                e.Cancel = MessageBox.Show("确定要关闭?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel;
            };//窗口关闭提示

            this.toolStripButton5.Click += (s, e) =>
            {
                using (Form_PurchaseOrder_Set frm = new Form_PurchaseOrder_Set())
                {
                    frm.ShowDialog();
                    if (frm.DialogResult == DialogResult.OK)
                    {
                        this.PurchaseOrderDefaultTaxRate = frm.CurrentTaxRateModel;
                    }
                };
            };//默认税率值设置
            #endregion

            #region 供货单位信息处理
            this.textBox1.KeyPress += (s, e) =>
            {
                if (e.KeyChar != 13)
                {
                    return;
                }
                this.SearchSupplyUnit();
            };
            this.button1.Click += (s, e) => this.SearchSupplyUnit();
            #endregion

            #region 用户信息处理
            Business.Models.BaseQueryModel q2 = new Business.Models.BaseQueryModel {
            };
            var allusers = this.PharmacyDatabaseService.GetUserIdNamesByQueryModel(q2, out msg).ToList();
            this.comboBox2.ValueMember   = "Id";
            this.comboBox2.DisplayMember = "Name";
            this.comboBox2.DataSource    = allusers;
            #endregion

            #region 右键菜单
            this.brm = new BaseRightMenu(this.dataGridView1);
            this.brm.InsertMenuItem("一键填写最近采购价格", this.GetLastUnitPrice);
            this.brm.InsertMenuItem("删除品种", this.DeleteDrugInfo);
            this.brm.InsertMenuItem("查看品种基本资料", this.OpenDrugInfo);
            this.brm.InsertMenuItem("税率一键填写", this.InsertTaxRate);
            #endregion

            #region Datagriview处理
            this.dataGridView1.DataSource              = this.CurrentListDetail;
            this.dataGridView1.AllowUserToAddRows      = false;
            this.dataGridView1.AllowUserToOrderColumns = true;
            this.dataGridView1.RowPostPaint           += (s, e) => DataGridViewOperator.SetRowNumber(this.dataGridView1, e);
            this.dataGridView1.AutoSizeColumnsMode     = DataGridViewAutoSizeColumnsMode.AllCells;
            this.dataGridView1.ReadOnly   = true;
            this.dataGridView1.DataError += (s, e) => { };

            this.dataGridView1.Columns["DrugInfoId"].Visible = false;

            DataGridViewCellStyle dgvcs = new DataGridViewCellStyle
            {
                BackColor = Color.Yellow
            };
            this.dataGridView1.Columns["UnitPrice"].DefaultCellStyle = dgvcs;
            this.dataGridView1.Columns["Amount"].DefaultCellStyle    = dgvcs;
            this.dataGridView1.Columns["TaxRate"].DefaultCellStyle   = dgvcs;

            #region 设置datagridview只读性和可编辑
            this.dataGridView1.CellEnter += (s, e) =>
            {
                if (dataGridView1.Columns[e.ColumnIndex].Name == "UnitPrice" || dataGridView1.Columns[e.ColumnIndex].Name == "Amount" || dataGridView1.Columns[e.ColumnIndex].Name == "TaxRate")
                {
                    this.dataGridView1.ReadOnly = false;
                }
                else
                {
                    this.dataGridView1.ReadOnly = true;
                }
            };
            #endregion

            #region 计算总额
            this.dataGridView1.CellEndEdit += (s, e) =>
            {
                this.textBox2.Text = decimal.Round(this.CurrentListDetail.Sum(r => r.UnitPrice * r.Amount), 4).ToString();
            };
            #endregion
            #endregion

            #region 绑定采购单CurrentPurchaseOrder实体
            this.purchaseOrderBindingSource.Add(this.CurrentPurchaseOrder);
            #endregion

            #region 获取供应商基础信息
            this.linkLabel1.Click += (s, e) => this.GetSupplyUnitInfo();
            #endregion
        }