From 63b335d1363dbe1b901ac5827a4ffde217ea250a Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Tue, 18 Feb 2020 17:50:58 -0700 Subject: [PATCH] Documentacion proveedores --- App_Code/ClsCompProveedores.vb | 223 ++++++++++- App_Code/ClsPaginas.vb | 1 + Compras/Compras.aspx.vb | 14 +- Compras/RepDocumentacionProveedor.aspx | 65 +++- Compras/RepDocumentacionProveedor.aspx.vb | 328 ++++++++++++++--- Edoc/CatTipoContratos.aspx | 4 +- Edoc/CatTipoContratos.aspx.vb | 5 +- Edoc/Contratos.aspx | 285 ++++++++++++++ Edoc/Contratos.aspx.vb | 271 ++++++++++++++ PortalProveedor/PortalProveedor.aspx | 8 +- PortalProveedor/PortalProveedor.aspx.vb | 429 ++++++++++++++-------- Ventas/RepIngresos.aspx | 73 ++-- 12 files changed, 1460 insertions(+), 246 deletions(-) create mode 100644 Edoc/Contratos.aspx create mode 100644 Edoc/Contratos.aspx.vb diff --git a/App_Code/ClsCompProveedores.vb b/App_Code/ClsCompProveedores.vb index b439b1ff9..2f2e2794e 100644 --- a/App_Code/ClsCompProveedores.vb +++ b/App_Code/ClsCompProveedores.vb @@ -1605,7 +1605,7 @@ Public Class ClsCompProveedores With SqlAdapter.SelectCommand.Parameters .Add("@CveTipoContrato", SqlDbType.Int).Value = CveTipoContrato - .Add("@CveTipoContrato", SqlDbType.VarChar).Value = TipoContrato + .Add("@TipoContrato", SqlDbType.VarChar).Value = TipoContrato .Add("@Estatus", SqlDbType.Bit).Value = Estatus .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa @@ -1684,6 +1684,227 @@ Public Class ClsCompProveedores Return Retorno End Function + + + + + Public Function AddContrato(Contrato As String, CveTipoContrato As Integer, CveSubProyecto As Integer, CveProveedor As Integer, CveRepresentanteLegal As Integer, FechaInicio As Date, FechaFin As Date, Estatus As Boolean, + CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_ContratosAdd") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@Contrato", SqlDbType.VarChar).Value = Contrato + .Add("@CveTipoContrato", SqlDbType.Int).Value = CveTipoContrato + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar el contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateContrato(CveContrato As Integer, Contrato As String, CveTipoContrato As Integer, CveSubProyecto As Integer, CveProveedor As Integer, CveRepresentanteLegal As Integer, FechaInicio As Date, + FechaFin As Date, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_ContratosUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@Contrato", SqlDbType.VarChar).Value = Contrato + .Add("@CveTipoContrato", SqlDbType.Int).Value = CveTipoContrato + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + Public Function GetContrato(CveContrato As Integer, CveSubProyecto As Integer, CveProveedor As Integer, CveTipoContrato As Integer, CveRepresentanteLegal As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_ContratosGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveTipoContrato", SqlDbType.Int).Value = CveTipoContrato + .Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Obtener los contratos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + + Public Function RemoveContrato(CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_ContratosRemove") + + With SqlAdapter.SelectCommand.Parameters + + + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + + + Public Function AddRePresentanteLegal(RepresentanteLegal As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_CatRepresentanteLegalAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@RepresentanteLegal", SqlDbType.VarChar).Value = RepresentanteLegal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el representante.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + + Public Function UpdateRePresentanteLegal(CveRepresentanteLegal As Integer, RepresentanteLegal As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_CatRepresentanteLegalUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal + .Add("@RepresentanteLegal", SqlDbType.VarChar).Value = RepresentanteLegal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el representante.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetRePresentanteLegal(CveRepresentanteLegal As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_CatRepresentanteLegalGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los representantes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveRePresentanteLegal(CveRepresentanteLegal As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_CatRepresentanteLegalRemove") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el representante.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + #End Region ' IDisposable diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 5ce6ad484..3c30e375d 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4672,6 +4672,7 @@ Public Class ClsPaginas PaginaDict.Add("/Edoc/CatDocumentos.aspx".ToUpper(), 1205) PaginaDict.Add("/Edoc/CatTipoContratos.aspx".ToUpper(), -1) PaginaDict.Add("/Edoc/CatDocumentosContratos.aspx".ToUpper(), -1) + PaginaDict.Add("/Edoc/Contratos.aspx".ToUpper(), -1) 'Portal PaginaDict.Add("/AIMMGM/ConsultaCliente.aspx".ToUpper(), -1) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index fd2af8bf0..9cd4e6444 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -7210,7 +7210,19 @@ Partial Class Compras_Compras Next importeMovimiento = 0 - End If + End If + + + 'Case 205 + + ' If TxtTotal.Text.ToDecimal = 0 And DdlTipoComprobante.SelectedValue = "Fac" Then + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, Row("IdCtaContable").ToString.ToEntero, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=Math.Round(importeMN, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=True) Then + ' ErrorPrepoliza = True + ' Exit For + ' End If + ' End If + + End Select If ErrorPrepoliza Then diff --git a/Compras/RepDocumentacionProveedor.aspx b/Compras/RepDocumentacionProveedor.aspx index ad4776c3d..c6704dc1e 100644 --- a/Compras/RepDocumentacionProveedor.aspx +++ b/Compras/RepDocumentacionProveedor.aspx @@ -61,11 +61,11 @@ - - + + <%-- --%> - + <%----%> @@ -80,11 +80,11 @@ <%-- --%> - - + + <%----%> - + <%----%> @@ -158,7 +158,7 @@ - + @@ -226,7 +226,7 @@ - @@ -281,6 +281,55 @@ + + + + + diff --git a/Compras/RepDocumentacionProveedor.aspx.vb b/Compras/RepDocumentacionProveedor.aspx.vb index d89519107..d7322024f 100644 --- a/Compras/RepDocumentacionProveedor.aspx.vb +++ b/Compras/RepDocumentacionProveedor.aspx.vb @@ -37,9 +37,160 @@ Partial Class Proveedores_RepDocumentacionProveedor Set(value As DataTable) ViewState("DTHeaders") = value End Set - End Property - + End Property + + + +#Region "UPLOAD" + Property CveDocumentacionElectronica As Integer + Get + If ViewState("CvePersonalClienteDocumentacion") Is Nothing Then + Return -1 + Else + Return DirectCast(ViewState("CvePersonalClienteDocumentacion"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CvePersonalClienteDocumentacion") = value + End Set + End Property + + Property CveDocumentacion As Integer + Get + If ViewState("CveDocumentacion") Is Nothing Then + Return -1 + Else + Return DirectCast(ViewState("CveDocumentacion"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CveDocumentacion") = value + End Set + End Property + + Property Documentacion As String + Get + If ViewState("Documentacion") Is Nothing Then + Return "-1" + Else + Return ViewState("Documentacion").ToString + End If + End Get + Set(value As String) + ViewState("Documentacion") = value + End Set + End Property + + Property AdjuntoDocumentacion As String + Get + If ViewState("AdjuntoDocumentacion") Is Nothing Then + Return "" + Else + Return ViewState("AdjuntoDocumentacion").ToString + End If + End Get + Set(value As String) + ViewState("AdjuntoDocumentacion") = value + End Set + End Property + + + + Property DiasVigencia As Integer + Get + If ViewState("DiasVigencia") Is Nothing Then + Return 0 + Else + Return DirectCast(ViewState("DiasVigencia"), Integer) + End If + End Get + Set(value As Integer) + ViewState("DiasVigencia") = value + End Set + End Property + + Property AplicaFechaVencimiento As Boolean + Get + If ViewState("AplicaFechaVencimiento") Is Nothing Then + Return True + Else + Return DirectCast(ViewState("AplicaFechaVencimiento"), Boolean) + End If + End Get + Set(value As Boolean) + ViewState("AplicaFechaVencimiento") = value + End Set + End Property + + Private Property FechaVigencia As Date + Get + If ViewState("FechaVigencia") Is Nothing Then + Return Nothing + Else + Return ViewState("FechaVigencia").ToString.ToDate + End If + End Get + Set(value As Date) + ViewState("FechaVigencia") = value + End Set + End Property + + Property Estatus As Integer + Get + If ViewState("Estatus") Is Nothing Then + Return 0 + Else + Return DirectCast(ViewState("Estatus"), Integer) + End If + End Get + Set(value As Integer) + ViewState("Estatus") = value + End Set + End Property + + Property ObservacionDocumentacion As String + Get + If ViewState("ObservacionDocumentacion") Is Nothing Then + Return "" + Else + Return ViewState("ObservacionDocumentacion").ToString + End If + End Get + Set(value As String) + ViewState("ObservacionDocumentacion") = value + End Set + End Property + + Private Property FechaLimite As Date + Get + If ViewState("FechaLimite") Is Nothing Then + Return Date.Now.AddDays(15) + Else + Return ViewState("FechaLimite").ToString.ToDate + End If + End Get + Set(value As Date) + ViewState("FechaLimite") = value + End Set + End Property + + + Property CveProveedor As Integer + Get + If ViewState("CveProveedor") Is Nothing Then + Return 0 + Else + Return DirectCast(ViewState("CveProveedor"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CveProveedor") = value + End Set + End Property +#End Region + + Private Sub Proveedores_RepDocumentacionProveedor_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then CargaCombos() @@ -125,7 +276,7 @@ Partial Class Proveedores_RepDocumentacionProveedor Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired") Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite") Dim txtFechaVigencia As TextBox = e.Row.FCTextBox("TxtFechaVigencia") - Dim Documentacion As String = e.Row.DataKey("Documentacion") + Dim CveDocumentacionElectronica As Integer = e.Row.DataKey("CveDocumentacionElectronica").ToEntero Dim ImgRechazar As LinkButton = e.Row.FCLinkButton("ImgRechazar") @@ -185,9 +336,9 @@ Partial Class Proveedores_RepDocumentacionProveedor ImgDownLoad.Visible = True If extencion.Length > 0 Then - ImgDownLoad.Text = String.Format(" ", linkDescarga, Documentacion & "." & extencion) + ImgDownLoad.Text = String.Format(" ", linkDescarga, CveDocumentacionElectronica & "." & extencion) Else - ImgDownLoad.Text = String.Format(" ", linkDescarga, Documentacion) + ImgDownLoad.Text = String.Format(" ", linkDescarga, CveDocumentacionElectronica) End If @@ -324,56 +475,149 @@ Partial Class Proveedores_RepDocumentacionProveedor End Function + Public Sub UploadModal_ClickDocumentacion(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - 'Protected Sub BrnProcesar_Click(sender As Object, e As EventArgs) + ' Dim chkEstatus As CheckBox + CveDocumentacionElectronica = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + CveDocumentacion = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Documentacion = GvRow.DataKey("Documentacion") + AdjuntoDocumentacion = GvRow.DataKey("Adjunto") + CveProveedor = GvRow.DataKey("CveProveedor").ToEntero + + 'DiasVigencia = GvRow.DataKey("DiasVigencia").ToString.ToEntero + Dim x As String = GvRow.DataKey("AplicaFechaVencimiento") + If GvRow.DataKey("AplicaFechaVencimiento") = "1" Then AplicaFechaVencimiento = True Else AplicaFechaVencimiento = False + + If GvRow.DataKey("Adjunto").ToString.Length > 0 Then + FechaVigencia = GvRow.DataKey("Adjunto").ToString.ToDate + Else + FechaVigencia = Nothing + End If + + + Estatus = GvRow.DataKey("Estatus").ToEntero + + 'If chkEstatus.Checked Then + ' Estatus = 1 + 'Else + ' Estatus = 0 + 'End If + + ObservacionDocumentacion = GvRow.FCTextBox("TxtObservaciones").Text.Trim.ToUpper + FechaLimite = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + AdjuntoDocumentacion = GvRow.DataKey("Adjunto") + + LtlModalUploadTitulo.Text = "Subir " & Documentacion + + UpModalTitleUploadDocumento.Update() + + RegistraScript("$('#ModalUploadDoc').modal({ backdrop: 'static', keyboard: false});") + + End Sub - ' Dim objEdoc As New ClsEdocumentacion - ' objEdoc.IniciaTransacSQL() + Protected Sub BtnUploadFileDoc_Click(sender As Object, e As EventArgs) Handles btnUploadFileDoc.Click - ' Dim ErrorProceso As Boolean = False + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = TxtFileDocumentacion.getfiles().Archivos + Dim Filename As String = "" + Dim ErrorProceso As Boolean = False - ' For Each GvRow As GridViewRow In GvDocumentos.Rows + If AplicaFechaVencimiento And DiasVigencia > 0 Then + FechaVigencia = DateTime.Today.AddDays(DiasVigencia) + End If + + For Each fileItem As Archivo In Filesgral - ' Dim RDBAcptar As RadioButton = GvRow.FCRadioButton("RDBAcptar") - ' Dim RDBRechazar As RadioButton = GvRow.FCRadioButton("RDBRechazar") - ' Dim ContactoMail As String = GvRow.DataKey("ContactoMail") + Try + + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + - ' If RDBAcptar.Checked Or RDBRechazar.Checked Then - ' Dim Estatus As Integer = If(RDBAcptar.Checked, 3, 1) - ' Dim Obsebaciones As String = If(RDBAcptar.Checked, "", GvRow.FCTextBox("TxtObservaciones").Text) + Dim TempCveDocumentacionElectronica As Integer = 0 + Dim objEdoc As New ClsEdocumentacion + objEdoc.IniciaTransacSQL() + + If CveDocumentacionElectronica = -1 Then + + CveDocumentacionElectronica = objEdoc.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, "-1", UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) + + If CveDocumentacionElectronica > 0 Then + If Not objEdoc.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, CveDocumentacionElectronica & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) Then + ErrorProceso = True + End If + End If + + + Else + If Not objEdoc.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, CveDocumentacionElectronica & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) Then + ErrorProceso = True + End If + End If - ' If Not objEdoc.DocumentacionElectronicaUpdate(GvRow.DataKey("CveDocumentacionElectronica").ToEntero, GvRow.DataKey("CveDocumentacion").ToEntero, -1, -1, GvRow.DataKey("CveProveedor").ToEntero, Estatus, - ' If(Obsebaciones.Trim.Length > 0, Obsebaciones, GvRow.DataKey("Observacion")), "-1", UsuarioActual.CveUsuario, GvRow.DataKey("FechaLimite").ToDate, - ' GvRow.DataKey("FechaVigencia").ToDate) Then - ' ErrorProceso = True - ' Exit For - ' Else + If Not ErrorProceso = True Then + + Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\" & CveDocumentacionElectronica & "." & FileExtension + Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\" & AdjuntoDocumentacion + + + + Try + If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\") Then + System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\") + End If + + If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then + File.Delete(rutaAdjuntoAnterior) + End If + + If System.IO.File.Exists(rutaDestino) Then + System.IO.File.Delete(rutaDestino) + End If + + System.IO.File.Move(fileItem.FileUrl, rutaDestino) + Catch ex As Exception + GuardaLog($"Error al gaurdar documento (moviendo archivo digital) --> Error{ ex.StackTrace}") + ErrorProceso = True + End Try + End If + + + If Not ErrorProceso Then + objEdoc.Commit() + Alert("Documento cargado correctamente") + Else + objEdoc.RollBack() + Alert("Error al cargar archivo", TipoMensaje.MsgError) + End If + objEdoc.Dispose() + + + CargaDocumentacion() + + TxtFileDocumentacion.Text = "" + UPModalUploadDoc.Update() + + Catch ex As Exception + OnError("Error al cargar archivo", ex) + End Try + + Next + + RegistraScript("$('#ModalUploadDoc').modal('hide')", "hidemodal3") + + End Sub + - ' If Estatus = 1 Then - ' 'Enviar correo rechazo con obserbación - ' End If - ' End If - - ' Else - ' 'Enviar correo archivo pediente - ' End If - - ' Next - - ' If ErrorProceso Then - ' objEdoc.RollBack() - ' Else - ' objEdoc.Commit() - ' Alert("Proceso Terminado correctamente.") - ' End If - - ' objEdoc.Dispose() - 'End Sub diff --git a/Edoc/CatTipoContratos.aspx b/Edoc/CatTipoContratos.aspx index 422b85b15..ff3e1493a 100644 --- a/Edoc/CatTipoContratos.aspx +++ b/Edoc/CatTipoContratos.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="RH - Catálogo de Géneros" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatTipoContratos.aspx.vb" Inherits="Edoc_CatTipoContrato" %> +<%@ Page Title="Tipo De Contrato" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatTipoContratos.aspx.vb" Inherits="Edoc_CatTipoContrato" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> @@ -57,7 +57,7 @@ - + diff --git a/Edoc/CatTipoContratos.aspx.vb b/Edoc/CatTipoContratos.aspx.vb index 6ba48e175..158eababc 100644 --- a/Edoc/CatTipoContratos.aspx.vb +++ b/Edoc/CatTipoContratos.aspx.vb @@ -43,6 +43,7 @@ Partial Class Edoc_CatTipoContrato GvDatos.DataBind() + UpDatos.Update() End Sub @@ -89,7 +90,9 @@ Partial Class Edoc_CatTipoContrato If Not ErrorProceso Then - RegistraScript(String.Format("$('#{0}').modal('HIDE');", "DivAgregarTiposContrato")) + + Alert($"Tipo Contrato { If(CveTipoContrato > 0, "Actualizado", "Agregado") } correctamente.") + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposContrato")) CargaDatos() End If diff --git a/Edoc/Contratos.aspx b/Edoc/Contratos.aspx new file mode 100644 index 000000000..3bd132099 --- /dev/null +++ b/Edoc/Contratos.aspx @@ -0,0 +1,285 @@ +<%@ Page Title="Contratos" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Contratos.aspx.vb" Inherits="Proveedores_Contratos" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Contratos + + + + + +
  • + +
  • +
    +
    +
    + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + +
    +
    +
    + + + + \ No newline at end of file diff --git a/Edoc/Contratos.aspx.vb b/Edoc/Contratos.aspx.vb new file mode 100644 index 000000000..ab45985ee --- /dev/null +++ b/Edoc/Contratos.aspx.vb @@ -0,0 +1,271 @@ +Option Strict On + +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class Proveedores_Contratos + Inherits ClsPaginas + + Protected Property CveContrato As Integer + Get + If ViewState("CveContrato") Is Nothing Then + Return -1 + Else + Return ViewState("CveContrato").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveContrato") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargaDatos() + CargaCombos() + + End If + + End Sub + + + Private Sub CargaDatos() + + Dim ObjProv As New ClsCompProveedores + + If ObjProv.GetContrato(-1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjProv.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjProv.Dispose() + GvDatos.DataBind() + + UpDatos.Update() + + End Sub + + Private Sub CargaCombos() + 'CargaProveedores + DdlProveedores.setEsWebService(True) + DdlProveedores.Attributes.Add("data-metodo", "getproveedores") + DdlProveedores.SelectedText = "Todos" + DdlProveedores.SelectedValue = "-1" + + + DdlSubProyecto.Items.Clear() + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1")) + + + DdlTipoContrato.Items.Clear() + + Dim ObjProveedor As New ClsCompProveedores + + + If ObjProveedor.GetTiposContratos(-1, UsuarioActual.CveEmpresa, 1) Then + DdlTipoContrato.DataSource = ObjProveedor.DtResultados + End If + + ObjProveedor.Dispose() + DdlTipoContrato.DataBind() + + DdlTipoContrato.Items.Insert(0, New ListItem("Seleccione", "-1")) + + CargaRepresentantes() + + End Sub + + + + + Protected Sub BtnAgregarContratoModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarContratoModal.Click + + CveContrato = -1 + ChkEstatus.Checked = True + + TxtContrato.Text = "" + + DdlProveedores.txtValue.Value = "" + DdlProveedores.txtText.Value = "" + + DdlTipoContrato.SelectedValueExist("-1") + DdlSubProyecto.SelectedValueExist("-1") + DDlRePresentanteLegal.SelectedValueExist("-1") + + TxtFechaInicio.Text = "" + TxtFechaFin.Text = "" + ChkEstatus.Checked = True + + BtnAgregarModalContrato.Text = "Agregar" + + UpModalContrato.Update() + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarContrato")) + + End Sub + + Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + CveContrato = GvRow.DataKey("CveContrato").ToEntero + + TxtContrato.Text = GvRow.DataKey("Contrato") + + DdlProveedores.txtValue.Value = GvRow.DataKey("CveProveedor") + DdlProveedores.txtText.Value = GvRow.DataKey("NombreComercial") + DdlTipoContrato.SelectedValueExist(GvRow.DataKey("CveTipoContrato")) + DdlSubProyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto")) + DDlRePresentanteLegal.SelectedValueExist(GvRow.DataKey("CveRepresentanteLegal")) + + TxtFechaInicio.Text = GvRow.DataKey("FechaInicio").ToString.ToDate().ToString("dd/MM/yyyy") + TxtFechaFin.Text = GvRow.DataKey("FechaFin").ToString.ToDate().ToString("dd/MM/yyyy") + + ChkEstatus.Checked = Boolean.Parse(GvRow.DataKey("Estatus")) + + + BtnAgregarModalContrato.Text = "Actualizar" + + UpModalContrato.Update() + + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarContrato")) + + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnAgregarModalContrato.Click + + If DdlProveedores.txtValue.Value.ToEntero <= 0 Then + Alert("Debe seleccionar un proveedor", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim ObjProv As New ClsCompProveedores + ObjProv.IniciaTransacSQL() + + Dim ErrorProceso As Boolean = False + + If CveContrato = -1 Then + If Not ObjProv.AddContrato(TxtContrato.Text, DdlTipoContrato.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedores.txtValue.Value.ToEntero, DDlRePresentanteLegal.SelectedValue.ToEntero, + TxtFechaInicio.Text.ToDate, TxtFechaFin.Text.ToDate, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If + Else + If Not ObjProv.UpdateContrato(CveContrato, TxtContrato.Text, DdlTipoContrato.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedores.txtValue.Value.ToEntero, DDlRePresentanteLegal.SelectedValue.ToEntero, + TxtFechaInicio.Text.ToDate, TxtFechaFin.Text.ToDate, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If + End If + + If Not ErrorProceso Then + + ObjProv.Commit() + + If CveContrato > 0 Then + Alert("Contrato Actualizado Correctamente.") + Else + Alert("Contrato Agregado Correctamente.") + End If + + + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarContrato")) + CargaDatos() + + Else + + ObjProv.RollBack() + End If + + ObjProv.Dispose() + + + + End Sub + + Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ErrorProceso As Boolean = False + Dim CveTipoContratoEliminar As Integer = GvRow.DataKey("CveTipoContrato").ToEntero + + Dim ObjProv As New ClsCompProveedores + + If ObjProv.RemoveContrato(CveTipoContratoEliminar, UsuarioActual.CveEmpresa) Then + Alert("Tipo Contrato eliminado correctamente") + Else + ErrorProceso = True + End If + + If Not ErrorProceso Then + CargaDatos() + End If + + + ObjProv.Dispose() + + End Sub + Protected Sub BtnCatRepresentantes_Click(sender As Object, e As EventArgs) + TxtRepresentanteLegal.Text = "" + + RegistraScript(String.Format("$('#{0}').modal('show');", "DivAgregarContrato2"), "frm2") + UpModalRepresentante.Update() + End Sub + + Protected Sub BtnAgregarRepresentante_Click(sender As Object, e As EventArgs) + + Dim ObjProv As New ClsCompProveedores + + If ObjProv.AddRePresentanteLegal(TxtRepresentanteLegal.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + Alert("Se agrego representante correctamente.") + TxtRepresentanteLegal.Text = "" + End If + + ObjProv.Dispose() + + CargaRepresentantes() + + End Sub + + Private Sub CargaRepresentantes() + + Dim ObjProv As New ClsCompProveedores + + + If ObjProv.GetRePresentanteLegal(-1, UsuarioActual.CveEmpresa) Then + GvRepresentante.DataSource = ObjProv.DtResultados + DDlRePresentanteLegal.DataSource = ObjProv.DtResultados + Else + GvRepresentante.DataSource = Nothing + End If + + ObjProv.Dispose() + + DDlRePresentanteLegal.Items.Clear() + DDlRePresentanteLegal.DataBind() + DDlRePresentanteLegal.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + GvRepresentante.DataBind() + + UpModalRepresentante.Update() + UpModalContrato.Update() + End Sub + + Protected Sub LnkGvRepresentantesEliminar_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim CveRepresentanteLegal As Integer = GvRow.DataKey("CveRepresentanteLegal").ToEntero + Dim ObjProv As New ClsCompProveedores + + If ObjProv.RemoveRePresentanteLegal(CveRepresentanteLegal, UsuarioActual.CveEmpresa) Then + Alert("Representante eliminado correctamente.") + End If + + ObjProv.Dispose() + + CargaRepresentantes() + + End Sub +End Class diff --git a/PortalProveedor/PortalProveedor.aspx b/PortalProveedor/PortalProveedor.aspx index 4c0b7fd38..912ae99df 100644 --- a/PortalProveedor/PortalProveedor.aspx +++ b/PortalProveedor/PortalProveedor.aspx @@ -839,7 +839,7 @@ - + @@ -905,6 +905,12 @@
    + <%-- + + + + --%> + <%-- 0 Then - ImgDownLoad.Text = String.Format(" ", linkDescarga, Documentacion & "." & extencion) + ImgDownLoad.Text = String.Format(" ", linkDescarga, CveDocumentacionElectronica & "." & extencion) Else - ImgDownLoad.Text = String.Format(" ", linkDescarga, Documentacion) + ImgDownLoad.Text = String.Format(" ", linkDescarga, CveDocumentacionElectronica) End If Else ImgDownLoad.Visible = False @@ -1564,7 +1571,8 @@ Partial Class Portal_PortalProveedor Dim FileExtension As String = "-1" Dim Filesgral As List(Of Archivo) = TxtFileDocumentacion.getfiles().Archivos Dim Filename As String = "" - + Dim ErrorProceso As Boolean = False + If AplicaFechaVencimiento And DiasVigencia > 0 Then FechaVigencia = DateTime.Today.AddDays(DiasVigencia) End If @@ -1575,55 +1583,150 @@ Partial Class Portal_PortalProveedor FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") Dim tempArray() As String - tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) - - Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\" & Documentacion & "." & FileExtension - Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\" & AdjuntoDocumentacion - - If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\") Then - System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\") - End If - - If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then - File.Delete(rutaAdjuntoAnterior) - End If - - If System.IO.File.Exists(rutaDestino) Then - System.IO.File.Delete(rutaDestino) - End If - - System.IO.File.Move(fileItem.FileUrl, rutaDestino) + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + Dim objEdoc As New ClsEdocumentacion + objEdoc.IniciaTransacSQL() If CveDocumentacionElectronica = -1 Then - If objEdoc.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) > 0 Then + CveDocumentacionElectronica = objEdoc.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, "-1", UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) + + If CveDocumentacionElectronica > 0 Then + + + If Not objEdoc.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, CveDocumentacionElectronica & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) Then + ErrorProceso = True + End If End If - Else - If objEdoc.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) Then + + Else + If Not objEdoc.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, CveDocumentacionElectronica & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) Then + ErrorProceso = True End If End If + + + If Not ErrorProceso = True Then + + Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\" & CveDocumentacionElectronica & "." & FileExtension + Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\" & AdjuntoDocumentacion + + + + Try + If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\") Then + System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\") + End If + + If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then + File.Delete(rutaAdjuntoAnterior) + End If + + If System.IO.File.Exists(rutaDestino) Then + System.IO.File.Delete(rutaDestino) + End If + + System.IO.File.Move(fileItem.FileUrl, rutaDestino) + Catch ex As Exception + GuardaLog($"Error al gaurdar documento (moviendo archivo digital) --> Error{ ex.StackTrace}") + ErrorProceso = True + End Try + End If + + + If Not ErrorProceso Then + objEdoc.Commit() + Alert("Documento cargado correctamente") + Else + objEdoc.RollBack() + Alert("Error al cargar archivo", TipoMensaje.MsgError) + End If objEdoc.Dispose() - 'GuardarDocumentos(CveDocumentacion) + CargaDocumentacion() TxtFileDocumentacion.Text = "" - UPModalUploadDoc.Update() - - - Alert("Archivo cargado correctamente.") + UPModalUploadDoc.Update() + Catch ex As Exception OnError("Error al cargar archivo", ex) End Try Next - RegistraScript("$('#ModalUploadDoc').modal('hide')", "hidemodal3") + RegistraScript("$('#ModalUploadDoc').modal('hide')", "hidemodal3") + + + 'Dim FileExtension As String = "-1" + 'Dim Filesgral As List(Of Archivo) = TxtFileDocumentacion.getfiles().Archivos + 'Dim Filename As String = "" + + 'If AplicaFechaVencimiento And DiasVigencia > 0 Then + ' FechaVigencia = DateTime.Today.AddDays(DiasVigencia) + 'End If + + 'For Each fileItem As Archivo In Filesgral + + ' Try + + ' FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + ' Dim tempArray() As String + ' tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + ' Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\" & Documentacion & "." & FileExtension + ' Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\" & AdjuntoDocumentacion + + ' If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\") Then + ' System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Edoc\Proveedor\" & CveProveedor & "\") + ' End If + + ' If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then + ' File.Delete(rutaAdjuntoAnterior) + ' End If + + ' If System.IO.File.Exists(rutaDestino) Then + ' System.IO.File.Delete(rutaDestino) + ' End If + + ' System.IO.File.Move(fileItem.FileUrl, rutaDestino) + + + ' Dim objEdoc As New ClsEdocumentacion + + ' If CveDocumentacionElectronica = -1 Then + ' If objEdoc.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) > 0 Then + + ' End If + ' Else + ' If objEdoc.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, CveProveedor, 2, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, FechaVigencia) Then + + ' End If + ' End If + + ' objEdoc.Dispose() + + ' 'GuardarDocumentos(CveDocumentacion) + ' CargaDocumentacion() + + ' TxtFileDocumentacion.Text = "" + ' UPModalUploadDoc.Update() + + + ' Alert("Archivo cargado correctamente.") + ' Catch ex As Exception + ' OnError("Error al cargar archivo", ex) + ' End Try + + 'Next + + 'RegistraScript("$('#ModalUploadDoc').modal('hide')", "hidemodal3") End Sub diff --git a/Ventas/RepIngresos.aspx b/Ventas/RepIngresos.aspx index d6951430c..6abacbbed 100644 --- a/Ventas/RepIngresos.aspx +++ b/Ventas/RepIngresos.aspx @@ -4,39 +4,54 @@
    @@ -66,8 +81,8 @@ -
    -
    +
    +
    @@ -76,7 +91,7 @@
    -
    +
    @@ -118,10 +133,14 @@
    -
    - +
    +<%-- - + --%> + + + +