diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4c116ea6f..2d8747e86 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1294,7 +1294,8 @@ Public Class ClsPaginas ObjPS.Dispose() End Get End Property - Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable + Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, + Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1, Optional Codigo As String = "-1") As DataTable Get Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) If CveEmpresa <> -1 Then @@ -1312,6 +1313,8 @@ Public Class ClsPaginas Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) If PSCodigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!PSCodigo) = PSCodigo)) + Codigo = Codigo.ToUpper().Trim() + If Codigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!Codigo).ToUpper().Trim() = Codigo)) If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus)) If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta)) If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS)) @@ -4619,6 +4622,7 @@ Public Class ClsPaginas PaginaDict.Add("/GPS/RepGastos.aspx".ToUpper(), 685) PaginaDict.Add("/GPS/RecursoConfiableTracking.aspx".ToUpper(), 692) PaginaDict.Add("/GPS/KimberlyClarkTracking.aspx".ToUpper(), -1) + PaginaDict.Add("/GPS/RepUnidades.aspx".ToUpper(), 780) #End Region 'INVENTARIOS #Region "Inventarios" @@ -4692,6 +4696,7 @@ Public Class ClsPaginas PaginaDict.Add("/Inventarios/EntregasPorRealizar.aspx".ToUpper(), 728) PaginaDict.Add("/Inventarios/CatAlmacenClasificacionSecciones.aspx".ToUpper(), 764) PaginaDict.Add("/Inventarios/ReconstruirCostos.aspx".ToUpper(), 764) + PaginaDict.Add("/Inventarios/RecepcionDevolucion.aspx".ToUpper(), 696) #End Region @@ -5078,6 +5083,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/MetasVendedores.aspx".ToUpper(), 722) PaginaDict.Add("/Ventas/CatMetasVendedores.aspx".ToUpper(), 723) PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 567) + PaginaDict.Add("/Ventas/CatAutorizacionLimites.aspx".ToUpper(), 781) #End Region @@ -5952,6 +5958,19 @@ Public Class ClsPaginas Dim TipoDocumentoRef As String = "" Dim AplicaPagare As String = "1" + Dim RFCReceptor As String = "" + + If String.IsNullOrEmpty(Vta.RFCReceptor) Then + RFCReceptor = Vta.Cliente.RFC + If Vta.FacturarSucursal Then + If Vta.ClienteSucursal IsNot Nothing Then + RFCReceptor = Vta.ClienteSucursal.RFC + End If + End If + Else + RFCReceptor = Vta.RFCReceptor + End If + Dim RutaCBB As String = String.Format("{0}CBB\{1}.jpg", Ruta, Vta.SerieFolio) Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) Dim ImgCBB As String '= String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6081,7 +6100,7 @@ Public Class ClsPaginas 'Si no tiene CBB, SE GENERA If Not ImagenCBB.Exists Then Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - CBB.GenerarCBB(UsuarioActual.Empresa.RFC, Vta.Cliente.RFC, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) End If ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6096,7 +6115,7 @@ Public Class ClsPaginas 'CLIENTE params.Add(New CrystalParametro("ClienteCodigo", Vta.Cliente.Codigo)) - params.Add(New CrystalParametro("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) + params.Add(New CrystalParametro("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso RFCReceptor = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) params.Add(New CrystalParametro("ClienteDireccion", ClienteDireccion)) params.Add(New CrystalParametro("ClienteLugar", ClienteLugar)) @@ -6128,7 +6147,7 @@ Public Class ClsPaginas params.Add(New CrystalParametro("SelloSAT", Vta.SelloSAT)) params.Add(New CrystalParametro("QR", ImgCBB)) - params.Add(New CrystalParametro("ClienteRFC", Vta.Cliente.RFC)) + params.Add(New CrystalParametro("ClienteRFC", RFCReceptor)) params.Add(New CrystalParametro("FormaPago", Vta.FormaPagoText)) params.Add(New CrystalParametro("Moneda", Vta.Moneda)) params.Add(New CrystalParametro("TipoCambio", Vta.TipoCambio.ToString)) @@ -6161,7 +6180,7 @@ Public Class ClsPaginas params.Add(New CrystalParametro("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal)) Else params.Add(New CrystalParametro("ClienteContactoMail", Vta.Cliente.MailCotizacion)) - params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", Vta.TelefonoGenerico, Vta.Cliente.Telefono))) + params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.Cliente.Telefono, Vta.TelefonoGenerico))) End If If UsuarioActual.CveEmpresa.Contiene(17) Then @@ -6463,7 +6482,18 @@ Public Class ClsPaginas Dim NombreArchivoDescarga As String = "" Dim TipoDocumento As String = "" Dim TipoDocumentoRef As String = "" + Dim RFCReceptor As String = "" + If String.IsNullOrEmpty(Vta.RFCReceptor) Then + RFCReceptor = Vta.Cliente.RFC + If Vta.FacturarSucursal Then + If Vta.ClienteSucursal IsNot Nothing Then + RFCReceptor = Vta.ClienteSucursal.RFC + End If + End If + Else + RFCReceptor = Vta.RFCReceptor + End If Dim RutaCBB As String = String.Format("{0}CBB\{1}.jpg", Ruta, Vta.SerieFolio) Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) @@ -6618,7 +6648,7 @@ Public Class ClsPaginas 'Si no tiene CBB, SE GENERA If Not ImagenCBB.Exists AndAlso Vta.CveCliente.ToEntero > 0 Then Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - CBB.GenerarCBB(UsuarioActual.Empresa.RFC, Vta.Cliente.RFC, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) End If ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6636,17 +6666,17 @@ Public Class ClsPaginas 'CLIENTE If Vta.CveCliente.ToEntero > 0 Or Vta.CveEmpresaCRM.ToEntero > 0 Then params.Add(New ReportParameter("ClienteCodigo", Vta.Cliente.Codigo)) - params.Add(New ReportParameter("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) + params.Add(New ReportParameter("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso RFCReceptor = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) params.Add(New ReportParameter("ClienteDireccion", ClienteDireccion)) params.Add(New ReportParameter("ClienteLugar", ClienteLugar)) - params.Add(New ReportParameter("ClienteRFC", Vta.Cliente.RFC)) + params.Add(New ReportParameter("ClienteRFC", RFCReceptor)) End If If Vta.CveEmpresaCRM.ToEntero > 0 Then params.Add(New ReportParameter("ClienteCodigo", Vta.Cliente.Codigo)) params.Add(New ReportParameter("ClienteNombre", Vta.Cliente.Nombre)) params.Add(New ReportParameter("ClienteDireccion", ClienteDireccion)) params.Add(New ReportParameter("ClienteLugar", ClienteLugar)) - params.Add(New ReportParameter("ClienteRFC", Vta.Cliente.RFC)) + params.Add(New ReportParameter("ClienteRFC", RFCReceptor)) End If 'TOTALES @@ -6729,7 +6759,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal)) ElseIf Vta.CveCliente.ToEntero > 0 Then params.Add(New ReportParameter("ClienteContactoMail", Vta.Cliente.MailCotizacion)) - params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.TelefonoGenerico, Vta.Cliente.Telefono))) + params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.Cliente.Telefono, Vta.TelefonoGenerico))) End If If UsuarioActual.CveEmpresa.Contiene(17) Then diff --git a/App_Code/ClsSisEmpresas.vb b/App_Code/ClsSisEmpresas.vb index 40cc65235..0e5c9d088 100644 --- a/App_Code/ClsSisEmpresas.vb +++ b/App_Code/ClsSisEmpresas.vb @@ -420,20 +420,6 @@ Public Class ClsSisEmpresas _Empresa.IdCuentaIEPSTrasladado = Data.Rows(0)("IdCuentaIEPSTrasladado").ToString.ToEntero _Empresa.IdCuentaOtrosIngresos = Data.Rows(0)("Conta_IdCuentaOtrosIngresos").ToString.ToEntero - 'Contabilidad SIG - _Empresa.CveCuentaIVAxAcreditar = Data.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero - _Empresa.CveCuentaIVAAcreditable = Data.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero - _Empresa.CveCuentaIVAxTrasladar = Data.Rows(0)("IdCuentaIVAxTrasladarSIG").ToString.ToEntero - _Empresa.CveCuentaIVATrasladado = Data.Rows(0)("IdCuentaIVATrasladadoSIG").ToString.ToEntero - _Empresa.CveCuentaRetIVACirculacion = Data.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - _Empresa.CveCuentaRetISRCirculacion = Data.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - _Empresa.CveCuentaDSV = Data.Rows(0)("IdCuentaDescuentoVentaSIG").ToString.ToEntero - _Empresa.CveCuentaImpuestosLocales = Data.Rows(0)("IdCuentaImpuestosLocalesSIG").ToString.ToEntero - _Empresa.CveCuentaIEPSxAcreditar = Data.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero - _Empresa.CveCuentaIEPSAcreditable = Data.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero - _Empresa.CveCuentaIEPSxTrasladar = Data.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString.ToEntero - _Empresa.CveCuentaIEPSTrasladado = Data.Rows(0)("IdCuentaIEPSTrasladadoSIG").ToString.ToEntero - '_Empresa.IdCtaProveedor = Data.Rows(0)("IdCtaProveedor").ToString.ToEntero '_Empresa.IdCtaCliente = Data.Rows(0)("IdCtaCliente").ToString.ToEntero '_Empresa.IdCtaDeudores = Data.Rows(0)("IdCtaDeudores").ToString.ToEntero diff --git a/App_Code/ClsSisUsuarios.vb b/App_Code/ClsSisUsuarios.vb index ed02a6324..09896ce69 100644 --- a/App_Code/ClsSisUsuarios.vb +++ b/App_Code/ClsSisUsuarios.vb @@ -821,7 +821,7 @@ Public Class ClsSisUsuarios Public Function AddUsuario(Usuario As String, Contraseña As String, Nombre As String, CveRol As Integer, Correo As String, CvePersonal As Integer, CveVendedor As Integer, CambiarContraseña As Boolean, CveUsuarioIng As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, Optional Rol As String = "-1", Optional CveAlmacenAsignado As Integer = -1, Optional AsignarSubProyecto As Boolean = False, Optional AsignarOC As Boolean = False, - Optional CvePlataforma As Integer = -1, Optional CveClientePlataforma As Integer = -1, Optional CveProveedorPlataforma As Integer = -1, Optional DescuentoAutorizado As Double = 0, Optional CodigoAcceso As String = "-1") As Integer + Optional CvePlataforma As Integer = -1, Optional CveClientePlataforma As Integer = -1, Optional CveProveedorPlataforma As Integer = -1, Optional DescuentoAutorizado As Double = 0, Optional CodigoAcceso As String = "-1", Optional LimiteCreditoAutorizado As Decimal = 0) As Integer Dim Retorno = -1 DataAdapter("PA_Sis_UsuarioAdd") With SqlAdapter.SelectCommand.Parameters @@ -842,6 +842,7 @@ Public Class ClsSisUsuarios .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedorPlataforma .Add("@DescuentoAutorizado", SqlDbType.Float).Value = DescuentoAutorizado .Add("@CodigoAcceso", SqlDbType.VarChar).Value = CodigoAcceso + .Add("@LimiteCreditoAutorizado", SqlDbType.Money).Value = LimiteCreditoAutorizado .Add("@CveUsuario", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -940,7 +941,7 @@ Public Class ClsSisUsuarios End Function Public Function UpdateUsuario(Usuario As String, Nombre As String, CveRol As Integer, Correo As String, CvePersonal As Integer, CveVendedor As Integer, CambiarContraseña As Boolean, Activo As Boolean, CveEmpresa As Integer, CveUsuario As Integer, CveAlmacenAsignado As Integer, CveSubProyecto As Integer, Optional CveUsuarioModifico As Integer = -1, Optional AsignarSubProyecto As Boolean = False, Optional AsignarOC As Boolean = False, - Optional DescuentoAutorizado As Double = 0, Optional CodigoAcceso As String = "-1") As Boolean + Optional DescuentoAutorizado As Double = 0, Optional CodigoAcceso As String = "-1", Optional LimiteCreditoAutorizado As Decimal = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Sis_UsuarioUpdate") @@ -962,6 +963,7 @@ Public Class ClsSisUsuarios .Add("@AsignarOC", SqlDbType.Bit).Value = AsignarOC .Add("@DescuentoAutorizado", SqlDbType.Float).Value = DescuentoAutorizado .Add("@CodigoAcceso", SqlDbType.VarChar).Value = CodigoAcceso + .Add("@LimiteCreditoAutorizado", SqlDbType.Money).Value = LimiteCreditoAutorizado End With Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 63f73011e..e4abc4166 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -341,7 +341,7 @@ Public Class ClsVentas Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional CveUsoCFDI As Integer = -1, Optional OrdenCompra As String = "-1", Optional CveCuentaTerminal As Integer = -1, Optional CveTipoRelacion As Integer = -1, Optional ImpuestoLocal As Double = 0, Optional CveTipoAmortizacionAnticipo As Integer = -1, Optional CveVentaRelacion As Integer = -1, Optional ImporteRelacion As Decimal = -1, Optional CveEmpresaCRM As Integer = -1, Optional EsInterno As Integer = -1, Optional CveAcercamientoCRM As Integer = -1, Optional DiasCredito As Integer = 0, Optional EsDiasCreditoFijo As Boolean = False, Optional AnticipoEspecial As Boolean = False, Optional Kilometraje As Double = 0, Optional EsAmortizacion As Boolean = False, Optional CveTipoRetencion As Integer = 0, - Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False, Optional ServicioDomicilio As Boolean = False, Optional RFCReceptor As String = "", Optional Adjunto As String = "-1") As Boolean + Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False, Optional ServicioDomicilio As Boolean = False, Optional RFCReceptor As String = "", Optional Adjunto As String = "-1", Optional DevolucionImportePagado As Decimal = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasAdd") @@ -438,6 +438,8 @@ Public Class ClsVentas .Add("@RFCReceptor", SqlDbType.VarChar).Value = RFCReceptor .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + .Add("@DevolucionImportePagado", SqlDbType.Money).Value = DevolucionImportePagado + .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue End With 'SqlTypes.SqlDateTime.Null @@ -4387,8 +4389,6 @@ Public Class ClsVentas Return Retorno End Function #End Region - - #Region " AUTORIZACION LIMITES " Public Function AutorizacionLimitesGet(CveCliente As Integer, CveCveVendedor As Integer, CveEstatus As Integer) As Boolean @@ -5091,6 +5091,81 @@ Public Class ClsVentas End Function #End Region + + Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_AutorizacionLimitesAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@TipoAutorizacion", SqlDbType.Int).Value = TipoAutorizacion + .Add("@TipoDocumento", SqlDbType.VarChar).Value = TipoDocumento + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Optional CveEstatus As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_AutorizacionLimitesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + + Public Function UpdateAutorizacionLimite(CveAutorizacion As Integer, CveCliente As Integer, CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_AutorizacionlimitesEstatusUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAutorizacion", SqlDbType.Int).Value = CveAutorizacion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function RemoveAutorizacionLimite(CveAutorizacion As Integer, CveCliente As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_AutorizacionLimitesRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAutorizacion", SqlDbType.Int).Value = CveAutorizacion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + #Region "IDisposable Support" diff --git a/App_Code/Empresa.vb b/App_Code/Empresa.vb index e445ab25d..3e8120dd8 100644 --- a/App_Code/Empresa.vb +++ b/App_Code/Empresa.vb @@ -108,12 +108,7 @@ Public Class Empresa Public Property IdCuentaIVAxTrasladar As Integer Public Property IdCuentaIVATrasladado As Integer Public Property IdCuentaPerdidaCambiaria As Integer - Public Property IdCuentaGananciaCambiaria As Integer - Public Property CveCuentaIVAxTrasladar As Integer - Public Property CveCuentaIVATrasladado As Integer - Public Property CveCuentaPerdidaCambiaria As Integer - Public Property CveCuentaGananciaCambiaria As Integer - + Public Property IdCuentaGananciaCambiaria As Integer Public Property ContaContabilizacionNC As Integer Public Property PV_TerminalTipo As Integer Public Property PlantillaMailVenta As String @@ -132,20 +127,9 @@ Public Class Empresa Public Property IdCtaAcreedores As Integer Public Property IdCtaDocXPagar As Integer Public Property IdCtaAnticipoCliente As Integer - Public Property IdCtaAnticipoProveedores As Integer - - Public Property CveCuentaIVAxAcreditar As Integer - Public Property CveCuentaIVAAcreditable As Integer - Public Property CveCuentaRetIVACirculacion As Integer - Public Property CveCuentaRetISRCirculacion As Integer - Public Property CveCuentaDSV As Integer - Public Property CveCuentaImpuestosLocales As Integer - Public Property CveCuentaIEPSxAcreditar As Integer - Public Property CveCuentaIEPSAcreditable As Integer - Public Property CveCuentaIEPSxTrasladar As Integer - Public Property CveCuentaIEPSTrasladado As Integer - - 'Nuevos Datos + Public Property IdCtaAnticipoProveedores As Integer + + 'Nuevos Datos Public Property IdCuentaIEPSxAcreditar As Integer Public Property IdCuentaIEPSAcreditable As Integer Public Property IdCuentaIEPSxTrasladar As Integer diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index a47720df8..830ed6140 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2268,7 +2268,6 @@ Namespace Modelos Dim FechaMovimiento As Date = ObjFactura.Fecha Dim IdCtaContable As Integer Dim IdCtaContableCliente As Integer - Dim CveCuentaCliente As Integer Dim Concepto As String = ObjFactura.SerieFolio Dim Referencia As String = ObjFactura.SerieFolio Dim Fecha = ObjFactura.Fecha @@ -2282,8 +2281,6 @@ Namespace Modelos Dim CveSubProyectoContabilizar As Integer Dim IdCtaIVAXTrasladar As Integer = 0 Dim IdCtaIVATrasladado As Integer = 0 - Dim CveCuentaIVAxTrasladar As Integer = 0 - Dim CveCuentaIVATrasladado As Integer = 0 Dim SeContabiliza As Boolean = True If (UsuarioActual.Empresa.Funcionalidad(343) = "1" AndAlso ObjFactura.TipoDocto = "Ant") Then @@ -2471,7 +2468,6 @@ Namespace Modelos End If IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - 'CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera End If CveSubProyectoContabilizar = CveSubProyectoVenta ImporteConcepto12 = importeMX.RoundSQL @@ -2847,7 +2843,6 @@ Namespace Modelos 'CTACONTABLE 'IdCtaContable = IdCtaContAnticipos - 'CveCuenta = CveCuentaAnticipos If tipoCambio = 1 Then IdCtaContable = ObjFactura.Cliente.IdCtaContClientes @@ -2996,7 +2991,7 @@ Namespace Modelos End If If sumaAmorticaciones <> 0 Then If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, Referencia, 251, Concepto, FechaMovimiento, - ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then ErrorPrepoliza = True Else ObjFactura.SeGuardoPrePoliza = True @@ -3052,9 +3047,6 @@ Namespace Modelos IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero End If - - 'CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then @@ -3135,8 +3127,6 @@ Namespace Modelos If Row2("CveClasificacion").ToString = "19929" Then IdCtaContable = 1142 End If - 'CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then @@ -3144,10 +3134,6 @@ Namespace Modelos idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) - ' CveCuentaContabilizacion = 0 - 'End If If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, PorcentajeImpuesto:=Row2("PorcentajeIVA").ToString().ToDecimal) Then ErrorPrepoliza = True @@ -3171,7 +3157,6 @@ Namespace Modelos If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() - 'CveCuenta = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() End If End If @@ -3334,20 +3319,18 @@ Namespace Modelos ' If importeMovimiento <> 0 Then ' 'IVA X TRASLADAR ' IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - ' CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then + ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then ' ErrorPrepoliza = True ' Exit For ' End If ' 'IVA PAGADO ' IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - ' CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then + ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then ' ErrorPrepoliza = True ' Exit For ' End If @@ -3437,7 +3420,6 @@ Namespace Modelos If GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows.Count = 1 Then IdCtaContable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("IdCtaContable").ToString.ToEntero - ' CveCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("IdCtaContableSIG").ToString.ToEntero End If If IdCtaContable <= 0 Then @@ -3445,11 +3427,6 @@ Namespace Modelos idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.AppendFormat("
{0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("NumCuentaMoneda").ToString.ToEntero) - ' CveCuentaContabilizacion = 0 - 'End If - 'BANCOS Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento)) Then @@ -3459,39 +3436,37 @@ Namespace Modelos 'CLIENTES Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If 'IVA X TRASLADAR IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If 'IVA PAGADO IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If 'IEPS X TRASLADAR Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar) Then + If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If 'IEPS PAGADO Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSTrasladado, CveSubProyecto:=CveSubProyectoContabilizar) Then + If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If @@ -3515,11 +3490,6 @@ Namespace Modelos idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - ' CveCuentaContabilizacion = 0 - 'End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=tipoCambio, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Else @@ -3966,13 +3936,11 @@ Namespace Modelos Dim DtCostos = ObjInventario.DtResultados.Copy Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 Dim ValorInventario As Decimal For Each RowInv As DataRow In DtCostosDistinct.Rows ValorInventario = DtCostos.SUM("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).ToString.ToDecimal IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero Try If ValorInventario <> 0 Then If Not ObjConta.AddPrePolizasDetalle(Me.CvePrePoliza, False, ValorInventario, Me.SerieFolio, 69, Me.SerieFolio, Me.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=Me.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveSubProyecto:=Me.CveSubProyecto) Then @@ -3998,7 +3966,6 @@ Namespace Modelos End If End If - 'VALIDA QUE SE HALLAN AGREGADO DETALLES AL MOVIMIENTO If ContadorMovtosDetalles = 0 Then OcurrioError = True @@ -4008,8 +3975,6 @@ Namespace Modelos OcurrioError = True End If - - If OcurrioError Then Return -1 Else @@ -4121,7 +4086,6 @@ Namespace Modelos TotalCosto = DtCostos.SUMD("Total").RoundSQL Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 If tmpCostos.Rows.Count > 0 Then Dim TotalCostoAcumulado As Decimal = 0 Dim cont As Integer = 1 @@ -4137,10 +4101,9 @@ Namespace Modelos 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString()) IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() - 'CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario) Then OcurrioError = True End If 'End If @@ -4262,7 +4225,6 @@ Namespace Modelos TotalCosto = DtCostos.SUMD("Total").RoundSQL Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 If tmpCostos.Rows.Count > 0 Then Dim TotalCostoAcumulado As Decimal = 0 Dim cont As Integer = 1 @@ -4278,10 +4240,9 @@ Namespace Modelos 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString()) IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() - 'CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario) Then OcurrioError = True End If 'End If @@ -4347,7 +4308,7 @@ Namespace Modelos If factura.DtImpuestosLocales IsNot Nothing AndAlso factura.CvePrePoliza > 0 AndAlso Not factura.TipoDocto.Contiene("Cot", "Rem") Then Dim Importe As Decimal - Dim IdCtaContable, CveCuenta As Integer + Dim IdCtaContable As Integer Dim Concepto As String Dim tipoCambio As Decimal Dim CveSubProyectoContabilizar As Integer = factura.CveSubProyecto @@ -4357,7 +4318,6 @@ Namespace Modelos Importe = RowIL("Importe").ToString.ToDecimal * ValorMultiplicador IdCtaContable = RowIL("IdCtaContable").ToString.ToEntero - CveCuenta = RowIL("IdCtaContable").ToString.ToEntero Concepto = factura.SerieFolio If factura.CveMoneda = 2 AndAlso factura.TipoCambio > 0 Then @@ -5107,9 +5067,7 @@ Namespace Modelos Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {CveAlmacenMovimiento}").ToEntero - 'Dim CveCuentaAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {CveAlmacenDevolucion}").ToEntero Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 If tmpCostos.Rows.Count > 0 Then Dim Multiplicador As Decimal = -1D @@ -6133,6 +6091,8 @@ Namespace Modelos Public Property CveDireccionEnvio As Integer Public Property RefacturacionGeneroNC As Boolean = False Public Property Pagado As Decimal + Public Property PagadoBancos As Decimal + Public Property PagadoCveIE As Integer Public Property DescuentoProntoPago As Decimal Public Property CveVentaRNCCargo As Integer Public Property FacturarSucursal As Boolean = False @@ -6503,6 +6463,7 @@ Namespace Modelos Public Property FordGSDB As String = "" Public Property FordASN As String = "" Public Property FemsaFactura As Modelos.FemsaFactura + Public Property DevolucionImportePagado As Decimal = 0 Public Sub SetSubProyecto() If CveSubProyecto > 0 AndAlso UsuarioActual IsNot Nothing Then @@ -7735,24 +7696,6 @@ Namespace Modelos End Property - 'Property GlobalDTBancosCuentas(CveUsuario As Integer, Optional CveCuenta As Integer = -1, Optional Estatus As Integer = 1) As DataTable - ' Get - - ' Dim Str As String = String.Format("CveEmpresa = {0} ", UsuarioActual.CveEmpresa) - ' If CveUsuario > -1 Then Str = String.Format("{0} AND CveUsuario = {1}", Str, CveUsuario) - ' If CveCuenta > -1 Then Str = String.Format("{0} AND CveCuenta = {1}", Str, CveCuenta) - ' If Estatus > -1 Then Str = String.Format("{0} AND Estatus = '{1}'", Str, If(Estatus = 1, "Activo", "Inactivo")) - - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTBancosCuentas"), DataTable), Str, "", DataViewRowState.CurrentRows) - ' GlobalDTBancosCuentas = Dv.ToTable - ' Dv.Dispose() - ' 'GlobalDTBancosCuentas = DirectCast(HttpContext.Current.Application("GlobalDTBancosCuentas"), DataTable) - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTBancosCuentas") = value - ' End Set - 'End Property - Property GlobalDTBancosCuentas(CveUsuario As Integer, Optional CveCuenta As Integer = -1, Optional Estatus As Integer = 1, Optional CveEmpresa As Integer = -1) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTBancosCuentas-{0}", CveEmpresa) @@ -9846,12 +9789,6 @@ Namespace Modelos Public Property IdCtaContAnticipos As Integer Public Property IdCtaContRetIVA As Integer Public Property IdCtaContRetISR As Integer - Public Property CveCuentaClientes As Integer - Public Property CveCuentaMonedaExtranjera As Integer - Public Property CveCuentaComplementaria As Integer - Public Property CveCuentaAnticipos As Integer - Public Property CveCuentaRetIVA As Integer - Public Property CveCuentaRetISR As Integer Public Property ConvenioCIE As String Public Property FormaFacturacion As String Public Property LimiteCredito As Decimal diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 3b94f4849..6845d6528 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -810,6 +810,18 @@ Public Class Timbrado Dim tCvePAC As Integer = UsuarioActual.Empresa.CvePAC If CvePACEspecial <> -1 Then tCvePAC = CvePACEspecial + 'validación especial. + If Ventas.TipoDocto.Contiene("Ing", "Dev") Then + + Dim CodigoIncorrecto As Integer = (From c In Ventas.Timbre.Conceptos Where (c.ClaveProdServ = "84111506" Or c.ClaveProdServ = "01010101") + Select c.ClaveProdServ).Count() + If CodigoIncorrecto > 0 Then + MensajeErrorCFDI = "SAT - Hay un concepto con Codigo no permitido." + Return False + End If + + End If + Select Case tCvePAC Case 1 ' Retorno = TimbrarFacturaBIInform33(UsuarioActual, Ventas, FM, TmpDTConceptos, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementos, Ruta, LstFordASN, FordGSDBM, ObjV) diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index e2ba8339d..90a17dc54 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -49,21 +49,13 @@ Public Class E141 : Implements IHttpHandler End Property Public ReadOnly Property TokenAutorizacion As String Get - If EsProduccion Then - Return "$2y$10$EZlXnFrhUc4aRVwjy5/v0.3JPdFNjyeANDc64YXJ5eHD8pMsv93Q." - Else - Return "$2y$10$8Mk3YeIkJESilIwD.U5dG.SsA4JloycJKbaGls8TNEw/AKBE1qane" - End If + Return "$2y$10$LGqtRWUloKQmAt.jcUldc.PmS5LJ6l.WU2w1G4PBOTLMVKZRNQFPS" End Get End Property Public ReadOnly Property URLBase As String Get - If EsProduccion Then - Return "https://services.fidelityapps.mx/" - Else - Return "https://econollantas-pruebas.fidelityapps.mx/" - End If + Return "https://services.fidelityapps.mx/" End Get End Property @@ -1852,6 +1844,7 @@ Public Class E141 : Implements IHttpHandler httpClient.Timeout = New TimeSpan(0, 5, 0) Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(url)) request.Headers.Add("X-PUBLIC-AUTH", TokenAutorizacion) + request.Headers.Add("X-Authentication", TokenAutorizacion) Using content = New StringContent(payload, Encoding.UTF8, "application/json") request.Content = content diff --git a/Bancos/DepositoTerminal.aspx.vb b/Bancos/DepositoTerminal.aspx.vb index 210c6c88e..2b8767aa8 100644 --- a/Bancos/DepositoTerminal.aspx.vb +++ b/Bancos/DepositoTerminal.aspx.vb @@ -308,7 +308,6 @@ Partial Class Bancos_DepositoTerminal Dim importeMX As Decimal Dim FechaMovimiento As Date = TxtFecha.Text.ToDate Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 Dim ConceptoMovimiento As String = ObjContabilidad.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreComercial, gvr.DataKey("SerieFolio").ToString, TxtFolio.ToString) Dim Referencia As String = gvr.DataKey("SerieFolio").ToString Dim CveSubProyecto As Integer = gvr.DataKey("CveSubProyecto").ToEntero @@ -320,20 +319,17 @@ Partial Class Bancos_DepositoTerminal If tipoCambioVenta = 1 Then IdCtaContable = IdCuentaCliente - CveCuenta = CveCuentaCliente Else ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" IdCtaContable = IdCtaContComplementaria - CveCuenta = CveCuentaComplementaria If ImporteMovimiento <> 0 AndAlso IdCtaContable > 0 Then importeMX = ImporteMovimiento - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, 0, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMovimiento * tipoCambioVenta - ImporteMovimiento, CveCuenta:=CveCuenta) Then + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, 0, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMovimiento * tipoCambioVenta - ImporteMovimiento) Then MsgError = "No se pudo insertar la póliza" End If End If IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If Case 8 'Ret IVA x Trasladar @@ -351,19 +347,9 @@ Partial Class Bancos_DepositoTerminal IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjContabilidad.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + + Case 9 'Ret ISR x Trasladar ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago @@ -379,25 +365,13 @@ Partial Class Bancos_DepositoTerminal IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjContabilidad.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + Case 13 'Iva por Trasladar ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago importeMX = Math.Round(ImporteMovimiento * tipoCambioVenta, 2) IdCtaContable = UsuarioActual.Empresa.IdCuentaIVAxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIVAxTrasladar If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" Case 62 'Ret IVA Trasladado @@ -415,19 +389,9 @@ Partial Class Bancos_DepositoTerminal IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjContabilidad.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + + Case 63 'Ret ISR Trasladado ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago @@ -443,25 +407,13 @@ Partial Class Bancos_DepositoTerminal IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjContabilidad.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + Case 61 'Iva Trasladado ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago importeMX = Math.Round(ImporteMovimiento * tipoCambioManual, 2) IdCtaContable = UsuarioActual.Empresa.IdCuentaIVATrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIVATrasladado If tipoCambioManual > 1 Then ConceptoMovimiento += $" TC:{tipoCambioManual} ${ImporteMovimiento.FormatoNumero(2)}" Case 38 'IEPS por trasladar @@ -470,14 +422,12 @@ Partial Class Bancos_DepositoTerminal importeMX = Math.Round(ImporteMovimiento * tipoCambioVenta, 2) IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSxTrasladar Case 39 'IEPS Trasladado ImporteMovimiento = gvr.DataKey("IEPS").ToDecimal * PorcentajePago importeMX = Math.Round(ImporteMovimiento * tipoCambioManual, 2) IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSTrasladado Case 78 'Otros Ingresos If ChkAjusteOI.Checked Then @@ -500,15 +450,9 @@ Partial Class Bancos_DepositoTerminal If (IdCtaContable < 1 Or IdCuentaBancaria < 1) Then CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) idCuentaContabilizacion = 0 - End If - - 'Conta SIG - If (CveCuenta < 1 Or CveCuentaBancaria < 1) Then - CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - CveCuentaContabilizacion = 0 - End If - - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyecto, gvr.DataKey("CveCliente").ToEntero, ImporteMX:=importeMX, CveCuenta:=CveCuenta) Then + End If + + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyecto, gvr.DataKey("CveCliente").ToEntero, ImporteMX:=importeMX) Then MsgError = "No se pudo insertar la póliza" End If End If diff --git a/GPS/TrayectoDetalle.aspx b/GPS/TrayectoDetalle.aspx index c977aaab9..7348e02c5 100644 --- a/GPS/TrayectoDetalle.aspx +++ b/GPS/TrayectoDetalle.aspx @@ -360,8 +360,8 @@ - + diff --git a/GPS/TrayectoDetalle.aspx.vb b/GPS/TrayectoDetalle.aspx.vb index 7153f6f10..fe58efe5d 100644 --- a/GPS/TrayectoDetalle.aspx.vb +++ b/GPS/TrayectoDetalle.aspx.vb @@ -186,7 +186,17 @@ Partial Class GPS_TrayectoDetalle GvIgnicion.DataSource = DsDatos.Tables(1) GvIgnicion.DataBind() - GvExcesos.DataSource = DsDatos.Tables(2) + Dim DtExcesos As DataTable = DsDatos.Tables(2) + + Dim Direcciones = ConsultarDirecciones(DtExcesos) + + If Direcciones IsNot Nothing Then + For Each Dir As JObject In Direcciones + DtExcesos.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() + Next + End If + + GvExcesos.DataSource = DtExcesos GvExcesos.DataBind() GvRalenti.DataSource = DsDatos.Tables(3) diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx b/Inventarios/PopUpExistenciasAlmacen.aspx index 3588e3237..6f5122421 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx +++ b/Inventarios/PopUpExistenciasAlmacen.aspx @@ -135,6 +135,8 @@ +<%-- + --%> @@ -147,6 +149,7 @@ + diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index a50ab4f25..8af463766 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2560,11 +2560,12 @@ Partial Class Inventarios_RecepcionUsados Case "0" ' USADOS CvePS = Row.DataKey("CvePS").ToEntero() Case "1" ' AJUSTE/GARANTIA - Dim drDatos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa)) + CvePS = Row.DataKey("CvePS").ToEntero() + 'Dim drDatos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa)) - If drDatos IsNot Nothing Then - CvePS = drDatos.Item("CvePSCargo").ToString.ToEntero - End If + 'If drDatos IsNot Nothing Then + ' CvePS = drDatos.Item("CvePSCargo").ToString.ToEntero + 'End If End Select If CvePS > 0 Then @@ -3104,28 +3105,37 @@ Partial Class Inventarios_RecepcionUsados End If Dim drDatos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa)) + Dim Importe As Decimal = 0 + Dim drTamañoPS As DataRow = Nothing + + DtMovimientos.Rows.Clear() + + ' USADOS If drDatos IsNot Nothing Then - Dim Importe As Decimal = drDatos("Cargo").ToString.ToDecimal - Dim drTamañoPS As DataRow = Nothing + If RblUsadosAjuste.SelectedValue = "0" Then + CvePS = drDatos.Item("CvePSCargo").ToString.ToEntero + End If + Importe = drDatos("Cargo").ToString.ToDecimal + Else + Importe = TxtImporteAjuste.Text.ToDecimal + End If - DtMovimientos.Rows.Clear() - - Select Case RblUsadosAjuste.SelectedValue - Case "0" ' USADOS - CvePS = drDatos.Item("CvePSCargo").ToString.ToEntero - Case "1" ' AJUSTE/GARANTIA - CvePS = DdlPSAjuste.SelectedValue.ToEntero - End Select + 'AJUSTE/GARANTIA + If RblUsadosAjuste.SelectedValue = "1" Then + CvePS = DdlPSAjuste.SelectedValue.ToEntero + End If + If CvePS > 0 Then If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then drTamañoPS = ObjPS.DtResultados.FiltroPrimero("") 'CveTamaño = -1 'limpio esta variable para que no se registre dos veces en la clase Modelos AddNew(drTamañoPS.Item("CvePS").ToString.ToEntero, drTamañoPS.Item("PSCodigo").ToString, drTamañoPS.Item("CveUM").ToString.ToEntero, drTamañoPS.Item("UnidadMedida").ToString, 1.0, Importe, - "", "-1", "-1", "-1", "", "", -1, "", "", CveTamaño) + "", "-1", "-1", "-1", "", "", -1, "", "", CveTamaño) End If Else Alert("No se pudo cargar el producto", TipoMensaje.MsgError) End If + Catch ex As Exception OnError("Ocurrió un error al agregar el producto", ex) End Try diff --git a/Inventarios/Remanufactura.aspx.vb b/Inventarios/Remanufactura.aspx.vb index 52f88843e..62aa9cee2 100644 --- a/Inventarios/Remanufactura.aspx.vb +++ b/Inventarios/Remanufactura.aspx.vb @@ -803,14 +803,13 @@ Partial Class Inventarios_Remanufactura FechaMovimiento = ObjFactura.FechaPago If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then ErrorPrepoliza = True Else ViewState("SeGuardoPrePoliza") = True diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index c5002a274..b6e71a423 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -463,12 +463,12 @@ Partial Class OC ViewState("CveConfianzaProveedor") = value End Set End Property - Private Property CveProveedorOrignal As Integer + Private Property CveProveedorOriginal As Integer Get - Return IfNull(ViewState("CveProveedorOrignal"), -1).ToString().ToEntero() + Return IfNull(ViewState("CveProveedorOriginal"), -1).ToString().ToEntero() End Get Set(value As Integer) - ViewState("CveProveedorOrignal") = value + ViewState("CveProveedorOriginal") = value End Set End Property Private Property CveEstatusSupervisada As Integer @@ -580,6 +580,7 @@ Partial Class OC If Not Page.IsPostBack Then CargaDatosAgregarPS() + CveProveedorOriginal = -1 'MODALIDAD MULTIEMPRESA CveEmpresaActual = UsuarioActual.CveEmpresa CargaEstatusUsuariosClasificaciones() @@ -1439,7 +1440,7 @@ Partial Class OC DdlProveedores.SelectedValue = objOC.CveProveedor.ToString If DdlProveedores.SelectedValue.ToEntero > 0 Then - CveProveedorOrignal = DdlProveedores.SelectedValue.ToEntero + CveProveedorOriginal = objOC.CveProveedor DdlProveedores.SelectedText = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveProveedor = {objOC.CveProveedor}").Rows(0)("RazonSocial").ToString Else DdlProveedores.SelectedText = "-" @@ -2727,7 +2728,7 @@ Partial Class OC DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)) Then - If CveProveedorOrignal <> CveProveedor Then + If CveProveedorOriginal <> CveProveedor Then If Not ObjConta.UpdateProveedorPoliza(CveOrdenCompra, CveProveedor, Proveedor) Then TieneError = True End If diff --git a/PortalCliente/PortalCliente.aspx.vb b/PortalCliente/PortalCliente.aspx.vb index 3f6f4a084..8e8d8596e 100644 --- a/PortalCliente/PortalCliente.aspx.vb +++ b/PortalCliente/PortalCliente.aspx.vb @@ -766,8 +766,7 @@ Partial Class Ventas_PortalCliente Dim TipoMovimiento = False Dim ImporteMovimiento = 0.0D Dim importeMX = 0.0D - Dim IdCtaContable = 0 - Dim CveCuenta = 0 + Dim IdCtaContable = 0 Dim ConceptoMovimiento = "" Dim Referencia = "" Dim CveSubProyecto = -1 @@ -810,7 +809,6 @@ Partial Class Ventas_PortalCliente ImporteMovimiento = 0 importeMX = 0 IdCtaContable = 0 - CveCuenta = 0 PorcentajeImpuesto = 0 ConceptoMovimiento = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, LtlCliente.Text, DrPago("Factura").ToString, DrPago("Factura").ToString) 'VALORES DE LA VENTA @@ -843,14 +841,12 @@ Partial Class Ventas_PortalCliente If CveMonedaVenta = 1 Then IdCtaContable = IdCuentaCliente - CveCuenta = CveCuentacliente Else IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaComplementaria ConceptoMovimiento += $" TC:{TCPago} ${ImporteMovimiento.FormatoNumero(2)}" If ImporteMovimiento <> 0 AndAlso IdCtaContable > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, 207, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, ImporteMX:=(importeMX - ImporteMovimiento).RoundSQL(), ImporteME:=ImporteMovimiento, CveCuenta:=CveCuenta, TipoCambio:=TCVenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, 207, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, ImporteMX:=(importeMX - ImporteMovimiento).RoundSQL(), ImporteME:=ImporteMovimiento, TipoCambio:=TCVenta) Then TieneError = True MensajeError.Append("No se pudo insertar el detalle de pago de la póliza
") Exit For @@ -858,7 +854,6 @@ Partial Class Ventas_PortalCliente End If IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If Case 134 'PAGO INTERMEDIARIO @@ -882,7 +877,6 @@ Partial Class Ventas_PortalCliente TCGeneral = TCVenta IdCtaContable = UsuarioActual.Empresa.IdCuentaIVAxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIVAxTrasladar If TCVenta > 1 Then ConceptoMovimiento += $" TC:{TCVenta} ${ImporteMovimiento.FormatoNumero(2)}" Case 61 'IVA TRASLADADO @@ -900,7 +894,6 @@ Partial Class Ventas_PortalCliente TCGeneral = TCFluctuacion IdCtaContable = UsuarioActual.Empresa.IdCuentaIVATrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIVATrasladado If TCFluctuacion > 1 Then ConceptoMovimiento += $" TC:{TCFluctuacion} ${ImporteMovimiento.FormatoNumero(2)}" Case 8 'RETIVA X TRASLADAR @@ -926,16 +919,8 @@ Partial Class Ventas_PortalCliente If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetIVACirculacion").ToEntero End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetIVACirculacionSIG").ToEntero - End If - End If + End If + Case 62 'RETIVA TRASLADADO If CveMonedaVenta = 1 Then ImporteMovimiento = RetIVAVenta * PorcentajePago @@ -959,17 +944,9 @@ Partial Class Ventas_PortalCliente If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetIVACirculacion").ToEntero End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetIVACirculacionSIG").ToEntero - End If - End If - + End If + + Case 9 'RETISR X TRASLADAR If CveMonedaVenta = 1 Then ImporteMovimiento = RetISRVenta * PorcentajePago @@ -993,17 +970,9 @@ Partial Class Ventas_PortalCliente If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetISRCirculacion").ToEntero End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetISRCirculacionSIG").ToEntero - End If - End If - + End If + + Case 63 'RETISR TRASLADADO If CveMonedaVenta = 1 Then ImporteMovimiento = RetIVAVenta * PorcentajePago @@ -1027,17 +996,8 @@ Partial Class Ventas_PortalCliente If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetISRCirculacion").ToEntero End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetISRCirculacionSIG").ToEntero - End If - End If - + End If + Case 38 'IEPS X TRASLADAR If CveMonedaVenta = 1 Then ImporteMovimiento = IEPSVenta * PorcentajePago @@ -1053,7 +1013,6 @@ Partial Class Ventas_PortalCliente TCGeneral = TCVenta IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSxTrasladar If TCVenta > 1 Then ConceptoMovimiento += $" TC:{TCVenta} ${ImporteMovimiento.FormatoNumero(2)}" Case 39 'IEPS TRASLADADO @@ -1071,14 +1030,12 @@ Partial Class Ventas_PortalCliente TCGeneral = TCFluctuacion IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSTrasladado If TCFluctuacion > 1 Then ConceptoMovimiento += $" TC:{TCFluctuacion} ${ImporteMovimiento.FormatoNumero(2)}" Case 64 'GANANCIA Continue For 'SKIPEA If CveMonedaVenta <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria If TCPago > TCVenta AndAlso CveMonedaVenta = 2 Then ImporteMovimiento = (ImportePago * TCPago) - (ImportePago * TCVenta) ImporteMovimiento -= ((IVAVenta * PorcentajePago) * TCFluctuacion) - ((IVAVenta * PorcentajePago) * TCVenta) @@ -1094,7 +1051,6 @@ Partial Class Ventas_PortalCliente Continue For 'SKIPEA If CveMonedaVenta <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria If TCPago < TCVenta AndAlso CveMonedaVenta = 2 Then ImporteMovimiento = (ImportePago * TCPago) - (ImportePago * TCVenta) ImporteMovimiento -= ((IVAVenta * PorcentajePago) * TCFluctuacion) - ((IVAVenta * PorcentajePago) * TCVenta) @@ -1110,7 +1066,7 @@ Partial Class Ventas_PortalCliente 'AGREGA PREPOLIZA DETALLE If ImporteMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, CveProveedorContabilizar, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TCGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, CveProveedorContabilizar, ImporteMX:=importeMX, TipoCambio:=TCGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then TieneError = True MensajeError.Append("No se pudo insertar el detalle de la póliza
") Exit For @@ -1954,7 +1910,7 @@ Partial Class Ventas_PortalCliente End Select If importeMovimiento <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, ObjFactura.Cliente.IdCtaContClientes, ObjFactura.Cliente.IdCtaContAnticipos), -1, CveIE:=CveIE, CveCompra:=-1, CveProveedor:=-1, CvePersonal:=-1, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal, CveCuenta:=If(ConceptoContable = 30, ObjFactura.Cliente.CveCuentaClientes, ObjFactura.Cliente.CveCuentaAnticipos)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, ObjFactura.Cliente.IdCtaContClientes, ObjFactura.Cliente.IdCtaContAnticipos), -1, CveIE:=CveIE, CveCompra:=-1, CveProveedor:=-1, CvePersonal:=-1, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If End If diff --git a/Sistemas/UsuarioDetalle.aspx b/Sistemas/UsuarioDetalle.aspx index 512355535..182c8df96 100644 --- a/Sistemas/UsuarioDetalle.aspx +++ b/Sistemas/UsuarioDetalle.aspx @@ -307,6 +307,13 @@ + + Límite Cédito Autorizado: + + + + + diff --git a/Sistemas/UsuarioDetalle.aspx.vb b/Sistemas/UsuarioDetalle.aspx.vb index e9948bffc..72683623b 100644 --- a/Sistemas/UsuarioDetalle.aspx.vb +++ b/Sistemas/UsuarioDetalle.aspx.vb @@ -447,6 +447,7 @@ Partial Class Sistemas_UsuarioDetalle If UsuarioActual.Empresa.Funcionalidad(531).ToString = "1" Then TrDescuentoAutorizado.Visible = True + TrLimiteAutorizacion.Visible = True End If If UsuarioActual.Empresa.Funcionalidad(599) = "1" Then @@ -586,8 +587,8 @@ Partial Class Sistemas_UsuarioDetalle LblFechaCaptura.Text = ObjUsuario.Fecha.ToShortDateString LblUsuarioCapturo.Text = ObjUsuario.UsuarioCreo - TxtDescuentoAutorizado.Text = ObjUsuario.DescuentoAutorizado.FormatoNumero - + TxtDescuentoAutorizado.Text = ObjUsuario.DescuentoAutorizado.FormatoNumero + TxtLimiteAutorizado.Text = ObjUsuario.DtResultados.Rows(0)("LimiteCreditoAutorizado").ToString() Else Alert("El Usuario Solicitado no existe, Revise su búsqueda.", TipoMensaje.MsgAdvertencia) BtnGuardar.Enabled = False @@ -831,7 +832,7 @@ Partial Class Sistemas_UsuarioDetalle 'REGISTRA O ACTUALIZA LOS DATOS GENERALES DEL USUARIO If CveUsuario = -1 Then - CveUsuario = ObjUsuarios.AddUsuario(TxtUsuario.Text.Trim, Encripta(ContraseñaPredeterminada), TxtNombre.Text.Trim, DdlRol.SelectedValue.ToEntero, TxtCorreo.Text.Trim, DdlPersonal.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, ChkCambiarContraseña.Checked, UsuarioActual.CveUsuario, DdlEmpresa.SelectedValue.ToEntero, DdlSubProyectos.SelectedValue.ToEntero, CveAlmacenAsignado:=DdlAlmacenGeneral.SelectedValue.ToEntero, AsignarSubProyecto:=ChkAsignarSubProyecto.Checked, AsignarOC:=ChkAsignarOC.Checked, DescuentoAutorizado:=TxtDescuentoAutorizado.Text.ToDouble, CodigoAcceso:=CodigoAcceso) + CveUsuario = ObjUsuarios.AddUsuario(TxtUsuario.Text.Trim, Encripta(ContraseñaPredeterminada), TxtNombre.Text.Trim, DdlRol.SelectedValue.ToEntero, TxtCorreo.Text.Trim, DdlPersonal.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, ChkCambiarContraseña.Checked, UsuarioActual.CveUsuario, DdlEmpresa.SelectedValue.ToEntero, DdlSubProyectos.SelectedValue.ToEntero, CveAlmacenAsignado:=DdlAlmacenGeneral.SelectedValue.ToEntero, AsignarSubProyecto:=ChkAsignarSubProyecto.Checked, AsignarOC:=ChkAsignarOC.Checked, DescuentoAutorizado:=TxtDescuentoAutorizado.Text.ToDouble, CodigoAcceso:=CodigoAcceso, LimiteCreditoAutorizado:=TxtLimiteAutorizado.Text.ToDecimal()) EsNuevoUsuario = True If CveUsuario = -1 Then TieneError = True @@ -843,7 +844,7 @@ Partial Class Sistemas_UsuarioDetalle End If Next Else - If Not ObjUsuarios.UpdateUsuario(TxtUsuario.Text.Trim, TxtNombre.Text.Trim, DdlRol.SelectedValue.ToEntero, TxtCorreo.Text.Trim, DdlPersonal.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, ChkCambiarContraseña.Checked, ChkEstatus.Checked, DdlEmpresa.SelectedValue.ToEntero, CveUsuario, DdlAlmacenGeneral.SelectedValue.ToEntero, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveUsuario, AsignarSubProyecto:=ChkAsignarSubProyecto.Checked, AsignarOC:=ChkAsignarOC.Checked, DescuentoAutorizado:=TxtDescuentoAutorizado.Text.ToDouble, CodigoAcceso:=CodigoAcceso) Then + If Not ObjUsuarios.UpdateUsuario(TxtUsuario.Text.Trim, TxtNombre.Text.Trim, DdlRol.SelectedValue.ToEntero, TxtCorreo.Text.Trim, DdlPersonal.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, ChkCambiarContraseña.Checked, ChkEstatus.Checked, DdlEmpresa.SelectedValue.ToEntero, CveUsuario, DdlAlmacenGeneral.SelectedValue.ToEntero, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveUsuario, AsignarSubProyecto:=ChkAsignarSubProyecto.Checked, AsignarOC:=ChkAsignarOC.Checked, DescuentoAutorizado:=TxtDescuentoAutorizado.Text.ToDouble, CodigoAcceso:=CodigoAcceso, LimiteCreditoAutorizado:=TxtLimiteAutorizado.Text.ToDecimal()) Then TieneError = True End If diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index b26f69ee9..ca172e5ec 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -559,7 +559,7 @@ Partial Class Ventas_ActualizarPrecios For Each Franquicia In Franquicias Dim CveFranquicia As Integer = Franquicia.ToEntero - Dim CvePS As Integer = GlobalDTPS(CveFranquicia, Codigo:=Codigo.ToUpper).FiltroPrimeroValor("CvePS", "").ToEntero + Dim CvePS As Integer = GlobalDTPSSimplificado(CveFranquicia, Codigo:=Codigo).FiltroPrimeroValor("CvePS", "").ToEntero Dim CvePrecioLisa As Integer = GlobalDTPrecioListas(CveFranquicia).FiltroPrimeroValor("CvePrecioLista", String.Format("PrecioLista = '{0}'", PrecioLista)).ToEntero If CvePS <= 0 Then diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx new file mode 100644 index 000000000..b71f4c61e --- /dev/null +++ b/Ventas/CatAutorizacionLimites.aspx @@ -0,0 +1,156 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatAutorizacionLimites.aspx.vb" Inherits="Ventas_CatAutorizacionLimites" %> + + + + + + + + Catálogo de autorizaciones de límite de crédito + + + + + + +
  • + Agregar autorización
  • +
    +
    +
    + + + + + +
    +
    +
    + +
    +
    +
      +
    • Estatus: + + + + + + + + +
    • +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + diff --git a/Ventas/CatAutorizacionLimites.aspx.vb b/Ventas/CatAutorizacionLimites.aspx.vb new file mode 100644 index 000000000..0b450106d --- /dev/null +++ b/Ventas/CatAutorizacionLimites.aspx.vb @@ -0,0 +1,215 @@ + +Imports Extensiones + +Partial Class Ventas_CatAutorizacionLimites + Inherits ClsPaginas + +#Region "PROPIEDADES" + Private Property CveAutorizacion() As Integer Get + Return If(IsNothing(ViewState("CveAutorizacion")), -1, CInt(ViewState("CveAutorizacion"))) + End Get Set + ViewState("CveAutorizacion") = Value End Set End Property + Private Property Modalidad() As String Get + Return If(IsNothing(ViewState("Modalidad")), "", (ViewState("Modalidad").ToString)) + End Get Set + ViewState("Modalidad") = Value End Set End Property +#End Region + + Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaCombos() + CargaDatos() + End If + End Sub + +#Region "CARGAS" + Private Sub CargaCombos() + Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + If EsWS Then + DdlCliente.setEsWebService(True) + Else + DdlCliente.setEsWebService(False) + DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + DdlCliente.DataBind() + DdlCliente.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedor.DataBind() + + UpModal.Update() + End Sub + Private Sub CargaDatos() + Dim ObjGral As New ClsVentas + If ObjGral.GetAutorizacionLimite(UsuarioActual.CveEmpresa, -1, -1, CveEstatus:=DdlEstatus.SelectedValue.ToEntero()) Then + GvDatos.DataSource = ObjGral.DtResultados + End If + ObjGral.Dispose() + GvDatos.DataBind() + UpDatos.Update() + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub + +#End Region + +#Region "BOTONES" + Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero() + Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero() + + Dim ObjGral As New ClsVentas + If ObjGral.RemoveAutorizacionLimite(CveAutorizacion, CveCliente) Then + Alert("La autorización se elimino correctamente.", TipoMensaje.MsgInformacion) + End If + ObjGral.Dispose() + + CargaDatos() + End Sub + + Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs) + LimpiaModal() + Modalidad = "A" + BtnGuardar.Text = "Agregar" + ltlMotititulo.Text = "Agregar autorización" UpModal.Update() + RegistraScript("$('#DModal').modal()") End Sub + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + If DdlTipoDocto.SelectedValue = "Ing" AndAlso DdlTipoAutorizacion.SelectedValue.ToEntero() <= 0 Then + Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim CveEstatus As Integer = 1 + Dim TipoDocto As String = DdlTipoDocto.SelectedValue + Dim CveTipoAutorizacion As Integer = -1 + + Select Case TipoDocto + Case "Ing" + CveTipoAutorizacion = DdlTipoAutorizacion.SelectedValue.ToEntero() + Case "Egs" + CveTipoAutorizacion = -1 + End Select + + Dim ObjPS As New ClsVentas + If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, DdlCliente.SelectedValue.ToEntero(), DdlVendedor.SelectedValue.ToEntero(), TxtPrecio.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveAutorizacion, TipoDocto) Then + RegistraScript("$('#DModal').modal('hide')") + Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) + End If + ObjPS.Dispose() + + CargaDatos() + End Sub + +#End Region + +#Region "LIMPIAR" + Protected Sub LimpiaModal() Me.CveAutorizacion = -1 TxtPrecio.Text = "" + + DdlCliente.SelectedValue = "-1" DdlVendedor.SelectedValueExist("-1") End Sub + +#End Region + +#Region "GRIDVIEW" + Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveEstatus") = "0" Then + e.Row.FCLabel("LblEstatus").CssClass = "badge badge-secondary" + e.Row.FCLinkButton("LnkAutorizar").Visible = True + e.Row.FCLinkButton("LnkRechazar").Visible = True + ElseIf e.Row.DBCampo("CveEstatus") = "1" Then + e.Row.FCLabel("LblEstatus").CssClass = "badge badge-success" + e.Row.FCLinkButton("LnkAutorizar").Visible = False + e.Row.FCLinkButton("LnkRechazar").Visible = True + ElseIf e.Row.DBCampo("CveEstatus") = "2" Then + e.Row.FCLabel("LblEstatus").CssClass = "badge badge-primary" + e.Row.FCLinkButton("LnkAutorizar").Visible = False + e.Row.FCLinkButton("LnkRechazar").Visible = False + ElseIf e.Row.DBCampo("CveEstatus") = "3" Then + e.Row.FCLabel("LblEstatus").CssClass = "badge badge-danger" + e.Row.FCLinkButton("LnkAutorizar").Visible = False + e.Row.FCLinkButton("LnkRechazar").Visible = False + End If + 'If e.Row.DBCampo("Estatus") = "True" Then + ' e.Row.Cells(1).ForeColor = Drawing.Color.Green + ' e.Row.Cells(1).Font.Bold = True + ' e.Row.Cells(1).Text = "Activo" + 'Else + ' e.Row.Cells(1).Text = "Inactivo" + ' e.Row.Cells(1).ForeColor = Drawing.Color.Red + ' e.Row.Cells(1).Font.Bold = True + 'End If + End If + End Sub + +#End Region + + + + Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero() + Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero() + Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero() + Dim Importe = gvRow.DataKey("Importe").ToEntero() + Dim CveEstatusAutorizacion As Integer = 1 + + Dim ObjVentas As New ClsVentas + If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion) Then + Alert("El límite de crédito fue autorizado.") + End If + ObjVentas.Dispose() + + CargaDatos() + End Sub + + Protected Sub LnkRechazar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero() + Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero() + Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero() + Dim Importe = gvRow.DataKey("Importe").ToEntero() + Dim CveEstatusAutorizacion As Integer = 3 + + Dim ObjVentas As New ClsVentas + If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion) Then + Alert("El límite de crédito fue rechazado.") + End If + ObjVentas.Dispose() + + CargaDatos() + End Sub + Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) + DivImporte.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 + UpModal.Update() + End Sub + Protected Sub DdlCliente_SelectedIndexChanged(sender As Object, e As EventArgs) + Dim CveCliente As Integer = DdlCliente.SelectedValue.ToEntero() + If CveCliente > 0 Then + Using ObjClientes As New ClsClientes + If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then + DdlVendedor.SelectedValueExist(ObjClientes.DtResultados.Rows(0)("CveVendedor")) + End If + End Using + End If + + UpModal.Update() + End Sub + Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) + Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString() + Select Case TipoDocto + Case "Ing" + DivAutorizacion.Visible = True + DivImporte.Visible = True + Case "Egs" + DivAutorizacion.Visible = False + DivImporte.Visible = False + End Select + UpModal.Update() + End Sub +End Class diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 1f4d659d8..1e0415ffa 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -855,7 +855,7 @@ Partial Class Ventas_ClientesAbonar Dim tipoCambioVentaDiferenciaCambiaria As Double = 1 Dim EsAnticipoEspecial As Boolean = False - If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True + If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then EsAnticipoEspecial = True If dtConceptos IsNot Nothing Then For Each Row As DataRow In dtConceptos.Rows @@ -900,9 +900,9 @@ Partial Class Ventas_ClientesAbonar Else ConceptoMovimiento += $" TC:{tipoCambioVentaValuacion} ${ImporteMovimiento.FormatoNumero(2)}" IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaComplementariaAnticipo, IdCtaContComplementaria) - If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then + If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa.Contiene(119, 158)) Then importeMX = ImporteMovimiento - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa = 119, 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158), 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2579,7 +2579,6 @@ Partial Class Ventas_ClientesAbonar For Each gr As GridViewRow In GvCxC.Rows If gr.FCCheckBox("Chk").Checked Then Dim IdCtaContable As Integer = IdCuentaCliente - Dim CveCuenta As Integer = 0 Dim PorcentajePago As Decimal = gr.DataKey("Saldo").ToDecimal / gr.DataKey("Original").ToDecimal Dim Saldo As Decimal = gr.DataKey("Saldo").ToDecimal Dim RETIVA As Decimal = gr.DataKey("RetIVA").ToDecimal @@ -2632,11 +2631,11 @@ Partial Class Ventas_ClientesAbonar End If - Dim UsaComplementaria As Boolean = False + Dim UsaComplementaria As Boolean = True - If UsuarioActual.CveEmpresa = 119 Then - UsaComplementaria = True - End If + 'If UsuarioActual.CveEmpresa = 119 Then + ' UsaComplementaria = True + 'End If If MsgError = "" Then @@ -2648,16 +2647,16 @@ Partial Class Ventas_ClientesAbonar If UsaComplementaria AndAlso tCveMoneda = 2 Then 'normal - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If 'complementaria - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, gr.DataKey("SerieFolio").ToString, 207, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, (Saldo * TCVenta) - Saldo).RoundSQL, ImporteME:=Saldo, CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, gr.DataKey("SerieFolio").ToString, 207, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, (Saldo * TCVenta) - Saldo).RoundSQL, ImporteME:=Saldo, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If Else - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo * TCVenta), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo * TCVenta), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If @@ -2673,11 +2672,11 @@ Partial Class Ventas_ClientesAbonar End If If TCPago > TCVenta Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 64, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 64, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then MsgError = "Ocurrio un error al saldar el movimiento" End If Else - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 65, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 65, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then MsgError = "Ocurrio un error al saldar el movimiento" End If End If @@ -2700,19 +2699,17 @@ Partial Class Ventas_ClientesAbonar End If IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuenta = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - If (IVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And IVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If (IVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And IVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If - If (RETIVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And RETIVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, RETIVA, gr.DataKey("SerieFolio").ToString, 8, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContRetIVA, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, RETIVA, RETIVA * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If (RETIVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And RETIVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, RETIVA, gr.DataKey("SerieFolio").ToString, 8, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContRetIVA, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, RETIVA, RETIVA * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSxTrasladar - If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, gr.DataKey("SerieFolio").ToString, 38, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IEPS, IEPS * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, gr.DataKey("SerieFolio").ToString, 38, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IEPS, IEPS * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 3c943a27d..f01634812 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -4993,13 +4993,13 @@ Partial Class PV If CveVentaDetalle <= 0 AndAlso Not EsCargo Then Dim ListaPSCargo = CalculaUsados(Consec) If ListaPSCargo.Count > 0 Then - CalculaRecepcionUsados(CvePS, ListaPSCargo) + CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad) End If ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then EliminarUsados() Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False) If ListaPSCargo.Count > 0 Then - CalculaRecepcionUsados(CvePS, ListaPSCargo) + CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad) End If End If @@ -7091,7 +7091,7 @@ Partial Class PV EmitirImprimirNew() End Sub - Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer)) + Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal) If Modalidad = "U" Then If TmpDTRecepcionUsados.Rows.Count > 0 Then @@ -7139,14 +7139,14 @@ Partial Class PV Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}") If DdlRecepcionUsados.SelectedValue.ToEntero() > 0 Then - TotalCargos += 1D * DrTamanio("Cargo").ToString().ToDecimal - TotalCantidad += 1D + TotalCargos += CantidadUsado * DrTamanio("Cargo").ToString().ToDecimal + TotalCantidad += CantidadUsado StrTamanios.AppendFormat("{0},", DrTamanio("CodigoPS")) Dim Row As DataRow = TmpDTRecepcionUsados.NewRow() Row("CvePS") = DrTamanio("CvePSCargo").ToString().ToEntero Row("CvePSRelacionado") = CvePS - Row("Cantidad") = 1D + Row("Cantidad") = CantidadUsado Row("CveUM") = DrTamanio("CveUM").ToString().ToEntero Row("CveVentaDetalle") = -1 Row("PU") = DrTamanio("Cargo").ToString().ToDecimal @@ -7176,11 +7176,14 @@ Partial Class PV ' Exit Sub 'End If - For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})").Rows + Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})") + Dim DivisorUsado = DtUsadosFiltro.Rows.Count.ToString().ToDecimal() + + For Each Dr As DataRow In DtUsadosFiltro.Rows Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal 'Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal - Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal) + Dim DescuentoCargo As Decimal = (TotalCargos / DivisorUsado) If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) @@ -7218,20 +7221,23 @@ Partial Class PV Next TmpDT.AcceptChanges() If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta - For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}").Rows + Dim DtPSFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}") + Dim Divisor = DtPSFiltro.Rows.Count.ToString().ToDecimal() - Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal - Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal) + For Each Dr As DataRow In DtPSFiltro.Rows - If DescuentoCargo > (PUAnterior - Dr("Descuento").ToString.ToDecimal()) Then - DescuentoCargo = (PUAnterior - Dr("Descuento").ToString.ToDecimal()) + Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal + Dim DescuentoCargo As Decimal = (TotalCargos / Divisor) + + If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then + DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) End If 'Dim PUActual As Decimal = PUAnterior - DescuentoCargo Dim Descuento As Decimal = Dr("Descuento").ToString.ToDecimal + DescuentoCargo - Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (PUAnterior)) - Descuento - TotalCargos += -DescuentoCargo + Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal) - Descuento + TotalCargos -= DescuentoCargo Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString) Dim drr As DataRow = drt(0) diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index c6adff94b..8583d5742 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -2944,7 +2944,10 @@ Partial Class ProductosyServicios Return True End If End If + + GlobalDTPSSimplificado(CveEmpresaFranquicia) = Nothing Next + Return False End Function diff --git a/Ventas/RepAnticipo-NC-IXCDetalle.aspx b/Ventas/RepAnticipo-NC-IXCDetalle.aspx index 427376291..2ba2f08ee 100644 --- a/Ventas/RepAnticipo-NC-IXCDetalle.aspx +++ b/Ventas/RepAnticipo-NC-IXCDetalle.aspx @@ -196,6 +196,11 @@ +
    + + + +
    diff --git a/Ventas/RepAnticipo-NC-IXCDetalle.aspx.cs b/Ventas/RepAnticipo-NC-IXCDetalle.aspx.cs index 24bd56845..00c7931df 100644 --- a/Ventas/RepAnticipo-NC-IXCDetalle.aspx.cs +++ b/Ventas/RepAnticipo-NC-IXCDetalle.aspx.cs @@ -94,7 +94,9 @@ public partial class Ventas_RepAnticipo_NC_IXCDetalle : ClsPaginas DdlSucursal.DataSource = get_GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa); DdlSucursal.DataBind(); DdlSucursal.Items.Insert(0, new ListItem("Todos", "-1")); - DdlSucursal.SelectedValue = "-1"; + DdlSucursal.SelectedValue = "-1"; + DdlSubProyectoSaldar.DataSource = get_GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa); + DdlSubProyectoSaldar.DataBind(); } //protected void CargaClientes() @@ -386,7 +388,7 @@ public partial class Ventas_RepAnticipo_NC_IXCDetalle : ClsPaginas break; } - if (!ObjConta.AddPrePolizasDetalle(CvePrePoliza, true, Gv.DataKey("Saldo").ToDecimal(), Gv.DataKey("Folio").ToString(), 78, TxtConcepto.Text, TxtFecha.Text.ToDate(), UsuarioActual.Empresa.IdCuentaOtrosIngresos, -1, CveIE, CveVenta, ImporteMX: Gv.DataKey("Saldo").ToDecimal(), CveCuenta: -1, CveSubProyecto: Gv.DataKey("CveSubProyecto").ToEntero())) + if (!ObjConta.AddPrePolizasDetalle(CvePrePoliza, true, Gv.DataKey("Saldo").ToDecimal(), Gv.DataKey("Folio").ToString(), 78, TxtConcepto.Text, TxtFecha.Text.ToDate(), UsuarioActual.Empresa.IdCuentaOtrosIngresos, -1, CveIE, CveVenta, ImporteMX: Gv.DataKey("Saldo").ToDecimal(), CveCuenta: -1, CveSubProyecto: DdlSubProyectoSaldar.SelectedValue.ToEntero())) { MsgError = "Ocurrio un error al saldar el movimiento"; break; diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb index cf7a1a120..7ff45a9fe 100644 --- a/Ventas/RepPS.aspx.vb +++ b/Ventas/RepPS.aspx.vb @@ -775,9 +775,9 @@ Partial Class Ventas_RepPS 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Value = Row("PolizasCantidadAcumulada") worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 7).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Name})" - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Value = Row("VentaAnterior") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Value = Row("VentaDia") - 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Value = Row("VentaAcumulada") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Value = Row("ManoObraCantidadAnterior") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Value = Row("ManoObraCantidadDia") + 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Value = Row("ManoObraCantidadAcumulada") worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Name})" Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesServiciosAmortPolizas, 0, IdxSucursalesServiciosAmortPolizas, 12).Style diff --git a/Ventas/RepVentasUtilidad.aspx b/Ventas/RepVentasUtilidad.aspx index d21808115..755ce2a34 100644 --- a/Ventas/RepVentasUtilidad.aspx +++ b/Ventas/RepVentasUtilidad.aspx @@ -244,7 +244,7 @@ - + diff --git a/Ventas/RepVentasUtilidad.aspx.vb b/Ventas/RepVentasUtilidad.aspx.vb index 04c8477c2..cfd0678b8 100644 --- a/Ventas/RepVentasUtilidad.aspx.vb +++ b/Ventas/RepVentasUtilidad.aspx.vb @@ -181,6 +181,9 @@ Partial Class Ventas_RepVentasUtilidad End If If Not e.Row.RowIndex = 0 AndAlso e.Row.DBCampo("SubTotal").ToDecimal = 0 AndAlso e.Row.DBCampo("CveVenta").ToEntero > 0 Then + If e.Row.DBCampo("FechaVenta").ToDate < txtFechaI.Text.ToDate.FirstDayOfMonth Then + e.Row.ToolTip = "Venta con realizada en un periodo anterior" + End If e.Row.CssClass = "danger" ElseIf Not e.Row.RowIndex = 0 AndAlso e.Row.DBCampo("CveVenta") <> "" Then e.Row.Cells(0).BackColor = ColorTranslator.FromHtml("#e9e9e9") @@ -218,6 +221,7 @@ Partial Class Ventas_RepVentasUtilidad If e.Row.DBCampo("CveVenta").ToEntero > 0 AndAlso Not CBool(e.Row.DBCampo("TienePago")) Then e.Row.Cells(15).BackColor = Drawing.Color.LightPink + e.Row.Cells(15).ToolTip = "Factura sin pago registrado" End If diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 39418049f..bef184d20 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -367,6 +367,9 @@
  • Relacionar Facturas
  • +
  • + Solicitar autorización de crédito +
  • @@ -3657,7 +3660,7 @@
    -
    +
    @@ -3765,23 +3768,23 @@ - +
    - +
    - - - + + +
    @@ -3956,7 +3959,7 @@
    + DataKeyNames="ISTotal,Saldo,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,CveConceptoContableAmor, TotalAnticipo, SubTotalAnticipo, IVAAnticipo,IEPS, ImpuestosLocalesAnticipo, SubTotalAmortizacion, SubTotal, Original, IVA, RetIVA, RetISR, IdCtaContableNC,FolioFiscal, CveClasificacionNC, TipoCambio,TipoCambioPago,TipoCambioHoy, CveMoneda,Fecha,SaldoSubTotal,SaldoConImpuestos,RegresarImpuesto,CveCliente"> @@ -6239,7 +6242,7 @@
    -