This commit is contained in:
2024-10-09 08:25:15 -07:00
8 changed files with 632 additions and 362 deletions

View File

@@ -4,6 +4,7 @@ Option Strict On
Imports System.Data Imports System.Data
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports Extensiones Imports Extensiones
Imports iText.StyledXmlParser.Css.Resolve.Shorthand.Impl
Public Class ClsCompras Public Class ClsCompras
Implements IDisposable Implements IDisposable
@@ -3115,6 +3116,29 @@ Public Class ClsCompras
Return Retorno Return Retorno
End Function End Function
Public Function GetComprobacionPagosContabilizados(CvePersonal As Integer, CveCajaChica As Integer, NumeroReembolso As String, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Comp_ComprobacionPagosContabilizadosGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
.Add("@CveCajaChica", SqlDbType.Int).Value = CveCajaChica
.Add("@NumeroReembolso", SqlDbType.VarChar).Value = NumeroReembolso
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveComprobacion", SqlDbType.Int).Direction = ParameterDirection.Output
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al consultar los pagos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetRepComprasInventarios(FechaIC As Date, FechaFC As Date, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CveSubProyecto As Integer, CveProveedor As Integer) As Boolean Public Function GetRepComprasInventarios(FechaIC As Date, FechaFC As Date, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CveSubProyecto As Integer, CveProveedor As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Comp_InventariosRepGet") DataAdapter("PA_Comp_InventariosRepGet")

View File

@@ -865,6 +865,37 @@ Public Class ClsContabilidad
End Function End Function
Public Function PrePolizaCompraCambiaReembolso(CvePrePoliza As Integer, CvePrePolizaVieja As Integer, CveCompra As Integer, CveEmpresa As Integer, Opcion As Integer) As Boolean
Dim Retorno As Boolean = False
SeUnifico = False
YaEstabaUnifida = False
EstaContabilizada = False
DataAdapter("PA_Conta_PrePolizaCompraCambiaReembolso")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
.Add("@CvePrePolizaVieja", SqlDbType.Int).Value = CvePrePolizaVieja
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@Opcion", SqlDbType.Int).Value = Opcion
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex1 As SqlException
OnError("Ocurrió un error al actualizar prepolizas", ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
Catch ex As Exception
OnError("Ocurrió un error al actualizar prepolizas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function PrePolizaSimplificacion(CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean Public Function PrePolizaSimplificacion(CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Conta_PrePolizasSimplificacion") DataAdapter("PA_Conta_PrePolizasSimplificacion")
@@ -878,9 +909,9 @@ Public Class ClsContabilidad
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
Retorno = True Retorno = True
Catch ex1 As SqlException Catch ex1 As SqlException
OnError("Ocurrió un error al simplificar prepolizas", ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error al actualizar prepolizas", ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al simplificar prepolizas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error al actualizar prepolizas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno

View File

@@ -173,9 +173,13 @@ Public Class ClsPaginas
Dim tHora As Integer = 0 Dim tHora As Integer = 0
'If UsuarioActual IsNot Nothing AndAlso UsuarioActual.Empresa IsNot Nothing Then tHora = UsuarioActual.Empresa.UTCOffset 'If UsuarioActual IsNot Nothing AndAlso UsuarioActual.Empresa IsNot Nothing Then tHora = UsuarioActual.Empresa.UTCOffset
Try Try
If HttpContext.Current.Session IsNot Nothing AndAlso HttpContext.Current.Session("UsuarioSIG") IsNot Nothing AndAlso CType(HttpContext.Current.Session("UsuarioSIG"), Usuario).Empresa IsNot Nothing Then tHora = CType(HttpContext.Current.Session("UsuarioSIG"), Usuario).Empresa.UTCOffset If HttpContext.Current IsNot Nothing Then
If HttpContext.Current.Session IsNot Nothing AndAlso HttpContext.Current.Session("UsuarioSIG") IsNot Nothing AndAlso CType(HttpContext.Current.Session("UsuarioSIG"), Usuario).Empresa IsNot Nothing Then
tHora = CType(HttpContext.Current.Session("UsuarioSIG"), Usuario).Empresa.UTCOffset
End If
End If
Catch ex As Exception Catch ex As Exception
tHora = 0
End Try End Try
Return If(tHora <> 0, Now.ToUniversalTime.AddMinutes(tHora), Now) Return If(tHora <> 0, Now.ToUniversalTime.AddMinutes(tHora), Now)

View File

@@ -331,7 +331,7 @@ Namespace Extensiones
Public Sub GuardaLogAD(Mensaje As String, Optional Archivo As String = "Log") Public Sub GuardaLogAD(Mensaje As String, Optional Archivo As String = "Log")
Dim ArchivoW As StreamWriter Dim ArchivoW As StreamWriter
Dim MensajeFormato As String = String.Format("{0}{1}Log: {2} | Fecha:{3}", Chr(13), Chr(10), Mensaje, ClsPaginas.NowADS().ToString("dd/MM/yyyy HH:mm")) Dim MensajeFormato As String = String.Format("{0}{1}Log: {2} | Fecha:{3}", Chr(13), Chr(10), Mensaje, DateTime.Now.ToString("dd/MM/yyyy HH:mm"))
Try Try
ArchivoW = New StreamWriter(String.Format("{0}\Log\{1}.txt", AppDomain.CurrentDomain.BaseDirectory, Archivo), True, System.Text.Encoding.UTF8) ArchivoW = New StreamWriter(String.Format("{0}\Log\{1}.txt", AppDomain.CurrentDomain.BaseDirectory, Archivo), True, System.Text.Encoding.UTF8)

View File

@@ -13,6 +13,9 @@ Imports MoreLinq
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports ClsPaginas Imports ClsPaginas
Imports System.Activities.Expressions Imports System.Activities.Expressions
Imports Microsoft.Data.Edm.Expressions
Imports Telerik.Web.UI
Imports DocumentFormat.OpenXml.Math
Partial Class Compras_Compras Partial Class Compras_Compras
Inherits ClsPaginas Inherits ClsPaginas
@@ -3549,7 +3552,7 @@ Partial Class Compras_Compras
ViewState("CveProveedor") = ObjProveedor.CveProveedor ViewState("CveProveedor") = ObjProveedor.CveProveedor
ViewState("CveTipoProveedor") = ObjProveedor.CveTipoProveedor ViewState("CveTipoProveedor") = ObjProveedor.CveTipoProveedor
RFCProveedor = ObjProveedor.RFC RFCProveedor = ObjProveedor.RFC
If ObjProveedor.CveTipoProveedor = 2 Then If ObjProveedor.CveTipoProveedor = 2 Then
LblProveedor.Text = "Acreedor:" LblProveedor.Text = "Acreedor:"
Else Else
@@ -8693,10 +8696,6 @@ Partial Class Compras_Compras
Next Next
'If Not validaNumeroReembolso() Then
' Exit Sub
'End If
Dim ObjCompra As New ClsCompras Dim ObjCompra As New ClsCompras
Dim ObjProveedores As New ClsCompProveedores(ObjCompra.IniciaTransacSQL()) Dim ObjProveedores As New ClsCompProveedores(ObjCompra.IniciaTransacSQL())
Dim ObjInventario As New ClsInventarios(ObjCompra.IniciaTransacSQL) Dim ObjInventario As New ClsInventarios(ObjCompra.IniciaTransacSQL)
@@ -9240,6 +9239,9 @@ Partial Class Compras_Compras
End If End If
If Retorno AndAlso Not validaNumeroReembolso(ObjCompra.IniciaTransacSQL()) Then
Retorno = False
End If
Catch ex As Exception Catch ex As Exception
Alert("Ocurrió un error al actualizar la compra", TipoMensaje.MsgError) Alert("Ocurrió un error al actualizar la compra", TipoMensaje.MsgError)
@@ -9248,6 +9250,9 @@ Partial Class Compras_Compras
Finally Finally
If Retorno Then If Retorno Then
If ObjContabilidad.MensajePolizaDescuadre IsNot Nothing AndAlso ObjContabilidad.MensajePolizaDescuadre.ToString <> "" Then If ObjContabilidad.MensajePolizaDescuadre IsNot Nothing AndAlso ObjContabilidad.MensajePolizaDescuadre.ToString <> "" Then
Alert(ObjContabilidad.MensajePolizaDescuadre.ToString) Alert(ObjContabilidad.MensajePolizaDescuadre.ToString)
@@ -9290,12 +9295,109 @@ Partial Class Compras_Compras
End Sub End Sub
Private Function validaNumeroReembolso() As Boolean Private Function validaNumeroReembolso(transaccionSql As SqlTransaction) As Boolean
If NumeroReembolsoOriginal <> TxtNumeroReembolso.Text Then
Dim objCompras As New ClsCompras(transaccionSql)
Dim objConta As New ClsContabilidad(transaccionSql)
Dim tienePagoContabilizado As Boolean = False
Dim ErrorProceso As Boolean = False
Dim CvePrePolizaReembolsoActual As Integer = CvePrePoliza
Dim CvePrePolizaReembolsoNuevo As Integer = -1
If TxtRembolsoNumero.Text.Trim.Length > 0 Then
Dim CvePersonalVal As Integer = -1
Dim CveCajaChicaVal As Integer = -1
If RblRembolso.SelectedValue.ToEntero = 1 Then
CvePersonalVal = DdlRembolsoPersonal.SelectedValue.ToEntero
Else
CveCajaChicaVal = DdlRembolsoCajaChica.SelectedValue.ToEntero
End If
If objCompras.GetComprobacion(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
If objCompras.DtResultados.Rows.Count > 0 Then
CvePrePolizaReembolsoNuevo = objCompras.DtResultados.Rows(0)("CvePrePoliza").ToString.ToEntero
Else
Dim tConcepto As String = If(DdlRembolsoPersonal.SelectedValue.ToEntero > 0, DdlRembolsoPersonal.SelectedItem.Text, DdlRembolsoCajaChica.SelectedItem.Text)
tConcepto = String.Format("{0}-{1}", tConcepto, TxtRembolsoNumero.Text.Trim)
CvePrePolizaReembolsoNuevo = objConta.AddPrePolizas("Compras Comproba", 1, 0, 0, 1, TxtFecha.Text.ToDate, tConcepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not objCompras.AddComprobacion(DdlRembolsoPersonal.SelectedValue.ToEntero, DdlRembolsoCajaChica.SelectedValue.ToEntero, TxtRembolsoNumero.Text.Trim, CvePrePolizaReembolsoNuevo, UsuarioActual.CveEmpresa) > 0 Then
ErrorProceso = True
End If
End If
End If
If NumeroReembolsoOriginal = "" And TxtRembolsoNumero.Text.Trim.Length > 0 Then
If objCompras.GetComprobacionPagosContabilizados(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
If objCompras.DtResultados IsNot Nothing AndAlso objCompras.DtResultados.Rows.Count > 0 Then
tienePagoContabilizado = True
End If
If tienePagoContabilizado Then
Alert($"No se puede actualizar el número de reembolso {TxtRembolsoNumero.Text}, ya tiene pagos contabilizados.", TipoMensaje.MsgAdvertencia)
Return False
End If
If objConta.GetPrePoliza(CvePrePoliza, UsuarioActual.CveEmpresa) Then
Dim FolioPoliza As Integer = objConta.DtResultados.Rows(0)("FolioPoliza").ToString.ToEntero
If FolioPoliza > 0 Then
If Not objConta.ContabilizaDesContabilizaPrePoliza(CvePrePoliza, False, UsuarioActual.CveEmpresa) Then
ErrorProceso = True
End If
End If
End If
Else
ErrorProceso = True
End If
ElseIf NumeroReembolsoOriginal.Length > 0 And TxtRembolsoNumero.Text.Trim.Length > 0 Then
'cambiar de prepoliza la compra actual, de la prepoliza actual a la nueva
If Not objConta.PrePolizaCompraCambiaReembolso(CvePrePolizaReembolsoNuevo, CvePrePoliza, CveCompra, UsuarioActual.CveEmpresa, 1) Then
ErrorProceso = True
End If
End If
Else
If NumeroReembolsoOriginal.Length > 0 And TxtRembolsoNumero.Text.Trim.Length = 0 Then
'Actualizar PrePoliza Actual de Donde CveCompra = CveCompra poner CvePrePolizaOriginal
If Not objConta.PrePolizaCompraCambiaReembolso(-1, CvePrePoliza, CveCompra, UsuarioActual.CveEmpresa, 2) Then
ErrorProceso = True
End If
End If
End If End If
Return If(ErrorProceso, False, True)
End Function End Function
Private Sub MandaCorreoActualizacionDetalle() Private Sub MandaCorreoActualizacionDetalle()
@@ -10785,7 +10887,7 @@ Partial Class Compras_Compras
If ChkConsignacion.Checked Then If ChkConsignacion.Checked Then
End If End If
UpINV.Update() UpInv.Update()
End Sub End Sub
@@ -11611,6 +11713,8 @@ Partial Class Compras_Compras
#Region " AJUSTA IMPORTES " #Region " AJUSTA IMPORTES "
Private Sub AjustaImporteUltimoConcepto(ImporteAjuste As Decimal, Optional EsCarga As Boolean = False) Private Sub AjustaImporteUltimoConcepto(ImporteAjuste As Decimal, Optional EsCarga As Boolean = False)
If ImporteAjuste = 0 Then Exit Sub If ImporteAjuste = 0 Then Exit Sub
Dim Amortizacion As Decimal = 0 Dim Amortizacion As Decimal = 0
@@ -17322,18 +17426,18 @@ Partial Class Compras_Compras
End If End If
End If End If
Select Case Modalidad 'Select Case Modalidad
Case "A" ' Case "A"
If Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) <> TmpDT.MAX("IVAPorcentaje").ToDouble And TmpDT.MAX("IVAPorcentaje").ToDouble <> 0 And Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) <> 0 And TmpDT.Rows.Count > 0 Then ' If Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) <> TmpDT.MAX("IVAPorcentaje").ToDouble And TmpDT.MAX("IVAPorcentaje").ToDouble <> 0 And Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) <> 0 And TmpDT.Rows.Count > 0 Then
Alert("No puede haber dos tipos de IVA en la compra.", TipoMensaje.MsgAdvertencia) ' Alert("No puede haber dos tipos de IVA en la compra.", TipoMensaje.MsgAdvertencia)
Exit Sub ' Exit Sub
End If ' End If
Case "U" ' Case "U"
If Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) <> TmpDT.FiltraParametros($"Consec <> {Index}").MAX("IVAPorcentaje").ToDouble And TmpDT.FiltraParametros($"Consec <> {Index}").MAX("IVAPorcentaje").ToDouble <> 0 And Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) <> 0 And TmpDT.FiltraParametros($"Consec <> {Index}").Rows.Count > 0 Then ' If Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) <> TmpDT.FiltraParametros($"Consec <> {Index}").MAX("IVAPorcentaje").ToDouble And TmpDT.FiltraParametros($"Consec <> {Index}").MAX("IVAPorcentaje").ToDouble <> 0 And Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) <> 0 And TmpDT.FiltraParametros($"Consec <> {Index}").Rows.Count > 0 Then
Alert("No puede haber dos tipos de IVA en la compra.", TipoMensaje.MsgAdvertencia) ' Alert("No puede haber dos tipos de IVA en la compra.", TipoMensaje.MsgAdvertencia)
Exit Sub ' Exit Sub
End If ' End If
End Select 'End Select
Dim Total As Decimal = (TxtCantidad.Text.ToDecimal * TxtPrecio.Text.ToDecimal) - TxtDescuentoModal.Text.ToDecimal Dim Total As Decimal = (TxtCantidad.Text.ToDecimal * TxtPrecio.Text.ToDecimal) - TxtDescuentoModal.Text.ToDecimal

View File

@@ -69,9 +69,9 @@
<li> <li>
<asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server"> <i class="fa fa-external-link"></i> Solicitudes SAT</asp:LinkButton> <asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server"> <i class="fa fa-external-link"></i> Solicitudes SAT</asp:LinkButton>
</li> </li>
<li> <%--<li>
<asp:LinkButton ID="LnkBitacoraFacturas" runat="server" OnClick="LnkBitacoraFacturas_Click"><i class="fa fa-book" ></i> Bitácora Facturas</asp:LinkButton> <asp:LinkButton ID="LnkBitacoraFacturas" runat="server" OnClick="LnkBitacoraFacturas_Click"><i class="fa fa-book" ></i> Bitácora Facturas</asp:LinkButton>
</li> </li>--%>
<li> <li>
<asp:LinkButton ID="LnkVinculacionMasivaComplementos" runat="server" OnClick="LnkVinculacionMasivaComplementos_Click" Visible ="false" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea realizar la vinculación masiva de complementos?" data-btn-ok-label="si"><i class="fa fa-tasks" ></i> Vinculación Masiva Complementos</asp:LinkButton> <asp:LinkButton ID="LnkVinculacionMasivaComplementos" runat="server" OnClick="LnkVinculacionMasivaComplementos_Click" Visible ="false" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea realizar la vinculación masiva de complementos?" data-btn-ok-label="si"><i class="fa fa-tasks" ></i> Vinculación Masiva Complementos</asp:LinkButton>
</li> </li>
@@ -1360,7 +1360,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<asp:GridView ID="GVSolicitudesNominas" runat="server" GridLines="None" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" AutoGenerateColumns="False" OnRowDataBound="GVSolicitudesNominas_RowDataBound" <asp:GridView ID="GVSolicitudesHistorial" runat="server" GridLines="None" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" AutoGenerateColumns="False" OnRowDataBound="GVSolicitudesHistorial_RowDataBound"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros" ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="CveSolicitudDetalle,CveSolicitud,idSolicitudCFDI,idSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa,ArchivoXML,Folio,CveTipoSolicitud,TipoDescargaStr"> DataKeyNames="CveSolicitudDetalle,CveSolicitud,idSolicitudCFDI,idSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa,ArchivoXML,Folio,CveTipoSolicitud,TipoDescargaStr">
<Columns> <Columns>

File diff suppressed because it is too large Load Diff

View File

@@ -7572,7 +7572,7 @@ Partial Class Ventas
UpFacturasRelacionadas.Update() UpFacturasRelacionadas.Update()
End Sub End Sub
Protected Sub CreaTmpFacturasRelacionadas() Protected Sub CreaTmpFacturasRelacionadas()
If CveVenta <= 0 OrElse EsCreaApartirDe Then If CveVenta <= 0 OrElse EsCreaApartirDe OrElse Me.AplicoNCFacturaActual Then
Me.TmpDTFacturasRelacionadas = New DataTable() Me.TmpDTFacturasRelacionadas = New DataTable()
Me.TmpDTFacturasRelacionadas.Columns.Add(New DataColumn("CveVenta", GetType(Integer))) Me.TmpDTFacturasRelacionadas.Columns.Add(New DataColumn("CveVenta", GetType(Integer)))
Me.TmpDTFacturasRelacionadas.Columns.Add(New DataColumn("SerieFolio", GetType(String))) Me.TmpDTFacturasRelacionadas.Columns.Add(New DataColumn("SerieFolio", GetType(String)))
@@ -7580,7 +7580,7 @@ Partial Class Ventas
End If End If
End Sub End Sub
Protected Sub LnkAgregarFacturaRelacionada_Click(sender As Object, e As EventArgs) Protected Sub LnkAgregarFacturaRelacionada_Click(sender As Object, e As EventArgs)
If CveVenta <= 0 OrElse EsCreaApartirDe Then If CveVenta <= 0 OrElse EsCreaApartirDe OrElse Me.AplicoNCFacturaActual Then
If Me.TmpDTFacturasRelacionadas Is Nothing Then If Me.TmpDTFacturasRelacionadas Is Nothing Then
CreaTmpFacturasRelacionadas() CreaTmpFacturasRelacionadas()
End If End If
@@ -7611,7 +7611,7 @@ Partial Class Ventas
End Sub End Sub
Protected Sub LnkAgregarFolioFiscalRelacionada_Click(sender As Object, e As EventArgs) Protected Sub LnkAgregarFolioFiscalRelacionada_Click(sender As Object, e As EventArgs)
If CveVenta <= 0 OrElse EsCreaApartirDe Then If CveVenta <= 0 OrElse EsCreaApartirDe OrElse Me.AplicoNCFacturaActual Then
If Me.TmpDTFacturasRelacionadas Is Nothing Then If Me.TmpDTFacturasRelacionadas Is Nothing Then
CreaTmpFacturasRelacionadas() CreaTmpFacturasRelacionadas()
End If End If
@@ -7641,7 +7641,7 @@ Partial Class Ventas
End Sub End Sub
Protected Sub BtnAgregarFacturasRelaciondas_Click(sender As Object, e As EventArgs) Protected Sub BtnAgregarFacturasRelaciondas_Click(sender As Object, e As EventArgs)
If CveVenta <= 0 OrElse EsCreaApartirDe Then If CveVenta <= 0 OrElse EsCreaApartirDe OrElse Me.AplicoNCFacturaActual Then
If Me.TmpDTFacturasRelacionadas Is Nothing OrElse Me.TmpDTFacturasRelacionadas.Rows.Count = 0 Then If Me.TmpDTFacturasRelacionadas Is Nothing OrElse Me.TmpDTFacturasRelacionadas.Rows.Count = 0 Then
Me.AplicaRelacionManual = False Me.AplicaRelacionManual = False
Alert("No hay facturas para relacionar", TipoMensaje.MsgAdvertencia) Alert("No hay facturas para relacionar", TipoMensaje.MsgAdvertencia)
@@ -7655,7 +7655,7 @@ Partial Class Ventas
End If End If
Me.AplicaRelacionManual = True Me.AplicaRelacionManual = True
RegistraScript("$('#DivFacturasRelaciondas').modal('hide');", "R1") RegistraScript("$('#DivFacturasRelacionadas').modal('hide');", "R1")
Alert("Las facturas seleccionadas se relacionaran con la factura nueva") Alert("Las facturas seleccionadas se relacionaran con la factura nueva")
End If End If
@@ -7723,7 +7723,7 @@ Partial Class Ventas
' RBLPago.SelectedValue = "2" ' RBLPago.SelectedValue = "2"
'End If 'End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso Me.PermiteCredito Then If Me.PermiteCredito Then
If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
If CreditoDispo > 0 Then If CreditoDispo > 0 Then
@@ -13425,6 +13425,14 @@ Partial Class Ventas
End If End If
Obj.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero() Obj.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero()
If HdnFolioFiscalNC.Value <> "0" And HdnFolioFiscalNC.Value <> "" Then Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value) If HdnFolioFiscalNC.Value <> "0" And HdnFolioFiscalNC.Value <> "" Then Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value)
'SI LA NOTA DE CREDITO ES POR AMORTIZACION DE ANTICIPO , TAMBIEN DEBE TENER EL TIPO RELACION 07
If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso DdlTipoRelacionAnticipo.SelectedValue.ToEntero() = 7 Then
Obj.CveTipoRelacion = 7
Timbre.CFDIRelacionados.TipoRelacion = "07"
Timbre.CFDIRelacionados.TipoRelacionTexto = "CFDI por aplicación de anticipo"
End If
End If End If
' cuando es refacturacoin es cfdirelacionado, con relacion 04 ' cuando es refacturacoin es cfdirelacionado, con relacion 04
If Timbre.Comprobante.TipoComprobante = "I" AndAlso NuevaFactura = 1 Then If Timbre.Comprobante.TipoComprobante = "I" AndAlso NuevaFactura = 1 Then
@@ -13501,25 +13509,6 @@ Partial Class Ventas
Timbre.CFDIRelacionados.TipoRelacionTexto = "" Timbre.CFDIRelacionados.TipoRelacionTexto = ""
End If End If
'SI LAS FACTURAS SE RELACIONARAN MANUALMENTE SE AGREGAN
If Me.AplicaRelacionManual AndAlso DdlTipoRelacionARelacionar.SelectedValue.ToEntero() > 0 Then
Dim CveTipoRelacion As Integer = DdlTipoRelacionARelacionar.SelectedValue.ToEntero()
Obj.CveTipoRelacion = DdlTipoRelacionARelacionar.SelectedValue.ToEntero()
Dim RowTipoRelacion As DataRow = GlobalDTVtaTiposRelacion().FiltroPrimero($"CveTipoRelacion = {CveTipoRelacion}")
Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString()
Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString()
For Each GvRow As GridViewRow In GvFacturasRelacionadas.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
Timbre.CFDIRelacionados.UUID.Add(GvRow.DataKey("FolioFiscal").Replace("test", ""))
End If
Next
End If
'DEVOLUCIONES DE OTRA VENTA, APLICADAS EN UNA NUEVA 'DEVOLUCIONES DE OTRA VENTA, APLICADAS EN UNA NUEVA
If UsuarioActual.CveEmpresa.Contiene(1, 189) AndAlso Obj.TipoDocto = "Ing" AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then If UsuarioActual.CveEmpresa.Contiene(1, 189) AndAlso Obj.TipoDocto = "Ing" AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
If ListaDevolucionesAplicadas IsNot Nothing AndAlso ListaDevolucionesAplicadas.Count > 0 Then If ListaDevolucionesAplicadas IsNot Nothing AndAlso ListaDevolucionesAplicadas.Count > 0 Then
@@ -13540,6 +13529,27 @@ Partial Class Ventas
End If End If
End If End If
'SI LAS FACTURAS SE RELACIONARAN MANUALMENTE SE AGREGAN
If Me.AplicaRelacionManual AndAlso DdlTipoRelacionARelacionar.SelectedValue.ToEntero() > 0 Then
Dim CveTipoRelacion As Integer = DdlTipoRelacionARelacionar.SelectedValue.ToEntero()
Obj.CveTipoRelacion = DdlTipoRelacionARelacionar.SelectedValue.ToEntero()
Dim RowTipoRelacion As DataRow = GlobalDTVtaTiposRelacion().FiltroPrimero($"CveTipoRelacion = {CveTipoRelacion}")
Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString()
Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString()
Timbre.CFDIRelacionados.UUID.Clear()
For Each GvRow As GridViewRow In GvFacturasRelacionadas.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
Timbre.CFDIRelacionados.UUID.Add(GvRow.DataKey("FolioFiscal").Replace("test", ""))
End If
Next
End If
Dim totSubTotal As Decimal = Obj.SubTotal Dim totSubTotal As Decimal = Obj.SubTotal
Dim totIVA As Decimal = Obj.IVA Dim totIVA As Decimal = Obj.IVA
Dim totRetIVA As Decimal = Obj.RetIVA Dim totRetIVA As Decimal = Obj.RetIVA
@@ -30215,6 +30225,13 @@ Partial Class Ventas
CveVentaUsadoDevolucionEfectivo = DdlVentaUsado.SelectedValue.ToEntero() CveVentaUsadoDevolucionEfectivo = DdlVentaUsado.SelectedValue.ToEntero()
End If End If
'SI SE VA APLICAR A LA FACTURA ACTUAL, NO UTILIZAR LOS DATOS DE AMORTIZACION
Me.TmpDTAnticiposNCIxCCliente = Nothing
GVAnticipos.DataSource = Me.TmpDTAnticiposNCIxCCliente
GVAnticipos.DataBind()
DdlTipoAmortizacionAnticipo.SelectedValueExist("-1")
DdlTipoRelacionAnticipo.SelectedValueExist("-1")
AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento, AplicoNCFacturaActual:=True) AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento, AplicoNCFacturaActual:=True)
End Sub End Sub
@@ -39420,6 +39437,19 @@ Partial Class Ventas
Protected Sub LnkFacturasRelacionadas_Click(sender As Object, e As EventArgs) Protected Sub LnkFacturasRelacionadas_Click(sender As Object, e As EventArgs)
CargaFacturasARelacionar() CargaFacturasARelacionar()
If Me.AplicoNCFacturaActual Then
DivDdlFacturaRela.Visible = True
BtnAgregarFacturasRelaciondas.Visible = True
DdlTipoRelacionARelacionar.Enabled = True
DdlFacturaARelacionar.Enabled = True
Me.TmpDTFacturasRelacionadas = Nothing
GvFacturasRelacionadas.Columns(2).Visible = True
GvFacturasRelacionadas.DataSource = Me.TmpDTFacturasRelacionadas
GvFacturasRelacionadas.DataBind()
End If
RegistraScript("$('#DivFacturasRelacionadas').modal('show')") RegistraScript("$('#DivFacturasRelacionadas').modal('show')")
UpFacturasRelacionadas.Update() UpFacturasRelacionadas.Update()
End Sub End Sub