Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -381,6 +381,7 @@ Namespace Modelos
|
||||
Public Class MAnticipoRelacionado
|
||||
Public Property CveVenta As Integer
|
||||
Public Property FolioFiscal As String
|
||||
Public Property Tipo As String
|
||||
End Class
|
||||
<Serializable>
|
||||
Public Class MVentaDetalleCotizacion
|
||||
@@ -1119,7 +1120,7 @@ Namespace Modelos
|
||||
'MENSAJE PRINCIPAL
|
||||
|
||||
If MostrarURL Then
|
||||
MensajeAlert.AppendFormat("<br/>La {0}: <a class=""Texto"" target=""_blank"" href=""/Ventas/Ventas.aspx?CveVenta={2}""><b></b>{1}</a> se generó correctamente.<br/><br/>", If(Me.TipoDocumento = "Ingresos", "Factura", Me.TipoDocumento), Me.SerieFolio, Me.CveVenta)
|
||||
MensajeAlert.AppendFormat("<br/>La {0}: <a class=""Texto"" target=""_blank"" href=""/Ventas/Ventas.aspx?CveVenta={2}""><b></b>{1}</a> se generó correctamente.<br/><br/>", If(Me.TipoDocumento = "Ingresos", "Factura", If(Me.TipoDocumento = "Egresos", "Nota de crédito", Me.TipoDocumento)), Me.SerieFolio, Me.CveVenta)
|
||||
Else
|
||||
MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", If(Me.TipoDocumento = "Ingresos", "Factura", Me.TipoDocumento), Me.SerieFolio))
|
||||
End If
|
||||
|
||||
@@ -393,7 +393,11 @@
|
||||
<div class="row">
|
||||
<div class="note note-success">
|
||||
<div class="row">
|
||||
<div class="col-md-1"><b>Nombre:</b></div>
|
||||
<div class="col-md-2">
|
||||
<asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money' style='font-size: 18px !important; color: #3c763d !important;'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
|
||||
|
||||
<b>Nombre:</b>
|
||||
</div>
|
||||
<div class="col-md-4"> <label><asp:Literal ID="LtlNombre" runat="server"></asp:Literal></label> </div>
|
||||
|
||||
<div class="col-md-1"><b>Folio:</b></div>
|
||||
@@ -411,10 +415,6 @@
|
||||
<div class="col-md-1" style="text-align: right;">
|
||||
<asp:LinkButton ID="LnkLiberar" runat="server" CssClass="btn btn-xs btn-success" Text="Liberar" OnClick="LnkLiberar_Click" />
|
||||
</div>
|
||||
<div class="col-md-1" style="text-align: right;">
|
||||
<asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -512,7 +512,7 @@ Partial Class Ventas_PVCobranza
|
||||
|
||||
Dim respFactura As Modelos.Factura.MMensajeFactura = Nothing
|
||||
Dim respNC As Modelos.Factura.MMensajeFactura = Nothing
|
||||
|
||||
Dim RegistrarPago As Boolean = True
|
||||
Try
|
||||
'FACTURAR LA REMISION PARA HACER EL PAGO
|
||||
If UsuarioActual.CveEmpresa.Contiene(189, 197) AndAlso VentaActual.TipoDocto = "Rem" Then
|
||||
@@ -563,6 +563,7 @@ Partial Class Ventas_PVCobranza
|
||||
End If
|
||||
|
||||
If MsgError = "" Then
|
||||
If SaldoPendiente > 0 Then
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("PVCobranza", 11, 0, 0, 1, Fecha, $"Pago {VentaActual.SerieFolio}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
|
||||
|
||||
If CvePrePoliza > 0 Then
|
||||
@@ -631,6 +632,10 @@ Partial Class Ventas_PVCobranza
|
||||
Else
|
||||
MsgError = "Error al registrar prepólizas"
|
||||
End If
|
||||
Else
|
||||
'SI NO TIENE SALDO PENDIENTE NO GENERAR POLIZA PARA EL PAGO
|
||||
RegistrarPago = False
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgError = "Error al registrar el pago"
|
||||
@@ -640,15 +645,25 @@ Partial Class Ventas_PVCobranza
|
||||
If MsgError = "" Then
|
||||
ObjVentas2.Commit()
|
||||
Dim msBuild As New StringBuilder()
|
||||
Dim MsgTimbrado As String = ""
|
||||
|
||||
'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO
|
||||
'If respFactura IsNot Nothing Then
|
||||
' If Not respFactura.Factura.TimbrarFactura() Then
|
||||
' msBuild.Append("La factura no se pudo timbrar<br/> ")
|
||||
' End If
|
||||
'End If
|
||||
If 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)
|
||||
Else
|
||||
AjustarTimbre(respFactura.Factura, Nothing)
|
||||
MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing)
|
||||
End If
|
||||
End If
|
||||
|
||||
If respFactura IsNot Nothing Then
|
||||
If RegistrarPago Then
|
||||
msBuild.Append($"Pago Registrado correctamente.")
|
||||
End If
|
||||
|
||||
For Each m In respFactura.Mensajes
|
||||
msBuild.AppendFormat("<br/> {0}", m)
|
||||
Next
|
||||
@@ -663,6 +678,10 @@ Partial Class Ventas_PVCobranza
|
||||
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®ENERAR=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()
|
||||
@@ -996,6 +1015,79 @@ Partial Class Ventas_PVCobranza
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Private Sub AjustarTimbre(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura)
|
||||
ObjFactura.Timbre.CFDIRelacionados.UUID.Clear()
|
||||
If HdnTipoAmortizacion.Value = "2" Then
|
||||
Dim Anticipos = ListaAnticiposAplicados.Where(Function(Obj) Obj.Tipo = "Ant")
|
||||
For Each Ant As Modelos.MAnticipoRelacionado In Anticipos
|
||||
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
|
||||
Next
|
||||
|
||||
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07"
|
||||
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
|
||||
|
||||
'AJUSTAR NC
|
||||
If ObjNC IsNot Nothing Then
|
||||
ObjNC.Timbre.CFDIRelacionados.UUID.Clear()
|
||||
|
||||
ObjNC.Timbre.CFDIRelacionados.TipoRelacion = "07"
|
||||
ObjNC.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
|
||||
End If
|
||||
End If
|
||||
|
||||
'DEVOLUCIONES DE OTRA VENTA, APLICADAS EN UNA NUEVA
|
||||
If HdnTipoAmortizacion.Value = "4" Then
|
||||
Dim DevolucionesNC = ListaAnticiposAplicados.Where(Function(Obj) Obj.Tipo = "NC")
|
||||
For Each Ant As Modelos.MAnticipoRelacionado In DevolucionesNC
|
||||
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
|
||||
Next
|
||||
|
||||
'TEMPORAL- DEBE SER TIPO RELACION "01 - Nota de crédito de los documentos relacionados"
|
||||
Dim CveTipoRelacion As Integer = 1
|
||||
|
||||
ObjFactura.CveTipoRelacion = CveTipoRelacion
|
||||
|
||||
Dim RowTipoRelacion As DataRow = GlobalDTVtaTiposRelacion().FiltroPrimero($"CveTipoRelacion = {CveTipoRelacion}")
|
||||
|
||||
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString()
|
||||
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function TimbrarFactura(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura) As String
|
||||
Dim MsgErrorTimbrado As String = ""
|
||||
Dim SeTimbro As Boolean = False
|
||||
Dim ObjTimbrado As New Timbrado
|
||||
Try
|
||||
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
|
||||
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
|
||||
MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
|
||||
ObjTimbrado = Nothing
|
||||
|
||||
If SeTimbro AndAlso ObjNC IsNot Nothing Then
|
||||
If ObjNC.Timbre IsNot Nothing Then
|
||||
ObjNC.Timbre.CFDIRelacionados.UUID.Clear()
|
||||
ObjNC.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
|
||||
|
||||
Dim ObjTimbradoNC As New Timbrado
|
||||
Dim TimbroNC As Boolean = ObjTimbradoNC.TimbrarFactura(UsuarioActual, ObjNC)
|
||||
|
||||
If Not TimbroNC Then
|
||||
MsgErrorTimbrado = ObjTimbradoNC.MensajeErrorCFDI
|
||||
End If
|
||||
ObjTimbradoNC = Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el timbrado", ex)
|
||||
End Try
|
||||
|
||||
Return MsgErrorTimbrado
|
||||
End Function
|
||||
|
||||
Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String
|
||||
Dim Retorno As String = ""
|
||||
Dim CveIEPago As Integer = 0
|
||||
@@ -1751,7 +1843,11 @@ Partial Class Ventas_PVCobranza
|
||||
Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal()
|
||||
|
||||
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
||||
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal")})
|
||||
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal"), .Tipo = gvr.DataKey("Tipo")})
|
||||
End If
|
||||
|
||||
If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
|
||||
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal"), .Tipo = gvr.DataKey("Tipo")})
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user