diff --git a/App_Code/ClsPuntoVenta.vb b/App_Code/ClsPuntoVenta.vb index bc7ae8883..729fc7426 100644 --- a/App_Code/ClsPuntoVenta.vb +++ b/App_Code/ClsPuntoVenta.vb @@ -228,8 +228,38 @@ Public Class ClsPuntoVenta Return Retorno End Function + Public Function GetVtaCortesActivos(CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_CortesActivosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + If Data.Rows.Count > 0 Then + With Me + .CveCorte = Data.Rows(0)("CveCorte").ToString.ToEntero + .FechaInicial = Data.Rows(0)("FechaInicial").ToString.ToDateTime + .FechaFinal = Data.Rows(0)("FechaFinal").ToString.ToDateTime + .FechaIng = Data.Rows(0)("FechaIng").ToString.ToDateTime + .ImporteInicial = Data.Rows(0)("ImporteInicial").ToString.ToDouble + .ImporteFinal = Data.Rows(0)("ImporteFinal").ToString.ToDouble + .Descripcion = Data.Rows(0)("Descripcion").ToString + .Estatus = Data.Rows(0)("Estatus").ToString + .Usuario = Data.Rows(0)("Usuario").ToString + .UsuarioNombre = Data.Rows(0)("UsuarioNombre").ToString + End With + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los Cortes del Punto de Venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function 'Public Function GetCortesPorCuenta(CveCuenta As Integer, CveEmpresa As Integer) As Boolean ' Dim Retorno As Boolean = False diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index d89b53ba4..c74ecc992 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3772,7 +3772,7 @@ Partial Class Ventas 'Checar si hay un Turno Abierto Dim ObjPVenta As New ClsPuntoVenta - If ObjPVenta.GetVta_Cortes("-1", "-1", UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, 0) Then + If ObjPVenta.GetVtaCortesActivos(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjPVenta.DtResultados.Rows.Count > 0 Then CveCorte = ObjPVenta.CveCorte @@ -3810,7 +3810,7 @@ Partial Class Ventas Private Sub BtnIniciarTurno_Click(sender As Object, e As EventArgs) Handles BtnIniciarTurno.Click Dim ObjPVenta As New ClsPuntoVenta - ObjPVenta.AddVtaCortes(NowADS(), TxtDineroCaja.Text.ToDecimal, UsuarioActual.CveUsuario, TxtDescripcionCaja.Text, UsuarioActual.CveEmpresa) + ObjPVenta.AddVtaCortes(NowADS(), TxtDineroCaja.Text.ToDecimal, UsuarioActual.CveUsuario, TxtDescripcionCaja.Text, 1, UsuarioActual.CveEmpresa) CveCorte = ObjPVenta.CveCorte LblEstatusCaja.Text = NowADS().ToShortDateString TrEstatusCaja.Visible = True