-RegistraScript se unifica en una sola clase static/shared y se simplica el código -Alert se vuelve estático -Random() no se manda a crear cada vez que se registra un script (esto tenía un costo alto) -Se corrigieron unos errores en los nombres de funciones -Las clases que ya heredan de Clspaginas, se les quita el this a RegistraScript y a Alert puesto que era innecesario (y además al haberlos vuelto métodos estáticos, NO pueden llamarse de un this)
327 lines
13 KiB
VB.net
327 lines
13 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class Acumuladores_CatFoliosGarantia
|
|
Inherits ClsPaginas
|
|
|
|
Private Property CveFolioGarantia As Integer
|
|
Get
|
|
If Not ViewState("CveFolioGarantia") Is Nothing Then
|
|
Return ViewState("CveFolioGarantia").ToString.ToEntero
|
|
Else
|
|
Return -1
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveFolioGarantia") = value
|
|
End Set
|
|
|
|
End Property
|
|
|
|
Private Property Actualizar As Boolean
|
|
Get
|
|
If Not ViewState("Actualizar") Is Nothing Then
|
|
Return DirectCast(ViewState("Actualizar"), Boolean)
|
|
Else
|
|
Return False
|
|
End If
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("Actualizar") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
CargaSubProyectos()
|
|
CargadatosGvFolioGarantia(DdlEstatus.SelectedValue.ToEntero, DdlTipoFolio.SelectedValue)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
#Region "Folios Garantía"
|
|
Private Sub CargaSubProyectos()
|
|
CargarCentrosDeCosto(Nothing, DdlSubProyectos, Nothing, lblSubProyecto)
|
|
CargarCentrosDeCosto(Nothing, DdlSubProyectoFiltro, Nothing, lblSubProyecto)
|
|
GvFolioGarantia.Columns(3).HeaderText = lblSubProyecto.Text
|
|
End Sub
|
|
|
|
Private Sub CargadatosGvFolioGarantia(EstatusValor As Integer, tipoFolioValor As String)
|
|
|
|
Dim objAcum As New ClsAcumuladores
|
|
|
|
If objAcum.FoliosGarantiaGet(-1, UsuarioActual.Empresa.CveEmpresa, Estatus:=EstatusValor, TipoFolio:=tipoFolioValor, Area:=-1, CveSubProyecto:=DdlSubProyectoFiltro.SelectedValue.ToEntero()) Then
|
|
GvFolioGarantia.DataSource = objAcum.DtResultados
|
|
Else
|
|
GvFolioGarantia.DataSource = Nothing
|
|
End If
|
|
|
|
objAcum.Dispose()
|
|
|
|
UPGvFolioGarantia.DataBind()
|
|
UpGral.Update()
|
|
|
|
'CargaGvTamanioBitacora()
|
|
|
|
End Sub
|
|
|
|
'Private Sub CargaGvTamanioBitacora()
|
|
|
|
' Dim objAcum As New ClsAcumuladores
|
|
|
|
' If objAcum.TamañoBitacoraGet(UsuarioActual.Empresa.CveEmpresa) Then
|
|
' GvBitacora.DataSource = objAcum.DtResultados
|
|
' Else
|
|
' GvBitacora.DataSource = Nothing
|
|
' End If
|
|
|
|
' objAcum.Dispose()
|
|
|
|
' UpGvBitacora.DataBind()
|
|
' UpGral.Update()
|
|
|
|
|
|
'End Sub
|
|
Protected Sub BtnAgregarFolioGarantia_Click(sender As Object, e As EventArgs) Handles BtnAgregarFolioGarantia.Click
|
|
LtlTituloModalFolioGarantia.Text = "Agregar Folio Garantía"
|
|
BtnAgregarFolioGarantiaModal.Text = "Agregar"
|
|
|
|
TxtFolioGarantia.Text = ""
|
|
DdlEstatusEditar.SelectedValueExist("1")
|
|
DdlSubProyectos.SelectedValueExist("-1")
|
|
|
|
Actualizar = False
|
|
UpGral.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolioGarantia"))
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregarFolioGarantiaModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarFolioGarantiaModal.Click
|
|
|
|
Dim ObjAcum As New ClsAcumuladores
|
|
|
|
'Dim Cargo, Bonificacion, Compra, Puntos As Decimal
|
|
|
|
'Cargo = If(TxtCargo.Text.ToDecimal > 0, TxtCargo.Text.ToDecimal, -1)
|
|
'Bonificacion = If(TxtBonificacion.Text.ToDecimal > 0, TxtBonificacion.Text.ToDecimal, -1)
|
|
'Compra = If(TxtCompra.Text.ToDecimal > 0, TxtCompra.Text.ToDecimal, -1)
|
|
'Puntos = If(TxtPuntos.Text.ToDecimal > 0, TxtPuntos.Text.ToDecimal, -1)
|
|
|
|
|
|
If Not Actualizar Then
|
|
If ObjAcum.FoliosGarantiaAdd(TxtFolioGarantia.Text, DdlEstatusEditar.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero, DdlTipoFolioModal.SelectedValue, TxtLimite.Text.ToEntero, DdlArea.SelectedValue.ToEntero) Then
|
|
|
|
TxtFolioGarantia.Text = ""
|
|
DdlEstatusEditar.SelectedValueExist("1")
|
|
'TxtCargo.Text = ""
|
|
'TxtBonificacion.Text = ""
|
|
'TxtCompra.Text = ""
|
|
'TxtPuntos.Text = ""
|
|
|
|
CargadatosGvFolioGarantia(DdlEstatus.SelectedValue.ToEntero, "-1")
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolioGarantia"), "jsHideModalFolioGarantia")
|
|
UpGral.Update()
|
|
|
|
Alert("Folio de Garantía Agregado Correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrió un error al guardar el Folio de Garantía", TipoMensaje.MsgError)
|
|
End If
|
|
Else
|
|
If ObjAcum.FoliosGarantiaUpdate(CveFolioGarantia, TxtFolioGarantia.Text, DdlEstatusEditar.SelectedValue.ToEntero, UsuarioActual.CveUsuario, DdlSubProyectos.SelectedValue.ToEntero,
|
|
DdlTipoFolioModal.SelectedValue, TxtLimite.Text.ToEntero) Then
|
|
|
|
TxtFolioGarantia.Text = ""
|
|
DdlEstatusEditar.SelectedValueExist("1")
|
|
'TxtCargo.Text = ""
|
|
'TxtBonificacion.Text = ""
|
|
'TxtCompra.Text = ""
|
|
'TxtPuntos.Text = ""
|
|
|
|
CargadatosGvFolioGarantia(DdlEstatus.SelectedValue.ToEntero, "-1")
|
|
UpModalFolioGarantia.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolioGarantia"), "jsHideModalFolioGarantia")
|
|
|
|
UpGral.Update()
|
|
Alert("Folio de Garantía Actualizado Correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrió un error al Actualizar el Folio de Garantía", TipoMensaje.MsgError)
|
|
End If
|
|
End If
|
|
|
|
CveFolioGarantia = -1
|
|
Actualizar = False
|
|
|
|
ObjAcum.Dispose()
|
|
|
|
End Sub
|
|
|
|
Public Sub Remove_ClickFolioGarantia(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim activo As Boolean = 0
|
|
Dim CveCapacitador As Integer = GvRow.DataKey("CveFolioGarantia")
|
|
|
|
Dim objAcum As New ClsAcumuladores
|
|
If objAcum.FoliosGarantiaRemove(CveCapacitador, UsuarioActual.CveEmpresa) Then
|
|
Alert("Capacitador Eliminó Correctamente ", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrió un error al Eliminar el Folio de Garantía", TipoMensaje.MsgError)
|
|
End If
|
|
objAcum.Dispose()
|
|
|
|
CargadatosGvFolioGarantia(DdlEstatus.SelectedValue.ToEntero, "-1")
|
|
|
|
CveFolioGarantia = -1
|
|
End Sub
|
|
|
|
Public Sub Edit_ClickFolioGarantia(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim activo As Boolean = 0
|
|
|
|
LtlTituloModalFolioGarantia.Text = "Editar Folio Garantía"
|
|
Actualizar = True
|
|
|
|
CveFolioGarantia = GvRow.DataKey("CveFolioGarantia")
|
|
|
|
TxtFolioGarantia.Text = GvRow.DataKey("FolioGarantia")
|
|
DdlEstatusEditar.SelectedValueExist(GvRow.DataKey("CveEstatus"))
|
|
TxtLimite.Text = GvRow.DataKey("Limite")
|
|
DdlTipoFolioModal.SelectedValue = GvRow.DataKey("tipoFolio")
|
|
'TxtCargo.Text = GvRow.DataKey("Cargo").ToDecimal.ToString("###,###,###.00")
|
|
'TxtBonificacion.Text = GvRow.DataKey("Bonificacion").ToDecimal.ToString("###,###,###.00")
|
|
'TxtCompra.Text = GvRow.DataKey("Compra").ToDecimal.ToString("###,###,###.00")
|
|
'TxtPuntos.Text = GvRow.DataKey("Puntos").ToDecimal.ToString("###,###,###.00")
|
|
|
|
DdlSubProyectos.Items.Clear()
|
|
DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
|
DdlSubProyectos.DataBind()
|
|
DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
DdlSubProyectos.SelectedValueExist(GvRow.DataKey("CveSubProyecto").ToEntero)
|
|
|
|
BtnAgregarFolioGarantiaModal.Text = "Actualizar"
|
|
|
|
UpModalFolioGarantia.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolioGarantia"))
|
|
|
|
End Sub
|
|
|
|
Public Sub ImgVer_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
CveFolioGarantia = GvRow.DataKey("CveFolioGarantia")
|
|
|
|
LblFolio.Text = GvRow.DataKey("FolioGarantia")
|
|
|
|
Using ObjAcum As New ClsAcumuladores
|
|
If ObjAcum.GetFoliosGarantiasDetalle(CveFolioGarantia, CveEstatusConsecutivo:=DdlEstatusConsecutivo.SelectedValue.ToEntero()) Then
|
|
GvGarantiasDetalle.DataSource = ObjAcum.DtResultados
|
|
HplGenerarSalida.NavigateUrl = "/Inventarios/TraspasoAlmacen.aspx?CveFolioGarantia=" & CveFolioGarantia
|
|
End If
|
|
End Using
|
|
GvGarantiasDetalle.DataBind()
|
|
|
|
UpGarantiasDetalle.Update()
|
|
|
|
RegistraScript("$('#DivGarantiasDetalle').modal('show');")
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
|
CargadatosGvFolioGarantia(DdlEstatus.SelectedValue.ToEntero, DdlTipoFolio.SelectedValue)
|
|
End Sub
|
|
|
|
Protected Sub BtnExportarExcel_Click(sender As Object, e As EventArgs)
|
|
GvGarantiasDetalle.ExportToExcelG(LblFolio.Text, "Ajustes de Garantía", UsuarioActual)
|
|
'GvGarantiasDetalle.ExportToExcelX(LblFolio.Text)
|
|
End Sub
|
|
|
|
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
|
End Sub
|
|
Protected Sub BtnGenerarTxt_Click(sender As Object, e As EventArgs)
|
|
Dim SbTxt As New StringBuilder
|
|
|
|
For Each GvRow As GridViewRow In GvGarantiasDetalle.Rows
|
|
If GvRow.RowType = DataControlRowType.DataRow Then
|
|
'1.- Consecutivo Partida-->1
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("Consecutivo"))
|
|
'2.- Cliente-->100407
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoSucursal"))
|
|
'3. Codigo De Articulo --> 171402
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoProducto2"))
|
|
'4. Tipo De Uso --> A
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoTipoUso"))
|
|
'5. Defecto --> P
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoTipoDefecto"))
|
|
'6. Codigo De Ensamble --> 1X
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoEnsamble"))
|
|
'7. Codigo De Linea/Termico --> 9000
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoLinea"))
|
|
'8. Codigo De Inspeccion --> J8K
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoInspeccion"))
|
|
'9. Fecha De Venta --> 05/09/2009
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("FechaVenta").ToDateTime().ToString("MM-dd-yyyyy"))
|
|
'10. Fecha De Reclamacion --> 05/07/2010
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("FechaReclamacion").ToDateTime().ToString("MM-dd-yyyyy"))
|
|
'11. TipoComprobante --> 1
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("TipoComprobante"))
|
|
'12. Comprobante --> N/A
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("Comprobante"))
|
|
'13. Autorizo --> STAN7490
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("Autorizo"))
|
|
'14. Comentarios --> Cliente 100407
|
|
SbTxt.AppendFormat("{0}@", GvRow.DataKey("Comentarios"))
|
|
'15. Clave De Autorizacion / Codigo Error --> P05TRBGX
|
|
SbTxt.AppendFormat("{0}", GvRow.DataKey("ClaveAutorizacion"))
|
|
|
|
SbTxt.Append(vbCrLf)
|
|
End If
|
|
Next
|
|
|
|
Dim text As String = SbTxt.ToString
|
|
Response.Clear()
|
|
Response.ClearHeaders()
|
|
Response.AddHeader("Content-Length", text.Length.ToString)
|
|
Response.ContentType = "text/plain"
|
|
Response.AppendHeader("content-disposition", $"attachment;filename=""{LblFolio.Text}.txt""")
|
|
Response.Write(text)
|
|
Response.End()
|
|
|
|
End Sub
|
|
|
|
Protected Sub GvGarantiasDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
e.Row.FCHyperLink("HlDescargarPDF").NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=AJUSTE&CveGarantiaDetalle={e.Row.DBCampo("CveGarantiaDetalle")}")}"
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnGenerarSalida_Click(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
Protected Sub DdlEstatusConsecutivo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
Using ObjAcum As New ClsAcumuladores
|
|
If ObjAcum.GetFoliosGarantiasDetalle(CveFolioGarantia, CveEstatusConsecutivo:=DdlEstatusConsecutivo.SelectedValue.ToEntero()) Then
|
|
GvGarantiasDetalle.DataSource = ObjAcum.DtResultados
|
|
HplGenerarSalida.NavigateUrl = "/Inventarios/TraspasoAlmacen.aspx?CveFolioGarantia=" & CveFolioGarantia
|
|
End If
|
|
End Using
|
|
GvGarantiasDetalle.DataBind()
|
|
|
|
UpGarantiasDetalle.Update()
|
|
End Sub
|
|
End Class
|