Pantalla de bloqueo en ventas.aspx y pv.aspx, asignar forma de pago en base al pago mas alto

This commit is contained in:
2022-01-24 17:29:58 -07:00
parent 63b22e7f4f
commit d42a496be0
4 changed files with 256 additions and 17 deletions

View File

@@ -2356,6 +2356,7 @@ Partial Class Ventas
TxtImporteOtrosContado.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
TxtEfectivoEnCaja.Attributes.Add("onKeyUp", "CalculaDiferencia();")
TxtEfectivoCajaBloqueo.Attributes.Add("onKeyUp", "CalculaDiferenciaBloqueo();")
'ImgCerrarTerminoCorte.Attributes.Add("OnClick", "$('#DivTerminarCorte').hide();")
'ImgCerrarIE.Attributes.Add("OnClick", "$('#DivIngresoEgreso').hide();")DdlTipoComprobante
@@ -3182,6 +3183,7 @@ Partial Class Ventas
#Region "Punto Venta"
Private Sub CargaCorteCaja()
Dim DebeCerrarCorte As Boolean = False
'Checar si hay un Turno Abierto
Dim ObjPVenta As New ClsPuntoVenta
@@ -3189,14 +3191,21 @@ Partial Class Ventas
If ObjPVenta.DtResultados.Rows.Count > 0 Then
CveCorte = ObjPVenta.CveCorte
LblEstatusCaja.Text = ObjPVenta.FechaInicial.ToShortDateString
LblTurno.Text = ObjPVenta.FechaInicial.ToShortDateString
TrEstatusCaja.Visible = True
BtnIniciarTurno.Visible = False
LkbEstadodeCaja.Visible = True
LkbIngreso.Visible = True
LkbRetiro.Visible = True
UpTurno.Visible = True
Dim FechaICorte = ObjPVenta.FechaInicial.Date '.AddDays(-5)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso FechaICorte < Now.Date Then
DebeCerrarCorte = True
LblMotivoBloqueo.Text = $"Existe un corte del día <b>{FechaICorte.ToString("dd/MM/yyyy")}</b>. Favor de cerrarlo para iniciar un nuevo corte."
Else
LblEstatusCaja.Text = ObjPVenta.FechaInicial.ToShortDateString
LblTurno.Text = ObjPVenta.FechaInicial.ToShortDateString
TrEstatusCaja.Visible = True
BtnIniciarTurno.Visible = False
LkbEstadodeCaja.Visible = True
LkbIngreso.Visible = True
LkbRetiro.Visible = True
UpTurno.Visible = True
End If
Else
UpTurno.Visible = False
'Ingresar un nuevo Turno
@@ -3204,6 +3213,14 @@ Partial Class Ventas
End If
End If
ObjPVenta.Dispose()
If DebeCerrarCorte Then
CargaDatosCorte()
BtnEmitirImprimir.Visible = False
HlCliente.Visible = False
DdlPS.Visible = False
RegistraScript("window.onload = function MuestraPantallaBloqueo() { document.getElementById(""C_btnShowBloqueo"").click(); }")
End If
End Sub
Private Sub BtnIniciarTurno_Click(sender As Object, e As EventArgs) Handles BtnIniciarTurno.Click
Dim ObjPVenta As New ClsPuntoVenta
@@ -3237,6 +3254,7 @@ Partial Class Ventas
Total = ObjPVenta.DtResultados(0)("ImporteInicial").ToString().ToDouble + ObjPVenta.DtResultados(0)("VentasEfectivo").ToString().ToDouble + ObjPVenta.DtResultados(0)("Ingresado").ToString().ToDouble - ObjPVenta.DtResultados(0)("Retirado").ToString().ToDouble - ObjPVenta.DtResultados(0)("Devoluciones").ToString().ToDouble
DineroCaja = Total
LblEfectivoEsperado.Text = Total.FormatoNumero(2)
LblEfectivoBloqueo.Text = Total.FormatoNumero(2)
Dim Dt As New DataTable
@@ -3349,6 +3367,21 @@ Partial Class Ventas
End If
ObjPVenta.Dispose()
End Sub
Private Sub BtnCerrarBloqueo_Click(sender As Object, e As EventArgs) Handles BtnCerrarBloqueo.Click
Dim ObjPVenta As New ClsPuntoVenta
If TxtEfectivoCajaBloqueo.Text.Trim <> "" Then
If ObjPVenta.UpdateFinalizadoVtaCortes(CveCorte, TxtEfectivoCajaBloqueo.Text.ToDouble, LblDiferenciaCajaBloqueo.Text.ToDouble, Now, UsuarioActual.CveEmpresa) Then
RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}", CveCorte, "PDF"))}'", "Imprimir")
Dim Liga = "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";"
Alert("Se ha cerrado el turno correctamente.", TipoMensaje.MsgInformacion, Liga)
End If
Else
Alert("Debe especificar el efectivo en caja", TipoMensaje.MsgAdvertencia)
RegistraScript("window.onload = function MuestraPantallaBloqueo() { document.getElementById(""C_btnShowBloqueo"").click(); }")
End If
ObjPVenta.Dispose()
End Sub
Private Sub BtnCancelar_Click(sender As Object, e As EventArgs) Handles BtnCancelar.Click
Response.Redirect("~/Inicio.aspx")
End Sub
@@ -21462,7 +21495,7 @@ Partial Class Ventas
DrDebito("Folio") = CargaFolioContado(DdlCuentaTarjetaDebito.SelectedValue.ToEntero(), 11)
DrDebito("Observaciones") = ""
DrDebito("Tipo") = "Tarjeta de Débito"
DrDebito("CveMetodoPago") = 5
DrDebito("CveMetodoPago") = 18
DrDebito("MesesSinIntereses") = -1
DtPagos.Rows.Add(DrDebito)
@@ -21557,7 +21590,7 @@ Partial Class Ventas
DrDebito("Folio") = CargaFolioContado(DdlCuentaOtrosContado.SelectedValue.ToEntero(), 11)
DrDebito("Observaciones") = ""
DrDebito("Tipo") = "Tarjeta de Débito"
DrDebito("CveMetodoPago") = 5
DrDebito("CveMetodoPago") = 18
DrDebito("MesesSinIntereses") = -1
DtPagos.Rows.Add(DrDebito)
@@ -21600,6 +21633,14 @@ Partial Class Ventas
UpFacturar.Update()
End If
'TOMA EL VALOR DEL PAGO MAS ALTO QUE SE APLIQUE
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DtPagos IsNot Nothing Then
Dim RowPagoMasAlto As DataRow = DtPagos.FiltraParametros("", Orderby:="Importe DESC").FiltroPrimero("")
If RowPagoMasAlto IsNot Nothing Then
DdlFormaPago33.SelectedValueExist(RowPagoMasAlto("CveMetodoPago"))
End If
End If
CargaGridContado()
UpContado.Update()