Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

View File

@@ -0,0 +1,915 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports System.Drawing
Imports Extensiones
'Imports Microsoft.Office.Interop.Excel
'Imports msExcel = Microsoft.Office.Interop.Excel
'Imports VBIDE
Partial Class AIMMGM_ConsultaCliente
Inherits ClsPaginas
Private Shared missing As Object = System.Reflection.Missing.Value
'Configuración
Private Property CveCliente As Integer
Get
Return ViewState("CveCliente").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveCliente") = value
End Set
End Property
Private Property CveVentaDetalle As Integer
Get
Return ViewState("CveVentaDetalle").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveVentaDetalle") = value
End Set
End Property
Private Property DtCompras As Data.DataTable
Get
Return CType(ViewState("DtCompras"), Data.DataTable)
End Get
Set(value As Data.DataTable)
ViewState("DtCompras") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Session("FileUpload") = ""
ViewState("Orden") = ""
ViewState("ONombre") = "Nombre DESC"
TxtFecha.Text = Now.ToShortDateString
If Request("CveCliente") IsNot Nothing Then
CveCliente = Request("CveCliente").ToString.ToEntero()
Else
CveCliente = UsuarioActual.CveCliente
End If
CveVentaDetalle = -1
If UsuarioActual.CveUsuario = 136 Then
imgP.Visible = False
Lbl.Visible = False
End If
'cargo usuarios y verifico permisos
'Configuración de Modalidad Update
'BtnGuardar.Text = "Guardar"
LtlTitulo.Text = "Portal del Cliente"
Dim ObjClientes As New ClsClientes
If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1) Then
If ObjClientes.DtResultados.Rows.Count > 0 Then
LtlTitulo.Text = "Portal del Cliente: " & ObjClientes.Nombre
CargaCompras(CveCliente)
CargaPagos(CveCliente)
DdlMetodoPago.DataSource = DirectCast(Application("GlobalDTMetodosPago"), Data.DataTable).FiltraParametros("CveMetodoPago IN (1,2,3,4,5)")
DdlMetodoPago.DataBind()
TxtNombre.Text = ObjClientes.Nombre
TxtNombreComercial.Text = ObjClientes.NombreComercial
TxtDireccion.Text = ObjClientes.Direccion
TxtNoExt.Text = ObjClientes.NoExt
TxtNoInt.Text = ObjClientes.NoInt
TxtColonia.Text = ObjClientes.Colonia
TxtLocalidad.Text = ObjClientes.Localidad
TxtCiudad.Text = ObjClientes.Ciudad
TxtEstado.Text = ObjClientes.Estado
TxtRFC.Text = ObjClientes.RFC
TxtCP.Text = ObjClientes.CP.ToString
TxtTelefono.Text = ObjClientes.Telefono
TxtContacto.Text = ObjClientes.Contacto
TxtEmail.Text = ObjClientes.Mail
TxtPagina.Text = ObjClientes.Pagina
TxtGiro.Text = ObjClientes.Giro
TxtProfesion.Text = ObjClientes.ConvenioCIE
TxtNumCtaPago.Text = ObjClientes.NumCtaPago
DdlMetodoPago.SelectedValue = ObjClientes.CveMetodoPago.ToString
BtnGuardar.Visible = True
HplComprar.Visible = True
HplComprar.NavigateUrl = String.Format("PopRegistro.aspx?CveCliente={0}&TB_iframe=true&height=450&width=980", CveCliente)
HplComprar.Target = "_blank"
End If
End If
ObjClientes.Dispose()
If UsuarioActual.CveRol.Contiene(1, 1022) Then
GVMisCompras.Columns(4).Visible = True
GVMisCompras.Columns(5).Visible = True
GVMisCompras.Columns(6).Visible = True
GVMisCompras.Columns(7).Visible = True
GVMisCompras.Columns(8).Visible = True
GvPagos.Columns(6).Visible = True
End If
'End If
End If
End Sub
Private Sub CargaCompras(CveCliente As Integer)
Dim DtDatosCompras As New Data.DataTable
DtDatosCompras.Columns.Add("PS", Type.GetType("System.String"))
DtDatosCompras.Columns.Add("Clasificacion", Type.GetType("System.String"))
DtDatosCompras.Columns.Add("Obs", Type.GetType("System.String"))
DtDatosCompras.Columns.Add("Fecha", Type.GetType("System.DateTime"))
DtDatosCompras.Columns.Add("Total", Type.GetType("System.Double"))
DtDatosCompras.Columns.Add("CveVentaDetalle", Type.GetType("System.Int32"))
DtDatosCompras.Columns.Add("CveVenta", Type.GetType("System.Int32"))
DtDatosCompras.Columns.Add("VentaMovs", Type.GetType("System.Int32")) 'registro el numero de movimientos detalle que tiene la venta, para saber si la elimino o solo la actualizo
Dim TieneStand As Boolean = False
Dim ObjClientes As New ClsClientes()
If ObjClientes.GetHistorialVentas(CveCliente) Then
If ObjClientes.DtResultados.Rows.Count > 0 Then
Dim dt As Data.DataTable = ObjClientes.DtResultados
Dim Venta As New ClsVentas
Dim AIM As New ClsAIMMGM
For Each dr As DataRow In dt.Rows
If AIM.GetVentas(CveCliente) Then
DtDatosCompras = AIM.DtResultados
End If
Next
Venta.Dispose()
GVMisCompras.DataSource = DtDatosCompras
DtCompras = DtDatosCompras
If DtDatosCompras.Rows.Count = 0 Then
CveVentaDetalle = DtDatosCompras.MIN("CveVentaDetalle").ToEntero
Else
CveVentaDetalle = -1
End If
Else
GVMisCompras.DataSource = Nothing
End If
Else
GVMisCompras.DataSource = Nothing
End If
ObjClientes.Dispose()
GVMisCompras.DataBind()
'If TieneStand Then
' TxtImporte.ReadOnly = False
'Else
' If DtCompras IsNot Nothing Then
' TxtImporte.Text = DtCompras.SUM("Total")
' End If
'End If
End Sub
Private Sub CargaPagos(CveCliente As Integer)
Dim Pagado As Double = 0
Dim AIM As New ClsAIMMGM
If AIM.GetPagos(CveCliente, -1) Then
GvPagos.DataSource = AIM.DtResultados
If AIM.DtResultados.Rows.Count > 0 Then
Pagado = AIM.DtResultados.SUM("Importe")
End If
End If
AIM.Dispose()
GvPagos.DataBind()
LblSaldo.Text = (DtCompras.SUM("Total") - Pagado).FormatoNumero
End Sub
'Private Sub CargaDatosCliente()
' Dim ObjClientes As New ClsClientes()
' If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, 43) Then
' If ObjClientes.DtResultados.Rows.Count > 0 Then
' 'Campos para Modificación
' TxtNombre.Text = ObjClientes.Nombre
' TxtNombreComercial.Text = ObjClientes.NombreComercial
' TxtDireccion.Text = ObjClientes.Direccion
' TxtNoExt.Text = ObjClientes.NoExt
' TxtNoInt.Text = ObjClientes.NoInt
' TxtColonia.Text = ObjClientes.Colonia
' TxtLocalidad.Text = ObjClientes.Localidad
' TxtCiudad.Text = ObjClientes.Ciudad
' TxtEstado.Text = ObjClientes.Estado
' TxtRFC.Text = ObjClientes.RFC
' TxtCP.Text = ObjClientes.CP.ToString
' TxtTelefono.Text = ObjClientes.Telefono
' TxtContacto.Text = ObjClientes.Contacto
' TxtEmail.Text = ObjClientes.Mail
' TxtPagina.Text = ObjClientes.Pagina
' TxtGiro.Text = ObjClientes.Giro
' TxtNumCtaPago.Text = ObjClientes.NumCtaPago
' DdlMetodoPago.SelectedValue = ObjClientes.CveMetodoPago.ToString
' Else
' Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
' End If
' End If
' ObjClientes.Dispose()
'End Sub
Protected Sub GVMisCompras_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GVMisCompras.RowCommand
If e.CommandName = "Eliminar" Then
Dim Retorno As Boolean = True
'PARAMETROS:
'0. CveVenta, 1. CveVentaDetalle, 2.Clasificacion, 3.MovimientosVentas, 4.Total
Dim S As String() = e.CommandArgument.ToString.Split("|"c)
Dim CveVenta, CveVentaDetalle, MovimientosVentas As Integer
Dim Clasificacion As String
Dim Total As Double = S(4).ToDouble
CveVenta = S(0).ToEntero : CveVentaDetalle = S(1).ToEntero : Clasificacion = S(2).ToString : MovimientosVentas = S(3).ToEntero
Dim Venta As New ClsVentas
Dim AIM As New ClsAIMMGM(Venta.IniciaTransacSQL)
Select Case Clasificacion
Case "Stand"
'libero el stand
Retorno = AIM.LiberaStand(CveVentaDetalle)
Case "Espacios Promocionales"
'libero publicidad
Retorno = AIM.LiberaPatrocinio(CveVentaDetalle)
End Select
If Retorno Then
'se actualiza
If Venta.RemoveVentasDetalle(CveVenta, CveVentaDetalle) Then
'NECESITO VERIFICAR SI ES STAND, O PATROCIONIO PARA LIBERAR LAS UBICACIONES
If Venta.GetVenta(CveVenta, 43) Then
Dim dr As DataRow = Venta.DtResultados.Rows(0)
Venta.UpdateVentas(dr("SubTotal").ToString.ToDouble - Total, 0, 0, dr("SubTotal").ToString.ToDouble - Total, 1, 1, dr("Fecha").ToString.ToDate, "", 43, CveVenta, "Rem")
Alert("El Registro ha sido eliminado", TipoMensaje.MsgInformacion)
If MovimientosVentas.ToEntero = 1 Then 'se cancela la venta en su totalidad
Venta.UpdateEstatusFactura(4, "", "", Now, CveVenta)
End If
Venta.Commit()
CargaCompras(CveCliente)
Else
Venta.RollBack()
End If
Else
Venta.RollBack()
End If
Else
Venta.RollBack()
End If
Venta.Dispose()
AIM.Dispose()
Else
If e.CommandName = "Imprimir" Then
Dim S As String() = e.CommandArgument.ToString.Split("|"c)
Dim dt As New Data.DataTable
dt.Columns.Add("Expositor", Type.GetType("System.String"))
dt.Columns.Add("Empresa", Type.GetType("System.String"))
dt.Columns.Add("Telefono", Type.GetType("System.String"))
dt.Columns.Add("Correo", Type.GetType("System.String"))
dt.Columns.Add("Pagina", Type.GetType("System.String"))
dt.Columns.Add("CvePS", Type.GetType("System.Int32"))
Dim dr As DataRow = dt.NewRow
dr("Expositor") = S(0)
dr("Empresa") = S(1)
dr("Correo") = S(2)
dr("Telefono") = S(3)
dr("Pagina") = S(4)
dr("CvePS") = S(5)
dt.Rows.Add(dr)
GeneraPDF(dt, 10)
End If
End If
End Sub
Private Function GeneraPDF(dtMovs As Data.DataTable, Opcion As Integer) As Boolean
Dim Retorno As Boolean = False
'Dim Excel As msExcel.Application = New msExcel.Application()
'Dim VB_Module As VBComponent = Nothing
'Excel.Visible = True
'Excel.ScreenUpdating = True
'Excel.DisplayAlerts = True
'Dim pdfFileOut As String
'Dim xlsxFileOut As String
'Dim Ruta As String = String.Format("{0}\AIMMGM\Gafetes\", AppDomain.CurrentDomain.BaseDirectory)
'If IO.File.Exists(Ruta & "FormatoAIMMGM.xlsx") Then
' IO.File.Copy(Ruta & "FormatoAIMMGM.xlsx", Ruta & "FormatoAIMMGM2.xlsx", True)
'End If
'Dim ArchivoBase As New System.IO.FileInfo(Ruta & "FormatoAIMMGM2.xlsx")
'ArchivoBase.CopyTo(Ruta & "FormatoAIMMGM33.xlsx", True)
''Dim ArchivoTemp As New System.IO.FileInfo("c:\inetpub\wwwVentas\AIMMGM\Gafetes\FormatoAIMMGM3.xlsx")
''Dim ArchivoBase As New System.IO.FileInfo(String.Format("{0}Formatos\OrdenCompra.xlsm", UsuarioActual.Empresa.Ruta))
''If ArchivoBase.CopyTo(String.Format("{0}Formatos\OC-{1}.xlsm", UsuarioActual.Empresa.Ruta, pCveOrdenCompra), True) IsNot Nothing Then
''Dim ArchivoTemp As New System.IO.FileInfo(String.Format("{0}Formatos\OC-{1}.xlsm", UsuarioActual.Empresa.Ruta, pCveOrdenCompra))
'Dim Libro As msExcel.Workbook = Excel.Workbooks.Open(Ruta & "FormatoAIMMGM33.xlsx", missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing)
'Libro.Activate()
'Dim Hoja As msExcel.Worksheet = CType(Libro.Worksheets(1), Microsoft.Office.Interop.Excel.Worksheet)
'Hoja.Visible = Microsoft.Office.Interop.Excel.XlSheetVisibility.xlSheetVisible
'Hoja.Activate()
'Try
' ' Hoja.Range("G1:G1").Value = FechaExpedicion.ToShortDateString
' 'Hoja.Range("B3:B3").Value = PagueseA
' 'Hoja.Range("G3:G3").Value = Importe.ToString("N2")
' ''Generales
' ''Hoja.Range("G2:G2").Value = Folio
' 'Hoja.Range("B4:B4").Value = TextoImporte
' 'Hoja.Range("B6:B6").Value = Observacion
' 'Hoja.Range("C10:C10").Value = UsuarioRegistro
' 'Hoja.Range("F6:F6").Value = SubProyecto
' Dim CeldaI As Integer = 2
' Dim CeldaF As Integer = 2
' Dim Top, Left As Single
' Dim CBB As String
' Left = 0
' Dim Imagen As Bitmap
' Dim i As Integer = 0
' For Each Row As DataRow In dtMovs.Rows
' 'Cantidad
' 'If Row("AplicaParaConcepto").ToString.ToEntero > 0 Then
' Hoja.Range("A" & CeldaF - 1 & ":A" & CeldaF - 1).RowHeight = 60
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).RowHeight = 50
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).Cells.VerticalAlignment = XlVAlign.xlVAlignCenter
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).Cells.VerticalAlignment = XlVAlign.xlVAlignCenter
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).Cells.HorizontalAlignment = XlHAlign.xlHAlignCenter
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).Cells.HorizontalAlignment = XlHAlign.xlHAlignCenter
' 'Hoja.Range("C" & CeldaF & ":C" & CeldaF).VerticalAlignment = Top
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).ColumnWidth = 49
' Hoja.Range("B" & CeldaF & ":B" & CeldaF).ColumnWidth = 2
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).ColumnWidth = 49
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).Font.Size = 23
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).Font.Size = 23
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).Font.Bold = True
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).Font.Bold = True
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).WrapText = True
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).WrapText = True
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).Value = Row("Expositor").ToString.ToUpper()
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).Value = Row("Expositor").ToString.ToUpper()
' 'Unidad
' 'If Row("AplicaParaConcepto").ToString.ToEntero > 0 Then
' Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).RowHeight = 35
' Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).Value = If(Row("CvePS").ToString.ToEntero = 36976, "Estudiante", Row("Empresa").ToString)
' Hoja.Range("C" & CeldaF + 1 & ":C" & CeldaF + 1).Value = If(Row("CvePS").ToString.ToEntero = 36976, "Estudiante", Row("Empresa").ToString)
' Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).Font.Size = 13
' Hoja.Range("C" & CeldaF + 1 & ":C" & CeldaF + 1).Font.Size = 13
' Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).Cells.HorizontalAlignment = XlHAlign.xlHAlignCenter
' Hoja.Range("C" & CeldaF + 1 & ":C" & CeldaF + 1).Cells.HorizontalAlignment = XlHAlign.xlHAlignCenter
' Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).Cells.VerticalAlignment = XlVAlign.xlVAlignCenter
' Hoja.Range("C" & CeldaF + 1 & ":C" & CeldaF + 1).Cells.VerticalAlignment = XlVAlign.xlVAlignCenter
' Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).WrapText = True
' Hoja.Range("C" & CeldaF + 1 & ":C" & CeldaF + 1).WrapText = True
' 'Concepto y Descripción
' 'Hoja.Range("F" & CeldaF & ":F" & CeldaF).Value = If(Row("Cargo").ToString.ToDouble > 0, Row("Cargo").ToString.ToDouble.FormatoNumero, "")
' 'P Unitario
' 'Morro el precio unitario si va a ir?
' 'Hoja.Range("G" & CeldaF & ":G" & CeldaF).Value = If(Row("Abono").ToString.ToDouble > 0, Row("Abono").ToString.ToDouble.FormatoNumero, "")
' Top = CSng(Hoja.Range("A" & (3 + CeldaF).ToString & ":C" & (4 + CeldaF).ToString).Top) - 18
' CBB = String.Format(Ruta & "\QR-{0}.jpg", i)
' Select Case Opcion
' Case 3
' Dim tam As Integer = 25
' If Row("Expositor").ToString.Length <= 15 Then
' tam = 30
' End If
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).Font.Size = tam
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).Font.Size = tam
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).RowHeight = 50 + 100
' 'Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).RowHeight = Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).RowHeight - 10
' CeldaF = CeldaF + 35 ' 17
' Case 4, 5
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).Font.Size = 35
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).Font.Size = 35
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).RowHeight = 50 + 100
' 'Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).RowHeight = Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).RowHeight - 10
' CeldaF = CeldaF + 35 ' 17
' Case 6
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).Font.Size = 30
' Hoja.Range("C" & CeldaF & ":C" & CeldaF).Font.Size = 30
' Hoja.Range("A" & CeldaF & ":A" & CeldaF).RowHeight = 50 + 100
' 'Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).RowHeight = Hoja.Range("A" & CeldaF + 1 & ":A" & CeldaF + 1).RowHeight - 10
' CeldaF = CeldaF + 35 ' 17
' Case Else
' Imagen = GenerateQRCode(String.Format("{0}{4}|{1}|{2}|{3}", Row("Empresa"), Row("Expositor"), Row("Telefono"), Row("Correo"), If(Row("Pagina").ToString.Trim <> "", String.Format("({0})", Row("Pagina")), "")))
' Imagen.Save(CBB)
' Hoja.Shapes.AddPicture(CBB, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, Left, Top, 62, 62)
' Hoja.Shapes.AddPicture(CBB, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, Left + 278, Top, 62, 62)
' CeldaF = CeldaF + 39 ' 17
' End Select
' i += 1
' 'If dtMovs.Rows.Count > 1 AndAlso CeldaF - CeldaI < dtMovs.Rows.Count - 1 Then
' ' CeldaF = CeldaF + 1
' ' Libro.Application.Run("AddRow", (CeldaF - 1).ToString, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing,
' ' missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing)
' ' Libro.Save()
' ' Libro.Application.DisplayAlerts = False
' ' Libro.Application.ScreenUpdating = False
' 'End If
' Next
' Libro.Save()
' Libro.Application.DisplayAlerts = False
' Libro.Application.ScreenUpdating = False
' Dim AddedRow As Integer = CeldaF - CeldaI
' Dim EsVistaPrevia As Boolean = True
' xlsxFileOut = String.Format("Format{0}-{1}.xlsx", Opcion, Now.Ticks)
' 'Exportar PDF
' pdfFileOut = String.Format("Format{0}-{1}.pdf", Opcion, Now.Ticks)
' Dim outputFileName As Object = Ruta & xlsxFileOut
' If IO.File.Exists(Ruta & "FormatoAIMMGM33.xlsx") Then
' IO.File.Copy(Ruta & "FormatoAIMMGM33.xlsx", outputFileName.ToString, True)
' End If
' Dim fileFormat As msExcel.XlFixedFormatType = msExcel.XlFixedFormatType.xlTypePDF
' 'Libro.ExportAsFixedFormat(fileFormat, outputFileName, missing, missing, missing, missing, missing, missing, missing)
' Dim Descargas As New StringBuilder()
' Descargas.AppendFormat("<li><a class=""Texto"" target='_blank' href=""/AIMMGM/Gafetes/{0}"">Impresion</a></li>", xlsxFileOut)
' 'Descargas.AppendFormat("<li><a class=""Texto"" href=""/Contabilidad/Poliza.aspx?IdPoliza={0}"">Póliza</a></li>", pIDPoliza)
' ''Descargas.AppendFormat("<li><a class=""Texto"" href=""/Ventas/PopUpImprimir.aspx?CveVenta=" & pCveOrdenCompra & "&Ext=CadenaOriginal"">Cadena Original</a></li>", UsuarioActual.CveEmpresa, Folio)
' Alert("<br />La impresión se generó correctamente.<br /><br /><br />Descargas:<ul>" & Descargas.ToString & "</ul>", TipoMensaje.MsgInformacion)
' Retorno = True
'Catch ex As Exception
' ' LblMsg.Text = ex.Message
' Alert("<br />La impresión no se generó correctamente.<br /><br /><br />" & ex.Message, TipoMensaje.MsgInformacion)
'End Try
'System.Runtime.InteropServices.Marshal.ReleaseComObject(Hoja)
'Hoja = Nothing
'Dim saveChanges As Object = msExcel.XlSaveAction.xlDoNotSaveChanges
'CType(Libro, msExcel._Workbook).Close(saveChanges, missing, missing)
'System.Runtime.InteropServices.Marshal.ReleaseComObject(Libro)
'Libro = Nothing
'Excel.Quit()
'System.Runtime.InteropServices.Marshal.ReleaseComObject(Excel)
'Excel = Nothing
'GC.Collect()
'GC.WaitForPendingFinalizers()
'ArchivoTemp.Delete()
Return Retorno
End Function
Private Function GenerateQRCode(Cadena As String) As Bitmap
'Dim Encoder As New Gma.QrCodeNet.Encoding.QrEncoder(Gma.QrCodeNet.Encoding.ErrorCorrectionLevel.L)
'Dim Code As Gma.QrCodeNet.Encoding.QrCode = Encoder.Encode(Cadena)
'Dim TempBMP As New Bitmap(Code.Matrix.Width, Code.Matrix.Height)
'For X As Integer = 0 To Code.Matrix.Width - 1
' For Y As Integer = 0 To Code.Matrix.Height - 1
' If Code.Matrix.InternalArray(X, Y) Then TempBMP.SetPixel(X, Y, Color.Black) Else TempBMP.SetPixel(X, Y, Color.White)
' Next
'Next
'Return TempBMP
Return Nothing
End Function
Protected Sub GVMisCompras_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles GVMisCompras.RowEditing
GVMisCompras.EditIndex = e.NewEditIndex
GVMisCompras.DataSource = DtCompras
GVMisCompras.DataBind()
End Sub
Protected Sub GVMisCompras_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GVMisCompras.RowUpdating
Dim tCveVentaDetalle As Integer = e.Keys("CveVentaDetalle").ToString.ToEntero
Dim Obs As String = GVMisCompras.Rows(e.RowIndex).FCTextBox("TxtObs").Text
Dim AIM As New ClsAIMMGM
If AIM.UpdateVentaDetalleReferencia(Obs, tCveVentaDetalle) Then
GVMisCompras.EditIndex = -1
CargaCompras(CveCliente)
End If
AIM.Dispose()
GVMisCompras.DataSource = DtCompras
GVMisCompras.DataBind()
End Sub
Protected Sub GVMisCompras_RowCancelingEdit(ByVal sender As Object, ByVal e As GridViewCancelEditEventArgs) Handles GVMisCompras.RowCancelingEdit
GVMisCompras.EditIndex = -1
GVMisCompras.DataSource = DtCompras
GVMisCompras.DataBind()
End Sub
Protected Sub GVMisCompras_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVMisCompras.RowDataBound
If e.Row.RowType = DataControlRowType.Footer Then
Dim Imp As Double = CType(GVMisCompras.DataSource, Data.DataTable).SUM("Total")
e.Row.FCLabel("LblTotal").Text = Imp.FormatoNumero()
ElseIf e.Row.RowType = DataControlRowType.DataRow Then
'If e.Row.DBCampo("Clasificacion") <> "Stand" Then e.Row.FCLiteral("LtlObs").Text = ""
End If
End Sub
Protected Sub GvPagos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvPagos.RowCommand
If e.CommandName = "Eliminar" Then
Dim CvePago As Integer = e.CommandArgument.ToString.ToEntero
Dim AIM As New ClsAIMMGM()
'se actualiza
If AIM.RemovePago(CvePago) Then
Alert("El Pago se ha eliminado", TipoMensaje.MsgInformacion)
CargaPagos(CveCliente)
End If
AIM.Dispose()
End If
End Sub
Protected Sub GvPagos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPagos.RowDataBound
If e.Row.RowType = DataControlRowType.Footer Then
Dim Imp As Double = CType(GvPagos.DataSource, Data.DataTable).SUM("Importe")
e.Row.FCLabel("LblTotal").Text = Imp.FormatoNumero()
ElseIf e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Archivo") <> "" Then
e.Row.FCHyperLink("ImgArchivo").NavigateUrl = String.Format("/Empresas/{0}/Documentos/{1}", UsuarioActual.CveEmpresa, e.Row.DBCampo("Archivo"))
End If
If e.Row.DBCampo("Pagado") = "True" AndAlso e.Row.DBCampo("Validado") = "False" Then
e.Row.FCLiteral("LtlEstatus").Text = "Sin Validar"
ElseIf e.Row.DBCampo("Validado") = "True" AndAlso e.Row.DBCampo("Facturado") = "False" Then
e.Row.FCLiteral("LtlEstatus").Text = "Validado"
ElseIf e.Row.DBCampo("Validado") = "True" AndAlso e.Row.DBCampo("Facturado") = "True" Then
e.Row.FCLiteral("LtlEstatus").Text = "Facturado"
Else
e.Row.FCLiteral("LtlEstatus").Text = "Registrado"
End If
If e.Row.DBCampo("Validado") = "False" Then
e.Row.FCImageButton("ImgEliminar").Visible = True
End If
If e.Row.DBCampo("xml") <> "" Then
e.Row.FCHyperLink("ImgDownXML").NavigateUrl = String.Format("/Empresas/{0}/Compras/{1}", UsuarioActual.CveEmpresa, e.Row.DBCampo("XML"))
e.Row.FCHyperLink("ImgDownXML").Visible = True
End If
If e.Row.DBCampo("pdf") <> "" Then
e.Row.FCHyperLink("ImgDownPDF").NavigateUrl = String.Format("/Empresas/{0}/Compras/{1}", UsuarioActual.CveEmpresa, e.Row.DBCampo("PDF"))
e.Row.FCHyperLink("ImgDownPDF").Visible = True
End If
End If
End Sub
Protected Sub BtnComprobante_Click(sender As Object, e As EventArgs) Handles BtnComprabante.Click
'If Not FUComprobante.HasFile Then
' Alert("Ingrese por favor el comprobante")
' Exit Sub
'End If
If TxtImporte.Text.ToDouble <= 0 Then
Alert("Ingrese un importe", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtImporte.Text.ToDouble > LblSaldo.Text.ToDouble Then
Alert("Ingrese un importe menor al saldo", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim AIM As New ClsAIMMGM
If Not IO.Directory.Exists(String.Format("{0}\Empresas\{1}\Documentos", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa)) Then
IO.Directory.CreateDirectory(String.Format("{0}\Empresas\{1}\Documentos", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa))
End If
Dim Cve As Integer = AIM.AddPago(CveCliente, CveVentaDetalle, TxtImporte.Text.ToDouble, 1, TxtFecha.Text.ToDate, IO.Path.GetExtension(FUComprobante.FileName), TxtObservaciones.Text.Trim, 9999, TxtAprobacion.Text.ToEntero)
If Cve > 0 Then
FUComprobante.SaveAs(String.Format("{0}/Empresas/{1}/Documentos/{2}{3}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, Cve, IO.Path.GetExtension(FUComprobante.FileName)))
Alert("Pago ingresado correctamente", TipoMensaje.MsgInformacion)
End If
AIM.Dispose()
CargaPagos(CveCliente)
End Sub
Protected Sub BtnSubirLogo_Click(sender As Object, e As EventArgs) Handles BtnSubirLogo.Click
If Not FULogo.HasFile Then
Alert("Seleccione el logo de su empresa", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'obtengo la clave de la publicidad
If Not IO.Directory.Exists(String.Format("{0}\Empresas\{1}\Documentos", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa)) Then
IO.Directory.CreateDirectory(String.Format("{0}\Empresas\{1}\Documentos", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa))
End If
Dim Logo As String
Dim CvePublicidad As Integer
Dim AIM As New ClsAIMMGM
If AIM.GetPublicidad(CveCliente) Then
If AIM.DtResultados.Rows.Count > 0 Then
CvePublicidad = AIM.DtResultados.Rows(0)("CvePublicidad").ToString.ToEntero
Logo = String.Format("Logo{0}{1}", CvePublicidad, IO.Path.GetExtension(FULogo.FileName))
FULogo.SaveAs(String.Format("{0}/Empresas/{1}/Documentos/{2}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, Logo))
AIM.UpdateLogo(CvePublicidad, Logo)
ImgLogo.ImageUrl = String.Format("/Empresas/{0}/Documentos/{1}", UsuarioActual.CveEmpresa, Logo)
End If
End If
AIM.Dispose()
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
Dim ObjClientes As New ClsClientes()
If CveCliente = -1 Then
'If ObjClientes.AddCliente(TxtNombre.Text.Trim, TxtNombreComercial.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtCiudad.Text.Trim, TxtLocalidad.Text.Trim, TxtEstado.Text.Trim, TxtRFC.Text.Trim, TxtCP.Text.Trim,
' TxtTelefono.Text.Trim, TxtContacto.Text.Trim, TxtEmail.Text.Trim, False, DdlSucursal.SelectedValue.ToEntero, TxtRetIVA.Text.ToDouble,
' TxtRetISR.Text.ToDouble, ChkRetIVAFletesAcarreos.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtNombreCorto.Text.Trim, TxtVendedor.Text.Trim, TxtPlazoCobranza.Text.Trim.ToEntero,
' TxtSucursalCliente.Text.Trim, TxtRecepcionPago.Text.Trim, TxtTipoPago.Text.Trim, TxtCuentaContable.Text.Trim, DdlCtaContableClientes.SelectedValue.ToEntero,
' DdlCtaContableAnticipos.SelectedValue.ToString.ToEntero, DdlCtaContableRetIVA.SelectedValue.ToString.ToEntero, DdlCtaContableRetISR.SelectedValue.ToString.ToEntero,
' TxtConvenioCIE.Text.Trim, TxtFormaFacturacion.Text.Trim, TxtCodigo.Text.Trim, TxtLimiteCredito.Text.ToDouble, TxtNumCtaPago.Text.Trim,
' DdlMetodoPago.SelectedValue.ToEntero, ChkAplicaFEMSA.Checked, TxtFEMSA_NumSociedad.Text.Trim,
' TxtFEMSA_NumProveedor.Text.Trim, TxtFEMA_Mail.Text.Trim, ChkAplicaDetallista.Checked, TxtDet_GLNComprador.Text.Trim, TxtDet_Departamento.Text.Trim,
' TxtDet_GLNVendedor.Text.Trim, TxtDet_NumProveedor.Text.Trim) Then
' Alert("El Cliente se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/CatClientes.aspx""")
'End If
Else
If ObjClientes.UpdateCliente(TxtNombre.Text.Trim, TxtNombreComercial.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtCiudad.Text.Trim, TxtLocalidad.Text.Trim, TxtEstado.Text.Trim, TxtRFC.Text.Trim, TxtCP.Text.Trim,
TxtTelefono.Text.Trim, TxtContacto.Text.Trim, TxtEmail.Text.Trim, "-1", TxtPagina.Text.Trim, TxtGiro.Text.Trim, -1, False,
2069, 0, 0, False, True, "", -1, 0, "", "", "", "", -1, -1, -1, -1, TxtProfesion.Text.Trim, "", "", 0, TxtNumCtaPago.Text.Trim, DdlMetodoPago.SelectedValue.ToEntero, False, "", "", "", False, "", "", "", "", "", False, "", 0, CveCliente, UsuarioActual.CveEmpresa, "", False) Then
'CargaDatos()
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
End If
End If
ObjClientes.Dispose()
End Sub
Protected Sub LbPortal_Click(sender As Object, e As EventArgs) Handles LbPortal.Click
ActivaPortal(CveCliente, TxtEmail.Text.Trim)
End Sub
Private Sub ActivaPortal(CveCliente As Integer, Correo As String)
'guarda el nuevo usuario
Dim Usr As New ClsSisUsuarios
Dim CveUsr As Integer
Dim Activa As Boolean = True
If Usr.GetUsuariosPortal(-1, CveCliente, -1) Then
If Usr.DtResultados.Rows.Count = 0 Then
'lo ingreso
CveUsr = Usr.AddUsuarioPortal("Admin", "-acceso-", "Administrador", "", CveCliente, -1, True, True, True, True, True, True, True, True, True, True, 1, 0)
'lo desactivo para que me pida la nueva contrase;a en el portal
If CveUsr > 0 Then
Usr.UpdateUsuarioPortal("Admin", "Administrador", "", True, True, True, True, True, True, True, True, True, True, False, ContraseñaPredeterminada, CveCliente, 0, CveUsr)
End If
Activa = True
Else
CveUsr = Usr.DtResultados.Rows(0)("CveUsuarioPortal").ToString.ToEntero
If Usr.DtResultados.Rows(0)("Estatus").ToString = "0" Then
Activa = True 'sino esta activada la cuenta, sigue mandando la liga para activar
Else
Activa = False
End If
End If
End If
Usr.Dispose()
If CveUsr > 0 Then
Dim Liga As String = "http://aimmgm.adsistemas.mx/AIMMGM/Portal.aspx"
Dim LigaActivar As String = Liga & "?p=" & Extensiones.Encripta("CveU=" & CveUsr & "&Clave=" & CveCliente & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks)
Dim strSQL As New StringBuilder
strSQL.Append(" <html> ")
strSQL.Append(" <head></head> ")
strSQL.Append(" <body> ")
strSQL.Append(" <img src='http://expominson2014.com/CorreoEncabezado.jpg'><br /> ")
strSQL.Append(" ")
strSQL.Append(" <p class=MsoNormal style='margin-top:15.0pt;margin-right:0cm;margin-bottom: ")
strSQL.Append(" 7.5pt;margin-left:0cm;line-height:normal;mso-outline-level:3'><b><span ")
strSQL.Append(" style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'>SONORA 2014: Minería Moderna, Ejemplo de Industria ")
strSQL.Append(" Responsable</span></b><b><span style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif""; ")
strSQL.Append(" mso-fareast-font-family:""Times New Roman"";mso-bidi-font-family:""Times New Roman""; ")
strSQL.Append(" color:#89BCDC;mso-fareast-language:ES-MX'><o:p></o:p></span></b></p> ")
strSQL.Append(" <br> ")
strSQL.Append(" <br> ")
strSQL.Append(" <p class=MsoNormal style='margin-top:9.0pt;margin-right:0cm;margin-bottom:9.0pt; ")
strSQL.Append(" margin-left:0cm;text-align:justify;line-height:normal'><span style='font-size: ")
strSQL.Append(" 12.0pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family:""Times New Roman""; ")
strSQL.Append(" mso-bidi-font-family:""Times New Roman"";color:#2C2C25;mso-fareast-language:ES-MX'>Estimado ")
strSQL.Append(" Socio y Amigo, Gracias por su asistencia, le brindamos la dirección al portal. ")
strSQL.Append(" ")
strSQL.Append(" ")
strSQL.Append(" <br><br> ")
If Activa Then strSQL.AppendFormat("<br>Haga click para activar su cuenta <a href='{0}' target='_blank'>Activar</a>", LigaActivar)
strSQL.Append(" <br><br> ")
strSQL.AppendFormat(" Dirección de acceso al Portal: <a href='{0}' target='_blank'>Portal AIMMGM</a> ", Liga)
strSQL.Append(" <br><br> ")
strSQL.Append(" Datos de acceso: ")
strSQL.Append(" <br><br> ")
strSQL.AppendFormat(" Clave Cliente: {0}", CveCliente)
strSQL.Append(" <br><br> ")
strSQL.Append(" Dentro del Portal usted tendrá acceso a visualizar el detalle de sus compras, subir la comprobación de sus pagos. ")
strSQL.Append(" <br><br><table id=""TrPagoss"" width=""994px"" style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td colspan=""2"" style=""background-color:#5D7B9D; text-align: center; height: 20px;""> ")
strSQL.Append(" Pagos-Transferencias Nacionales ")
strSQL.Append(" <b></b> ")
strSQL.Append(" </td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td style=""width:275px;"">Banco:</td><td><b>Inbursa</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Sucursal:</td><td><b>Nápoles 021</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Cuenta:</td><td><b>50019145334</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>CLABE:</td><td><b>036180500191453345</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nombre del Beneficiario:</td><td><b>Asociación de Ingenieros de Minas, Metalurgistas y Geólogos de México A.C.</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" ")
strSQL.Append(" </table> ")
strSQL.Append(" <br/> ")
strSQL.Append(" <table id=""TrPagoss2"" width=""994px""style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td colspan=""2"" style=""background-color:#5D7B9D; text-align: center; height: 20px;""> ")
strSQL.Append(" Pagos-Transferencias Internacionales ")
strSQL.Append(" <b></b> ")
strSQL.Append(" </td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td style=""width:275px;"">Moneda:</td><td><b>Dólares Americanos</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Banco:</td><td><b>JPMorgan Chase Bank New York NY USA</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Código Swift:</td><td><b>CHASUS33</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Ruta Banco Receptor (ABA):</td><td><b>021 000 021</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nombre del Beneficiario:</td><td><b>Asociación de Ingenieros de Minas, Metalurgistas y Geólogos de México A.C. </b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Cuenta del Beneficiario:</td><td><b>50019145334</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>CLABE:</td><td><b>036180500191453345</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Banco Beneficiario:</td><td><b>Banco Inbursa, S.A. México, D.F.</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nuestro Código Swift:</td><td><b>INBUMXMM</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" ")
strSQL.Append(" </table> ")
strSQL.Append(" </span></p> ")
strSQL.Append(" </body> ")
'Dim ObjMail As New ClsSisMail()
Dim Emp As New Empresa
Dim ObjEmp As New ClsSisEmpresas
If ObjEmp.GetEmpresas(43, "-1", "-1", "-1", "-1") Then
Emp = ObjEmp.Empresa
End If
ObjEmp.Dispose()
'If ObjMail.Mandacorreo(Emp, Correo, If(Activa, "Activación de cuenta ExpominSon 2014", "Registro de Compra ExpominSon 2014"), "", "", {""}, strSQL.ToString) Then
'End If
End If
End Sub
Protected Sub ChkPagado_CheckedChanged(sender As Object, e As EventArgs)
Dim Chk As WebControls.CheckBox = DirectCast(sender, WebControls.CheckBox)
Dim gvr As GridViewRow = DirectCast(Chk.BindingContainer, GridViewRow)
Dim Aim As New ClsAIMMGM
Aim.AddUpdVentaDetallePagado(gvr.DataKey("CveVentaDetalle").ToString.ToEntero, Chk.Checked)
Aim.Dispose()
End Sub
Protected Sub ChkImpreso_CheckedChanged(sender As Object, e As EventArgs)
Dim Chk As WebControls.CheckBox = DirectCast(sender, WebControls.CheckBox)
Dim gvr As GridViewRow = DirectCast(Chk.BindingContainer, GridViewRow)
Dim Aim As New ClsAIMMGM
Aim.AddUpdVentaDetalleImpreso(gvr.DataKey("CveVentaDetalle").ToString.ToEntero, Chk.Checked)
Aim.Dispose()
End Sub
Sub DDlContratadoSelectedIndex_Changed(sender As Object, e As EventArgs)
Dim DDl As WebControls.DropDownList = DirectCast(sender, WebControls.DropDownList)
Dim gvr As GridViewRow = DirectCast(DDl.BindingContainer, GridViewRow)
Dim Aim As New ClsAIMMGM
Aim.AddUpdVentaDetalleComprobado(gvr.DataKey("CveVentaDetalle").ToString.ToEntero, DDl.SelectedValue.ToEntero)
Aim.Dispose()
End Sub
End Class

Binary file not shown.

142
AIMMGM/Pagos.aspx Normal file
View File

@@ -0,0 +1,142 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Pagos.aspx.vb" Inherits="AIMMGM_Pagos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
Pagos
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<table width="100%" cellpadding="0" cellspacing="0">
<tr class="SubTotales">
<td style="width: 80px">Cliente</td>
<td style="width: 280px">
<asp:DropDownList ID="DdlCliente" Width="250px" runat="server" DataTextField="Nombre" DataValueField="CveCliente"></asp:DropDownList></td>
<td style="width: 80px">Estatus</td>
<td style="width: 80px">
<asp:DropDownList Width="100px" ID="DdlEstatus" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Pagados" Selected="True" Value="1"></asp:ListItem>
<asp:ListItem Text="Validados" Value="2"></asp:ListItem>
<asp:ListItem Text="Facturados" Value="3"></asp:ListItem>
</asp:DropDownList></td>
<td>Aprobación:<asp:TextBox ID="TxtAprobacion" Width="55px" runat="server" Text=""></asp:TextBox></td>
<td>&nbsp;</td>
<td>
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" />
<asp:Button ID="BtnSolicitarFactura" runat="server" Text="Solicitar Factura" />
</td>
</tr>
<tr>
<td colspan="6">
<asp:GridView ID="GvPagos" runat="server" AutoGenerateColumns="False" CellPadding="2">
<Columns>
<asp:HyperLinkField HeaderText="Cliente" ControlStyle-CssClass="Texto" DataTextField="Nombre" DataTextFormatString="&nbsp;{0}" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="ConsultaCliente.aspx?CveCliente={0}">
<ItemStyle Width="300px" />
</asp:HyperLinkField>
<asp:BoundField DataField="Fecha" HeaderText="Fecha" DataFormatString="{0:d}" />
<asp:BoundField DataField="Importe" DataFormatString="{0:N2}" HeaderText="Importe" ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Right">
<ItemStyle HorizontalAlign="Right" Width="80px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Doc" ItemStyle-HorizontalAlign="Center">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:HyperLink ID="ImgArchivo" runat="server" Target="_blank" Visible='<%# Eval("Archivo").tostring<>"" %>'><img src="/Imagenes/descargar.png" style="height: 18px; width: 18px;" alt="Descargar Archivo"/></asp:HyperLink>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="Observaciones" HeaderText="Observaciones" />
<asp:BoundField DataField="Aprobacion" HeaderText="Aprobacion" />
<asp:TemplateField HeaderText="Validado" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# if(Eval("Validado").ToString ="True","Si","No") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Requiere Factura" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox ID="ChkRequiereFactura" runat="server" Visible='<%# Eval("Validado").ToString ="False" %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="LnkValidar" Text="Validar" OnClientClick="return confirm('Está seguro de que es válido?')" CommandArgument='<%# Eval("CvePago") %>' CommandName="Validar" runat="server" Visible='<%# Eval("Validado").ToString ="False" %>' OnClick="LnkValidar_Click"></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Facturado" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# If(Eval("Facturado").ToString = "True", "Si", "No")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="Titulos" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
<div style="display: none;">
<asp:GridView ID="GvE" runat="server" AutoGenerateColumns="False" CellPadding="2">
<Columns>
<asp:BoundField DataField="Nombre" HeaderText="Nombre" ItemStyle-Width="350px" ItemStyle-HorizontalAlign="Left">
<ItemStyle Width="350px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="RFC" HeaderText="RFC" />
<asp:TemplateField HeaderText="Calle y Número" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# String.Format("{0} {1} {2}", Eval("Direccion"), Eval("NoExt"), Eval("NoInt"))%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Colonia" HeaderText="Colonia" />
<asp:BoundField DataField="Ciudad" HeaderText="Ciudad" />
<asp:BoundField DataField="Estado" HeaderText="Estado" />
<asp:BoundField DataField="Pais" HeaderText="Pais" />
<asp:BoundField DataField="CP" HeaderText="CP" />
<asp:BoundField DataField="Mail" HeaderText="Correo" />
<asp:BoundField DataField="Importe" HeaderText="Monto" DataFormatString="{0:N2}" />
<asp:TemplateField HeaderText="Moneda" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text="PESOS"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text="PAGADO"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="MetodoPago" HeaderText="FormaPago" />
<asp:TemplateField HeaderText="Factura" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text="SI"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="NumCtaPago" HeaderText="Cuenta" />
<asp:TemplateField HeaderText="Concepto" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text="ExpoMinSon 2014"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="Titulos" BackColor="Gray" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
</div>
</td>
</tr>
</table>
<br/>
</asp:Content>

218
AIMMGM/Pagos.aspx.vb Normal file
View File

@@ -0,0 +1,218 @@

Imports ClosedXML.Excel
Imports Extensiones
Imports System.Data
Partial Class AIMMGM_Pagos
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim Cliente As New ClsClientes
If Cliente.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, 43, -1) Then
DdlCliente.DataSource = Cliente.DtResultados
End If
Cliente.Dispose()
DdlCliente.DataBind()
DdlCliente.Items.Insert(0, New ListItem("Todos", "-1"))
CargaDatos()
End If
'Alert(GeneraContrasena)
End Sub
Sub CargaDatos()
Dim Aprobacion As Integer = -1
Dim AIM As New ClsAIMMGM
If TxtAprobacion.Text.Trim <> "" Then Aprobacion = TxtAprobacion.Text.ToEntero
If AIM.GetPagos(DdlCliente.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, Aprobacion:=Aprobacion) Then
GvPagos.DataSource = AIM.DtResultados
End If
AIM.Dispose()
GvPagos.DataBind()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
Protected Sub GvPagos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPagos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Archivo") <> "" Then
e.Row.FCHyperLink("ImgArchivo").NavigateUrl = String.Format("/Empresas/{0}/Documentos/{1}", UsuarioActual.CveEmpresa, e.Row.DBCampo("Archivo"))
End If
End If
End Sub
Protected Sub LnkValidar_Click(sender As Object, e As EventArgs)
Dim Lnk As LinkButton = CType(sender, LinkButton)
Dim gvr As GridViewRow = CType(Lnk.NamingContainer, GridViewRow)
If Lnk.CommandArgument.ToEntero > 0 Then
Dim AIM As New ClsAIMMGM
If AIM.GetPagos(-1, -1, Lnk.CommandArgument.ToEntero) Then
If AIM.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow = AIM.DtResultados.Rows(0)
EnviaCorreo(dr("Mail").ToString, dr("Importe").ToString.ToDouble, dr("Fecha").ToString.ToDate)
If gvr.FCCheckBox("ChkRequiereFactura").Checked Then
AIM.UpdateEstatus(2, 1, Lnk.CommandArgument.ToEntero)
Else
AIM.UpdateEstatus(4, 1, Lnk.CommandArgument.ToEntero)
End If
End If
End If
AIM.Dispose()
CargaDatos()
End If
End Sub
Private Sub EnviaCorreo(Correo As String, Importe As Double, Fecha As Date)
Dim strSQL As New StringBuilder
strSQL.Append(" <html> ")
strSQL.Append(" <head></head> ")
strSQL.Append(" <body> ")
strSQL.Append(" <img src='http://expominson2014.com/CorreoEncabezado.jpg'><br /> ")
strSQL.Append(" ")
strSQL.Append(" <p class=MsoNormal style='margin-top:15.0pt;margin-right:0cm;margin-bottom: ")
strSQL.Append(" 7.5pt;margin-left:0cm;line-height:normal;mso-outline-level:3'><b><span ")
strSQL.Append(" style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'>SONORA 2014: Minería Moderna, Ejemplo de Industria ")
strSQL.Append(" Responsable</span></b><b><span style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif""; ")
strSQL.Append(" mso-fareast-font-family:""Times New Roman"";mso-bidi-font-family:""Times New Roman""; ")
strSQL.Append(" color:#89BCDC;mso-fareast-language:ES-MX'><o:p></o:p></span></b></p> ")
strSQL.Append(" <br> ")
strSQL.Append(" <br> ")
strSQL.Append(" <p class=MsoNormal style='margin-top:9.0pt;margin-right:0cm;margin-bottom:9.0pt; ")
strSQL.Append(" margin-left:0cm;text-align:justify;line-height:normal'><span style='font-size: ")
strSQL.Append(" 12.0pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family:""Times New Roman""; ")
strSQL.Append(" mso-bidi-font-family:""Times New Roman"";color:#2C2C25;mso-fareast-language:ES-MX'>Estimado Cliente <br> ")
strSQL.AppendFormat(" El Pago por ${0} con fecha {1} ha sido validado. ", Importe.FormatoNumero(), Fecha.ToShortDateString())
strSQL.Append(" <br><br> Muchas gracias por su Pago.")
strSQL.Append(" ")
strSQL.Append(" <br><br> ")
strSQL.Append(" </span></p></body></html> ")
'Dim ObjMail As New ClsSisMail()
Dim Emp As New Empresa
Dim ObjEmp As New ClsSisEmpresas
If ObjEmp.GetEmpresas(43, "-1", "-1", "-1", "-1") Then
Emp = ObjEmp.Empresa
End If
ObjEmp.Dispose()
'If ObjMail.Mandacorreo(Emp, Correo, "ExpominSon 2014: Comprobante de Pago validado", "", "", {""}, strSQL.ToString) Then
'End If
End Sub
Protected Sub BtnSolicitarFactura_Click(sender As Object, e As EventArgs) Handles BtnSolicitarFactura.Click
'solicitar la facturas de los pagos pendientes que no se han facturado
Dim AIM As New ClsAIMMGM
Dim dt As DataTable
If AIM.GetPagos(DdlCliente.SelectedValue.ToEntero, 2) Then
dt = AIM.DtResultados.FiltraParametros("Facturado = 0 and RequiereFactura = 1")
' GvE.Caption = String.Format("<table style='width:100%; background-color:#ADD8E6;'><tr><td>{0}</td></tr></table>", Now.ToLongDateString)
GvE.CaptionAlign = TableCaptionAlign.Left
GvE.DataSource = dt
GvE.DataBind()
If GvE IsNot Nothing AndAlso GvE.Rows.Count > 0 Then
Dim NombreArchivoXLSX As String = "Listado"
Dim dtt As New DataTable(NombreArchivoXLSX)
Dim i As Integer = 0
Dim ArrColumnasVisibles As New List(Of Integer) 'solo recorro las columnas visibles
For Each cell As TableCell In GvE.HeaderRow.Cells
If GvE.Columns(i).Visible Then
dtt.Columns.Add(HttpUtility.HtmlDecode(TextoCelda(cell)))
ArrColumnasVisibles.Add(i)
End If
i += 1
Next
i = 0
For Each row As GridViewRow In GvE.Rows
dtt.Rows.Add()
i = 0
For Each j As Integer In ArrColumnasVisibles
dtt.Rows(dtt.Rows.Count - 1)(i) = TextoCelda(row.Cells(j))
i = i + 1
Next
Next
Dim Archivoxlsx As String = String.Format("{0}/Empresas/{1}/Documentos/{2}.xlsx", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, NombreArchivoXLSX)
Using wb As New XLWorkbook()
wb.Worksheets.Add(dtt)
wb.SaveAs(Archivoxlsx)
End Using
For Each dr As DataRow In AIM.DtResultados.Rows
AIM.UpdateEstatus(3, 1, dr("CvePago").ToString.ToEntero)
Next
EnviaSolicitud("contabilidad2010@aimmgm.org.mx", Archivoxlsx)
Alert("Facturas Solicitadas", TipoMensaje.MsgInformacion)
Else
Alert("No hay pagos que facturar", TipoMensaje.MsgInformacion)
End If
End If
AIM.Dispose()
End Sub
Private Sub EnviaSolicitud(Correo As String, Adjunto As String)
Dim strSQL As New StringBuilder
strSQL.Append(" <html> ")
strSQL.Append(" <head></head> ")
strSQL.Append(" <body> ")
strSQL.Append(" <span style='font-size: ")
strSQL.Append(" 12.0pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family:""Times New Roman""; ")
strSQL.Append(" mso-bidi-font-family:""Times New Roman"";color:#2C2C25;mso-fareast-language:ES-MX'>Hola gracias por elaborar la facturas con los datos anexos<br /><br /> Atentamente<br /><br /> AIMMGM, AC Distrito Sonora")
strSQL.Append(" </span></p> </body></html> ")
Dim ObjMail As New ClsSisMail()
Dim Emp As New Empresa
Dim ObjEmp As New ClsSisEmpresas
If ObjEmp.GetEmpresas(43, "-1", "-1", "-1", "-1") Then
Emp = ObjEmp.Empresa
End If
ObjEmp.Dispose()
'If ObjMail.Mandacorreo(Emp, Correo, "Solicitud de Factura", Adjunto, "", {"admonaimmgm@gmail.com", "facturacion@aimmgm.org.mx"}, strSQL.ToString) Then
'End If
'If ObjMail.Mandacorreo(Emp, Correo, "Solicitud de Factura", Adjunto, "", {"rene.molina@gmail.com", "rene.molina@adsistemas.mx"}, strSQL.ToString) Then
'End If
End Sub
End Class

703
AIMMGM/PopRegistro.aspx.vb Normal file
View File

@@ -0,0 +1,703 @@
Imports System.Data
Imports Extensiones
Partial Class AIMMGM_Registro
Inherits Page
Private Property TmpDT As DataTable
Get
Return CType(ViewState("TmpDT"), DataTable)
End Get
Set(value As DataTable)
ViewState("TmpDT") = value
End Set
End Property
Private Property DTPS As DataTable
Get
Return CType(ViewState("DTPS"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTPS") = value
End Set
End Property
Property CveCliente() As Integer
Get
CveCliente = DirectCast(ViewState("CveCliente"), Integer)
End Get
Set(value As Integer)
ViewState("CveCliente") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'CType(Me.Master, BaseMasterPage).EsPopup = True
'CType(Me.Master, BaseMasterPage).PopupWidth = 1000
If Request("CveCliente") Is Nothing Then
PnlRegistro.Visible = False
Else
CveCliente = IfNull(Request("CveCliente"), "0").ToString.ToEntero
If CveCliente <= 0 Then
PnlRegistro.Visible = False
End If
End If
Dim ObjPS As New ClsProductosServicios()
If ObjPS.GetPS(-1, -1, 43) Then
'ViewState("DTPS") = ObjPS.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa & " AND Estado = 'Activo'", "PS")
ViewState("DTPS") = ObjPS.DtResultados.FiltraParametros("CveEmpresa = 43 AND Estado = 'Activo'", "PS")
End If
ObjPS.Dispose()
CreaTabla()
CargaRegistros("")
GvDias.DataSource = DTPS.FiltraParametros("Clasificacion = 'RegistroParcial' ")
GvDias.DataBind()
GvExtras.DataSource = DTPS.FiltraParametros("Clasificacion = 'Extras' ")
GvExtras.DataBind()
'verifico el total de ventas y si es mayor igual a 20 y lo oculto el producto
Dim dtExcursiones As DataTable = DTPS.FiltraParametros("Clasificacion = 'Excursiones' ")
Dim Contador As Integer = 0
For Each dr As DataRow In dtExcursiones.Rows
Dim AIM As New ClsAIMMGM
If AIM.RepVentasPS(1, -1, -1, -1, "01/01/2014".ToDate, Now, 43) Then
Contador = AIM.DtResultados.COUNT("CvePS", "CvePS = " & dr("CvePS").ToString)
If Contador >= 20 Then
dr("CvePS") = 0
End If
End If
AIM.Dispose()
Next
GVExcursiones.DataSource = dtExcursiones.FiltraParametros("CvePS > 0")
GVExcursiones.DataBind()
GvCursos.DataSource = DTPS.FiltraParametros("Clasificacion = 'Cursos' ")
GvCursos.DataBind()
GvEventos.DataSource = DTPS.FiltraParametros("Clasificacion = 'Eventos Sociales' ")
GvEventos.DataBind()
'' set the transparency of the main map image to display other layers over the satellite map
End If
End Sub
Private Sub CargaRegistros(Opcion As String)
Dim dt As DataTable = DTPS.FiltraParametros("Clasificacion = 'Registro' ", "CvePS")
If Opcion = "Sonora" Then
dt = dt.FiltraParametros("CvePS IN (36972,36975,36976)")
ElseIf Opcion = "Otro" Then
dt = dt.FiltraParametros("CvePS IN (36973,31975,36976)")
Else
dt = dt.FiltraParametros("CvePS IN (36974,31975,36976)")
End If
Dim dr As DataRow = dt.NewRow
dr("CvePS") = 0
dr("PS") = "Visitante por día"
dr("Precio") = 0
dt.Rows.Add(dr)
dt.AcceptChanges()
GvRegistro.DataSource = dt
GvRegistro.DataBind()
End Sub
Private Sub CreaTabla()
TmpDT = New DataTable
TmpDT.Columns.Add("Consec", GetType(Integer))
TmpDT.Columns.Add("Cantidad", GetType(Double))
TmpDT.Columns.Add("Codigo", GetType(String))
TmpDT.Columns.Add("CveUM", GetType(Integer))
TmpDT.Columns.Add("UM", GetType(String))
TmpDT.Columns.Add("CveClasificacion", GetType(Integer))
TmpDT.Columns.Add("Clasificacion", GetType(String))
TmpDT.Columns.Add("CvePS", GetType(Integer))
TmpDT.Columns.Add("PS", GetType(String))
TmpDT.Columns.Add("Obs", GetType(String))
TmpDT.Columns.Add("PU", GetType(Double))
TmpDT.Columns.Add("IVA", GetType(Double))
TmpDT.Columns.Add("RetIVA", GetType(Double))
TmpDT.Columns.Add("Descuento", GetType(Double))
TmpDT.Columns.Add("TipoDescuento", GetType(Integer))
TmpDT.Columns.Add("Total", GetType(Double))
'Para uso del módulo contable
TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer))
TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer))
TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean))
TmpDT.Columns.Add("CveProyecto", GetType(Integer))
TmpDT.Columns.Add("Proyecto", GetType(String))
TmpDT.Columns.Add("CveSubProyecto", GetType(Integer))
TmpDT.Columns.Add("SubProyecto", GetType(String))
TmpDT.Columns.Add("CveMoneda", GetType(Integer))
TmpDT.Columns.Add("Abreviatura", GetType(String))
'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto
End Sub
Protected Sub BtnRegistro_Click(sender As Object, e As EventArgs) Handles BtnRegistro.Click
TmpDT.Clear()
Dim SeleccionarVisitante As Integer = 0
For Each gvr As GridViewRow In GvRegistro.Rows
If gvr.FCCheckBox("RBL").Checked Then
If gvr.DataKey("CvePS").ToEntero > 0 Then
Dim dr As DataRow = TmpDT.NewRow
dr("CvePS") = gvr.DataKey("CvePS")
dr("PS") = gvr.DataKey("PS")
dr("Total") = gvr.DataKey("Precio")
dr("CveMoneda") = gvr.DataKey("CveMoneda")
dr("Abreviatura") = gvr.DataKey("Abreviatura")
TmpDT.Rows.Add(dr)
Else
SeleccionarVisitante = 1
End If
End If
Next
'If Seleccionar = 0 Then
' Alert("Seleccione un registro", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
Dim Contador As Integer = 0
For Each gvr As GridViewRow In GvDias.Rows
If gvr.FCCheckBox("RBL").Checked Then
Contador += 1
Dim dr As DataRow = TmpDT.NewRow
dr("CvePS") = gvr.DataKey("CvePS")
dr("PS") = gvr.DataKey("PS")
dr("Total") = gvr.DataKey("Precio")
dr("CveMoneda") = gvr.DataKey("CveMoneda")
dr("Abreviatura") = gvr.DataKey("Abreviatura")
TmpDT.Rows.Add(dr)
End If
Next
If SeleccionarVisitante = 1 AndAlso Contador = 0 Then
Alert("Seleccione una opción de visitante por día", TipoMensaje.MsgAdvertencia)
RegistraScript("$get('GvDias').style.display='';")
Exit Sub
End If
For Each gvr As GridViewRow In GvExtras.Rows
If gvr.FCCheckBox("RBL").Checked Then
Dim dr As DataRow = TmpDT.NewRow
dr("CvePS") = gvr.DataKey("CvePS")
dr("PS") = gvr.DataKey("PS")
dr("Total") = gvr.DataKey("Precio")
dr("CveMoneda") = gvr.DataKey("CveMoneda")
dr("Abreviatura") = gvr.DataKey("Abreviatura")
dr("Obs") = gvr.FCTextBox("TxtNombre").Text.Trim
TmpDT.Rows.Add(dr)
End If
Next
For Each gvr As GridViewRow In GVExcursiones.Rows
If gvr.FCCheckBox("RBL").Checked Then
Dim dr As DataRow = TmpDT.NewRow
dr("CvePS") = gvr.DataKey("CvePS")
dr("PS") = gvr.DataKey("PS")
dr("Total") = gvr.DataKey("Precio")
dr("CveMoneda") = gvr.DataKey("CveMoneda")
dr("Abreviatura") = gvr.DataKey("Abreviatura")
TmpDT.Rows.Add(dr)
If TxtProfesion.Text.Trim = "" Then
Alert("Ingrese por favor la profesión", TipoMensaje.MsgAdvertencia)
RegistraScript("$get('divprofesion').style.display='';")
Exit Sub
End If
End If
Next
For Each gvr As GridViewRow In GvCursos.Rows
If gvr.FCCheckBox("RBL").Checked Then
Dim dr As DataRow = TmpDT.NewRow
dr("CvePS") = gvr.DataKey("CvePS")
dr("PS") = gvr.DataKey("PS")
dr("Total") = gvr.DataKey("Precio")
dr("CveMoneda") = gvr.DataKey("CveMoneda")
dr("Abreviatura") = gvr.DataKey("Abreviatura")
TmpDT.Rows.Add(dr)
End If
Next
For Each gvr As GridViewRow In GvEventos.Rows
If gvr.FCCheckBox("RBL").Checked Then
Dim dr As DataRow = TmpDT.NewRow
dr("CvePS") = gvr.DataKey("CvePS")
dr("PS") = gvr.DataKey("PS")
dr("Total") = gvr.DataKey("Precio")
dr("CveMoneda") = gvr.DataKey("CveMoneda")
dr("Abreviatura") = gvr.DataKey("Abreviatura")
TmpDT.Rows.Add(dr)
End If
Next
PnlEventos.Visible = False
PnlPagar.Visible = True
GvCompras.DataSource = TmpDT
GvCompras.DataBind()
End Sub
Protected Sub GvCompras_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCompras.RowDataBound
If e.Row.RowType = DataControlRowType.Footer Then
e.Row.FCLabel("LblTotal").Text = TmpDT.SUM("Total").ToString("N2") & " MXN"
End If
End Sub
Protected Sub BtnSiguiente_Click(sender As Object, e As EventArgs) Handles BtnSiguiente.Click
If TxtNombres.Text = "" Then
Alert("El campo <b>Nombre</b> es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtAPaterno.Text = "" Then
Alert("El campo <b>Apellido Paterno</b> es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'If TxtEmail.Text = "" Then
' Alert("El campo <b>Correo</b> es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
'If TxtTelefono.Text = "" Then
' Alert("El campo <b>Teléfono</b> es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
PnlEventos.Visible = True
PnlRegistro.Visible = False
End Sub
Public Sub Alert(Mensaje As String, pOpcion As TipoMensaje, Optional JSBtnAceptar As String = "")
If System.Web.HttpContext.Current IsNot Nothing AndAlso System.Web.HttpContext.Current.Handler IsNot Nothing Then
Dim Img, Botones As String
Dim Titulo As String
Dim Plus As String = DateTime.Now.Ticks.ToString
Mensaje = Mensaje.Replace("'"c, "\'")
JSBtnAceptar = JSBtnAceptar.Replace("'"c, "\'")
Select Case pOpcion
Case TipoMensaje.MsgInformacion
Titulo = "Información"
Img = "I"
'Img = "<img src=""/Imagenes/Mensajes/Information.jpg"" width=""50px"" style=""float:left;"" alt="""" />"
'Botones = String.Format("<input id=""_CmdAceptar"" type=""button"" value=""Aceptar"" onclick=""OcultaAlert();{1}"" />", Plus, JSBtnAceptar)
Botones = "1"
Case TipoMensaje.MsgConfirmacion
Titulo = "Confirmación"
Img = "C"
'Img = "<img src=""/Imagenes/Mensajes/Interrogation.jpg"" width=""50px"" style=""float:left;"" alt="""" />"
'Botones = String.Format("<input id=""_CmdAceptar"" type=""button"" value=""Aceptar"" onclick=""OcultaAlert();{1} return true;""><input type=""Button"" value=""Cancelar"" onclick=""OcultaAlert(\""{0}\""); return false;"">", Plus, JSBtnAceptar)
Botones = "2"
Case TipoMensaje.MsgAdvertencia
Titulo = "Advertencia"
Img = "A"
'Img = "<img src=""/Imagenes/Mensajes/Exclamation.jpg"" width=""50px"" style=""float:left;"" alt="""" />"
'Botones = String.Format("<input id=""_CmdAceptar"" type=""button"" value=""Aceptar"" onclick=""OcultaAlert();{1}"" />", Plus, JSBtnAceptar)
Botones = "1"
Case Else
Titulo = "Error"
Img = "E"
'Img = "<img src=""/Imagenes/Mensajes/Error.jpg"" width=""50px"" style=""float:left;"" alt="""" />"
'Botones = String.Format("<input id=""_CmdAceptar"" type=""button"" value=""Aceptar"" onclick=""OcultaAlert();"" />", Plus, JSBtnAceptar)
Botones = "1"
End Select
Try
Dim Pag As Page = DirectCast(System.Web.HttpContext.Current.Handler, Page)
'ScriptManager.RegisterStartupScript(Pag, Pag.GetType(), (DateTime.Now.Ticks + 1).ToString(), "MuestraAlert('" & Alerta.ToString() & "', '" & Plus & "');", True)
ScriptManager.RegisterStartupScript(Pag, Pag.GetType(), (DateTime.Now.Ticks + 1).ToString(), String.Format("MuestraAlerta('{0}','{1}','{2}','{3}','{4}');", Titulo, Mensaje, Img, Botones, JSBtnAceptar), True)
Pag = Nothing
Catch ex As Exception
End Try
'Alerta = Nothing
End If
End Sub
Protected Sub BtnRegresar1_Click(sender As Object, e As EventArgs) Handles BtnRegresar1.Click
PnlRegistro.Visible = True
PnlEventos.Visible = False
End Sub
Protected Sub BtnRegresar2_Click(sender As Object, e As EventArgs) Handles BtnRegresar2.Click
PnlEventos.Visible = True
PnlPagar.Visible = False
End Sub
Protected Sub BtnSocio_Click(sender As Object, e As EventArgs) Handles BtnSocio.Click
If TxtFolioSocio.Text.ToEntero = 0 Then
TxtAPaterno.Text = ""
TxtAMaterno.Text = ""
TxtNombres.Text = ""
TxtNombres.Enabled = True
HdnSocioDistrito.Value = ""
Else
Dim Prosp As New ClsProspectos
If Prosp.GetProspectos(-1, "-1", "-1", -1, -1, -1, -1, -1, TxtFolioSocio.Text.ToEntero, 43) Then
If Prosp.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow = Prosp.DtResultados.Rows(0)
TxtAPaterno.Text = dr("ApellidoPaterno").ToString
TxtAMaterno.Text = dr("ApellidoMaterno").ToString
TxtNombres.Text = dr("Nombres").ToString
TxtNombres.Enabled = False
If dr("CveProspectoClasificacion").ToString.ToEntero = 61 Then
HdnSocioDistrito.Value = "Sonora"
Else
HdnSocioDistrito.Value = "Otro"
End If
Else
TxtAPaterno.Text = ""
TxtAMaterno.Text = ""
TxtNombres.Text = ""
TxtNombres.Enabled = True
HdnSocioDistrito.Value = ""
End If
End If
Prosp.Dispose()
End If
CargaRegistros(HdnSocioDistrito.Value)
End Sub
Protected Sub BtnRegistraCompra_Click(sender As Object, e As EventArgs) Handles BtnRegistraCompra.Click
Dim Nombre As String = TxtNombres.Text.Trim & " " & TxtAPaterno.Text.Trim & " " & TxtAMaterno.Text.Trim
Dim CveMetodoPago As Integer = 0
Dim Cliente As New ClsClientes
If Cliente.GetClientes(-1, Nombre, "-1", "-1", "-1", "-1", "-1", -1, 43, -1) Then
If Cliente.DtResultados.Rows.Count > 0 Then
CveMetodoPago = Cliente.CveMetodoPago
End If
End If
Cliente.Dispose()
Dim Errorr As Boolean = False
Dim Venta As New ClsVentas
Venta.IniciaTransacSQL()
Dim tnombre As String
Dim TieneExcursion As Boolean = False
'DdlFiscalMetodoPago.SelectedValue.ToEntero1,
If Venta.AddVenta("Rem", 0, CveCliente, 2069, TmpDT.SUM("Total"), 0, 0, 0, 0, 0, TmpDT.SUM("Total"), 1, 0, CveMetodoPago, 0, 0, Now, "", "", 0, Now, -1, -1, "", "", "", 0, 0, 0, 0, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, -1, -1, 0, 1, 0, 2069, 43) Then
Dim CveVenta As Integer = Venta.CveVenta
For Each dr As DataRow In TmpDT.Rows
Dim CveUnidadMedida As Integer
Dim PS As New ClsProductosServicios
If PS.GetPS(dr("CvePS").ToString.ToEntero, -1, 43) Then
If PS.DtResultados.Rows.Count > 0 Then
CveUnidadMedida = PS.DtResultados.Rows(0)("CveUnidadMedida").ToString.ToEntero
If PS.DtResultados.Rows(0)("Clasificacion").ToString = "Excursiones" Then
TieneExcursion = True
End If
End If
End If
PS.Dispose()
If dr("CvePS").ToString.ToEntero = 36977 Then 'cuando es acompa;ante pongo el nombre del acompa;ante
tnombre = dr("Obs").ToString
Else
tnombre = Nombre
End If
If Not Venta.AddVentaDetalle(CveVenta, dr("CvePS").ToString.ToEntero, 1, CveUnidadMedida, dr("Total").ToString.ToDouble, 0, dr("Total").ToString.ToDouble, tnombre, 0, 0, -1, -1) Then
Errorr = True
Exit Sub
End If
Next
Else
Errorr = True
End If
If Not Errorr Then
Venta.Commit()
Alert("<br>Su Registro se ha realizado correctamente.<br><br> Se le estará enviando al correo proporcionado la información necesaria para el acceso de su portal.<br><br>", TipoMensaje.MsgInformacion, "tb_remove();")
'EnviaNotificacion(TmpDT, "nunezothon@yahoo.com.mx") '"rene.molina@adsistemas.mx") '
If TieneExcursion Then
EnviaNotificacion(TmpDT, "ppadilla@imdex-cascabel.com") '"rene.molina@adsistemas.mx") '
End If
'ActivaPortal(CveCliente, TxtEmail.Text.Trim) '"rene.molina@adsistemas.mx") '
'envio de correo a la persona que controla el area, Aristeo,.. .
'se activa su portal del cliente
BtnRegistraCompra.Enabled = False
LblMensaje.Text = "Su Registro se ha realizado correctamente"
Else
Alert("No se pudo realizar la compra, Favor de intentarlo mas tarde", TipoMensaje.MsgAdvertencia)
Venta.RollBack()
End If
Venta.Dispose()
'Dim Prosp As New ClsProspectos
'Dim Cve As Integer
'Cve = Prosp.AddProspectos(-1, TxtAPaterno.Text, TxtAMaterno.Text, TxtNombres.Text, "01/01/1900".ToDate, "", "", "", 1, "", "", "", "", "", "", -1, -1, TxtTelefono.Text, "", "", "",
' TxtEmail.Text, "", "", "", -1, -1, -1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", False,
' TxtFiscalRazon.Text, TxtFiscalCalle.Text, TxtFiscalColonia.Text, TxtFiscalCP.Text, -1, TxtFiscalRFC.Text,
' -1, -1, -1, "", -1, -1, -1, False, "", -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
''registrar la venta
'Prosp.Dispose()
End Sub
Private Sub EnviaNotificacion(dtt As DataTable, Correo As String)
'Dim ObjMail As New ClsSisMail()
Dim Body As New StringBuilder
Body.AppendFormat("Se ha realizado el registro de: {0} {1} {2}<br><br>El detalle de lo registrado es:", TxtAPaterno.Text, TxtAMaterno.Text, TxtNombres.Text)
Body.AppendFormat("<table width='500px'>")
For Each dr As DataRow In TmpDT.Rows
Body.AppendFormat("<tr><td style='width:400px'>{0}</td><td style='width:100px'>{1} {2}</td></tr>", dr("PS"), dr("Total"), dr("Abreviatura"))
Next
Body.AppendFormat("</table>")
Dim Emp As New Empresa
Dim ObjEmp As New ClsSisEmpresas
If ObjEmp.GetEmpresas(43, "-1", "-1", "-1", "-1") Then
Emp = ObjEmp.Empresa
End If
ObjEmp.Dispose()
'If ObjMail.Mandacorreo(Emp, Correo, "Notificación de compra", "", "", {""}, Body.ToString) Then
'End If
End Sub
Private Sub ActivaPortal(CveCliente As Integer, Correo As String)
'guarda el nuevo usuario
Dim Usr As New ClsSisUsuarios
Dim CveUsr As Integer
Dim ContraseñaPredeterminada As String = "-acceso-"
Dim Activa As Boolean = True
If Usr.GetUsuariosPortal(-1, CveCliente, -1) Then
If Usr.DtResultados.Rows.Count = 0 Then
'lo ingreso
CveUsr = Usr.AddUsuarioPortal("Admin", "-acceso-", "Administrador", "", CveCliente, -1, True, True, True, True, True, True, True, True, True, True, 1, 0)
'lo desactivo para que me pida la nueva contrase;a en el portal
If CveUsr > 0 Then
Usr.UpdateUsuarioPortal("Admin", "Administrador", "", True, True, True, True, True, True, True, True, True, True, False, ContraseñaPredeterminada, CveCliente, 0, CveUsr)
End If
Activa = True
Else
CveUsr = Usr.DtResultados.Rows(0)("CveUsuarioPortal").ToString.ToEntero
If Usr.DtResultados.Rows(0)("Estatus").ToString = "0" Then
Activa = True 'sino esta activada la cuenta, sigue mandando la liga para activar
Else
Activa = False
End If
End If
End If
Usr.Dispose()
If CveUsr > 0 Then
Dim Liga As String = "http://aimmgm.adsistemas.mx/AIMMGM/Portal.aspx"
Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsr & "&Clave=" & CveCliente & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks)
Dim strSQL As New StringBuilder
strSQL.Append(" <html> ")
strSQL.Append(" <head></head> ")
strSQL.Append(" <body> ")
strSQL.Append(" <img src='http://expominson2014.com/CorreoEncabezado.jpg'><br /> ")
strSQL.Append(" ")
strSQL.Append(" <p class=MsoNormal style='margin-top:15.0pt;margin-right:0cm;margin-bottom: ")
strSQL.Append(" 7.5pt;margin-left:0cm;line-height:normal;mso-outline-level:3'><b><span ")
strSQL.Append(" style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'>SONORA 2014: Minería Moderna, Ejemplo de Industria ")
strSQL.Append(" Responsable</span></b><b><span style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif""; ")
strSQL.Append(" mso-fareast-font-family:""Times New Roman"";mso-bidi-font-family:""Times New Roman""; ")
strSQL.Append(" color:#89BCDC;mso-fareast-language:ES-MX'><o:p></o:p></span></b></p> ")
strSQL.Append(" <br> ")
strSQL.Append(" <br> ")
strSQL.Append(" <p class=MsoNormal style='margin-top:9.0pt;margin-right:0cm;margin-bottom:9.0pt; ")
strSQL.Append(" margin-left:0cm;text-align:justify;line-height:normal'><span style='font-size: ")
strSQL.Append(" 12.0pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family:""Times New Roman""; ")
strSQL.Append(" mso-bidi-font-family:""Times New Roman"";color:#2C2C25;mso-fareast-language:ES-MX'>Estimado ")
strSQL.Append(" Socio y Amigo, Gracias por su asistencia, le brindamos la dirección al portal. ")
strSQL.Append(" ")
strSQL.Append(" ")
strSQL.Append(" <br><br> ")
If Activa Then strSQL.AppendFormat("<br>Haga click para activar su cuenta <a href='{0}' target='_blank'>Activar</a>", LigaActivar)
strSQL.Append(" <br><br> ")
strSQL.AppendFormat(" Dirección de acceso al Portal: <a href='{0}' target='_blank'>Portal AIMMGM</a> ", Liga)
strSQL.Append(" <br><br> ")
strSQL.Append(" Datos de acceso: ")
strSQL.Append(" <br><br> ")
strSQL.AppendFormat(" Clave Cliente: {0}", CveCliente)
strSQL.Append(" <br><br> ")
strSQL.Append(" Dentro del Portal usted tendrá acceso a visualizar el detalle de sus compras, subir la comprobación de sus pagos. ")
strSQL.Append(" <br><br><table id=""TrPagoss"" width=""994px"" style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td colspan=""2"" style=""background-color:#5D7B9D; text-align: center; height: 20px;""> ")
strSQL.Append(" Pagos-Transferencias Nacionales ")
strSQL.Append(" <b></b> ")
strSQL.Append(" </td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td style=""width:275px;"">Banco:</td><td><b>Inbursa</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Sucursal:</td><td><b>Nápoles 021</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Cuenta:</td><td><b>50019145334</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>CLABE:</td><td><b>036180500191453345</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nombre del Beneficiario:</td><td><b>Asociación de Ingenieros de Minas, Metalurgistas y Geólogos de México A.C.</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" ")
strSQL.Append(" </table> ")
strSQL.Append(" <br/> ")
strSQL.Append(" <table id=""TrPagoss2"" width=""994px""style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td colspan=""2"" style=""background-color:#5D7B9D; text-align: center; height: 20px;""> ")
strSQL.Append(" Pagos-Transferencias Internacionales ")
strSQL.Append(" <b></b> ")
strSQL.Append(" </td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td style=""width:275px;"">Moneda:</td><td><b>Dólares Americanos</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Banco:</td><td><b>JPMorgan Chase Bank New York NY USA</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Código Swift:</td><td><b>CHASUS33</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Ruta Banco Receptor (ABA):</td><td><b>021 000 021</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nombre del Beneficiario:</td><td><b>Asociación de Ingenieros de Minas, Metalurgistas y Geólogos de México A.C. </b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Cuenta del Beneficiario:</td><td><b>50019145334</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>CLABE:</td><td><b>036180500191453345</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Banco Beneficiario:</td><td><b>Banco Inbursa, S.A. México, D.F.</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nuestro Código Swift:</td><td><b>INBUMXMM</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" ")
strSQL.Append(" </table> ")
strSQL.Append(" </span></p> ")
strSQL.Append(" </body> ")
'Dim ObjMail As New ClsSisMail()
Dim Emp As New Empresa
Dim ObjEmp As New ClsSisEmpresas
If ObjEmp.GetEmpresas(43, "-1", "-1", "-1", "-1") Then
Emp = ObjEmp.Empresa
End If
ObjEmp.Dispose()
'If ObjMail.Mandacorreo(Emp, Correo, If(Activa, "Activación de cuenta ExpominSon 2014", "Registro de Compra ExpominSon 2014"), "", "", {""}, strSQL.ToString) Then
'End If
End If
End Sub
Protected Sub GvRegistro_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRegistro.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CvePS").ToEntero > 0 Then
e.Row.FCRadioButton("RBL").Attributes.Add("onclick", "$get('GvDias').style.display='none'; ChkGrid();")
Else
e.Row.FCLabel("Label1").Visible = False
e.Row.FCLabel("Label2").Visible = False
e.Row.FCRadioButton("RBL").Attributes.Add("onclick", "$get('GvDias').style.display='';")
End If
End If
End Sub
Protected Sub GVExcursiones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVExcursiones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCRadioButton("RBL").Attributes.Add("onclick", "$get('divprofesion').style.display='';")
End If
End Sub
End Class

1121
AIMMGM/Registro.aspx.vb Normal file

File diff suppressed because it is too large Load Diff

49
AIMMGM/Saldos.aspx Normal file
View File

@@ -0,0 +1,49 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Saldos.aspx.vb" Inherits="AIMMGM_Saldos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="H" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" Runat="Server">
Saldos
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" Runat="Server">
<table width="100%" cellpadding="0" cellspacing="0">
<tr class="SubTotales">
<td style="width: 80px">Opción</td>
<td style="width: 80px">
<asp:DropDownList Width="100px" ID="DdlTipo" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Registros" Value="1"></asp:ListItem>
<asp:ListItem Text="Stand" Value="2"></asp:ListItem>
<asp:ListItem Text="Patrocinios" Value="3"></asp:ListItem>
</asp:DropDownList></td>
<td>&nbsp;</td>
<td>
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" /></td>
</tr>
<tr>
<td colspan="6">
<asp:UpdatePanel ID="UPPDatos" UpdateMode="Conditional" runat="server"><ContentTemplate>
<asp:GridView ID="Gv" runat="server" AutoGenerateColumns="False" CellPadding="2">
<Columns>
<asp:HyperLinkField HeaderText="Cliente" ControlStyle-CssClass="Texto" DataTextField="Nombre" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="ConsultaCliente.aspx?CveCliente={0}">
<ItemStyle Width="300px" />
</asp:HyperLinkField>
<asp:BoundField DataField="Compras" HeaderText="# Compras" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="SubTotal" DataFormatString="{0:N2}" HeaderText="Importe" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Pagado" DataFormatString="{0:N2}" HeaderText="Pagado" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Saldo" DataFormatString="{0:N2}" HeaderText="Saldo" ItemStyle-HorizontalAlign="Right" />
</Columns>
<HeaderStyle CssClass="Titulos" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="BtnConsultar" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Content>

29
AIMMGM/Saldos.aspx.vb Normal file
View File

@@ -0,0 +1,29 @@

Imports Extensiones
Partial Class AIMMGM_Saldos
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaDatos()
End If
End Sub
Private Sub CargaDatos()
Dim AIM As New ClsAIMMGM
If AIM.RepSaldos(DdlTipo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
Gv.DataSource = AIM.DtResultados
End If
AIM.Dispose()
Gv.DataBind()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
End Class

100
AIMMGM/VentasPS.aspx Normal file
View File

@@ -0,0 +1,100 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="VentasPS.aspx.vb" Inherits="AIMMGM_Ventas" %>
<asp:Content ID="Content1" ContentPlaceHolderID="H" Runat="Server">
<asp:ImageButton ID="ImgExcel" runat="server" ImageUrl="/Imagenes/IconoExcel.gif" Width="17px" Height="17px" />&nbsp;
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" Runat="Server">
Registros
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" Runat="Server">
<table width="100%" cellpadding="0" cellspacing="0">
<tr class="SubTotales">
<td style="width: 80px">Opción:</td>
<td style="width: 200px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
<table width="100%"><tr><td> <asp:DropDownList Width="100px" ID="DdlTipo" runat="server" AutoPostBack="True">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Registros" Value="1"></asp:ListItem>
<asp:ListItem Text="Stand" Value="2"></asp:ListItem>
<asp:ListItem Text="Patrocinios" Value="3"></asp:ListItem>
</asp:DropDownList> </td><td><asp:DropDownList Width="100px" Visible="False" ID="DdlSubTipo" DataTextField="PS" DataValueField="CvePS" runat="server"></asp:DropDownList></td></tr></table>
</ContentTemplate></asp:UpdatePanel>
</td>
<td style="width:50px;">Pagado:</td>
<td><asp:DropDownList Width="50px" ID="DdlPagado" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Si" Value="1"></asp:ListItem>
<asp:ListItem Text="No" Value="0"></asp:ListItem>
</asp:DropDownList></td>
<td style="width:50px;">Comprobado:</td>
<td><asp:DropDownList Width="50px" ID="DdlComprobado" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Sin Comp" Value="0"></asp:ListItem>
<asp:ListItem Text="Efectivo" Value="1"></asp:ListItem>
<asp:ListItem Text="Terminal" Value="2"></asp:ListItem>
<asp:ListItem Text="Enlinea" Value="3"></asp:ListItem>
<asp:ListItem Text="Deposito" Value="4"></asp:ListItem>
</asp:DropDownList></td>
<td style="width: 80px">&nbsp;Fecha I.:&nbsp;</td>
<td style="width: 100px">
<asp:TextBox ID="txtFechaI" runat="server" Width="65px"></asp:TextBox>
&nbsp;<asp:ImageButton runat="server" ID="imgCalendario" ImageUrl="/Imagenes/calendar.png" ImageAlign="AbsMiddle" Width="16px" Height="16px" AlternateText="Click para ver el Calendario" />
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>&nbsp;
</td>
<td style="width: 80px">&nbsp;Fech. F.:&nbsp;</td>
<td style="width: 100px">
<asp:TextBox ID="txtFechaF" runat="server" Width="65px"></asp:TextBox>
&nbsp;<asp:ImageButton runat="server" ID="imgCalendarioF" ImageUrl="/Imagenes/calendar.png" ImageAlign="AbsMiddle" Width="16px" Height="16px" AlternateText="Click para ver el Calendario" />
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
&nbsp;
</td>
<td>&nbsp;</td>
<td>
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" /></td>
</tr>
<tr>
<td colspan="10">
<asp:UpdatePanel ID="UPPDatos" UpdateMode="Conditional" runat="server"><ContentTemplate>
<asp:Label ID="LblRegistros" runat="server" Text=""></asp:Label>
<asp:GridView ID="Gv" runat="server" AutoGenerateColumns="False" CellPadding="2">
<Columns>
<asp:HyperLinkField HeaderText="Cliente" ControlStyle-CssClass="Texto" DataTextField="Nombre" DataTextFormatString="&nbsp;{0}" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="ConsultaCliente.aspx?CveCliente={0}">
<ItemStyle Width="300px" />
</asp:HyperLinkField>
<asp:BoundField DataField="PS" HeaderText="Producto" ItemStyle-HorizontalAlign="Left">
<ItemStyle Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="Observaciones" HeaderText="Referencia" ItemStyle-HorizontalAlign="Left">
<ItemStyle Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="PU" DataFormatString="{0:N2}" HeaderText="Importe" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Fecha" DataFormatString="{0:d}" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Mail" HeaderText="Correo" ItemStyle-HorizontalAlign="Left">
<ItemStyle Width="150px" />
</asp:BoundField>
</Columns>
<HeaderStyle CssClass="Titulos" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="BtnConsultar" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Content>

65
AIMMGM/VentasPS.aspx.vb Normal file
View File

@@ -0,0 +1,65 @@

Imports System.Data
Imports Extensiones
Partial Class AIMMGM_Ventas
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
txtFechaI.Text = "01/01/" & Now.Year
txtFechaF.Text = Now.ToShortDateString
Dim dt As DataTable
Dim PS As New ClsProductosServicios
If PS.GetPS(-1, -1, 43) Then
dt = PS.DtResultados.FiltraParametros("CveClasificacion IN (4361,4362,4363,4364,4365,5585)")
DdlSubTipo.DataSource = dt
DdlSubTipo.DataBind()
DdlSubTipo.Items.Insert(0, New ListItem("Todos", "-1"))
End If
PS.Dispose()
CargaDatos()
End If
End Sub
Private Sub CargaDatos()
Dim AIM As New ClsAIMMGM
If AIM.RepVentasPS(DdlTipo.SelectedValue.ToEntero, DdlSubTipo.SelectedValue.ToEntero, DdlPagado.SelectedValue.ToEntero, DdlComprobado.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, UsuarioActual.CveEmpresa) Then
Gv.DataSource = AIM.DtResultados
LblRegistros.Text = String.Format("Registros:{0}", AIM.DtResultados.Rows.Count)
End If
AIM.Dispose()
Gv.DataBind()
UPPDatos.Update()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
Protected Sub ImgExcel_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgExcel.Click
Gv.ExportToExcelx("ListadoVentas")
End Sub
Protected Sub DdlTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipo.SelectedIndexChanged
If DdlTipo.SelectedValue = "1" Then
DdlSubTipo.Visible = True
Else
DdlSubTipo.Visible = False
DdlSubTipo.SelectedValue = "-1"
End If
End Sub
End Class

441
AIMMGM/ePagos.aspx.vb Normal file
View File

@@ -0,0 +1,441 @@
Imports System.Data
Imports Extensiones
Imports System.IO
Partial Class AIMMGM_ePagos
Inherits Page
Private Property TmpDT As DataTable
Get
Return CType(ViewState("TmpDT"), DataTable)
End Get
Set(value As DataTable)
ViewState("TmpDT") = value
End Set
End Property
Private Property DTPS As DataTable
Get
Return CType(ViewState("DTPS"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTPS") = value
End Set
End Property
Property GlobalDTGralEstados(CvePais As Integer) As DataTable
Get
GlobalDTGralEstados = DirectCast(Application("GlobalDTGralEstados"), DataTable).FiltraParametros(String.Format("CvePais ={0}", CvePais))
End Get
Set(value As DataTable)
Application("GlobalDTGralEstados") = value
End Set
End Property
Property ClavePago() As String
Get
ClavePago = Application("ClavePago").ToString
End Get
Set(value As String)
Application("ClavePago") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'CType(Me.Master, BaseMasterPage).EsPopup = True
'CType(Me.Master, BaseMasterPage).PopupWidth = 1000
'Dim ObjPS As New ClsProductosServicios()
'If ObjPS.GetPS(-1, -1, 43) Then
' 'ViewState("DTPS") = ObjPS.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa & " AND Estado = 'Activo'", "PS")
' ViewState("DTPS") = ObjPS.DtResultados.FiltraParametros("CveEmpresa = 43 AND Estado = 'Activo'", "PS")
'End If
'ObjPS.Dispose()
Dim Cadena As String = Decripta(Request("p"))
If Cadena <> "" Then
ClsPaginas.CargaParametros(Cadena)
If ClsPaginas.UrlParametros("CVE") IsNot Nothing AndAlso ClsPaginas.UrlParametros("F") IsNot Nothing Then
Dim Fecha As String = ClsPaginas.UrlParametros("F").ToString
If Fecha.ToDate > Now.AddHours(-1) AndAlso ClsPaginas.UrlParametros("P") IsNot Nothing AndAlso ClsPaginas.UrlParametros("P").ToString = "1" Then
ClavePago = ClsPaginas.UrlParametros("CVE").ToString
CargaCompra()
Else
If ClsPaginas.UrlParametros("NP") IsNot Nothing AndAlso ClsPaginas.UrlParametros("NP").ToString = "1" Then
LblMensaje.Text = "No se pudo realizar el pago de la compra. favor de intentarlo de nuevo"
HplReIntentar.Visible = True
HplReIntentar.NavigateUrl = String.Format("Registro.aspx?CP={0}&C={1}", ClsPaginas.UrlParametros("CVE"), ClsPaginas.UrlParametros("CVECLIENTE"))
End If
End If
End If
End If
End If
End Sub
Private Sub CargaCompra()
Dim tmp As New DataTable
Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", AppDomain.CurrentDomain.BaseDirectory)
Dim Archivo As String = String.Format("{0}/{1}.xml", Carpeta, ClavePago)
Dim Archivo2 As String = String.Format("{0}/C{1}.xml", Carpeta, ClavePago)
If File.Exists(Archivo) Then
tmp.ReadXml(Archivo)
TmpDT = tmp
PnlPagar.Visible = True
GvCompras.DataSource = tmp
GvCompras.DataBind()
Dim CveCliente As Integer = tmp.MAX("CveCliente").ToString.ToEntero
Dim Nombre As String = ""
Dim CveMetodoPago As Integer = 0
Dim Cliente As New ClsClientes
If Cliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, 43, -1) Then
If Cliente.DtResultados.Rows.Count > 0 Then
CveMetodoPago = Cliente.CveMetodoPago
Nombre = Cliente.Nombre
End If
End If
Cliente.Dispose()
Dim Errorr As Boolean = False
Dim Venta As New ClsVentas
Dim AIM As New ClsAIMMGM(Venta.IniciaTransacSQL)
Dim tnombre As String
Dim TieneExcursion As Boolean = False
If Venta.AddVenta("Rem", 0, CveCliente, 2069, TmpDT.SUM("Total"), 0, 0, 0, 0, 0, TmpDT.SUM("Total"), 1, 0, CveMetodoPago, 0, 0, Now, "", "", -1, Now, -1, -1, "", "", "", 0, 0, 0, 0, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, -1, -1, 0, 1, 0, 2069, 43) Then
Dim CveVenta As Integer = Venta.CveVenta
For Each dr As DataRow In TmpDT.Rows
Dim CveUnidadMedida As Integer
Dim PS As New ClsProductosServicios
If PS.GetPS(dr("CvePS").ToString.ToEntero, -1, 43) Then
If PS.DtResultados.Rows.Count > 0 Then
CveUnidadMedida = PS.DtResultados.Rows(0)("CveUnidadMedida").ToString.ToEntero
If PS.DtResultados.Rows(0)("Clasificacion").ToString = "Excursiones" Then
TieneExcursion = True
End If
End If
End If
PS.Dispose()
If dr("CvePS").ToString.ToEntero = 36977 Then 'cuando es acompa;ante pongo el nombre del acompa;ante
tnombre = dr("Obs").ToString
Else
tnombre = Nombre
End If
If Not Venta.AddVentaDetalle(CveVenta, dr("CvePS").ToString.ToEntero, 1, CveUnidadMedida, dr("Total").ToString.ToDouble, 0, dr("Total").ToString.ToDouble, tnombre, 0, 0, -1, 0) Then
Errorr = True
Exit For
End If
Next
If Not Errorr Then
If AIM.AddPago(CveCliente, -1, TmpDT.SUM("Total"), 1, Now, "", "Pago en línea", 0, 0) <= 0 Then
Errorr = True
End If
If Not Errorr Then
If Not AIM.AddUpdVentaDetallePagado(Venta.CveVentaDetalle, True) Then
Errorr = True
End If
End If
End If
Else
Errorr = True
End If
If Not Errorr Then
File.Move(Archivo, Archivo2)
LblMensaje.Text = "El Pago se registró con éxito"
Venta.Commit()
Else
Venta.RollBack()
End If
Venta.Dispose()
AIM.Dispose()
Else
LblMensaje.Text = "Pago ya registrado"
End If
End Sub
Protected Sub GvCompras_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCompras.RowDataBound
If e.Row.RowType = DataControlRowType.Footer Then
e.Row.FCLabel("LblTotal").Text = TmpDT.SUM("Total").ToString("N2") & " MXN"
End If
End Sub
Public Sub Alert(Mensaje As String, pOpcion As TipoMensaje, Optional JSBtnAceptar As String = "")
If System.Web.HttpContext.Current IsNot Nothing AndAlso System.Web.HttpContext.Current.Handler IsNot Nothing Then
Dim Img, Botones As String
Dim Titulo As String
Dim Plus As String = DateTime.Now.Ticks.ToString
Mensaje = Mensaje.Replace("'"c, "\'")
JSBtnAceptar = JSBtnAceptar.Replace("'"c, "\'")
Select Case pOpcion
Case TipoMensaje.MsgInformacion
Titulo = "Información"
Img = "I"
'Img = "<img src=""/Imagenes/Mensajes/Information.jpg"" width=""50px"" style=""float:left;"" alt="""" />"
'Botones = String.Format("<input id=""_CmdAceptar"" type=""button"" value=""Aceptar"" onclick=""OcultaAlert();{1}"" />", Plus, JSBtnAceptar)
Botones = "1"
Case TipoMensaje.MsgConfirmacion
Titulo = "Confirmación"
Img = "C"
'Img = "<img src=""/Imagenes/Mensajes/Interrogation.jpg"" width=""50px"" style=""float:left;"" alt="""" />"
'Botones = String.Format("<input id=""_CmdAceptar"" type=""button"" value=""Aceptar"" onclick=""OcultaAlert();{1} return true;""><input type=""Button"" value=""Cancelar"" onclick=""OcultaAlert(\""{0}\""); return false;"">", Plus, JSBtnAceptar)
Botones = "2"
Case TipoMensaje.MsgAdvertencia
Titulo = "Advertencia"
Img = "A"
'Img = "<img src=""/Imagenes/Mensajes/Exclamation.jpg"" width=""50px"" style=""float:left;"" alt="""" />"
'Botones = String.Format("<input id=""_CmdAceptar"" type=""button"" value=""Aceptar"" onclick=""OcultaAlert();{1}"" />", Plus, JSBtnAceptar)
Botones = "1"
Case Else
Titulo = "Error"
Img = "E"
'Img = "<img src=""/Imagenes/Mensajes/Error.jpg"" width=""50px"" style=""float:left;"" alt="""" />"
'Botones = String.Format("<input id=""_CmdAceptar"" type=""button"" value=""Aceptar"" onclick=""OcultaAlert();"" />", Plus, JSBtnAceptar)
Botones = "1"
End Select
Try
Dim Pag As Page = DirectCast(System.Web.HttpContext.Current.Handler, Page)
'ScriptManager.RegisterStartupScript(Pag, Pag.GetType(), (DateTime.Now.Ticks + 1).ToString(), "MuestraAlert('" & Alerta.ToString() & "', '" & Plus & "');", True)
ScriptManager.RegisterStartupScript(Pag, Pag.GetType(), (DateTime.Now.Ticks + 1).ToString(), String.Format("MuestraAlerta('{0}','{1}','{2}','{3}','{4}');", Titulo, Mensaje, Img, Botones, JSBtnAceptar), True)
Pag = Nothing
Catch ex As Exception
End Try
'Alerta = Nothing
End If
End Sub
Private Sub EnviaNotificacion(dtt As DataTable, Correo As String)
'Dim ObjMail As New ClsSisMail()
Dim Body As New StringBuilder
'Body.AppendFormat("Se ha realizado el registro de: {0} {1} {2}<br><br>El detalle de lo registrado es:", TxtAPaterno.Text, TxtAMaterno.Text, TxtNombres.Text)
Body.AppendFormat("<table width='500px'>")
For Each dr As DataRow In TmpDT.Rows
Body.AppendFormat("<tr><td style='width:400px'>{0}</td><td style='width:100px'>{1} {2}</td></tr>", dr("PS"), dr("Total"), dr("Abreviatura"))
Next
Body.AppendFormat("</table>")
Dim Emp As New Empresa
Dim ObjEmp As New ClsSisEmpresas
If ObjEmp.GetEmpresas(43, "-1", "-1", "-1", "-1") Then
Emp = ObjEmp.Empresa
End If
ObjEmp.Dispose()
'If ObjMail.Mandacorreo(Emp, Correo, "Notificación de compra", "", "", {""}, Body.ToString) Then
'End If
End Sub
Private Sub ActivaPortal(CveCliente As Integer, Correo As String)
'guarda el nuevo usuario
Dim Usr As New ClsSisUsuarios
Dim CveUsr As Integer
Dim ContraseñaPredeterminada As String = "-acceso-"
Dim Activa As Boolean = True
If Usr.GetUsuariosPortal(-1, CveCliente, -1) Then
If Usr.DtResultados.Rows.Count = 0 Then
'lo ingreso
CveUsr = Usr.AddUsuarioPortal("Admin", "-acceso-", "Administrador", "", CveCliente, -1, True, True, True, True, True, True, True, True, True, True, 1, 0)
'lo desactivo para que me pida la nueva contrase;a en el portal
If CveUsr > 0 Then
Usr.UpdateUsuarioPortal("Admin", "Administrador", "", True, True, True, True, True, True, True, True, True, True, False, ContraseñaPredeterminada, CveCliente, 0, CveUsr)
End If
Activa = True
Else
CveUsr = Usr.DtResultados.Rows(0)("CveUsuarioPortal").ToString.ToEntero
If Usr.DtResultados.Rows(0)("Estatus").ToString = "0" Then
Activa = True 'sino esta activada la cuenta, sigue mandando la liga para activar
Else
Activa = False
End If
End If
End If
Usr.Dispose()
If CveUsr > 0 Then
Dim Liga As String = "http://aimmgm.adsistemas.mx/AIMMGM/Portal.aspx"
Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsr & "&Clave=" & CveCliente & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks)
Dim strSQL As New StringBuilder
strSQL.Append(" <html> ")
strSQL.Append(" <head></head> ")
strSQL.Append(" <body> ")
strSQL.Append(" <img src='http://expominson2014.com/CorreoEncabezado.jpg'><br /> ")
strSQL.Append(" ")
strSQL.Append(" <p class=MsoNormal style='margin-top:15.0pt;margin-right:0cm;margin-bottom: ")
strSQL.Append(" 7.5pt;margin-left:0cm;line-height:normal;mso-outline-level:3'><b><span ")
strSQL.Append(" style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'>SONORA 2014: Minería Moderna, Ejemplo de Industria ")
strSQL.Append(" Responsable</span></b><b><span style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif""; ")
strSQL.Append(" mso-fareast-font-family:""Times New Roman"";mso-bidi-font-family:""Times New Roman""; ")
strSQL.Append(" color:#89BCDC;mso-fareast-language:ES-MX'><o:p></o:p></span></b></p> ")
strSQL.Append(" <br> ")
strSQL.Append(" <br> ")
strSQL.Append(" <p class=MsoNormal style='margin-top:9.0pt;margin-right:0cm;margin-bottom:9.0pt; ")
strSQL.Append(" margin-left:0cm;text-align:justify;line-height:normal'><span style='font-size: ")
strSQL.Append(" 12.0pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family:""Times New Roman""; ")
strSQL.Append(" mso-bidi-font-family:""Times New Roman"";color:#2C2C25;mso-fareast-language:ES-MX'>Estimado ")
strSQL.Append(" Socio y Amigo, Gracias por su asistencia, le brindamos la dirección al portal. ")
strSQL.Append(" ")
strSQL.Append(" ")
strSQL.Append(" <br><br> ")
If Activa Then strSQL.AppendFormat("<br>Haga click para activar su cuenta <a href='{0}' target='_blank'>Activar</a>", LigaActivar)
strSQL.Append(" <br><br> ")
strSQL.AppendFormat(" Dirección de acceso al Portal: <a href='{0}' target='_blank'>Portal AIMMGM</a> ", Liga)
strSQL.Append(" <br><br> ")
strSQL.Append(" Datos de acceso: ")
strSQL.Append(" <br><br> ")
strSQL.AppendFormat(" Clave Cliente: {0}", CveCliente)
strSQL.Append(" <br><br> ")
strSQL.Append(" Dentro del Portal usted tendrá acceso a visualizar el detalle de sus compras, subir la comprobación de sus pagos. ")
strSQL.Append(" <br><br><table id=""TrPagoss"" width=""994px"" style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td colspan=""2"" style=""background-color:#5D7B9D; text-align: center; height: 20px;""> ")
strSQL.Append(" Pagos-Transferencias Nacionales ")
strSQL.Append(" <b></b> ")
strSQL.Append(" </td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td style=""width:275px;"">Banco:</td><td><b>Inbursa</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Sucursal:</td><td><b>Nápoles 021</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Cuenta:</td><td><b>50019145334</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>CLABE:</td><td><b>036180500191453345</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nombre del Beneficiario:</td><td><b>Asociación de Ingenieros de Minas, Metalurgistas y Geólogos de México A.C.</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" ")
strSQL.Append(" </table> ")
strSQL.Append(" <br/> ")
strSQL.Append(" <table id=""TrPagoss2"" width=""994px""style='font-size:14.5pt;font-family:""Century Gothic"",""sans-serif"";mso-fareast-font-family: ")
strSQL.Append(" ""Times New Roman"";mso-bidi-font-family:""Times New Roman"";color:#2A4A7E; ")
strSQL.Append(" mso-fareast-language:ES-MX'> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td colspan=""2"" style=""background-color:#5D7B9D; text-align: center; height: 20px;""> ")
strSQL.Append(" Pagos-Transferencias Internacionales ")
strSQL.Append(" <b></b> ")
strSQL.Append(" </td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td style=""width:275px;"">Moneda:</td><td><b>Dólares Americanos</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Banco:</td><td><b>JPMorgan Chase Bank New York NY USA</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Código Swift:</td><td><b>CHASUS33</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Ruta Banco Receptor (ABA):</td><td><b>021 000 021</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nombre del Beneficiario:</td><td><b>Asociación de Ingenieros de Minas, Metalurgistas y Geólogos de México A.C. </b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Cuenta del Beneficiario:</td><td><b>50019145334</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>CLABE:</td><td><b>036180500191453345</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Banco Beneficiario:</td><td><b>Banco Inbursa, S.A. México, D.F.</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" <tr> ")
strSQL.Append(" <td>Nuestro Código Swift:</td><td><b>INBUMXMM</b></td> ")
strSQL.Append(" </tr> ")
strSQL.Append(" ")
strSQL.Append(" </table> ")
strSQL.Append(" </span></p> ")
strSQL.Append(" </body> ")
Dim ObjMail As New ClsSisMail()
Dim Emp As New Empresa
Dim ObjEmp As New ClsSisEmpresas
If ObjEmp.GetEmpresas(43, "-1", "-1", "-1", "-1") Then
Emp = ObjEmp.Empresa
End If
ObjEmp.Dispose()
If ObjMail.Mandacorreo(Emp, Correo, If(Activa, "Activación de cuenta ExpominSon 2014", "Registro de Compra ExpominSon 2014"), "", "", {""}, strSQL.ToString) Then
End If
End If
End Sub
End Class