diff --git a/AF/AF.aspx b/AF/AF.aspx index 8ce476197..506805e0f 100644 --- a/AF/AF.aspx +++ b/AF/AF.aspx @@ -3058,7 +3058,7 @@ - + diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 7a39219a4..da147e2c4 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -4446,5 +4446,312 @@ Public Class ClsBancos End Function +#Region "N O T I F I C A C I O N E S D E P A G O P R O V E E D O R E S" + + Public Function NotificacionPago(CveIENotificar As Integer, CorreoNotificarA As String, CopiaPara As String, UsuarioActual As Usuario) As Boolean + + Dim RutaComprobante As String = "" + If GetBancosIE(CveIENotificar, UsuarioActual.CveEmpresa) Then + RutaComprobante = Comprobante + End If + + + Dim Body As String = GeneraCorreo(CveIENotificar, UsuarioActual) + 'Dim Comprobante As String = "" + + Dim File As Byte() = Nothing + + + 'If MostrarConfirmacion Then + Return MandaCorreo(CorreoNotificarA, "Notificaciones de pago", Body, RutaComprobante, File, UsuarioActual, CopiaPara) + 'Else + ' Dim Hilo As New Threading.Thread(Sub() MandaCorreo(CorreoNotificarA, "Notificaciones de pago", Body, RutaComprobante, File, UsuarioActual, MostrarConfirmacion, CopiaPara)) + ' Hilo.Start() + 'End If + + + End Function + + Private Function MandaCorreo(Para As String, Asunto As String, Body As String, RutaComprobante As String, File As Byte(), UsuarioActual As Usuario, CopiaPara As String) As Boolean + + Dim Respuesta As Boolean = False + + Try + Dim Mail As New ClsSisMail() + Para = If(Para IsNot Nothing, Para, "") + Asunto = If(Asunto IsNot Nothing, Asunto, "") + Body = If(Body IsNot Nothing, Body, "") + + Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail) + + If RutaComprobante IsNot Nothing AndAlso RutaComprobante <> "" Then + ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaComprobante}) + End If + + If File IsNot Nothing Then + ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoCuentaCxP.pdf"}) + End If + + Dim separador As Char() = {";"c, ","c} + Dim strArray As String() = Para.Split(separador) + + Para = "" + + For Each sCorreo As String In strArray + If ClsSisMail.IsMailShared(sCorreo) And sCorreo.Trim.Length > 0 Then + Para = $"{Para}{sCorreo};" + End If + Next + + + If Para.Length > 0 Then + + Para = Para.Substring(0, Para.Length - 1) + + If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=ListaArchivos, Displayname:=$"SIG Notificaciones: Pago de {UsuarioActual.Empresa.Empresa}", CCP:=CopiaPara) Then + + Respuesta = True + 'If MostrarConfirmacion Then + ' Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + 'End If + + + + 'If MostrarConfirmacion Then + ' Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError) + 'End If + + End If + + End If + + + Catch ex As Exception + OnError("Ocurrio un error al enviar el correo", ex) + + + End Try + + Return Respuesta + + End Function + + Private Function GeneraCorreo(CveIENotificar As Integer, UsuarioActual As Usuario) As String + + Dim strBody As New StringBuilder + + + If GetBancosIE(CveIENotificar, UsuarioActual.CveEmpresa) Then + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" {0}", UsuarioActual.Empresa.Empresa) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Direccion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Colonia) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.RFC) + strBody.AppendFormat(" ") + strBody.AppendFormat("
{0}
Col. {0}
{0}, {1}, C.P.{2}
RFC {0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("


") + + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + + If CveTipoTransaccion = 1 Then ' cuando es cheque + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + End If + + If CveTipoTransaccion.Contiene(2, 9, 17) Then ' cuando es transf + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + End If + + + strBody.Append(" ") + strBody.AppendFormat(" ") + strBody.Append(" ") + strBody.Append("
Favor de pasar a nuestras oficinas por el cheque con la siguientes instrucciones.
Notificación de transferencia de pago realizada.
 
") + strBody.AppendFormat("
") + strBody.Append("
") + + + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" Beneficiario:{0} ", PagueseA) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", TipoTransaccion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", Banco) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", NumCuenta) + strBody.AppendFormat(" ") + If CuentaDepositado.ToString <> "" Then + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", CuentaDepositado) + strBody.AppendFormat(" ") + End If + + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", FechaDocumento.ToString("dd/MM/yyyy")) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", Importe.FormatoNumero, Moneda) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", Observaciones) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
Movimiento:{0}
Banco:{0}
Cuenta:{0}
Cuenta Destino:{0}
Fecha:{0}
Importe:$ {0} {1}
Observaciones:{0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + + + + + 'MOVIMIENTOS CHEQUE + If GetBancosIEMovimientos(CveIENotificar, UsuarioActual.CveEmpresa) Then + Dim Textov33 As String = "" + If UsuarioActual.Empresa.Funcionalidad(520) = "1" Then + Textov33 = "Favor de emitir complemento de pago de los siguientes documentos" + End If + + + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" Documentos abonados o pagados
{0}
", Textov33) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + + + For Each dr As DataRow In DtResultados.FiltraParametros("CveConceptoContable IN (17) AND CveCompra > 0").Rows + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", dr("Fecha").ToString.ToDate.ToShortDateString()) + strBody.AppendFormat(" ", dr("SerieFolio").ToString) + strBody.AppendFormat(" ", dr("Importe").ToString.FormatoNumero) + strBody.AppendFormat(" ", dr("FolioFiscal")) + strBody.AppendFormat(" ", dr("ImporteNC").ToString.FormatoNumero) + strBody.AppendFormat(" ") + Next + + + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
FechaFacturaImporte ($)Folio FiscalNC Aplicadas
{0}{0}$ {0}{0}{0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + End If + + strBody.Append("
Favor de no responder a este correo.
") + + strBody.Append("") + End If + + 'objIE.Dispose() + Return strBody.ToString + + End Function + +#End Region End Class diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 4ed4b5dd5..7a14674f8 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -166,6 +166,7 @@ Public Class ClsClientes Public Property CargoUsados As Boolean Public Property BonificacionUsado As Boolean + Public Property CveSATEstado As Integer Public ReadOnly Property DtResultados() As DataTable @@ -426,6 +427,7 @@ Public Class ClsClientes _RequiereOC = CBool(Data(0)("RequiereOC")) _CargoUsados = CBool(Data(0)("CargoUsado")) _BonificacionUsado = CBool(Data(0)("BonificacionUsado")) + _CveSATEstado = Data(0)("CveSATEstado").ToString.ToEntero End If Retorno = True @@ -574,7 +576,7 @@ Public Class ClsClientes Optional AplicaComercioExterior As Boolean = False, Optional CveTipoOperacion As Integer = -1, Optional CvePedimento As Integer = -1, Optional CveIncoterm As Integer = -1, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, 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") As Boolean + Optional CorreoEntregaCompras As String = "-1", Optional CorreoEntregaAlmacen As String = "-1", Optional CveSATEstado As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -714,6 +716,9 @@ Public Class ClsClientes .Add("@CorreoEntregaCompras", SqlDbType.VarChar).Value = CorreoEntregaCompras .Add("@CorreoEntregaAlmacen", SqlDbType.VarChar).Value = CorreoEntregaAlmacen + .Add("@CveSATEstado", SqlDbType.Int).Value = CveSATEstado + + End With Try SqlAdapter.Fill(Data) @@ -757,7 +762,8 @@ Public Class ClsClientes Optional AplicaComercioExterior As Boolean = False, Optional CveTipoOperacion As Integer = -1, Optional CvePedimento As Integer = -1, Optional CveIncoterm As Integer = -1, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional CveMotivoTraslado As Integer = 0, Optional NumRegIdTrib As String = "-1", Optional ComExtEstado As String = "-1", Optional ComExtMunicipio As String = "-1", Optional ComExtColonia As String = "-1", 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") As Boolean + 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) As Boolean Dim Retorno As Boolean = False @@ -911,6 +917,10 @@ Public Class ClsClientes .Add("@CorreoEntregaCompras", SqlDbType.VarChar).Value = CorreoEntregaCompras .Add("@CorreoEntregaAlmacen", SqlDbType.VarChar).Value = CorreoEntregaAlmacen + .Add("@CveSATEstado", SqlDbType.Int).Value = CveSATEstado + + + End With Try SqlAdapter.Fill(Data) @@ -1011,21 +1021,41 @@ Public Class ClsClientes Return Retorno End Function - 'Public Function GetSucursales(CveCliente As Integer, CveClienteSucursal As Integer) As Boolean + + 'Public Function GetEstados(Optional ClaveSATPais As String = "-1") As Boolean ' Dim Retorno As Boolean = False - ' DataAdapter("PA_Vta_SucursalClientePopUpGet") - ' SqlAdapter.SelectCommand.Parameters.Add("@CveCliente", SqlDbType.Int).Value = CveCliente - ' SqlAdapter.SelectCommand.Parameters.Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal + ' DataAdapter("PA_ClientesEstadosGet") + + ' SqlAdapter.SelectCommand.Parameters.Add("@ClaveSATPais", SqlDbType.VarChar).Value = ClaveSATPais + ' Try ' SqlAdapter.Fill(Data) ' Retorno = True ' Catch ex As Exception - ' OnError("Ocurrió un error al obtener el las Sucursales del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' OnError("Ocurrió un error al obtener el los estados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) ' End Try ' Return Retorno - 'End Function + 'End Function + + + + 'Public Function GetSucursales(CveCliente As Integer, CveClienteSucursal As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_Vta_SucursalClientePopUpGet") + ' SqlAdapter.SelectCommand.Parameters.Add("@CveCliente", SqlDbType.Int).Value = CveCliente + ' SqlAdapter.SelectCommand.Parameters.Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el las Sucursales del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function Public Function AddSucursal(CveCliente As Integer, Sucursal As String, CveUsuario As Integer, Ciudad As String, Colonia As String, CP As String, Direccion As String, Estado As String, Localidad As String, Pais As String, NoExt As String, NoInt As String, Telefono As String, Correo As String, CorreoCotizacion As String, Contacto As String, CveVendedor As Integer, NumCtaPago As String, CveMetodoPago As Integer, LimiteCredito As Decimal, CveResponsableSucursal As Integer, CveUsoCFDI As Integer, CveFormaPago33 As Integer, CveMetodoPago33 As Integer, Optional LT As String = "0", Optional LG As String = "0") As Boolean Dim Retorno As Boolean = False @@ -1566,8 +1596,8 @@ Public Class ClsClientes Return Retorno End Function - Public Function AgregarClienteNoFrecuente(Nombre As String, Direccion As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Ciudad As String, Estado As String, - Pais As String, RFC As String, CP As String, Telefono As String, Mail As String, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer, + Public Function AgregarClienteNoFrecuente(Nombre As String, Direccion As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Ciudad As String, CveEstado As Integer, + RFC As String, CP As String, Telefono As String, Mail As String, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer, NumCuentaPago As String, CveMetodoPago33 As Integer, CveFormaPago33 As Integer, Optional CvePrecioLista As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ClientesNoFrecuenteAdd") @@ -1580,8 +1610,8 @@ Public Class ClsClientes .Add("@Colonia", SqlDbType.VarChar).Value = Colonia .Add("@Localidad", SqlDbType.VarChar).Value = Localidad .Add("@Ciudad", SqlDbType.VarChar).Value = Ciudad - .Add("@Estado", SqlDbType.VarChar).Value = Estado - .Add("@Pais", SqlDbType.VarChar).Value = Pais + .Add("@CveEstado", SqlDbType.Int).Value = CveEstado + ' .Add("@Pais", SqlDbType.VarChar).Value = Pais .Add("@RFC", SqlDbType.VarChar).Value = RFC .Add("@CP", SqlDbType.VarChar).Value = CP .Add("@Telefono", SqlDbType.VarChar).Value = Telefono diff --git a/App_Code/ClsFISConfiguracion.vb b/App_Code/ClsFISConfiguracion.vb index 3ee63918e..a1d8ddf32 100644 --- a/App_Code/ClsFISConfiguracion.vb +++ b/App_Code/ClsFISConfiguracion.vb @@ -16,6 +16,7 @@ Public Class ClsFISConfiguracion Private SqlConexion As SqlConnection Private SqlAdapter As SqlDataAdapter Private SqlCommand As SqlCommand + Private SqlTransacc As SqlTransaction Private Data As DataTable 'Atributos de la clase @@ -23,6 +24,7 @@ Public Class ClsFISConfiguracion Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region #Region "Propiedades" @@ -42,20 +44,38 @@ Public Class ClsFISConfiguracion #End Region - Sub New() - SqlConexion = New SqlConnection - SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString - Try - SqlConexion.Open() - Catch ex As Exception - Me.OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) + + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True + End If + SqlAdapter = New SqlDataAdapter("", SqlConexion) ConexionAdd() + + End Sub + Private Sub DataAdapter(ByVal pStrSQL As String, Optional ByVal TipoComando As CommandType = CommandType.StoredProcedure) + With SqlAdapter.SelectCommand + .Parameters.Clear() + .CommandText = pStrSQL + .CommandType = TipoComando + End With + If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc + Data = New DataTable End Sub #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters @@ -87,21 +107,14 @@ Public Class ClsFISConfiguracion End If End Sub - Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) - With SqlAdapter.SelectCommand - .Parameters.Clear() - .CommandText = StrSQL - .CommandType = TipoComando - End With - Data = New DataTable - End Sub + #End Region Public Function GetConfiguracion(CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - Data = New DataTable - SqlAdapter = New SqlDataAdapter("PA_Fis_CuentaContablesGet", SqlConexion) - SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure + + DataAdapter("PA_Fis_CuentaContablesGet") + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa Try SqlAdapter.Fill(Data) @@ -117,16 +130,15 @@ Public Class ClsFISConfiguracion Catch ex As SqlException OnError("Ocurrió un error al consultar las Configuraciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try - SqlAdapter.Dispose() + Return Retorno End Function Public Function AddConfiguracion(ActIVAAcreditable As Integer, ActIVAxAcreditar As Integer, PasIVAPagar As Integer, PasIVAxPagar As Integer, EROtrosIngresos As Integer, ERDSV As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - Data = New DataTable - SqlAdapter = New SqlDataAdapter("PA_Fis_CuentaContablesAdd", SqlConexion) - SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure + + DataAdapter("PA_Fis_CuentaContablesAdd") With SqlAdapter.SelectCommand.Parameters .Add("@ActIVAAcreditable", SqlDbType.VarChar).Value = ActIVAAcreditable @@ -150,7 +162,7 @@ Public Class ClsFISConfiguracion Catch ex As Exception OnError("Ocurrió un error al Guardar la Configuración.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try - SqlAdapter.Dispose() + Return Retorno End Function diff --git a/App_Code/ClsGPS.vb b/App_Code/ClsGPS.vb index 1488d68ff..4f24d2b76 100644 --- a/App_Code/ClsGPS.vb +++ b/App_Code/ClsGPS.vb @@ -5365,6 +5365,109 @@ Public Class ClsGPS #End Region +#Region "R E C U R S O - C O N F I A B L E" + Public Function AddRCTracking(Nombre As String, CveDispositivo As Integer, Shipment As String, CveUsuarioIngreso As Integer, CveCliente As Integer, CveEmpresa As Integer) As Integer + Dim retorno As Integer = -1 + DataAdapter("PA_GPS_RC_TrackingAdd", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.VarChar).Value = Nombre + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@Shipment", SqlDbType.VarChar).Value = Shipment + .Add("@CveUsuarioIngreso", SqlDbType.Int).Value = CveUsuarioIngreso + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveRCTracking", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + retorno = SqlAdapter.SelectCommand.Parameters("@CveRCTracking").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error al agregar un tracking.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return retorno + End Function + + Public Function UpdateRCTrackingEstatus(CveRCTracking As Integer, CveEstatus As Boolean, CveUsuarioModifico As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_GPS_RC_TrackingEstatusUpdate", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveRCTracking", SqlDbType.Int).Value = CveRCTracking + .Add("@CveEstatus", SqlDbType.Bit).Value = CveEstatus + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar un tracking.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return retorno + End Function + + Public Function GetRCTracking(CveRCTracking As Integer, CveDispositivo As Integer, CveEstatus As Integer, CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As DateTime = ModExtensiones.MinFecha, Optional FechaF As DateTime = ModExtensiones.MaxFecha) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_GPS_RC_TrackingGet", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveRCTracking", SqlDbType.Int).Value = CveRCTracking + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaI", SqlDbType.DateTime).Value = FechaI + .Add("@FechaF", SqlDbType.DateTime).Value = FechaF + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener un tracking.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return retorno + End Function + + Public Function GetRCTrackingDatos(CveRCTracking As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_GPS_RC_TrackingDatosGet", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveRCTracking", SqlDbType.Int).Value = CveRCTracking + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los datos de un tracking.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return retorno + End Function + + Public Function RemoveRCTracking(CveRCTracking As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_GPS_RC_TrackingEstatusRemove", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveRCTracking", SqlDbType.Int).Value = CveRCTracking + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar un tracking.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return retorno + End Function + + +#End Region + Protected Sub addParameters(name As String, tipo As SqlDbType, valor As Object) If SqlConexion.State = ConnectionState.Open Then SqlAdapter.SelectCommand.Parameters.Add(name, tipo).Value = valor diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 66e6e4384..92bcf5399 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1627,7 +1627,7 @@ Public Class ClsPaginas 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjVendedores As New ClsVtaVendedores - If ObjVendedores.GetVendedores(-1) Then Application(AppNombre) = ObjVendedores.DtResultados + If ObjVendedores.GetVendedores(CveEmpresa) Then Application(AppNombre) = ObjVendedores.DtResultados ObjVendedores.Dispose() End If If CveEmpresa <> -1 Then @@ -3351,7 +3351,7 @@ Public Class ClsPaginas Application("GlobalDTClasificacionPorcentaje") = value End Set End Property - Property GlobalDTPaqueterias(CveEmpresa As Integer, Optional TipoPaquteria As Integer = -1) As DataTable + Property GlobalDTPaqueterias(CveEmpresa As Integer, Optional TipoPaqueteria As Integer = -1) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTPaqueterias-{0}", CveEmpresa) If Application(AppNombre) Is Nothing Then @@ -3361,7 +3361,7 @@ Public Class ClsPaginas End If Dim Str As StringBuilder = New StringBuilder() - If TipoPaquteria <> -1 Then Str.AppendFormat("TipoPaqueteria = {0}", TipoPaquteria) + If TipoPaqueteria <> -1 Then Str.AppendFormat("TipoPaqueteria = {0}", TipoPaqueteria) Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) GlobalDTPaqueterias = Dv.ToTable @@ -4372,6 +4372,7 @@ Public Class ClsPaginas PaginaDict.Add("/GPS/Notificaciones.aspx".ToUpper(), -1) PaginaDict.Add("/GPS/Shipments.aspx".ToUpper(), 673) PaginaDict.Add("/GPS/RepGastos.aspx".ToUpper(), 685) + PaginaDict.Add("/GPS/RecursoConfiableTracking.aspx".ToUpper(), 692) #End Region 'INVENTARIOS @@ -4819,6 +4820,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/RepVentasMensualesDetalle.aspx".ToUpper(), 721) PaginaDict.Add("/Ventas/MetasVendedores.aspx".ToUpper(), 722) PaginaDict.Add("/Ventas/CatMetasVendedores.aspx".ToUpper(), 723) + PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 704) #End Region diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index c348cebec..f5ac79de9 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -460,7 +460,8 @@ Public Class ClsVentas Optional TipoDocto As String = "Cot", Optional Vigencia As Date = MinFecha, Optional CondicionesPago As Integer = -1, Optional AtencionA As String = "-1", Optional PedidoContrato As String = "-1", Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional CveCliente As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional OrdenCompra As String = "-1", Optional RetIVA As Double = -1, - Optional RetISR As Double = -1, Optional Kilometraje As Double = 0) As Boolean + Optional RetISR As Double = -1, Optional Kilometraje As Double = 0, Optional CveVendedor As Integer = -1, Optional ObsAlm As String = "", Optional FormaPaqueteria As Integer = -1, + Optional CorreoNot As String = "-1") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUpdate") @@ -491,6 +492,10 @@ Public Class ClsVentas .Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal .Add("@OrdenCompra", SqlDbType.VarChar).Value = OrdenCompra .Add("@Kilometraje", SqlDbType.Float).Value = Kilometraje + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@ObservacionesAlm", SqlDbType.NVarChar).Value = ObsAlm + .Add("@FormaPaqueteria", SqlDbType.Int).Value = FormaPaqueteria + .Add("@CorreoNotificacion", SqlDbType.NVarChar).Value = CorreoNot End With Try @@ -1638,6 +1643,43 @@ Public Class ClsVentas Return Retorno End Function + 'Reporte de Ventas - Auxiliar Facturas + Public Function GetRepAuxliarFacturas(CveProyecto As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CvePS As Integer, FechaI As Date, FechaF As Date, + CveCliente As Integer, CveVendedor As Integer, CveUsuario As Integer, CveEstatus As Integer, CveEmpresa As Integer, + Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = -1, Optional CveUsuarioConsulta As Integer = -1, Optional TipoDocto As String = "-1") As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_RepAuxiliarGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte auxiliar de facturas de venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + #End Region #Region "V E N T A S - P R E C I O L I S T A S" 'Hecho por Charlie 1/9/2016 @@ -4463,11 +4505,11 @@ Public Class ClsVentas Return retorno End Function - Public Function GetOCRelacionadas(CveVentasDetalles As String) As Boolean + Public Function GetOCRelacionadas(CveVenta As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_OrdenCompraRelacionada", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters - .Add("@CveVentasDetalles", SqlDbType.NVarChar).Value = CveVentasDetalles + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta End With Try SqlAdapter.Fill(Data) diff --git a/App_WebReferences/RCGPSService/RCService.disco b/App_WebReferences/RCGPSService/RCService.disco new file mode 100644 index 000000000..fc35eddd5 --- /dev/null +++ b/App_WebReferences/RCGPSService/RCService.disco @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/RCService.wsdl b/App_WebReferences/RCGPSService/RCService.wsdl new file mode 100644 index 000000000..e4de999c0 --- /dev/null +++ b/App_WebReferences/RCGPSService/RCService.wsdl @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/RCService.xsd b/App_WebReferences/RCGPSService/RCService.xsd new file mode 100644 index 000000000..999d861b1 --- /dev/null +++ b/App_WebReferences/RCGPSService/RCService.xsd @@ -0,0 +1,21 @@ + + + + + + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/RCService1.xsd b/App_WebReferences/RCGPSService/RCService1.xsd new file mode 100644 index 000000000..8e338436c --- /dev/null +++ b/App_WebReferences/RCGPSService/RCService1.xsd @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/RCService2.xsd b/App_WebReferences/RCGPSService/RCService2.xsd new file mode 100644 index 000000000..0108d9eb2 --- /dev/null +++ b/App_WebReferences/RCGPSService/RCService2.xsd @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/RCService3.xsd b/App_WebReferences/RCGPSService/RCService3.xsd new file mode 100644 index 000000000..32e1c19af --- /dev/null +++ b/App_WebReferences/RCGPSService/RCService3.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/Reference.svcmap b/App_WebReferences/RCGPSService/Reference.svcmap new file mode 100644 index 000000000..fbaf7a130 --- /dev/null +++ b/App_WebReferences/RCGPSService/Reference.svcmap @@ -0,0 +1,35 @@ + + + + false + true + + false + false + false + + + true + Auto + true + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/configuration.svcinfo b/App_WebReferences/RCGPSService/configuration.svcinfo new file mode 100644 index 000000000..e70db96fc --- /dev/null +++ b/App_WebReferences/RCGPSService/configuration.svcinfo @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/configuration91.svcinfo b/App_WebReferences/RCGPSService/configuration91.svcinfo new file mode 100644 index 000000000..74eb6fcf0 --- /dev/null +++ b/App_WebReferences/RCGPSService/configuration91.svcinfo @@ -0,0 +1,201 @@ + + + + + + + BasicHttpBinding_IRCService + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + None + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Collection) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + + + http://gps.rcontrol.com.mx/Tracking/wcf/RCService.svc + + + + + + basicHttpBinding + + + BasicHttpBinding_IRCService + + + RCGPSService.IRCService + + + System.ServiceModel.Configuration.AddressHeaderCollectionElement + + + <Header /> + + + System.ServiceModel.Configuration.IdentityElement + + + System.ServiceModel.Configuration.UserPrincipalNameElement + + + + + + System.ServiceModel.Configuration.ServicePrincipalNameElement + + + + + + System.ServiceModel.Configuration.DnsElement + + + + + + System.ServiceModel.Configuration.RsaElement + + + + + + System.ServiceModel.Configuration.CertificateElement + + + + + + System.ServiceModel.Configuration.CertificateReferenceElement + + + My + + + LocalMachine + + + FindBySubjectDistinguishedName + + + + + + False + + + BasicHttpBinding_IRCService + + + + + + + + + + + \ No newline at end of file diff --git a/Ashx/SIGGPSRCService.ashx b/Ashx/SIGGPSRCService.ashx new file mode 100644 index 000000000..30ad9d59c --- /dev/null +++ b/Ashx/SIGGPSRCService.ashx @@ -0,0 +1,158 @@ +<%@ WebHandler Language="C#" Class="SIGGPSRCService" %> + +using System; +using System.Web; +using System.Web.SessionState; +using System.Data; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Extensiones; +using System.Collections.Specialized; +using System.Collections.Generic; +using System.IO; +using System.Net.Http; +using System.Text; + +public class SIGGPSRCService : IHttpHandler, IRequiresSessionState +{ + public bool EsProduccion + { + get + { + if (System.Configuration.ConfigurationManager.AppSettings["EsProduccion"] == null) + return false; + else + return (System.Configuration.ConfigurationManager.AppSettings["EsProduccion"].ToString() == "1"); + } + } + + public bool IsReusable => false; + + public void ProcessRequest(HttpContext context) + { + context.Response.ContentType = "text/plain"; + bool retorno = false; + try + { + + string Metodo = context.Request["Metodo"] == null ? "" : context.Request["Metodo"]; + switch (Metodo) + { + case "EjecutaServicio": + ModExtensiones.GuardaLogAD("Servicio Ejecutado...........", "LogServicioConfiable"); + retorno = IniciarTransmision(); + break; + default: + break; + } + if (retorno) + { + context.Response.Write("True"); + } + else + { + context.Response.Write("False"); + } + + } + catch (Exception ex) + { + ex.GuardaLog(ex.Message); + } + + context.Response.End(); + } + + private bool IniciarTransmision() + { + var retorno = false; + var TieneError = false; + + var WS = new RCGPSService.RCServiceClient(); + + RCGPSService.UserTokenResult Token = WS.GetUserToken(UserService, PasswordService); + List ListaEventos = new List(); + + DataTable DtTrackings = null; + var ObjGPS = new ClsGPS(); + try + { + if (ObjGPS.GetRCTracking(-1, -1, 1, -1, -1)) + { + DtTrackings = ObjGPS.DtResultados.Copy(); + } + else + { + TieneError = true; + } + + if (DtTrackings != null) + { + foreach (DataRow RowTrack in DtTrackings.Rows) + { + DataTable dtTracking = null; + if (ObjGPS.GetRCTrackingDatos(RowTrack["CveRCTracking"].ToString().ToEntero())) + { + dtTracking = ObjGPS.DtResultados.Copy(); + } + else + { + TieneError = true; + } + if (dtTracking != null) + { + foreach (DataRow Row in dtTracking.Rows) + { + ListaEventos.Add(new RCGPSService.Event() + { + code = "STT", + date = Row["Fecha"].ToString().ToDateTime(), + latitude = Row["Latitud"].ToString(), + longitude = Row["Longitud"].ToString(), + asset = Row["PlacasVehiculo"].ToString(), + speed = Row["Velocidad"].ToString(), + shipment = Row["Shipment"].ToString() + }); + } + } + dtTracking.Dispose(); + dtTracking = null; + } + } + } + catch (Exception ex) + { + TieneError = true; + this.OnError("Ocurrió un error al enviar los datos", ex); + } + ObjGPS.Dispose(); + + DtTrackings.Dispose(); + DtTrackings = null; + + if (ListaEventos.Count > 0 && !TieneError) + { + var respuesta = WS.GPSAssetTracking(Token.token, ListaEventos.ToArray()); + if (respuesta.Length > 0) + { + retorno = !TieneError; + } + } + else + { + retorno = !TieneError; + } + + WS.Close(); + + return retorno; + } + + + + + + private string UserService => EsProduccion ? "ws_avl_opsat" : "demo_cedis_corp"; + private string PasswordService => EsProduccion ? "eiHv##889iWfz#&2" : "xxxxxxxx"; + +} \ No newline at end of file diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 17e401ead..0f7b199d5 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -585,7 +585,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState 'verifica existencias - If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141) Then + If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141, 152) Then UsaGlobal = False Dim objInv As New ClsInventarios diff --git a/Bancos/IE.aspx b/Bancos/IE.aspx index 4cacca5f8..c5e19185d 100644 --- a/Bancos/IE.aspx +++ b/Bancos/IE.aspx @@ -441,6 +441,115 @@
+ + + + +
+
+
+ + Notas de Crédito + +
+ +
+ + + +
+ +
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + +   + + + + + + <%-- Visible='<%# Eval("CveCompra").ToString <> "" andalso CDbl(Eval("Saldo")) > 0%>' />--%> + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+ + + + + + +