diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index b991a40a3..388078978 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -161,6 +161,8 @@ Public Class ClsClientes Public Property CveAlmacenAlterno As Integer = -1 Public Property CveAlmacenConsignacion As Integer = -1 Public Property UsaProductoAlterno As Boolean = False + Public Property EnDemanda As Boolean = False + Public Property EnQuebranto As Boolean = False #End Region @@ -413,6 +415,8 @@ Public Class ClsClientes _CveAlmacenConsignacion = Data(0)("CveAlmacenConsignacion").ToString.ToEntero _UsaProductoAlterno = CBool(Data(0)("UsaProductoAlterno")) + _EnDemanda = CBool(Data(0)("UsaProductoAlterno")) + _EnQuebranto = CBool(Data(0)("EnQuebranto")) End If Retorno = True @@ -530,7 +534,8 @@ Public Class ClsClientes Optional CveMotivoTraslado As Integer = 0, Optional NumRegIdTrib As String = "", Optional ComExtEstado As String = "-1", Optional ComExtMunicipio As String = "-1", Optional ComExtColonia As String = "-1", Optional RequiereOC As Boolean = False, Optional LT As String = "0", Optional LG As String = "0", Optional EsDistribuidor As Boolean = False, Optional TipoCliente As Integer = 1, Optional CargoUsado As Boolean = False, Optional BonificacionUsado As Boolean = False, Optional CveTipoRetencion As Integer = 0, Optional CorreoEntregaCompras As String = "-1", Optional CorreoEntregaAlmacen As String = "-1", Optional CveSATEstado As Integer = -1, Optional CveAdminTrayecto As Integer = -1, Optional CveRegimenFiscal As Integer = 0, Optional RegimenSociedad As String = "-1", Optional TipoPersona As Boolean = False, - Optional RepresentanteLegal As String = "", Optional FechaLimiteCredito As Date = MinFecha, Optional ComExtCalle As String = "-1", Optional ComExtNumExt As String = "-1", Optional ComExtCP As String = "-1", Optional Genero As Boolean = True, Optional CveAlmacenAsignado As Integer = -1, Optional CveAlmacenConsignacion As Integer = -1, Optional CveAlmacenAlterno As Integer = -1, Optional UsaProductoAlterno As Boolean = False) As Boolean + Optional RepresentanteLegal As String = "", Optional FechaLimiteCredito As Date = MinFecha, Optional ComExtCalle As String = "-1", Optional ComExtNumExt As String = "-1", Optional ComExtCP As String = "-1", Optional Genero As Boolean = True, Optional CveAlmacenAsignado As Integer = -1, Optional CveAlmacenConsignacion As Integer = -1, Optional CveAlmacenAlterno As Integer = -1, Optional UsaProductoAlterno As Boolean = False, + Optional EnDemanda As Boolean = False, Optional EnQuebranto As Boolean = False) As Boolean Dim Retorno As Boolean = False @@ -662,6 +667,8 @@ Public Class ClsClientes .Add("@CveAlmacenAlterno", SqlDbType.Int).Value = CveAlmacenAlterno .Add("@CveAlmacenConsignacion", SqlDbType.Int).Value = CveAlmacenConsignacion .Add("@UsaProductoAlterno", SqlDbType.Bit).Value = UsaProductoAlterno + .Add("@EnDemanda", SqlDbType.Bit).Value = EnDemanda + .Add("@EnQuebranto", SqlDbType.Bit).Value = EnQuebranto End With Try SqlAdapter.Fill(Data) @@ -707,7 +714,8 @@ Public Class ClsClientes Optional ApellidoPaternoPF As String = "-1", Optional ApellidoMaternoPF As String = "-1", Optional NombresPF As String = "-1", Optional RequiereOC As Boolean = False, Optional LT As String = "0", Optional LG As String = "0", Optional EsDistribuidor As Boolean = False, Optional TipoCliente As Integer = 1, Optional CargoUsado As Boolean = False, Optional BonificacionUsado As Boolean = False, Optional CveTipoRetencion As Integer = 0, Optional CorreoEntregaCompras As String = "-1", Optional CorreoEntregaAlmacen As String = "-1", Optional CveSATEstado As Integer = -1, Optional CveAdminTrayecto As Integer = -1, Optional NoDesglosaIVA As Boolean = False, Optional CveRegimenFiscal As Integer = 0, Optional RegimenSociedad As String = "-1", Optional TipoPersona As Boolean = False, - Optional RepresentanteLegal As String = "", Optional FechaLimiteCredito As Date = MinFecha, Optional ComExtCalle As String = "-1", Optional ComExtNumExt As String = "-1", Optional ComExtCP As String = "-1", Optional Genero As Boolean = True, Optional CveAlmacenAsignado As Integer = -1, Optional CveAlmacenAlterno As Integer = -1, Optional CveAlmacenConsignacion As Integer = -1, Optional UsaProductoAlterno As Boolean = False) As Boolean + Optional RepresentanteLegal As String = "", Optional FechaLimiteCredito As Date = MinFecha, Optional ComExtCalle As String = "-1", Optional ComExtNumExt As String = "-1", Optional ComExtCP As String = "-1", Optional Genero As Boolean = True, Optional CveAlmacenAsignado As Integer = -1, Optional CveAlmacenAlterno As Integer = -1, Optional CveAlmacenConsignacion As Integer = -1, Optional UsaProductoAlterno As Boolean = False, + Optional EnDemanda As Boolean = False, Optional EnQuebranto As Boolean = False) As Boolean Dim Retorno As Boolean = False @@ -849,7 +857,8 @@ Public Class ClsClientes .Add("@CveAlmacenConsignacion", SqlDbType.Int).Value = CveAlmacenConsignacion .Add("@CveAlmacenAlterno", SqlDbType.Int).Value = CveAlmacenAlterno .Add("@UsaProductoAlterno", SqlDbType.Bit).Value = UsaProductoAlterno - + .Add("@EnDemanda", SqlDbType.Bit).Value = EnDemanda + .Add("@EnQuebranto", SqlDbType.Bit).Value = EnQuebranto End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 3c0f7b656..52d3826f9 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -3201,7 +3201,7 @@ Public Class ClsContratos End Function - Public Function GetPresupuestosResumen(CveEmpresa As Integer, CveSubProyecto As Integer, Opcion As Integer) As Boolean + Public Function GetPresupuestosResumen(CveEmpresa As Integer, CveSubProyecto As Integer, FechaInicio As Date, FechaFin As Date, Opcion As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Con_PresupuestosResumenGet") @@ -3209,6 +3209,8 @@ Public Class ClsContratos .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin End With Try diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index cb986fc36..496459e94 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -3,8 +3,6 @@ Option Strict On Imports System.Data Imports System.Data.SqlClient Imports Extensiones -Imports Microsoft.Web.XmlTransform -Imports Telerik.Web.UI.ComboBox.ComboBoxStyles Public Class ClsInventarios Implements IDisposable @@ -1357,7 +1355,7 @@ Public Class ClsInventarios End If Catch Ex1 As SqlException If Ex1.Message.Contains("50019") Then - Me.OnError(" El producto no tiene existencia.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Me.OnError(String.Format(" El producto '{0}' no tiene existencia.", Ex1.Message.GetTagValue("codigops")), Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) ElseIf Ex1.Message.Contains("CK_Inv_MovimientosDetalle_MetodoInventario") Then Me.OnError("El movimiento debe de tener una Serie.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) Else @@ -3326,11 +3324,12 @@ Public Class ClsInventarios #End Region #Region " INVENTARIOS - VENTAS " - Public Function EntregaAlmacenGet(CveVenta As Integer, Optional CveAlmacen As Integer = -1) As Boolean + Public Function EntregaAlmacenGet(CveVenta As Integer, CveEmpresa As Integer, Optional CveAlmacen As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_EntregaAlmacenGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen End With Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 022a7f354..5de754c67 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1952,12 +1952,18 @@ Public Class ClsPaginas If ObjInventarios.GetCamiones(-1, UsuarioActual.CveEmpresa) Then Application(AppNombre) = ObjInventarios.DtResultados ObjInventarios.Dispose() End If - Dim Str As New StringBuilder - If CveCamion > 0 Then Str.AppendFormat("CveCamion = {0}", CveCamion) - If CveTipoCamion > 0 Then Str.AppendFormat("CveTipoCamion = {0}", CveTipoCamion) - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTInvCamiones = Dv.ToTable - Dv.Dispose() + + Dim filtros As New List(Of String) + If CveCamion >= 0 Then filtros.Add($"CveCamion = {CveCamion} ") + If CveTipoCamion >= 0 Then filtros.Add($"CveTipoCamion = {CveTipoCamion} ") + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) + GlobalDTInvCamiones = Dv.ToTable + Dv.Dispose() + Else + GlobalDTInvCamiones = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + End Get Set(value As DataTable) Dim AppNombre As String = $"GlobalDTInvCamiones-{CveEmpresa}" @@ -6984,6 +6990,15 @@ Public Class ClsPaginas If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then params.Add(New ReportParameter("UsaProductoAlterno", If(Vta.Cliente.UsaProductoAlterno, "1", "0"))) + + params.Add(New ReportParameter("Documentacion", Vta.Cliente.Documentacion)) + params.Add(New ReportParameter("Medico", Vta.Medico)) + params.Add(New ReportParameter("Procedimiento", Vta.Procedimiento)) + params.Add(New ReportParameter("FechaCirugia", Vta.FechaParaSurtir.ToString("yyyy-MM-dd HH:mm"))) + params.Add(New ReportParameter("Paciente", Vta.Paciente)) + params.Add(New ReportParameter("Episodio", Vta.Episodio)) + params.Add(New ReportParameter("Alfa1", Vta.Alfa1)) + End If 'PARAMETROS SEGUN TIPO DOCUMENTO @@ -7022,16 +7037,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("Ref", TipoDocumentoRef)) params.Add(New ReportParameter("AplicaPagare", AplicaPagare)) - If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then - params.Add(New ReportParameter("Documentacion", Vta.Cliente.Documentacion)) - params.Add(New ReportParameter("Medico", Vta.Medico)) - params.Add(New ReportParameter("Procedimiento", Vta.Procedimiento)) - params.Add(New ReportParameter("FechaCirugia", Vta.FechaEjecucion.ToString("dd/MM/yyyy HH:mm"))) - params.Add(New ReportParameter("Paciente", Vta.Paciente)) - params.Add(New ReportParameter("Episodio", Vta.Episodio)) - params.Add(New ReportParameter("Alfa1", Vta.Alfa1)) - End If 'VSH If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122, 145) Then 'DATOS CLIENTES @@ -7081,15 +7087,6 @@ Public Class ClsPaginas params.Add(New ReportParameter("Ref", TipoDocumentoRef)) params.Add(New ReportParameter("AplicaPagare", AplicaPagare)) - If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then - params.Add(New ReportParameter("Documentacion", Vta.Cliente.Documentacion)) - params.Add(New ReportParameter("Medico", Vta.Medico)) - params.Add(New ReportParameter("Procedimiento", Vta.Procedimiento)) - params.Add(New ReportParameter("FechaCirugia", Vta.FechaEjecucion.ToString("dd/MM/yyyy HH:mm"))) - params.Add(New ReportParameter("Paciente", Vta.Paciente)) - params.Add(New ReportParameter("Episodio", Vta.Episodio)) - params.Add(New ReportParameter("Alfa1", Vta.Alfa1)) - End If RutaFormato = String.Format("{0}Formatos\{1}.rdlc", UsuarioActual.Empresa.Ruta, NombreArchivo) RutaFormatoDefault = String.Format("Empresas\Grales\Formatos\{0}.rdlc", NombreArchivo) @@ -7115,11 +7112,11 @@ Public Class ClsPaginas params.Add(New ReportParameter("CveVenta", Vta.CveVenta.ToString)) End If 'COMPU DN DIFUSA - If UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119, 137, 132, 144, 177, 186) Then + If UsuarioActual.CveEmpresa.Contiene(1, 119, 137, 132, 144, 177, 186) Then Dim FirmaVendedor As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", UsuarioActual.Empresa.Ruta, Vta.CveVendedor)) params.Add(New ReportParameter("FirmaVendedor", If(FirmaVendedor.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", UsuarioActual.CveEmpresa, Vta.CveVendedor))).AbsoluteUri, ""))) params.Add(New ReportParameter("Entrega", Vta.Entrega)) - params.Add(New ReportParameter("Vigencia", Vta.Vigencia.ToString("dd/MMMM/yyyy"))) + params.Add(New ReportParameter("Vigencia", Vta.Vigencia.ToString("yyyy-MM-dd"))) params.Add(New ReportParameter("Sucursal", Vta.SubProyecto.SubProyecto)) params.Add(New ReportParameter("SucursalCliente", If(Vta.ClienteSucursal.Sucursal Is Nothing, "", Vta.ClienteSucursal.Sucursal.ToString))) params.Add(New ReportParameter("CveMoneda", Vta.CveMoneda.ToString)) @@ -7133,11 +7130,8 @@ Public Class ClsPaginas RutaFormato = String.Format("{0}Formatos\{1}.rdlc", UsuarioActual.Empresa.Ruta, NombreArchivo) RutaFormatoDefault = String.Format("Empresas\Grales\Formatos\{0}.rdlc", NombreArchivo) Case "Egs" - If UsuarioActual.CveEmpresa.Contiene(72, 80) Then - NombreArchivo = "NotaCredito" - Else - NombreArchivo = "Factura" - End If + + NombreArchivo = "Factura" NombreArchivoDescarga = "Nota de Crédito" TipoDocumento = "EGRESO" TipoDocumentoRef = String.Format(": Ref.:{0}", Vta.RefDocto) @@ -7163,22 +7157,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("Tipo", TipoDocumento)) params.Add(New ReportParameter("Ref", TipoDocumentoRef)) params.Add(New ReportParameter("AplicaPagare", AplicaPagare)) - 'INE COMPLEMENTOS - If UsuarioActual.CveEmpresa.Contiene(72) Then - Dim INETipoProceso As String = "" - Dim INETipoComite As String = "" - Dim INEIdContabilidad As Integer = 0 - If Vta.ComplementoINE IsNot Nothing Then - INETipoProceso = Vta.ComplementoINE.INETipoProceso - INETipoComite = Vta.ComplementoINE.INETipoComite - INEIdContabilidad = Vta.ComplementoINE.INEIdContabilidad - End If - params.Add(New ReportParameter("INETipoProceso", INETipoProceso)) - params.Add(New ReportParameter("INETipoComite", INETipoComite)) - params.Add(New ReportParameter("INEIdContabilidad", INEIdContabilidad.ToString)) - params.Add(New ReportParameter("Referencia", Vta.Cliente.ReferenciaFiscal)) - params.Add(New ReportParameter("ClienteContacto", Vta.AtencionA)) - End If + RutaFormato = String.Format("{0}Formatos\{1}.rdlc", UsuarioActual.Empresa.Ruta, NombreArchivo) RutaFormatoDefault = String.Format("Empresas\Grales\Formatos\{0}.rdlc", NombreArchivo) Case "Ped" @@ -7192,14 +7171,6 @@ Public Class ClsPaginas params.Add(New ReportParameter("AplicaPagare", AplicaPagare)) params.Add(New ReportParameter("CveAlmacenTraspasoOrigen", Vta.CveAlmacenTraspasoOrigen.ToString)) - If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then - params.Add(New ReportParameter("Documentacion", Vta.Cliente.Documentacion)) - params.Add(New ReportParameter("Medico", Vta.Medico)) - params.Add(New ReportParameter("Procedimiento", Vta.Procedimiento)) - params.Add(New ReportParameter("FechaCirugia", Vta.FechaEjecucion.ToString("dd/MM/yyyy HH:mm"))) - params.Add(New ReportParameter("Paciente", Vta.Paciente)) - params.Add(New ReportParameter("Episodio", Vta.Episodio)) - End If RutaFormato = String.Format("{0}Formatos\{1}.rdlc", UsuarioActual.Empresa.Ruta, NombreArchivo) RutaFormatoDefault = String.Format("Empresas\Grales\Formatos\{0}.rdlc", NombreArchivo) @@ -7616,116 +7587,6 @@ Public Class ClsPaginas Return o.Value End If End Function - Public Sub GenerarFacturaVenta(CveVenta As Integer) - Dim ObjVentas As New ClsVentas - Dim Vta As Modelos.Factura = Nothing - Dim TmpDTImpuestos As DataTable = New DataTable - TmpDTImpuestos.Columns.Add("ImpuestoLocal", GetType(String)) - TmpDTImpuestos.Columns.Add("Importe", GetType(Double)) - TmpDTImpuestos.Columns.Add("Orden", GetType(Integer)) - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, False) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - Dim dtVentas As DataTable = ObjVentas.DtResultados - ' se rellenan los campos de la factura - Vta = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.Factura) - Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString - 'se rellena la sucursal - Vta.SubProyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SubProyectoModel) - Vta.Cliente = New Modelos.ClienteModel - Vta.Cliente.Nombre = dtVentas(0)("ClienteNombre").ToString - Vta.Cliente.Telefono = dtVentas(0)("Telefono").ToString - Vta.Cliente.Direccion = dtVentas(0)("ClienteDireccion").ToString - Vta.Cliente.CP = dtVentas(0)("CPCliente").ToString - Vta.Cliente.Ciudad = dtVentas(0)("ClienteCiudad").ToString - Vta.Cliente.Localidad = dtVentas(0)("ClienteLocalidad").ToString - Vta.Cliente.Estado = dtVentas(0)("ClienteEstado").ToString - Vta.Cliente.Pais = dtVentas(0)("ClientePais").ToString - Vta.Cliente.RFC = dtVentas(0)("ClienteRFC").ToString - Vta.Cliente.Colonia = dtVentas(0)("ColoniaCliente").ToString - Vta.AtencionA = dtVentas(0)("AtencionA").ToString - Vta.TelefonoGenerico = dtVentas(0)("TelefonoGenerico").ToString - Vta.Cliente.NoExt = dtVentas(0)("ClienteNoExt").ToString - Vta.Cliente.NoInt = dtVentas(0)("ClienteNoInt").ToString - Vta.Cliente.Codigo = dtVentas(0)("ClienteCodigo").ToString - Vta.Cliente.Mail = dtVentas(0)("Mail").ToString - Vta.RefDocto = dtVentas(0)("Ref").ToString - Vta.CveVenta = dtVentas(0)("CveVenta").ToString.ToEntero - Vta.Version = dtVentas(0)("Version").ToString - Vta.ClienteSucursal = New Modelos.SucursalModel - Vta.ClienteSucursal.Direccion = dtVentas(0)("SucClienteDireccion").ToString - Vta.ClienteSucursal.NoExt = dtVentas(0)("SucClienteNoExt").ToString - Vta.ClienteSucursal.NoInt = dtVentas(0)("SucClienteNoInt").ToString - Vta.ClienteSucursal.Colonia = dtVentas(0)("SucClienteColonia").ToString - Vta.ClienteSucursal.CP = dtVentas(0)("SucClienteCP").ToString - Vta.ClienteSucursal.Municipio = dtVentas(0)("SucClienteCiudad").ToString - Vta.ClienteSucursal.Estado = dtVentas(0)("SucClienteEstado").ToString - Vta.ClienteSucursal.Pais = dtVentas(0)("SucClientePais").ToString - Vta.ClienteSucursal.Localidad = dtVentas(0)("SucClienteLocalidad").ToString - Vta.ClienteSucursal.CorreoSucursal = dtVentas(0)("SucClienteCorreo").ToString - Vta.ClienteSucursal.TelefonoSucursal = dtVentas(0)("SucClienteTelefono").ToString - Vta.ClienteSucursal.Sucursal = dtVentas(0)("SucursalCliente").ToString - Vta.EnviarA = New Modelos.EnviarAModel - Vta.EnviarA.CveDireccionEnvio = dtVentas(0)("CveDireccionEnvio").ToString.ToEntero - Vta.EnviarA.EnvioDireccion = dtVentas(0)("EnvioDireccion").ToString - Vta.EnviarA.EnvioColonia = dtVentas(0)("EnvioColonia").ToString - Vta.EnviarA.EnvioCiudad = dtVentas(0)("EnvioCiudad").ToString - Vta.EnviarA.EnvioEstado = dtVentas(0)("EnvioEstado").ToString - Vta.EnviarA.EnvioCP = dtVentas(0)("EnvioCP").ToString - Dim DR As DataRow = TmpDTImpuestos.NewRow() - If UsuarioActual.CveEmpresa.Contiene(1, 5, 15, 17, 72, 66, 79, 81, 109, 110, 111, 76) Then - If dtVentas(0)("SubTotal").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Subtotal" : DR("Importe") = dtVentas(0)("SubTotal").ToString.ToDouble : DR("Orden") = 10 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("Descuento").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = dtVentas(0)("Descuento").ToString.ToDouble : DR("Orden") = 20 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("Amortizacion").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = dtVentas(0)("Amortizacion").ToString.ToDouble : DR("Orden") = 30 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("SubTotal").ToString.ToDouble <> (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) Then DR("ImpuestoLocal") = "SubTotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) : DR("Orden") = 40 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("IVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 50 : TmpDTImpuestos.Rows.Add(DR) - 'solo para eclipse, que muesre un subtotal debajo de IVA - If UsuarioActual.CveEmpresa = 15 Then DR = TmpDTImpuestos.NewRow() : DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) + dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 51 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("RetIVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = dtVentas(0)("RetIVA").ToString.ToDouble : DR("Orden") = 60 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("RetISR").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = dtVentas(0)("RetISR").ToString.ToDouble : DR("Orden") = 70 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("Total").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = dtVentas(0)("Total").ToString.ToDouble : DR("Orden") = 1000 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - End If - If ObjVentas.GetVentaDetalle(CveVenta) Then 'Obtenemos el Detalle de la Oorden de Compra - Vta.DtDetalle = ObjVentas.DtResultados - End If - If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then - If UsuarioActual.CveEmpresa.Contiene(1, 5, 15, 17, 72, 66, 79, 81, 109, 110, 111, 76) Then - Dim dtImpuesto As DataTable = ObjVentas.DtResultados - If dtImpuesto.Rows.Count > 0 Then - For Each Row As DataRow In dtImpuesto.Rows - Dim Orden As Integer = 80 - If Row("Importe").ToString.ToDouble <> 0 Then - DR("ImpuestoLocal") = Row("ImpuestoLocal").ToString - DR("Importe") = Row("Importe").ToString.ToDouble - DR("Orden") = Orden - TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - Orden = Orden + 1 - End If - Next - End If - Vta.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC") - Else - Vta.DtDeduccion = ObjVentas.DtResultados - End If - End If - If ObjVentas.GetVentasFirmas(CveVenta) Then - Vta.DtFirmas = ObjVentas.DtResultados - End If - End If - ObjVentas.Dispose() - - If Not IsNothing(Vta) Then - PdfFactura(Vta) - Vta = Nothing - End If - End Sub #End Region Public Function RutaFormatoReporte(NombreReporte As String) As String @@ -7745,7 +7606,6 @@ Public Class ClsPaginas Public Function NewGeneraBytesOC(tCveOrdenCompra As Integer, Optional MR As ReportViewer = Nothing, Optional ConBitacora As Boolean = False) As Byte() Dim bytes As Byte() = Nothing Dim CveEmpresaActual As Integer - Dim TmpDTEnvioDireccion As DataTable Dim params As New List(Of ReportParameter) Try Dim DtDetalle As DataTable = Nothing @@ -7774,68 +7634,6 @@ Public Class ClsPaginas 'Obtenemos la sucursal de la OC PARA COMPU PROVEEDORES Dim DomicilioSucursal As String = "" - If UsuarioActual.CveEmpresa.Contiene(72, 80) Then - Dim SBDomicilioSucursal As New StringBuilder() - Dim CiudadSucursal As String = "" - Dim ObjClientes As New ClsClientes - If ObjOC.GetSucursalOC(ObjOC.CveOrdenCompra) AndAlso ObjOC.DtResultados.Rows.Count > 0 Then - CiudadSucursal = String.Format("{0},{1}", ObjOC.SucMunicipio, ObjOC.SucEstado) - SBDomicilioSucursal.AppendFormat("{0}", ObjOC.SucCalle) - If ObjOC.SucNoExt.Length > 0 Then SBDomicilioSucursal.AppendFormat(" No.Ext: {0}", ObjOC.SucNoExt) - If ObjOC.SucNoInt.Length > 0 Then SBDomicilioSucursal.AppendFormat(", No.Int: {0}", ObjOC.SucNoInt) - If ObjOC.SucColonia.Length > 0 Then SBDomicilioSucursal.AppendFormat(", Col: {0}", ObjOC.SucColonia) - If ObjOC.SucCP.Length > 0 Then SBDomicilioSucursal.AppendFormat(", CP: {0}", ObjOC.SucCP) - If CiudadSucursal.Length > 0 Then SBDomicilioSucursal.AppendFormat(", {0}", CiudadSucursal) - If ObjOC.SucPais.Length > 0 Then SBDomicilioSucursal.AppendFormat(", {0}", ObjOC.SucPais) - DomicilioSucursal = SBDomicilioSucursal.ToString - params.Add(New ReportParameter("Proyecto", ObjOC.SucSubProyecto.ToString)) - params.Add(New ReportParameter("Telefono", ObjOC.SucTelefono.ToString)) - 'Obtenemos la direccion envio PARA COMPU PROVEEDORES - If ObjOC.CveDireccionEnvio > 0 Then - Dim StrEnvioDi As New StringBuilder - If ObjClientes.DireccionEnvioGet(ObjOC.CveDireccionEnvio, ObjOC.CveCliente, -1) Then - TmpDTEnvioDireccion = ObjClientes.DtResultados - Else - TmpDTEnvioDireccion = Nothing - End If - ObjClientes.Dispose() - - If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", ObjOC.CveDireccionEnvio)).Rows.Count > 0 Then - StrEnvioDi.AppendFormat("{0}", TmpDTEnvioDireccion(0)("EnvioDireccion")) - If TmpDTEnvioDireccion(0)("EnvioNoExt") IsNot Nothing AndAlso TmpDTEnvioDireccion(0)("EnvioNoExt").ToString.Length > 0 Then StrEnvioDi.AppendFormat(", No.Ext: {0}", TmpDTEnvioDireccion(0)("EnvioNoExt")) - If TmpDTEnvioDireccion(0)("EnvioNoInt") IsNot Nothing AndAlso TmpDTEnvioDireccion(0)("EnvioNoInt").ToString.Length > 0 Then StrEnvioDi.AppendFormat(", No.Int: {0}", TmpDTEnvioDireccion(0)("EnvioNoInt")) - params.Add(New ReportParameter("EnvioDireccion", StrEnvioDi.ToString)) - params.Add(New ReportParameter("EnvioNoExt", TmpDTEnvioDireccion(0)("EnvioNoExt").ToString)) - params.Add(New ReportParameter("EnvioNoInt", TmpDTEnvioDireccion(0)("EnvioNoInt").ToString)) - params.Add(New ReportParameter("EnvioColonia", TmpDTEnvioDireccion(0)("EnvioColonia").ToString)) - params.Add(New ReportParameter("EnvioCiudad", TmpDTEnvioDireccion(0)("EnvioCiudad").ToString)) - params.Add(New ReportParameter("EnvioEstado", TmpDTEnvioDireccion(0)("EnvioEstado").ToString)) - params.Add(New ReportParameter("EnvioContacto", TmpDTEnvioDireccion(0)("EnvioContacto").ToString)) - params.Add(New ReportParameter("EnvioDepartamento", TmpDTEnvioDireccion(0)("EnvioDepartamento").ToString)) - params.Add(New ReportParameter("EnvioCP", TmpDTEnvioDireccion(0)("EnvioCP").ToString)) - params.Add(New ReportParameter("EnvioTel", TmpDTEnvioDireccion(0)("EnvioTel").ToString)) - End If - Else - If ObjOC.LugarEntrega.ToString IsNot Nothing AndAlso ObjOC.LugarEntrega.ToString = "" Then - Dim StrEnvioDi As New StringBuilder - StrEnvioDi.AppendFormat("{0}", ObjOC.SucCalle) - If ObjOC.SucNoExt.Length > 0 Then StrEnvioDi.AppendFormat(", No.Ext: {0}", ObjOC.SucNoExt) - If ObjOC.SucNoInt.Length > 0 Then StrEnvioDi.AppendFormat(", No.Int: {0}", ObjOC.SucNoInt) - params.Add(New ReportParameter("EnvioDireccion", StrEnvioDi.ToString)) - params.Add(New ReportParameter("EnvioColonia", If(ObjOC.SucColonia.Length > 0, ObjOC.SucColonia, ""))) - params.Add(New ReportParameter("EnvioCiudad", If(ObjOC.SucMunicipio.Length > 0, ObjOC.SucMunicipio, ""))) - params.Add(New ReportParameter("EnvioEstado", If(ObjOC.SucEstado.Length > 0, ObjOC.SucEstado, ""))) - params.Add(New ReportParameter("EnvioCP", If(ObjOC.SucCP.Length > 0, ObjOC.SucCP, ""))) - Else - params.Add(New ReportParameter("EnvioDireccion", ObjOC.LugarEntrega)) - params.Add(New ReportParameter("LugarEntrega", ObjOC.LugarEntrega)) - End If - params.Add(New ReportParameter("EnvioTel", ObjOC.SucTelefono.ToString)) - - End If - End If - End If - Dim CveUsuarioSol As Integer = dtOC(0)("CveUsuarioSolicito").ToString.ToEntero Dim CveUsuarioAut As Integer = dtOC(0)("CveUsuarioAutorizo").ToString.ToEntero Dim drSol As DataRow = GlobalDTUsuarios(CveUsuarioSol, EmpresaActual.CveEmpresa).FiltroPrimero("") 'DataRow (incluye el NOMBRE de quien SOLICITÓ la OC) @@ -7846,10 +7644,10 @@ Public Class ClsPaginas If drSol IsNot Nothing AndAlso drSol("CvePersonal").ToString.ToEntero > 0 Then CvePersonalSol = drSol("CvePersonal").ToString.ToEntero If drAut IsNot Nothing AndAlso drAut("CvePersonal").ToString.ToEntero > 0 Then CvePersonalAut = drAut("CvePersonal").ToString.ToEntero Dim ObjRH As New ClsRH() - If ObjRH.GetPersonal(CvePersonalSol, EmpresaActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then + If CvePersonalSol > 0 AndAlso ObjRH.GetPersonal(CvePersonalSol, EmpresaActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then PuestoSol = ObjRH.DtResultados(0)("Puesto").ToString End If - If ObjRH.GetPersonal(CvePersonalAut, EmpresaActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then + If CvePersonalAut > 0 AndAlso ObjRH.GetPersonal(CvePersonalAut, EmpresaActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then PuestoAut = ObjRH.DtResultados(0)("Puesto").ToString End If ObjRH.Dispose() @@ -7861,9 +7659,6 @@ Public Class ClsPaginas End If Dim nombreautorizo As String = dtOC(0)("UsuarioAutorizo").ToString - 'If EmpresaActual = 48 Then - ' nombreautorizo = "Lic. LUIS JORGE CONTRERAS LANDGRAVE" - 'End If Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta)) If Not Archivo.Exists OrElse EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 13, 72, 80, 83, 122, 126, 158) Then params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2))) diff --git a/App_Code/ClsSisNotificaciones.vb b/App_Code/ClsSisNotificaciones.vb index d4f4ec8be..91485aa7d 100644 --- a/App_Code/ClsSisNotificaciones.vb +++ b/App_Code/ClsSisNotificaciones.vb @@ -150,6 +150,14 @@ Public Class ClsSisNotificaciones #End Region #Region "N O T I F I C A C I O N E S" + Public Shared Sub EnviarAlerta(Titulo As String, Mensaje As String, CveUsuario As String, Optional Tipo As TipoNotificacion = TipoNotificacion.AlertaVentanaNoOcultar, Optional TimeOut As Integer = 0) + Dim hub = GlobalHost.ConnectionManager.GetHubContext(Of Notificaciones)() + 'VERIFICA SI EXISTE LA CONEXION DEL USUARIO + If Notificaciones.UsuariosConexiones.Keys.Any(Function(key) key = CveUsuario) Then + hub.Clients.Client(Notificaciones.UsuariosConexiones(CveUsuario)).alertaVentana(Titulo, Mensaje, DirectCast(Tipo, Integer), TimeOut) + End If + End Sub + Public Sub DispararNotificacion(CveNotificacion As Integer, CvesFiltro As List(Of Object), CveEmpresa As Integer) _CveNotificacion = CveNotificacion @@ -1814,7 +1822,7 @@ Public Class ClsSisNotificaciones 'Next Dim lista As New List(Of String) lista.Add(CveUsuario.ToString()) - Notificaciones.AlertaVentana(Mensaje, lista, Titulo, timeoutseconds) + 'Notificaciones.AlertaVentana(Mensaje, lista, Titulo, timeoutseconds) End Sub 'Public Sub SendNotificacionGPS(context As IHubContext, CveUsuario As Integer, JsonParams As String) ' context.Clients.All.DisparaNotificacionUsuario(CveUsuario,) diff --git a/App_Code/ClsSisProcesos.vb b/App_Code/ClsSisProcesos.vb index 9f877382a..f97454c9e 100644 --- a/App_Code/ClsSisProcesos.vb +++ b/App_Code/ClsSisProcesos.vb @@ -209,6 +209,25 @@ Public Class ClsSisProcesos Return OnError End Function + Public Function GetUsuariosconProceso(CveProceso As Integer, CveEmpresa As Integer) As Boolean + Dim OnError As Boolean = False + + DataAdapter("PA_Sis_UsuarioconProcesoGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProceso", SqlDbType.Int).Value = CveProceso + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + OnError = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener los usuarios con el Proceso.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return OnError + End Function + ' IDisposable Protected Overridable Sub Dispose(disposing As Boolean) If Not Me.disposedValue Then diff --git a/App_Code/ClsSisUsuarios.vb b/App_Code/ClsSisUsuarios.vb index be5aa595a..9c6f804b4 100644 --- a/App_Code/ClsSisUsuarios.vb +++ b/App_Code/ClsSisUsuarios.vb @@ -191,7 +191,7 @@ Public Class ClsSisUsuarios End Try Return Retorno End Function - Public Function ValidaUsuario(Usuario As String, Password As String, Optional CveEmpresa As Integer = -1, Optional GrupoEmpresa As String = "") As Usuario + Public Function ValidaUsuario(Usuario As String, Password As String, Optional CveEmpresa As Integer = -1, Optional GrupoEmpresa As String = "", Optional GenerarMenu As Boolean = True) As Usuario Dim Retorno As Usuario = Nothing DataAdapter("PA_Sis_UsuarioValidacionGet") With SqlAdapter.SelectCommand.Parameters @@ -253,7 +253,7 @@ Public Class ClsSisUsuarios 'cargo los modulos del usuario y genero el menú Dim dttmp As DataTable = GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveEmpresa) - GeneraMenu(Retorno.CveUsuario, dttmp, Retorno.CvePlataforma) + If GenerarMenu Then GeneraMenu(Retorno.CveUsuario, dttmp, Retorno.CvePlataforma) Dim UsuariosModulos As New HybridDictionary For Each Row As DataRow In dttmp.Rows @@ -481,7 +481,7 @@ Public Class ClsSisUsuarios Retorno.Portal = True Retorno.Referencia = Data.Rows(0)("Referencia").ToString Retorno.EsSupervisorRH = If(Data.Rows(0)("EsSupervisorRH").ToString = "1", True, False) - 'Retorno.Liga = Data.Rows(0)("Liga").ToString + Retorno.RutaDB = ConnStr 'cargo los modulos del usuario y genero el menú Dim dttmp As DataTable = GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveCliente) @@ -538,7 +538,7 @@ Public Class ClsSisUsuarios Retorno.Portal = True Retorno.Referencia = Data.Rows(0)("Referencia").ToString Retorno.EsSupervisorRH = If(Data.Rows(0)("EsSupervisorRH").ToString = "1", True, False) - 'Retorno.Liga = Data.Rows(0)("Liga").ToString + Retorno.RutaDB = ConnStr 'cargo los modulos del usuario y genero el menú Dim dttmp As DataTable = GetUsuariosRolesModulos(Retorno.CveUsuario, Retorno.CveProveedor) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 844dbb8db..6255262da 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -751,6 +751,22 @@ Public Class ClsVentas Return Retorno End Function + Public Function UpdateVentaAnticipoAutorizado(CveVenta As Integer, Autorizado As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentaAnticipoAutorizadoUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@Autorizado", SqlDbType.Bit).Value = Autorizado + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus del anticipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasFechaVencimientoUpdate") @@ -1961,14 +1977,14 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetRepPSEcono(CveSubProyecto As Integer, CvePS As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, Optional CveUsuarioConsulta As Integer = -1, Optional GPO As Integer = -1, + Public Function GetRepPSEcono(CveSubProyectos As String, CvePS As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, Optional CveUsuarioConsulta As Integer = -1, Optional GPO As Integer = -1, Optional CveMoneda As Integer = -1, Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional Clasificacion As String = "-1", Optional Linea As String = "-1", Optional Marca As String = "-1", Optional orden As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_RepPSEconoGet") With SqlAdapter.SelectCommand.Parameters - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveSubProyectos", SqlDbType.VarChar).Value = CveSubProyectos .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@FechaI", SqlDbType.Date).Value = FechaI .Add("@FechaF", SqlDbType.Date).Value = FechaF @@ -6916,6 +6932,83 @@ Public Class ClsVentas #End Region +#Region "VENTAS MEDICAS COMISIONES ESPECIALES" + + Public Function GetComisionesMedicasEsPeciales(CveMedico As Integer, CvePS As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ComisionesMedicasEspecialesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMedico", SqlDbType.Int).Value = CveMedico + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las comisiones especiales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + + End Function + + Public Function AddComisionesMedicasEspeciales(CveMedico As Integer, CvePS As Integer, TipoComision As Integer, Comision As Decimal, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ComisionesMedicasEspecialesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMedico", SqlDbType.Int).Value = CveMedico + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@TipoComision", SqlDbType.Int).Value = TipoComision + .Add("@Comision", SqlDbType.Money).Value = Comision + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + If ex.Message.Contains("2627") Then + Alert("Ya existe una comisión con el médico y producto especificados.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al agegar la comisión especial", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + + End Try + + Return Retorno + + End Function + + Public Function RemoveComisionesMedicasEspeciales(CveMedicoComision As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ComisionesMedicasEspecialesRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMedicoComision", SqlDbType.Int).Value = CveMedicoComision + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la comision especial.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + + End Function + +#End Region + #Region "DEVOLUICON" Public Function UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle As Integer, CantidadDevolucion As Decimal) As Boolean diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 776036e64..3634904b3 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -5606,7 +5606,7 @@ Namespace Modelos End If 'LA VALIDACION DE SALDOS CUANDO ES REFACTURACION SE HACE ANTES ASI QUE SI ES REFACTURACION IGNORAMOS ESTA CONDICION, SI ES ANTICIPO VERIFICA QUE NO ESTÉ APLICADO - If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") AndAlso ObjFactura.Pagado > 0 AndAlso DTDocumentosRelacionados.Rows.Count > 0 Then + If Not AplicaRefacturacionConPagos AndAlso Not AplicaCancelacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") AndAlso ObjFactura.Pagado > 0 AndAlso DTDocumentosRelacionados.Rows.Count > 0 Then Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados." Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia @@ -6446,7 +6446,7 @@ Namespace Modelos 'VERIFICA LOS MOVIMIENTOS DE DEVOLUCION YA GENERADOS QUE TENGAN EXISTENCIA EN (ENTREGA POR ADELANTADO) If Not ErrorCancelar Then If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then - DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen IN (10,4)") + DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen IN (10)") CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen IN (1,4)").ToEntero() 'SI ES SERVICIO A DOMICILIO DEBE REGRESAR A ESTE TIPO DE ALMACEN If Me.ServicioDomicilio Then @@ -6456,6 +6456,7 @@ Namespace Modelos CveAlmacenExA = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 10").ToEntero() If CveAlmacenExA <= 0 Then CveAlmacenExA = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 4").ToEntero() + DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen IN (4)") End If CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero() diff --git a/App_Code/Notificaciones.vb b/App_Code/Notificaciones.vb index ef5e9cd67..a0e44a996 100644 --- a/App_Code/Notificaciones.vb +++ b/App_Code/Notificaciones.vb @@ -1,55 +1,75 @@ -Option Strict Off -Imports Extensiones -Imports Microsoft.AspNet.SignalR - -Public Enum TipoNotificacion As Integer - - ToastInformacion = 5 'succes - ToastInformacionB = 6 'info - ToastError = 7 'error - ToastAdventencia = 8 'Warning - - AlertaVentana = 2 - AlertaVentanaNoOcultar = 1 -End Enum -Public Class Notificaciones - Inherits Hub - Public Overrides Function OnConnected() As System.Threading.Tasks.Task - Return MyBase.OnConnected() - End Function - - Public Overrides Function OnReconnected() As System.Threading.Tasks.Task - Return MyBase.OnReconnected() - End Function - Public Overrides Function OnDisconnected(stopCalled As Boolean) As Threading.Tasks.Task - Return MyBase.OnDisconnected(stopCalled) - End Function - - - - Public Shared Sub AlertaVentana(Message As String, Para As String, Optional Titulo As String = "", Optional timeoutseconds As Integer = 5, Optional Tipo As TipoNotificacion = TipoNotificacion.AlertaVentanaNoOcultar) - Dim lPara As New List(Of String) - lPara.Add(Para) - AlertaVentana(Message, lPara, Titulo, timeoutseconds, Tipo) - End Sub - Public Shared Sub AlertaVentana(Message As String, Para As List(Of String), Optional Titulo As String = "", Optional timeoutseconds As Integer = 5, Optional Tipo As TipoNotificacion = TipoNotificacion.AlertaVentanaNoOcultar) - If (Para IsNot Nothing) AndAlso Para.Count > 0 Then - Dim Clients As Hubs.IHubConnectionContext(Of Object) = GlobalHost.ConnectionManager.GetHubContext(Of Notificaciones)().Clients - Clients.Users(Para).AlertaVentana(Titulo, Message, DirectCast(Tipo, Integer), timeoutseconds) - End If - End Sub - - 'Public Shared Sub AlertaVentana(Message As String, Para As List(Of String), Optional Titulo As String = "", Optional timeoutseconds As Integer = 5, Optional Tipo As TipoNotificacion = TipoNotificacion.AlertaVentanaNoOcultar) - ' Dim Clients As Hubs.IHubConnectionContext(Of Object) = GlobalHost.ConnectionManager.GetHubContext(Of Notificaciones)().Clients - ' Clients.Users(Para).AlertaVentana(Titulo, Message, DirectCast(Tipo, Integer), timeoutseconds) - 'End Sub -End Class -Public Class MyhubUserIdProvider - Implements IUserIdProvider - - - Private Function IUserIdProvider_GetUserId(request As IRequest) As String Implements IUserIdProvider.GetUserId - Dim userId = Decripta(request.User.Identity.Name) 'MyCustomUserClass.FindUserId(request.User.Identity.Name) - Return userId.ToString() - End Function -End Class +Option Strict Off +Imports System.Collections.Concurrent +Imports Extensiones +Imports Microsoft.AspNet.SignalR + +Public Enum TipoNotificacion As Integer + + ToastInformacion = 5 'succes + ToastInformacionB = 6 'info + ToastError = 7 'error + ToastAdventencia = 8 'Warning + + AlertaVentana = 2 + AlertaVentanaNoOcultar = 1 +End Enum +Public Class Notificaciones + Inherits Hub + + Public Shared UsuariosConexiones As ConcurrentDictionary(Of String, String) = New ConcurrentDictionary(Of String, String) + + Public Overrides Function OnConnected() As System.Threading.Tasks.Task + NotificarConexion() + Return MyBase.OnConnected() + End Function + + Public Overrides Function OnReconnected() As System.Threading.Tasks.Task + NotificarConexion() + Return MyBase.OnReconnected() + End Function + Public Overrides Function OnDisconnected(stopCalled As Boolean) As Threading.Tasks.Task + Return MyBase.OnDisconnected(stopCalled) + End Function + + Public Sub NotificarConexion() + If Context.User.Identity.IsAuthenticated Then + Dim ConnectionId As String = Context.ConnectionId + Dim CveUsuario As String = Context.User.Identity.Name + If UsuariosConexiones.ContainsKey(CveUsuario) Then + If UsuariosConexiones(CveUsuario) <> Context.ConnectionId Then + UsuariosConexiones.TryUpdate(CveUsuario, Context.ConnectionId, UsuariosConexiones(CveUsuario)) + End If + Else + If CveUsuario.ToEntero > 0 Then + UsuariosConexiones.TryAdd(CveUsuario, ConnectionId) + End If + End If + End If + End Sub + + Public Sub TestMessage(message As String) + Clients.All.testMessage(message) + End Sub + + Public Sub AlertaVentana(Message As String, Para As String, Optional Titulo As String = "", Optional timeoutseconds As Integer = 5, Optional Tipo As TipoNotificacion = TipoNotificacion.AlertaVentanaNoOcultar) + Dim lPara As New List(Of String) + lPara.Add(Para) + AlertaVentana(Message, lPara, Titulo, timeoutseconds, Tipo) + End Sub + Public Sub AlertaVentana(Message As String, Para As List(Of String), Optional Titulo As String = "", Optional timeoutseconds As Integer = 5, Optional Tipo As TipoNotificacion = TipoNotificacion.AlertaVentanaNoOcultar) + If (Para IsNot Nothing) AndAlso Para.Count > 0 Then + Dim Clients As Hubs.IHubConnectionContext(Of Object) = GlobalHost.ConnectionManager.GetHubContext(Of Notificaciones)().Clients + Clients.Users(Para).AlertaVentana(Titulo, Message, DirectCast(Tipo, Integer), timeoutseconds) + End If + End Sub + +End Class +Public Class MyhubUserIdProvider + Implements IUserIdProvider + + + Private Function IUserIdProvider_GetUserId(request As IRequest) As String Implements IUserIdProvider.GetUserId + Dim userId = Decripta(request.User.Identity.Name) 'MyCustomUserClass.FindUserId(request.User.Identity.Name) + Return userId.ToString() + End Function +End Class diff --git a/Ashx/E119.ashx b/Ashx/E119.ashx index a14a437ef..9ec4f64ad 100644 --- a/Ashx/E119.ashx +++ b/Ashx/E119.ashx @@ -19,6 +19,7 @@ Public Class E119 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe Private ReadOnly Property CveEmpresa As Integer = 119 Private ReadOnly Property CveUsuario As Integer = 100 + Private ReadOnly Property NombreCadena As String = "Conexion" Public ReadOnly Property EsProduccion As Boolean Get @@ -52,12 +53,12 @@ Public Class E119 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe #Region "V A L I D A - D A T O S" Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario Dim UsuarioActual As Usuario = Nothing - Dim ObjUsuarios As New ClsSisUsuarios + Dim ObjUsuarios As New ClsSisUsuarios(NombreCadena:=NombreCadena) If ObjUsuarios.GetUsuarios(CveUsuario) Then If ObjUsuarios.DtResultados.Rows.Count > 0 Then Dim Usuario As String = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString() Dim Contrasenia As String = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString() - UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa) + UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa, GenerarMenu:=False) UsuarioActual.CveEmpresa = CveEmpresa HttpContext.Current.Session("UsuarioSIG") = UsuarioActual CreaObjetoEmpresa(UsuarioActual) diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 498665467..e606c32b5 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -930,19 +930,23 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim CveAlmacen = IfNull(context.Request("cvealmacen"), "-1").ToString.ToEntero Dim UsaGlobal As Boolean = True - Dim MostrarTodosAlmacenes As Boolean = False + Dim MostrarTodosAlmacenes As Boolean = True 'verifica existencias If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso usuario.Empresa.Funcionalidad(141) = "1" Then UsaGlobal = False + If usuario.CveEmpresa = 119 Then MostrarTodosAlmacenes = False + 'If (usuario.Empresa.Funcionalidad(558) = "1") AndAlso Pagina.Contiene("ventas/ventas") Then + ' MostrarTodosAlmacenes = True + 'End If - If (usuario.Empresa.Funcionalidad(558) = "1") AndAlso Pagina.Contiene("ventas/ventas") Then - MostrarTodosAlmacenes = True - End If + 'If (usuario.Empresa.Funcionalidad(578) = "1") AndAlso Pagina.Contiene("ventas/ventas") Then 'sms + ' MostrarTodosAlmacenes = True + 'End If - If (usuario.Empresa.Funcionalidad(578) = "1") AndAlso Pagina.Contiene("ventas/ventas") Then 'sms - MostrarTodosAlmacenes = True - End If + 'If (usuario.Empresa.CveEmpresa.Contiene(189, 193, 195, 197)) AndAlso Pagina.Contiene("ventas/ventas") Then 'sms + ' MostrarTodosAlmacenes = True + 'End If Dim objInv As New ClsInventarios Try diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index ec3f491a6..518ea5655 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -37,6 +37,9 @@ +
  • + Imprimir Poliza +
  • <%--
  • Imprimir
  • --%> @@ -151,10 +154,14 @@
    + + +
    - +
    @@ -172,16 +179,22 @@
    - +
    - - + + + + + + +
    diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index 9551eba19..2f1a1fdcd 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -38,6 +38,9 @@ Partial Class Bancos_DepositosCaja BtnConsultar.Attributes.Add("onclick", "Consultar(this);") BtnDepositar.Attributes.Add("onclick", "Depositar(this);") + Dim StrEncriptPrueba As String = Encripta($"OP=DC&CveIE={2784391}&CuentaCaja={"TestCuantaCaja"}&CuentaDepo={"Test cuenta"}") + HplImprimirPDF.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={StrEncriptPrueba}" + End If End Sub @@ -286,8 +289,13 @@ Partial Class Bancos_DepositosCaja End If End If + Dim CveTransaccionBanco As Integer = DdlTipoDeposito.SelectedValue.ToEntero + If CveTransaccionBanco = -1 Then + CveTransaccionBanco = 13 + End If + If TotalImporte < 0 Then 'que es una devolución, entonces como es negativo, se cambia el concetpo de bancos, por condición de trigger CveTransaccionBanco = 6 End If @@ -350,9 +358,9 @@ Partial Class Bancos_DepositosCaja If Not OcurrioError AndAlso ChkCuentaRetorno.Checked Then CveTransaccionBanco = 13 FolioIE = ObjBancos.GetNextFolio(DdlCajaChica.SelectedValue.ToEntero, CveTransaccionBanco) - CveIEOrigen = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, CveTransaccionBanco, Fecha, FolioIE.ToString, "Retorno Depósito Bancario", CuentaRetorno, CveMoneda, 1, TxtObservaciones.Text, "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim CveIEOrigenRetorno As Integer = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, CveTransaccionBanco, Fecha, FolioIE.ToString, "Retorno Depósito Bancario", CuentaRetorno, CveMoneda, 1, TxtObservaciones.Text, "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, CuentaRetorno, CuentaRetorno * TipoCambio, 30, "", "Retorno", CveClasificacion:=CveClasificacionDescuento, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen) Then + If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, CuentaRetorno, CuentaRetorno * TipoCambio, 30, "", "Retorno", CveClasificacion:=CveClasificacionDescuento, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigenRetorno) Then OcurrioError = True End If End If @@ -403,6 +411,8 @@ Partial Class Bancos_DepositosCaja documentos += String.Format("Imprimir {1}
    ", StrEncript, "Depósito Bancario") + + End If If Not OcurrioError AndAlso ObjConta.ValidacionesPrePoliza(NuevaCvePrePoliza, UsuarioActual, Opcion:=1) Then diff --git a/Bancos/IE.aspx b/Bancos/IE.aspx index 92e446f0c..840131979 100644 --- a/Bancos/IE.aspx +++ b/Bancos/IE.aspx @@ -27,7 +27,7 @@
  • - PrePoliza + Póliza
  • diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index b91ea0f79..14c0c445b 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -747,9 +747,7 @@ Partial Class Bancos_IE RBL.Items.Add(New ListItem("Acreedores Diversos", "AC")) End If - - - If TabCancelacion.Visible Then + If TabCancelacion.Visible Or TxtFolio.Text.Contains("_C") Then LnkCancelar.Visible = False End If @@ -775,11 +773,7 @@ Partial Class Bancos_IE ' LnkCancelarComplemento.Visible = False ' LnkCancelarComplementoImporte.Visible = False - - ' UppEliminarIE.Update() - - 'End If DdlMotivoCancelacion.DataSource = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltraParametros("CveSATMotivoCancelacion IN (2,3)") diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index 1e7945306..1f8fa17e7 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -67,7 +67,7 @@
    T.C.: - + diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index a1791b726..3c3ba9bb5 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -327,9 +327,21 @@ Partial Class Bancos_ProveedoresAbonar Private Sub CambiaTipoMoneda() If DivTC.Visible Then + TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4) - If ChkPagarDolares.Checked Then RegistraScript("CambiaPesosDolares();") - If ChkPagarPesos.Checked Then RegistraScript("CambiaDolaresPesos();") + + If ChkPagarDolares.Checked Then + 'RegistraScript("CambiaPesosDolares();") + RegistraScript("CambiaDolaresPesos();") + + End If + + If ChkPagarPesos.Checked Then + 'RegistraScript("CambiaDolaresPesos();") + RegistraScript("CambiaPesosDolares();") + + End If + End If UpDatos.Update() End Sub @@ -1343,6 +1355,7 @@ Partial Class Bancos_ProveedoresAbonar CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero) TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);") TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4) + TxtTC.Attributes.Add("onblur", "CambiaPesosDolares()") Else DivTC.Visible = False CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero) @@ -1362,6 +1375,7 @@ Partial Class Bancos_ProveedoresAbonar CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero) TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);") TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4) + TxtTC.Attributes.Add("onblur", "CambiaDolaresPesos()") Else 'DivDolaresDolares.Visible = False CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero) diff --git a/Bancos/RepCortes.aspx b/Bancos/RepCortes.aspx index 9f9830a38..65f77f716 100644 --- a/Bancos/RepCortes.aspx +++ b/Bancos/RepCortes.aspx @@ -364,7 +364,7 @@

    - Detalles del pago + Detalles de pago @@ -385,7 +385,7 @@

    - Depósitos Caja + Depósitos de caja
    @@ -406,7 +406,7 @@

    - Contabilidad + Estado contable de la caja
    diff --git a/Bancos/RepSaldosDetalle.aspx b/Bancos/RepSaldosDetalle.aspx index 9b1f0539e..6cf7d727c 100644 --- a/Bancos/RepSaldosDetalle.aspx +++ b/Bancos/RepSaldosDetalle.aspx @@ -55,11 +55,10 @@ - - - + + diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index ea1caef0c..c2c1cbf6d 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -5918,56 +5918,58 @@ } - function chkAnt(t, txt, importe, TotalSaldoCompra, CveMonedaAnticipo, TCAnticipo, CveMonedaOriginal, TCCompra, txtComision) { - var Total = ToDouble($get('TxtTotal').value); - debugger; - var txtvalue = ToDouble(txt.value); - var ImportePago, ImporteCompra; + function chkAnt(t, txt, importe, TotalSaldoCompra, CveMonedaAnticipo, TCAnticipo, CveMonedaOriginal, TCCompra, txtComision) { + var Total = ToDouble($get('TxtTotal').value); + debugger; + var txtvalue = ToDouble(txt.value); + var ImportePago, ImporteCompra; - var TCC = TCCompra / TCAnticipo; - var importevalue = ToDouble(importe); + var TCC = TCCompra / TCAnticipo; + var importevalue = ToDouble(importe); - if (CveMonedaAnticipo != CveMonedaOriginal) { - if (CveMonedaAnticipo == 1 && CveMonedaOriginal == 2) { - txtvalue = ToDouble(txtvalue / TCAnticipo); - importevalue = ToDouble(importevalue / TCAnticipo); - } else if (CveMonedaAnticipo == 2 && CveMonedaOriginal == 1) { - txtvalue = ToDouble(txtvalue * TCAnticipo); - importevalue = ToDouble(importevalue * TCAnticipo); + if (CveMonedaAnticipo != CveMonedaOriginal) { + if (CveMonedaAnticipo == 1 && CveMonedaOriginal == 2) { + txtvalue = ToDouble(txtvalue / TCAnticipo); + importevalue = ToDouble(importevalue / TCAnticipo); + } else if (CveMonedaAnticipo == 2 && CveMonedaOriginal == 1) { + txtvalue = ToDouble(txtvalue * TCAnticipo); + importevalue = ToDouble(importevalue * TCAnticipo); + } } - } - else { TCC = 1; } - var DifSaldo = (TotalSaldoCompra - FnSumaValoresAnt());//.toFixed(2); // le agrego lo del valor actual para validarlo + else { TCC = 1; } + var DifSaldo = (TotalSaldoCompra - FnSumaValoresAnt());//.toFixed(2); // le agrego lo del valor actual para validarlo - if (t.checked) - { - if (DifSaldo > importevalue) { - txt.value = toFixed(ToDouble(importevalue * TCC), 2); - } else { - txt.value = toFixed(ToDouble(DifSaldo * TCC), 2); + if (t.checked) + { + if (DifSaldo > importevalue) { + txt.value = toFixed(ToDouble(importevalue * TCC), 2); + } else { + txt.value = toFixed(ToDouble(DifSaldo * TCC), 2); + } + + + if (txtComision !== undefined && txtComision !== null) { + let difFinal = (DifSaldo - importevalue) * TCC; + if (difFinal > 0 && difFinal < 1) { + txtComision.value = toFixed(roundToTwo(difFinal), 2); + } + } + + + } else { + txt.value = ""; } - let difFinal = (DifSaldo - importevalue) * TCC; - - if (difFinal > 0 && difFinal < 1) { - txtComision.value = toFixed(roundToTwo(difFinal), 2); - } + $("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2)); + $("#LblAplicadoCompraAnt").text(FormatoNumero(FnSumaValoresAnt(), 2)); + $("#LblAplicadoCompraAntComision").text(FormatoNumero(FnSumaValoresAntComisiones(), 2)); + $("#LblSaldoFactura").text(FormatoNumero(TotalSaldoCompra - FnSumaValoresAnt(), 2)); - } else { - txt.value = ""; } - $("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2)); - $("#LblAplicadoCompraAnt").text(FormatoNumero(FnSumaValoresAnt(), 2)); - $("#LblAplicadoCompraAntComision").text(FormatoNumero(FnSumaValoresAntComisiones(), 2)); - $("#LblSaldoFactura").text(FormatoNumero(TotalSaldoCompra - FnSumaValoresAnt(), 2)); - - - } - function roundToTwo(num) { return Math.round(num * 100) / 100; } diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 8c7f444f1..2beb02694 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1790,7 +1790,7 @@ Partial Class Compras_Compras Private Function CargaFactura(CveFactura As Integer) As String Dim ObjeFacturas As New ClsCompras Dim RFC As String = "" - If ObjeFacturas.GetFacturas(CveFactura, "-1", NowADS().AddYears(-4), NowADS(), "-1", "-1", -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa) AndAlso ObjeFacturas.DtResultados.Rows.Count > 0 Then + If ObjeFacturas.GetFacturas(CveFactura, "-1", NowADS().AddYears(-6), NowADS(), "-1", "-1", -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa) AndAlso ObjeFacturas.DtResultados.Rows.Count > 0 Then Dim dr As DataRow = ObjeFacturas.DtResultados.Rows(0) ' no toma la cero, porque es el totalizador ViewState("CveTipoProveedor") = dr("CveTipoProveedor").ToString.ToEntero @@ -1875,407 +1875,407 @@ Partial Class Compras_Compras CreaDTConceptos() CargaComprobanteXML(XMLDoc) If NuevaValidacionXML = 1 OrElse (Version = "3.3" OrElse Version = "4.0") Then - Dim Xml As String - Dim nodo As XmlNode = XMLDoc.DocumentElement - Dim Version As String = ValorXML(nodo, "version") - Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) - Dim cfdVer As String = "" - Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) + Dim Xml As String + Dim nodo As XmlNode = XMLDoc.DocumentElement + Dim Version As String = ValorXML(nodo, "version") + Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) + Dim cfdVer As String = "" + Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) - If Version = "3.2" Then - Prefijo = "cfd" - cfdVer = "http://www.sat.gob.mx/cfd/2" - ElseIf Version = "3.3" Then - cfdVer = "http://www.sat.gob.mx/cfd/3" - Else ' se considera que es la version 4.0 - cfdVer = "http://www.sat.gob.mx/cfd/4" - End If - - 'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" - - namespaces.AddNamespace(Prefijo, cfdVer) - namespaces.AddNamespace("aerolineas", "http://www.sat.gob.mx/aerolineas") - namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") - namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") - namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal") - - Dim nodeconceptos As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Conceptos", Prefijo), namespaces) - Xml = Replace(nodeconceptos.OuterXml, "", "") 'salto de linea html - Xml = Xml.Replace("<br>", "") - Xml = Xml.Replace("<", "") - Xml = Xml.Replace("&", "") 'adicional, si hay otros - - If ObjeFacturas.GetFacturasComparacionXML(Version, Xml, UsuarioActual.CveEmpresa) Then - TmpDT = ObjeFacturas.DtResultados - TmpDT.Columns.Add("CveSATPSActualizado") - SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL - - If Not TmpDT.Columns.Contains("Amortizacion") Then - TmpDT.Columns.Add("Amortizacion", GetType(Decimal)) - End If - - AddPS2(False) - - 'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101 - Dim ProductosCodigoSATNoPermitidos As New StringBuilder("") - For Each drr As DataRow In TmpDT.FiltraParametros("ClaveProdServ = '01010101'").Rows - ProductosCodigoSATNoPermitidos.AppendFormat("{0}
    ", drr("PS")) - Next - - If TmpDT.MAX("RetISRPorcentaje").ToDecimal = 0.0125 Then RetISRResico = True - If TmpDT.MAX("RetIVAPorcentaje").ToDecimal = 0.04 Then RetIVAFlete = True - - If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then - Dim mensajeAdvertencia As String = String.Format("El XML que intenta registrar contiene partidas o artículos con código SAT ‘01010101’ el cual no es aceptado, hable con su proveedor para cancelar y/o refacturar un XML válido.
    Partidas o artículos con código ‘01010101’:

    {0}", ProductosCodigoSATNoPermitidos.ToString) - Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia) - If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso Not UsuarioActual.CveUsuario.Contiene(1719, 1721) Then BtnGuardar.Enabled = False '' solo se activa para el usuario Sara.JAM - BtnGuardar.ToolTip = "No se permite registrar facturas con conceptos con código '01010101'. Solicite al proveedor un nuevo comprobante." - End If - - End If - - - - Dim SbValRet As New StringBuilder - For Each concepto As XmlNode In nodeconceptos - ' Obtener la descripción del concepto - Dim descripcion As String = ValorXML(concepto, "Descripcion") - Dim importeValue As Decimal = Decimal.Parse(ValorXML(concepto, "Importe")) - - ' Seleccionar el nodo de Impuestos dentro de Concepto, si existe - Dim impuestosNode As XmlNode = concepto.SelectSingleNode("cfdi:Impuestos", namespaces) - - If Not impuestosNode Is Nothing Then - ' Seleccionar los nodos de Retencion dentro de Impuestos - Dim retenciones As XmlNodeList = impuestosNode.SelectNodes("cfdi:Retenciones/cfdi:Retencion", namespaces) - For Each retencion As XmlNode In retenciones - ' Obtener los valores de los atributos Base e Importe - Dim baseValue As Decimal = Decimal.Parse(ValorXML(retencion, "Base")) - Dim impuesto As String = ValorXML(retencion, "Impuesto") - - If impuesto = "001" Then - impuesto = "Retención ISR" - ElseIf impuesto = "002" Then - impuesto = "Retención IVA" - ElseIf impuesto = "003" Then - impuesto = "IEPS" - End If - - - ' Validar si Base coincide con Importe - If baseValue <> importeValue Then - 'SbValRet.Append($"La base e importe de la retención del impuesto {impuesto} no coinciden para {descripcion}. Base: {baseValue.ToString()}, Importe: {importeValue.ToString()}
    ") - SbValRet.Append($"Producto: {descripcion} La base e importe del impuesto {impuesto} no coincide Base: {baseValue.ToString()}, Importe Producto: {importeValue.ToString()}
    ") - End If - Next - End If - Next - - If SbValRet.ToString.Trim.Length > 0 Then - Alert(SbValRet.ToString, TipoMensaje.MsgAdvertencia) - End If - - - - Else - CargaConceptosXML(XMLDoc) + If Version = "3.2" Then + Prefijo = "cfd" + cfdVer = "http://www.sat.gob.mx/cfd/2" + ElseIf Version = "3.3" Then + cfdVer = "http://www.sat.gob.mx/cfd/3" + Else ' se considera que es la version 4.0 + cfdVer = "http://www.sat.gob.mx/cfd/4" End If - Select Case TipoComprobante - Case "ingreso" : DdlTipoComprobante.SelectedValue = "Fac" : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) - Case "egreso" : DdlTipoComprobante.SelectedValue = "NC" : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Fac")) : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) : ChkAplicaNotaCredito.Enabled = False - Case "I" - DdlTipoComprobante.SelectedValue = "Fac" - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) - DdlTipoCompra.Items.Remove(DdlTipoCompra.Items.FindByValue("6")) - DdlTipoCompra.Items.Remove(DdlTipoCompra.Items.FindByValue("11")) - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlTipoCompra.Items.Add(New ListItem("Recolección", "14")) - Case "E" - DdlTipoComprobante.SelectedValue = "NC" - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Fac")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) - ChkAplicaNotaCredito.Enabled = False + 'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" - DdlTipoCompra.Items.Clear() - DdlTipoCompra.Items.Add(New ListItem("Seleccione", "-1")) - DdlTipoCompra.Items.Add(New ListItem("NC Con Productos", "6")) - DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) - DdlTipoCompra.Items.Add(New ListItem("NC Por Devolución", "11")) - DdlTipoCompra.Items.Add(New ListItem("Garantía", "12")) - Case "T" - DdlTipoCompra.Items.Clear() - DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) - DdlTipoComprobante.SelectedValue = "Fac" - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) + namespaces.AddNamespace(Prefijo, cfdVer) + namespaces.AddNamespace("aerolineas", "http://www.sat.gob.mx/aerolineas") + namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") + namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") + namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal") - End Select + Dim nodeconceptos As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Conceptos", Prefijo), namespaces) + Xml = Replace(nodeconceptos.OuterXml, "", "") 'salto de linea html + Xml = Xml.Replace("<br>", "") + Xml = Xml.Replace("<", "") + Xml = Xml.Replace("&", "") 'adicional, si hay otros - 'DIV ALIAS - CargaPSAlias() - - RFC = dr("RFCDe").ToString - RFCProveedor = RFC - TxtFecha.Text = dr("FechaFactura").ToString.ToDate.ToShortDateString - TxtSerie.Text = dr("Serie").ToString - TxtFolio.Text = dr("Folio").ToString - DdlValidadaSAT.SelectedValue = If(dr("FueValidado").ToString.Contiene("Si", "1"), "Si", "No") - DdlValidadaSAT.Enabled = False - LblTipoFact.Text = dr("TipoFactura").ToString - SerieVieja = dr("Serie").ToString - LblMetodoPago.Text = MetodoPago - - Dim SubTotal2, IVA, IEPS As Decimal - IVA = TrasladoIVA - - If Not UsuarioActual.TienePermisoProceso(130) Then - TxtFolio.Enabled = False - TxtSerie.Enabled = False - End If - - 'PERMISO PARA MODIFICACIÓN DE FECHA AUN CON FACTURA - TxtFecha.Enabled = UsuarioActual.TienePermisoProceso(216) - ImgFecha.Enabled = UsuarioActual.TienePermisoProceso(216) - CEFecha.Enabled = UsuarioActual.TienePermisoProceso(216) - - TxtSubTotal.Enabled = False - TxtDescuento.Enabled = False - TxtSubTotal2.Enabled = False - TxtIVA.Enabled = False - TxtTotal.Enabled = False - DdlProveedor.Enabled = False - - If TxtFolio.Text.Trim = "" Then TxtFolio.Enabled = True : TxtSerie.Enabled = True - - If UsuarioActual.TienePermisoProceso(112) Then - PermisoEdicionManual = True - TxtSubTotal.Enabled = True - TxtDescuento.Enabled = True - TxtSubTotal2.Enabled = True - TxtIVA.Enabled = True - TxtTotal.Enabled = True - End If - - If UsuarioActual.Empresa.Funcionalidad(118) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Fac" Then - VerVales.Visible = True - End If - - If TieneAnticiposXML Then 'si tiene anticipos, limpia los descuentos - 'LblAmortizacion.Text = ImporteAnticipo.FormatoNumero - TxtDescuento.Text = "0.00" - LblAmortizacion.Text = Descuentos.FormatoNumero - 'limpia los descuentos - For Each drr As DataRow In TmpDT.Rows - 'drr("Total") = drr("Total").ToString.ToDecimal + drr("Descuento").ToString.ToDecimal - drr("Amortizacion") = drr("Descuento") 'pasamos el importe de descuento a amortizacion - drr("Descuento") = 0.00 - Next - Amortizaciones = Descuentos - Descuentos = 0 - End If - - Dim Msg As String = "" - If Version = "3.3" Or Version = "4.0" Then + If ObjeFacturas.GetFacturasComparacionXML(Version, Xml, UsuarioActual.CveEmpresa) Then + TmpDT = ObjeFacturas.DtResultados + TmpDT.Columns.Add("CveSATPSActualizado") + SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL If Not TmpDT.Columns.Contains("Amortizacion") Then TmpDT.Columns.Add("Amortizacion", GetType(Decimal)) End If - TmpDT.AcceptChanges() - ValidacionesTotalesXml() - Else - 'PRUEBA - 'http://rm/Compras/Compras.aspx?CveFactura=122518 Emp: 48 - 'tTotal = Math.Round(SubTotal2 + IVA - RetencionIVA - RetencionISR + IEPS + OtrosImpuestos, 2) - HdnCompraSaldo.Value = Total.ToString - CompraSaldo = Total - Dim AjustaUltimoConcepto As Boolean = False + AddPS2(False) - 'AGREGA IEPS COMO CONCEPTO - If TrasladoIEPS > 0 And UsuarioActual.Empresa.Funcionalidad(112).ToString.ToEntero > 0 Then - AgregarConceptoIEPS(TrasladoIEPS, UsuarioActual.Empresa.Funcionalidad(112).ToString.ToEntero) - ' TrasladoIEPS = 0 + 'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101 + Dim ProductosCodigoSATNoPermitidos As New StringBuilder("") + For Each drr As DataRow In TmpDT.FiltraParametros("ClaveProdServ = '01010101'").Rows + ProductosCodigoSATNoPermitidos.AppendFormat("{0}
    ", drr("PS")) + Next + + If TmpDT.MAX("RetISRPorcentaje").ToDecimal = 0.0125 Then RetISRResico = True + If TmpDT.MAX("RetIVAPorcentaje").ToDecimal = 0.04 Then RetIVAFlete = True + + If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then + Dim mensajeAdvertencia As String = String.Format("El XML que intenta registrar contiene partidas o artículos con código SAT ‘01010101’ el cual no es aceptado, hable con su proveedor para cancelar y/o refacturar un XML válido.
    Partidas o artículos con código ‘01010101’:

    {0}", ProductosCodigoSATNoPermitidos.ToString) + Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia) + If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso Not UsuarioActual.CveUsuario.Contiene(1719, 1721) Then BtnGuardar.Enabled = False '' solo se activa para el usuario Sara.JAM + BtnGuardar.ToolTip = "No se permite registrar facturas con conceptos con código '01010101'. Solicite al proveedor un nuevo comprobante." End If - 'en otro impuesto lo esta registrando en ajuste en automatico - If OtrosImpuestos > 0 Then - AjustaUltimoConcepto = True - End If - - If RFC = "CFE370814QI0" Then ' RFC de CFE, se hace un ajuste por diferencia para sacar el DAP - 'OtrosImpuestos = Total - (SubTotal2 + IVA) - 'este importe lo vamos a meter al gasto - 'AjustaImporteUltimoConcepto(OtrosImpuestos) - OtrosImpuestos = 1 - AjustaUltimoConcepto = True - 'SubTotal2 = SubTotal - End If - - Dim SubTotalReal As Decimal = 0 - SubTotalReal = Math.Round(Total + RetencionISR + RetencionIVA - IVA + Descuentos - TrasladoIEPS, 2) ' NO se incluye otros impuestos para ajustar esa cifra - Dim DiferenciaTotales As Decimal = SubTotalReal - Math.Round(SubTotalConceptos, 2) - - If DiferenciaTotales <> 0 Then - 'Verificamos IEPS y Otros Impuestos - 'restricccion general, que si el subtotal de los conceptos no cuadra con Total + RetISR + RetIVA - IVA <> SubTotalConeptos, ajuste al final - If TrasladoIEPS > 0 OrElse OtrosImpuestos > 0 OrElse Math.Abs(DiferenciaTotales) < 1 Then - - 'Condicion necesaria cuando hay IVA pero no hay diferencia - If DiferenciaTotales <> 0 Then - - If DiferenciaTotales < 50 OrElse AjustaUltimoConcepto = True Then - Dim IA As Decimal = Total + RetencionISR + RetencionIVA - IVA - SubTotalConceptos - TrasladoIEPS + Descuentos - AjustaImporteUltimoConcepto(IA, True) - - ElseIf DiferenciaTotales > 50 Then - PnlAjusteProductos.Visible = True - Dim Porcentaje As Double = Math.Round((SubTotalConceptos - SubTotalReal) / SubTotalConceptos * 100, 2) - TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero - Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
    ") - ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False - - 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias - For Each Row As GridViewRow In GvPS.Rows - Row.FCLinkButton("imgE").Visible = False - Row.FCLinkButton("imgD").Visible = False - Next - End If - End If - TrasladoIEPS = 0 : OtrosImpuestos = 0 : SubTotal2 = SubTotal - Else - PnlAjusteProductos.Visible = True - Dim Porcentaje As Double = If(SubTotalConceptos > 0, Math.Round((SubTotalConceptos - SubTotalReal) / SubTotalConceptos * 100, 2), 0) - TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero - Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
    ") - ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False - - 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias - For Each Row As GridViewRow In GvPS.Rows - Row.FCLinkButton("imgE").Visible = False - Row.FCLinkButton("imgD").Visible = False - Next - End If - End If - 'Si no hay diferencias pero tenemos descuento, se ofrece la opcion para ajustar el gasto - If Descuentos > 0 Then - - '[IPP] PARCHE: Factura TELMEX para APH 12/ENERO/2018 - If CveFactura = 286290 Then - - Else - PnlAjusteProductos.Visible = True - Dim Porcentaje As Double = Math.Round((Descuentos) / (SubTotalConceptos) * 100, 4) - TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero(4) - Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
    ") - ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False - - 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias - For Each Row As GridViewRow In GvPS.Rows - Row.FCLinkButton("imgE").Visible = False - Row.FCLinkButton("imgD").Visible = False - Next - End If - End If - - SubTotal2 = SubTotalReal - Descuentos - - If Descuentos > 0 Then - TrDescuento.Visible = True - End If - - If Msg <> "" Then - Alert(Msg, TipoMensaje.MsgAdvertencia) - BtnGuardar.Enabled = False - End If - 'AJUSTAMOS SUBTOTAL EN CASO DE SER DIFERENTE AL SUBTOTAL2 DEL XML (TOTAL - IVA) - If SubTotal2 <> SubTotal Then - SubTotal = SubTotalConceptos - End If - - TxtSubTotal.Text = SubTotal.FormatoNumero - TxtDescuento.Text = Descuentos.FormatoNumero - TxtSubTotal2.Text = SubTotal2.FormatoNumero - TxtIVA.Text = IVA.FormatoNumero - TxtTotal.Text = Total.ToString.FormatoNumero - - HfTotalCompra.Value = Total.ToString - CompraSaldo = Total - - CalculaTotalPorDevengar() - TxtDocumentoImporteFE.Text = Total.ToString - RVDocumentoImporte.MaximumValue = Math.Round(Total, 2).ToString - RVDocumentoImporteFE.MaximumValue = RVDocumentoImporte.MaximumValue - RVDocumentoImporteCaja.MaximumValue = RVDocumentoImporte.MaximumValue - TxtDocumentoImporte.Text = Total.FormatoNumero - TxtDocumentoImporteCaja.Text = Total.FormatoNumero - TxtRetIVA.Text = RetencionIVA.FormatoNumero - TxtRetISR.Text = RetencionISR.FormatoNumero - TxtIEPS.Text = IEPS.FormatoNumero - If IEPS > 0 Then TrIEPS.Visible = True - If RetencionIVA > 0 Then TrRetIVA.Visible = True - If RetencionISR > 0 Then TrRetISR.Visible = True - TxtOtrosImpuestos.Text = OtrosImpuestos.FormatoNumero - If OtrosImpuestos > 0 Then TrOtrosImpuestos.Visible = True - - HFDiferenciaCompra.Value = TxtTotal.Text - 'ASIGNA VALORES ORIGINALES PARA GUARDAR - AsignaValoresOriginales(SubTotal, SubTotal2, IVA, RetencionIVA, RetencionISR, Total) End If - TxtFechaPago.Text = (TxtFecha.Text.ToDate.AddDays(LblDiasCredito.Text.ToEntero)).ToShortDateString - Dim drMon As DataRow = GlobalDTMonedas.FiltroPrimero(String.Format(" (Abreviatura LIKE '%{0}%' OR Moneda LIKE '%{0}%' )", Moneda)) + + + Dim SbValRet As New StringBuilder + For Each concepto As XmlNode In nodeconceptos + ' Obtener la descripción del concepto + Dim descripcion As String = ValorXML(concepto, "Descripcion") + Dim importeValue As Decimal = Decimal.Parse(ValorXML(concepto, "Importe")) + + ' Seleccionar el nodo de Impuestos dentro de Concepto, si existe + Dim impuestosNode As XmlNode = concepto.SelectSingleNode("cfdi:Impuestos", namespaces) + + If Not impuestosNode Is Nothing Then + ' Seleccionar los nodos de Retencion dentro de Impuestos + Dim retenciones As XmlNodeList = impuestosNode.SelectNodes("cfdi:Retenciones/cfdi:Retencion", namespaces) + For Each retencion As XmlNode In retenciones + ' Obtener los valores de los atributos Base e Importe + Dim baseValue As Decimal = Decimal.Parse(ValorXML(retencion, "Base")) + Dim impuesto As String = ValorXML(retencion, "Impuesto") + + If impuesto = "001" Then + impuesto = "Retención ISR" + ElseIf impuesto = "002" Then + impuesto = "Retención IVA" + ElseIf impuesto = "003" Then + impuesto = "IEPS" + End If + + + ' Validar si Base coincide con Importe + If baseValue <> importeValue Then + 'SbValRet.Append($"La base e importe de la retención del impuesto {impuesto} no coinciden para {descripcion}. Base: {baseValue.ToString()}, Importe: {importeValue.ToString()}
    ") + SbValRet.Append($"Producto: {descripcion} La base e importe del impuesto {impuesto} no coincide Base: {baseValue.ToString()}, Importe Producto: {importeValue.ToString()}
    ") + End If + Next + End If + Next + + If SbValRet.ToString.Trim.Length > 0 Then + Alert(SbValRet.ToString, TipoMensaje.MsgAdvertencia) + End If + + + + Else + CargaConceptosXML(XMLDoc) + End If + + Select Case TipoComprobante + Case "ingreso" : DdlTipoComprobante.SelectedValue = "Fac" : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) + Case "egreso" : DdlTipoComprobante.SelectedValue = "NC" : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Fac")) : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) : ChkAplicaNotaCredito.Enabled = False + Case "I" + DdlTipoComprobante.SelectedValue = "Fac" + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) + DdlTipoCompra.Items.Remove(DdlTipoCompra.Items.FindByValue("6")) + DdlTipoCompra.Items.Remove(DdlTipoCompra.Items.FindByValue("11")) + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlTipoCompra.Items.Add(New ListItem("Recolección", "14")) + Case "E" + DdlTipoComprobante.SelectedValue = "NC" + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Fac")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + ChkAplicaNotaCredito.Enabled = False + + DdlTipoCompra.Items.Clear() + DdlTipoCompra.Items.Add(New ListItem("Seleccione", "-1")) + DdlTipoCompra.Items.Add(New ListItem("NC Con Productos", "6")) + DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) + DdlTipoCompra.Items.Add(New ListItem("NC Por Devolución", "11")) + DdlTipoCompra.Items.Add(New ListItem("Garantía", "12")) + Case "T" + DdlTipoCompra.Items.Clear() + DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) + DdlTipoComprobante.SelectedValue = "Fac" + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) + + End Select + + 'DIV ALIAS + CargaPSAlias() + + RFC = dr("RFCDe").ToString + RFCProveedor = RFC + TxtFecha.Text = dr("FechaFactura").ToString.ToDate.ToShortDateString + TxtSerie.Text = dr("Serie").ToString + TxtFolio.Text = dr("Folio").ToString + DdlValidadaSAT.SelectedValue = If(dr("FueValidado").ToString.Contiene("Si", "1"), "Si", "No") + DdlValidadaSAT.Enabled = False + LblTipoFact.Text = dr("TipoFactura").ToString + SerieVieja = dr("Serie").ToString + LblMetodoPago.Text = MetodoPago + + Dim SubTotal2, IVA, IEPS As Decimal + IVA = TrasladoIVA + + If Not UsuarioActual.TienePermisoProceso(130) Then + TxtFolio.Enabled = False + TxtSerie.Enabled = False + End If + + 'PERMISO PARA MODIFICACIÓN DE FECHA AUN CON FACTURA + TxtFecha.Enabled = UsuarioActual.TienePermisoProceso(216) + ImgFecha.Enabled = UsuarioActual.TienePermisoProceso(216) + CEFecha.Enabled = UsuarioActual.TienePermisoProceso(216) + + TxtSubTotal.Enabled = False + TxtDescuento.Enabled = False + TxtSubTotal2.Enabled = False + TxtIVA.Enabled = False + TxtTotal.Enabled = False + DdlProveedor.Enabled = False + + If TxtFolio.Text.Trim = "" Then TxtFolio.Enabled = True : TxtSerie.Enabled = True + + If UsuarioActual.TienePermisoProceso(112) Then + PermisoEdicionManual = True + TxtSubTotal.Enabled = True + TxtDescuento.Enabled = True + TxtSubTotal2.Enabled = True + TxtIVA.Enabled = True + TxtTotal.Enabled = True + End If + + If UsuarioActual.Empresa.Funcionalidad(118) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Fac" Then + VerVales.Visible = True + End If + + If TieneAnticiposXML Then 'si tiene anticipos, limpia los descuentos + 'LblAmortizacion.Text = ImporteAnticipo.FormatoNumero + TxtDescuento.Text = "0.00" + LblAmortizacion.Text = Descuentos.FormatoNumero + 'limpia los descuentos + For Each drr As DataRow In TmpDT.Rows + 'drr("Total") = drr("Total").ToString.ToDecimal + drr("Descuento").ToString.ToDecimal + drr("Amortizacion") = drr("Descuento") 'pasamos el importe de descuento a amortizacion + drr("Descuento") = 0.00 + Next + Amortizaciones = Descuentos + Descuentos = 0 + End If + + Dim Msg As String = "" + If Version = "3.3" Or Version = "4.0" Then + + If Not TmpDT.Columns.Contains("Amortizacion") Then + TmpDT.Columns.Add("Amortizacion", GetType(Decimal)) + End If + TmpDT.AcceptChanges() + ValidacionesTotalesXml() + Else + 'PRUEBA + 'http://rm/Compras/Compras.aspx?CveFactura=122518 Emp: 48 + + 'tTotal = Math.Round(SubTotal2 + IVA - RetencionIVA - RetencionISR + IEPS + OtrosImpuestos, 2) + HdnCompraSaldo.Value = Total.ToString + CompraSaldo = Total + Dim AjustaUltimoConcepto As Boolean = False + + 'AGREGA IEPS COMO CONCEPTO + If TrasladoIEPS > 0 And UsuarioActual.Empresa.Funcionalidad(112).ToString.ToEntero > 0 Then + AgregarConceptoIEPS(TrasladoIEPS, UsuarioActual.Empresa.Funcionalidad(112).ToString.ToEntero) + ' TrasladoIEPS = 0 + End If + 'en otro impuesto lo esta registrando en ajuste en automatico + If OtrosImpuestos > 0 Then + AjustaUltimoConcepto = True + End If + + If RFC = "CFE370814QI0" Then ' RFC de CFE, se hace un ajuste por diferencia para sacar el DAP + 'OtrosImpuestos = Total - (SubTotal2 + IVA) + 'este importe lo vamos a meter al gasto + 'AjustaImporteUltimoConcepto(OtrosImpuestos) + OtrosImpuestos = 1 + AjustaUltimoConcepto = True + 'SubTotal2 = SubTotal + End If + + Dim SubTotalReal As Decimal = 0 + SubTotalReal = Math.Round(Total + RetencionISR + RetencionIVA - IVA + Descuentos - TrasladoIEPS, 2) ' NO se incluye otros impuestos para ajustar esa cifra + Dim DiferenciaTotales As Decimal = SubTotalReal - Math.Round(SubTotalConceptos, 2) + + If DiferenciaTotales <> 0 Then + 'Verificamos IEPS y Otros Impuestos + 'restricccion general, que si el subtotal de los conceptos no cuadra con Total + RetISR + RetIVA - IVA <> SubTotalConeptos, ajuste al final + If TrasladoIEPS > 0 OrElse OtrosImpuestos > 0 OrElse Math.Abs(DiferenciaTotales) < 1 Then + + 'Condicion necesaria cuando hay IVA pero no hay diferencia + If DiferenciaTotales <> 0 Then + + If DiferenciaTotales < 50 OrElse AjustaUltimoConcepto = True Then + Dim IA As Decimal = Total + RetencionISR + RetencionIVA - IVA - SubTotalConceptos - TrasladoIEPS + Descuentos + AjustaImporteUltimoConcepto(IA, True) + + ElseIf DiferenciaTotales > 50 Then + PnlAjusteProductos.Visible = True + Dim Porcentaje As Double = Math.Round((SubTotalConceptos - SubTotalReal) / SubTotalConceptos * 100, 2) + TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero + Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
    ") + ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False + + 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias + For Each Row As GridViewRow In GvPS.Rows + Row.FCLinkButton("imgE").Visible = False + Row.FCLinkButton("imgD").Visible = False + Next + End If + End If + TrasladoIEPS = 0 : OtrosImpuestos = 0 : SubTotal2 = SubTotal + Else + PnlAjusteProductos.Visible = True + Dim Porcentaje As Double = If(SubTotalConceptos > 0, Math.Round((SubTotalConceptos - SubTotalReal) / SubTotalConceptos * 100, 2), 0) + TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero + Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
    ") + ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False + + 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias + For Each Row As GridViewRow In GvPS.Rows + Row.FCLinkButton("imgE").Visible = False + Row.FCLinkButton("imgD").Visible = False + Next + End If + End If + 'Si no hay diferencias pero tenemos descuento, se ofrece la opcion para ajustar el gasto + If Descuentos > 0 Then + + '[IPP] PARCHE: Factura TELMEX para APH 12/ENERO/2018 + If CveFactura = 286290 Then + + Else + PnlAjusteProductos.Visible = True + Dim Porcentaje As Double = Math.Round((Descuentos) / (SubTotalConceptos) * 100, 4) + TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero(4) + Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
    ") + ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False + + 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias + For Each Row As GridViewRow In GvPS.Rows + Row.FCLinkButton("imgE").Visible = False + Row.FCLinkButton("imgD").Visible = False + Next + End If + End If + + SubTotal2 = SubTotalReal - Descuentos + + If Descuentos > 0 Then + TrDescuento.Visible = True + End If + + If Msg <> "" Then + Alert(Msg, TipoMensaje.MsgAdvertencia) + BtnGuardar.Enabled = False + End If + 'AJUSTAMOS SUBTOTAL EN CASO DE SER DIFERENTE AL SUBTOTAL2 DEL XML (TOTAL - IVA) + If SubTotal2 <> SubTotal Then + SubTotal = SubTotalConceptos + End If + + TxtSubTotal.Text = SubTotal.FormatoNumero + TxtDescuento.Text = Descuentos.FormatoNumero + TxtSubTotal2.Text = SubTotal2.FormatoNumero + TxtIVA.Text = IVA.FormatoNumero + TxtTotal.Text = Total.ToString.FormatoNumero + + HfTotalCompra.Value = Total.ToString + CompraSaldo = Total + + CalculaTotalPorDevengar() + TxtDocumentoImporteFE.Text = Total.ToString + RVDocumentoImporte.MaximumValue = Math.Round(Total, 2).ToString + RVDocumentoImporteFE.MaximumValue = RVDocumentoImporte.MaximumValue + RVDocumentoImporteCaja.MaximumValue = RVDocumentoImporte.MaximumValue + TxtDocumentoImporte.Text = Total.FormatoNumero + TxtDocumentoImporteCaja.Text = Total.FormatoNumero + TxtRetIVA.Text = RetencionIVA.FormatoNumero + TxtRetISR.Text = RetencionISR.FormatoNumero + TxtIEPS.Text = IEPS.FormatoNumero + If IEPS > 0 Then TrIEPS.Visible = True + If RetencionIVA > 0 Then TrRetIVA.Visible = True + If RetencionISR > 0 Then TrRetISR.Visible = True + TxtOtrosImpuestos.Text = OtrosImpuestos.FormatoNumero + If OtrosImpuestos > 0 Then TrOtrosImpuestos.Visible = True + + HFDiferenciaCompra.Value = TxtTotal.Text + 'ASIGNA VALORES ORIGINALES PARA GUARDAR + AsignaValoresOriginales(SubTotal, SubTotal2, IVA, RetencionIVA, RetencionISR, Total) + + End If + TxtFechaPago.Text = (TxtFecha.Text.ToDate.AddDays(LblDiasCredito.Text.ToEntero)).ToShortDateString + + Dim drMon As DataRow = GlobalDTMonedas.FiltroPrimero(String.Format(" (Abreviatura LIKE '%{0}%' OR Moneda LIKE '%{0}%' )", Moneda)) + + If drMon IsNot Nothing Then + DdlMoneda.SelectedValue = drMon("CveMoneda").ToString + CveMoneda = drMon("CveMoneda").ToString.ToEntero + Else + 'sino busco en la tabla de alias + drMon = GlobalDTMonedasAlias.FiltroPrimero(String.Format("MonedaAlias LIKE '%{0}%' ", Moneda)) If drMon IsNot Nothing Then DdlMoneda.SelectedValue = drMon("CveMoneda").ToString CveMoneda = drMon("CveMoneda").ToString.ToEntero Else - 'sino busco en la tabla de alias - drMon = GlobalDTMonedasAlias.FiltroPrimero(String.Format("MonedaAlias LIKE '%{0}%' ", Moneda)) - - If drMon IsNot Nothing Then - DdlMoneda.SelectedValue = drMon("CveMoneda").ToString - CveMoneda = drMon("CveMoneda").ToString.ToEntero - Else - LblMoneda.Text = Moneda - LblMoneda.ForeColor = Drawing.Color.Red - End If - End If - - If DdlMoneda.SelectedValue.ToEntero > 1 Then - If TipoCambio <= 10 Then - TipoCambio = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal - End If - - TxtFecha.Attributes.Remove("onblur") - If UsuarioActual.Empresa.UsaAC Then - TxtFecha.Attributes.Add("onblur", "CambiaFecha();CambiaFechaTC();") - Else - TxtFecha.Attributes.Add("onblur", "CambiaFechaTC();") - End If - End If - - If TipoCambio > 0 And DdlMoneda.SelectedValue.ToEntero > 1 Then LblTC.Text = String.Format("TC: {0}", TipoCambio.ToString("N4")) - - 'DF - 10-04-17 - If UsuarioActual.TienePermisoProceso(187) Then - TxtSerie.Enabled = True - End If - - If LblMetodoPago.Text = "" AndAlso TipoComprobante <> "T" Then - Alert("El xml no contiene la etiqueta 'método de pago', favor de verificar la emisión con el proveedor.", TipoMensaje.MsgAdvertencia) - BtnGuardar.Visible = False + LblMoneda.Text = Moneda + LblMoneda.ForeColor = Drawing.Color.Red End If End If - Else + + If DdlMoneda.SelectedValue.ToEntero > 1 Then + If TipoCambio <= 10 Then + TipoCambio = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal + End If + + TxtFecha.Attributes.Remove("onblur") + If UsuarioActual.Empresa.UsaAC Then + TxtFecha.Attributes.Add("onblur", "CambiaFecha();CambiaFechaTC();") + Else + TxtFecha.Attributes.Add("onblur", "CambiaFechaTC();") + End If + End If + + If TipoCambio > 0 And DdlMoneda.SelectedValue.ToEntero > 1 Then LblTC.Text = String.Format("TC: {0}", TipoCambio.ToString("N4")) + + 'DF - 10-04-17 + If UsuarioActual.TienePermisoProceso(187) Then + TxtSerie.Enabled = True + End If + + If LblMetodoPago.Text = "" AndAlso TipoComprobante <> "T" Then + Alert("El xml no contiene la etiqueta 'método de pago', favor de verificar la emisión con el proveedor.", TipoMensaje.MsgAdvertencia) + BtnGuardar.Visible = False + End If + End If + Else Alert("No se Encontró la Factura", TipoMensaje.MsgAdvertencia) BtnGuardar.Visible = False End If @@ -3549,105 +3549,129 @@ Partial Class Compras_Compras ViewState("CveProveedor") = ObjProveedor.CveProveedor HdnCveProveedor.Value = ObjProveedor.CveProveedor.ToString TxtFechaPago.Text = (TxtFecha.Text.ToDate.AddDays(LblDiasCredito.Text.ToEntero)).ToShortDateString - RFCProveedor = ObjProveedor.RFC + 'comentado RMF.2024.05.21. en anticipos parciales, está bloquenado + 'If MetodoPagoOC = 0 AndAlso RBLPago.SelectedValue.ToEntero <> 2 Then - CveRegimenFiscalProveedor = ObjProveedor.CveRegimenFiscal - If CveFactura > 0 Then + ' Dim ImporteAnticipoComision As Decimal = 0 + ' If ArrAnticipos.Count > 0 Then + ' For Each Ant As Compras_Compras.Anticipos In ArrAnticipos + ' ImporteAnticipoComision += Ant.ImporteComision + ' Next + ' End If - If RetIVAOriginal > 0 Then - Dim CalRetIVAPor As Decimal = (RetIVAOriginal * 1 / SubTotal2Original).RoundAD(6).ToDecimal - - If (CalRetIVAPor).RoundSQL(5) = 0.10666 OrElse (CalRetIVAPor).RoundSQL(5) = 0.05333 Then - DdlRetIVAConcepto.SelectedValueExist("1") '10.66 servicios profesionales - End If - If RetIVAFlete Then '4 Fletes - If RFCProveedor.Length = 13 Then - DdlRetIVAConcepto.SelectedValueExist("2") - Else - DdlRetIVAConcepto.SelectedValueExist("3") - End If - End If - End If - - If RetISROriginal > 0 Then - Dim CalRetISRPor As Decimal = (RetISROriginal * 1 / SubTotal2Original).RoundAD(5).ToDecimal - - If (CalRetISRPor).RoundSQL(1) = 0.1 Then '10 Servicios profesionales - DdlRetISRConcepto.SelectedValueExist("1") - End If - 'permitido en un margen de 1% a 2% - If RetISRResico OrElse (CalRetISRPor >= 0.01 AndAlso CalRetISRPor <= 0.02) Then '1.25 Recico regimen simplificado confianza - DdlRetISRConcepto.SelectedValueExist("3") - RetISRResico = True - End If - End If - End If - - CargaRetIVAConcepto(True, ObjProveedor.DIOTCveTipoOperacion) - CargaRetISRConcepto(True, ObjProveedor.DIOTCveTipoOperacion) - - LbAgregar.Enabled = True - UpPSS.Update() - UpPS.Update() - UpParametros.Update() - UPCondicionesPago.Update() - 'si tiene el habiltiado el módulo de Contratos - 'checo si tiene estimaciones - - 'CargaDatosEstimaciones(ObjProveedor.CveProveedor) - ImgBtnBuscarOC.OnClientClick = String.Format("AbrirVentana('/OC/PopUpBuscarReq.aspx?V=VOCCOMP&P={0}&T={1}&Masterimpoup=true',1000,600,'S'); return false;", ObjProveedor.CveProveedor, DdlTipoComprobante.SelectedValue) - CargaAnticipos(ObjProveedor.CveProveedor) : UpAnticipos.Update() - - 'If UsuarioActual.Empresa.UsaAC Then - ' If (TxtRetIVA.Text.ToDouble > 0) Or (TxtRetISR.Text.ToDouble > 0) Then ' - ' ImgBtnBuscarOC.Visible = False - ' TxtOC.Enabled = False - ' BtnGuardar.Visible = False - ' Alert("El proveedor no tiene registrada cuentas contables de retenciones. Debe asignar las cuentas en el registro del proveedor.", TipoMensaje.MsgAdvertencia) - ' DivRestriccionAdvertencia.Visible = True - ' LtRestriccionAdvertencia.Text = "El proveedor no tiene registrada cuentas contables de retenciones." + ' If (LblSaldoFactura.Text.ToDecimal - ImporteAnticipoComision) > 0 Then + ' Alert("La orden de compra se definió de contado, favor de especificar la compra de contado.", TipoMensaje.MsgAdvertencia) + ' Exit Sub ' End If 'End If - If CveProveedor > 0 Then + If RetIVAOriginal > 0 Then + Dim CalRetIVAPor As Decimal = (RetIVAOriginal * 1 / SubTotal2Original).RoundAD(6).ToDecimal - Dim ObjSAT As New ClsSAT - Dim RFCRequest As String = ObjProveedor.RFC - If ObjSAT.GetListado69B(2, UsuarioActual.CveEmpresa, RFCRequest) Then - If ObjSAT.DtResultados.Rows.Count > 0 Then - Dim Estatus As String = ObjSAT.DtResultados.Rows(0)("Situacion").ToString - BtnGuardar.Enabled = False - UpParametros.Update() - - Alert($"El RFC del proveedor se encuentra en estado {Estatus} en el Listado EFOS (69B) del SAT", TipoMensaje.MsgAdvertencia) - System.Threading.Thread.Sleep(5) + If (CalRetIVAPor).RoundSQL(5) = 0.10666 OrElse (CalRetIVAPor).RoundSQL(5) = 0.05333 Then + DdlRetIVAConcepto.SelectedValueExist("1") '10.66 servicios profesionales + End If + If RetIVAFlete Then '4 Fletes + If RFCProveedor.Length = 13 Then + DdlRetIVAConcepto.SelectedValueExist("2") + Else + DdlRetIVAConcepto.SelectedValueExist("3") End If End If - ObjSAT.Dispose() - End If - If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then - PorcentajeProntoPago = ObjProveedor.PorcentajeProntoPago - End If + If RetISROriginal > 0 Then + Dim CalRetISRPor As Decimal = (RetISROriginal * 1 / SubTotal2Original).RoundAD(5).ToDecimal - Else - Alert("El Proveedor solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) + If (CalRetISRPor).RoundSQL(1) = 0.1 Then '10 Servicios profesionales + DdlRetISRConcepto.SelectedValueExist("1") + End If + 'permitido en un margen de 1% a 2% + If RetISRResico OrElse (CalRetISRPor >= 0.01 AndAlso CalRetISRPor <= 0.02) Then '1.25 Recico regimen simplificado confianza + DdlRetISRConcepto.SelectedValueExist("3") + RetISRResico = True + End If + End If End If + +<<<<<<< HEAD + CargaRetIVAConcepto(True, ObjProveedor.DIOTCveTipoOperacion) + CargaRetISRConcepto(True, ObjProveedor.DIOTCveTipoOperacion) + + CargaRetIVAConcepto(True, ObjProveedor.DIOTCveTipoOperacion) + CargaRetISRConcepto(True, ObjProveedor.DIOTCveTipoOperacion) +>>>>>>> GDiaz 2024.05.21 + + LbAgregar.Enabled = True + UpPSS.Update() + UpPS.Update() + UpParametros.Update() + UPCondicionesPago.Update() + 'si tiene el habiltiado el módulo de Contratos + 'checo si tiene estimaciones + + 'CargaDatosEstimaciones(ObjProveedor.CveProveedor) + ImgBtnBuscarOC.OnClientClick = String.Format("AbrirVentana('/OC/PopUpBuscarReq.aspx?V=VOCCOMP&P={0}&T={1}&Masterimpoup=true',1000,600,'S'); return false;", ObjProveedor.CveProveedor, DdlTipoComprobante.SelectedValue) + CargaAnticipos(ObjProveedor.CveProveedor) : UpAnticipos.Update() + + 'If UsuarioActual.Empresa.UsaAC Then + ' If (TxtRetIVA.Text.ToDouble > 0) Or (TxtRetISR.Text.ToDouble > 0) Then ' + ' ImgBtnBuscarOC.Visible = False + ' TxtOC.Enabled = False + ' BtnGuardar.Visible = False + ' Alert("El proveedor no tiene registrada cuentas contables de retenciones. Debe asignar las cuentas en el registro del proveedor.", TipoMensaje.MsgAdvertencia) + ' DivRestriccionAdvertencia.Visible = True + ' LtRestriccionAdvertencia.Text = "El proveedor no tiene registrada cuentas contables de retenciones." + ' End If + 'End If + + If CveProveedor > 0 Then + + Dim ObjSAT As New ClsSAT + Dim RFCRequest As String = ObjProveedor.RFC + If ObjSAT.GetListado69B(2, UsuarioActual.CveEmpresa, RFCRequest) Then + If ObjSAT.DtResultados.Rows.Count > 0 Then + Dim Estatus As String = ObjSAT.DtResultados.Rows(0)("Situacion").ToString + BtnGuardar.Enabled = False + UpParametros.Update() + + Alert($"El RFC del proveedor se encuentra en estado {Estatus} en el Listado EFOS (69B) del SAT", TipoMensaje.MsgAdvertencia) + System.Threading.Thread.Sleep(5) + End If + End If + ObjSAT.Dispose() + + End If + + If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then + PorcentajeProntoPago = ObjProveedor.PorcentajeProntoPago + End If + +<<<<<<< HEAD +======= + + +>>>>>>> GDiaz 2024.05.21 Else - Alert("Ocurrió un error al consultar el proveedor.", TipoMensaje.MsgError) + Alert("El Proveedor solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) End If + + + +<<<<<<< HEAD +======= +>>>>>>> GDiaz 2024.05.21 If UsuarioActual.Empresa.Funcionalidad(560) = "1" Then - If ObjProveedor.GetProveedoresEvaluacionPediente(Me.CveProveedor, UsuarioActual.CveEmpresa) Then - If ObjProveedor.DtResultados.Rows.Count > 0 Then - Me.RequiereEvaluacion = ObjProveedor.DtResultados.Rows(0)("RequiereEvaluacion").ToString() = "1" - Me.CveUsuarioEvaluador = ObjProveedor.DtResultados.Rows(0)("CveUsuarioEvaluador").ToString().ToEntero() + If ObjProveedor.GetProveedoresEvaluacionPediente(Me.CveProveedor, UsuarioActual.CveEmpresa) Then + If ObjProveedor.DtResultados.Rows.Count > 0 Then + Me.RequiereEvaluacion = ObjProveedor.DtResultados.Rows(0)("RequiereEvaluacion").ToString() = "1" + Me.CveUsuarioEvaluador = ObjProveedor.DtResultados.Rows(0)("CveUsuarioEvaluador").ToString().ToEntero() + End If + End If End If - End If - End If - ObjProveedor.Dispose() + ObjProveedor.Dispose() End Sub Private Sub CargaAnticipos(CveProveedor As Integer, Optional FiltroTipo As String = "-1") @@ -4193,24 +4217,9 @@ Partial Class Compras_Compras '------------------ INICIA VALIDACIONES ------------------ - - - - If MetodoPagoOC = 0 AndAlso RBLPago.SelectedValue.ToEntero <> 2 Then - - Dim ImporteAnticipoComision As Decimal = 0 - If ArrAnticipos.Count > 0 Then - For Each Ant As Compras_Compras.Anticipos In ArrAnticipos - ImporteAnticipoComision += Ant.ImporteComision - Next - End If - - If (LblSaldoFactura.Text.ToDecimal - ImporteAnticipoComision) > 0 Then - Alert("La orden de compra se definió de contado, favor de especificar la compra de contado.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - + If MetodoPagoOC = 0 AndAlso RBLPago.SelectedValue.ToEntero <> 2 AndAlso LblSaldoFactura.Text.ToDecimal > 0 Then + Alert("La orden de compra se definió de contado, favor de especificar la compra de contado.", TipoMensaje.MsgAdvertencia) + Exit Sub End If Dim CveSubProyectoPrincipal As Integer = AsignarSubProyectoPrincipal() @@ -9780,7 +9789,13 @@ Partial Class Compras_Compras Dim tTCFecha As Double = If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble) - e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2},{3},{4},{5},{6},{7});", + + + + + If UsuarioActual.Empresa.CveEmpresa.Contiene(13, 83) Then + + e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2},{3},{4},{5},{6},{7});", e.Row.FCTextBox("TxtAnticipo").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, CompraSaldo, ImporteAmortizacion), @@ -9793,8 +9808,6 @@ Partial Class Compras_Compras - If UsuarioActual.Empresa.CveEmpresa.Contiene(13, 83) Then - e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2},{3},{4},{5},{6});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), @@ -9813,6 +9826,17 @@ Partial Class Compras_Compras DdlMoneda.SelectedValue.ToEntero, e.Row.FCTextBox("TxtAnticipo").ClientID)) Else + + e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2},{3},{4},{5},{6});", + e.Row.FCTextBox("TxtAnticipo").ClientID, + e.Row.DBCampo("Saldo"), + If(CveCompra > 0, CompraSaldo, ImporteAmortizacion), + e.Row.DBCampo("CveMoneda"), + e.Row.DBCampo("TCCompra").ToDouble, + DdlMoneda.SelectedValue, + IIf(DdlMoneda.SelectedValue = "1", 1, TxtTC.Text) + )) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO + e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2},{3},{4},{5});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), @@ -13118,11 +13142,15 @@ Partial Class Compras_Compras Dim objcompras As New ClsCompras() If objcompras.GetCompraParaDevolucion(CveProveedor, UsuarioActual.CveEmpresa, SubTotal) Then DDLDevolucion.Items.Clear() - DDLDevolucion.DataSource = objcompras.DtResultados - DDLDevolucion.DataBind() + Dim dtt As DataTable = objcompras.DtResultados + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then 'solo los últimos 3 meses + dtt = dtt.FiltraParametros($"Fecha >= #{NowADS.AddMonths(-3).ToString("yyyy/MM/dd")}#") + End If + DDLDevolucion.DataSource = dtt DDLDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) End If objcompras.Dispose() + DDLDevolucion.DataBind() UPDevolucion.Update() End Sub @@ -13135,9 +13163,9 @@ Partial Class Compras_Compras Dim objcompras As New ClsCompras() If objcompras.GetCompraDetalleAlmacen(UsuarioActual.CveEmpresa, DDLDevolucion.SelectedValue.ToEntero) Then GVDevolucion.DataSource = objcompras.DtResultados - GVDevolucion.DataBind() End If objcompras.Dispose() + GVDevolucion.DataBind() Dim CveAlmacen As Integer = -1 For Each GvRow As GridViewRow In GVDevolucion.Rows If GvRow.RowType = DataControlRowType.DataRow Then @@ -20700,8 +20728,6 @@ Partial Class Compras_Compras Return True End If - - If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then Dim ObjCon As New ClsContratos @@ -20709,7 +20735,7 @@ Partial Class Compras_Compras Dim Autorizado As Double = 0 Dim Ejercido As Double = 0 - If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, 1) Then + If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, TxtFecha.Text.ToDate.FirstDayOfMonth, TxtFecha.Text.ToDate.LastDayOfMonth, 1) Then Dim FechaCompra As Date = TxtFecha.Text.ToDate @@ -20718,27 +20744,8 @@ Partial Class Compras_Compras FechaCompra <= row.Field(Of Date)("FechaFin") Select row - - - - - 'Dim dataTable As New DataTable - 'Dim rowFilter As String = "" - 'Dim orderby As String = "" - 'Dim groupByColumns As String()() = {New String() {"SubProyecto", "CveSubProyecto", "Clasificacion", "CveClasificacion", "TipoGasto", "CveTipoGasto"}} - 'Dim sumColumns As String() = {"Total"} - - - 'Dim resultDataTable As DataTable = GroupByDT(TmpDT, rowFilter, orderby, groupByColumns, sumColumns) - - - - - If resultadosFiltrados.Count > 0 Then - - ''.TotalSum = Group.Sum(Function(r) r.Field(Of Decimal)("Total")) If Opcion = 1 Then @@ -20771,29 +20778,8 @@ Partial Class Compras_Compras Else respuesta = True End If - - Else - 'Dim EnumAgrupado = (From row In TmpDT.AsEnumerable() - ' Group row By - ' SubProyecto = row.Field(Of String)("SubProyecto"), - ' CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"), - ' Clasificacion = row.Field(Of String)("Clasificacion"), - ' CveClasificacion = row.Field(Of Integer)("CveClasificacion"), - ' TipoGasto = row.Field(Of String)("TipoGasto"), - ' CveTipoGasto = row.Field(Of Integer)("CveTipoGasto") - ' Into Group - ' Select New With { - ' .SubProyecto = SubProyecto, - ' .CveSubProyecto = CveSubProyecto, - ' .Clasificacion = Clasificacion, - ' .CveClasificacion = CveClasificacion, - ' .CveTipoGasto = CveTipoGasto, - ' .TipoGasto = TipoGasto, - ' .TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total")))) - ' }).ToList() - Dim EnumAgrupado = ( From row In TmpDT.AsEnumerable() Group row By @@ -20815,22 +20801,15 @@ Partial Class Compras_Compras } ).ToList() - For Each item In EnumAgrupado - Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = item.CveSubProyecto) If tieneRegistrosConCveSubProyecto Then - 'Dim saldoTotal As Decimal = (From row In resultadosFiltrados - ' Where row.Field(Of Integer)("CveSubProyecto") = item.CveSubProyecto AndAlso - ' row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion - ' Select row.Field(Of Decimal)("Saldo")).Sum() Dim saldoTotal As Decimal = (From row In resultadosFiltrados.AsEnumerable() Where row.Field(Of Integer)("CveSubProyecto") = item.CveSubProyecto AndAlso - If(row.IsNull("CveClasificacion"), - 0, + If(row.IsNull("CveClasificacion"), 0, row.Field(Of Integer?)("CveClasificacion").GetValueOrDefault()) = item.CveClasificacion Select row.Field(Of Decimal)("Saldo")).Sum() @@ -20857,29 +20836,18 @@ Partial Class Compras_Compras Next End If - - - Else 'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia) respuesta = True End If - - Else 'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia) respuesta = False End If - ObjCon.Dispose() - - - Else respuesta = True End If - - Return respuesta End Function diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 4ba4d6a1c..ebeb39d24 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1610,7 +1610,9 @@ Partial Class PopUpVerFactura If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then DtMetodosPago = DtCortesVentasResumen.FiltraParametros("MetodoPago <> 'Crédito'") End If + Dim DirFormato As String = "Empresas/Grales/Formatos/RepCortes.rdlc" + If File.Exists(UsuarioActual.Empresa.Ruta + "\Formatos\RepCortes.rdlc") Then DirFormato = UsuarioActual.Empresa.Ruta + "\Formatos\RepCortes.rdlc" End If @@ -3378,7 +3380,7 @@ Partial Class PopUpVerFactura If UsuarioActual.CveEmpresa.Contiene(172, 173) Then ImprimirPDFStimul("Empresas/Grales/Formatos/EntradaSalida.mrt", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString)) Else - ImprimirPDF("Empresas/Grales/Formatos/EntradaSalida.rdlc", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString), RDSName:="DsInventarios") + ImprimirPDF("Empresas/Grales/Formatos/Salida.rdlc", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString), RDSName:="DsInventarios") End If End If @@ -5380,6 +5382,15 @@ Partial Class PopUpVerFactura If ObjIE.GetBancosIEMovimientosDepositos(CveIE, UsuarioActual.CveEmpresa) Then Tabla = ObjIE.DtResultados.Copy() End If + + Dim TipoTransaccion As String = "" + Dim Observaciones As String = "" + + If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then + TipoTransaccion = ObjIE.TipoTransaccion + Observaciones = ObjIE.Observaciones + End If + ObjIE.Dispose() If Tabla IsNot Nothing AndAlso Tabla.Rows.Count > 0 Then @@ -5390,6 +5401,8 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("CuentaCaja", CuentaCaja)) params.Add(New ReportParameter("CuentaDeposito", CuentaDeposito)) params.Add(New ReportParameter("TipoPago", TipoPago)) + params.Add(New ReportParameter("TipoTransaccion", TipoTransaccion)) + params.Add(New ReportParameter("Observaciones", Observaciones)) If Archivo.Exists Then params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) @@ -5753,14 +5766,14 @@ Partial Class PopUpVerFactura If ObjIE.DtResultados.Rows.Count > 0 Then Dim reportDataSetsList As New List(Of ReportDataSource) - Dim CvePrePoliza As Integer = 0 + Dim CvePrePoliza As Integer = ObjIE.DtResultados.Rows(0)("CvePrePoliza").ToString.ToEntero Dim dtMovs As New DataTable If ObjIE.GetBancosIEFacturasPagadas(CveIE, UsuarioActual.CveEmpresa) Then dtMovs = ObjIE.DtResultados.FiltraParametros("CveConceptoContable IN (17,2,308,309,312,292 )") If dtMovs IsNot Nothing AndAlso dtMovs.Rows.Count > 0 Then - CvePrePoliza = dtMovs.Rows(0)("CVePrePoliza").ToString.ToEntero + 'CvePrePoliza = dtMovs.Rows(0)("CvePrePoliza").ToString.ToEntero If Not UsuarioActual.CveEmpresa.Contiene(13, 83) Then 'CONVIERTO A PESOS CUANDO SE PAGA CON PESOS FACTURAS DE DOLARES @@ -5805,7 +5818,7 @@ Partial Class PopUpVerFactura End With dtMovs.Dispose() - If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 And CvePrePoliza > 0 Then + If UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197) And CvePrePoliza > 0 Then Dim ObjContabilidad As New ClsContabilidad diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx index 23a848b8a..4ee25ee9e 100644 --- a/Contabilidad/RegPrePolizaS.aspx +++ b/Contabilidad/RegPrePolizaS.aspx @@ -155,7 +155,7 @@
    - + @@ -187,8 +187,8 @@
    - - + +
    @@ -288,7 +288,7 @@
    -
    +
    @@ -310,6 +310,7 @@
    +
    Concepto - + <%----%> + @@ -621,9 +623,7 @@
    - - - +
    @@ -646,6 +646,9 @@
    +
    + +
    @@ -1200,9 +1203,17 @@ } + + function valorIE() { } + + function asignaConcepto() { + let valor = $('#TxtConcepto').val(); + $('input[type="text"].selTxtConcepto').val(valor); + } + diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index 8fa667a29..ab4a57400 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1,4 +1,7 @@ Imports System.Data +Imports System.Runtime.CompilerServices +Imports System.Runtime.Remoting + 'Imports DocumentFormat.OpenXml Imports Extensiones Imports GemBox.Spreadsheet @@ -321,7 +324,7 @@ Partial Class ContabilidadC_RegPrePolizaS TxtFechaDocumento.Text = NowADS().ToString("dd/MM/yyyy") TxtFechaelaboracion.Text = NowADS().ToString("dd/MM/yyyy") TxtConcepto.Enabled = True - TxtUsuarioElaboro.Text = UsuarioActual.Nombre + LblUsuarioElaboro.Text = UsuarioActual.Nombre End If @@ -349,7 +352,7 @@ Partial Class ContabilidadC_RegPrePolizaS TxtFechaDocumento.Text = NowADS().ToString("dd/MM/yyyy") TxtFechaelaboracion.Text = NowADS().ToString("dd/MM/yyyy") TxtConcepto.Enabled = True - TxtUsuarioElaboro.Text = UsuarioActual.Usuario + LblUsuarioElaboro.Text = UsuarioActual.Usuario End If @@ -409,6 +412,7 @@ Partial Class ContabilidadC_RegPrePolizaS .Add("EsMonedaExtranjera", Type.GetType("System.Boolean")) .Add("TC", Type.GetType("System.Decimal")) .Add("CvePrePoliza", Type.GetType("System.Int32")) + .Add("CveMovimientoAlmacen", Type.GetType("System.Int32")) End With @@ -429,6 +433,7 @@ Partial Class ContabilidadC_RegPrePolizaS DtMovimientosEliminar.AcceptChanges() End Sub Private Function CargaPrePoliza(tCvePrePoliza As Integer) As Boolean + HplImprimirPDF.Visible = False Dim retorno As Boolean = False Dim ObjContabilidad As New ClsContabilidad If ObjContabilidad.GetPrePoliza(tCvePrePoliza, UsuarioActual.CveEmpresa) Then @@ -448,14 +453,13 @@ Partial Class ContabilidadC_RegPrePolizaS Folio = dr("FolioPoliza").ToString TxtFolio.Text = dr("FolioPoliza").ToString - TxtUsuarioElaboro.Text = dr("UsuarioNombre").ToString + LblUsuarioElaboro.Text = dr("UsuarioNombre").ToString TxtFechaelaboracion.Text = dr("FechaIng").ToString.ToDate.ToString("dd/MM/yyyy") TxtFechaelaboracion.ToolTip = dr("FechaIng").ToString.ToDate.ToString("HH:mm:ss") CvePlantillaPoliza = dr("CvePlantillaPoliza").ToString.ToEntero DdlPlantilla.SelectedValueExist(CvePlantillaPoliza) - HplImprimirPDF.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=PREPO&CvePrePoliza={CvePrePoliza}")}" - HplImprimirPDF.Visible = True - If UsuarioActual.CveRol = 1 Then TxtUsuarioElaboro.ToolTip = dr("Modulo").ToString + + LblUsuarioElaboro.ToolTip = dr("Modulo").ToString If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then LnkAddConcepto.Visible = True @@ -528,6 +532,23 @@ Partial Class ContabilidadC_RegPrePolizaS RegistraScript("comparar();") LnkExcel.Visible = False + + Dim CveIE As Integer = DtMovimientos.FiltroPrimeroValor("CveIE", " CveIE > 0 ").ToEntero + + If UsuarioActual.Empresa.Funcionalidad(382).ToEntero = 1 AndAlso CveIE > 0 Then + + Dim StrEncript As String = Encripta($"OP=ImprimeMov&CveIE={CveIE}") + 'HplListaProveedores.NavigateUrl = String.Format($"/Compras/PopUpVerFactura.aspx?P={StrEncript}", ) + + HplImprimirPDF.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={StrEncript}" + HplImprimirPDF.Visible = True + Else + HplImprimirPDF.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=PREPO&CvePrePoliza={CvePrePoliza}")}" + HplImprimirPDF.Visible = True + End If + + + Else Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia) BtnEliminar.Visible = False @@ -792,7 +813,7 @@ Partial Class ContabilidadC_RegPrePolizaS GvMov.DataSource = DtMovimientos GvMov.DataBind() - GvPrePoliza.DataBind() ''limpio el grid + GvPrePoliza.DataBind() UpPrePoliza.Update() UPMovs.Update() @@ -813,7 +834,7 @@ Partial Class ContabilidadC_RegPrePolizaS e.Row.FCTextBox("TxtAbono").Text = If(e.Row.DBCampo("Abono") = "0", "", e.Row.DBCampo("Abono")) e.Row.FCTextBox("TxtCargo").Text = If(e.Row.DBCampo("Cargo") = "0", "", e.Row.DBCampo("Cargo")) - e.Row.FCTextBox("TxtConcepto").Text = e.Row.DBCampo("Descripcion") + e.Row.FCTextBox("TxtConcepto").Text = e.Row.DBCampo("Concepto") If CvePeriodo > 0 Then e.Row.FCTextBox("TxtCargo").Enabled = False @@ -835,7 +856,8 @@ Partial Class ContabilidadC_RegPrePolizaS e.Row.FCDropDownList("DdlSubProyecto").Enabled = True e.Row.FCLinkButton("imgD").Visible = True Else - e.Row.FCDropDownList("DdlSubProyecto").Enabled = False + ' + 'e.Row.FCDropDownList("DdlSubProyecto").Enabled = False End If If e.Row.DBCampo("MultipleSubProyecto") = "True" Then @@ -1012,7 +1034,7 @@ Partial Class ContabilidadC_RegPrePolizaS End If - If Not gvr.DataKey("CveConceptoContable").Contiene("30", "10", "204") Then ' 30-bancos, 10-anticipos proveedores, 204- blancos complementaria + If Not gvr.DataKey("CveConceptoContable").Contiene("30", "10", "204", "348", "350") Then ' 30-bancos, 10-anticipos proveedores, 204- blancos complementaria,348-350 - doc x pagar If gvr.DataKey("CveConceptoContable").ToEntero = 41 Then CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero Else @@ -1667,6 +1689,35 @@ Partial Class ContabilidadC_RegPrePolizaS End If End If + + If DdlPlantilla.SelectedValue.ToEntero <> 53 Then + + Dim x As Integer = 0 + For Each gvRow As GridViewRow In GvMov.Rows + + + DtMovimientos.Rows(x)("ContadoTipoTransaccion") = gvRow.DataKey("ContadoTipoTransaccion").ToEntero + DtMovimientos.Rows(x)("ContadoCuenta") = gvRow.DataKey("ContadoCuenta").ToEntero + DtMovimientos.Rows(x)("ContadoNumeroFolio") = gvRow.DataKey("ContadoNumeroFolio") + DtMovimientos.Rows(x)("ContadoImporte") = gvRow.DataKey("ContadoImporte").ToDecimal + DtMovimientos.Rows(x)("ContadoBeneficiario") = gvRow.DataKey("ContadoBeneficiario") + DtMovimientos.Rows(x)("ContadoObservaciones") = gvRow.DataKey("ContadoObservaciones") + + DtMovimientos.Rows(x)("Concepto") = gvRow.FCTextBox("TxtConcepto").Text + DtMovimientos.Rows(x)("Cargo") = gvRow.FCTextBox("TxtCargo").Text.ToDecimal + DtMovimientos.Rows(x)("Abono") = gvRow.FCTextBox("TxtAbono").Text.ToDecimal + DtMovimientos.Rows(x)("TC") = gvRow.FCTextBox("TxtTC").Text.ToDecimal + DtMovimientos.Rows(x)("ImporteME") = gvRow.FCTextBox("TxtAbonoME").Text.ToDecimal + DtMovimientos.Rows(x)("CveSubProyecto") = gvRow.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero + + x = x + 1 + Next + DtMovimientos.AcceptChanges() + + + End If + + dr("CveCuenta") = DdlCuentaContableE.SelectedValue dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text @@ -1717,11 +1768,22 @@ Partial Class ContabilidadC_RegPrePolizaS End If DtMovimientos.AcceptChanges() - GvPrePoliza.EditIndex = -1 - GvPrePoliza.DataSource = DtMovimientos - GvPrePoliza.DataBind() - UpPrePoliza.Update() - GvPrePoliza.Visible = True + + If DdlPlantilla.SelectedValue.ToEntero <> 53 Then + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + GvPrePoliza.DataBind() + UpPrePoliza.Update() + UPMovs.Update() + Else + GvPrePoliza.EditIndex = -1 + GvPrePoliza.DataSource = DtMovimientos + GvPrePoliza.DataBind() + UpPrePoliza.Update() + GvPrePoliza.Visible = True + End If + + TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero @@ -1964,7 +2026,7 @@ Partial Class ContabilidadC_RegPrePolizaS 'Folio = TxtDocumentoFolio.Text 'ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal 'Observaciones = TxtDocumentoObservaciones.Text - 'Beneficiario = TxtDocumentoBeneficiario.Text + 'Beneficiario = TxtDocumentoBeneficiario.TextTxtReferenciaE RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) @@ -2606,7 +2668,7 @@ Partial Class ContabilidadC_RegPrePolizaS divContabilizada.Visible = False TxtFolio.Text = "" - TxtUsuarioElaboro.Text = UsuarioActual.Usuario + LblUsuarioElaboro.Text = UsuarioActual.Usuario End Sub diff --git a/Contratos/RepPresupuestos.aspx.vb b/Contratos/RepPresupuestos.aspx.vb index b7a05c96d..24714de4d 100644 --- a/Contratos/RepPresupuestos.aspx.vb +++ b/Contratos/RepPresupuestos.aspx.vb @@ -310,8 +310,8 @@ Partial Class Contratos_RepPresupuestos If UsaComprometido Then Ejercido = DrPresupuesto("Comprometido").ToString.ToDecimal PorEjercer = Autorizado - Ejercido - EjercidoPorcentaje = Ejercido / Autorizado * 100 - PorEjercerPorcentaje = PorEjercer / Autorizado * 100 + EjercidoPorcentaje = If(Autorizado > 0, Ejercido / Autorizado * 100, 0) + PorEjercerPorcentaje = If(Autorizado > 0, PorEjercer / Autorizado * 100, 0) thComprometido.Visible = True GvDatos.Columns(2).Visible = True End If @@ -366,7 +366,7 @@ Partial Class Contratos_RepPresupuestos e.Row.Cells(1).Text = "-" End If If e.Row.DBCampo("Comprometido").ToDecimal = 0 Then - e.Row.Cells(1).Text = "-" + e.Row.Cells(2).Text = "-" End If If e.Row.DBCampo("Ejercido").ToDecimal = 0 Then e.Row.Cells(3).Text = "-" diff --git a/Empresas/Grales/Formatos/DepositoCaja.rdlc b/Empresas/Grales/Formatos/DepositoCaja.rdlc index 15daf66f2..7c269cc67 100644 --- a/Empresas/Grales/Formatos/DepositoCaja.rdlc +++ b/Empresas/Grales/Formatos/DepositoCaja.rdlc @@ -1,1089 +1,5 @@ - - - - - - - - 1.27645in - - - 0.96697in - - - 3.81815in - - - 0.98425in - - - 0.84873in - - - - - 0.25in - - - - - true - true - - - - - SerieFolio - - - - - - - Textbox1 - - - - DimGray - - 1pt - - - DimGray - - 1pt - - - DimGray - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Fecha - - - - - - - Textbox3 - - - - DimGray - - 1pt - - - DimGray - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Cliente - - - - - - - Textbox5 - - - - DimGray - - 1pt - - - DimGray - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Tipo Pago - - - - - - - Textbox9 - - - - DimGray - - 1pt - - - DimGray - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Importe - - - - - - - Textbox10 - - - - DimGray - - 1pt - - - DimGray - - 1pt - - - DimGray - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.18in - - - - - true - true - - - - - =Fields!Referencia.Value - - - - - - - Referencia - - - - DimGray - - - DimGray - - - DimGray - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - - - - - =Fields!Fecha.Value - - - - - - - Fecha - - - - DimGray - - 1pt - - - DimGray - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Cliente.Value - - - - - - - Cliente - - - - DimGray - - 1pt - - - DimGray - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!TipoPago.Value - - - - - - - TipoPago - - - - DimGray - - 1pt - - - DimGray - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - - - - - =Fields!Importe.Value - - - - - - - DimGray - - - - DimGray - - - - DimGray - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - - - After - true - - - - - - - DataSet1 - 1.6342in - 0.43in - 7.89455in - - - - - - true - true - - - - - Fecha Impresion: - - - - - - - Textbox12 - 0.18203cm - 16.12812cm - 0.70936cm - 1.96203cm - 1 - - - Middle - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!Fecha.Value - - - - - - - Textbox12 - 0.18203cm - 18.09015cm - 0.70936cm - 1.60515cm - 2 - - - Middle - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - D E P O S I T O D E C A J A - - - - - - - Textbox8 - 1.26209cm - 3.07551cm - 0.5365cm - 13.01733cm - 3 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!Empresa.Value - - - - - - - Textbox8 - 0.092cm - 3.07551cm - 1.17009cm - 13.01733cm - 4 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Cuenta de Caja: - - - - - - - Textbox12 - 2.15384cm - 0.12912cm - 0.53299cm - 3.11306cm - 5 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!CuentaCaja.Value - - - - - - - Textbox12 - 2.15384cm - 3.25543cm - 0.53299cm - 8.81574cm - 6 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Total: - - - - - - - Textbox2 - 5.31361cm - 15.35404cm - 0.6cm - 2.53175cm - 7 - - 0.25pt - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Sum(Fields!Importe.Value, "DataSet1") - - - - - 0.25pt - - - - - - DimGray - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Cuenta Deposito: - - - - - - - Textbox12 - 2.86322cm - 0.12912cm - 0.53299cm - 3.11306cm - 9 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!CuentaDeposito.Value - - - - - - - Textbox12 - 2.86322cm - 3.25543cm - 0.53299cm - 8.81574cm - 10 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!FechaIE.Value - - - - - - - Textbox12 - 2.15386cm - 13.94971cm - 0.70936cm - 2.14313cm - 11 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - FECHA: - - - - - - - Textbox12 - 2.15386cm - 12.49038cm - 0.70936cm - 1.45933cm - 12 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Tipo Pago: - - - - - - - - - - - - - - - - Textbox12 - 3.44148cm - 0.12912cm - 0.53299cm - 3.12013cm - 13 - - =(Parameters!TipoPago.Value = "") - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!TipoPago.Value - - - - - - - Textbox12 - 3.44148cm - 3.28453cm - 0.53299cm - 3.76632cm - 14 - - - 2pt - 2pt - 2pt - 2pt - - - - 6.09cm - - - - - 27.94cm - 21.59cm - 1cm - 0.5cm - 0.5cm - 0.5cm - 1.27cm - - - - + 0 @@ -1132,6 +48,1228 @@ + + + + + + + + + 1.27645in + + + 0.96697in + + + 3.81815in + + + 0.98425in + + + 0.84873in + + + + + 0.25in + + + + + true + true + + + + + SerieFolio + + + + + + + Textbox1 + + + + DimGray + + 1pt + + + DimGray + + 1pt + + + DimGray + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Fecha + + + + + + + Textbox3 + + + + DimGray + + 1pt + + + DimGray + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Cliente + + + + + + + Textbox5 + + + + DimGray + + 1pt + + + DimGray + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Tipo Pago + + + + + + + Textbox9 + + + + DimGray + + 1pt + + + DimGray + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox10 + + + + DimGray + + 1pt + + + DimGray + + 1pt + + + DimGray + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.18in + + + + + true + true + + + + + =Fields!Referencia.Value + + + + + + + Referencia + + + + DimGray + + + DimGray + + + DimGray + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!Fecha.Value + + + + + + + Fecha + + + + DimGray + + 1pt + + + DimGray + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Cliente.Value + + + + + + + Cliente + + + + DimGray + + 1pt + + + DimGray + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TipoPago.Value + + + + + + + TipoPago + + + + DimGray + + 1pt + + + DimGray + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!Importe.Value + + + + + + + DimGray + + + + DimGray + + + + DimGray + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + After + true + + + + + + + DataSet1 + 1.6342in + 0.43in + 7.89455in + + + + + + true + true + + + + + Fecha Impresion: + + + + + + + Textbox12 + 0.18203cm + 16.12812cm + 0.70936cm + 1.96203cm + 1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Fecha.Value + + + + + + + Textbox12 + 0.18203cm + 18.09015cm + 0.70936cm + 1.60515cm + 2 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + D E P O S I T O D E C A J A + + + + + + + Textbox8 + 1.26209cm + 3.07551cm + 0.5365cm + 13.01733cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Empresa.Value + + + + + + + Textbox8 + 0.092cm + 3.07551cm + 1.17009cm + 13.01733cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Cuenta de Caja: + + + + + + + Textbox12 + 2.15384cm + 0.12912cm + 0.53299cm + 3.11306cm + 5 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CuentaCaja.Value + + + + + + + Textbox12 + 2.15384cm + 3.25543cm + 0.53299cm + 8.81574cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Total: + + + + + + + Textbox2 + 5.31361cm + 15.35404cm + 0.6cm + 2.53175cm + 7 + + 0.25pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Importe.Value, "DataSet1") + + + + + 0.25pt + + + + + + DimGray + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Cuenta Deposito: + + + + + + + Textbox12 + 2.86322cm + 0.12912cm + 0.53299cm + 3.11306cm + 9 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CuentaDeposito.Value + + + + + + + Textbox12 + 2.86322cm + 3.25543cm + 0.53299cm + 8.81574cm + 10 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FechaIE.Value + + + + + + + Textbox12 + 2.15386cm + 13.94971cm + 0.53297cm + 2.14313cm + 11 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha: + + + + + + + Textbox12 + 2.15386cm + 12.24756cm + 0.53297cm + 1.70215cm + 12 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Tipo Pago: + + + + + + + + + + + + + + + + Textbox12 + 3.44148cm + 0.12912cm + 0.53299cm + 3.12013cm + 13 + + =(Parameters!TipoPago.Value = "") + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!TipoPago.Value + + + + + + + Textbox12 + 3.44148cm + 3.28453cm + 0.53299cm + 3.76632cm + 14 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!TipoTransaccion.Value + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Forma de pago: + + + + + + + Textbox12 + 2.86322cm + 12.24756cm + 0.53299cm + 2.76048cm + 16 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Observaciones.Value + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Observaciones: + + + + + + + Textbox12 + 6.01944cm + 0.14177cm + 0.53299cm + 2.58822cm + 18 + + + 2pt + 2pt + 2pt + 2pt + + + + 6.75146cm + + + + + 27.94cm + 21.59cm + 1cm + 0.5cm + 0.5cm + 0.5cm + 1.27cm + + + + + + String @@ -1168,6 +1306,18 @@ true ReportParameter1 + + String + true + true + ReportParameter1 + + + String + true + true + ReportParameter1 + Cm 8ca56a24-e4cd-4986-9105-84383a48863b diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 9db0e3af6..9b8d272e3 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -658,7 +658,7 @@ Partial Class Inventarios_EntregaAlmacen Dim ObjInventario As New ClsInventarios - If ObjInventario.EntregaAlmacenGet(CveVenta, CveAlmacen) Then + If ObjInventario.EntregaAlmacenGet(CveVenta, UsuarioActual.CveEmpresa, CveAlmacen) Then If ObjInventario.DtResultados IsNot Nothing AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then ArchivoBitacora = String.Format("{0}Temp\EntregaDT_{1}_{2}.xml", UsuarioActual.Empresa.Ruta, UsuarioActual.CveUsuario, CveVenta) @@ -717,6 +717,11 @@ Partial Class Inventarios_EntregaAlmacen LbObservacionesAlmacen.Text = drE("ObservacionesAlmacen").ToString() CveVentaSurtir = CveVenta CveOSSurtir = CveOS + + If TipoDocto = "Ped" And CveOSSurtir <= 0 Then + CveOSSurtir = drE("CveOS").ToString().ToEntero + End If + CveTipoVenta = drE("CveTipoVenta").ToString().ToEntero CveAlmacenTraspasoDestino = drE(If(EsDevolucionVenta = 1 And TipoDocto <> "Rem" And TipoDocto <> "Ped", "CveAlmacenTraspasoOrigen", "CveAlmacenTraspasoDestino")).ToString().ToEntero() CveAlmacenTraspasoOrigen = drE(If(EsDevolucionVenta = 1 And TipoDocto <> "Rem" And TipoDocto <> "Ped", "CveAlmacenTraspasoDestino", "CveAlmacenTraspasoOrigen")).ToString().ToEntero() @@ -1062,7 +1067,8 @@ Partial Class Inventarios_EntregaAlmacen If CargaBitacora Then CargaBitacoraSerie() - End If + End If + Else End If End If @@ -2167,15 +2173,13 @@ Partial Class Inventarios_EntregaAlmacen DtDatos.Rows(Index)("Lote") = gvr.FCTextBox("TxtLote").Text End If - - End If Index += 1 Next 'VALIDA SI HUBO CAMBIOS EN LA EXISTENCIA Dim DtDatosVenta As New DataTable - If ObjInventario.EntregaAlmacenGet(CveVentaSurtir) Then + If ObjInventario.EntregaAlmacenGet(CveVentaSurtir, UsuarioActual.CveEmpresa) Then DtDatosVenta = ObjInventario.DtResultados End If Dim CantidadGV As Decimal = GvDatos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("CantidadF").ToDecimal) @@ -3316,9 +3320,7 @@ Partial Class Inventarios_EntregaAlmacen OnError("Ocurrió un error al guardar", ex) End Try - - - If EsDevolucionVenta = 1 AndAlso CveOSSurtir > 0 AndAlso TipoMovimiento = 2 AndAlso TipoDocto = "Ped" Then + If Not ErrorMovInv AndAlso EsDevolucionVenta = 1 AndAlso CveOSSurtir > 0 AndAlso TipoMovimiento = 2 AndAlso TipoDocto = "Ped" Then If Not CierreOS(CveOSSurtir, CveMovimiento, ObjInventario.IniciaTransacSQL) Then ErrorMovInv = True Alert("Error al finalizar orden de servicio", TipoMensaje.MsgError) @@ -4352,7 +4354,13 @@ Partial Class Inventarios_EntregaAlmacen Private Sub RecargaporAlmacenes() If DdlAlmacen.SelectedValue <> "-1" Then - CargaGvDatos() + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + CargaGvDatos(False) + Else + CargaGvDatos() + End If + + End If End Sub diff --git a/Inventarios/RepNotasSinAlmacen.aspx.vb b/Inventarios/RepNotasSinAlmacen.aspx.vb index 55a9eb262..1ee22d54b 100644 --- a/Inventarios/RepNotasSinAlmacen.aspx.vb +++ b/Inventarios/RepNotasSinAlmacen.aspx.vb @@ -1,7 +1,6 @@ Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms -Imports Stimulsoft.Report.QuickButtons.StiWpfQuickButtonAttribute Partial Class RepNotasSinAlmacen Inherits ClsPaginas @@ -122,8 +121,8 @@ Partial Class RepNotasSinAlmacen CargaDatos() End Sub - Private Sub CargaDatos() - Dim Reporte As New ClsInventarios + Private Sub CargaDatos() + Dim CveClienteProveedor As Integer = -1 Dim TipoDocumento As String = DdlTipoDocto1.SelectedValue @@ -139,14 +138,18 @@ Partial Class RepNotasSinAlmacen Else CveClienteProveedor = DdlCliente.SelectedValue.ToEntero End If - - If Reporte.RepNotasSinAlmacen(Opcion, CveClienteProveedor, FechaInicial, FechaFinal, TipoDocumento, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa) Then + Dim Reporte As New ClsInventarios + If Reporte.RepNotasSinAlmacen(Opcion, CveClienteProveedor, FechaInicial, FechaFinal, TipoDocumento, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa) Then + Dim dtt As DataTable = Reporte.DtResultados + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then ' es empresa hospitalaria + dtt = dtt.fit + End If GvVentas.DataSource = Reporte.DtResultados DtNotasSinAlmacenVentas = Reporte.DtResultados Else GvVentas.DataSource = Nothing - End If - + End If + Reporte.Dispose() GvVentas.DataBind() Else @@ -155,15 +158,15 @@ Partial Class RepNotasSinAlmacen CveClienteProveedor = -1 Else CveClienteProveedor = DdlProveedor.SelectedValue.ToEntero - End If - + End If + Dim Reporte As New ClsInventarios If Reporte.RepNotasSinAlmacen(2, CveClienteProveedor, FechaInicial, FechaFinal, DdlTipoDocto2.SelectedValue, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa) Then GvCompras.DataSource = Reporte.DtResultados DtNotasSinAlmacenCompras = Reporte.DtResultados Else GvCompras.DataSource = Nothing - End If - + End If + Reporte.Dispose() GvCompras.DataBind() 'If (GvCompras.Rows.Count > 0) Then @@ -174,8 +177,8 @@ Partial Class RepNotasSinAlmacen End If UpDatosGvVentas.Update() - UpDatosGvCompras.Update() - Reporte.Dispose() + UpDatosGvCompras.Update() + End Sub diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 9793c9c20..168218ffe 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -6,7 +6,6 @@ Imports System.Data.SqlClient Imports System.IO Imports Extensiones Imports GemBox.Spreadsheet -Imports Microsoft.Owin.Security.Provider Imports Newtonsoft.Json Partial Class OC_OC @@ -926,13 +925,13 @@ Partial Class OC_OC ChkEntregaDirecta.Checked = False End If - If UsuarioActual.CveEmpresa.Contiene(13, 73) AndAlso CveOrdenCompra > 0 AndAlso Request("Conta") IsNot Nothing AndAlso Request("Conta").ToEntero = 1 Then - If GeneraPrePolizaPresupuesto(CveOrdenCompra, Nothing) Then - Alert("PrePoliza de Presupuesto Generada Correctamente") - Else - Alert("No Se Genero la PrePoliza de Presupuesto Generada Correctamente", TipoMensaje.MsgAdvertencia) - End If - End If + 'If UsuarioActual.CveEmpresa.Contiene(13, 73) AndAlso CveOrdenCompra > 0 AndAlso Request("Conta") IsNot Nothing AndAlso Request("Conta").ToEntero = 1 Then + ' If GeneraPrePolizaPresupuesto(CveOrdenCompra, Nothing) Then + ' Alert("PrePoliza de Presupuesto Generada Correctamente") + ' Else + ' Alert("No Se Genero la PrePoliza de Presupuesto Generada Correctamente", TipoMensaje.MsgAdvertencia) + ' End If + 'End If End If @@ -2218,51 +2217,11 @@ Partial Class OC_OC Exit Sub End If - - Dim ValImporte As Decimal = (TxtCant.Text.ToDecimal * txtPrecioUnitario.Text.ToDecimal).RoundSQL(2) If Not ValidaPresupuesto(1, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, ValImporte) Then Exit Sub End If - 'If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then - - 'Dim ObjCon As New ClsContratos - 'Dim CvePresupuesto As Integer = 0 - 'Dim Autorizado As Decimal = 0 - 'Dim Ejercido As Decimal = 0 - 'If ObjCon.GetPresupuestos(-1, "-1", DdlSubProyecto.SelectedValue.ToEntero, 2, -1, UsuarioActual.CveEmpresa) Then - ' If ObjCon.DtResultados.Rows.Count > 0 Then - ' CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero - ' If CvePresupuesto > 0 Then - ' If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then - ' If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows.Count > 0 Then - ' Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows(0)("Importe").ToString.ToDecimal - ' End If - ' End If - ' If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{NowADS().Year - 1}".ToDate, NowADS(), UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, - ' DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveUsuario, DdlClasificacion.SelectedValue.ToEntero) Then - ' If ObjCon.DtResultados.Rows.Count > 0 Then - ' Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDecimal - ' End If - ' End If - ' End If - ' End If - 'End If - 'ObjCon.Dispose() - - 'If CvePresupuesto > 0 And Autorizado > 0 Then - ' Dim Diferencia As Decimal = (Ejercido + If(txtPrecioUnitario.Text.ToDecimal > 0, (txtPrecioUnitario.Text.ToDecimal * TxtCant.Text.ToDecimal) - TxtDescuentoAdd.Text.ToDecimal, 0)) - Autorizado - ' If Diferencia > 0 Then - ' Alert($"No hay presupuesto disponible en el subproyecto {DdlSubProyecto.SelectedItem.Text} y la clasificación {DdlClasificacion.SelectedItem.Text} se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - 'End If - 'End If - - - - Dim RetISR As Decimal = DrPS("RetISR").ToString.ToDecimal Dim RetIVA As Decimal = DrPS("RetIVA").ToString.ToDecimal Dim IvaPS As Decimal = DrPS("IVA").ToString.ToDecimal @@ -2642,10 +2601,17 @@ Partial Class OC_OC End If + If Not ValidaTotales() Then + TieneError = True + End If + + Return TieneError End Function Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click + + 'VALIDACIONES PARA GUARDAR If ValidaGuardar() Then Exit Sub @@ -2653,6 +2619,8 @@ Partial Class OC_OC Exit Sub End If + + Dim MsgError As String = "Hubo un error al registrar" 'VARIABLES Dim CveProveedorSucursal As Integer = -1 @@ -3348,6 +3316,30 @@ Partial Class OC_OC End Sub + + Private Function ValidaTotales() As Boolean + + Dim Subtotal As Decimal = DtDetalle.SUMD("Total", "Total > 0") + DtDetalle.SUMD("Descuento") + Dim Descuento As Decimal = DtDetalle.SUMD("Descuento").RoundSQL + Dim SubTotalIEPSIVA As Decimal = DtDetalle.SUMD("IEPSPSIVA") + Dim IVA As Decimal = DtDetalle.SUMD("IVA") + SubTotalIEPSIVA + Dim SubTotalIEPS As Decimal = DtDetalle.SUMD("IEPSPS") + Dim SubTotalRetIVA As Decimal = DtDetalle.SUMD("RetIVA") + Dim SubTotalRetISR As Decimal = DtDetalle.SUMD("RetISR") + + Dim Total As Decimal = (Subtotal - Descuento + IVA + SubTotalIEPS - SubTotalRetIVA - SubTotalRetISR) + Dim Diferencia As Decimal = (Total - LblTotal.Text.ToDecimal).RoundSQL(2) + + If Math.Abs(Diferencia) > 0 Then + Alert($"Existe una diferencia de {Diferencia.ToString("###,###,###.00")} entre el Total y las Partidas.", TipoMensaje.MsgAdvertencia) + Return False + Else + Return True + End If + + + End Function + Protected Function GeneraOrdenes(ByRef objOrdenCompra As ClsOC, Conta As ClsContPAQi, ByRef ObjInventarios As ClsInventarios) As Boolean 'If Ddlcliente.txtValue.Value.ToEntero > 0 And DdlVendedor.SelectedValue.ToEntero <= 0 Then @@ -3521,8 +3513,7 @@ Partial Class OC_OC End If - - If UsuarioActual.CveEmpresa.Contiene(13, 73) Then + If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then If Not GeneraPrePolizaPresupuesto(objOrdenCompra.CveOrdenCompra, objOrdenCompra.IniciaTransacSQL) Then HuboError = True @@ -3530,7 +3521,6 @@ Partial Class OC_OC End If - Catch ex As Exception HuboError = True End Try @@ -3687,6 +3677,10 @@ Partial Class OC_OC TieneError = True End If + If (UsuarioActual.Empresa.Funcionalidad(532) = "1") Then + GeneraPrePolizaPresupuesto(CveOrdenCompra, objOrdenCompra.IniciaTransacSQL, True) + End If + If IDPolizaPresupuestal > 0 AndAlso UsuarioActual.Empresa.UsaAC Then PolizaCancelacion = CancelarAC(ObjAC) @@ -9051,59 +9045,50 @@ Partial Class OC_OC Dim respuesta As Boolean = False - 'If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then - If UsuarioActual.CveEmpresa.Contiene(13, 83) Then + If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then Dim ObjCon As New ClsContratos Dim CvePresupuesto As Integer = 0 - Dim Autorizado As Double = 0 - Dim Ejercido As Double = 0 - - If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, 2) Then - - Dim FechaCompra As Date = TxtFecha.Text.ToDate + Dim Autorizado As Decimal = 0 + Dim Ejercido As Decimal = 0 + Dim FechaCompra As Date = TxtFecha.Text.ToDate + If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, FechaCompra.FirstDayOfMonth, FechaCompra.LastDayOfMonth, 2) Then + Dim ColumnaSaldo As String = "Saldo" + If UsuarioActual.CveEmpresa.Contiene(13, 83) Then ColumnaSaldo = "SaldoComprometido" Dim resultadosFiltrados = From row In ObjCon.DtResultados.AsEnumerable() - Where FechaCompra >= row.Field(Of Date)("FechaInicio") AndAlso - FechaCompra <= row.Field(Of Date)("FechaFin") Select row - - If resultadosFiltrados.Count > 0 Then + If ObjCon.DtResultados.Rows.Count > 0 Then If Opcion = 1 Then - Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = ValCveSubProyecto) If tieneRegistrosConCveSubProyecto Then Dim saldoTotal As Decimal = (From row In resultadosFiltrados Where row.Field(Of Integer)("CveSubProyecto") = ValCveSubProyecto AndAlso row.Field(Of Integer)("CveClasificacion") = ValCveClasificacion - Select row.Field(Of Decimal)("Saldo")).Sum() + Select row.Field(Of Decimal)(ColumnaSaldo)).Sum() If saldoTotal > 0 Then Dim TotalAcumuladoTabla As Decimal = (DtDetalle.SUM("Total", $" CveSubProyecto = {ValCveSubProyecto} AND CveClasificacion = {ValCveClasificacion} ")) Dim Diferencia As Decimal = saldoTotal - TotalAcumuladoTabla - ValImporte If (Diferencia) < 0 Then - Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}. Se excede por { Math.Abs(Diferencia).FormatoNumero}", TipoMensaje.MsgAdvertencia) + Alert($"No hay presupuesto disponible en:
    Subproyecto: {ValSubProyecto} Clasificación: {ValClasificacion}. Se excede por { Math.Abs(Diferencia).FormatoNumero}", TipoMensaje.MsgAdvertencia) respuesta = False - Else respuesta = True End If - Else - Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}.", TipoMensaje.MsgAdvertencia) + Alert($"No hay presupuesto disponible en:
    Subproyecto: {ValSubProyecto} Clasificación: {ValClasificacion}.", TipoMensaje.MsgAdvertencia) respuesta = False End If Else respuesta = True End If - Else - Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable() Group row By SubProyecto = row.Field(Of String)("SubProyecto"), @@ -9127,21 +9112,20 @@ Partial Class OC_OC Dim saldoTotal As Decimal = (From row In resultadosFiltrados Where row.Field(Of Integer)("CveSubProyecto") = item.CveSubProyecto AndAlso row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion - Select row.Field(Of Decimal)("Saldo")).Sum() + Select row.Field(Of Decimal)(ColumnaSaldo)).Sum() If saldoTotal > 0 Then Dim Diferencia As Decimal = saldoTotal - item.TotalSum If (Diferencia) < 0 Then - Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}. Se excede por {Math.Abs(Diferencia).FormatoNumero}", TipoMensaje.MsgAdvertencia) + Alert($"No hay presupuesto disponible en:
    Subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}. Se excede por {Math.Abs(Diferencia).FormatoNumero}", TipoMensaje.MsgAdvertencia) respuesta = False Exit For Else respuesta = True End If - Else - Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}.", TipoMensaje.MsgAdvertencia) + Alert($"No hay presupuesto disponible en:
    Subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}.", TipoMensaje.MsgAdvertencia) respuesta = False Exit For End If @@ -9149,7 +9133,6 @@ Partial Class OC_OC respuesta = True End If Next - End If Else @@ -9160,46 +9143,32 @@ Partial Class OC_OC 'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia) respuesta = False End If - ObjCon.Dispose() - - - Else respuesta = True End If - - Return respuesta End Function - - Private Function GeneraPrePolizaPresupuesto(CveOrdenCompraPresupuesto As Integer, Optional ByRef transaccion As SqlTransaction = Nothing) As Boolean + Private Function GeneraPrePolizaPresupuesto(CveOrdenCompraPresupuesto As Integer, Optional ByRef transaccion As SqlTransaction = Nothing, Optional EsCancelacion As Boolean = False) As Boolean Dim Respuesta As Boolean = True - If UsuarioActual.CveEmpresa.Contiene(13, 73) Then + If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then Dim CveMonedaPresupuesto As Integer = DdlMoneda.SelectedValue.ToEntero Dim TC As Decimal = If(CveMonedaPresupuesto = 1, 1, GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal) If CveMonedaPresupuesto > 1 AndAlso TC = 0 Then - Alert($"No se genero la prepoliza de presupuesto, no se pudo obtener el Tipo de Cambio de la fecha {TxtFecha.Text}", TipoMensaje.MsgAdvertencia) + Alert($"No se genero la póliza de presupuesto, no se pudo obtener el Tipo de Cambio de la fecha {TxtFecha.Text}", TipoMensaje.MsgAdvertencia) Return False End If - Dim ObjConta As New ClsContabilidad() + Dim ObjConta As New ClsContabilidad(transaccion) + Dim CvePrePolizaPresupuesto = ObjConta.AddPrePolizas("OC/OC-(Presupuesto)", 53, LblTotal.Text.ToDecimal, LblTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlProveedores.SelectedText, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If transaccion Is Nothing Then - ObjConta = New ClsContabilidad() - Else - ObjConta = New ClsContabilidad(transaccion) - End If - - Dim CvePrePolizaPreSuPuesto = ObjConta.AddPrePolizas("OC/OC-(Presupuesto)", 53, LblTotal.Text.ToDecimal, LblTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlProveedores.SelectedText, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If CvePrePolizaPreSuPuesto > 0 Then + If CvePrePolizaPresupuesto > 0 Then Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable() Group row By @@ -9219,37 +9188,28 @@ Partial Class OC_OC For Each item In EnumAgrupado Dim SerieFolio = $"OC: {Folio}, Clasificación: {item.Clasificacion}" + Dim Multiplicador As Decimal = If(EsCancelacion, -1, 1) - Dim Importe As Decimal = item.TotalSum - Dim ImporteME As Decimal = If(CveMonedaPresupuesto = 1, 0, item.TotalSum) - Dim ImporteMN As Decimal = If(CveMonedaPresupuesto = 1, item.TotalSum, item.TotalSum * TC) + Dim Importe As Decimal = Multiplicador * item.TotalSum + Dim ImporteME As Decimal = Multiplicador * If(CveMonedaPresupuesto = 1, 0, item.TotalSum) + Dim ImporteMN As Decimal = Multiplicador * If(CveMonedaPresupuesto = 1, item.TotalSum, item.TotalSum * TC) - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, False, Importe, ImporteMN, 154, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then - Respuesta = False - Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPresupuesto, False, Importe, ImporteMN, 154, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then + Respuesta = False : Exit For End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, True, Importe, ImporteMN, 152, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then - Respuesta = False - Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPresupuesto, True, Importe, ImporteMN, 152, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then + Respuesta = False : Exit For End If - Next Else Respuesta = False End If - - - End If - Return Respuesta End Function - - #End Region diff --git a/PortalProveedor/PortalProveedor.aspx.vb b/PortalProveedor/PortalProveedor.aspx.vb index 8772990de..d1ae59790 100644 --- a/PortalProveedor/PortalProveedor.aspx.vb +++ b/PortalProveedor/PortalProveedor.aspx.vb @@ -302,21 +302,27 @@ Partial Class Portal_PortalProveedor #Region "C A R G A - D A T O S" Protected Sub CargaDatos() - GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimero($"CveProveedor = {CveProveedor}") - Dim ObjProveedor As New ClsCompProveedores() - If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, CveProveedor, "-1", "-1", "-1", "-1", "-1", "-1", "-1", 1, UsuarioActual.CveEmpresa) Then - If ObjProveedor.DtResultados.Rows.Count > 0 Then + Dim drp As DataRow = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimero($"CveProveedor = {CveProveedor}") - 'CxP - LtlProveedor.Text = ObjProveedor.RazonSocial - lblLimiteCredito.Text = ObjProveedor.LimiteCredito.ToString - lblPlazoCobranza.Text = ObjProveedor.PlazoPago.ToString - - Else - Alert("Ocurrió un error al cargar los datos.", TipoMensaje.MsgError) - End If + If drp IsNot Nothing Then + LtlProveedor.Text = drp("RazonSocial").ToString + lblLimiteCredito.Text = drp("LimiteCredito").ToString.ToDecimal.FormatoNumero + lblPlazoCobranza.Text = drp("PlazoPago").ToString End If - ObjProveedor.Dispose() + 'Dim ObjProveedor As New ClsCompProveedores() + 'If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, CveProveedor, "-1", "-1", "-1", "-1", "-1", "-1", "-1", 1, UsuarioActual.CveEmpresa) Then + ' If ObjProveedor.DtResultados.Rows.Count > 0 Then + + ' 'CxP + ' LtlProveedor.Text = ObjProveedor.RazonSocial + ' lblLimiteCredito.Text = ObjProveedor.LimiteCredito.ToString + ' lblPlazoCobranza.Text = ObjProveedor.PlazoPago.ToString + + ' Else + ' Alert("Ocurrió un error al cargar los datos.", TipoMensaje.MsgError) + ' End If + 'End If + 'ObjProveedor.Dispose() End Sub @@ -357,9 +363,9 @@ Partial Class Portal_PortalProveedor If ObjMovtos.GetCxPProveedor(CveProveedor, "-1", "-1", -1, -1, -1, -1, -1, -1, DdlProveedorSucursalCxCSucursal.SelectedValue.ToEntero, -1) Then - GvCxP.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "Moneda,OrdenVencimiento, FechaVencimiento") - - 'solo tomo los 10 ultimos mas el totalizador general + GvCxP.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "Moneda,OrdenVencimiento, FechaVencimiento") + + 'solo tomo los 10 ultimos mas el totalizador general Dim dt As DataTable = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'") If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then diff --git a/Scripts/Notificaciones.js b/Scripts/Notificaciones.js index ea40c5c57..f2b9ec0b0 100644 --- a/Scripts/Notificaciones.js +++ b/Scripts/Notificaciones.js @@ -14,16 +14,16 @@ var NotificacionesADS = function () { if (Notification.permission !== 'denied') { Notification.requestPermission(function (permission) { // If the user accepts, let's create a notification - //if (permission === "granted") { - //} + if (permission === "granted") { + } }); } } } //-------------------------------------------------------------------- Eventos ---------------------------------------------------------------------- - var AlertaVentana = function (Titulo, Mensaje, Tipo, timeoutseconds, Opciones) { + var AlertaVentana = function (Titulo, Mensaje, Tipo, timeoutseconds) { console.log(Mensaje); - let obj = { metodo: "AlertaVentana", titulo: Titulo, mensaje: Mensaje, timeout: timeoutseconds, tipo: Tipo, opciones: Opciones, tick: (new Date()).getTime() }; + let obj = { metodo: "AlertaVentana", titulo: Titulo, mensaje: Mensaje, timeout: timeoutseconds, tipo: Tipo, tick: (new Date()).getTime() }; let myjson = JSON.stringify(obj); localStorage.setItem("ADSNotificaciones", myjson); execAlertaVentana(obj); @@ -117,11 +117,11 @@ var NotificacionesADS = function () { var proxy = $.connection.notificaciones; /*$.connection.hub.url = '/signalr';*/ $.connection.hub.disconnected(function () { - console.log(' (SignalR) diconnected'); + console.log(' (SignalR) disconnected'); signalrconectionStar(1200); }); - proxy.client.AlertaVentana = AlertaVentana; + proxy.client.alertaVentana = AlertaVentana; proxy.client.Execstring = Execstring; @@ -139,7 +139,7 @@ var NotificacionesADS = function () { nointentos = nointentos + 1; if (nointentos < maxintentos) { $.connection.hub.start().done(function () { console.log('(SignalR)Bienvenido'); nointentos = 0; }) - .fail(function () { console.log(' (SignalR) no conectado (Intento:' + nointentos + ')'); signalrconectionStar(12000); }); + .fail(function () { console.log(' (SignalR) no conectado (Intento:' + nointentos + ')'); signalrconectionStar(1200); }); } }, TimeOut); } diff --git a/Sistemas/PopUpCambiaUsuarioEmpresa.aspx.vb b/Sistemas/PopUpCambiaUsuarioEmpresa.aspx.vb index 19491bfbc..289e587a1 100644 --- a/Sistemas/PopUpCambiaUsuarioEmpresa.aspx.vb +++ b/Sistemas/PopUpCambiaUsuarioEmpresa.aspx.vb @@ -27,7 +27,7 @@ Partial Class Sistemas_PopUpCambiaUsuarioEmpresa 'Dim DtEmp As DataTable = GlobalDTEmpresas.Copy Dim NombreEmp As String = UsuarioActual.Empresa.Empresa - '''condición para ocultar los nombres de las empresas y ponerles "mi empresa de venta (xxx)" + ''condición para ocultar los nombres de las empresas y ponerles "mi empresa de venta (xxx)" ''If UsuarioActual.CveUsuario = 100 Then '' Dim customerRow() As Data.DataRow @@ -92,8 +92,25 @@ Partial Class Sistemas_PopUpCambiaUsuarioEmpresa tUsuario = gvr.DataKey("Usuario").ToString tContraseña = gvr.DataKey("Contraseña").ToString tCveEmpresa = gvr.DataKey("CveEmpresa").ToString.ToEntero + Dim tGrupoEmpresa As String = "" + Dim NombreCadena As String = "Conexion" - Dim ObjUsuario As New ClsSisUsuarios + If Request.Url.Host.ToUpper().Contains("EMD".ToUpper()) Then tGrupoEmpresa = "EMD" + If Request.Url.Host.ToUpper().Contains("BDH".ToUpper()) Then tGrupoEmpresa = "BDH" + If Request.Url.Host.ToUpper().Contains("ECONOLLANTAS".ToUpper()) Then tGrupoEmpresa = "ECONOLLANTAS" : NombreCadena = "Conexion" + If Request.Url.Host.ToUpper().Contains("JAM".ToUpper()) Then tGrupoEmpresa = "JAM" + If Request.Url.Host.ToUpper().Contains("CITRUS".ToUpper()) Then tGrupoEmpresa = "CITRUS" + If Request.Url.Host.ToUpper().Contains("KINO".ToUpper()) Then tGrupoEmpresa = "KINO" + If Request.Url.Host.ToUpper().Contains("VSH".ToUpper()) Then tGrupoEmpresa = "VSH" + If Request.Url.Host.ToUpper().Contains("AJAM".ToUpper()) Then tGrupoEmpresa = "AJAM" + If Request.Url.Host.ToUpper().Contains("ALATEL".ToUpper()) Then tGrupoEmpresa = "ALATEL" + If Request.Url.Host.ToUpper().Contains("SERVEC".ToUpper()) Then tGrupoEmpresa = "SERVEC" + If Request.Url.Host.ToUpper().Contains("SMS".ToUpper()) Then tGrupoEmpresa = "SMS" + If Request.Url.Host.ToUpper().Contains("VYA".ToUpper()) Then tGrupoEmpresa = "VYA" + If Request.Url.Host.ToUpper().Contains("GRUPODIAZ".ToUpper()) Then tGrupoEmpresa = "GRUPODIAZ" + If Request.Url.Host.ToUpper().Contains("FERRETERA".ToUpper()) Then tGrupoEmpresa = "FERRETERA" + + Dim ObjUsuario As New ClsSisUsuarios(NombreCadena:=NombreCadena) Dim Usuario As Usuario 'Dim UsuarioAsignaciones As Usuario diff --git a/Sistemas/PopUpSeleccionarEmpresa.aspx.vb b/Sistemas/PopUpSeleccionarEmpresa.aspx.vb index c0868b5c7..1271f6e3d 100644 --- a/Sistemas/PopUpSeleccionarEmpresa.aspx.vb +++ b/Sistemas/PopUpSeleccionarEmpresa.aspx.vb @@ -59,10 +59,26 @@ Partial Class PopUpSeleccionarEmpresa Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow) - If gvr IsNot Nothing Then - - Dim ObjUsuario As New ClsSisUsuarios - Dim Usuario As Usuario = Nothing + If gvr IsNot Nothing Then + Dim tGrupoEmpresa As String = "" + Dim NombreCadena As String = "Conexion" + Dim Usuario As Usuario = Nothing + If Request.Url.Host.ToUpper().Contains("EMD".ToUpper()) Then tGrupoEmpresa = "EMD" + If Request.Url.Host.ToUpper().Contains("BDH".ToUpper()) Then tGrupoEmpresa = "BDH" + If Request.Url.Host.ToUpper().Contains("ECONOLLANTAS".ToUpper()) Then tGrupoEmpresa = "ECONOLLANTAS" : NombreCadena = "Conexion" + If Request.Url.Host.ToUpper().Contains("JAM".ToUpper()) Then tGrupoEmpresa = "JAM" + If Request.Url.Host.ToUpper().Contains("CITRUS".ToUpper()) Then tGrupoEmpresa = "CITRUS" + If Request.Url.Host.ToUpper().Contains("KINO".ToUpper()) Then tGrupoEmpresa = "KINO" + If Request.Url.Host.ToUpper().Contains("VSH".ToUpper()) Then tGrupoEmpresa = "VSH" + If Request.Url.Host.ToUpper().Contains("AJAM".ToUpper()) Then tGrupoEmpresa = "AJAM" + If Request.Url.Host.ToUpper().Contains("ALATEL".ToUpper()) Then tGrupoEmpresa = "ALATEL" + If Request.Url.Host.ToUpper().Contains("SERVEC".ToUpper()) Then tGrupoEmpresa = "SERVEC" + If Request.Url.Host.ToUpper().Contains("SMS".ToUpper()) Then tGrupoEmpresa = "SMS" + If Request.Url.Host.ToUpper().Contains("VYA".ToUpper()) Then tGrupoEmpresa = "VYA" + If Request.Url.Host.ToUpper().Contains("GRUPODIAZ".ToUpper()) Then tGrupoEmpresa = "GRUPODIAZ" + If Request.Url.Host.ToUpper().Contains("FERRETERA".ToUpper()) Then tGrupoEmpresa = "FERRETERA" + + Dim ObjUsuario As New ClsSisUsuarios(NombreCadena:=NombreCadena) Usuario = ObjUsuario.ValidaUsuario(gvr.DataKey("Usuario"), gvr.DataKey("Contraseña"), CveEmpresa:=gvr.DataKey("CveEmpresa").ToEntero) ObjUsuario.Dispose() @@ -138,9 +154,25 @@ Partial Class PopUpSeleccionarEmpresa Dim gvr As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).BindingContainer, GridViewRow) If gvr IsNot Nothing Then - - Dim ObjUsuario As New ClsSisUsuarios - Dim Usuario As Usuario = Nothing + Dim tGrupoEmpresa As String = "" + Dim NombreCadena As String = "Conexion" + Dim Usuario As Usuario = Nothing + If Request.Url.Host.ToUpper().Contains("EMD".ToUpper()) Then tGrupoEmpresa = "EMD" + If Request.Url.Host.ToUpper().Contains("BDH".ToUpper()) Then tGrupoEmpresa = "BDH" + If Request.Url.Host.ToUpper().Contains("ECONOLLANTAS".ToUpper()) Then tGrupoEmpresa = "ECONOLLANTAS" : NombreCadena = "Conexion" + If Request.Url.Host.ToUpper().Contains("JAM".ToUpper()) Then tGrupoEmpresa = "JAM" + If Request.Url.Host.ToUpper().Contains("CITRUS".ToUpper()) Then tGrupoEmpresa = "CITRUS" + If Request.Url.Host.ToUpper().Contains("KINO".ToUpper()) Then tGrupoEmpresa = "KINO" + If Request.Url.Host.ToUpper().Contains("VSH".ToUpper()) Then tGrupoEmpresa = "VSH" + If Request.Url.Host.ToUpper().Contains("AJAM".ToUpper()) Then tGrupoEmpresa = "AJAM" + If Request.Url.Host.ToUpper().Contains("ALATEL".ToUpper()) Then tGrupoEmpresa = "ALATEL" + If Request.Url.Host.ToUpper().Contains("SERVEC".ToUpper()) Then tGrupoEmpresa = "SERVEC" + If Request.Url.Host.ToUpper().Contains("SMS".ToUpper()) Then tGrupoEmpresa = "SMS" + If Request.Url.Host.ToUpper().Contains("VYA".ToUpper()) Then tGrupoEmpresa = "VYA" + If Request.Url.Host.ToUpper().Contains("GRUPODIAZ".ToUpper()) Then tGrupoEmpresa = "GRUPODIAZ" + If Request.Url.Host.ToUpper().Contains("FERRETERA".ToUpper()) Then tGrupoEmpresa = "FERRETERA" + + Dim ObjUsuario As New ClsSisUsuarios(NombreCadena:=NombreCadena) Usuario = ObjUsuario.ValidaUsuarioPortalProveedor(gvr.DataKey("CveProveedor").ToEntero(), gvr.DataKey("Usuario"), gvr.DataKey("Contraseña")) ObjUsuario.Dispose() diff --git a/Sistemas/SessionesActivas.aspx b/Sistemas/SessionesActivas.aspx index a61a989a3..312a880fb 100644 --- a/Sistemas/SessionesActivas.aspx +++ b/Sistemas/SessionesActivas.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="SessionesActivas.aspx.vb" Inherits="SessionesActivas" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="SessionesActivas.aspx.vb" Inherits="SessionesActivas" EnableEventValidation="false" %> diff --git a/Sistemas/SessionesActivas.aspx.vb b/Sistemas/SessionesActivas.aspx.vb index 1dad46c59..8e1823580 100644 --- a/Sistemas/SessionesActivas.aspx.vb +++ b/Sistemas/SessionesActivas.aspx.vb @@ -1,6 +1,7 @@  Imports System.Data Imports Extensiones +Imports Microsoft.AspNet.SignalR Partial Class SessionesActivas Inherits System.Web.UI.Page @@ -190,10 +191,9 @@ Partial Class SessionesActivas End Sub Protected Sub LnkEnviar_Click(sender As Object, e As EventArgs) - Dim lista As New List(Of String) - lista.Add(RCveUsuario) - 'Notificaciones.AlertaVentana(TxtMensaje.Text, lista) - Notificaciones.AlertaVentana(TxtMensaje.Text, lista, timeoutseconds:=0) + Dim mensaje = TxtMensaje.Text.Trim() + "
    Liga" + ClsSisNotificaciones.EnviarAlerta("Aviso", mensaje, RCveUsuario, Tipo:=TipoNotificacion.ToastInformacionB) + RegistraScript($"$(""#DivMensaje"").modal('hide');console.log('{Decripta(Context.User.Identity.Name)}')") End Sub diff --git a/Sistemas/UsuarioDetalle.aspx.vb b/Sistemas/UsuarioDetalle.aspx.vb index a67afdb37..b8980a3bd 100644 --- a/Sistemas/UsuarioDetalle.aspx.vb +++ b/Sistemas/UsuarioDetalle.aspx.vb @@ -1384,8 +1384,10 @@ Partial Class Sistemas_UsuarioDetalle GlobalDTAlmacenUsuarios(-1, tCveEmpresa) = Nothing GlobalDTUsuarioResponsable(tCveEmpresa) = Nothing GlobalDTUsuarios(CveEmpresa:=tCveEmpresa) = Nothing - GlobalDTUsuarios(CveEmpresa:=-1) = Nothing + GlobalDTUsuarios(CveEmpresa:=tCveEmpresa) = Nothing + 'si hay diferencia en la empresa asignada y la asociada. + If tCveEmpresa <> DdlEmpresa.SelectedValue.ToEntero Then GlobalDTUsuarios(CveEmpresa:=DdlEmpresa.SelectedValue.ToEntero) = Nothing 'If ObjUsuarios.GetUsuariosEmpresas(-1, UsuarioActual.CveEmpresa) Then ' Application("GlobalDTUsuarios") = ObjUsuarios.DtResultados @@ -1732,8 +1734,15 @@ Partial Class Sistemas_UsuarioDetalle Private Sub CargaDtSubProyectos() Dim ClsUsuarios As New ClsSisUsuarios - If ClsUsuarios.GetSubProyectos(CveUsuario) Then - DtSubProyectos = ClsUsuarios.DtResultados + If ClsUsuarios.GetSubProyectos(CveUsuario) Then + + DtSubProyectos = ClsUsuarios.DtResultados + If Not CveUsuario > 0 Then + DtSubProyectos.Rows.Clear() + DtSubProyectos.AcceptChanges() + End If + + Else DtSubProyectos = Nothing Alert("Ocurrió un Error al cargar los SubProyectos del Usuario. Por favor vuelva a intentar", TipoMensaje.MsgError) @@ -2254,8 +2263,15 @@ Partial Class Sistemas_UsuarioDetalle DdlCuentasBancarias.DataBind() DdlCuentasBancarias.Items.Insert(0, New ListItem("Seleccione", "-1")) End Sub - Private Sub CargaDtCuentasBancarias() + Private Sub CargaDtCuentasBancarias() + DtCuentasBancarias = GlobalDTBancosCuentas(CveUsuario, -1, -1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros($"CveEmpresa = {DdlEmpresaAsignaciones.SelectedValue}") + + If Not CveUsuario > 0 Then + DtCuentasBancarias.Rows.Clear() + DtCuentasBancarias.AcceptChanges() + End If + DtCuentasBancarias.Columns.Add("Accion", GetType(Integer)) CargaGvCuentasBancarias() diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index dbafeca6b..51d1e7939 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -62,7 +62,7 @@ Partial Class RepContratosCalendario Private Sub CargaCronograma(Optional TipoVista As Integer = -1) If DtAvance IsNot Nothing Then - Dim DtUnidades As DataTable = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros("Codigo <> '' AND MedidaVehicular IN (2,3)", " SubTipoActivoFijo DESC ", {"Codigo", "CveActivoFijo"}) + Dim DtUnidades As DataTable = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros("Codigo <> '' AND MedidaVehicular IN (2,3)", Orderby:=" SubTipoActivoFijo DESC, CodigoNumeroOrden ASC", DistinctColumns:={"Codigo", "CveActivoFijo"}) 'For Each Row As DataRow In DtAvance.Rows ' If String.IsNullOrEmpty(Row("CodigoAF").ToString()) Then diff --git a/UserControl/AddMedico.ascx b/UserControl/AddMedico.ascx index 744d019e3..1a23f6140 100644 --- a/UserControl/AddMedico.ascx +++ b/UserControl/AddMedico.ascx @@ -147,11 +147,13 @@
    - - Mensual - Quincenal - Semanal + 15d próximo mes + 15d próxima quincena + 7d pago inmediato 2d + 15d pago inmediato + 30d próxima quincena - +
    diff --git a/Ventas/CatClientes.aspx b/Ventas/CatClientes.aspx index fb29a26ab..da087eb92 100644 --- a/Ventas/CatClientes.aspx +++ b/Ventas/CatClientes.aspx @@ -17,9 +17,7 @@
  • Personalizar
  • - <%--
  • - Agregar Corporativo -
  • --%> +
  • Unificar Clientes
  • @@ -34,29 +32,28 @@ -
    -
    +
    +
    - "> -
    -
    -
    Nombre:
    -
    +
    + +
    Nombre:
    +
    -
    RFC:
    -
    +
    RFC:
    +
    -
    Estatus:
    -
    +
    Estatus:
    +
    Todos Activo @@ -64,9 +61,20 @@
    -
    + <%--
    -
    +
    --%> + +
    + Permite Crédito: +
    +
    + + Todos + Si + No + +
    @@ -75,18 +83,18 @@
    >
    -
    Sucursal:
    -
    +
    Sucursal:
    +
    -
    Clasif:
    -
    +
    Clasificación:
    +
    -
    Tipo:
    -
    +
    Tipo:
    +
    Todos Frecuente @@ -94,10 +102,10 @@
    -
    +
    Vendedor:
    -
    +
    @@ -105,6 +113,7 @@
    +
    @@ -121,8 +130,9 @@ -
    - + + + <%-- - + --%> -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Nombre Corto - - - - - - No Ext - - - - - - No Int - - - - - - Colonia - - - - - - Ciudad - - - - - - Estado - - - - - - País - - - - - - CP - - - - - - Contacto - - - - - - Correo Env. Factura - - - - - - Recepción Facturas - - - - - - Ret IVA - - - - - - Ret ISR - - - - - - Plazo Cobranza - - - - - - Límite Crédito - - - - - +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Nombre Corto + + + + + + No Ext + + + + + + No Int + + + + + + Colonia + + + + + + Ciudad + + + + + + Estado + + + + + + País + + + + + + CP + + + + + + Contacto + + + + + + Correo Env. Factura + + + + + + Recepción Facturas + + + + + + Ret IVA + + + + + + Ret ISR + + + + + + Plazo Cobranza + + + + + + Límite Crédito + + + + + - <%-- - CIE - - - - --%> + + Calle + + + + + + Celular + + + + + + Correo Env. Cotización + + + + + + Otro Telefono + + + + + + Permite Crédito + + + + + + F Limite Crédito + + + + + + +
    - - Calle - - - - - - Celular - - - - - - Correo Env. Cotización - - - - - - Otro Telefono - - - - - - F Limite Crédito - - - - - - - - - - - +
    - + + + + + diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 42949077a..eb52f60bb 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -1099,4 +1099,26 @@ Partial Class Ventas_PVCobranza #End Region + + Protected Sub LnkCobrosEnTranscurso_Click(sender As Object, e As EventArgs) + + Dim ObjMovtos As New ClsMovimientos() + Dim FechaI, FechaF As Date + + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1) + + If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero, FechaI, FechaF) Then + + Dim dtt As DataTable = ObjMovtos.DtResultados.FiltraParametros($"CveVenta > 0 AND CveUsuarioCobranza > 0 ") + GvModalCobrosEnTranscurso.DataSource = dtt + + End If + + ObjMovtos.Dispose() + GvModalCobrosEnTranscurso.DataBind() + UpDVModalCobrosEnTranscurso.Update() + RegistraScript("$('#DVModalCobrosEnTranscurso').modal('show');") + + End Sub End Class diff --git a/Ventas/RepAnticipo-NC-IXCDetalle.aspx.cs b/Ventas/RepAnticipo-NC-IXCDetalle.aspx.cs index 94d71c882..af42ae3fd 100644 --- a/Ventas/RepAnticipo-NC-IXCDetalle.aspx.cs +++ b/Ventas/RepAnticipo-NC-IXCDetalle.aspx.cs @@ -358,7 +358,8 @@ public partial class Ventas_RepAnticipo_NC_IXCDetalle : ClsPaginas CveIE = Gv.DataKey("CveIE").ToEntero(); Saldo = Gv.DataKey("Saldo").ToDecimal(); SaldoAdmin = Saldo; - } + } + Saldo = -Saldo; // invertimos el saldo para que se haga negativo para que sea ABono ImporteTotalGasto += Saldo; if (!ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, SaldoAdmin, Saldo, ConPreP.CveConcepto, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE: CveIE, CveVenta, CveCliente: Gv.DataKey("CveCliente").ToEntero())) diff --git a/Ventas/RepComisionesSMS.aspx b/Ventas/RepComisionesSMS.aspx index 716a17efd..172a5b8ed 100644 --- a/Ventas/RepComisionesSMS.aspx +++ b/Ventas/RepComisionesSMS.aspx @@ -19,6 +19,9 @@
  • +
  • +
  • +
  • Excel @@ -112,12 +115,7 @@
  • - - - - - - +
    @@ -138,21 +136,19 @@ - - - - - + + + + + - + - - - - - + + + @@ -162,53 +158,7 @@ - - - - - - - - -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    - - -
    -
    -
    -
    - - - - - - - - + + + + + + diff --git a/Ventas/RepComisionesSMS.aspx.vb b/Ventas/RepComisionesSMS.aspx.vb index ebee4433a..5ec007988 100644 --- a/Ventas/RepComisionesSMS.aspx.vb +++ b/Ventas/RepComisionesSMS.aspx.vb @@ -2,7 +2,9 @@ Option Strict On Imports System.Data +Imports System.Data.Entity Imports Extensiones +Imports Microsoft.EntityFrameworkCore Partial Class Ventas_RepComisionesSMS @@ -59,8 +61,6 @@ Partial Class Ventas_RepComisionesSMS Public Sub CargaDatos() - - LnkExportar.Visible = False Dim ObjVentas As New ClsVentas @@ -83,39 +83,11 @@ Partial Class Ventas_RepComisionesSMS End Sub - Public Sub CargaDatosEspeciales() - - - - LnkExportar.Visible = False - - Dim ObjVentas As New ClsVentas - - If ObjVentas.GetComisionesMedicasRep(txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, UsuarioActual.CveEmpresa, -1, -1, DdlMedico.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuarioAtendio.SelectedValue.ToEntero, -1, 2) Then - GvDatosEspeciales.DataSource = ObjVentas.DtResultados - - If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - LnkExportar.Visible = True - End If - Else - GvDatosEspeciales.DataSource = Nothing - End If - - ObjVentas.Dispose() - - GvDatosEspeciales.DataBind() - - UpDatosEspeciales.Update() - - End Sub - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - If Tabs.ActiveTabIndex = 0 Then - CargaDatos() - Else - CargaDatosEspeciales() - End If + + CargaDatos() + End Sub @@ -123,19 +95,12 @@ Partial Class Ventas_RepComisionesSMS Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click - Dim SbFiltros As New StringBuilder() SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|") - - If Tabs.ActiveTabIndex = 0 Then - GvDatos.Columns(10).Visible = False + GvDatos.Columns(10).Visible = False GvDatos.ExportToExcelGembox("Comisiones", UsuarioActual, "Comisiones", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) - GvDatos.Columns(10).Visible = True - Else - GvDatosEspeciales.ExportToExcelGembox("Comisiones", UsuarioActual, "Comisiones Especiales", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) - End If - + GvDatos.Columns(10).Visible = True End Sub @@ -248,4 +213,149 @@ Partial Class Ventas_RepComisionesSMS End If End Sub + +#Region "COMISIONES ESPECIALES" + + Protected Sub LnkComisionesEspeciales_Click(sender As Object, e As EventArgs) + + ReiniciaModalComisionesEspeciales() + + CargaComisionesEspeciales() + RegistraScript("$('#DvModalComisionesEspeciales').modal('show');") + + End Sub + + + Private Sub ReiniciaModalComisionesEspeciales() + + DdlModalTipoComision.SelectedValueExist(-1) + + DdlModalMedico.SelectedValue = Nothing + DdlModalMedico.ClearSelection() + DdlModalMedico.Items.Clear() + DdlModalMedico.DataSource = GlobalDTMedicos(UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True' ") + DdlModalMedico.DataBind() + DdlModalMedico.Items.Insert(0, New ListItem("Todos", "-1")) + + + DdlModalPS.SelectedValue = "-1" + DdlModalPS.SelectedValue = "" + DdlModalPS.SelectedText = "" + + Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + If EsWS Then + DdlModalPS.setEsWebService(True) + Else + + DdlModalPS.ddl.SelectedValue = Nothing + DdlModalPS.ddl.ClearSelection() + DdlModalPS.ddl.Items.Clear() + + + 'Objeto.ddl.DataSource = GlobalDTProductosServicios(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, AplicaParaVenta:=1, Estatus:=1) + DdlModalPS.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, Estatus:=1) + DdlModalPS.ddl.DataBind() + DdlModalPS.ddl.Items.Insert(0, New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2")) + DdlModalPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + + DdlModalPS.setEsWebService(False) + End If + + TxtModalComision.Text = "" + + UpModalComisionesEspeciales.Update() + + End Sub + Private Sub CargaComisionesEspeciales() + + Dim ObjVentas As New ClsVentas + GvComisionesEspeciales.DataSource = Nothing + If ObjVentas.GetComisionesMedicasEsPeciales(-1, -1, UsuarioActual.CveEmpresa) Then + GvComisionesEspeciales.DataSource = ObjVentas.DtResultados + End If + ObjVentas.Dispose() + GvComisionesEspeciales.DataBind() + UpModalComisionesEspeciales.Update() + End Sub + + Protected Sub LnkEliminarComisionEspecial_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim CveMedicoComision As Integer = GvRow.DataKey("CveMedicoComision").ToEntero + + If CveMedicoComision > 0 Then + Dim errorProceso As Boolean = False + + Dim ObjVentas As New ClsVentas + + If ObjVentas.RemoveComisionesMedicasEspeciales(CveMedicoComision, UsuarioActual.CveEmpresa) Then + Alert("Comisión eliminada correctamente") + Else + errorProceso = True + End If + + ObjVentas.Dispose() + + + If Not errorProceso Then + CargaComisionesEspeciales() + End If + + End If + + + End Sub + +#End Region + + + Protected Sub DdlModalTipoComision_SelectedIndexChanged(sender As Object, e As EventArgs) + + TxtModalComision.Text = "" + + If DdlModalTipoComision.SelectedValue.ToEntero = 1 Then + TxtModalComision.Attributes.Add("onkeyup", "FormatoMoneda(this)") + Else + TxtModalComision.Attributes.Add("onkeyup", "FormatoMoneda(this);validaPorcentaje(this);") + End If + + UpModalComisionesEspeciales.Update() + + End Sub + + Protected Sub LnkModalGuardarComisionEspecial_Click(sender As Object, e As EventArgs) + + If DdlModalPS.SelectedValue.ToEntero <= 0 Then + Alert("Debe de seleccionar un producto.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If TxtModalComision.Text.ToDecimal = 0 Then + Alert("La comisión es requerida.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim errorProceso As Boolean = False + + Dim Comision As Decimal = TxtModalComision.Text.ToDecimal + + If DdlModalTipoComision.SelectedValue.ToEntero = 2 Then + Comision = TxtModalComision.Text.ToDecimal / 100 + End If + + Dim ObjVentas As New ClsVentas + + If ObjVentas.AddComisionesMedicasEspeciales(DdlModalMedico.SelectedValue.ToEntero, DdlModalPS.SelectedValue.ToEntero, DdlModalTipoComision.SelectedValue.ToEntero, Comision, UsuarioActual.CveUsuario) Then + Alert("Comisión agregada correctamente") + Else + errorProceso = True + End If + + ObjVentas.Dispose() + + If Not errorProceso Then + CargaComisionesEspeciales() + ReiniciaModalComisionesEspeciales() + End If + + End Sub End Class diff --git a/Ventas/RepPS.aspx b/Ventas/RepPS.aspx index 05a9045a4..f8f5baef0 100644 --- a/Ventas/RepPS.aspx +++ b/Ventas/RepPS.aspx @@ -88,7 +88,7 @@
    SubProyecto:
    - +
    Fecha Inicio: diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb index 43fb8e8ac..8a6227ec3 100644 --- a/Ventas/RepPS.aspx.vb +++ b/Ventas/RepPS.aspx.vb @@ -54,7 +54,7 @@ Partial Class Ventas_RepPS End Sub Private Sub CargaCombos() - CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto) + CargarCentrosDeCosto(Nothing, DdlSubProyectos, Nothing, LblSubProyecto) DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) DdlClasificacion.DataBind() @@ -75,14 +75,15 @@ Partial Class Ventas_RepPS DivMarca.Visible = True LblMarca.Visible = True LblLinea.Visible = True - DivLinea.Visible = True - - Using ObjMarcas As New ClsProductosServicios - If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then - DdlMarcaPSDes.DataSource = ObjMarcas.DtResultados - DdlMarcaPSDes.DataBind() - End If - End Using + DivLinea.Visible = True + + DdlMarcaPSDes.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) + 'Using ObjMarcas As New ClsProductosServicios + ' If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then + ' DdlMarcaPSDes.DataSource = ObjMarcas.DtResultados + ' DdlMarcaPSDes.DataBind() + ' End If + 'End Using End If DdlLinea.DataSource = GlobalDTClasificacionesDetalle(UsuarioActual.CveEmpresa) @@ -95,7 +96,8 @@ Partial Class Ventas_RepPS Dim Clasificacion As String = If(DdlClasificacion.GetSelectedValuesM = "", "-1", DdlClasificacion.GetSelectedValuesM) Dim Linea As String = If(DdlLinea.GetSelectedValuesM = "", "-1", DdlLinea.GetSelectedValuesM) Dim Marca As String = If(DdlMarcaPSDes.GetSelectedValuesM = "", "-1", DdlMarcaPSDes.GetSelectedValuesM) - Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero() + 'Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero() + Dim CveSubProyectos As String = If(DdlSubProyectos.GetSelectedValuesM = "", "-1", DdlSubProyectos.GetSelectedValuesM) Dim Grupo As Integer = DdlGrupo.SelectedValue.ToEntero() Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero() Dim CveMoneda As Integer = -1 @@ -106,7 +108,7 @@ Partial Class Ventas_RepPS FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) Dim ObjVentas As New ClsVentas() - If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico, Clasificacion:=Clasificacion, Linea:=Linea, Marca:=Marca, orden:=DdlOrden.SelectedValue.ToEntero()) Then + If ObjVentas.GetRepPSEcono(CveSubProyectos, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico, Clasificacion:=Clasificacion, Linea:=Linea, Marca:=Marca, orden:=DdlOrden.SelectedValue.ToEntero()) Then DtReporte = ObjVentas.DtResultados.Copy() GvDatos.DataSource = DtReporte Else @@ -167,7 +169,7 @@ Partial Class Ventas_RepPS FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) If DtReporte IsNot Nothing AndAlso DtReporte.Rows.Count > 0 Then Dim SbParametros As New StringBuilder - SbParametros.AppendFormat("Sucursal:{0}", DdlSubProyecto.SelectedItem.Text) + SbParametros.AppendFormat("Sucursal:{0}", DdlSubProyectos.GetSelectedText) SbParametros.AppendFormat(", Orden:{0}", DdlGrupo.SelectedItem.Text) Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") diff --git a/Ventas/RepVencimientosCredito.aspx b/Ventas/RepVencimientosCredito.aspx index 4e0d07699..6e137229f 100644 --- a/Ventas/RepVencimientosCredito.aspx +++ b/Ventas/RepVencimientosCredito.aspx @@ -113,144 +113,38 @@ -
    " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
    -
    - -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    -
    - +
    - - + + - - - + - - - - - - - - - - - - - - - - - -
    -
    - - -
    -
    - -
    -
    -
    -
    - - -
    -
    -
    - - - -
    - - - - - <%-- MODAL COMPROBANTE --%> - - <%-- FIN MODAL COMPROBANTE --%> - - - - - + diff --git a/Ventas/RepVencimientosCredito.aspx.cs b/Ventas/RepVencimientosCredito.aspx.cs index 8c7d13ece..bcd923158 100644 --- a/Ventas/RepVencimientosCredito.aspx.cs +++ b/Ventas/RepVencimientosCredito.aspx.cs @@ -88,58 +88,20 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas LnkDescargaExcel.Visible = false; ClsVentas objVentas = new ClsVentas(); - - int CveProveedor = -1; - - if(TipoLinea == 1) + + if (objVentas.GetLineasAdicionalesVencimientos( DdlClientes.SelectedValue.ToEntero(), -1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveEmpresa)) { - if (objVentas.GetLineasAdicionalesVencimientos( DdlClientes.SelectedValue.ToEntero(), 1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveEmpresa)) - { - GvD.DataSource = objVentas.DtResultados; + GvD.DataSource = objVentas.DtResultados; - if (objVentas.DtResultados.Rows.Count > 0) - { - DTDatosGvD = objVentas.DtResultados; - LnkDescargaExcel.Visible = true; - UpAcciones.Update(); - } - } - else + if (objVentas.DtResultados.Rows.Count > 0) { - GvD.DataSource = null; + DTDatosGvD = objVentas.DtResultados; + LnkDescargaExcel.Visible = true; + UpAcciones.Update(); } } - else - { - - if (DdlAgrupador.SelectedValue.ToEntero()== 1){ - GvLAPO.Columns[0].HeaderText = "Comercializador"; - } - else - { - GvLAPO.Columns[0].HeaderText = "Cliente"; - } - - if (objVentas.RepLineasAdicionales(DdlAgrupador.SelectedValue.ToEntero(), -1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 2, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa)) - { - GvLAPO.DataSource = objVentas.DtResultados; - - if (objVentas.DtResultados.Rows.Count > 0) - { - DTDatosGvD = objVentas.DtResultados; - LnkDescargaExcel.Visible = true; - UpAcciones.Update(); - } - } - else - { - GvLAPO.DataSource = null; - } - } - objVentas.Dispose(); GvD.DataBind(); - GvLAPO.DataBind(); UpLineasAdicionales.Update(); } @@ -155,116 +117,7 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas RegistraScript("$('#ModalComprobante').modal('show');",""); } - protected void BtnAddComprobante_Click(object sender, EventArgs e) - { - bool errorCargaComprobante = false; - string FileExtension = "-1"; - List filesgral = Anexo.getfiles().Archivos; - string filemove = ""; - FileInfo fiNuevo; - - DirectoryInfo df = new DirectoryInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\"); - - //Crea directorio si no existe - if (!df.Exists) - { - try - { - Directory.CreateDirectory(df.FullName); - } - catch - { - errorCargaComprobante = true; - } - } - - //borrar archivo anterior - if((!errorCargaComprobante) && LineaAdicionalComprobante.Length > 0) - { - FileInfo fiAnterior = new FileInfo($@"{df.FullName}{LineaAdicionalComprobante}"); - if (fiAnterior.Exists) - { - try - { - File.Delete(fiAnterior.FullName); - } - catch - { - errorCargaComprobante = true; - } - } - } - - if(!errorCargaComprobante){ - - string RutaArchivoTemp = ""; - foreach (Archivo fileItem in filesgral) - { - FileExtension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", ""); - filemove = fileItem.filename; - RutaArchivoTemp = $@"{AppDomain.CurrentDomain.BaseDirectory}\Temp\{fileItem.filename}"; - break; - } - - if((!errorCargaComprobante) && RutaArchivoTemp.Length > 0) - { - fiNuevo = new FileInfo(RutaArchivoTemp); - - if (fiNuevo.Exists) - { - try - { - if (File.Exists($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}")) - { - File.Delete($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"); - } - File.Move(fiNuevo.FullName, $@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"); - errorCargaComprobante = false; - } - catch - { - errorCargaComprobante = true; - } - if (!errorCargaComprobante) - { - ClsVentas objVentas = new ClsVentas(); - if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicional, CveVenta, $@"{CveVenta}{fiNuevo.Extension}", -1, UsuarioActual.CveEmpresa)) - { - errorCargaComprobante = true; - } - objVentas.Dispose(); - } - } - } - } - - if (!errorCargaComprobante) - { - CargaDatos(); - Anexo.Text = "[]"; - RegistraScript("$('#ModalComprobante').modal('hide');", ""); - Alert("Comprobante actualizado correctamente."); - } - UpAddComprobancte.Update(); - } - - protected void LnkCambiarEstatus_Click(object sender, EventArgs e) - { - GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer; - int CveLineaAdicionalActualzarEstatus = GvRow.DataKey("CveLineaAdicional").ToEntero(); - int CveVenta = GvRow.DataKey("CveVenta").ToEntero(); - bool errorCambioEstatus = false; - ClsVentas objVentas = new ClsVentas(); - if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicional, CveVenta, "", 2, UsuarioActual.CveEmpresa)) - { - errorCambioEstatus = true; - } - if (!errorCambioEstatus) - { - CargaDatos(); - } - objVentas.Dispose(); - } + protected void LnkDescargaExcel_Click(object sender, EventArgs e) { @@ -273,14 +126,7 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas GridView gvTemp = GvD; //gvTemp.ExportToExcelX("RepLineasAdicionales" + NowADS().ToShortDateString()); gvTemp.ExportToExcelGembox("RepLineasAdicionales", UsuarioActual, "Rep Lineas Adicionales", AnchoImagen: 150); - } - else if(TipoLinea == 2) - { - GridView gvTemp = GvLAPO; - gvTemp.Columns[12].Visible = false; - //gvTemp.ExportToExcelX("ReportePO" + NowADS().ToShortDateString()); - gvTemp.ExportToExcelGembox( "ReportePO", UsuarioActual, "Reporte PO ", AnchoImagen:150); - } + } } protected void GvLAPO_RowDataBound(object sender, GridViewRowEventArgs e) @@ -351,28 +197,6 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas } } - protected void GvLAPO_RowCommand(object sender, GridViewCommandEventArgs e) - { - if (e.CommandName == "Estatus") - { - GridViewRow GvRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer; - int CveLineaAdicionalActualizarEstatus = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero(); - int CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero(); - - bool errorCambioEstatus = false; - //int cveestatus = e.CommandArgument.ToEntero() + 2; //pasar al siguiente estatus - - ClsVentas objVentas = new ClsVentas(); - if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicionalActualizarEstatus, CveVenta,"", 2, UsuarioActual.CveEmpresa)) - { - errorCambioEstatus = true; - } - objVentas.Dispose(); - if (!errorCambioEstatus) - { - CargaDatos(); - } - } - } + } \ No newline at end of file diff --git a/Ventas/RepVentas.aspx.vb b/Ventas/RepVentas.aspx.vb index 2adae64a3..5939e44d1 100644 --- a/Ventas/RepVentas.aspx.vb +++ b/Ventas/RepVentas.aspx.vb @@ -125,6 +125,13 @@ Partial Class Ventas_RepVentas LnkDescargaCartaPorte.Visible = True End If + If Opcion = "Cot" Then + DdlTipoComprobante.SelectedValuesIfExistM(Opcion) + DdlGrupo.SelectedValueExist("7") + DdlTipoComprobante_SelectedIndexChanged(DdlTipoComprobante, EventArgs.Empty) + DdlEstatus.ClearSelection() + End If + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then LblServicioDomicilioFiltro.Visible = True DVServicioDomicilio.Visible = True diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index a2e1f750a..00999f431 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="Ventas - Facturación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Ventas.aspx.vb" Inherits="Ventas" EnableEventValidation="false" %> +<%@ Page Title="Ventas - Facturación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Ventas.aspx.vb" Inherits="Ventas" EnableEventValidation="false" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <%@ Register Src="~/UserControl/AddMedico.ascx" TagPrefix="UserControl" TagName="AddMedico" %> @@ -391,7 +391,7 @@
  • Solicitar autorización de crédito
  • -
  • +
  • Cancelar solo CFDI
  • @@ -614,29 +614,29 @@ Paciente: - + Episodio: - + + + + + + Folio Remisión: + + + + + + Tipo de Venta: + + + - - - Folio Remisión: - - - - - - Tipo de Venta: - - - - -
    @@ -758,12 +758,12 @@ Fecha:
    - + - + - + @@ -892,88 +892,88 @@ - + - -
    -
    - - Estatus -
    -
    -
    -
    -
    +
    +
    + + Estatus -
    - +
    +
    +
    -
    - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +
    Corte:  - -
    Saldo:  - <%--   --%> - - -
    Estatus:  - - <%-- +
    + +
    + +
    + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - -
    Corte:  + +
    Saldo:  + <%--   --%> + + +
    Estatus:  + + <%--
    Contabilizada: - - - <%-- --%> - <%----%> -
    Se timbró:  -
    Envió Mail:  -
    Usuario creó:  -
    Fecha registró:  -
    - -
    -
    - +
    Contabilizada: + + + <%-- --%> + <%----%> +
    Se timbró:  +
    Envió Mail:  +
    Usuario creó:  +
    Fecha registró:  +
    + +
    +
    + @@ -3491,7 +3491,7 @@
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
    @@ -4485,7 +4485,7 @@