|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using DevComponents.DotNetBar.Controls;
|
|
|
|
|
using POSV.Component;
|
|
|
|
|
using POSV.Entity;
|
|
|
|
|
using POSV.ShoppingCart;
|
|
|
|
|
using POSV.Utils;
|
|
|
|
|
|
|
|
|
|
namespace POSV.Business
|
|
|
|
|
{
|
|
|
|
|
public partial class DiscountDialogForm : BusinessForm
|
|
|
|
|
{
|
|
|
|
|
private DiscountPanelEx discountPanelEx;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 操作员默认的最大折扣率
|
|
|
|
|
/// </summary>
|
|
|
|
|
private decimal MaxDiscountRate = Global.Instance.Worker.MaxDiscountRate;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当前选择的记录,单品折扣依赖
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly OrderItem _orderItem = null;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 整单的记录,,整单折扣依赖
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly OrderObject _orderObject = null;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 权限控制码
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string _permissionCode = string.Empty;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 授权人信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
private Tuple<decimal , decimal , List<string> , Worker> _authz = null;
|
|
|
|
|
|
|
|
|
|
public DiscountDialogForm(ModuleKeyCode keyCode , OrderItem orderItem , OrderObject orderObject , string permissionCode , Tuple<decimal , decimal , List<string> , Worker> authz = null)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
this._orderItem = orderItem;
|
|
|
|
|
|
|
|
|
|
this._orderObject = orderObject;
|
|
|
|
|
|
|
|
|
|
this._permissionCode = permissionCode;
|
|
|
|
|
|
|
|
|
|
this._authz = authz;
|
|
|
|
|
|
|
|
|
|
this.discountPanelEx = new DiscountPanelEx(keyCode,orderItem , orderObject , permissionCode , AuthOperator.输入操作 , authz);
|
|
|
|
|
this.discountPanelEx.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
|
|
|
this.discountPanelEx.Location = new System.Drawing.Point(0 , 0);
|
|
|
|
|
this.discountPanelEx.Name = "discountPanelEx";
|
|
|
|
|
this.discountPanelEx.Padding = new System.Windows.Forms.Padding(2);
|
|
|
|
|
|
|
|
|
|
this.Controls.Add(this.discountPanelEx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
|
|
|
|
|
if (this.DesignMode) return;
|
|
|
|
|
|
|
|
|
|
this.SetStyle(ControlStyles.Selectable , true);
|
|
|
|
|
|
|
|
|
|
this.ActiveControl = this.discountPanelEx;
|
|
|
|
|
|
|
|
|
|
this.discountPanelEx.AcceptButtonClick += OnAcceptButtonClick;
|
|
|
|
|
this.discountPanelEx.CancelButtonClick += OnCancelButtonClick;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnCancelButtonClick(object sender , FlyoutEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnControlBoxCloseClick(sender , EventArgs.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnAcceptButtonClick(object sender , FlyoutEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
switch (e.KeyCode)
|
|
|
|
|
{
|
|
|
|
|
case "item":
|
|
|
|
|
{
|
|
|
|
|
this.OnAcceptButtonClick(new TransparentEventArgs(TransparentAction.Accept , e.KeyCode , e.Data));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "order":
|
|
|
|
|
{
|
|
|
|
|
this.OnAcceptButtonClick(new TransparentEventArgs(TransparentAction.Accept , e.KeyCode , e.Data));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OnControlBoxCloseClick(sender , EventArgs.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnControlBoxCloseClick(object sender , EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.Owner != null)
|
|
|
|
|
{
|
|
|
|
|
this.Owner.Close();
|
|
|
|
|
}
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|