--Mover a pantalla de cobranza(PVCobranza.aspx). el inicio de turno y y ocultarlo en la pantalla de ventas, se activará en el proceso 371
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -14,13 +14,24 @@ Partial Class Ventas_PVCobranza
|
||||
Set(value As Integer)
|
||||
ViewState("CveCorte") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DineroCaja As Double
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DineroCaja")), 0, ViewState("DineroCaja").ToString().ToDecimal())
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("DineroCaja") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CveCorte = 0
|
||||
CargaFiltros()
|
||||
CargaCorteCaja()
|
||||
If UsuarioActual.TienePermisoProceso(371) Then
|
||||
CargaCorteCaja()
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -59,31 +70,118 @@ Partial Class Ventas_PVCobranza
|
||||
DdlCuentaTarjetaDebito.DataBind()
|
||||
DdlCuentaCheque.DataBind()
|
||||
DdlCuentaTransferencia.DataBind()
|
||||
|
||||
TxtImporteEfectivo.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
|
||||
TxtImporteCredito.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
|
||||
TxtImporteDebito.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
|
||||
TxtImporteCheque.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
|
||||
TxtImporteTransferencia.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
|
||||
TxtImporteOtrosContado.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
|
||||
TxtImporteOtrosContado.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
|
||||
|
||||
TxtEfectivoEnCaja.Attributes.Add("onKeyUp", "CalculaDiferencia();")
|
||||
TxtEfectivoCajaBloqueo.Attributes.Add("onKeyUp", "CalculaDiferenciaBloqueo();")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCorteCaja()
|
||||
Dim DebeCerrarCorte As Boolean = False
|
||||
'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.DtResultados.Rows.Count > 0 Then
|
||||
CveCorte = ObjPVenta.CveCorte
|
||||
End If
|
||||
End If
|
||||
ObjPVenta.Dispose()
|
||||
|
||||
|
||||
Private Sub CargaCorteCaja()
|
||||
Dim DebeCerrarCorte As Boolean = False
|
||||
'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.DtResultados.Rows.Count > 0 Then
|
||||
CveCorte = ObjPVenta.CveCorte
|
||||
Dim FechaICorte As Date = ObjPVenta.FechaInicial.Date '.AddDays(-5)
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso FechaICorte < NowADS().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
|
||||
LblTurno.Text = ObjPVenta.FechaInicial.ToShortDateString
|
||||
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
|
||||
RegistraScript("window.onload = function MuestraCorteCaja() { document.getElementById(""C_btnShow"").click(); }")
|
||||
End If
|
||||
End If
|
||||
ObjPVenta.Dispose()
|
||||
|
||||
If DebeCerrarCorte Then
|
||||
CargaDatosCorte()
|
||||
RegistraScript("window.onload = function MuestraPantallaBloqueo() { document.getElementById(""C_btnShowBloqueo"").click(); }")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatosCorte()
|
||||
Dim ObjPVenta As New ClsPuntoVenta
|
||||
Dim Total As Double
|
||||
|
||||
If ObjPVenta.GetVta_Cortes("-1", "-1", UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, 0) Then
|
||||
If ObjPVenta.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
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
|
||||
|
||||
Dt.Columns.Add("Descripcion", GetType(String))
|
||||
Dt.Columns.Add("Importe", GetType(Decimal))
|
||||
|
||||
Dim Dr1 As DataRow = Dt.NewRow
|
||||
Dr1("Descripcion") = "Fondo de Caja"
|
||||
Dr1("Importe") = ObjPVenta.DtResultados(0)("ImporteInicial").ToString().ToDouble
|
||||
Dt.Rows.Add(Dr1)
|
||||
|
||||
Dim Dr2 As DataRow = Dt.NewRow
|
||||
Dr2("Descripcion") = "Ventas en Efectivo"
|
||||
Dr2("Importe") = ObjPVenta.DtResultados(0)("VentasEfectivo").ToString().ToDouble
|
||||
Dt.Rows.Add(Dr2)
|
||||
|
||||
Dim Dr21 As DataRow = Dt.NewRow
|
||||
Dr21("Descripcion") = "Devoluciones"
|
||||
Dr21("Importe") = ObjPVenta.DtResultados(0)("Devoluciones").ToString().ToDouble
|
||||
Dt.Rows.Add(Dr21)
|
||||
|
||||
'Dim Dr3 = Dt.NewRow
|
||||
'Dr3("Descripcion") = "Propinas"
|
||||
'Dr3("Importe") = ObjPVenta.DtResultados(0)("Propina").ToString().ToDouble
|
||||
'Dt.Rows.Add(Dr3)
|
||||
|
||||
Dim Dr4 As DataRow = Dt.NewRow
|
||||
Dr4("Descripcion") = "Entradas"
|
||||
Dr4("Importe") = ObjPVenta.DtResultados(0)("Ingresado").ToString().ToDouble
|
||||
Dt.Rows.Add(Dr4)
|
||||
|
||||
Dim Dr5 As DataRow = Dt.NewRow
|
||||
Dr5("Descripcion") = "Salidas"
|
||||
Dr5("Importe") = ObjPVenta.DtResultados(0)("Retirado").ToString().ToDouble
|
||||
Dt.Rows.Add(Dr5)
|
||||
|
||||
Dim Dr6 As DataRow = Dt.NewRow
|
||||
Dr6("Descripcion") = "Total"
|
||||
Dr6("Importe") = Total
|
||||
Dt.Rows.Add(Dr6)
|
||||
|
||||
GvDineroCaja.DataSource = Dt
|
||||
GvDineroCaja.DataBind()
|
||||
UpDineroCaja.Update()
|
||||
UpTerminarCorte.Update()
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjPVenta.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
@@ -276,6 +374,128 @@ Partial Class Ventas_PVCobranza
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
End Function
|
||||
|
||||
Protected Sub BtnCerrarCaja_Click(sender As Object, e As EventArgs)
|
||||
RegistraScript("$('#DivEstadoCaja').modal('hide')")
|
||||
RegistraScript("$('#DivTerminarCorte').modal()", "divterminarcorte")
|
||||
End Sub
|
||||
Protected Sub LkbIngreso_Click(sender As Object, e As EventArgs)
|
||||
CargaIngresoEgreso(1)
|
||||
End Sub
|
||||
Public Sub CargaIngresoEgreso(Opcion As Integer)
|
||||
RegistraScript("$('#DivIngresoEgreso').modal()")
|
||||
If Opcion = 1 Then
|
||||
LblTituloIE.Text = "Ingreso de Efectivo: "
|
||||
HdnTipoMovimiento.Value = "1"
|
||||
ElseIf Opcion = 0 Then
|
||||
LblTituloIE.Text = "Retiro de Efectivo: "
|
||||
HdnTipoMovimiento.Value = "0"
|
||||
End If
|
||||
UpIngresoEgreso.Update()
|
||||
End Sub
|
||||
Protected Sub LkbRetiro_Click(sender As Object, e As EventArgs)
|
||||
CargaIngresoEgreso(0)
|
||||
End Sub
|
||||
|
||||
Private Sub LkbEstadodeCaja_Click(sender As Object, e As EventArgs) Handles LkbEstadodeCaja.Click
|
||||
CargaDatosCorte()
|
||||
CargaVentasPago()
|
||||
CargaEntradasSalidas()
|
||||
RegistraScript("$('#DivEstadoCaja').modal()")
|
||||
End Sub
|
||||
|
||||
Private Sub CargaVentasPago()
|
||||
Dim ObjPVenta As New ClsPuntoVenta
|
||||
|
||||
If ObjPVenta.GetVta_MetodosPago(CveCorte) Then
|
||||
If ObjPVenta.DtResultados.Rows.Count > 0 Then
|
||||
GvMetodosPago.DataSource = ObjPVenta.DtResultados
|
||||
GvMetodosPago.DataBind()
|
||||
UpMetodosPago.Update()
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjPVenta.Dispose()
|
||||
End Sub
|
||||
Private Sub CargaEntradasSalidas()
|
||||
Dim ObjPVenta As New ClsPuntoVenta
|
||||
|
||||
'Salida
|
||||
If ObjPVenta.GetVta_MovimientosCajas(CveCorte, 0) Then
|
||||
If ObjPVenta.DtResultados.Rows.Count > 0 Then
|
||||
GvEgresos.DataSource = ObjPVenta.DtResultados
|
||||
GvEgresos.DataBind()
|
||||
UpEgresos.Update()
|
||||
End If
|
||||
End If
|
||||
|
||||
'Entrada
|
||||
If ObjPVenta.GetVta_MovimientosCajas(CveCorte, 1) Then
|
||||
If ObjPVenta.DtResultados.Rows.Count > 0 Then
|
||||
GvIngresos.DataSource = ObjPVenta.DtResultados
|
||||
GvIngresos.DataBind()
|
||||
UpIngresos.Update()
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjPVenta.Dispose()
|
||||
End Sub
|
||||
Private Sub BtnCerrarTurno_Click(sender As Object, e As EventArgs) Handles BtnCerrarTurno.Click
|
||||
Dim ObjPVenta As New ClsPuntoVenta
|
||||
If TxtEfectivoEnCaja.Text.Trim <> "" Then
|
||||
If ObjPVenta.UpdateFinalizadoVtaCortes(CveCorte, TxtEfectivoEnCaja.Text.ToDouble, LblDiferenciaCaja.Text.ToDouble, NowADS(), 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 As String = "document.location.href=""/Ventas/PVCobranza.aspx"";"
|
||||
Alert("Se ha cerrado el turno correctamente.", TipoMensaje.MsgInformacion, Liga)
|
||||
End If
|
||||
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, NowADS(), 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 As String = "document.location.href=""/Ventas/PVCobranza.aspx"";"
|
||||
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 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)
|
||||
CveCorte = ObjPVenta.CveCorte
|
||||
LblTurno.Text = NowADS().ToShortDateString
|
||||
UpTurno.Visible = True
|
||||
LkbEstadodeCaja.Visible = True
|
||||
LkbIngreso.Visible = True
|
||||
LkbRetiro.Visible = True
|
||||
BtnIniciarTurno.Visible = False
|
||||
|
||||
ObjPVenta.Dispose()
|
||||
|
||||
RegistraScript("$('#DivCorteDeCaja').hide();")
|
||||
|
||||
UpTurno.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnAceptarIE_Click(sender As Object, e As EventArgs) Handles BtnAceptarIE.Click
|
||||
Dim ObjPVenta As New ClsPuntoVenta
|
||||
If TxtCantidadIE.Text.ToEntero() > 0 Then
|
||||
If ObjPVenta.AddVta_MovimientosCajas(CveCorte, UsuarioActual.CveUsuario, TxtCantidadIE.Text.ToDouble, TxtDescripcionIE.Text, HdnTipoMovimiento.Value.ToEntero(), NowADS()) Then
|
||||
TxtCantidadIE.Text = ""
|
||||
TxtDescripcionIE.Text = ""
|
||||
RegistraScript("$('#DivIngresoEgreso').modal('hide')", "divingresoegreso")
|
||||
Alert("El movimiento se realizó correctamente")
|
||||
UpIngresoEgreso.Update()
|
||||
End If
|
||||
End If
|
||||
ObjPVenta.Dispose()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user