145 lines
5.7 KiB
C#
145 lines
5.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Diagnostics;
|
|
using ADSUtileriasWF.Data.Externa.PV;
|
|
using System.Linq;
|
|
using ADSUtileriasWF.Helpers;
|
|
|
|
namespace ADSUtileriasWF.Views.PV.ControlUser
|
|
{
|
|
public partial class UscComanda : UserControl
|
|
{
|
|
public UscComanda()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void controlComanda_Load(object sender, EventArgs e)
|
|
{
|
|
SetUpEventHandler();
|
|
// Me.Visible = False
|
|
dgComanda.AutoGenerateColumns = false;
|
|
// dgComanda.AutoResizeRow(0, DataGridViewAutoSizeRowMode.AllCellsExceptHeader)
|
|
}
|
|
public void CargaComanda(int CveVentaTerminal, int CveCategoria)
|
|
{
|
|
var SS = new Stopwatch();
|
|
SS.Start();
|
|
var objVenta = new ClsVentas();
|
|
if (objVenta.GetVentasDetalle(CveVentaTerminal, WCF_PV.ClsVentasEstatusEntrega.Todas))
|
|
{
|
|
if (objVenta.DtResultados.Tabla.Rows.Count > 0)
|
|
{
|
|
dgComanda.DataSource = objVenta.DtResultados.Tabla.FiltraParametros("EstatusEntrega in (1, 2) and EsPromocion = 0 and CveCategoria = " + CveCategoria.ToString());
|
|
lblOrden.Text = objVenta.DtResultados.Tabla.Rows[0]["ComandaOrden"].ToString();
|
|
foreach (DataGridViewRow Row in dgComanda.Rows)
|
|
{
|
|
switch (Row.Cells["EstatusEntrega"].Value)
|
|
{
|
|
case WCF_PV.ClsVentasEstatusEntrega.Solicitado:
|
|
{
|
|
Row.DefaultCellStyle.BackColor = Color.White;
|
|
break;
|
|
}
|
|
|
|
case WCF_PV.ClsVentasEstatusEntrega.EnProceso:
|
|
{
|
|
Row.DefaultCellStyle.BackColor = Color.LightGreen;
|
|
break;
|
|
}
|
|
|
|
case WCF_PV.ClsVentasEstatusEntrega.Preparado:
|
|
{
|
|
Row.DefaultCellStyle.BackColor = Color.Orange;
|
|
break;
|
|
}
|
|
|
|
case WCF_PV.ClsVentasEstatusEntrega.Entregado:
|
|
{
|
|
Row.DefaultCellStyle.BackColor = Color.Yellow;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (objVenta.GetVentas(CveVentaTerminal, -1, -1, "-1", -1, -1, ModVarsPV.UsuarioActual.CveEmpresa, EstatusVentaTerminal.Todas))
|
|
{
|
|
|
|
if (objVenta.CveVentaTerminal > 0)
|
|
{
|
|
lblMesa.Text = objVenta.Mesa;
|
|
lblMesero.Text = objVenta.Vendedor;
|
|
lblHoraPedido.Text = objVenta.FechaApertura.ToString("HH:mm:ss");
|
|
lblTiempoPedido.Text = string.Format("{0} Minutos",(DateTime.Now -objVenta.FechaApertura).TotalMinutes); //DateDiff(DateInterval.Minute, objVenta.FechaApertura, DateAndTime.Now).ToEntero
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
objVenta.Dispose();
|
|
SS.Stop();
|
|
// MessageBox.Show(SS.ElapsedMilliseconds)
|
|
this.Visible = true;
|
|
}
|
|
|
|
|
|
private int GetDataGridViewHeight(DataGridView dataGridView)
|
|
{
|
|
var sum = dataGridView.ColumnHeadersVisible ? dataGridView.ColumnHeadersHeight : 0 + dataGridView.Rows.OfType<DataGridViewRow>().Where(r => r.Visible).Sum(r => r.Height);
|
|
return sum;
|
|
}
|
|
|
|
private void dgComanda_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
switch (dgComanda.Rows[e.RowIndex].Cells["EstatusEntrega"].Value)
|
|
{
|
|
case WCF_PV.ClsVentasEstatusEntrega.Solicitado:
|
|
{
|
|
dgComanda.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightGreen;
|
|
break;
|
|
}
|
|
|
|
case WCF_PV.ClsVentasEstatusEntrega.EnProceso:
|
|
{
|
|
dgComanda.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Orange;
|
|
break;
|
|
}
|
|
|
|
case WCF_PV.ClsVentasEstatusEntrega.Preparado:
|
|
{
|
|
dgComanda.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Yellow;
|
|
break;
|
|
}
|
|
|
|
case WCF_PV.ClsVentasEstatusEntrega.Entregado:
|
|
{
|
|
dgComanda.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
|
|
break;
|
|
}
|
|
}
|
|
|
|
EnSeleccion?.Invoke(dgComanda.Rows[e.RowIndex].Cells["CveVentaDetalleTerminal"].Value.ToString().ToEntero());
|
|
}
|
|
|
|
public event EnSeleccionEventHandler EnSeleccion;
|
|
|
|
public delegate void EnSeleccionEventHandler(int CveVentaDetalleTerminal);
|
|
|
|
public void HandleEnSeleccion(int CveVentaDetalleTerminal)
|
|
{
|
|
// Perform desired processing for when time has expired.
|
|
// MsgBox("HandleTimeExpired caught the TimeExpired event" & _
|
|
// vbCrLf & "Status = " & Status)
|
|
}
|
|
|
|
public void SetUpEventHandler()
|
|
{
|
|
EnSeleccion += HandleEnSeleccion;
|
|
}
|
|
}
|
|
} |