This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2022-01-27 07:23:15 -07:00
33 changed files with 9962 additions and 1986 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
@@ -3201,6 +3202,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
@@ -3208,14 +3210,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
@@ -3223,6 +3232,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
@@ -3256,6 +3273,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
@@ -3368,6 +3386,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
@@ -10945,6 +10978,8 @@ Partial Class Ventas
Timbre.Receptor.Nombre = Obj.Cliente.Nombre
End If
Timbre.Receptor.RegimenFiscalReceptor = Obj.Cliente.CodigoRegimenFiscal
Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP
Timbre.Receptor.ResidenciaFiscal = ""
Timbre.Receptor.NumeroRegistroTributario = ""
Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI
@@ -11835,7 +11870,7 @@ Partial Class Ventas
End If
'SI SE FACTURAN RNC DE CARGO, SE AGREGA EL CONCEPTO DE ACREDITAMIENTO
If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso EsCargo Then
If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso EsCargo AndAlso Not factura.EsGarantia Then
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
Dim CvePSCargo As Integer = -1
@@ -17252,7 +17287,11 @@ Partial Class Ventas
If CveClasifPS = 20636 Then
ValidaCondicionesComerciales = False
End If
'CAMBIO DE VIGENCIA NO SE APLICAN DESCUENTOS
If CveClasifPS = 20637 Then
ObjDescuento.ImporteDescuento = 0
Return ObjDescuento
End If
End If
Dim dr As DataRow = Nothing
@@ -21477,7 +21516,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)
@@ -21572,7 +21611,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)
@@ -21615,6 +21654,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()
@@ -26939,9 +26986,7 @@ Partial Class Ventas
Protected Sub BtnAplicarNC_Click(sender As Object, e As EventArgs)
'SOLO APLICA SI NO HAY DOCUMENTOS QUE SELECCIONAR
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim Verificacion As Boolean = False
If ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0 Then ' si hay opciones seleccionadas, se activa el generar las NCs
Verificacion = True
Else
@@ -26953,7 +26998,10 @@ Partial Class Ventas
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, "Egs", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL ", Orderby:="TipoAutorizacion")
If RowAutorizacion IsNot Nothing Then
Verificacion = True
Dim ImporteAutorizacion As Decimal = RowAutorizacion("Importe").ToString().ToDecimal()
If ImporteAutorizacion > TxtNCImporte.Text.ToDecimal Then
Verificacion = True
End If
End If
End If
ObjVentas.Dispose()
@@ -27463,12 +27511,16 @@ Partial Class Ventas
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowUsado("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowUsado("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowUsado("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero())
End If
If Terminar Then
Exit For
End If
@@ -27552,12 +27604,16 @@ Partial Class Ventas
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
End If
If Terminar Then
Exit For
End If
@@ -27640,11 +27696,15 @@ Partial Class Ventas
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
End If
Next
Next
@@ -27730,11 +27790,15 @@ Partial Class Ventas
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
End If
Next
Next
@@ -27814,11 +27878,15 @@ Partial Class Ventas
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
End If
If Terminar Then
Exit For
@@ -27897,11 +27965,15 @@ Partial Class Ventas
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowRNC("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowRNC("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowRNC("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowRNC("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero())
End If
If Terminar Then
Exit For
@@ -31294,7 +31366,7 @@ Partial Class Ventas
Private Function GuardarUsados(CveConcepto As Integer, SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura) As Boolean
Dim Resultado As Boolean = True
If ClienteEsDistribuidor Then
If ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero