diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index c243c6058..29e08b635 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -758,11 +758,12 @@ Public Class ClsAcumuladores End Try Return Retorno End Function - Public Function GetGarantiasPolizaVirtual(CveVenta As Integer) As Boolean + Public Function GetGarantiasPolizaVirtual(CveVenta As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Acum_GarantiasPolizaVirtualGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index a268761f6..40d862b7f 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -1554,7 +1554,9 @@ Public Class ClsClientes Return Retorno End Function - Public Function AgregarClienteNoFrecuente(Nombre As String, Direccion As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Ciudad As String, Estado As String, Pais As String, RFC As String, CP As String, Telefono As String, Mail As String, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer, NumCuentaPago As String, Optional CvePrecioLista As Integer = -1) As Boolean + Public Function AgregarClienteNoFrecuente(Nombre As String, Direccion As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Ciudad As String, Estado As String, + Pais As String, RFC As String, CP As String, Telefono As String, Mail As String, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer, + NumCuentaPago As String, CveMetodoPago33 As Integer, CveFormaPago33 As Integer, Optional CvePrecioLista As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ClientesNoFrecuenteAdd") @@ -1575,6 +1577,8 @@ Public Class ClsClientes .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveMetodoPago33", SqlDbType.Int).Value = CveMetodoPago33 + .Add("@CveFormaPago33", SqlDbType.Int).Value = CveFormaPago33 .Add("@NumCuentaPago", SqlDbType.VarChar).Value = NumCuentaPago .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista @@ -1604,8 +1608,8 @@ Public Class ClsClientes End Try Return Retorno - End Function - + End Function + #Region "UNIFICAR CLIENTES" Public Function UnificarClientes(CveClienteAUnificar As Integer, CveClienteOriginal As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index bb62e0c26..95107e716 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -1267,6 +1267,11 @@ Public Class ClsOC _CveOrdenCompraDetalle = SqlAdapter.SelectCommand.Parameters("@vCveOrdenCompraDetalle").Value.ToString.ToEntero Retorno = True Catch ex As Exception + + If ex.Message.Contains("CK_OC_OrdenesCompraDetalle_RetIVA_Total") Then + Alert("La retención de iva no coincide con su total", TipoMensaje.MsgAdvertencia) + End If + OnError("Ocurrió un error al agregar el detalle de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index d5c7b5237..25fb3c073 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -2677,6 +2677,45 @@ Public Class ClsVentas Return OnError End Function + Public Function GetFacturasCanceladasPendientesWS(RFC As String, CveEmpresa As Integer, Optional showalert As Boolean = True) As Boolean + Dim retorno As Boolean = False + Try + + Dim objServicio As Cancelacion.CancelacionSoapClient = New Cancelacion.CancelacionSoapClient() + Dim resp As Cancelacion.StructCancel = objServicio.ObtienePendientes(RFC, "UserTest", "1234567890") + If resp.Estado = 0 Then + Dim XmlPendientes As String = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(resp.Xml)) + Dim theReader As IO.StringReader = New IO.StringReader(XmlPendientes) + Dim theDataSet As DataSet = New DataSet() + theDataSet.ReadXml(theReader) + + If theDataSet.Tables(0).Rows(0)("Uuid").ToString() <> "null" Then + Dim sb = New StringBuilder() + + For Each item As DataRow In theDataSet.Tables(0).Rows + sb.AppendFormat("{0};", item("Uuid").ToString()) + Next + + If GetFacturasCanceladasPendientes(sb.ToString(), CveEmpresa) Then + retorno = True + End If + + Else + If showalert Then + Alert("No se encontraron cancelaciones pendientes", ModExtensiones.TipoMensaje.MsgError) + End If + End If + Else + Alert("Error al obtener cancelaciones pendientes: " & resp.Descripcion, ModExtensiones.TipoMensaje.MsgError) + End If + + Catch ex As Exception + retorno = False + Me.OnError("Error al obtener cancelaciones pendientes: ", ex, "") + End Try + Return retorno + End Function + Public Function UpdateVentaFacturas(CveFactura As Integer, CveVenta As Integer, CveEmpresa As Integer) As Boolean Dim OnError As Boolean = False diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index fea43d93f..6df87817e 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -368,7 +368,7 @@ Namespace Modelos End If Timbre = New CFDITimbre End Sub - Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "") + Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False) Me.UsuarioActual = UsuarioActual Me.CveVenta = CveVenta Me.CveEmpresa = CveEmpresa @@ -393,7 +393,7 @@ Namespace Modelos Me.DtDetalle = ObjVentas.DtResultados.Copy() End If ObjVentas.Dispose() - IniciaValoresVentas() + IniciaValoresVentas(EsCancelacion) If String.IsNullOrEmpty(DirectorioServidor) Then DirectorioServidor = HttpContext.Current.Server.MapPath("/") End If @@ -446,7 +446,7 @@ Namespace Modelos Me.IEPS = 0 Me.CveAlmacenTraspasoOrigen = 0 End Sub - Private Sub IniciaValoresVentas() + Private Sub IniciaValoresVentas(Optional EsCancelacion As Boolean = False) If CveVenta > 0 AndAlso CveEmpresa > 0 Then Me.DtAnticipos = New DataTable() Me.DtAntNCVinculadas = New DataTable() @@ -492,6 +492,10 @@ Namespace Modelos Me.DtNCVinculadas = ObjVentas.DtResultados.Copy() End If + If TipoDocto.Contiene("Ant") AndAlso EsCancelacion Then + EsNCAmortizacion = True + End If + If ObjVentas.GetVentasAntNC(-1, CveVenta, AplicaAmortizacion:=EsNCAmortizacion) Then Me.DtAnticipos = ObjVentas.DtResultados.Copy() End If @@ -2333,7 +2337,7 @@ Namespace Modelos Exit Select End If - If ObjFactura.TipoDocto.Contiene("Ing", "Egs") AndAlso ValorMultiplicador = -1 Then + If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant") AndAlso ValorMultiplicador = -1 Then For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows If row2("CveConceptoContable").ToString().ToEntero = 11 Then importeMovimiento = row2("Importe").ToString().ToDecimal * ValorMultiplicador '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal) @@ -2344,7 +2348,10 @@ Namespace Modelos CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2("CveVenta").ToString().ToEntero, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, + CveVenta:=ObjFactura.CveVenta, CveVentaAmortizacion:=row2("CveVenta").ToString().ToEntero, CveCliente:=ObjFactura.CveCliente, + CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, + CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For Else diff --git a/Bancos/RepProgramarRecursos.aspx.vb b/Bancos/RepProgramarRecursos.aspx.vb index 11c343b68..af93c7aca 100644 --- a/Bancos/RepProgramarRecursos.aspx.vb +++ b/Bancos/RepProgramarRecursos.aspx.vb @@ -81,6 +81,14 @@ Partial Class Bancos_RepProgramarRecursos ViewState("UsuarioProgramo") = value End Set End Property + Private Property CveProveedor As Integer + Get + Return ViewState("CveProveedor").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveProveedor") = value + End Set + End Property #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -91,7 +99,6 @@ Partial Class Bancos_RepProgramarRecursos Orden = "" Opcion = "-1" HdnEmp.Value = UsuarioActual.CveEmpresa.ToString - If (UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1") Then DdlProveedores.setEsWebService(True) DdlProveedores.Attributes.Add("data-metodo", "getproveedores") @@ -303,7 +310,7 @@ Partial Class Bancos_RepProgramarRecursos End Sub Private Sub CargaDatos() - + CveProveedor = DdlProveedores.SelectedValue.ToEntero Dim CveUsuarioProgramo As Integer = DdlUsuarioProgramo.SelectedValue.ToEntero 'UsuarioActual.CveUsuario If Not ChkProgramadas.Checked Then CveUsuarioProgramo = -1 If ChkProgramadas.Checked And DdlUsuarioProgramo.SelectedValue.ToEntero = -1 Then CveUsuarioProgramo = -2 @@ -803,7 +810,8 @@ Partial Class Bancos_RepProgramarRecursos End Sub Private Sub Imprimir(Optional Formato As String = "PDF") - Dim Proveedor = If(DdlProveedores.SelectedValue = "-1", "", $" Proveedor: {DdlProveedores.SelectedText}") + + Dim Proveedor = If(CveProveedor = -1, "", $" Proveedor: {GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveProveedor = {CveProveedor}").Rows(0)("RazonSocial").ToString}") Dim Clasificacion = If(DdlProveedoresClasificaciones.SelectedValue = "-1", "", $" Clasificación: {DdlProveedoresClasificaciones.SelectedItem.Text}") Dim AplicaNC = If(DdlAplicaNC.SelectedValue = "-1", "", $" Aplica NC: {DdlAplicaNC.SelectedItem.Text}") Dim TipoProv = If(DdlTipoProveedor.SelectedValue = "0", "", $" Tipo Prov.: {DdlTipoProveedor.SelectedItem.Text}") diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 40e4e3811..e79fadb0c 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -907,8 +907,10 @@