Example #1
0
 /// <summary>
 /// 销退申请
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsbtnOrderReturn_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定需要退货申请吗?", "提示", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
     {
         return;
     }
     try
     {
         if (currentUCOut.OutInventory != null)
         {
             currentUCOut.OutInventory.SalesOutInventoryDetails = currentUCOut.OutInventory.SalesOutInventoryDetails.Where(r => r.OutAmount > 0).ToArray();
             FormSalesOrderReturn form = new FormSalesOrderReturn(currentUCOut.OutInventory);
             form.ShowDialog();
         }
         else
         {
             MessageBox.Show("打开销退画面失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("打开销退画面失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log.Error(ex);
     }
 }
Example #2
0
        /// <summary>
        /// 处理按钮按下
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvOrderReturn_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            var entity = dgvOrderReturn.Rows[e.RowIndex].DataBoundItem as SalesOrderReturn;

            if (dgvOrderReturn.Columns[e.ColumnIndex].Name == "处理")
            {
                string message = string.Empty;
                try
                {
                    var orderReturn           = PharmacyDatabaseService.GetSalesOrderReturn(out message, entity.Id);
                    FormSalesOrderReturn form = new FormSalesOrderReturn(orderReturn);
                    if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        btnRefresh_Click(sender, e);
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("打开销退处理画面失败" + message);
                }
            }
        }
Example #3
0
        private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (this.dataGridView1.CurrentCell.OwningColumn.Name != Column5.Name)
            {
                return;
            }
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }
            Business.Models.SalesOrderModelForSalesOrderReturn r = this.dataGridView1.Rows[e.RowIndex].DataBoundItem as Business.Models.SalesOrderModelForSalesOrderReturn;
            Models.OutInventory[] outin  = this.PharmacyDatabaseService.GetOutInventoryByOrderID(out msg, r.Id);
            Models.OutInventory   outInv = outin.First();
            if (outin.Count() > 1)
            {
                outInv.SalesOutInventoryDetails.Clear();
                foreach (var c in outin)
                {
                    foreach (var d in c.SalesOutInventoryDetails)
                    {
                        outInv.SalesOutInventoryDetails.Add(d);
                    }
                }
            }
            FormSalesOrderReturn form = new FormSalesOrderReturn(outInv);

            form.ShowDialog();
        }
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == 1)
     {
         Guid                 id  = bList[e.RowIndex].id;
         SalesOrderReturn     sor = list.First(r => r.Id == id);
         FormSalesOrderReturn frm = new FormSalesOrderReturn(sor, true, true);
         frm.ShowDialog();
         if (frm.DialogResult == DialogResult.OK)
         {
             getData();
             return;
         }
     }
     if (this.dataGridView1.CurrentCell.OwningColumn.Name.Equals(Column6.Name))
     {
         Guid                 id  = bList[e.RowIndex].id;
         SalesOrderReturn     sor = list.First(r => r.Id == id);
         FormSalesOrderReturn frm = new FormSalesOrderReturn(sor, true, false);
         frm.ShowDialog();
     }
 }
Example #5
0
        private void OpenReturnOrder()
        {
            Business.Models.SalesOrderReturnModel som = (Business.Models.SalesOrderReturnModel) this.dataGridView1.CurrentRow.DataBoundItem;
            var orderReturn           = PharmacyDatabaseService.GetSalesOrderReturn(out msg, som.Id);
            FormSalesOrderReturn form = new FormSalesOrderReturn(orderReturn);

            form.ShowDialog();
        }
        private void querySaleOrderReturn(Guid ReturnOrderId)
        {
            if (ReturnOrderId == null)
            {
                return;
            }
            var orderReturn           = PharmacyDatabaseService.GetSalesOrderReturn(out msg, ReturnOrderId);
            FormSalesOrderReturn form = new FormSalesOrderReturn(orderReturn);

            form.ShowDialog();
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }
            if (this.dataGridView1.Columns[e.ColumnIndex].Name != this.Column1.Name)
            {
                return;
            }

            Business.Models.SalesOrderReturnModel som = (Business.Models.SalesOrderReturnModel) this.dataGridView1.Rows[e.RowIndex].DataBoundItem;
            var orderReturn           = PharmacyDatabaseService.GetSalesOrderReturn(out msg, som.Id);
            FormSalesOrderReturn form = new FormSalesOrderReturn(orderReturn);

            form.ShowDialog();
        }
Example #8
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
        }