This commit is contained in:
2025-01-10 06:38:45 -07:00
23 changed files with 316 additions and 100 deletions

View File

@@ -5659,6 +5659,7 @@
</asp:TemplateField>
<asp:BoundField HeaderText="Folio" DataField="Folio" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Tipo" DataField="Tipo" DataFormatString="{0}" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="INPC" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Saldo" DataField="SaldoConImpuestos" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="20%" />

View File

@@ -796,19 +796,22 @@ Partial Class Ventas_PVCobranza
Dim DebeTimbrar As Boolean = True
Dim SeTimbro As Boolean = False
Dim SeTimbroNC As Boolean = False
'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO
If DebeTimbrar AndAlso respFactura IsNot Nothing Then
'VERIFICA SI SE GENERO NC
If respNC IsNot Nothing Then
AjustarTimbre(respFactura.Factura, respNC.Factura)
MsgTimbrado = TimbrarFactura(respFactura.Factura, respNC.Factura)
MsgTimbrado = TimbrarFactura(respFactura.Factura, respNC.Factura, SeTimbro, SeTimbroNC)
Else
AjustarTimbre(respFactura.Factura, Nothing)
MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing)
MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing, SeTimbro, SeTimbroNC)
End If
If Not String.IsNullOrEmpty(MsgTimbrado) Then
Dim StrEr As String = $"<br/><div id = 'DivTipoCambioAdvertencia' class='alert alert-warning' style='padding: 5px; margin-bottom: 5px; padding-right: 25px;'><strong style = 'font-size: 20px; margin-right: 25px;' > Comprobante no emitido : </strong> {MsgTimbrado}<br/>Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.</div>"
Dim StrEr As String = $"<br/><div id = 'DivTipoCambioAdvertencia' class='alert alert-danger' style='padding: 5px; margin-bottom: 5px; padding-right: 25px;'><strong style = 'font-size: 20px; margin-right: 25px;' > Comprobante no emitido : </strong><br/> {MsgTimbrado}<br/>Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.</div>"
MsgTimbrado = StrEr
End If
@@ -816,27 +819,41 @@ Partial Class Ventas_PVCobranza
If respFactura IsNot Nothing Then
If RegistrarPago Then
msBuild.Append($"Pago Registrado correctamente.")
msBuild.Append("<span style=""font-size:14px;"">Pago Registrado correctamente. </span> <br/><br/>")
End If
For Each m In respFactura.Mensajes
msBuild.AppendFormat("<br/> {0}", m)
Next
msBuild.AppendFormat("<span style=""font-size:14px;""> La factura <a class=""Texto"" target=""_blank"" style=""font-size:18px;font-weight:bold;"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a> se genero correctamente. </span> <br/>", respFactura.CveVenta, respFactura.SerieFolio)
If SeTimbro Then
Dim xml = String.Format("<ul><li><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respFactura.CveVenta, "XML", respFactura.SerieFolio, respFactura.Factura.TipoDocto)))
msBuild.AppendFormat("{0}", xml)
End If
Dim pdf = String.Format("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respFactura.CveVenta)))
msBuild.AppendFormat("{0}", pdf)
If respFactura.Factura.Inv_CveMovimiento > 0 Then
msBuild.AppendFormat("<b><a target='_blank' class='Texto' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Movimiento de Almacén</a></b><br/>", respFactura.Factura.Inv_CveMovimiento)
End If
If respNC IsNot Nothing Then
For Each m In respNC.Mensajes
msBuild.AppendFormat("<br/> {0}", m)
Next
msBuild.AppendFormat("<span style=""font-size:14px;""> La nota de crédito <a class=""Texto"" target=""_blank"" style=""font-size:18px;font-weight:bold;"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a> se genero correctamente.</span> <br/>", respNC.CveVenta, respNC.SerieFolio)
If SeTimbroNC Then
Dim xml = String.Format("<ul><li><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respNC.CveVenta, "XML", respNC.SerieFolio, respNC.Factura.TipoDocto)))
msBuild.AppendFormat("{0}", xml)
End If
Dim pdfNC = String.Format("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respNC.CveVenta)))
msBuild.AppendFormat("{0}", pdfNC)
End If
If Not String.IsNullOrEmpty(MsgTimbrado) Then
msBuild.AppendFormat("<br/>{0}<br/>", MsgTimbrado)
End If
Else
msBuild.Append($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1&REGENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>")
End If
If Not String.IsNullOrEmpty(MsgTimbrado) Then
msBuild.AppendFormat("<br/> {0}", MsgTimbrado)
End If
Alert(msBuild.ToString(), TipoMensaje.MsgInformacion)
Else
ObjVentas2.RollBack()
@@ -1256,9 +1273,11 @@ Partial Class Ventas_PVCobranza
End Sub
Private Function TimbrarFactura(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura) As String
Private Function TimbrarFactura(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura, ByRef SeTimbro As Boolean, ByRef SeTimbroNC As Boolean) As String
Dim MsgErrorTimbrado As String = ""
Dim SeTimbro As Boolean = False
'Dim SeTimbro As Boolean = False
'Dim TimbroNC As Boolean = False
Dim ObjTimbrado As New Timbrado
Try
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
@@ -1272,9 +1291,9 @@ Partial Class Ventas_PVCobranza
ObjNC.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
Dim ObjTimbradoNC As New Timbrado
Dim TimbroNC As Boolean = ObjTimbradoNC.TimbrarFactura(UsuarioActual, ObjNC)
SeTimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, ObjNC)
If Not TimbroNC Then
If Not SeTimbroNC Then
MsgErrorTimbrado = $"{MsgErrorTimbrado} {ObjTimbradoNC.MensajeErrorCFDI}"
End If
ObjTimbradoNC = Nothing

View File

@@ -198,7 +198,7 @@ Partial Class Ventas_Promociones
ChkEstatus.Enabled = False
End If
If (ChkEstatus.Checked = True And Not PermisoAutorizPromocionPorcentaje) Or (ReqAutorizacion And Not PermisoAutorizPromocionPorcentaje) Then
If (ChkEstatus.Checked = False And Not PermisoAutorizPromocionPorcentaje And ReqAutorizacion) Or (ReqAutorizacion And Not PermisoAutorizPromocionPorcentaje) Then
BtnGuardar.Visible = False
ButBtnEliminar.Visible = False
End If

View File

@@ -9157,6 +9157,9 @@ Partial Class Ventas
Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal
PU = (GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal).RoundSQL(6)
Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal()
Dim TotalOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Total").ToDecimal()
If Cantidad <= 0 Then
Alert("La cantidad debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -9172,8 +9175,62 @@ Partial Class Ventas
Exit Sub
End If
If UsuarioActual.CveEmpresa = 140 OrElse DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then
ObjDescuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero(), Cantidad, PU)
Dim DdlUM As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida")
Dim DdlCla As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlClasificacion")
Dim DdlSP As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto")
Dim DrProducto = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSNuevo).FiltroPrimero("")
Dim CveUMPS As Integer = DrProducto("CveUnidadMedida").ToString().ToEntero()
Dim CveClasificacion As Integer = DrProducto("CveClasificacion").ToString().ToEntero()
DdlUM.SelectedValueExist(CveUMPS)
Dim RecalcularPromociones As Boolean = False
Dim RegeneraPrecio As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
RecalcularPromociones = True
End If
If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then
RecalcularPromociones = True
End If
If Not GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Enabled Then
If CvePSAnterior <> CvePSNuevo Then
RegeneraPrecio = True
End If
If Cantidad <> CantidadOriginal Then
RegeneraPrecio = True
End If
If RegeneraPrecio Then
Dim CvePrecioLista As Integer = -1
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero()
Else
CvePrecioLista = GvPS.Rows(e.RowIndex).DataKey("CvePrecioLista").ToEntero()
End If
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSNuevo, CveClasificacion, CvePrecioListaSugerido:=CvePrecioLista)
If ObjPrecioSugerido IsNot Nothing AndAlso ObjPrecioSugerido.PrecioSugerido > 0 Then
PU = ObjPrecioSugerido.PrecioSugerido
End If
End If
End If
If RecalcularPromociones Then
ObjDescuento = CalcularDescuentos(CvePSNuevo, Cantidad, PU)
Dim RegenerarPU As Boolean = False
If ObjDescuento.EsPUModificado Then
PU = ObjDescuento.PU
End If
End If
'SI ESTA HABILITADO LA OPCION DE DESCUENTO, SE AGREGO UN DESCUENTO MANUAL Y NO TIENE PROMOCION
@@ -9187,19 +9244,6 @@ Partial Class Ventas
Exit Sub
End If
Dim DdlUM As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida")
Dim DdlCla As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlClasificacion")
Dim DdlSP As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto")
Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal()
Dim TotalOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Total").ToDecimal()
Dim DrProducto = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSNuevo).FiltroPrimero("")
Dim CveUMPS As Integer = DrProducto("CveUnidadMedida").ToString().ToEntero()
DdlUM.SelectedValueExist(CveUMPS)
If Not ValidaAgregarPS(Cantidad, CvePSNuevo, DdlUM.SelectedValue.ToEntero(), PU, DrProducto("CveTipoPS").ToString().ToEntero(), DdlCla.SelectedValue.ToEntero(), DdlSubProyectoDatos.SelectedValue.ToEntero(), ObjDescuento, CantidadOriginal:=CantidadOriginal) Then
Exit Sub
End If
@@ -9220,9 +9264,9 @@ Partial Class Ventas
Dim ConsecutivoActual As Integer = TmpDT.Rows(e.RowIndex)("Consec").ToString().ToEntero()
Dim OrdenOriginal As Integer = TmpDT.Rows(e.RowIndex)("Orden").ToString().ToEntero()
If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then
ObjDescuento = CalcularDescuentos(CvePSNuevo, Cantidad, PU)
End If
'If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then
' ObjDescuento = CalcularDescuentos(CvePSNuevo, Cantidad, PU)
'End If
Dim NumTurnos As Decimal = 0
If UsuarioActual.CveEmpresa.Contiene(7, 122) Then
@@ -18333,7 +18377,7 @@ Partial Class Ventas
If EsVentaMedica Then
TxtPrecio.Enabled = False
If UsuarioActual.CveUsuario = 3986 OrElse RBLTipoVenta.SelectedValue = "2" Then
If UsuarioActual.CveUsuario = 3986 Or RBLTipoVenta.SelectedValue.ToEntero = 2 Then
TxtPrecio.Enabled = True
End If
@@ -18352,7 +18396,11 @@ Partial Class Ventas
End If
End If
If UsuarioActual.TienePermisoProceso(68) AndAlso Not drPS("SATClavePS").ToString.Contiene("84111506", "80141610") Then TxtPrecio.Enabled = False
Dim PSCodigoSAT As String = drPS("SATClavePS").ToString
If UsuarioActual.TienePermisoProceso(68) AndAlso Not PSCodigoSAT.Contiene("84111506", "80141610") Then TxtPrecio.Enabled = False
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 AndAlso Not ChkEmitirComercioExterior.Checked Then
DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString())
@@ -19644,7 +19692,7 @@ Partial Class Ventas
objPS.Dispose()
End If
Dim ValidaExistencia As Boolean = (DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False) OrElse UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1
Dim ValidaExistencia As Boolean = (DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False) Or UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1
If CantidadOriginal > 0 Then
'SI NO HAY CAMBIOS EN LAS CANTIDADES, NO VALIDAR EXISTENCIA
@@ -23983,6 +24031,27 @@ Partial Class Ventas
TxtAtencionA.Enabled = True
GvPS.Columns(21).Visible = True
thOrden.Visible = True
If GvPS.Columns(21).Visible Then
For Each GvRow As GridViewRow In GvPS.Rows
If GvRow.RowType = DataControlRowType.Header Then
GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True
End If
If GvRow.RowType = DataControlRowType.DataRow Then
GvRow.FCTextBox("TxtOrden").Visible = True
If GvRow.FCTextBox("TxtOrden").ToEntero() <= 0 Then
GvRow.FCTextBox("TxtOrden").Text = GvRow.DataKey("Consec")
End If
End If
Next
End If
OrdenarPS(True)
UpCliente.Update()
UPPVentas.Update()
UpPS.Update()
@@ -33157,6 +33226,27 @@ Partial Class Ventas
imgCalendario.Visible = False
End If
GvPS.Columns(21).Visible = True
thOrden.Visible = True
If GvPS.Columns(21).Visible Then
For Each GvRow As GridViewRow In GvPS.Rows
If GvRow.RowType = DataControlRowType.Header Then
GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True
End If
If GvRow.RowType = DataControlRowType.DataRow Then
GvRow.FCTextBox("TxtOrden").Visible = True
If GvRow.FCTextBox("TxtOrden").ToEntero() <= 0 Then
GvRow.FCTextBox("TxtOrden").Text = GvRow.DataKey("Consec")
End If
End If
Next
End If
OrdenarPS(True)
UpPS.Update()
UPPDescuento.Update()
UPObservaciones.Update()