diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index d2779e6d3..a9d79c531 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -766,7 +766,7 @@ Partial Class AF_AF End If If Filename <> "" Then - Filename.FilesMove(String.Format("{0}", Archivo.Name), String.Format("Empresas\{0}\AF\Placas", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("{0}", Archivo.Name), String.Format("{0}AF\Placas", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If If HdnModalidad.Value = "A" Then @@ -877,13 +877,13 @@ Partial Class AF_AF Filename = fileItem.filename Next - Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Licencias\{1}", ModExtensiones.DirectorioBaseEmpresas, Filename)) + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Licencias\{1}", UsuarioActual.Empresa.Ruta, Filename)) If Archivo.Exists() Then Archivo.Delete() End If If Filename <> "" Then - Filename.FilesMove(String.Format("{0}", Archivo.Name), String.Format("Empresas\{0}\AF\Licencias", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("{0}", Archivo.Name), String.Format("{0}AF\Licencias", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If If HdnModalidadLicencia.Value = "A" Then @@ -940,7 +940,7 @@ Partial Class AF_AF extencion = array(array.Length - 1) End If - If Adjunto.Trim.Length > 0 Then + If Adjunto.Trim.Length > 0 Then Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/AF/Polizas/" & Adjunto & "." & extencion Dim linkDescargaArchivo = UsuarioActual.Empresa.Ruta & "AF/Polizas/" & Adjunto & "." & extencion @@ -1030,13 +1030,13 @@ Partial Class AF_AF Filename = fileItem.filename Next - Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Polizas\{1}", AppDomain.CurrentDomain.BaseDirectory, Filename)) + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Polizas\{1}", UsuarioActual.Empresa.Ruta, Filename)) If Archivo.Exists() Then Archivo.Delete() End If If Filename <> "" Then - Filename.FilesMove(String.Format("{0}", Archivo.Name), String.Format("Empresas\{0}\AF\Polizas", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("{0}", Archivo.Name), String.Format("{0}AF\Polizas", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If If HdnModalidadPoliza.Value = "A" Then @@ -1929,7 +1929,7 @@ Partial Class AF_AF If EsURL2 Then If objAF.UpdateActivosFijosResguardosURL("-1", $"AFT{CveResguardoPadre}.{FileExtension}", CveResguardoPadre) Then If filemove <> "" Then - filemove.FilesMove(String.Format("AFT{0}", CveResguardoPadre), String.Format("Empresas\{0}\AF\Resguardos", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("AFT{0}", CveResguardoPadre), String.Format("{0}AF\Resguardos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If Else HuboError = True @@ -1937,7 +1937,7 @@ Partial Class AF_AF Else If objAF.UpdateActivosFijosResguardosURL($"AFR{CveResguardoPadre}.{FileExtension}", "-1", CveResguardoPadre) Then If filemove <> "" Then - filemove.FilesMove(String.Format("AFR{0}", CveResguardoPadre), String.Format("Empresas\{0}\AF\Resguardos", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("AFR{0}", CveResguardoPadre), String.Format("{0}AF\Resguardos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If Else HuboError = True @@ -2022,7 +2022,7 @@ Partial Class AF_AF Dim DirectorioOld As New StringBuilder Dim DirectorioNew As New StringBuilder DirectorioOld.AppendFormat("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, FileMove) - DirectorioNew.AppendFormat("{0}Empresas\{1}\AF\", ModExtensiones.DirectorioBaseEmpresas, CveEmpresaActual) + DirectorioNew.AppendFormat("{0}AF\", UsuarioActual.Empresa.Ruta) If Not Directory.Exists(DirectorioNew.ToString) Then Directory.CreateDirectory(DirectorioNew.ToString) End If @@ -2054,7 +2054,7 @@ Partial Class AF_AF If (CveImagenActivoFijo > 0) Then Dim ObjActivoFijo As New ClsAF If ObjActivoFijo.RemoveActivosFijosImagenes(CveImagenActivoFijo) Then - File.Delete(String.Format("{0}Empresas\{1}\{2}", ModExtensiones.DirectorioBaseEmpresas, CveEmpresaActual, ObjActivoFijo.DtResultados.Rows(0)("URL"))) + File.Delete(String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjActivoFijo.DtResultados.Rows(0)("URL"))) CargarArchivo() RegistraScript("initcarusel();") End If diff --git a/AF/ResguardoAF.aspx.vb b/AF/ResguardoAF.aspx.vb index 5f48d7542..03ab0ce02 100644 --- a/AF/ResguardoAF.aspx.vb +++ b/AF/ResguardoAF.aspx.vb @@ -542,10 +542,10 @@ Partial Class AF_ResguardoAF If EsLiberacion Then If objAF.UpdateActivosFijosResguardosURL($"AFR{CveResguardoPadre}.{FileExtension}", "-1", CveResguardoPadre) Then If filemove <> "" Then - If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) Then - File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) + If File.Exists(String.Format("{0}\AF\Resguardos\AFR{1}.{2}", UsuarioActual.Empresa.Ruta, CveResguardoPadre, FileExtension)) Then + File.Delete(String.Format("{0}AF\Resguardos\AFR{1}.{2}", UsuarioActual.Empresa.Ruta, CveResguardoPadre, FileExtension)) End If - If filemove.FilesMove(String.Format("AFR{0}", CveResguardoPadre), String.Format("Empresas\{0}\AF\Resguardos", UsuarioActual.CveEmpresa)) Then + If filemove.FilesMove(String.Format("AFR{0}", CveResguardoPadre), String.Format("{0}AF\Resguardos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then HuboError = False Else HuboError = True @@ -558,10 +558,10 @@ Partial Class AF_ResguardoAF If EsURL2 Then If objAF.UpdateActivosFijosResguardosURLGpo("-1", $"AFT{CveResguardoPadre}.{FileExtension}", CveResguardoPadre) Then If filemove <> "" Then - If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) Then - File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) + If File.Exists(String.Format("{0}AF\Resguardos\AFR{1}.{2}", UsuarioActual.Empresa.Ruta, CveResguardoPadre, FileExtension)) Then + File.Delete(String.Format("{0}AF\Resguardos\AFR{1}.{2}", UsuarioActual.Empresa.Ruta, CveResguardoPadre, FileExtension)) End If - If filemove.FilesMove(String.Format("AFT{0}", CveResguardoPadre), String.Format("Empresas\{0}\AF\Resguardos", UsuarioActual.CveEmpresa)) Then + If filemove.FilesMove(String.Format("AFT{0}", CveResguardoPadre), String.Format("{0}AF\Resguardos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then HuboError = False Else HuboError = True @@ -575,10 +575,10 @@ Partial Class AF_ResguardoAF If objAF.UpdateActivosFijosResguardosURLGpo($"AFR{CveResguardoPadre}.{FileExtension}", "-1", CveResguardoPadre) Then If filemove <> "" Then - If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) Then - File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) + If File.Exists(String.Format("{0}AF\Resguardos\AFR{1}.{2}", UsuarioActual.Empresa.Ruta, CveResguardoPadre, FileExtension)) Then + File.Delete(String.Format("{0}AF\Resguardos\AFR{1}.{2}", UsuarioActual.Empresa.Ruta, CveResguardoPadre, FileExtension)) End If - If filemove.FilesMove(String.Format("AFR{0}", CveResguardoPadre), String.Format("Empresas\{0}\AF\Resguardos", UsuarioActual.CveEmpresa)) Then + If filemove.FilesMove(String.Format("AFR{0}", CveResguardoPadre), String.Format("{0}AF\Resguardos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then HuboError = False Else HuboError = True diff --git a/AIMMGM/ConsultaCliente.aspx.vb b/AIMMGM/ConsultaCliente.aspx.vb index 29c856863..1264906e2 100644 --- a/AIMMGM/ConsultaCliente.aspx.vb +++ b/AIMMGM/ConsultaCliente.aspx.vb @@ -648,14 +648,14 @@ Partial Class AIMMGM_ConsultaCliente End If Dim AIM As New ClsAIMMGM - If Not IO.Directory.Exists(String.Format("{0}\Empresas\{1}\Documentos", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) Then - IO.Directory.CreateDirectory(String.Format("{0}\Empresas\{1}\Documentos", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) + If Not IO.Directory.Exists(String.Format("{0}Documentos", UsuarioActual.Empresa.Ruta)) Then + IO.Directory.CreateDirectory(String.Format("{0}Documentos", UsuarioActual.Empresa.Ruta, 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}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Cve, IO.Path.GetExtension(FUComprobante.FileName))) + FUComprobante.SaveAs(String.Format("{0}Documentos/{1}{2}", UsuarioActual.Empresa.Ruta, Cve, IO.Path.GetExtension(FUComprobante.FileName))) Alert("Pago ingresado correctamente", TipoMensaje.MsgInformacion) End If AIM.Dispose() @@ -669,8 +669,8 @@ Partial Class AIMMGM_ConsultaCliente Exit Sub End If 'obtengo la clave de la publicidad - If Not IO.Directory.Exists(String.Format("{0}\Empresas\{1}\Documentos", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) Then - IO.Directory.CreateDirectory(String.Format("{0}\Empresas\{1}\Documentos", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) + If Not IO.Directory.Exists(String.Format("{0}Documentos", UsuarioActual.Empresa.Ruta)) Then + IO.Directory.CreateDirectory(String.Format("{0}Documentos", UsuarioActual.Empresa.Ruta)) End If Dim Logo As String @@ -680,10 +680,10 @@ Partial Class AIMMGM_ConsultaCliente 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}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Logo)) + FULogo.SaveAs(String.Format("{0}Documentos/{2}", UsuarioActual.Empresa.Ruta, Logo)) AIM.UpdateLogo(CvePublicidad, Logo) - ImgLogo.ImageUrl = String.Format("/Empresas/{0}/Documentos/{1}", UsuarioActual.CveEmpresa, Logo) + ImgLogo.ImageUrl = String.Format("{0}/Documentos/{1}", UsuarioActual.Empresa.Ruta, Logo) End If End If diff --git a/AIMMGM/Pagos.aspx.vb b/AIMMGM/Pagos.aspx.vb index 37f0c54a4..24ccdebfd 100644 --- a/AIMMGM/Pagos.aspx.vb +++ b/AIMMGM/Pagos.aspx.vb @@ -161,7 +161,7 @@ Partial Class AIMMGM_Pagos Next Next - Dim Archivoxlsx As String = String.Format("{0}/Empresas/{1}/Documentos/{2}.xlsx", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, NombreArchivoXLSX) + Dim Archivoxlsx As String = String.Format("{0}Documentos/{1}.xlsx", UsuarioActual.Empresa.Ruta, NombreArchivoXLSX) Using wb As New XLWorkbook() wb.Worksheets.Add(dtt) wb.SaveAs(Archivoxlsx) diff --git a/AIMMGM/Registro.aspx.vb b/AIMMGM/Registro.aspx.vb index cc37fbe2f..b0b5a6a05 100644 --- a/AIMMGM/Registro.aspx.vb +++ b/AIMMGM/Registro.aspx.vb @@ -125,7 +125,7 @@ Partial Class AIMMGM_Registro Private Sub CargaReCompra(ClavePago As String, CveCliente As Integer) Dim tmp As New DataTable - Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", ModExtensiones.DirectorioBaseEmpresas) + Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", UsuarioActual.Empresa.Ruta) Dim Archivo As String = String.Format("{0}/{1}.xml", Carpeta, ClavePago) Dim Archivo2 As String = String.Format("{0}/C{1}.xml", Carpeta, ClavePago) diff --git a/AIMMGM/ePagos.aspx.vb b/AIMMGM/ePagos.aspx.vb index 75fc0b45a..1e498a877 100644 --- a/AIMMGM/ePagos.aspx.vb +++ b/AIMMGM/ePagos.aspx.vb @@ -90,7 +90,7 @@ Partial Class AIMMGM_ePagos Private Sub CargaCompra() Dim tmp As New DataTable - Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", ModExtensiones.DirectorioBaseEmpresas) + Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", UsuarioActual.Empresa.Ruta) Dim Archivo As String = String.Format("{0}/{1}.xml", Carpeta, ClavePago) Dim Archivo2 As String = String.Format("{0}/C{1}.xml", Carpeta, ClavePago) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 9e898f86c..1d8d75be2 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5565,20 +5565,31 @@ Public Class ClsPaginas sw.Start() Dim Bytes As Byte() = Nothing + Dim CveUsuario As Integer = 0 + Dim CveEmpresa As Integer = 0 + Dim RutaEmpresa As String = "" + + If Context.Session("UsuarioSIG") IsNot Nothing Then + CveUsuario = UsuarioActual.CveUsuario + CveEmpresa = UsuarioActual.CveEmpresa + RutaEmpresa = UsuarioActual.Empresa.RutaArchivos + End If + Dim bdir As String = If(RutaReporte.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory) + + 'TOMAR LA RUTA BASE PARA EL DIRECTORIO DE LA EMPRESA + If Not String.IsNullOrEmpty(RutaEmpresa) AndAlso Not RutaReporte.Contains("Grales") Then + bdir = RutaEmpresa.Replace($"{CveEmpresa}/", "") + End If + RutaReporte.Replace("/", "\") + If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) End If If EsProduccion Then - Dim CveUsuario As Integer = 0 - Dim CveEmpresa As Integer = 0 - If Context.Session("UsuarioSIG") IsNot Nothing Then - CveUsuario = UsuarioActual.CveUsuario - CveEmpresa = UsuarioActual.CveEmpresa - End If Dim wsreport As New WSRDLC.WebServiceSoapClient Dim params As New List(Of WSRDLC.ReportParameter) Dim ds As New DataSet @@ -5963,11 +5974,11 @@ Public Class ClsPaginas #End Region #Region "IMPRIMIR FACTURA" - Public Sub PdfFacturaPyME(ByRef Vta As Modelos.Factura, DT As DataTable) + Public Sub PdfFacturaPyME(ByRef Vta As Modelos.Factura, DT As DataTable, Optional Guardar As Boolean = True) Dim retorno As Byte() = Nothing 'DATOS GENERALES - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta Dim PathXML As String = $"{Ruta}XML\{Vta.TipoDocto}\{Vta.SerieFolio}.xml" Dim NombreArchivo As String = "" Dim NombreArchivoDescarga As String = "" @@ -6456,26 +6467,27 @@ Public Class ClsPaginas DataSet.Tables.Add(Vta.DtDeduccion.Copy) If Archivo.Exists Then - - ImprimirbytesPDF(ImprimirPDFPyME(RutaFormato, DataSet, params, NombreArchivo, "PDF", MR:=Nothing), "Factura") - Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)) - If Not ArchivoPDF.Exists Then - Try - DirectoryExistsCreate(String.Format("{0}PDF", UsuarioActual.Empresa.Ruta)) - DirectoryExistsCreate(String.Format("{0}PDF\{1}", UsuarioActual.Empresa.Ruta, Vta.TipoDocto)) - File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno) - Catch ex As Exception - Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) - End Try - Else - Try - ArchivoPDF.Delete() - File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno) - Catch ex As Exception - Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) - End Try + If Guardar Then + Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)) + If Not ArchivoPDF.Exists Then + Try + DirectoryExistsCreate(String.Format("{0}PDF", UsuarioActual.Empresa.Ruta)) + DirectoryExistsCreate(String.Format("{0}PDF\{1}", UsuarioActual.Empresa.Ruta, Vta.TipoDocto)) + File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno) + Catch ex As Exception + Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) + End Try + Else + Try + ArchivoPDF.Delete() + File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno) + Catch ex As Exception + Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) + End Try + End If End If + Else params.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)) params.Add(New CrystalParametro("RFC", UsuarioActual.Empresa.RFC)) @@ -6493,7 +6505,7 @@ Public Class ClsPaginas ' Dim ObjVentas As New ClsVentas 'DATOS GENERALES - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta Dim PathXML As String = $"{Ruta}XML\{Vta.TipoDocto}\{Vta.SerieFolio}.xml" Dim NombreArchivo As String = "" Dim NombreArchivoDescarga As String = "" @@ -7913,7 +7925,7 @@ Public Class ClsPaginas Dim DTDeducciones As Data.DataTable Dim DTDeducciones2 As New Data.DataTable - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\" + Dim Ruta As String = RutaEmpresa Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.Serie }{If(indemnizacion, "F", "")}-{ObjNomina.Folio}.xml" Dim FechaEmision, FechaCertificacion As DateTime Dim FolioFiscal, NoSerieCertificado, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT As String @@ -8278,7 +8290,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToString)) 'DATOS GENERALES - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta Dim PathXML As String = $"{Ruta}XML\Pag\{Serie}-{Folio}.xml" Dim PathPDF As String = $"{Ruta}PDF\Pag\{Serie}-{Folio}.pdf" SerieFolio = $"{Serie}-{Folio}" @@ -8413,8 +8425,8 @@ Public Class ClsPaginas End If - If File.Exists($"{UsuarioActual.Empresa.Ruta}\Formatos\ReciboDePago.rdlc") Then - rutaArchivo = $"Empresas\{UsuarioActual.CveEmpresa}\Formatos\ReciboDePago.rdlc" + If File.Exists($"{UsuarioActual.Empresa.Ruta}Formatos\ReciboDePago.rdlc") Then + rutaArchivo = $"{UsuarioActual.Empresa.Ruta}Formatos\ReciboDePago.rdlc" Else rutaArchivo = " \Empresas\Grales\Formatos\ReciboDePago.rdlc" End If diff --git a/App_Code/ClsSisEmpresas.vb b/App_Code/ClsSisEmpresas.vb index 0e5c9d088..8712432be 100644 --- a/App_Code/ClsSisEmpresas.vb +++ b/App_Code/ClsSisEmpresas.vb @@ -465,7 +465,9 @@ Public Class ClsSisEmpresas _Empresa.CveEncuestaCRM = Data.Rows(0)("CveEncuestaCRM").ToString.ToEntero _Empresa.FielPassword = Data.Rows(0)("FielPassword").ToString - _Empresa.FielPFX = Data.Rows(0)("FielPFX").ToString + _Empresa.FielPFX = Data.Rows(0)("FielPFX").ToString + + _Empresa.RutaArchivos = Data.Rows(0)("RutaArchivos").ToString Else diff --git a/App_Code/Empresa.vb b/App_Code/Empresa.vb index 3e8120dd8..aeb1ff7b7 100644 --- a/App_Code/Empresa.vb +++ b/App_Code/Empresa.vb @@ -99,10 +99,15 @@ Public Class Empresa Public Property Soporte_USR As String Public Property Soporte_PWD As String Public Property Soporte_Tipo As String - Public Property Timbres As Integer + Public Property Timbres As Integer + Public Property RutaArchivos As String Public ReadOnly Property Ruta As String Get - Return String.Format("{0}\{1}\", Extensiones.ModExtensiones.DirectorioEmpresas, Me.CveEmpresa) + If Not String.IsNullOrEmpty(RutaArchivos) Then + Return RutaArchivos + Else + Return String.Format("{0}\{1}\", Extensiones.ModExtensiones.DirectorioEmpresas, Me.CveEmpresa) + End If End Get End Property Public Property IdCuentaIVAxTrasladar As Integer diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index e4f5db821..b36f28a44 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2099,7 +2099,7 @@ Namespace Modelos For Each drow As DataRow In factura.DtDetalle.Rows If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario, + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then Resultado = False Exit For @@ -2158,7 +2158,7 @@ Namespace Modelos If factura.Cliente.EsDistribuidor AndAlso factura.CveConceptoMovimiento = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToDecimal(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then ' Mensaje = "Error al guardar Movimientos de distribuidor" Resultado = False diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 95863dc34..3743692cd 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -519,7 +519,7 @@ Namespace Extensiones Return retorno End Function - Public Function FilesMove(oldName As String, newName As String, newDirectorio As String, Optional Sobreescribir As Boolean = False) As Boolean + Public Function FilesMove(oldName As String, newName As String, newDirectorio As String, Optional Sobreescribir As Boolean = False, Optional ConcatenarDirectorioBase As Boolean = True) As Boolean Dim retorno As Boolean = True Dim directorioOld As New StringBuilder Dim directorioNew As New StringBuilder @@ -531,11 +531,17 @@ Namespace Extensiones End If 'SI VA A LA CARPETA DE EMPRESAS TIENE QUE TOMAR LA RUTA DE EMPRESAS - If newDirectorio.Contains("Empresas") Then - directorioNew.AppendFormat("{0}{1}\", ModExtensiones.DirectorioBaseEmpresas, newDirectorio) + If ConcatenarDirectorioBase Then + If newDirectorio.Contains("Empresas") Then + directorioNew.AppendFormat("{0}{1}\", ModExtensiones.DirectorioBaseEmpresas, newDirectorio) + Else + directorioNew.AppendFormat("{0}{1}\", AppDomain.CurrentDomain.BaseDirectory, newDirectorio) + End If Else - directorioNew.AppendFormat("{0}{1}\", AppDomain.CurrentDomain.BaseDirectory, newDirectorio) - End If + 'SI YA TIENE EL DIRECTORIO COMPLETO NO CONCANTENA EL DIRECTORIO + directorioNew.AppendFormat("{0}\", newDirectorio) + End If + If Not Directory.Exists(directorioNew.ToString) Then Directory.CreateDirectory(directorioNew.ToString) diff --git a/Ashx/SIGCRM.ashx b/Ashx/SIGCRM.ashx index dacdc1843..77aefdf0e 100644 --- a/Ashx/SIGCRM.ashx +++ b/Ashx/SIGCRM.ashx @@ -56,7 +56,7 @@ Public Class SIGCRM : Implements IHttpHandler, IRequiresSessionState Dim Usuario As Usuario = UsuarioActual(context) If Not IsNothing(Usuario) Then - Dim Url = String.Format("{0}\Empresas\{1}\Acercamientos\{2}\Imagenes\{3}", ModExtensiones.DirectorioBaseEmpresas, Usuario.CveEmpresa, CveAcercamiento, Archivo) + Dim Url = String.Format("{0}Acercamientos\{1}\Imagenes\{2}", Usuario.Empresa.Ruta, CveAcercamiento, Archivo) If File.Exists(Url) Then context.Response.ContentType = String.Format("image/{0}", Extension) diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 11ec214c0..f191800c0 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -8,6 +8,12 @@ Imports Extensiones Imports System.IO Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState + 'TEMPORAL, DEBE SER REEMPLAZADO POR EL MODELO DE LA LIBRERIA + Public Class MResponseModel(Of T) + Public Property IsSuccess As Boolean + Public Property Message As String + Public Property Result As T + End Class Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest If context.Request("metodo") IsNot Nothing AndAlso context.Request("metodo").ToString() = "GetTokenAngular" Then @@ -51,13 +57,14 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim CveEmpresa As Integer = context.Request("CveEmpresa").ToString().ToEntero() GuardaLog(String.Format("?metodo=Contabilizapoliza&CvePrePoliza={0}&CveUsuario={1}&CveEmpresa ={2}", CvePrePoliza, CveUsuario, CveEmpresa)) ActualizaPrePoliza(context) - Dim obj As New ADSNetLibrary.SIGAPI.Models.ResponseModel(Of Object)() + + Dim obj As New MResponseModel(Of Object)() obj.Result = DateTime.Now.ToString() Dim retorno = JsonConvert.SerializeObject(obj).ToString() context.Response.Write(retorno) context.Response.StatusCode = 200 Case "RevisaConexion" - Dim obj As New ADSNetLibrary.SIGAPI.Models.ResponseModel(Of Object)() + Dim obj As New MResponseModel(Of Object)() obj.Result = DateTime.Now.ToString() Dim retorno = JsonConvert.SerializeObject(obj).ToString() context.Response.Write(retorno) @@ -92,8 +99,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ActualizaPrePoliza(context) Case "getpersonal" getpersonal(context) - Case "getcuentascontables" - GetCuentasContables(context) Case "getcontratos" GetContratos(context) Case "GettingCURP" @@ -214,7 +219,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim CveEmpresa As Integer = context.Request("CveEmpresa").ToString.ToEntero Dim CveUsuario As Integer = context.Request("CveUsuario").ToString.ToEntero Dim Empresa As New Empresa - Dim ObjConta As New ClsContabilidad + Dim Retorno As Integer = 0 Dim ObjEmpresa As New ClsSisEmpresas() @@ -224,19 +229,22 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ObjEmpresa.Dispose() Dim IdPoliza As Integer = -1 - ObjConta.GetPrePoliza(CvePrePoliza, CveEmpresa) - IdPoliza = ObjConta.DtResultados.FiltroPrimeroValor("IdPoliza", "").ToEntero + Dim ObjConta As New ClsContabilidad + Try + ObjConta.GetPrePoliza(CvePrePoliza, CveEmpresa) + IdPoliza = ObjConta.DtResultados.FiltroPrimeroValor("IdPoliza", "").ToEntero + If IdPoliza > 0 Then + ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) + End If - If IdPoliza > 0 Then - - ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) - If ObjConta.ContabilizarPrePoliza(CvePrePoliza, CveUsuario, Empresa, pIDPoliza:=IdPoliza) Then + If ObjConta.ContabilizarPrePoliza(CvePrePoliza, CveUsuario, Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1)) Then Retorno = 200 End If - Else - Retorno = 200 - End If + Catch ex As Exception + GuardaLogAD(ex.ToString()) + End Try ObjConta.Dispose() + Empresa = Nothing 'context.Response.Write(CveUsuario.ToString()) context.Response.StatusCode = Retorno @@ -582,15 +590,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End If If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then - 'Dim i As Integer = 0 'limpieza de columnas - 'While i < DtRetorno.Columns.Count - ' If Not DtRetorno.Columns(i).ColumnName.Contiene("CveProveedor", "NombreCortoProveedor") Then - ' DtRetorno.Columns.RemoveAt(i) - ' Else - ' i = i + 1 - ' End If - 'End While - DtRetorno.Columns("CveCliente").ColumnName = "id" DtRetorno.Columns(ColumnaNombre).ColumnName = "text" retorno = JsonConvert.SerializeObject(DtRetorno).ToString @@ -626,6 +625,11 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ObjProveedores.Dispose() End If + 'Dim ObjProveedores As New ClsCompProveedores + 'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", Name, "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then + ' DtRetorno = ObjProveedores.DtResultados + 'End If + 'ObjProveedores.Dispose() Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable) '.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then DtRetorno = dt.FiltraParametros(String.Format("NombreCortoProveedor like '%{0}%'", Name)) @@ -651,7 +655,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Else context.Response.Write("[]") End If - + DtRetorno.Dispose() Return retorno End Function #End Region @@ -740,6 +744,10 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141, 152, 153, 159, 160, 161, 162, 163, 166) Then UsaGlobal = False + 'If CveEmpresa.Contiene(140, 141) And Pagina.Contiene("ventas/ventas") Then + ' AplicaParaVenta = 1 + 'End If + Dim objInv As New ClsInventarios If objInv.GetExistenciasProductosLike(Name, CveClasificacion, CveSubProyecto, Estatus.ToEntero, AplicaParaVenta, CveEmpresa, CveMarca) Then @@ -1185,6 +1193,11 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ObjPersonal.Dispose() End If + 'Dim ObjProveedores As New ClsCompProveedores + 'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", Name, "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then + ' DtRetorno = ObjProveedores.DtResultados + 'End If + 'ObjProveedores.Dispose() Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then DtRetorno = dt.FiltraParametros($"NombreCompleto like '%{Name}%'") @@ -1192,7 +1205,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End If If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then - DtRetorno.Columns("CvePersonal").ColumnName = "id" DtRetorno.Columns("NombreCompleto").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtRetorno).ToString @@ -1239,47 +1251,4 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Return retorno End Function #End Region - -#Region "Get Cuentas" - Private Function GetCuentasContables(ByVal context As HttpContext) As String - Dim retorno As String = "" - Dim DtRetorno As DataTable = Nothing - - Dim usuario As Usuario = UsuarioActual(context) - Dim CveEmpresa As String - If IsNothing(usuario) Then - context.Response.Write("") - Else - CveEmpresa = usuario.CveEmpresa - - Dim Name = IfNull(context.Request("Name"), "-1").ToString - Dim ObjConta As New ClsContabilidad - If ObjConta.GetCuentas(-1, "-1", 1, CveEmpresa, Nombre:=Name) Then - DtRetorno = ObjConta.DtResultados - End If - ObjConta.Dispose() - - End If - - If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then - Dim i As Integer = 0 'limpieza de columnas - While i < DtRetorno.Columns.Count - If Not DtRetorno.Columns(i).ColumnName.Contiene("CveCuenta", "CtaCodigo") Then - DtRetorno.Columns.RemoveAt(i) - Else - i = i + 1 - End If - End While - DtRetorno.Columns("CveCuenta").ColumnName = "id" - DtRetorno.Columns("CtaCodigo").ColumnName = "text" - retorno = JsonConvert.SerializeObject(DtRetorno).ToString - context.Response.Write(retorno) - Else - context.Response.Write("[]") - End If - - DtRetorno.Dispose() - Return retorno - End Function -#End Region End Class \ No newline at end of file diff --git a/Bancos/CreditosPagoMultiple.aspx.vb b/Bancos/CreditosPagoMultiple.aspx.vb index 3389cd8d3..55cf1b55f 100644 --- a/Bancos/CreditosPagoMultiple.aspx.vb +++ b/Bancos/CreditosPagoMultiple.aspx.vb @@ -302,7 +302,7 @@ Partial Class Bancos_CreditosPagoMultiple Alert("El Documento se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/CreditosPagoMultiple.aspx"";") If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)) + filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If ObjIE.Commit() GeneraChequePDF(CveIE, UsuarioActual.Empresa) diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index e0ef0f2ee..7bde7a0bc 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -2737,7 +2737,7 @@ Partial Class Bancos_IE 'GUARDA COMPROBANTE If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("Empresas\{0}\IE", UsuarioActual.CveEmpresa)) + filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If 'GUARDA PREPOLIZAS DETALLE [PRIMERO SON LOS CASOS ESPECIALES, AL FINAL (ELSE) LOS CASOS NORMALES] --REEMPLAZA IFs @@ -4880,7 +4880,7 @@ Partial Class Bancos_IE If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format("{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GvEB.DataSource = ObjEventoBitacora.DtResultados @@ -5028,8 +5028,8 @@ Partial Class Bancos_IE #Region " CARGAR - COMPROBANTE " Protected Sub BtnConfirmaComprobante_Click(sender As Object, e As EventArgs) - Dim DirectorioGuardar = String.Format("{0}Empresas\{1}\IE", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) - Dim ArchivoTemporal = String.Format("{0}Empresas\{1}\Temp\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Session("FileUpload").ToString) + Dim DirectorioGuardar = String.Format("{0}IE", UsuarioActual.Empresa.Ruta) + Dim ArchivoTemporal = String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString) If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ArchivoTemporal) Then Dim Extension As String = Path.GetExtension(ArchivoTemporal) @@ -5084,8 +5084,7 @@ Partial Class Bancos_IE Dim Path As String = HttpContext.Current.Request.ApplicationPath Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Path = Extensiones.DirectorioBaseEmpresas - Path += String.Format("Empresas/{0}/IE", UsuarioActual.CveEmpresa) + Path = String.Format("{0}IE", UsuarioActual.Empresa.Ruta) diff --git a/Bancos/PagoAcreedor.aspx.cs b/Bancos/PagoAcreedor.aspx.cs index fc91d55d9..56fa5710f 100644 --- a/Bancos/PagoAcreedor.aspx.cs +++ b/Bancos/PagoAcreedor.aspx.cs @@ -321,7 +321,7 @@ public partial class Bancos_PagoAcreedor : ClsPaginas //GUARDA COMPROBANTE if (!filemove.Equals("")) { - filemove.FilesMove(CveIE.ToString(), string.Format(@"Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)); + filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:false); } decimal Importe; decimal ImporteMN; @@ -744,7 +744,7 @@ public partial class Bancos_PagoAcreedor : ClsPaginas //GUARDA COMPROBANTE if (!filemove.Equals("")) { - filemove.FilesMove(CveIE.ToString(), string.Format(@"Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)); + filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase: false); } if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, Ref, CveConceptoContableBanco, Conc, DateTime.Now, IDCtaContableBancos, -1, CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteMN, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero())) diff --git a/Bancos/PagoDeudor.aspx.cs b/Bancos/PagoDeudor.aspx.cs index e96343893..abd9ee76f 100644 --- a/Bancos/PagoDeudor.aspx.cs +++ b/Bancos/PagoDeudor.aspx.cs @@ -355,7 +355,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas //GUARDA COMPROBANTE if (!filemove.Equals("")) { - filemove.FilesMove(CveIE.ToString(), string.Format(@"Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)); + filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase: false); } // SI ES DOLARES @@ -699,7 +699,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas //GUARDA COMPROBANTE if (!filemove.Equals("")) { - filemove.FilesMove(CveIE.ToString(), string.Format(@"Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)); + filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase: false); } //GUARDA PREPOLIZAS DETALLE diff --git a/Bancos/PolizaCheque.aspx.vb b/Bancos/PolizaCheque.aspx.vb index ef2889275..4c7177d1f 100644 --- a/Bancos/PolizaCheque.aspx.vb +++ b/Bancos/PolizaCheque.aspx.vb @@ -1021,7 +1021,7 @@ Partial Class Bancos_PolizaCheque 'If Conta IsNot Nothing Then Conta.Commit() If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)) + filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GeneraChequePDF(CveIE, UsuarioActual.Empresa, IDPoliza) diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 0865e5b69..c0ec85953 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -3467,8 +3467,6 @@ Partial Class Bancos_PopIEVentas PDFReciboDePagos(-1, -1, ObjBancos.CveComplementoPago, False) - Dim LigaDescargaXML = $"../Empresas/{UsuarioActual.CveEmpresa}/XML/Pag/{ObjBancos.ComplementoSerieFolio}.xml" - Dim LigaDescargaPDF = $"../Empresas/{UsuarioActual.CveEmpresa}/PDF/Pag/{ObjBancos.ComplementoSerieFolio}.pdf" Retorno.AppendFormat(" Complemento de pago {0}
", ObjBancos.ComplementoSerieFolio) Retorno.AppendFormat("XML    ", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CveComplementoPago={1}&CveIE={2}", ObjBancos.ComplementoSerieFolio, ObjBancos.CveComplementoPago, CveIE))) Retorno.AppendFormat("PDF   ", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CveComplementoPago={1}&CveIE={2}", ObjBancos.ComplementoSerieFolio, ObjBancos.CveComplementoPago, CveIE))) diff --git a/Bancos/PrestamoPersonal.aspx.cs b/Bancos/PrestamoPersonal.aspx.cs index 2ecb1b234..61470b145 100644 --- a/Bancos/PrestamoPersonal.aspx.cs +++ b/Bancos/PrestamoPersonal.aspx.cs @@ -10,8 +10,8 @@ using System.Web.UI.WebControls; using Extensiones; using static Extensiones.ModExtensiones; public partial class Bancos_PrestamoPersonal : ClsPaginas -{ - #region "PROPIEDADES" +{ + #region "PROPIEDADES" private int IDCtaContablePrestamo { get @@ -106,7 +106,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas txtFechaF.Text = DateTime.Now.ToShortDateString(); TxtImporte.Attributes.Add("disabled", "disabled"); - if(UsuarioActual.Empresa.Funcionalidad(281).ToEntero() == 1) + if (UsuarioActual.Empresa.Funcionalidad(281).ToEntero() == 1) { TxtFechaPrestamo.Enabled = false; ImgCalendarioPrestamo.Visible = false; @@ -187,8 +187,8 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas { divTCPago.Visible = false; TxtTCPago.Text = "1"; - } - + } + long Folio; ClsBancos bancos = new ClsBancos(); Folio = bancos.GetNextFolio(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero()); @@ -268,17 +268,17 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas if (CvePrePoliza > 0) { decimal ImporteBanco = TxtImporte.Text.ToDecimal(); - decimal ImporteMNBanco= ImporteBanco; + decimal ImporteMNBanco = ImporteBanco; decimal ImporteComplementaria = 0; decimal TC = TxtTCPago.Text.ToDecimal(); string Conc = TxtObservaciones.Text == "" ? TxtFolio.Text : TxtObservaciones.Text; string Ref = TxtObservaciones.Text == "" ? TxtFolio.Text : TxtObservaciones.Text; CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero(), TxtFechaDocumento.Text.Trim().ToDate(), TxtFolio.Text.Trim(), DdlFuncionarioEmpleadoPago.SelectedItem.Text, ImporteBanco.ToString().ToDouble(), CveMoneda, - TC.ToString().ToDouble() , TxtObservaciones.Text.Trim(), "", ChkAbonoCuenta.Checked, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); + TC.ToString().ToDouble(), TxtObservaciones.Text.Trim(), "", ChkAbonoCuenta.Checked, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); if (CveMoneda != 1) - { + { if (UsaComplementaria) { ImporteMNBanco = ImporteBanco; @@ -296,7 +296,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas //GUARDA COMPROBANTE if (!filemove.Equals("")) { - filemove.FilesMove(CveIE.ToString(), string.Format(@"Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)); + filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase: false); } decimal Importe; decimal ImporteMN; @@ -323,9 +323,9 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas ImporteMN = Importe * TC; ImporteComplementaria = 0; } - } - - + } + + if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContablePago, Conc, DateTime.Now, IDCtaContablePrestamo, -1, CveIE, CvePersonal: DdlFuncionarioEmpleadoPago.SelectedValue.ToEntero(), ImporteMX: ImporteMN, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TC, TipoCambioPago: TC)) { MsgError = "No se pudo insertar concepto de pago acreedor"; @@ -352,7 +352,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, ImporteBanco, Ref, CveConceptoContableBancoComplementario, Conc, DateTime.Now, IDCtaContableBancosPrestamo, -1, CveIE, CvePersonal: DdlFuncionarioEmpleadoPago.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, ImporteME: ImporteBanco, TipoCambio: TC, TipoCambioPago: TC)) { MsgError = "No se pudo insertar concepto de bancos complementaria"; - } + } } } @@ -377,7 +377,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas } //CONTABILIZA - if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") ) + if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("")) { if (IDCtaContablePrestamo > 0 && IDCtaContableBancos > 0) { @@ -471,11 +471,11 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas int tCveMoneda = 0; if (dr != null) { - tCveMoneda = dr["CveMoneda"].ToString().ToEntero(); - - IDCtaContableBancosPrestamo = dr["IdCtaContable"].ToString().ToEntero(); - IDCtaContableBancosPrestamoComplementario = dr["IdCtaContableComplementaria"].ToString().ToEntero(); - + tCveMoneda = dr["CveMoneda"].ToString().ToEntero(); + + IDCtaContableBancosPrestamo = dr["IdCtaContable"].ToString().ToEntero(); + IDCtaContableBancosPrestamoComplementario = dr["IdCtaContableComplementaria"].ToString().ToEntero(); + } if (tCveMoneda != 1) @@ -487,9 +487,9 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas { divTCPrestamo.Visible = false; TxtTCPrestamo.Text = "1"; - } - - + } + + long Folio; ClsBancos bancos = new ClsBancos(); Folio = bancos.GetNextFolio(DdlCuentaPrestamo.SelectedValue.ToEntero(), DdlTipoTransanccionPrestamo.SelectedValue.ToEntero()); @@ -500,7 +500,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas } - private void AsignaCuentaPersonal( int CvePersonal, int tCveMoneda) + private void AsignaCuentaPersonal(int CvePersonal, int tCveMoneda) { IDCtaContablePrestamo = 0; @@ -508,10 +508,10 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas if (CvePersonal > 0) { - if (ObjRH.GetPersonal(CvePersonal,UsuarioActual.CveEmpresa)) + if (ObjRH.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa)) { - IDCtaContablePrestamo = ObjRH.IdCtaContPrestamos; - + IDCtaContablePrestamo = ObjRH.IdCtaContPrestamos; + } } ObjRH.Dispose(); @@ -550,7 +550,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas AsignaCuentaPersonal(DdlFuncionarioEmpleadoPrestamo.SelectedValue.ToEntero(), CveMoneda); // DATOS PREPOLIZA - if (DdlTipoTransanccionPrestamo.SelectedValue == "1" && UsuarioActual.CveEmpresa != 119 ) FolioFijo = TxtFolioPrestamo.Text.ToEntero(); + if (DdlTipoTransanccionPrestamo.SelectedValue == "1" && UsuarioActual.CveEmpresa != 119) FolioFijo = TxtFolioPrestamo.Text.ToEntero(); CvePrePoliza = ObjMov.AddPrePolizas("Bancos/PRESTAMO PERSONAL", CvePlantillaPoliza, TxtImportePrestamo.Text.Trim().ToDouble(), TxtImportePrestamo.Text.Trim().ToDouble(), CveMoneda, TxtFechaPrestamo.Text.ToDate(), DdlFuncionarioEmpleadoPrestamo.SelectedItem.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo: FolioFijo, ReglaFolioPoliza: ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, null, UsuarioActual.CveEmpresa)); @@ -564,11 +564,11 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas string Ref = TxtObservacionesPrestamo.Text == "" ? TxtFolioPrestamo.Text : TxtObservacionesPrestamo.Text; CveIE = ObjIE.AddBancos_IE(DdlCuentaPrestamo.SelectedValue.ToEntero(), DdlTipoTransanccionPrestamo.SelectedValue.ToEntero(), TxtFechaPrestamo.Text.Trim().ToDate(), TxtFolioPrestamo.Text.Trim(), DdlFuncionarioEmpleadoPrestamo.SelectedItem.Text, Importe.ToString().ToDouble(), CveMoneda, - TC.ToString().ToDouble(), TxtObservacionesPrestamo.Text.Trim(), "", false, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); - + TC.ToString().ToDouble(), TxtObservacionesPrestamo.Text.Trim(), "", false, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); + if (CveMoneda != 1) { - if (UsuarioActual.CveEmpresa.Contiene (1, 119)) { UsaComplementaria = true; } + if (UsuarioActual.CveEmpresa.Contiene(1, 119)) { UsaComplementaria = true; } if (UsaComplementaria) { @@ -579,21 +579,21 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas { ImporteMN = Importe * TC; ImporteComplementaria = 0; - } - - } - - - + } + + } + + + if (CveIE > 0) { //GUARDA COMPROBANTE if (!filemove.Equals("")) { - filemove.FilesMove(CveIE.ToString(), string.Format(@"Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)); + filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:false); } - if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContableBanco, Conc, DateTime.Now, IDCtaContableBancosPrestamo, -1, CveIE, CvePersonal: DdlFuncionarioEmpleadoPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteMN, TipoCambio: TC, TipoCambioPago:TC)) + if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContableBanco, Conc, DateTime.Now, IDCtaContableBancosPrestamo, -1, CveIE, CvePersonal: DdlFuncionarioEmpleadoPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteMN, TipoCambio: TC, TipoCambioPago: TC)) { MsgError = "No se pudo insertar concepto de bancos"; } @@ -603,7 +603,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas } if (CveMoneda != 1 && UsaComplementaria) - { + { if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, Ref, CveConceptoContableBancoComplementario, Conc, DateTime.Now, IDCtaContableBancosPrestamo, -1, CveIE, CvePersonal: DdlFuncionarioEmpleadoPrestamo.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, ImporteME: Importe, TipoCambio: TC, TipoCambioPago: TC)) { MsgError = "No se pudo insertar concepto de bancos complementaria"; @@ -612,9 +612,9 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas { MsgError = "No se pudo insertar concepto de acreedor complementaria"; } - } - - + } + + } else { @@ -637,7 +637,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas } //CONTABILIZA - if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") ) + if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("")) { if (IDCtaContablePrestamo > 0 && IDCtaContableBancosPrestamo > 0) { @@ -732,10 +732,10 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas if (DdlFuncionarioEmpleado.SelectedValue.ToEntero() > 0) CvePersonal = DdlFuncionarioEmpleado.SelectedValue.ToEntero(); ClsBancos bancos = new ClsBancos(); - if(bancos.GetPersonalPrestamoAuxiliar(CvePersonal, FechaI, FechaF, UsuarioActual.CveEmpresa)) + if (bancos.GetPersonalPrestamoAuxiliar(CvePersonal, FechaI, FechaF, UsuarioActual.CveEmpresa)) { - GvAuxiliar.DataSource = bancos.DtResultados; - + GvAuxiliar.DataSource = bancos.DtResultados; + } bancos.Dispose(); GvAuxiliar.DataBind(); diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index b67a756a2..7e9093f82 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -888,7 +888,7 @@ Partial Class Bancos_ProveedoresAbonar 'guardo el archivo If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)) + filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If Anexo.Text = "" diff --git a/Bancos/RepCobrado.aspx.vb b/Bancos/RepCobrado.aspx.vb index 970fbe2e9..27bab7d10 100644 --- a/Bancos/RepCobrado.aspx.vb +++ b/Bancos/RepCobrado.aspx.vb @@ -134,7 +134,7 @@ Partial Class Ventas_RepRecuperacion If DdlCuentaBancaria.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Cuenta Bancaria: {0}", DdlCuentaBancaria.SelectedItem.Text) Dim RutaPDF As String - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta RutaPDF = $"{Ruta}\Formatos\RepRecuperacion.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepRecuperacion.rdlc" diff --git a/Bancos/RepCobradoDetalle.aspx.vb b/Bancos/RepCobradoDetalle.aspx.vb index 16ad3e3ca..06560f929 100644 --- a/Bancos/RepCobradoDetalle.aspx.vb +++ b/Bancos/RepCobradoDetalle.aspx.vb @@ -193,7 +193,7 @@ Partial Class Ventas_RepRecuperacionDetalle If DdlProveedorSucursal.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Proveedor Sucursal: {0}", DdlProveedorSucursal.SelectedItem.Text) Dim RutaPDF As String - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta RutaPDF = $"{Ruta}\Formatos\RepRecuperacionDetalle.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepRecuperacionDetalle.rdlc" diff --git a/Bancos/RepIE.aspx.vb b/Bancos/RepIE.aspx.vb index 9abca51fc..79f1f35ea 100644 --- a/Bancos/RepIE.aspx.vb +++ b/Bancos/RepIE.aspx.vb @@ -535,7 +535,7 @@ Partial Class Bancos_RepIE End Sub Private Sub Imprimir(Formato As String) - Dim LogoRutaFisica As String = String.Format("Empresas\{0}\Logo.png", UsuarioActual.CveEmpresa) + Dim LogoRutaFisica As String = String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta) Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta)) diff --git a/Bancos/Transferencias.aspx.vb b/Bancos/Transferencias.aspx.vb index 097a21b4f..1cdd89b8e 100644 --- a/Bancos/Transferencias.aspx.vb +++ b/Bancos/Transferencias.aspx.vb @@ -296,7 +296,7 @@ Partial Class Bancos_Transferencias If (CveIE > 0 AndAlso CveIEDestino > 0) Then If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)) + filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If 'inserto los movimientos de la conta para abonar al saldo diff --git a/CRM/Acercamiento.aspx.cs b/CRM/Acercamiento.aspx.cs index ad05f2e5d..bd33d2fb3 100644 --- a/CRM/Acercamiento.aspx.cs +++ b/CRM/Acercamiento.aspx.cs @@ -1059,7 +1059,7 @@ public partial class CRM_Acercamiento : ClsPaginas if (ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim(), string.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoProcesoCRM: CveTipoProceso, CveAcercamientoCRM: CveAcercamiento, CveEtapaProcesoCRM: CveEtapa)) { if (filemove != "") - filemove.FilesMove(string.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), string.Format(@"Empresas\{0}\OI", UsuarioActual.CveEmpresa)); + filemove.FilesMove(string.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), string.Format(@"{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:false); TxtEventoDescripcion.Text = ""; @@ -1448,7 +1448,7 @@ public partial class CRM_Acercamiento : ClsPaginas if ((CveArchivo > 0)) { string NombreNuevo = string.Format("{0}{1}", CveArchivo, FileExtension); - string DirectorioNuevo = string.Format("{0}\\Empresas\\{1}\\Acercamientos\\{2}\\Imagenes\\", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CveAcercamiento); + string DirectorioNuevo = string.Format("{0}Acercamientos\\{1}\\Imagenes\\", UsuarioActual.Empresa.Ruta, CveAcercamiento); if (!Directory.Exists(DirectorioNuevo)) { Directory.CreateDirectory(DirectorioNuevo); diff --git a/CRM/EmpresaCRM.aspx.cs b/CRM/EmpresaCRM.aspx.cs index b0dc49fe5..14b65061a 100644 --- a/CRM/EmpresaCRM.aspx.cs +++ b/CRM/EmpresaCRM.aspx.cs @@ -1068,7 +1068,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas if (ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim(), string.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM)) { if (filemove != "") - filemove.FilesMove(string.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), string.Format(@"Empresas\{0}\OI", UsuarioActual.CveEmpresa)); + filemove.FilesMove(string.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), string.Format(@"{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:false); TxtEventoDescripcion.Text = ""; diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index ca2f18d1d..626eaac84 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -639,7 +639,7 @@ # Cant Unidad - Clasificación + Clasificación @@ -661,7 +661,7 @@
Producto o Servicio - Observación + Observación   @@ -675,22 +675,15 @@ - Tipo de Gasto - - - - - - - + Tipo de Gasto
P.U.  - % IVA  + IVA  % IEPS  - Total  + Total 
¿No Deducible? 
@@ -741,7 +734,7 @@ - + <%-- 0 --%> @@ -760,7 +753,7 @@ <%-- 3 --%> - +
@@ -775,7 +768,7 @@ <%-- 4 --%> <%-- 5 --%> - + @@ -784,17 +777,18 @@ <%-- 6 --%> - + <%-- 7 --%> <%-- 8 --%> - + +
<%-- 9 --%> - + <%----%> @@ -804,7 +798,7 @@ <%-- 10 --%> - + <%-- 11 --%> @@ -814,13 +808,13 @@ <%-- 12 --%> - + <%-- 13 --%> - + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 92e7f1b74..c3a49a3d0 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -580,12 +580,6 @@ Partial Class Compras_Compras End Set End Property - 'Private ReadOnly Property Ruta As String - ' Get - ' Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" - ' End Get - 'End Property - Public Class Anticipos Public Property TipoMovto As String @@ -1636,7 +1630,7 @@ Partial Class Compras_Compras Dim dr As DataRow = ObjeFacturas.DtResultados.Rows(0) ' no toma la cero, porque es el totalizador Dim XMLDoc As New XmlDocument - Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, dr("RFCDe"), dr("XML")) + Dim Archivo As String = String.Format("{0}Compras\{1}\{2}", UsuarioActual.Empresa.Ruta, dr("RFCDe"), dr("XML")) If IO.File.Exists(Archivo) Then Dim Validada As Boolean = True @@ -6462,10 +6456,10 @@ Partial Class Compras_Compras If DdlRetIVAConcepto.SelectedValue.ToEntero = 5 Then If CveMoneda = 2 Then - importeMN = TmpDT.SUMD("RetIVA") * TxtTC.Text.ToDecimal + importeMN = TxtRetIVA.Text.ToDecimal * TxtTC.Text.ToDecimal Else - importeMN = TmpDT.SUMD("RetIVA") - importeMovimiento = TmpDT.SUMD("RetIVA") + importeMN = TxtRetIVA.Text.ToDecimal + importeMovimiento = TxtRetIVA.Text.ToDecimal End If @@ -13591,7 +13585,7 @@ Partial Class Compras_Compras If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=CveCompra) Then If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GvEB.DataSource = ObjEventoBitacora.DtResultados diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 1cb659ebc..3a4a65a77 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -69,11 +69,7 @@ Partial Class PopUpVerFactura ViewState("TmpDTMaterialesOS") = value End Set End Property - Private ReadOnly Property Ruta As String - Get - Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" - End Get - End Property + Private ReadOnly Property DomicilioFiscalCompu As String Get Dim SisEmpresa As New ClsSisEmpresas() @@ -4369,7 +4365,7 @@ Partial Class PopUpVerFactura ' 04/05/2018 - Pruebas de impresion de factura PyME Private Sub GeneraPDFVtaPyMe(Venta As Modelos.Factura, Optional Formato As String = "PDF") - Dim Directorio1 As String = String.Format("{0}Empresas\{1}\Formatos\Factura.mrt", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) + Dim Directorio1 As String = String.Format("{0}Formatos\Factura.mrt", UsuarioActual.Empresa.Ruta) Dim File As FileInfo = New FileInfo(Directorio1) If File.Exists Then diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index 3133c92fc..0d721b704 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -709,7 +709,7 @@ Partial Class Compras_Proveedores Try Dim dr As DataRow = ObjeFacturas.DtResultados.Rows(0) - XMLDoc.Load(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & dr("CveEmpresa").ToString & "\Compras\" & dr("RFCDe").ToString & "\" & dr("XML").ToString) + XMLDoc.Load(UsuarioActual.Empresa.Ruta & "Compras\" & dr("RFCDe").ToString & "\" & dr("XML").ToString) Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3" Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) @@ -2699,7 +2699,7 @@ Partial Class Compras_Proveedores If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedor:=CveProveedor) Then If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GvEB.DataSource = ObjEventoBitacora.DtResultados diff --git a/Compras/RepComprasAFDetalle.aspx.vb b/Compras/RepComprasAFDetalle.aspx.vb index 0d78f1e74..e8de3702b 100644 --- a/Compras/RepComprasAFDetalle.aspx.vb +++ b/Compras/RepComprasAFDetalle.aspx.vb @@ -332,7 +332,7 @@ Partial Class Compras_RepComprasAFDetalle Dim ObjTareas As New ClsOIEventos Dim RutaPDF As String - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta RutaPDF = $"{Ruta}\Formatos\RepComprasAFDetalle.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas\Grales\Formatos\RepComprasAFDetalle.rdlc" diff --git a/Compras/RepCxPPeriodo.aspx.cs b/Compras/RepCxPPeriodo.aspx.cs index bd3e49f7a..5b9f2a458 100644 --- a/Compras/RepCxPPeriodo.aspx.cs +++ b/Compras/RepCxPPeriodo.aspx.cs @@ -247,7 +247,7 @@ public partial class Compras_RepCxPPeriodo : ClsPaginas StrFiltro.AppendFormat(" Registro: {0}", DdlUsuarioRegistro.SelectedItem.Text); string RutaPDF = ""; - string Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas/{UsuarioActual.CveEmpresa}/"; + string Ruta = UsuarioActual.Empresa.Ruta; RutaPDF = $"{Ruta}/Formatos/RepCxPPeriodo.rdlc"; if (!System.IO.File.Exists(RutaPDF)) { diff --git a/Compras/RepGastosFijos.aspx.cs b/Compras/RepGastosFijos.aspx.cs index 92265c1dc..2e41a8983 100644 --- a/Compras/RepGastosFijos.aspx.cs +++ b/Compras/RepGastosFijos.aspx.cs @@ -215,9 +215,9 @@ public partial class Compras_RepGastosFijos : ClsPaginas protected void ImprimiReporte(string Formato = "PDF") { string FechaInicio = DateTime.Parse(TxtFechaI.Text).ToShortDateString(); - string FechaFinal = DateTime.Parse(TxtFechaF.Text).ToShortDateString(); - - string Ruta = string.Format("{0}Empresas/{1}/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa); + string FechaFinal = DateTime.Parse(TxtFechaF.Text).ToShortDateString(); + + string Ruta = UsuarioActual.Empresa.Ruta; string RutaPDF = string.Format("{0}/Formatos/RepGastosFijos.rdlc", Ruta); if (!File.Exists(RutaPDF)) diff --git a/Compras/RepPagado.aspx.cs b/Compras/RepPagado.aspx.cs index d2faa08d1..b5dafa73c 100644 --- a/Compras/RepPagado.aspx.cs +++ b/Compras/RepPagado.aspx.cs @@ -243,7 +243,7 @@ public partial class Compras_RepPagado : ClsPaginas StrFiltro.AppendFormat(" Moneda: {0}", DdlMoneda.SelectedItem.Text); string RutaPDF = ""; - string Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas/{UsuarioActual.CveEmpresa}/"; + string Ruta = UsuarioActual.Empresa.Ruta; RutaPDF = $"{Ruta}/Formatos/RepRecuperacion.rdlc"; if (!System.IO.File.Exists(RutaPDF)) { diff --git a/Compras/RepPagadoDetalle.aspx.cs b/Compras/RepPagadoDetalle.aspx.cs index a5bded5ec..326d99ed8 100644 --- a/Compras/RepPagadoDetalle.aspx.cs +++ b/Compras/RepPagadoDetalle.aspx.cs @@ -274,7 +274,7 @@ public partial class Compras_RepPágadoDetalle : ClsPaginas StrFiltro.AppendFormat(" Moneda: {0}", DdlMoneda.SelectedItem.Text); string RutaPDF = ""; - string Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas/{UsuarioActual.CveEmpresa}/"; + string Ruta = UsuarioActual.Empresa.Ruta; RutaPDF = $"{Ruta}/Formatos/RepPagadoDetalle.rdlc"; if (!System.IO.File.Exists(RutaPDF)) { diff --git a/Compras/RepPagadoPeriodo.aspx.cs b/Compras/RepPagadoPeriodo.aspx.cs index 7de9ab3b3..c514e6827 100644 --- a/Compras/RepPagadoPeriodo.aspx.cs +++ b/Compras/RepPagadoPeriodo.aspx.cs @@ -292,7 +292,7 @@ public partial class Compras_RepPagadoPeriodo : ClsPaginas StrFiltro.AppendFormat(" Moneda: {0}", DdlMoneda.SelectedItem.Text); string RutaPDF = ""; - string Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas/{UsuarioActual.CveEmpresa}/"; + string Ruta = UsuarioActual.Empresa.Ruta; RutaPDF = $"{Ruta}/Formatos/RepPagadoPeriodo.rdlc"; if (!System.IO.File.Exists(RutaPDF)) { diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 2ee5e8db2..9b4d611c9 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -697,7 +697,7 @@ Partial Class Compras_eFacturas txtFechaF.Text = Now.ToShortDateString 'txtFechaI.Text.ToDate.AddMonths(1).AddDays(-1).ToShortDateString - Destino = String.Format("{0}Compras\", UsuarioActual.Empresa.Ruta) 'string.format("{0}Empresas\{1}\Compras\", ModExtensiones.DirectorioBaseEmpresas ,UsuarioActual.CveEmpresa & "\Compras\" + Destino = String.Format("{0}Compras\", UsuarioActual.Empresa.Ruta) Ejecutable = "C:\Proyectos\wwwSIG\Utilerias\ADSUtilerias.exe" Form.DefaultButton = BtnConsultar.UniqueID @@ -1300,7 +1300,7 @@ Partial Class Compras_eFacturas End Sub Protected Sub LnkNoRecibidas_Click(sender As Object, e As EventArgs, Optional ValidaRowCount As Boolean = False) Handles LnkNoRecibias.Click Dim DtNoRecibidas As New DataTable - Dim Ruta As String = String.Format("{0}\Empresas\{1}\Compras\NoRecibidas-{1}.xml", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) + Dim Ruta As String = String.Format("{0}Compras\NoRecibidas-{1}.xml", UsuarioActual.Empresa.Ruta, UsuarioActual.CveEmpresa) Dim Str As New StringBuilder If IO.File.Exists(Ruta) Then DtNoRecibidas.ReadXml(Ruta) @@ -1428,7 +1428,8 @@ Partial Class Compras_eFacturas If filemove <> "" Then 'filemove.FilesMove("", String.Format("{0}\Temp\Facturas", UsuarioActual.Empresa.Ruta)) - filemove.FilesMove("", String.Format("Empresas\{0}\Temp\Facturas", UsuarioActual.CveEmpresa)) + 'filemove.FilesMove("", String.Format("Empresas\{0}\Temp\Facturas", UsuarioActual.CveEmpresa)) + filemove.FilesMove("", String.Format("{0}Temp\Facturas", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) 'AGREGA XML A LA LISTA If FileExtension.ToUpper = "XML" Or FileExtension.ToUpper = "PDF" Then ListXML.Add(String.Format("{0}Temp\Facturas\{1}", UsuarioActual.Empresa.Ruta, filemove)) @@ -1438,7 +1439,7 @@ Partial Class Compras_eFacturas Next - Dim fileEntries As String() = Directory.GetFiles(String.Format("{0}Empresas\{1}\Temp\Facturas", Extensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) + Dim fileEntries As String() = Directory.GetFiles(String.Format("{0}Temp\Facturas", UsuarioActual.Empresa.Ruta)) Dim ListaDirectoriosTemporales As New List(Of String) Dim ListaComprimidos As New List(Of String) @@ -1454,7 +1455,7 @@ Partial Class Compras_eFacturas ListaComprimidos.Add(filePath) 'CREO DIRECTORIO ALEATORIO Dim Aleatorio As New Random - Dim TempDirectorio As String = String.Format("{0}\{1}\{2}{3}", UsuarioActual.Empresa.Ruta, "Temp\Facturas", Date.Now.Ticks, Aleatorio.Next(100, 999)) + Dim TempDirectorio As String = String.Format("{0}{1}\{2}{3}", UsuarioActual.Empresa.Ruta, "Temp\Facturas", Date.Now.Ticks, Aleatorio.Next(100, 999)) Directory.CreateDirectory(TempDirectorio) ListaDirectoriosTemporales.Add(TempDirectorio) 'AGREGA DIRECTORIO A LA LISTA @@ -1749,7 +1750,7 @@ Partial Class Compras_eFacturas DirectoryExistsCreate(String.Format("{0}Compras\{1}", UsuarioActual.Empresa.Ruta, RFC.ToUpper)) Try - File.Move(PathArchivo, String.Format("{0}Empresas\{1}\Compras\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, RFC.ToUpper, NombreArchivo)) + File.Move(PathArchivo, String.Format("{0}Compras\{1}\{2}", UsuarioActual.Empresa.Ruta, RFC.ToUpper, NombreArchivo)) Catch ex As Exception Alert("Error") End Try @@ -2787,7 +2788,7 @@ Partial Class Compras_eFacturas XMLNodosPagosModalCount = 0 Dim XMLDoc As New XmlDocument - Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML")) + Dim Archivo As String = String.Format("{0}Compras\{2}\{3}", UsuarioActual.Empresa.Ruta, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML")) If IO.File.Exists(Archivo) Then @@ -3669,7 +3670,7 @@ Partial Class Compras_eFacturas Dim strRFCde As String = gvrow.DataKey("RFCde") Dim strXml As String Dim strPDF As String - Dim dirbase As String = String.Format("{0}{1}{2}{3}{4}\", ModExtensiones.DirectorioBaseEmpresas, "\Empresas\", UsuarioActual.CveEmpresa, "\Compras\", strRFCde) + Dim dirbase As String = String.Format("{0}{1}{2}\", UsuarioActual.Empresa.Ruta, "Compras\", strRFCde) If Directory.Exists(dirbase) Then strXml = String.Format("{0}{1}", dirbase, gvrow.DataKey("XML")) strPDF = String.Format("{0}{1}", dirbase, gvrow.DataKey("PDF")) @@ -3704,7 +3705,7 @@ Partial Class Compras_eFacturas Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim strRFCde As String = gvrow.DataKey("RFCde") Dim strPDF As String - Dim dirbase As String = String.Format("{0}{1}{2}{3}{4}\", ModExtensiones.DirectorioBaseEmpresas, "\Empresas\", UsuarioActual.CveEmpresa, "\Compras\", strRFCde) + Dim dirbase As String = String.Format("{0}{1}{2}\", UsuarioActual.Empresa.Ruta, "Compras\", strRFCde) strPDF = String.Format("{0}{1}", dirbase, gvrow.DataKey("PDF")) If File.Exists(strPDF) Then Dim file As New System.IO.FileInfo(strPDF) @@ -3728,7 +3729,7 @@ Partial Class Compras_eFacturas Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim strRFCde As String = gvrow.DataKey("RFCde") Dim strXml As String - Dim dirbase As String = String.Format("{0}{1}{2}{3}{4}\", ModExtensiones.DirectorioBaseEmpresas, "\Empresas\", UsuarioActual.CveEmpresa, "\Compras\", strRFCde) + Dim dirbase As String = String.Format("{0}{1}{2}\", UsuarioActual.Empresa.Ruta, "Compras\", strRFCde) strXml = String.Format("{0}{1}", dirbase, gvrow.DataKey("XML")) If File.Exists(strXml) Then Dim file As New System.IO.FileInfo(strXml) @@ -3949,7 +3950,7 @@ Partial Class Compras_eFacturas Dim XMLDoc As New XmlDocument - Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML")) + Dim Archivo As String = String.Format("{0}Compras\{1}\{2}", UsuarioActual.Empresa.Ruta, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML")) If IO.File.Exists(Archivo) Then diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb index 91bf2e427..8630e7aa5 100644 --- a/Contabilidad/RegPrePoliza.aspx.vb +++ b/Contabilidad/RegPrePoliza.aspx.vb @@ -2359,10 +2359,7 @@ Partial Class ContabilidadC_RegPrePoliza Dim Path As String = HttpContext.Current.Request.ApplicationPath Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Path = Extensiones.DirectorioBaseEmpresas - Path += String.Format("Empresas/{0}/IE", UsuarioActual.CveEmpresa) - - + Path = String.Format("{0}IE", UsuarioActual.Empresa.Ruta) If Not Directory.Exists(Path) Then Directory.CreateDirectory(Path) diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb index 67b1f65e6..02127071e 100644 --- a/Contratos/Contrato.aspx.vb +++ b/Contratos/Contrato.aspx.vb @@ -1304,10 +1304,10 @@ Partial Class Contratos_Default 'Renombrar archivo If ViewState("extencion") IsNot Nothing Then If ViewState("FUrl").ToString.Length > 0 AndAlso ViewState("extencion").ToString.Length > 0 Then - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") Then - Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Contratos") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Contratos") End If - Ruta = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" + Ruta = UsuarioActual.Empresa.Ruta & "Contratos\" 'ViewState("extencion") = FileExtension 'ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", "Temp", ViewState("FName").ToString) @@ -1420,10 +1420,10 @@ Partial Class Contratos_Default If ViewState("extencion") IsNot Nothing Then If ViewState("FUrl").ToString.Length > 0 AndAlso ViewState("extencion").ToString.Length > 0 Then - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") Then - Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Contratos") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Contratos") End If - Ruta = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" + Ruta = UsuarioActual.Empresa.Ruta & "Contratos\" Try If File.Exists(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) Then @@ -3248,7 +3248,7 @@ Partial Class Contratos_Default If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If cargarBitacora() diff --git a/Contratos/Contrato.vb b/Contratos/Contrato.vb index 07fb55a52..385377c09 100644 --- a/Contratos/Contrato.vb +++ b/Contratos/Contrato.vb @@ -597,10 +597,10 @@ Partial Class Contratos_Default 'Renombrar archivo If ViewState("extencion") IsNot Nothing Then If ViewState("FUrl").ToString.Length > 0 AndAlso ViewState("extencion").ToString.Length > 0 Then - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") Then - Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Contratos") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Contratos") End If - Ruta = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" + Ruta = UsuarioActual.Empresa.Ruta & "Contratos\" 'ViewState("extencion") = FileExtension 'ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", "Temp", ViewState("FName").ToString) @@ -643,10 +643,10 @@ Partial Class Contratos_Default If ViewState("extencion") IsNot Nothing Then If ViewState("FUrl").ToString.Length > 0 AndAlso ViewState("extencion").ToString.Length > 0 Then - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") Then - Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Contratos") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Contratos") End If - Ruta = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" + Ruta = UsuarioActual.Empresa.Ruta & "Contratos\" Try If File.Exists(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) Then @@ -1462,7 +1462,7 @@ Partial Class Contratos_Default If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If cargarBitacora() diff --git a/Contratos/ContratoAvance.aspx.vb b/Contratos/ContratoAvance.aspx.vb index c462ab589..d26ba7cc4 100644 --- a/Contratos/ContratoAvance.aspx.vb +++ b/Contratos/ContratoAvance.aspx.vb @@ -361,10 +361,10 @@ Partial Class Contratos_ContratoAvance Alert("No se logro guardar el Presupuesto favor de intentarlo mas tarde o comuniquese con soporte", TipoMensaje.MsgAdvertencia) Else - Dim urlsave As String = String.Format("Empresas\{0}\Contrato\{1}\Anexos", UsuarioActual.CveEmpresa, CveContrato) + Dim urlsave As String = String.Format("{0}Contrato\{1}\Anexos", UsuarioActual.Empresa.Ruta, CveContrato) For Each fileItem As Archivo In guardarArchivos - fileItem.filename.FilesMove(fileItem.filename.Replace($".{fileItem.Extension}", ""), urlsave) + fileItem.filename.FilesMove(fileItem.filename.Replace($".{fileItem.Extension}", ""), urlsave, ConcatenarDirectorioBase:=False) Next @@ -426,9 +426,9 @@ Partial Class Contratos_ContratoAvance Alert("No se logro guardar el Presupuesto favor de intentarlo mas tarde o comuniquese con soporte", TipoMensaje.MsgAdvertencia) Else - Dim urlsave As String = String.Format("Empresas\{0}\Contrato\{1}\Anexos", UsuarioActual.CveEmpresa, CveContrato) + Dim urlsave As String = String.Format("{0}Contrato\{1}\Anexos", UsuarioActual.Empresa.Ruta, CveContrato) For Each fileItem As Archivo In guardarArchivos - fileItem.filename.FilesMove(fileItem.filename.Replace($".{fileItem.Extension}", ""), urlsave) + fileItem.filename.FilesMove(fileItem.filename.Replace($".{fileItem.Extension}", ""), urlsave, ConcatenarDirectorioBase:=False) Next ObjContratos.Commit() diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index 7b926f413..c8a3abb3b 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -1,435 +1,435 @@ -Option Explicit On -Option Strict On - -Imports Extensiones -Imports System.IO -Imports System.Data -Imports Microsoft.Reporting.WebForms -Imports System.Globalization -Imports GemBox.Spreadsheet - -Partial Class Contratos_ContratoObra +Option Explicit On +Option Strict On + +Imports Extensiones +Imports System.IO +Imports System.Data +Imports Microsoft.Reporting.WebForms +Imports System.Globalization +Imports GemBox.Spreadsheet + +Partial Class Contratos_ContratoObra Inherits ClsPaginas -#Region " PROPIEDADES " - Private Property CveContrato As Integer - Get - If ViewState("CveContrato") Is Nothing Then - Return 0 - Else - Return ViewState("CveContrato").ToString.ToEntero - End If - - End Get - Set(value As Integer) - ViewState("CveContrato") = value - End Set - End Property - Private Property CveTipoContrato As Integer - Get - If ViewState("CveTipoContrato") Is Nothing Then - Return 0 - Else - Return ViewState("CveTipoContrato").ToString.ToEntero - End If - - End Get - Set(value As Integer) - ViewState("CveTipoContrato") = value - End Set - End Property - Private Property CveMovimiento As Integer - Get - Return ViewState("CveMovimiento").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveMovimiento") = value - End Set - End Property - Private Property CveMovimientoDevolucion As Integer - Get - Return ViewState("CveMovimientoDevolucion").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveMovimientoDevolucion") = value - End Set - End Property - - Private Property FolioSugerido As String - Get - Return ViewState("FolioSugerido").ToString - End Get - Set(value As String) - ViewState("FolioSugerido") = value - End Set - End Property - - Private Property CveVenta As Integer - Get - Return ViewState("CveVenta").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveVenta") = value - End Set - End Property - Public Property Autorizado As Boolean - Get - Return DirectCast(ViewState("Autorizado"), Boolean) - End Get - Set(value As Boolean) - ViewState("Autorizado") = value - End Set - End Property - Private Property ArchivoUpdate As String - Get - Return ViewState("ArchivoUpdate").ToString - End Get - Set(value As String) - ViewState("ArchivoUpdate") = value - End Set - End Property - Private Property TipoContrato As Integer - Get - Return ViewState("TipoContrato").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("TipoContrato") = value - End Set - End Property - Private Property DtDatos As DataTable - Get - Return CType(ViewState("DtDatos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtDatos") = value - End Set - End Property - Private Property DtPlantillasContratos As DataTable - Get - Return CType(ViewState("DtPlantillasContratos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtPlantillasContratos") = value - End Set - End Property - Private Property DtPeriodo As DataTable - Get - Return CType(ViewState("DtPeriodo"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtPeriodo") = value - End Set - End Property - 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 ModalidadDetalle As Integer - Get - Return DirectCast(ViewState(" ModalidadDetalle"), Integer) - End Get - Set(value As Integer) - ViewState(" ModalidadDetalle") = value - End Set - End Property - Public Property DtMovimientos() As DataTable - Get - Return CType(ViewState("DtMovimientos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtMovimientos") = value - End Set - End Property - - Public Property DtGastos() As DataTable - Get - Return CType(ViewState("DtGastos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtGastos") = value - End Set - End Property - - Public Property DtSuministros() As DataTable - Get - Return CType(ViewState("DtSuministros"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtSuministros") = value - End Set - End Property - Public Property DtAvance() As DataTable - Get - Return CType(ViewState("DtAvance"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtAvance") = value - End Set - End Property - - - Public Property DtPresupuestos() As DataTable - Get - Return CType(ViewState("DtPresupuestos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtPresupuestos") = value - End Set - End Property - Private Property FechaI As DateTime - Get - Return CType(ViewState("FechaI"), DateTime) - End Get - Set(value As DateTime) - ViewState("FechaI") = value - End Set - End Property - - Private Property FechaF As DateTime - Get - Return CType(ViewState("FechaF"), DateTime) - End Get - Set(value As DateTime) - ViewState("FechaF") = value - End Set - End Property - - Public Property DtActivosFijos() As DataTable - Get - Return CType(ViewState("DtActivosFijos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtActivosFijos") = value - End Set - End Property - - Private Property CvePSSerieLote As Integer - Get - Return CType(ViewState("CvePSSerieLote"), Integer) - End Get - Set(value As Integer) - ViewState("CvePSSerieLote") = value - End Set - End Property - Private Property CveUMSerieLote As Integer - Get - Return CType(ViewState("CveUMSerieLote"), Integer) - End Get - Set(value As Integer) - ViewState("CveUMSerieLote") = value - End Set - End Property - Private Property DtAvanceDocumento As DataTable - Get - Return CType(ViewState("DtAvanceDocumento"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtAvanceDocumento") = value - End Set - End Property - Private Property Titulo As String - Get - Return ViewState("Titulo").ToString - End Get - Set(value As String) - ViewState("Titulo") = value - End Set - End Property - Private Property TituloCorto As String - Get - Return ViewState("TituloCorto").ToString - End Get - Set(value As String) - ViewState("TituloCorto") = value - End Set - End Property - - Private Property TipoDocumento As String - Get - Return ViewState("TipoDocumento").ToString - End Get - Set(value As String) - ViewState("TipoDocumento") = value - End Set - End Property - - Private Property Contratante As String - Get - Return ViewState("Contratante").ToString - End Get - Set(value As String) - ViewState("Contratante") = value - End Set - End Property - Private Property SumaAvance As Double - Get - Return If(ViewState("SumaAvance") IsNot Nothing, ViewState("SumaAvance").ToString.ToDouble, 0) - End Get - Set(value As Double) - ViewState("SumaAvance") = value - End Set - End Property - Private Property SumaUtilidad As Double - Get - Return If(ViewState("SumaUtilidad") IsNot Nothing, ViewState("SumaUtilidad").ToString.ToDouble, 0) - End Get - Set(value As Double) - ViewState("SumaUtilidad") = value - End Set - End Property - Private Property SumaGasto As Double - Get - Return If(ViewState("SumaGasto") IsNot Nothing, ViewState("SumaGasto").ToString.ToDouble, 0) - End Get - Set(value As Double) - ViewState("SumaGasto") = value - End Set - End Property - Private Property NumRow As Integer - - Private Property EsEditarFianza As Boolean - Get - Return CType(ViewState("EsEditarFianza"), Boolean) - End Get - Set(value As Boolean) - ViewState("EsEditarFianza") = value - End Set - End Property - Private Property IndexFianzaEditar As Integer - Get - Return CType(ViewState("IndexFianzaEditar"), Integer) - End Get - Set(value As Integer) - ViewState("IndexFianzaEditar") = value - End Set - End Property - Public Property DtTmpFianzas() As DataTable - Get - Return CType(ViewState("DtTmpFianzas"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtTmpFianzas") = value - End Set - End Property - Public Property DtTmpFianzasInicial() As DataTable - Get - Return CType(ViewState("DtTmpFianzasInicial"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtTmpFianzasInicial") = value - End Set - End Property - Private Property MensajeAlert As StringBuilder - Get - Return CType(ViewState("MensajeAlert"), StringBuilder) - End Get - Set(value As StringBuilder) - ViewState("MensajeAlert") = value - End Set - End Property - Private Property DsDatosPedDev As DataSet - Get - DsDatosPedDev = DirectCast(ViewState("DsDatosPedDev"), DataSet) - End Get - - Set(ByVal value As DataSet) - ViewState("DsDatosPedDev") = value - End Set +#Region " PROPIEDADES " + Private Property CveContrato As Integer + Get + If ViewState("CveContrato") Is Nothing Then + Return 0 + Else + Return ViewState("CveContrato").ToString.ToEntero + End If + + End Get + Set(value As Integer) + ViewState("CveContrato") = value + End Set + End Property + Private Property CveTipoContrato As Integer + Get + If ViewState("CveTipoContrato") Is Nothing Then + Return 0 + Else + Return ViewState("CveTipoContrato").ToString.ToEntero + End If + + End Get + Set(value As Integer) + ViewState("CveTipoContrato") = value + End Set + End Property + Private Property CveMovimiento As Integer + Get + Return ViewState("CveMovimiento").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveMovimiento") = value + End Set + End Property + Private Property CveMovimientoDevolucion As Integer + Get + Return ViewState("CveMovimientoDevolucion").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveMovimientoDevolucion") = value + End Set End Property - Private Property CveSubProyecto As Integer - Get - + Private Property FolioSugerido As String + Get + Return ViewState("FolioSugerido").ToString + End Get + Set(value As String) + ViewState("FolioSugerido") = value + End Set + End Property + + Private Property CveVenta As Integer + Get + Return ViewState("CveVenta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveVenta") = value + End Set + End Property + Public Property Autorizado As Boolean + Get + Return DirectCast(ViewState("Autorizado"), Boolean) + End Get + Set(value As Boolean) + ViewState("Autorizado") = value + End Set + End Property + Private Property ArchivoUpdate As String + Get + Return ViewState("ArchivoUpdate").ToString + End Get + Set(value As String) + ViewState("ArchivoUpdate") = value + End Set + End Property + Private Property TipoContrato As Integer + Get + Return ViewState("TipoContrato").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("TipoContrato") = value + End Set + End Property + Private Property DtDatos As DataTable + Get + Return CType(ViewState("DtDatos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtDatos") = value + End Set + End Property + Private Property DtPlantillasContratos As DataTable + Get + Return CType(ViewState("DtPlantillasContratos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtPlantillasContratos") = value + End Set + End Property + Private Property DtPeriodo As DataTable + Get + Return CType(ViewState("DtPeriodo"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtPeriodo") = value + End Set + End Property + 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 ModalidadDetalle As Integer + Get + Return DirectCast(ViewState(" ModalidadDetalle"), Integer) + End Get + Set(value As Integer) + ViewState(" ModalidadDetalle") = value + End Set + End Property + Public Property DtMovimientos() As DataTable + Get + Return CType(ViewState("DtMovimientos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMovimientos") = value + End Set + End Property + + Public Property DtGastos() As DataTable + Get + Return CType(ViewState("DtGastos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtGastos") = value + End Set + End Property + + Public Property DtSuministros() As DataTable + Get + Return CType(ViewState("DtSuministros"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtSuministros") = value + End Set + End Property + Public Property DtAvance() As DataTable + Get + Return CType(ViewState("DtAvance"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtAvance") = value + End Set + End Property + + + Public Property DtPresupuestos() As DataTable + Get + Return CType(ViewState("DtPresupuestos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtPresupuestos") = value + End Set + End Property + Private Property FechaI As DateTime + Get + Return CType(ViewState("FechaI"), DateTime) + End Get + Set(value As DateTime) + ViewState("FechaI") = value + End Set + End Property + + Private Property FechaF As DateTime + Get + Return CType(ViewState("FechaF"), DateTime) + End Get + Set(value As DateTime) + ViewState("FechaF") = value + End Set + End Property + + Public Property DtActivosFijos() As DataTable + Get + Return CType(ViewState("DtActivosFijos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtActivosFijos") = value + End Set + End Property + + Private Property CvePSSerieLote As Integer + Get + Return CType(ViewState("CvePSSerieLote"), Integer) + End Get + Set(value As Integer) + ViewState("CvePSSerieLote") = value + End Set + End Property + Private Property CveUMSerieLote As Integer + Get + Return CType(ViewState("CveUMSerieLote"), Integer) + End Get + Set(value As Integer) + ViewState("CveUMSerieLote") = value + End Set + End Property + Private Property DtAvanceDocumento As DataTable + Get + Return CType(ViewState("DtAvanceDocumento"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtAvanceDocumento") = value + End Set + End Property + Private Property Titulo As String + Get + Return ViewState("Titulo").ToString + End Get + Set(value As String) + ViewState("Titulo") = value + End Set + End Property + Private Property TituloCorto As String + Get + Return ViewState("TituloCorto").ToString + End Get + Set(value As String) + ViewState("TituloCorto") = value + End Set + End Property + + Private Property TipoDocumento As String + Get + Return ViewState("TipoDocumento").ToString + End Get + Set(value As String) + ViewState("TipoDocumento") = value + End Set + End Property + + Private Property Contratante As String + Get + Return ViewState("Contratante").ToString + End Get + Set(value As String) + ViewState("Contratante") = value + End Set + End Property + Private Property SumaAvance As Double + Get + Return If(ViewState("SumaAvance") IsNot Nothing, ViewState("SumaAvance").ToString.ToDouble, 0) + End Get + Set(value As Double) + ViewState("SumaAvance") = value + End Set + End Property + Private Property SumaUtilidad As Double + Get + Return If(ViewState("SumaUtilidad") IsNot Nothing, ViewState("SumaUtilidad").ToString.ToDouble, 0) + End Get + Set(value As Double) + ViewState("SumaUtilidad") = value + End Set + End Property + Private Property SumaGasto As Double + Get + Return If(ViewState("SumaGasto") IsNot Nothing, ViewState("SumaGasto").ToString.ToDouble, 0) + End Get + Set(value As Double) + ViewState("SumaGasto") = value + End Set + End Property + Private Property NumRow As Integer + + Private Property EsEditarFianza As Boolean + Get + Return CType(ViewState("EsEditarFianza"), Boolean) + End Get + Set(value As Boolean) + ViewState("EsEditarFianza") = value + End Set + End Property + Private Property IndexFianzaEditar As Integer + Get + Return CType(ViewState("IndexFianzaEditar"), Integer) + End Get + Set(value As Integer) + ViewState("IndexFianzaEditar") = value + End Set + End Property + Public Property DtTmpFianzas() As DataTable + Get + Return CType(ViewState("DtTmpFianzas"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtTmpFianzas") = value + End Set + End Property + Public Property DtTmpFianzasInicial() As DataTable + Get + Return CType(ViewState("DtTmpFianzasInicial"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtTmpFianzasInicial") = value + End Set + End Property + Private Property MensajeAlert As StringBuilder + Get + Return CType(ViewState("MensajeAlert"), StringBuilder) + End Get + Set(value As StringBuilder) + ViewState("MensajeAlert") = value + End Set + End Property + Private Property DsDatosPedDev As DataSet + Get + DsDatosPedDev = DirectCast(ViewState("DsDatosPedDev"), DataSet) + End Get + + Set(ByVal value As DataSet) + ViewState("DsDatosPedDev") = value + End Set + End Property + + Private Property CveSubProyecto As Integer + Get + If ViewState("CveSubProyecto") Is Nothing Then Return -1 Else Return CType(ViewState("CveSubProyecto"), Integer) End If - End Get - Set(value As Integer) - ViewState("CveSubProyecto") = value + End Get + Set(value As Integer) + ViewState("CveSubProyecto") = value End Set End Property - Property TotalAvanceVentas As Decimal - Get - + Property TotalAvanceVentas As Decimal + Get + If ViewState("TotalAvanceVentas") Is Nothing Then Return 0D Else Return ViewState("TotalAvanceVentas").ToString.ToDecimal End If - End Get - Set(value As Decimal) - ViewState("TotalAvanceVentas") = value + End Get + Set(value As Decimal) + ViewState("TotalAvanceVentas") = value End Set End Property - Property TotalAvanceInterno As Decimal - Get - + Property TotalAvanceInterno As Decimal + Get + If ViewState("TotalAvanceInterno") Is Nothing Then Return 0D Else Return ViewState("TotalAvanceInterno").ToString.ToDecimal End If - End Get - Set(value As Decimal) - ViewState("TotalAvanceInterno") = value + End Get + Set(value As Decimal) + ViewState("TotalAvanceInterno") = value End Set End Property -#End Region +#End Region - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - CargaValoresIniciales() + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaValoresIniciales() CreaDtTmpFianzas() cargaClientes() - If Request("CveContrato") IsNot Nothing AndAlso IsNumeric(Request("CveContrato")) AndAlso Request("CveContrato").ToEntero > 0 Then - ViewState("CveContrato") = Request("CveContrato") - - DvBitacora.Visible = True - DdlEstatus.Enabled = False - If UsuarioActual.TienePermisoProceso(126) Then - BtnAutorizar.Visible = True - End If - DivContent.Visible = True - ' DivTipoContrato.Visible = False - 'TxtArchivo.Visible = True - - CargaDatos() - - CargaDatosAvance() - CargaDatosAvancePorDocumento() - CargaInventarios() - - '12/04/2018 - Si el tipo de contrato es convenio de precio fijo configura campos - If CveTipoContrato = 28 Then - CargaConvenioPrecioFijo() - End If - - 'Configuración de Modalidad Update - BtnGuardar.Text = "Guardar Cambios" - - If Request("Opt") IsNot Nothing AndAlso IsNumeric(Request("Opt")) Then Tab.ActiveTabIndex = Request("Opt").ToEntero - + If Request("CveContrato") IsNot Nothing AndAlso IsNumeric(Request("CveContrato")) AndAlso Request("CveContrato").ToEntero > 0 Then + ViewState("CveContrato") = Request("CveContrato") + + DvBitacora.Visible = True + DdlEstatus.Enabled = False + If UsuarioActual.TienePermisoProceso(126) Then + BtnAutorizar.Visible = True + End If + DivContent.Visible = True + ' DivTipoContrato.Visible = False + 'TxtArchivo.Visible = True + + CargaDatos() + + CargaDatosAvance() + CargaDatosAvancePorDocumento() + CargaInventarios() + + '12/04/2018 - Si el tipo de contrato es convenio de precio fijo configura campos + If CveTipoContrato = 28 Then + CargaConvenioPrecioFijo() + End If + + 'Configuración de Modalidad Update + BtnGuardar.Text = "Guardar Cambios" + + If Request("Opt") IsNot Nothing AndAlso IsNumeric(Request("Opt")) Then Tab.ActiveTabIndex = Request("Opt").ToEntero + If CveContrato > 0 Then LnkModalAddPSVentas.Visible = True @@ -438,10 +438,10 @@ Partial Class Contratos_ContratoObra LnkModalAddPresupuestoControl.Visible = True LnkModalAddMaquinariaFlotilla.Visible = True - End If - - CargaEstadoCuenta() - + End If + + CargaEstadoCuenta() + TabEstadoCuenta.Visible = True @@ -454,524 +454,524 @@ Partial Class Contratos_ContratoObra Indicadores() - Else - 'Configuración de Modalidad Insert - LblFechaCaptura.Text = Now.ToShortDateString() - LblUsuarioCapturo.Text = UsuarioActual.Usuario - ViewState("CveContrato") = -1 - - DvBitacora.Visible = False - TabContratosGastos.Visible = False - TabAF.Visible = False - TabReporteAvance.Visible = False - TabAvanveDocumento.Visible = False - + Else + 'Configuración de Modalidad Insert + LblFechaCaptura.Text = Now.ToShortDateString() + LblUsuarioCapturo.Text = UsuarioActual.Usuario + ViewState("CveContrato") = -1 + + DvBitacora.Visible = False + TabContratosGastos.Visible = False + TabAF.Visible = False + TabReporteAvance.Visible = False + TabAvanveDocumento.Visible = False + TAB.ActiveTabIndex = 0 - End If - - 'carga combos - CargaClasificaciones() - CargaPS() - CargaPSInsumos() - ConfiguraTipos() + End If + + 'carga combos + CargaClasificaciones() + CargaPS() + CargaPSInsumos() + ConfiguraTipos() 'CargaDatosEncabezado() CargaDLLCargaGVCentrosConsto() tabalCentrosdecotso() - End If - - - '[IPP] PORQUE ESTA TODO ESTO EN TODOS LOS POSTBACK ??? - REVISEN BIEN DONDE PONEN EL CODIGO - - If UsuarioActual.TienePermisoProceso(165) Then - BtnGuardar.Visible = True - Else - BtnGuardar.Visible = False - End If - - If CveContrato > 0 Then - If UsuarioActual.TienePermisoProceso(164) Then - BtnEliminar.Visible = True - Gv.Columns(7).Visible = True - GvInsumos.Columns(7).Visible = True - Else - BtnEliminar.Visible = False - Gv.Columns(7).Visible = False - GvInsumos.Columns(7).Visible = False + End If + + + '[IPP] PORQUE ESTA TODO ESTO EN TODOS LOS POSTBACK ??? - REVISEN BIEN DONDE PONEN EL CODIGO + + If UsuarioActual.TienePermisoProceso(165) Then + BtnGuardar.Visible = True + Else + BtnGuardar.Visible = False + End If + + If CveContrato > 0 Then + If UsuarioActual.TienePermisoProceso(164) Then + BtnEliminar.Visible = True + Gv.Columns(7).Visible = True + GvInsumos.Columns(7).Visible = True + Else + BtnEliminar.Visible = False + Gv.Columns(7).Visible = False + GvInsumos.Columns(7).Visible = False End If - Else - TabPres.Visible = False - Gv.Columns(7).Visible = True - GvInsumos.Columns(7).Visible = True - - End If - - + Else + TabPres.Visible = False + Gv.Columns(7).Visible = True + GvInsumos.Columns(7).Visible = True + + End If + + TabAvanveDocumento.Visible = False TabContratosGastos.Visible = False TabPed.Visible = False End Sub -#Region " CARGA VALORES INICIALES " - Private Sub CargaValoresIniciales() - CveContrato = -1 - ViewState("TipoContrato") = 0 - CveVenta = -1 - Autorizado = False - BtnAutorizar.Visible = False - Session("FileUpload") = "" - Session("FileExtension") = "" - Session("FileFolder") = "" - ArchivoUpdate = "" - ModalidadDetalle = 1 - FolioSugerido = "" - - CargaProyecto() +#Region " CARGA VALORES INICIALES " + Private Sub CargaValoresIniciales() + CveContrato = -1 + ViewState("TipoContrato") = 0 + CveVenta = -1 + Autorizado = False + BtnAutorizar.Visible = False + Session("FileUpload") = "" + Session("FileExtension") = "" + Session("FileFolder") = "" + ArchivoUpdate = "" + ModalidadDetalle = 1 + FolioSugerido = "" + + CargaProyecto() CargaContratista() - DdlUM.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) - DdlUM.DataBind() - DdlMoneda.DataSource = GlobalDTMonedas + DdlUM.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) + DdlUM.DataBind() + DdlMoneda.DataSource = GlobalDTMonedas DdlMoneda.DataBind() - CargaContratosEstatus() + CargaContratosEstatus() CreaDT() - If UsuarioActual.CveEmpresa.Contiene(72, 80) Then divResponsable.Visible = False - + If UsuarioActual.CveEmpresa.Contiene(72, 80) Then divResponsable.Visible = False + End Sub - Protected Sub DdlMoneda_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMoneda.SelectedIndexChanged - - If DdlMoneda.SelectedIndex = 0 Then - tipoCambio.Visible = False - TxtTipoCambio.Text = "" - UpGral.Update() - Else - tipoCambio.Visible = True - TxtTipoCambio.Text = "" - UpGral.Update() - End If - End Sub - Public Function isWithFamily() As Boolean - Return UsuarioActual.CveEmpresa = 66 + Protected Sub DdlMoneda_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMoneda.SelectedIndexChanged + + If DdlMoneda.SelectedIndex = 0 Then + tipoCambio.Visible = False + TxtTipoCambio.Text = "" + UpGral.Update() + Else + tipoCambio.Visible = True + TxtTipoCambio.Text = "" + UpGral.Update() + End If + End Sub + Public Function isWithFamily() As Boolean + Return UsuarioActual.CveEmpresa = 66 End Function Private Sub cargaClientes() DdlCliente.setEsWebService(True) - DdlCliente.Attributes.Add("data-metodo", "getcliente") - End Sub - - Private Sub CreaDT() - TmpDT = New DataTable - TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) - TmpDT.Columns.Add("Cantidad", GetType(Double)) - TmpDT.Columns.Add("CantidadContratada", GetType(Double)) - 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("CodigoPS", GetType(String)) - TmpDT.Columns.Add("PU", GetType(Double)) - TmpDT.Columns.Add("Total", GetType(Double)) - TmpDT.Columns.Add("CveTipoPresupuesto", GetType(Integer)) - TmpDT.Columns.Add("PermitirAvance", GetType(Integer)) - TmpDT.Columns.Add("PermitirEstimacion", GetType(Integer)) - TmpDT.Columns.Add("UsuarioAvance", GetType(Integer)) - TmpDT.Columns.Add("Cantidad_Original", GetType(Double)) - TmpDT.Columns.Add("PU_Original", GetType(Double)) - TmpDT.Columns.Add("Total_Original", GetType(Double)) - TmpDT.Columns.Add("NoIdentificacion", GetType(String)) - TmpDT.Columns.Add("LimitarCantidad", GetType(Integer)) - TmpDT.Columns.Add("OCInterna", GetType(String)) + DdlCliente.Attributes.Add("data-metodo", "getcliente") + End Sub + + Private Sub CreaDT() + TmpDT = New DataTable + TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) + TmpDT.Columns.Add("Cantidad", GetType(Double)) + TmpDT.Columns.Add("CantidadContratada", GetType(Double)) + 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("CodigoPS", GetType(String)) + TmpDT.Columns.Add("PU", GetType(Double)) + TmpDT.Columns.Add("Total", GetType(Double)) + TmpDT.Columns.Add("CveTipoPresupuesto", GetType(Integer)) + TmpDT.Columns.Add("PermitirAvance", GetType(Integer)) + TmpDT.Columns.Add("PermitirEstimacion", GetType(Integer)) + TmpDT.Columns.Add("UsuarioAvance", GetType(Integer)) + TmpDT.Columns.Add("Cantidad_Original", GetType(Double)) + TmpDT.Columns.Add("PU_Original", GetType(Double)) + TmpDT.Columns.Add("Total_Original", GetType(Double)) + TmpDT.Columns.Add("NoIdentificacion", GetType(String)) + TmpDT.Columns.Add("LimitarCantidad", GetType(Integer)) + TmpDT.Columns.Add("OCInterna", GetType(String)) TmpDT.Columns.Add("Observacion", GetType(String)) - TmpDT.Columns.Add("CveRubro", GetType(Integer)) - TmpDT.Columns.Add("CveActividad", GetType(Integer)) - TmpDT.Columns.Add("CveSubTipoActivoFijo", GetType(Integer)) - - TmpDT.Columns.Add("Rubro", GetType(String)) - TmpDT.Columns.Add("Actividad", GetType(String)) + TmpDT.Columns.Add("CveRubro", GetType(Integer)) + TmpDT.Columns.Add("CveActividad", GetType(Integer)) + TmpDT.Columns.Add("CveSubTipoActivoFijo", GetType(Integer)) + + TmpDT.Columns.Add("Rubro", GetType(String)) + TmpDT.Columns.Add("Actividad", GetType(String)) TmpDT.Columns.Add("SubTipoActivoFijo", GetType(String)) TmpDT.Columns.Add("Dias", GetType(Integer)) - End Sub - Protected Sub Limpiar() - TxtNumeroContrato.Text = "" - TxtDescripcionContrato.Text = "" - DdlContratista.SelectedValue = "-1" - DdlCliente.SelectedValue = "-1" - TxtFechaInicial.Text = "" - TxtFechaFinal.Text = "" + End Sub + Protected Sub Limpiar() + TxtNumeroContrato.Text = "" + TxtDescripcionContrato.Text = "" + DdlContratista.SelectedValue = "-1" + DdlCliente.SelectedValue = "-1" + TxtFechaInicial.Text = "" + TxtFechaFinal.Text = "" TxtPorIVA.Text = "" 'DdlProyecto.SelectedValue = "-1" - TxtCantidad.Text = "" - TxtPU.Text = "" - TmpDT.Clear() - CargaGVPresupuestos(TmpDT) - CargaGVPresupuestosInsumos(TmpDT) - LbTotalGeneral.Text = "0.00" + TxtCantidad.Text = "" + TxtPU.Text = "" + TmpDT.Clear() + CargaGVPresupuestos(TmpDT) + CargaGVPresupuestosInsumos(TmpDT) + LbTotalGeneral.Text = "0.00" End Sub -#End Region +#End Region -#Region " CONFIGURA TIPOS CONTRATO " +#Region " CONFIGURA TIPOS CONTRATO " - Private Sub ConfiguraTipos() - If Not TipoContrato.Contiene({7, 9, 13, 16, 18, 21}) Then - TabAF.Visible = False + Private Sub ConfiguraTipos() + If Not TipoContrato.Contiene({7, 9, 13, 16, 18, 21}) Then + TabAF.Visible = False End If 'DONDE OCUPA ALMACEN - Dim CveTipoAlmacenOrigen = "12,15" + Dim CveTipoAlmacenOrigen = "12,15" Dim CveTipoAlmacenDestino = "11,12" - End Sub - + End Sub + Private Sub MuestraPermiteAvance() End Sub -#End Region +#End Region -#Region " INICIO DE PAGINA " +#Region " INICIO DE PAGINA " - Private Sub modalidades(modalidadDetalleInt As Integer) - - If modalidadDetalleInt = 1 Then + Private Sub modalidades(modalidadDetalleInt As Integer) + + If modalidadDetalleInt = 1 Then ModalidadDetalle = 1 - DvTotal.Visible = True - - - 'If CveContrato > 0 AndAlso CveTipoContrato <> 25 Then - ' TableDatosCabecera.Visible = True - 'End If - + DvTotal.Visible = True + + + 'If CveContrato > 0 AndAlso CveTipoContrato <> 25 Then + ' TableDatosCabecera.Visible = True + 'End If + If CveTipoContrato = 25 Then DvTotal.Visible = False - End If - - ElseIf modalidadDetalleInt = 2 Then + End If + + ElseIf modalidadDetalleInt = 2 Then ModalidadDetalle = 2 DvTotal.Visible = True - 'If CveContrato > 0 AndAlso CveTipoContrato <> 25 Then - ' TableDatosCabecera.Visible = True + 'If CveContrato > 0 AndAlso CveTipoContrato <> 25 Then + ' TableDatosCabecera.Visible = True 'End If - End If - - UpGral.Update() - + End If + + UpGral.Update() + End Sub -#End Region +#End Region -#Region " CARGA DATOS " - Private Sub CargaDatos() - Dim ObjContratos As New ClsContratos() +#Region " CARGA DATOS " + Private Sub CargaDatos() + Dim ObjContratos As New ClsContratos() Dim Ruta = Request.ApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" 'DivTipoContrato.Visible = False - If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then - If ObjContratos.DtResultados.Rows.Count > 0 Then - - GRidsPresupuestos.Visible = True - msjpresupuestos.Visible = False - - If ArchivoUpdate = ObjContratos.Archivo.ToString Then - 'LinkArchivo.Visible = True - 'LinkArchivo.HRef = String.Format("{0}{1}", Ruta, ObjContratos.Archivo.ToString) - End If - Titulo = $"{ObjContratos.NumeroContrato} - {ObjContratos.DescripcionContrato} ({ObjContratos.DtResultados.Rows(0)("ContratoTipo")})" - TituloCorto = $"{ObjContratos.NumeroContrato} - {ObjContratos.DescripcionContrato} " - TipoDocumento = ObjContratos.DtResultados.Rows(0)("ContratoTipo").ToString - LtlTitulo.Text = $"Contrato: {Titulo})" - 'Pestaña Datos Generales - TxtObservaciones.Text = ObjContratos.Observaciones - TxtDescripcionContrato.Text = ObjContratos.DescripcionContrato - TxtNumeroContrato.Text = ObjContratos.NumeroContrato - TxtNumeroLicitacion.Text = ObjContratos.NumeroLicitacion + If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then + If ObjContratos.DtResultados.Rows.Count > 0 Then + + GRidsPresupuestos.Visible = True + msjpresupuestos.Visible = False + + If ArchivoUpdate = ObjContratos.Archivo.ToString Then + 'LinkArchivo.Visible = True + 'LinkArchivo.HRef = String.Format("{0}{1}", Ruta, ObjContratos.Archivo.ToString) + End If + Titulo = $"{ObjContratos.NumeroContrato} - {ObjContratos.DescripcionContrato} ({ObjContratos.DtResultados.Rows(0)("ContratoTipo")})" + TituloCorto = $"{ObjContratos.NumeroContrato} - {ObjContratos.DescripcionContrato} " + TipoDocumento = ObjContratos.DtResultados.Rows(0)("ContratoTipo").ToString + LtlTitulo.Text = $"Contrato: {Titulo})" + 'Pestaña Datos Generales + TxtObservaciones.Text = ObjContratos.Observaciones + TxtDescripcionContrato.Text = ObjContratos.DescripcionContrato + TxtNumeroContrato.Text = ObjContratos.NumeroContrato + TxtNumeroLicitacion.Text = ObjContratos.NumeroLicitacion TipoContrato = ObjContratos.CveContratoTipo - CveTipoContrato = ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero + CveTipoContrato = ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero TxtCorreoNotificacion.Text = ObjContratos.DtResultados.Rows(0)("CorreoNotificacionPedDev").ToString DdlCliente.SelectedValue = ObjContratos.CveCliente.ToString DdlCliente.SelectedText = ObjContratos.NombreComercial.ToString If ObjContratos.CveProveedor > 0 Then ' TrProveedor.Visible = True - TrCliente.Visible = False - CargaContratista() - DdlContratista.SelectedValue = ObjContratos.CveProveedor.ToString - DdlContratista.SelectedText = ObjContratos.RazonSocial.ToString - - Else + TrCliente.Visible = False + CargaContratista() + DdlContratista.SelectedValue = ObjContratos.CveProveedor.ToString + DdlContratista.SelectedText = ObjContratos.RazonSocial.ToString + + Else cargaClientes() DdlCliente.SelectedValue = ObjContratos.CveCliente.ToString UpCliente.Update() - UpGral.Update() - CargaSucursalCliente() - DdlSucursalCliente.SelectedValue = ObjContratos.CveSucursalCliente.ToString + UpGral.Update() + CargaSucursalCliente() + DdlSucursalCliente.SelectedValue = ObjContratos.CveSucursalCliente.ToString End If - CargaContratoAddendum() - + CargaContratoAddendum() + If ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero = 14 Then RFVEstatus.ValidationGroup = "" DvTotal.Visible = True RowEstatus.Visible = False CargaPlantillas() - TabPres.HeaderText = "Partidas" - End If - - If ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero = 25 Then - trLicitacion.Visible = False - divResponsable.Visible = False - trIva.Visible = False - trAnticipo.Visible = False - trAmortizacion.Visible = False - trPorGarantia.Visible = False - DvTotal.Visible = False - TabPVInsumos.Visible = False - RowEstatus.Visible = False TabPres.HeaderText = "Partidas" - 'TableDatosCabecera.Visible = False - TabAvanveDocumento.Visible = False + End If + + If ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero = 25 Then + trLicitacion.Visible = False + divResponsable.Visible = False + trIva.Visible = False + trAnticipo.Visible = False + trAmortizacion.Visible = False + trPorGarantia.Visible = False + DvTotal.Visible = False + TabPVInsumos.Visible = False + RowEstatus.Visible = False + TabPres.HeaderText = "Partidas" + 'TableDatosCabecera.Visible = False + TabAvanveDocumento.Visible = False TabSistema.Visible = False TabContratosGastos.Visible = False TDAvance.Style.Add("display", "none") 'TxtNoIdentificacionv.Visible = False DvObservaciones.Visible = True - TxtObservaciones.Text = ObjContratos.DtResultados.Rows(0)("Observaciones").ToString + TxtObservaciones.Text = ObjContratos.DtResultados.Rows(0)("Observaciones").ToString Gv.Columns(3).Visible = True End If - FechaF = ObjContratos.FechaFinal - FechaI = ObjContratos.FechaInicial - TxtFechaFinal.Text = ObjContratos.FechaFinal.ToShortDateString - TxtFechaInicial.Text = ObjContratos.FechaInicial.ToShortDateString - TxtUbicacion.Text = ObjContratos.Ubicacion - TxtResponsable.Text = ObjContratos.Responsable - TxtLugar.Text = ObjContratos.Lugar - TxtPorAnticipo.Text = ObjContratos.PorAmortizacionAnticipo.FormatoNumero - TxtPorAmortizacionAnticipo.Text = ObjContratos.PorAmortizacionAnticipo.FormatoNumero - TxtPorGarantia.Text = ObjContratos.PorGarantia.FormatoNumero - 'DdlProyecto.SelectedValue = ObjContratos.CveProyecto.ToString - LblSubProyecto.Text = ObjContratos.SubProyectoContrato - DdlTipoContratoObra.SelectedValueExist(ObjContratos.CveContratoTipo) + FechaF = ObjContratos.FechaFinal + FechaI = ObjContratos.FechaInicial + TxtFechaFinal.Text = ObjContratos.FechaFinal.ToShortDateString + TxtFechaInicial.Text = ObjContratos.FechaInicial.ToShortDateString + TxtUbicacion.Text = ObjContratos.Ubicacion + TxtResponsable.Text = ObjContratos.Responsable + TxtLugar.Text = ObjContratos.Lugar + TxtPorAnticipo.Text = ObjContratos.PorAmortizacionAnticipo.FormatoNumero + TxtPorAmortizacionAnticipo.Text = ObjContratos.PorAmortizacionAnticipo.FormatoNumero + TxtPorGarantia.Text = ObjContratos.PorGarantia.FormatoNumero + 'DdlProyecto.SelectedValue = ObjContratos.CveProyecto.ToString + LblSubProyecto.Text = ObjContratos.SubProyectoContrato + DdlTipoContratoObra.SelectedValueExist(ObjContratos.CveContratoTipo) 'CargaSubProyectoContrato(DdlProyecto.SelectedValue.ToEntero) - 'DdlSubProyectoContrato.SelectedValue = ObjContratos.CveSubProyecto.ToString - - - + 'DdlSubProyectoContrato.SelectedValue = ObjContratos.CveSubProyecto.ToString + + + TxtPorIVA.Text = ObjContratos.PorIVA.ToString TxtLimiteGastos.Text = ObjContratos.LimiteDeGasto.ToString TxtTotal.Text = ObjContratos.Importe.FormatoNumero - DdlEstatus.SelectedValueExist(ObjContratos.CveContratosEstatus.ToString) - CargarFianzas() - - If ObjContratos.TipoEstatus = 2 Then + DdlEstatus.SelectedValueExist(ObjContratos.CveContratosEstatus.ToString) + CargarFianzas() + + If ObjContratos.TipoEstatus = 2 Then DdlEstatus.Enabled = False - Else - DdlEstatus.Items.Clear() - 'Se esta ocultando concluido' - DdlEstatus.DataSource = CType(DdlEstatus.DataSource, DataTable).FiltraParametros("TipoEstatus NOT IN (2)") + Else + DdlEstatus.Items.Clear() + 'Se esta ocultando concluido' + DdlEstatus.DataSource = CType(DdlEstatus.DataSource, DataTable).FiltraParametros("TipoEstatus NOT IN (2)") DdlEstatus.DataBind() - End If - TxtTipoCambio.Text = ObjContratos.TipoCambio.ToString - + End If + TxtTipoCambio.Text = ObjContratos.TipoCambio.ToString + ModalidadDetalle = ObjContratos.ModalidadDetalle - modalidades(ModalidadDetalle) - - CargaGVGastos() - - DdlMoneda.SelectedValue = ObjContratos.CveMoneda.ToString - If DdlMoneda.SelectedIndex > 0 Then - tipoCambio.Visible = True - End If - - - If ObjContratos.CveProveedor > 0 Then - Contratante = ObjContratos.RazonSocial.ToString - Else - Contratante = ObjContratos.NombreComercial.ToString + modalidades(ModalidadDetalle) + + CargaGVGastos() + + DdlMoneda.SelectedValue = ObjContratos.CveMoneda.ToString + If DdlMoneda.SelectedIndex > 0 Then + tipoCambio.Visible = True + End If + + + If ObjContratos.CveProveedor > 0 Then + Contratante = ObjContratos.RazonSocial.ToString + Else + Contratante = ObjContratos.NombreComercial.ToString End If LblFechaCaptura.Text = ObjContratos.FechaIng.ToShortDateString CargaPresupuesto() - cargarBitacora() - If LblImporte.Text.ToDecimal <= 0 Then - LblImporte.Text = ObjContratos.ImporteTotal.ToString.FormatoNumero - End If - - If Not IsDBNull(ObjContratos.Archivo) AndAlso ObjContratos.Archivo <> "" AndAlso ObjContratos.Archivo <> "-1" AndAlso ObjContratos.Archivo <> $"{ObjContratos.CveContrato}." Then + cargarBitacora() + If LblImporte.Text.ToDecimal <= 0 Then + LblImporte.Text = ObjContratos.ImporteTotal.ToString.FormatoNumero + End If + + If Not IsDBNull(ObjContratos.Archivo) AndAlso ObjContratos.Archivo <> "" AndAlso ObjContratos.Archivo <> "-1" AndAlso ObjContratos.Archivo <> $"{ObjContratos.CveContrato}." Then ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "CONTRATOS", ObjContratos.Archivo) - BtnDescargar.Visible = True - Else - BtnDescargar.Visible = False - A1.Visible = True + BtnDescargar.Visible = True + Else + BtnDescargar.Visible = False + A1.Visible = True End If - DVSubProyecto.Visible = True - DVddlproyecto.Visible = False - - Else - CveContrato = -1 - Alert("El Contrato Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) - BtnGuardar.Enabled = False - End If - Else - CveContrato = -1 - Alert("Ocurrió un error al cargar el Contrato. Por favor vuelva a intentar.", TipoMensaje.MsgError) - BtnGuardar.Enabled = False - End If - UpGral.Update() - UPAFUL.Update() + DVSubProyecto.Visible = True + DVddlproyecto.Visible = False + + Else + CveContrato = -1 + Alert("El Contrato Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) + BtnGuardar.Enabled = False + End If + Else + CveContrato = -1 + Alert("Ocurrió un error al cargar el Contrato. Por favor vuelva a intentar.", TipoMensaje.MsgError) + BtnGuardar.Enabled = False + End If + UpGral.Update() + UPAFUL.Update() UpProyecto.Update() ' UpImpuestos.Update() - UpTitulos.Update() - ObjContratos.Dispose() - End Sub - Private Sub CargaContratoAddendum() - 'Dim ObjContratos As New ClsContratos - 'If ObjContratos.GetContratosAddendum(CveContrato) Then - ' If ObjContratos.DtResultados.Rows.Count > 0 Then - ' TabAddendum.Visible = True - ' GvAddendum.DataSource = ObjContratos.DtResultados - ' GvAddendum.DataBind() - ' End If - 'End If - End Sub - Private Sub CargaPresupuesto() - Dim ObjContratos As New ClsContratos - TabPres.Visible = True - - If TipoContrato = 4 Then - TabPI.Visible = True - End If - If ObjContratos.GetContratosDetalle(CveContrato, UsuarioActual.CveEmpresa, 2) Then - TmpDT = ObjContratos.DtResultados - If TmpDT.MAX("Cantidad_Original").ToString.ToEntero > 0 OrElse TmpDT.MAX("PU_Original").ToString.ToEntero > 0 Then - BtnAutorizar.Visible = False - Autorizado = True - BtnAgregarDetalle.Visible = False - AgregarInt.Visible = UsuarioActual.TienePermisoProceso(129) - End If - - CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) - CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) - - GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") - GvInt.DataBind() - - UpGV.Update() - UpGVInsumos.Update() + UpTitulos.Update() + ObjContratos.Dispose() + End Sub + Private Sub CargaContratoAddendum() + 'Dim ObjContratos As New ClsContratos + 'If ObjContratos.GetContratosAddendum(CveContrato) Then + ' If ObjContratos.DtResultados.Rows.Count > 0 Then + ' TabAddendum.Visible = True + ' GvAddendum.DataSource = ObjContratos.DtResultados + ' GvAddendum.DataBind() + ' End If + 'End If + End Sub + Private Sub CargaPresupuesto() + Dim ObjContratos As New ClsContratos + TabPres.Visible = True + + If TipoContrato = 4 Then + TabPI.Visible = True + End If + If ObjContratos.GetContratosDetalle(CveContrato, UsuarioActual.CveEmpresa, 2) Then + TmpDT = ObjContratos.DtResultados + If TmpDT.MAX("Cantidad_Original").ToString.ToEntero > 0 OrElse TmpDT.MAX("PU_Original").ToString.ToEntero > 0 Then + BtnAutorizar.Visible = False + Autorizado = True + BtnAgregarDetalle.Visible = False + AgregarInt.Visible = UsuarioActual.TienePermisoProceso(129) + End If + + CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) + CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) + + GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") + GvInt.DataBind() + + UpGV.Update() + UpGVInsumos.Update() UPGVInt.Update() TotalAvanceVentas = TmpDT.FiltraParametros("CveTipoPresupuesto=2 AND CveContratoDetalle > 0").SUM("Total").ToDecimal TotalAvanceInterno = TmpDT.FiltraParametros("CveTipoPresupuesto=1 AND CveContratoDetalle > 0").SUM("Total").ToDecimal - LbTotalGeneral.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=2 AND CveContratoDetalle > 0").SUM("Total").FormatoNumero() - LbTotalGeneralInsumos.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1 AND CveContratoDetalle > 0").SUM("Total").FormatoNumero() - - LbTotalGeneralInt.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1").SUM("Total").FormatoNumero() - 'LblImporte.Text = "$" & TmpDT.FiltraParametros("CveTipoPresupuesto=2").SUM("Total").FormatoNumero() - End If - End Sub - + LbTotalGeneral.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=2 AND CveContratoDetalle > 0").SUM("Total").FormatoNumero() + LbTotalGeneralInsumos.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1 AND CveContratoDetalle > 0").SUM("Total").FormatoNumero() + + LbTotalGeneralInt.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1").SUM("Total").FormatoNumero() + 'LblImporte.Text = "$" & TmpDT.FiltraParametros("CveTipoPresupuesto=2").SUM("Total").FormatoNumero() + End If + End Sub + Private Sub CargarFianzas() - Dim ObjContrato As ClsContratos = New ClsContratos() - - If ObjContrato.GetContratoFianza(CveContrato, -1, "-1", "-1", UsuarioActual.CveEmpresa, -1) Then + Dim ObjContrato As ClsContratos = New ClsContratos() + + If ObjContrato.GetContratoFianza(CveContrato, -1, "-1", "-1", UsuarioActual.CveEmpresa, -1) Then DtTmpFianzas = ObjContrato.DtResultados - DtTmpFianzasInicial = DtTmpFianzas.Copy() - - End If - + DtTmpFianzasInicial = DtTmpFianzas.Copy() + + End If + ObjContrato.Dispose() End Sub -#End Region +#End Region -#Region " GUARDAR " +#Region " GUARDAR " Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia) Exit Sub - End If - + End If + If TxtPorAmortizacionAnticipo.Text.ToDecimal < TxtPorAnticipo.Text.ToDecimal Then Alert("El porcentaje de amortización no debe de ser menor al porcentaje de anticipo.", TipoMensaje.MsgAdvertencia) Exit Sub - End If - - - - Dim TieneError = False - Dim Modificado = False - ' Dim Extension = Session("FileExtension").ToString - Dim Archivo = Session("FileUpload").ToString - Dim Ruta = Session("FileFolder").ToString - + End If + + + + Dim TieneError = False + Dim Modificado = False + ' Dim Extension = Session("FileExtension").ToString + Dim Archivo = Session("FileUpload").ToString + Dim Ruta = Session("FileFolder").ToString + Dim Minimo, Maximo, Total As Double Minimo = 0 'txtMinimo.Text.ToDouble @@ -980,202 +980,202 @@ Partial Class Contratos_ContratoObra - If DdlMoneda.SelectedIndex > 0 Then - If TxtTipoCambio.Text.Trim.Length = 0 Or TxtTipoCambio.Text.Trim.ToDouble = 0.0 Then - Alert("Cuando seleccione una moneda diferente a peso debe especificar el tipo de cambio.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - End If - - If CveContrato > 0 Then - If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then - Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia) - Exit Sub + If DdlMoneda.SelectedIndex > 0 Then + If TxtTipoCambio.Text.Trim.Length = 0 Or TxtTipoCambio.Text.Trim.ToDouble = 0.0 Then + Alert("Cuando seleccione una moneda diferente a peso debe especificar el tipo de cambio.", TipoMensaje.MsgAdvertencia) + Exit Sub End If End If - Dim ObjContratos As New ClsContratos - Dim ObjInventarios As New ClsInventarios(ObjContratos.IniciaTransacSQL) - - TipoContrato = DdlTipoContratoObra.SelectedValue.ToEntero - - 'Crear Contrato + If CveContrato > 0 Then + If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then + Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + + Dim ObjContratos As New ClsContratos + Dim ObjInventarios As New ClsInventarios(ObjContratos.IniciaTransacSQL) + + TipoContrato = DdlTipoContratoObra.SelectedValue.ToEntero + + 'Crear Contrato If Not CveContrato > 0 Then - Dim EstatusContrato As Integer = 1 - - CveContrato = ObjContratos.AddContratosObra(TxtNumeroContrato.Text, TxtDescripcionContrato.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, TxtFechaInicial.Text.ToDate, TxtFechaFinal.Text.ToDate, - TxtUbicacion.Text, TxtResponsable.Text, DdlProyecto.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble, - TxtPorGarantia.Text.ToDouble, "." & Session("FileExtension").ToString, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total, - DdlMoneda.SelectedValue.ToEntero, ModalidadDetalle, EstatusContrato, TipoContrato, - TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, - PorcentajeComision:=0, TipoGarantia:=-1, Folio:=0, FechaVenc:=Nothing, EstatusFianza:=1, - CvePeriodo:=-1, CveCuentaEquipo:=-1, CveContratoPlantilla:=-1, CveVendedor:=-1, - Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim, LimiteDeGasto:=TxtLimiteGastos.Text.ToDouble) - - - TieneError = Not GuardaFianzas(ObjContratos) - - - If CveContrato > 0 AndAlso Not TieneError Then - 'Renombrar archivo - If ViewState("extencion") IsNot Nothing Then - If ViewState("FUrl").ToString.Length > 0 AndAlso ViewState("extencion").ToString.Length > 0 Then - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") Then - Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") - End If - Ruta = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" - - 'ViewState("extencion") = FileExtension - 'ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", "Temp", ViewState("FName").ToString) - Try - If File.Exists(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) Then - File.Delete(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) - End If - System.IO.File.Move(ViewState("FUrl").ToString, String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) - Catch ex As Exception - + Dim EstatusContrato As Integer = 1 + + CveContrato = ObjContratos.AddContratosObra(TxtNumeroContrato.Text, TxtDescripcionContrato.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, TxtFechaInicial.Text.ToDate, TxtFechaFinal.Text.ToDate, + TxtUbicacion.Text, TxtResponsable.Text, DdlProyecto.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble, + TxtPorGarantia.Text.ToDouble, "." & Session("FileExtension").ToString, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total, + DdlMoneda.SelectedValue.ToEntero, ModalidadDetalle, EstatusContrato, TipoContrato, + TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, + PorcentajeComision:=0, TipoGarantia:=-1, Folio:=0, FechaVenc:=Nothing, EstatusFianza:=1, + CvePeriodo:=-1, CveCuentaEquipo:=-1, CveContratoPlantilla:=-1, CveVendedor:=-1, + Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim, LimiteDeGasto:=TxtLimiteGastos.Text.ToDouble) + + + TieneError = Not GuardaFianzas(ObjContratos) + + + If CveContrato > 0 AndAlso Not TieneError Then + 'Renombrar archivo + If ViewState("extencion") IsNot Nothing Then + If ViewState("FUrl").ToString.Length > 0 AndAlso ViewState("extencion").ToString.Length > 0 Then + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Contratos") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Contratos") + End If + Ruta = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" + + 'ViewState("extencion") = FileExtension + 'ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", "Temp", ViewState("FName").ToString) + Try + If File.Exists(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) Then + File.Delete(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) + End If + System.IO.File.Move(ViewState("FUrl").ToString, String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) + Catch ex As Exception + End Try - End If + End If End If - If TxtNumeroContrato.Text = FolioSugerido Then + If TxtNumeroContrato.Text = FolioSugerido Then Dim ObjFolios As New ClsGralFolios - If Not ObjFolios.UpdateFolioActual(CveSubProyecto, "Con", True, UsuarioActual.CveEmpresa) Then - TieneError = True - End If - - ObjFolios.Dispose() + If Not ObjFolios.UpdateFolioActual(CveSubProyecto, "Con", True, UsuarioActual.CveEmpresa) Then + TieneError = True + End If + + ObjFolios.Dispose() End If - Else - TieneError = True - End If - - Else - Modificado = True - - Dim ArchivoUpdate As String = "-1" - - If Session("FileExtension").ToString <> "" Then - ArchivoUpdate = "." & Session("FileExtension").ToString - Else - - End If - - If ObjContratos.UpdateContratosObra(CveContrato, TxtNumeroContrato.Text, TxtDescripcionContrato.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, TxtFechaInicial.Text.ToDate, TxtFechaFinal.Text.ToDate, - TxtUbicacion.Text, TxtResponsable.Text, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble, - TxtPorGarantia.Text.ToDouble, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total, DdlMoneda.SelectedValue.ToEntero, - ModalidadDetalle, If(UsuarioActual.Empresa.CvePlataforma = 3 OrElse CveTipoContrato = 25, 1, DdlEstatus.SelectedValue.ToEntero), TipoContrato, TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, - CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, PorcentajeComision:=0, - TipoGarantia:=-1, Folio:=-1, FechaVenc:=Nothing, EstatusFianza:=-1, CveContratoPlantilla:=-1, - CveCuentaEquipo:=-1, CveVendedor:=-1, Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, - CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim, LimiteDeGasto:=TxtLimiteGastos.Text.ToDouble) Then - - - TieneError = Not GuardaFianzas(ObjContratos) - - 'Renombrar archivo + Else + TieneError = True + End If + + Else + Modificado = True + + Dim ArchivoUpdate As String = "-1" + + If Session("FileExtension").ToString <> "" Then + ArchivoUpdate = "." & Session("FileExtension").ToString + Else + + End If + + If ObjContratos.UpdateContratosObra(CveContrato, TxtNumeroContrato.Text, TxtDescripcionContrato.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, TxtFechaInicial.Text.ToDate, TxtFechaFinal.Text.ToDate, + TxtUbicacion.Text, TxtResponsable.Text, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble, + TxtPorGarantia.Text.ToDouble, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total, DdlMoneda.SelectedValue.ToEntero, + ModalidadDetalle, If(UsuarioActual.Empresa.CvePlataforma = 3 OrElse CveTipoContrato = 25, 1, DdlEstatus.SelectedValue.ToEntero), TipoContrato, TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, + CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, PorcentajeComision:=0, + TipoGarantia:=-1, Folio:=-1, FechaVenc:=Nothing, EstatusFianza:=-1, CveContratoPlantilla:=-1, + CveCuentaEquipo:=-1, CveVendedor:=-1, Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, + CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim, LimiteDeGasto:=TxtLimiteGastos.Text.ToDouble) Then + + + TieneError = Not GuardaFianzas(ObjContratos) + + 'Renombrar archivo If Not TieneError Then - If ViewState("extencion") IsNot Nothing Then - - If ViewState("FUrl").ToString.Length > 0 AndAlso ViewState("extencion").ToString.Length > 0 Then - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") Then - Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos") - End If - Ruta = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" - - Try - If File.Exists(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) Then - File.Delete(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) - End If - System.IO.File.Move(ViewState("FUrl").ToString, String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) - Catch ex As Exception - + If ViewState("extencion") IsNot Nothing Then + + If ViewState("FUrl").ToString.Length > 0 AndAlso ViewState("extencion").ToString.Length > 0 Then + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Contratos") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Contratos") + End If + Ruta = UsuarioActual.Empresa.Ruta & "Contratos\" + + Try + If File.Exists(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) Then + File.Delete(String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) + End If + System.IO.File.Move(ViewState("FUrl").ToString, String.Format("{0}{1}.{2}", Ruta, CveContrato.ToString, ViewState("extencion").ToString)) + Catch ex As Exception + End Try - End If + End If End If - End If - Else - TieneError = True - End If - - End If - - If TieneError Then - ObjContratos.RollBack() - Else - ObjContratos.Commit() - - If ObjContratos.GetContratos(-1, -1) Then - Application("GlobalDTContratos") = ObjContratos.DtResultados - End If - - Limpiar() - If Modificado Then - Alert("El Contrato se modificó Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/ContratoObra.aspx?CveContrato={0}""", CveContrato)) - Else - Alert("El Contrato se registró Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/ContratoObra.aspx?CveContrato={0}""", CveContrato)) - End If - - End If - - UpGral.Update() - ObjContratos.Dispose() + End If + Else + TieneError = True + End If + + End If + + If TieneError Then + ObjContratos.RollBack() + Else + ObjContratos.Commit() + + If ObjContratos.GetContratos(-1, -1) Then + Application("GlobalDTContratos") = ObjContratos.DtResultados + End If + + Limpiar() + If Modificado Then + Alert("El Contrato se modificó Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/ContratoObra.aspx?CveContrato={0}""", CveContrato)) + Else + Alert("El Contrato se registró Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/ContratoObra.aspx?CveContrato={0}""", CveContrato)) + End If + + End If + + UpGral.Update() + ObjContratos.Dispose() End Sub -#End Region +#End Region -#Region " ELIMINAR " - Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click - Dim objContratos As New ClsContratos - - If objContratos.RemoveContrato(CveContrato, UsuarioActual.Empresa.CveEmpresa) Then - Response.Redirect("./Contratos.aspx") - Else - ' Alert("Ocurrio un error al eliminar el contrato", TipoMensaje.MsgError) - End If +#Region " ELIMINAR " + Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click + Dim objContratos As New ClsContratos + + If objContratos.RemoveContrato(CveContrato, UsuarioActual.Empresa.CveEmpresa) Then + Response.Redirect("./Contratos.aspx") + Else + ' Alert("Ocurrio un error al eliminar el contrato", TipoMensaje.MsgError) + End If End Sub -#End Region +#End Region -#Region " TERMINAR/CANCELAR CONTRATO " - Protected Sub LBTerminarContrato_Click(sender As Object, e As EventArgs) - Dim ObjContratos As New ClsContratos - If ObjContratos.TerminarContrato(CveContrato, 2, UsuarioActual.CveEmpresa) > 0 Then - Alert("El Contrato fue terminado Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/Contrato.aspx?CveContrato={0}""", CveContrato)) - End If - ObjContratos.Dispose() - End Sub - - Protected Sub LBCancelarContrato_Click(sender As Object, e As EventArgs) - Dim ObjContratos As New ClsContratos - If ObjContratos.TerminarContrato(CveContrato, 3, UsuarioActual.CveEmpresa) > 0 Then - Alert("El Contrato fue cancelado Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/Contrato.aspx?CveContrato={0}""", CveContrato)) - End If - ObjContratos.Dispose() - End Sub - - Protected Sub LBVigenteContrato_Click(sender As Object, e As EventArgs) - Dim ObjContratos As New ClsContratos - If ObjContratos.TerminarContrato(CveContrato, 1, UsuarioActual.CveEmpresa) > 0 Then - Alert("El Contrato fue cancelado Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/Contrato.aspx?CveContrato={0}""", CveContrato)) - End If - ObjContratos.Dispose() +#Region " TERMINAR/CANCELAR CONTRATO " + Protected Sub LBTerminarContrato_Click(sender As Object, e As EventArgs) + Dim ObjContratos As New ClsContratos + If ObjContratos.TerminarContrato(CveContrato, 2, UsuarioActual.CveEmpresa) > 0 Then + Alert("El Contrato fue terminado Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/Contrato.aspx?CveContrato={0}""", CveContrato)) + End If + ObjContratos.Dispose() End Sub -#End Region -#Region " TABS " + Protected Sub LBCancelarContrato_Click(sender As Object, e As EventArgs) + Dim ObjContratos As New ClsContratos + If ObjContratos.TerminarContrato(CveContrato, 3, UsuarioActual.CveEmpresa) > 0 Then + Alert("El Contrato fue cancelado Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/Contrato.aspx?CveContrato={0}""", CveContrato)) + End If + ObjContratos.Dispose() + End Sub -#Region " TAB: INFORMACION GENERAL" + Protected Sub LBVigenteContrato_Click(sender As Object, e As EventArgs) + Dim ObjContratos As New ClsContratos + If ObjContratos.TerminarContrato(CveContrato, 1, UsuarioActual.CveEmpresa) > 0 Then + Alert("El Contrato fue cancelado Correctamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/Contrato.aspx?CveContrato={0}""", CveContrato)) + End If + ObjContratos.Dispose() + End Sub +#End Region -#Region "COMBOS - INFO GENERAL" +#Region " TABS " + +#Region " TAB: INFORMACION GENERAL" + +#Region "COMBOS - INFO GENERAL" Private Sub CargaProyecto() 'trddlproyecto.Visible = LblProyecto.Visible @@ -1195,67 +1195,67 @@ Partial Class Contratos_ContratoObra ' DdlProyecto.DataSource = GlobalDTProyectos(UsuarioActual.Empresa.CveEmpresa).FiltraParametros("", "", {"CveProyecto", "Proyecto"}) ' DdlProyecto.DataBind() 'End If - End Sub - 'Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged - ' CargaSubProyectoContrato(DdlProyecto.SelectedValue.ToEntero) - 'End Sub - 'Protected Sub CargaSubProyectoContrato(CveProyecto As Integer) - ' DdlSubProyectoContrato.Items.Clear() - ' DdlSubProyectoContrato.DataSource = GlobalDTSubProyectos(CveProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("", "", {"CveSubproyecto", "SubProyecto"}) - ' DdlSubProyectoContrato.DataBind() - ' DdlSubProyectoContrato.Items.Insert(0, New ListItem("Seleccione un Proyecto", "-1")) - 'End Sub - Private Sub CargaContratista() + End Sub + 'Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged + ' CargaSubProyectoContrato(DdlProyecto.SelectedValue.ToEntero) + 'End Sub + 'Protected Sub CargaSubProyectoContrato(CveProyecto As Integer) + ' DdlSubProyectoContrato.Items.Clear() + ' DdlSubProyectoContrato.DataSource = GlobalDTSubProyectos(CveProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("", "", {"CveSubproyecto", "SubProyecto"}) + ' DdlSubProyectoContrato.DataBind() + ' DdlSubProyectoContrato.Items.Insert(0, New ListItem("Seleccione un Proyecto", "-1")) + 'End Sub + Private Sub CargaContratista() DdlContratista.setEsWebService(True) - DdlContratista.Attributes.Add("data-metodo", "getproveedores") - End Sub - - 'Private Sub CargaVendedores() - ' DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) - ' DdlVendedor.DataBind() - 'End Sub - 'Private Sub CargaContratoPadre() - ' DdlContratoPadre.Items.Clear() - ' DdlContratoPadre.DataSource = GlobalDTContratos.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveContratoTipo = {TipoContrato} {If(DdlCliente.SelectedValue.ToEntero > 0, $"AND CveCliente = {DdlCliente.SelectedValue}", "")} {If(CveContrato > 0, $"AND CveContrato <> {CveContrato}", "")} ") - ' DdlContratoPadre.DataBind() - ' DdlContratoPadre.Items.Insert(0, New ListItem("Seleccione", "-1")) - 'End Sub - Private Sub CargaContratosEstatus() - Dim ObjContratos As New ClsContratos - ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) - DdlEstatus.DataSource = ObjContratos.DtResultados - DdlEstatus.DataBind() - ObjContratos.Dispose() - End Sub - Protected Sub DdlCliente_SelectedIndexChanged(sender As Object, e As EventArgs) + DdlContratista.Attributes.Add("data-metodo", "getproveedores") + End Sub + + 'Private Sub CargaVendedores() + ' DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + ' DdlVendedor.DataBind() + 'End Sub + 'Private Sub CargaContratoPadre() + ' DdlContratoPadre.Items.Clear() + ' DdlContratoPadre.DataSource = GlobalDTContratos.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveContratoTipo = {TipoContrato} {If(DdlCliente.SelectedValue.ToEntero > 0, $"AND CveCliente = {DdlCliente.SelectedValue}", "")} {If(CveContrato > 0, $"AND CveContrato <> {CveContrato}", "")} ") + ' DdlContratoPadre.DataBind() + ' DdlContratoPadre.Items.Insert(0, New ListItem("Seleccione", "-1")) + 'End Sub + Private Sub CargaContratosEstatus() + Dim ObjContratos As New ClsContratos + ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) + DdlEstatus.DataSource = ObjContratos.DtResultados + DdlEstatus.DataBind() + ObjContratos.Dispose() + End Sub + Protected Sub DdlCliente_SelectedIndexChanged(sender As Object, e As EventArgs) CargaSucursalCliente() ' CargaDireccionesEnvios(DdlCliente.SelectedValue.ToEntero) - UPPDatos.Update() - End Sub - Private Sub CargaSucursalCliente() - TrClienteSucursal.Visible = False - - Dim ObjCliente As New ClsClientes() - - If DdlCliente.SelectedValue.ToEntero > 0 Then - - If ObjCliente.GetSucursales(DdlCliente.SelectedValue.ToEntero) Then - DdlSucursalCliente.DataSource = ObjCliente.DtResultados - If ObjCliente.DtResultados.Rows.Count > 0 Then - TrClienteSucursal.Visible = True - End If + UPPDatos.Update() + End Sub + Private Sub CargaSucursalCliente() + TrClienteSucursal.Visible = False + + Dim ObjCliente As New ClsClientes() + + If DdlCliente.SelectedValue.ToEntero > 0 Then + + If ObjCliente.GetSucursales(DdlCliente.SelectedValue.ToEntero) Then + DdlSucursalCliente.DataSource = ObjCliente.DtResultados + If ObjCliente.DtResultados.Rows.Count > 0 Then + TrClienteSucursal.Visible = True + End If DdlSucursalCliente.DataBind() ' DdlTipoContrato.Items.Insert(0, New ListItem("Matriz", "-1")) - End If - 'If UsuarioActual.Empresa.CvePlataforma = 3 Then ' QUITAR - ' CargaCuentasEquipos() - 'End If - End If - - ObjCliente.Dispose() - - 'CargaContratoPadre() - UpProyecto.Update() + End If + 'If UsuarioActual.Empresa.CvePlataforma = 3 Then ' QUITAR + ' CargaCuentasEquipos() + 'End If + End If + + ObjCliente.Dispose() + + 'CargaContratoPadre() + UpProyecto.Update() End Sub @@ -1266,224 +1266,224 @@ Partial Class Contratos_ContratoObra -#End Region +#End Region -#Region " ARCHIVO " +#Region " ARCHIVO " - Private Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click - DescargarArchivo() - End Sub - - Private Sub DescargarArchivo() - Dim File As New FileInfo(ViewState("FUrl").ToString) - - If File.Exists Then 'set appropriate headers - Response.Clear() - Response.ClearHeaders() - Response.ClearContent() - Response.AddHeader("Content-Disposition", "attachment; filename=" & TxtNumeroContrato.Text & ".pdf") - Response.AddHeader("Content-Length", File.Length.ToString()) - 'Response.ContentType = "text/plain" - Response.ContentType = "application/octet-stream" - Response.Flush() - ' Response.TransmitFile(File.FullName) - Response.WriteFile(File.FullName) - Response.End() - 'if file does not exist - - Alert("Descargado Correctamente.", TipoMensaje.MsgInformacion) - Else - Alert("Ocurrio un error al descargar el archivo", TipoMensaje.MsgAdvertencia, "window.close()") - - End If 'nothing in the URL as HTTP GET - End Sub - - Protected Sub BtnGuardarArchivo_Click1(sender As Object, e As EventArgs) Handles BtnGuardarArchivo.Click - Dim FileExtension As String = "-1" - Dim Filesgral As List(Of Archivo) = Anexo.getfiles().Archivos - Dim Filename As String = "" - Dim folderContratosPath As String = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos") - - If Not Directory.Exists(folderContratosPath) Then - Directory.CreateDirectory(folderContratosPath) - End If - - If Not Directory.Exists(Path.Combine(folderContratosPath, "Temp")) Then - Directory.CreateDirectory(Path.Combine(folderContratosPath, "Temp")) - End If - - For Each fileItem As Archivo In Filesgral - - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Session("FileExtension") = FileExtension - Dim tempArray() As String - tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) - - - ViewState("extencion") = FileExtension - ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", "Temp", fileItem.filename) - - File.Move(fileItem.FileUrl, ViewState("FUrl").ToString) - TxtArchivo.Text = tempArray(1) - ' imgFileOk.Visible = True - 'ImgArchivo.Src = "/imagenes/accept.png" - Next - - UPAFUL.Update() - - RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1") - A1.Visible = True - If Not FileExtension = "-1" Then - BtnDescargar.Visible = True - End If - End Sub -#End Region - -#End Region - -#Region " TAB: PRESUPUESTOS " - -#Region "C O M B O S - PRESUPUESTOS" - Private Function isWhitFamily() As Boolean - Return (UsuarioActual.CveEmpresa = 66) - End Function - - Private Sub CargaClasificaciones() - DdlClasificacionAdd.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) ' GlobalDTClasificacionesPresupuestos(UsuarioActual.CveEmpresa) - DdlClasificacionAdd.DataBind() - DdlClasificacionAdd.Items.Insert(0, New ListItem("Seleccione", "-1")) - - 'DdlClasificacionAddInsumos.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) ' GlobalDTClasificacionesPresupuestos(UsuarioActual.CveEmpresa) - 'DdlClasificacionAddInsumos.DataBind() - 'DdlClasificacionAddInsumos.Items.Insert(0, New ListItem("Seleccione", "-1")) - - DdlClasificacionInt.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) 'GlobalDTSubFamilias(UsuarioActual.CveEmpresa) - DdlClasificacionInt.DataBind() - DdlClasificacionInt.Items.Insert(0, New ListItem("Seleccione", "-1")) + Private Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click + DescargarArchivo() End Sub -#Region " FUNCIONALIDAD 105 " - Private Sub CargaPS() - DdlProductows.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - If Not DdlProductows.UsaWebService AndAlso CType(DdlProductows.DataSource, DataTable) Is Nothing Then - DdlProductows.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - DdlProductows.DataBind() - Else - DdlProductows.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionAdd.SelectedValue) - End If - ElProductoChange() - End Sub - Protected Sub DdlProducto_ValueChanged(sender As Object, e As EventArgs) Handles DdlProductows.selectedindexchange - ElProductoChange() - End Sub - Private Sub ElProductoChange() - DdlUM.Items.Clear() - DdlUM.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductows.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) - DdlUM.DataBind() - UpTitulos.Update() - End Sub - Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacionAdd.SelectedIndexChanged - ChangeDdlProducto() - End Sub - Private Sub ChangeDdlProducto() - If UsuarioActual.Empresa.Funcionalidad(105) = "" Then - DdlProductows.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionAdd.SelectedValue.ToEntero).FiltraParametros("", "PSCodigo") - DdlProductows.DataBind() - DdlProductows.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) - Else - DdlProductows.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionAdd.SelectedValue) - DdlProductows.SelectedText = "Seleccione" - DdlProductows.SelectedValue = "-1" - End If - - UpModalVentasAddPS.Update() - - End Sub - - Private Sub CargaPSInsumos() - DdlProductowsInsumos.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - If Not DdlProductowsInsumos.UsaWebService AndAlso CType(DdlProductowsInsumos.DataSource, DataTable) Is Nothing Then - DdlProductowsInsumos.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - DdlProductowsInsumos.DataBind() - End If - ElProductoChangeInsumos() - End Sub - Protected Sub DdlProductoInsumos_ValueChanged(sender As Object, e As EventArgs) Handles DdlProductowsInsumos.selectedindexchange - ElProductoChangeInsumos() - End Sub - Private Sub ElProductoChangeInsumos() - DdlUMInsumos.Items.Clear() - DdlUMInsumos.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductowsInsumos.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) - DdlUMInsumos.DataBind() - UpTitulos.Update() - End Sub - 'Protected Sub DdlClasificacionInsumos_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacionAddInsumos.SelectedIndexChanged - ' ChangeDdlProductoInsumos() - 'End Sub - Private Sub ChangeDdlProductoInsumos() - If UsuarioActual.Empresa.Funcionalidad(105) = "" Then - 'Dim filtro As String = "" - 'If Not (DdlClasificacionAddInsumos.SelectedValue = "-1") Then - - ' If isWhitFamily() Then - ' filtro = String.Format("CveSubFamilia={0}", DdlClasificacionAddInsumos.SelectedValue) - ' Else - ' filtro = String.Format("CveClasificacion={0}", DdlClasificacionAddInsumos.SelectedValue) - ' End If - 'End If - 'DdlProductowsInsumos.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionAddInsumos.SelectedValue.ToEntero).FiltraParametros("", "PSCodigo") - 'DdlProductowsInsumos.DataBind() - 'DdlProductowsInsumos.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + Private Sub DescargarArchivo() + Dim File As New FileInfo(ViewState("FUrl").ToString) + + If File.Exists Then 'set appropriate headers + Response.Clear() + Response.ClearHeaders() + Response.ClearContent() + Response.AddHeader("Content-Disposition", "attachment; filename=" & TxtNumeroContrato.Text & ".pdf") + Response.AddHeader("Content-Length", File.Length.ToString()) + 'Response.ContentType = "text/plain" + Response.ContentType = "application/octet-stream" + Response.Flush() + ' Response.TransmitFile(File.FullName) + Response.WriteFile(File.FullName) + Response.End() + 'if file does not exist + + Alert("Descargado Correctamente.", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrio un error al descargar el archivo", TipoMensaje.MsgAdvertencia, "window.close()") + + End If 'nothing in the URL as HTTP GET + End Sub + + Protected Sub BtnGuardarArchivo_Click1(sender As Object, e As EventArgs) Handles BtnGuardarArchivo.Click + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = Anexo.getfiles().Archivos + Dim Filename As String = "" + Dim folderContratosPath As String = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos") + + If Not Directory.Exists(folderContratosPath) Then + Directory.CreateDirectory(folderContratosPath) + End If + + If Not Directory.Exists(Path.Combine(folderContratosPath, "Temp")) Then + Directory.CreateDirectory(Path.Combine(folderContratosPath, "Temp")) + End If + + For Each fileItem As Archivo In Filesgral + + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Session("FileExtension") = FileExtension + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + + ViewState("extencion") = FileExtension + ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", "Temp", fileItem.filename) + + File.Move(fileItem.FileUrl, ViewState("FUrl").ToString) + TxtArchivo.Text = tempArray(1) + ' imgFileOk.Visible = True + 'ImgArchivo.Src = "/imagenes/accept.png" + Next + + UPAFUL.Update() + + RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1") + A1.Visible = True + If Not FileExtension = "-1" Then + BtnDescargar.Visible = True + End If + End Sub +#End Region + +#End Region + +#Region " TAB: PRESUPUESTOS " + +#Region "C O M B O S - PRESUPUESTOS" + Private Function isWhitFamily() As Boolean + Return (UsuarioActual.CveEmpresa = 66) + End Function + + Private Sub CargaClasificaciones() + DdlClasificacionAdd.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) ' GlobalDTClasificacionesPresupuestos(UsuarioActual.CveEmpresa) + DdlClasificacionAdd.DataBind() + DdlClasificacionAdd.Items.Insert(0, New ListItem("Seleccione", "-1")) + + 'DdlClasificacionAddInsumos.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) ' GlobalDTClasificacionesPresupuestos(UsuarioActual.CveEmpresa) + 'DdlClasificacionAddInsumos.DataBind() + 'DdlClasificacionAddInsumos.Items.Insert(0, New ListItem("Seleccione", "-1")) + + DdlClasificacionInt.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) 'GlobalDTSubFamilias(UsuarioActual.CveEmpresa) + DdlClasificacionInt.DataBind() + DdlClasificacionInt.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub + +#Region " FUNCIONALIDAD 105 " + Private Sub CargaPS() + DdlProductows.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + If Not DdlProductows.UsaWebService AndAlso CType(DdlProductows.DataSource, DataTable) Is Nothing Then + DdlProductows.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + DdlProductows.DataBind() + Else + DdlProductows.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionAdd.SelectedValue) + End If + ElProductoChange() + End Sub + Protected Sub DdlProducto_ValueChanged(sender As Object, e As EventArgs) Handles DdlProductows.selectedindexchange + ElProductoChange() + End Sub + Private Sub ElProductoChange() + DdlUM.Items.Clear() + DdlUM.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductows.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) + DdlUM.DataBind() + UpTitulos.Update() + End Sub + Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacionAdd.SelectedIndexChanged + ChangeDdlProducto() + End Sub + Private Sub ChangeDdlProducto() + If UsuarioActual.Empresa.Funcionalidad(105) = "" Then + DdlProductows.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionAdd.SelectedValue.ToEntero).FiltraParametros("", "PSCodigo") + DdlProductows.DataBind() + DdlProductows.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + Else + DdlProductows.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionAdd.SelectedValue) + DdlProductows.SelectedText = "Seleccione" + DdlProductows.SelectedValue = "-1" + End If + + UpModalVentasAddPS.Update() + + End Sub + + Private Sub CargaPSInsumos() + DdlProductowsInsumos.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + If Not DdlProductowsInsumos.UsaWebService AndAlso CType(DdlProductowsInsumos.DataSource, DataTable) Is Nothing Then + DdlProductowsInsumos.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + DdlProductowsInsumos.DataBind() + End If + ElProductoChangeInsumos() + End Sub + Protected Sub DdlProductoInsumos_ValueChanged(sender As Object, e As EventArgs) Handles DdlProductowsInsumos.selectedindexchange + ElProductoChangeInsumos() + End Sub + Private Sub ElProductoChangeInsumos() + DdlUMInsumos.Items.Clear() + DdlUMInsumos.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductowsInsumos.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) + DdlUMInsumos.DataBind() + UpTitulos.Update() + End Sub + 'Protected Sub DdlClasificacionInsumos_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacionAddInsumos.SelectedIndexChanged + ' ChangeDdlProductoInsumos() + 'End Sub + Private Sub ChangeDdlProductoInsumos() + If UsuarioActual.Empresa.Funcionalidad(105) = "" Then + 'Dim filtro As String = "" + 'If Not (DdlClasificacionAddInsumos.SelectedValue = "-1") Then + + ' If isWhitFamily() Then + ' filtro = String.Format("CveSubFamilia={0}", DdlClasificacionAddInsumos.SelectedValue) + ' Else + ' filtro = String.Format("CveClasificacion={0}", DdlClasificacionAddInsumos.SelectedValue) + ' End If + 'End If + 'DdlProductowsInsumos.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionAddInsumos.SelectedValue.ToEntero).FiltraParametros("", "PSCodigo") + 'DdlProductowsInsumos.DataBind() + 'DdlProductowsInsumos.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) Else 'If isWhitFamily() Then ' DdlProductowsInsumos.ddlWS.Attributes.Add("data-idSubFamilia", DdlClasificacionAddInsumos.SelectedValue) 'Else ' DdlProductowsInsumos.ddlWS.Attributes.Add("data-idClasificacion", DdlClasificacionAddInsumos.SelectedValue) 'End If - End If + End If End Sub -#End Region +#End Region -#End Region +#End Region -#Region " TAB PRESUPUESTOS VENTAS " - Private Sub CargaGVPresupuestos(DtTemp As DataTable) - Gv.DataSource = DtTemp - DtPresupuestos = DtTemp - Gv.DataBind() +#Region " TAB PRESUPUESTOS VENTAS " + Private Sub CargaGVPresupuestos(DtTemp As DataTable) + Gv.DataSource = DtTemp + DtPresupuestos = DtTemp + Gv.DataBind() If CveTipoContrato = 25 Then ' Gv.Columns(0).Visible = False Gv.Columns(1).Visible = False ' Gv.Columns(3).Visible = False - Gv.Columns(6).Visible = False - End If - 'If (Gv.Rows.Count > 0) Then - ' Gv.UseAccessibleHeader = True - ' Gv.HeaderRow.TableSection = TableRowSection.TableHeader - ' RegistraScript("OrdenarGVPresupuestos();") - 'End If - UpGV.Update() - End Sub - Protected Sub BtnAutorizar_Click(sender As Object, e As EventArgs) Handles BtnAutorizar.Click - Dim pinterno = TmpDT.SUM("Total", "CveTipoPresupuesto=1").ToString.ToDouble - Dim pventas = TmpDT.SUM("Total", "CveTipoPresupuesto=2").ToString.ToDouble - If (pinterno < pventas) Then - Dim objContrato As New ClsContratos - - If objContrato.AutorizarContratos(CveContrato, UsuarioActual.CveUsuario) Then - BtnAutorizar.Visible = False - Autorizado = True - Alert("Contrato Autorizado", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/Contrato.aspx?CveContrato={0}""", CveContrato)) - End If - objContrato.Dispose() - Else - Alert("el presupuesto de ventas debe ser mayor al presupuesto interno!", TipoMensaje.MsgAdvertencia) - End If - End Sub - - Protected Sub BtnAgregarDetalle_Click(sender As Object, e As EventArgs) - - + Gv.Columns(6).Visible = False + End If + 'If (Gv.Rows.Count > 0) Then + ' Gv.UseAccessibleHeader = True + ' Gv.HeaderRow.TableSection = TableRowSection.TableHeader + ' RegistraScript("OrdenarGVPresupuestos();") + 'End If + UpGV.Update() + End Sub + Protected Sub BtnAutorizar_Click(sender As Object, e As EventArgs) Handles BtnAutorizar.Click + Dim pinterno = TmpDT.SUM("Total", "CveTipoPresupuesto=1").ToString.ToDouble + Dim pventas = TmpDT.SUM("Total", "CveTipoPresupuesto=2").ToString.ToDouble + If (pinterno < pventas) Then + Dim objContrato As New ClsContratos + + If objContrato.AutorizarContratos(CveContrato, UsuarioActual.CveUsuario) Then + BtnAutorizar.Visible = False + Autorizado = True + Alert("Contrato Autorizado", TipoMensaje.MsgInformacion, String.Format("document.location.href=""/Contratos/Contrato.aspx?CveContrato={0}""", CveContrato)) + End If + objContrato.Dispose() + Else + Alert("el presupuesto de ventas debe ser mayor al presupuesto interno!", TipoMensaje.MsgAdvertencia) + End If + End Sub + + Protected Sub BtnAgregarDetalle_Click(sender As Object, e As EventArgs) + + If CveContratoDetalleEditar = -1 Then Dim Row As DataRow = TmpDT.NewRow() @@ -1599,92 +1599,92 @@ Partial Class Contratos_ContratoObra End If CveContratoDetalleEditar = -1 - End Sub - - Private Sub CargaDatosPresup() - Dim ContratosSecciones As New ClsContratos() - - If ContratosSecciones.GetContratosSecciones(-1, CveContrato, -1, -1, -1, UsuarioActual.CveEmpresa) Then - 'If ContratosSecciones.GetContratosSecciones(-1, DdlEstatus.SelectedValue.ToEntero, DdlPS.SelectedValue.ToEntero, DdlContrato.SelectedValue.ToEntero, -1, -1, FechaI, FechaF) Then - DtDatos = ContratosSecciones.DtResultados - ' DtDatos.Rows.RemoveAt(0) - CargaGVPresupuestos(DtDatos) - LblImporte.Text = "$" & DtDatos.MAX("Total").FormatoNumero() - Else - Gv.DataSource = Nothing - End If - - ContratosSecciones.Dispose() - - UpGral.Update() End Sub -#Region "GV PRESUPUESTOS" + Private Sub CargaDatosPresup() + Dim ContratosSecciones As New ClsContratos() + + If ContratosSecciones.GetContratosSecciones(-1, CveContrato, -1, -1, -1, UsuarioActual.CveEmpresa) Then + 'If ContratosSecciones.GetContratosSecciones(-1, DdlEstatus.SelectedValue.ToEntero, DdlPS.SelectedValue.ToEntero, DdlContrato.SelectedValue.ToEntero, -1, -1, FechaI, FechaF) Then + DtDatos = ContratosSecciones.DtResultados + ' DtDatos.Rows.RemoveAt(0) + CargaGVPresupuestos(DtDatos) + LblImporte.Text = "$" & DtDatos.MAX("Total").FormatoNumero() + Else + Gv.DataSource = Nothing + End If + + ContratosSecciones.Dispose() + + UpGral.Update() + End Sub + +#Region "GV PRESUPUESTOS" + + Protected Sub EstClick(sender As Object, e As System.EventArgs) + 'Get the button that raised the event + Dim btn As CheckBox = DirectCast(sender, CheckBox) + Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) + Dim CveContratoDetalle As Integer = gvr.DataKey("CveContratoDetalle").ToString.ToEntero + Dim objContrato As New ClsContratos + If objContrato.UpdateContratosDetalleEstimacion(CveContratoDetalle, IIf(btn.Checked, 1, 0).ToString.ToEntero) Then + Dim row = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) + row("PermitirEstimacion") = IIf(btn.Checked, 1, 0).ToString.ToEntero + Alert("Se ha permitido estimar", TipoMensaje.MsgInformacion) + Else + Alert("no se pudo permitir avance") + End If + objContrato.Dispose() + + End Sub + + Protected Sub AvaClick(sender As Object, e As System.EventArgs) + 'Get the button that raised the event + Dim btn As CheckBox = DirectCast(sender, CheckBox) + Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) + Dim CveContratoDetalle As Integer = gvr.DataKey("CveContratoDetalle").ToString.ToEntero + Dim objContrato As New ClsContratos + If objContrato.UpdateContratosDetalleAvance(CveContratoDetalle, IIf(btn.Checked, 1, 0).ToString.ToEntero) Then + Dim row = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) + row("PermitirAvance") = IIf(btn.Checked, 1, 0).ToString.ToEntero + + + CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) + + + Alert("Se ha permitido levantar avance", TipoMensaje.MsgInformacion) + Else + Alert("no se pudo permitir avance", TipoMensaje.MsgAdvertencia) + End If + objContrato.Dispose() + End Sub + Protected Sub GV_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Gv.RowDataBound - Protected Sub EstClick(sender As Object, e As System.EventArgs) - 'Get the button that raised the event - Dim btn As CheckBox = DirectCast(sender, CheckBox) - Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) - Dim CveContratoDetalle As Integer = gvr.DataKey("CveContratoDetalle").ToString.ToEntero - Dim objContrato As New ClsContratos - If objContrato.UpdateContratosDetalleEstimacion(CveContratoDetalle, IIf(btn.Checked, 1, 0).ToString.ToEntero) Then - Dim row = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) - row("PermitirEstimacion") = IIf(btn.Checked, 1, 0).ToString.ToEntero - Alert("Se ha permitido estimar", TipoMensaje.MsgInformacion) - Else - Alert("no se pudo permitir avance") - End If - objContrato.Dispose() - - End Sub - - Protected Sub AvaClick(sender As Object, e As System.EventArgs) - 'Get the button that raised the event - Dim btn As CheckBox = DirectCast(sender, CheckBox) - Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) - Dim CveContratoDetalle As Integer = gvr.DataKey("CveContratoDetalle").ToString.ToEntero - Dim objContrato As New ClsContratos - If objContrato.UpdateContratosDetalleAvance(CveContratoDetalle, IIf(btn.Checked, 1, 0).ToString.ToEntero) Then - Dim row = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) - row("PermitirAvance") = IIf(btn.Checked, 1, 0).ToString.ToEntero - - - CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) - - - Alert("Se ha permitido levantar avance", TipoMensaje.MsgInformacion) - Else - Alert("no se pudo permitir avance", TipoMensaje.MsgAdvertencia) - End If - objContrato.Dispose() - End Sub - Protected Sub GV_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Gv.RowDataBound - If e.Row.RowIndex > -1 Then Dim LnkHabilitaAvance As LinkButton = e.Row.FCLinkButton("LnkHabilitaAvance") ' e.Row.FCCheckBox("CHKPAvance").Visible = Autorizado 'e.Row.FCCheckBox("CHKPEstimacion").Visible = Autorizado - If UsuarioActual.TienePermisoProceso(124) Then - e.Row.FCCheckBox("CHKPAvance").Enabled = True + If UsuarioActual.TienePermisoProceso(124) Then + e.Row.FCCheckBox("CHKPAvance").Enabled = True LnkHabilitaAvance.Enabled = True - End If - - If e.Row.DBCampo("PermitirAvance").ToString = "1" Then - e.Row.FCCheckBox("CHKPAvance").Checked = True - ' If UsuarioActual.TienePermisoProceso(125) Then : e.Row.FCCheckBox("CHKPEstimacion").Enabled = True : End If - End If - - If e.Row.DBCampo("PermitirEstimacion").ToString = "1" Then - ' e.Row.FCCheckBox("CHKPEstimacion").Checked = True - End If + End If + + If e.Row.DBCampo("PermitirAvance").ToString = "1" Then + e.Row.FCCheckBox("CHKPAvance").Checked = True + ' If UsuarioActual.TienePermisoProceso(125) Then : e.Row.FCCheckBox("CHKPEstimacion").Enabled = True : End If + End If + + If e.Row.DBCampo("PermitirEstimacion").ToString = "1" Then + ' e.Row.FCCheckBox("CHKPEstimacion").Checked = True + End If If Autorizado Then ' e.Row.FCLinkButton("imgE").Visible = False - 'e.Row.FCLinkButton("imgD").Visible = False - End If - If CveTipoContrato = 25 Then - e.Row.Cells(1).Width = Unit.Pixel(10) - e.Row.Cells(6).Width = Unit.Pixel(250) + 'e.Row.FCLinkButton("imgD").Visible = False + End If + If CveTipoContrato = 25 Then + e.Row.Cells(1).Width = Unit.Pixel(10) + e.Row.Cells(6).Width = Unit.Pixel(250) End If @@ -1696,131 +1696,131 @@ Partial Class Contratos_ContratoObra Else LnkHabilitaAvance.Text = "" LnkHabilitaAvance.Attributes.Add("data-original-title", "¿Habilitar avance?") - End If - - - End If - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("DdlUMEdit").DataBind() - e.Row.FCDropDownList("DdlUMEdit").SelectedValue = e.Row.DataKey("CveUM") - End If - - End Sub - Protected Sub GV_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles Gv.RowEditing - Gv.EditIndex = e.NewEditIndex - CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) - End Sub - Protected Sub Gv_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles Gv.RowUpdating - Dim Cantidad, PU As Double : Dim CvePS, CveContratoDetalle, CveUM As Integer - Dim NoIdentificacion As String = "" - Dim OCInterna As String = "" - Dim LimitarCantidad As Boolean - Dim Observaciones As String = "" - CveContratoDetalle = Gv.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero - Cantidad = Gv.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.Trim.ToDouble - PU = Gv.Rows(e.RowIndex).FCTextBox("TxtPU").Text.Trim.ToDouble - CvePS = Gv.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero - CveUM = Gv.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedValue.ToEntero - NoIdentificacion = Gv.Rows(e.RowIndex).FCTextBox("TxtNoIdentificacion").Text.ToString - OCInterna = Gv.Rows(e.RowIndex).FCTextBox("TxtOCInternaEdit").Text.ToString - LimitarCantidad = Gv.Rows(e.RowIndex).FCCheckBox("ChkLimitarCantidad").Checked - Observaciones = Gv.Rows(e.RowIndex).FCTextBox("TxtObservacion").Text.ToString - Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) - Dim LimitarCantidadValidator As Boolean = row("LimitarCantidad").ToString = "True" - If row("CantidadContratada").ToString.ToEntero <> Cantidad OrElse row("PU").ToString.ToEntero <> PU OrElse CveUM <> row("CveUM").ToString.ToEntero OrElse row("NoIdentificacion").ToString <> NoIdentificacion OrElse row("OCInterna").ToString <> OCInterna OrElse LimitarCantidadValidator <> LimitarCantidad Then - - Dim ObjContratos As New ClsContratos - If ObjContratos.UpdateContratosDetalle(CveContratoDetalle, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, NoIdentificacion, LimitarCantidad, OCInterna, Observaciones) Then - - If Autorizado Then - Dim msj As String = String.Format("Se realizaron los siguientes cambios, el Presupuesto Interno se modificó: {1} {0} {2:C2} a {3} {0} {4:C2}", - row("PS").ToString, row("Cantidad").ToString, row("PU").ToString, Cantidad, PU) - guardarBitacora(msj) - End If - - row("Cantidad") = Cantidad - row("CantidadContratada") = Cantidad - row("PU") = PU - row("Total") = Cantidad * PU - row("CveUM") = CveUM - row("UM") = Gv.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedItem.Text - row("NoIdentificacion") = NoIdentificacion - row("OCInterna") = OCInterna - row("LimitarCantidad") = LimitarCantidad - row("Observacion") = Observaciones - - TmpDT.AcceptChanges() - Alert("Cambios realizados correctamente.", TipoMensaje.MsgInformacion) - Else - Alert("Error al Actualizar Detalle", TipoMensaje.MsgError) - End If - ObjContratos.Dispose() - - Else - Alert("Cambios realizados correctamente") - End If - - Gv.EditIndex = -1 - LbTotalGeneral.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=2").SUM("Total").FormatoNumero - LblImporte.Text = LbTotalGeneral.Text - CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) - - End Sub - Protected Sub GV_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles Gv.RowCancelingEdit - Gv.EditIndex = -1 - CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) - End Sub - Protected Sub GV_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles Gv.RowDeleting - - Dim ObjContratos As New ClsContratos - Dim DbRow As DataRow = Nothing - Dim CveContratoDetalle As Integer = Gv.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero - DbRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) - If Autorizado Then - Dim msj As String = String.Format("Se eliminaron {0} {1} producto {2} con el precio {3}", DbRow("Cantidad"), DbRow("UM"), DbRow("PS"), DbRow("PU")) - guardarBitacora(msj) - End If - - If ObjContratos.RemoveContratosDetalle(CveContratoDetalle, CveContrato) Then - TmpDT.Rows.Remove(DbRow) - CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) - LbTotalGeneral.Text = Gv.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.FCLabel("LtTotal").Text.ToDouble).ToString.FormatoNumero - Alert("Detalle eliminado eliminado correctamente.") - Else - Alert("Ocurrió un error al eliminar el detalle (Producto/Servicio). Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - ObjContratos.Dispose() - End Sub - Protected Sub GV_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles Gv.RowCommand - If e.CommandName = "Sel" Then - ' Seleccionado = e.CommandArgument.ToString - Gv.SelectRow(e.CommandArgument.ToString.ToEntero - 1) - End If + End If + + + End If + If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then + e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) + e.Row.FCDropDownList("DdlUMEdit").DataBind() + e.Row.FCDropDownList("DdlUMEdit").SelectedValue = e.Row.DataKey("CveUM") + End If + End Sub -#End Region + Protected Sub GV_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles Gv.RowEditing + Gv.EditIndex = e.NewEditIndex + CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) + End Sub + Protected Sub Gv_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles Gv.RowUpdating + Dim Cantidad, PU As Double : Dim CvePS, CveContratoDetalle, CveUM As Integer + Dim NoIdentificacion As String = "" + Dim OCInterna As String = "" + Dim LimitarCantidad As Boolean + Dim Observaciones As String = "" + CveContratoDetalle = Gv.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero + Cantidad = Gv.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.Trim.ToDouble + PU = Gv.Rows(e.RowIndex).FCTextBox("TxtPU").Text.Trim.ToDouble + CvePS = Gv.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero + CveUM = Gv.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedValue.ToEntero + NoIdentificacion = Gv.Rows(e.RowIndex).FCTextBox("TxtNoIdentificacion").Text.ToString + OCInterna = Gv.Rows(e.RowIndex).FCTextBox("TxtOCInternaEdit").Text.ToString + LimitarCantidad = Gv.Rows(e.RowIndex).FCCheckBox("ChkLimitarCantidad").Checked + Observaciones = Gv.Rows(e.RowIndex).FCTextBox("TxtObservacion").Text.ToString + Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + Dim LimitarCantidadValidator As Boolean = row("LimitarCantidad").ToString = "True" + If row("CantidadContratada").ToString.ToEntero <> Cantidad OrElse row("PU").ToString.ToEntero <> PU OrElse CveUM <> row("CveUM").ToString.ToEntero OrElse row("NoIdentificacion").ToString <> NoIdentificacion OrElse row("OCInterna").ToString <> OCInterna OrElse LimitarCantidadValidator <> LimitarCantidad Then + + Dim ObjContratos As New ClsContratos + If ObjContratos.UpdateContratosDetalle(CveContratoDetalle, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, NoIdentificacion, LimitarCantidad, OCInterna, Observaciones) Then + + If Autorizado Then + Dim msj As String = String.Format("Se realizaron los siguientes cambios, el Presupuesto Interno se modificó: {1} {0} {2:C2} a {3} {0} {4:C2}", + row("PS").ToString, row("Cantidad").ToString, row("PU").ToString, Cantidad, PU) + guardarBitacora(msj) + End If + + row("Cantidad") = Cantidad + row("CantidadContratada") = Cantidad + row("PU") = PU + row("Total") = Cantidad * PU + row("CveUM") = CveUM + row("UM") = Gv.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedItem.Text + row("NoIdentificacion") = NoIdentificacion + row("OCInterna") = OCInterna + row("LimitarCantidad") = LimitarCantidad + row("Observacion") = Observaciones + + TmpDT.AcceptChanges() + Alert("Cambios realizados correctamente.", TipoMensaje.MsgInformacion) + Else + Alert("Error al Actualizar Detalle", TipoMensaje.MsgError) + End If + ObjContratos.Dispose() + + Else + Alert("Cambios realizados correctamente") + End If + + Gv.EditIndex = -1 + LbTotalGeneral.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=2").SUM("Total").FormatoNumero + LblImporte.Text = LbTotalGeneral.Text + CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) + + End Sub + Protected Sub GV_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles Gv.RowCancelingEdit + Gv.EditIndex = -1 + CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) + End Sub + Protected Sub GV_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles Gv.RowDeleting + + Dim ObjContratos As New ClsContratos + Dim DbRow As DataRow = Nothing + Dim CveContratoDetalle As Integer = Gv.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero + DbRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + If Autorizado Then + Dim msj As String = String.Format("Se eliminaron {0} {1} producto {2} con el precio {3}", DbRow("Cantidad"), DbRow("UM"), DbRow("PS"), DbRow("PU")) + guardarBitacora(msj) + End If + + If ObjContratos.RemoveContratosDetalle(CveContratoDetalle, CveContrato) Then + TmpDT.Rows.Remove(DbRow) + CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) + LbTotalGeneral.Text = Gv.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.FCLabel("LtTotal").Text.ToDouble).ToString.FormatoNumero + Alert("Detalle eliminado eliminado correctamente.") + Else + Alert("Ocurrió un error al eliminar el detalle (Producto/Servicio). Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + ObjContratos.Dispose() + End Sub + Protected Sub GV_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles Gv.RowCommand + If e.CommandName = "Sel" Then + ' Seleccionado = e.CommandArgument.ToString + Gv.SelectRow(e.CommandArgument.ToString.ToEntero - 1) + End If + End Sub +#End Region -#End Region +#End Region + +#Region " TAB PRESUPUESTOS INSUMOS " + Private Sub CargaGVPresupuestosInsumos(DtTemp As DataTable) + GvInsumos.DataSource = DtTemp + DtSuministros = DtTemp + GvInsumos.DataBind() + 'If (GvInsumos.Rows.Count > 0) Then + ' GvInsumos.UseAccessibleHeader = True + ' GvInsumos.HeaderRow.TableSection = TableRowSection.TableHeader + ' RegistraScript("OrdenarGVPresupuestosInsumos();") + 'End If + UpGVInsumos.Update() + End Sub -#Region " TAB PRESUPUESTOS INSUMOS " - Private Sub CargaGVPresupuestosInsumos(DtTemp As DataTable) - GvInsumos.DataSource = DtTemp - DtSuministros = DtTemp - GvInsumos.DataBind() - 'If (GvInsumos.Rows.Count > 0) Then - ' GvInsumos.UseAccessibleHeader = True - ' GvInsumos.HeaderRow.TableSection = TableRowSection.TableHeader - ' RegistraScript("OrdenarGVPresupuestosInsumos();") - 'End If - UpGVInsumos.Update() - End Sub - Protected Sub BtnAgregarDetalleInsumos_Click(sender As Object, e As EventArgs) - 'DdlProductowsInsumos.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + 'DdlProductowsInsumos.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") If Not DdlProductowsInsumos.UsaWebService Then If DdlRubro.SelectedValue.ToEntero = 2 And DdlProductowsInsumos.SelectedValue.ToEntero <= 0 Then Alert("Debe de seleccionar un producto.", TipoMensaje.MsgAdvertencia) @@ -1833,8 +1833,8 @@ Partial Class Contratos_ContratoObra If DdlRubro.SelectedValue.ToEntero = 1 And DdlProductowsInsumos.txtValue.Value.ToEntero <= 0 Then Alert("Debe de seleccionar un producto.", TipoMensaje.MsgAdvertencia) Exit Sub - End If - + End If + End If If CveContratoDetalleEditar = -1 Then @@ -2033,40 +2033,40 @@ Partial Class Contratos_ContratoObra End If - - - - + + + + End Sub -#Region "GV PRESUPUESTOS" +#Region "GV PRESUPUESTOS" + + Protected Sub GVInsumos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvInsumos.RowDataBound - Protected Sub GVInsumos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvInsumos.RowDataBound - If e.Row.RowIndex > -1 Then If e.Row.DBCampo("CveContratoDetalle") = "" Then e.Row.CssClass = "SubTotales" End If - e.Row.FCCheckBox("CHKPAvance").Visible = Autorizado - 'e.Row.FCCheckBox("CHKPEstimacion").Visible = Autorizado - If UsuarioActual.TienePermisoProceso(124) Then - e.Row.FCCheckBox("CHKPAvance").Enabled = True - End If - - If e.Row.DBCampo("PermitirAvance").ToString = "1" Then - e.Row.FCCheckBox("CHKPAvance").Checked = True - ' If UsuarioActual.TienePermisoProceso(125) Then : e.Row.FCCheckBox("CHKPEstimacion").Enabled = True : End If - End If - - If e.Row.DBCampo("PermitirEstimacion").ToString = "1" Then - ' e.Row.FCCheckBox("CHKPEstimacion").Checked = True - End If - If Autorizado Then - 'e.Row.FCLinkButton("imgE").Visible = False - 'e.Row.FCLinkButton("imgD").Visible = False - End If + e.Row.FCCheckBox("CHKPAvance").Visible = Autorizado + 'e.Row.FCCheckBox("CHKPEstimacion").Visible = Autorizado + If UsuarioActual.TienePermisoProceso(124) Then + e.Row.FCCheckBox("CHKPAvance").Enabled = True + End If + + If e.Row.DBCampo("PermitirAvance").ToString = "1" Then + e.Row.FCCheckBox("CHKPAvance").Checked = True + ' If UsuarioActual.TienePermisoProceso(125) Then : e.Row.FCCheckBox("CHKPEstimacion").Enabled = True : End If + End If + + If e.Row.DBCampo("PermitirEstimacion").ToString = "1" Then + ' e.Row.FCCheckBox("CHKPEstimacion").Checked = True + End If + If Autorizado Then + 'e.Row.FCLinkButton("imgE").Visible = False + 'e.Row.FCLinkButton("imgD").Visible = False + End If If e.Row.FCLabel("LtlLimitarCantidad").Text.ToString = "True" Then e.Row.FCLabel("LtlLimitarCantidad").Text = "Si" Else @@ -2074,282 +2074,282 @@ Partial Class Contratos_ContratoObra End If End If - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("DdlUMEdit").DataBind() - e.Row.FCDropDownList("DdlUMEdit").SelectedValue = e.Row.DataKey("CveUM") - End If - - End Sub - Protected Sub GVInsumos_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvInsumos.RowEditing - GvInsumos.EditIndex = e.NewEditIndex - CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) - End Sub - Protected Sub GvInsumos_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvInsumos.RowUpdating - Dim Cantidad, PU As Double - Dim CvePS, CveContratoDetalle, CveUM As Integer - Dim NoIdentificacion As String = "" - Dim LimitarCantidad As Boolean - - CveContratoDetalle = GvInsumos.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero - Cantidad = GvInsumos.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.Trim.ToDouble - PU = GvInsumos.Rows(e.RowIndex).FCTextBox("TxtPU").Text.Trim.ToDouble - CvePS = GvInsumos.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero - CveUM = GvInsumos.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedValue.ToEntero - NoIdentificacion = GvInsumos.Rows(e.RowIndex).FCTextBox("TxtNoIdentificacion").Text.ToString - LimitarCantidad = GvInsumos.Rows(e.RowIndex).FCCheckBox("ChkLimitarCantidad").Checked - - Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) - - If row("Cantidad").ToString.ToEntero <> Cantidad OrElse row("PU").ToString.ToEntero <> PU OrElse CveUM <> row("CveUM").ToString.ToEntero OrElse row("NoIdentificacion").ToString <> NoIdentificacion OrElse (row("LimitarCantidad").ToString = "True") <> LimitarCantidad Then - - Dim ObjContratos As New ClsContratos - If ObjContratos.UpdateContratosDetalle(CveContratoDetalle, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, NoIdentificacion, LimitarCantidad, "") Then - - If Autorizado Then - Dim msj As String = String.Format("Se realizaron los siguientes cambios, el Presupuesto Interno se modificó: {1} {0} {2:C2} a {3} {0} {4:C2}", - row("PS").ToString, row("Cantidad").ToString, row("PU").ToString, Cantidad, PU) - guardarBitacora(msj) - End If - - row("Cantidad") = Cantidad - row("CantidadContratada") = Cantidad - row("PU") = PU - row("Total") = Cantidad * PU - row("CveUM") = CveUM - row("UM") = GvInsumos.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedItem.Text - row("NoIdentificacion") = NoIdentificacion - row("LimitarCantidad") = LimitarCantidad - TmpDT.AcceptChanges() - Alert("Cambios realizados correctamente.", TipoMensaje.MsgInformacion) - Else - Alert("Error al Actualizar Detalle", TipoMensaje.MsgError) - End If - ObjContratos.Dispose() - - Else - Alert("Cambios realizados correctamente") - End If - - GvInsumos.EditIndex = -1 - LbTotalGeneralInsumos.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1").SUM("Total").FormatoNumero - 'LblImporte.Text = LbTotalGeneral.Text - CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) - - End Sub - Protected Sub GVInsumos_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvInsumos.RowCancelingEdit - GvInsumos.EditIndex = -1 - CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) - End Sub - Protected Sub GVInsumos_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvInsumos.RowDeleting - - Dim ObjContratos As New ClsContratos - Dim DbRow As DataRow = Nothing - Dim CveContratoDetalle As Integer = GvInsumos.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero - DbRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) - If Autorizado Then - Dim msj As String = String.Format("Se eliminaron {0} {1} producto {2} con el precio {3}", DbRow("Cantidad"), DbRow("UM"), DbRow("PS"), DbRow("PU")) - guardarBitacora(msj) - End If - - If ObjContratos.RemoveContratosDetalle(CveContratoDetalle, CveContrato) Then - TmpDT.Rows.Remove(DbRow) - CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) - LbTotalGeneralInsumos.Text = GvInsumos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.FCLabel("LtTotal").Text.ToDouble).ToString.FormatoNumero - Alert("Detalle eliminado eliminado correctamente.") - Else - Alert("Ocurrió un error al eliminar el detalle (Producto/Servicio). Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - ObjContratos.Dispose() - End Sub - Protected Sub GVInsumos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvInsumos.RowCommand - If e.CommandName = "Sel" Then - ' Seleccionado = e.CommandArgument.ToString - GvInsumos.SelectRow(e.CommandArgument.ToString.ToEntero - 1) - End If + If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then + e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) + e.Row.FCDropDownList("DdlUMEdit").DataBind() + e.Row.FCDropDownList("DdlUMEdit").SelectedValue = e.Row.DataKey("CveUM") + End If + End Sub -#End Region + Protected Sub GVInsumos_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvInsumos.RowEditing + GvInsumos.EditIndex = e.NewEditIndex + CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) + End Sub + Protected Sub GvInsumos_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvInsumos.RowUpdating + Dim Cantidad, PU As Double + Dim CvePS, CveContratoDetalle, CveUM As Integer + Dim NoIdentificacion As String = "" + Dim LimitarCantidad As Boolean + + CveContratoDetalle = GvInsumos.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero + Cantidad = GvInsumos.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.Trim.ToDouble + PU = GvInsumos.Rows(e.RowIndex).FCTextBox("TxtPU").Text.Trim.ToDouble + CvePS = GvInsumos.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero + CveUM = GvInsumos.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedValue.ToEntero + NoIdentificacion = GvInsumos.Rows(e.RowIndex).FCTextBox("TxtNoIdentificacion").Text.ToString + LimitarCantidad = GvInsumos.Rows(e.RowIndex).FCCheckBox("ChkLimitarCantidad").Checked + + Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + + If row("Cantidad").ToString.ToEntero <> Cantidad OrElse row("PU").ToString.ToEntero <> PU OrElse CveUM <> row("CveUM").ToString.ToEntero OrElse row("NoIdentificacion").ToString <> NoIdentificacion OrElse (row("LimitarCantidad").ToString = "True") <> LimitarCantidad Then + + Dim ObjContratos As New ClsContratos + If ObjContratos.UpdateContratosDetalle(CveContratoDetalle, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, NoIdentificacion, LimitarCantidad, "") Then + + If Autorizado Then + Dim msj As String = String.Format("Se realizaron los siguientes cambios, el Presupuesto Interno se modificó: {1} {0} {2:C2} a {3} {0} {4:C2}", + row("PS").ToString, row("Cantidad").ToString, row("PU").ToString, Cantidad, PU) + guardarBitacora(msj) + End If + + row("Cantidad") = Cantidad + row("CantidadContratada") = Cantidad + row("PU") = PU + row("Total") = Cantidad * PU + row("CveUM") = CveUM + row("UM") = GvInsumos.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedItem.Text + row("NoIdentificacion") = NoIdentificacion + row("LimitarCantidad") = LimitarCantidad + TmpDT.AcceptChanges() + Alert("Cambios realizados correctamente.", TipoMensaje.MsgInformacion) + Else + Alert("Error al Actualizar Detalle", TipoMensaje.MsgError) + End If + ObjContratos.Dispose() + + Else + Alert("Cambios realizados correctamente") + End If + + GvInsumos.EditIndex = -1 + LbTotalGeneralInsumos.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1").SUM("Total").FormatoNumero + 'LblImporte.Text = LbTotalGeneral.Text + CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) + + End Sub + Protected Sub GVInsumos_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvInsumos.RowCancelingEdit + GvInsumos.EditIndex = -1 + CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) + End Sub + Protected Sub GVInsumos_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvInsumos.RowDeleting + + Dim ObjContratos As New ClsContratos + Dim DbRow As DataRow = Nothing + Dim CveContratoDetalle As Integer = GvInsumos.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero + DbRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + If Autorizado Then + Dim msj As String = String.Format("Se eliminaron {0} {1} producto {2} con el precio {3}", DbRow("Cantidad"), DbRow("UM"), DbRow("PS"), DbRow("PU")) + guardarBitacora(msj) + End If + + If ObjContratos.RemoveContratosDetalle(CveContratoDetalle, CveContrato) Then + TmpDT.Rows.Remove(DbRow) + CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) + LbTotalGeneralInsumos.Text = GvInsumos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.FCLabel("LtTotal").Text.ToDouble).ToString.FormatoNumero + Alert("Detalle eliminado eliminado correctamente.") + Else + Alert("Ocurrió un error al eliminar el detalle (Producto/Servicio). Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + ObjContratos.Dispose() + End Sub + Protected Sub GVInsumos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvInsumos.RowCommand + If e.CommandName = "Sel" Then + ' Seleccionado = e.CommandArgument.ToString + GvInsumos.SelectRow(e.CommandArgument.ToString.ToEntero - 1) + End If + End Sub +#End Region -#End Region +#End Region -#Region " TAB PRESUPUESTOS INTERNOS" +#Region " TAB PRESUPUESTOS INTERNOS" - Protected Sub AgregarInt_Click(sender As Object, e As EventArgs) Handles AgregarInt.Click - Dim Row As DataRow = TmpDT.NewRow() - Row("Cantidad") = TxtCantidadInt.Text.ToDouble.FormatoNumero - Row("CveUM") = DdlUMInt.SelectedValue.ToEntero - Row("UM") = DdlUMInt.SelectedItem - Row("CveClasificacion") = DdlClasificacionInt.SelectedValue - Row("Clasificacion") = DdlClasificacionInt.SelectedItem - Row("CvePS") = HFProductoInt.Value - Row("PS") = HFTProductoInt.Value - Row("PU") = TxtPUInt.Text.ToDouble.FormatoNumero - Row("Total") = (TxtCantidadInt.Text.ToDouble * TxtPUInt.Text.ToDouble).FormatoNumero - Row("CveTipoPresupuesto") = 1 - Row("NoIdentificacion") = "" ' TxtNoIdentificacionv.Text.Trim - Row("LimitarCantidad") = False 'ChkLimitar.Checked <-- Estaba usando un checkbox de un logar muy diferente a donde esta ese formilario, posiblemente se copio codigo y se fue por equivocacion - - Dim ObjContratos As New ClsContratos - If ObjContratos.AddContratosDetalle(CveContrato, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, Row("LimitarCantidad").ToString.ToEntero = 1, "") Then - If Autorizado Then - Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU")) - guardarBitacora(msj) - End If - Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") - TmpDT.Rows.Add(Row) - Dim TotalRow = Row("Total").ToString.ToDouble - GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") - GvInt.DataBind() - - HFProductoInt.Value = "" - HFTProductoInt.Value = "" - TxtCantidadInt.Text = "" - TxtPUInt.Text = "" - DdlClasificacionInt.SelectedValue = "-1" - LbTotalGeneralInt.Text = (LbTotalGeneralInt.Text.ToDouble + TotalRow).ToString.FormatoNumero - TxtCantidad.Focus() - UPGVInt.Update() - Else - 'Alert("No se pudo agregar el detalle") - End If - ObjContratos.Dispose() + Protected Sub AgregarInt_Click(sender As Object, e As EventArgs) Handles AgregarInt.Click + Dim Row As DataRow = TmpDT.NewRow() + Row("Cantidad") = TxtCantidadInt.Text.ToDouble.FormatoNumero + Row("CveUM") = DdlUMInt.SelectedValue.ToEntero + Row("UM") = DdlUMInt.SelectedItem + Row("CveClasificacion") = DdlClasificacionInt.SelectedValue + Row("Clasificacion") = DdlClasificacionInt.SelectedItem + Row("CvePS") = HFProductoInt.Value + Row("PS") = HFTProductoInt.Value + Row("PU") = TxtPUInt.Text.ToDouble.FormatoNumero + Row("Total") = (TxtCantidadInt.Text.ToDouble * TxtPUInt.Text.ToDouble).FormatoNumero + Row("CveTipoPresupuesto") = 1 + Row("NoIdentificacion") = "" ' TxtNoIdentificacionv.Text.Trim + Row("LimitarCantidad") = False 'ChkLimitar.Checked <-- Estaba usando un checkbox de un logar muy diferente a donde esta ese formilario, posiblemente se copio codigo y se fue por equivocacion + + Dim ObjContratos As New ClsContratos + If ObjContratos.AddContratosDetalle(CveContrato, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, Row("LimitarCantidad").ToString.ToEntero = 1, "") Then + If Autorizado Then + Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU")) + guardarBitacora(msj) + End If + Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") + TmpDT.Rows.Add(Row) + Dim TotalRow = Row("Total").ToString.ToDouble + GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") + GvInt.DataBind() + + HFProductoInt.Value = "" + HFTProductoInt.Value = "" + TxtCantidadInt.Text = "" + TxtPUInt.Text = "" + DdlClasificacionInt.SelectedValue = "-1" + LbTotalGeneralInt.Text = (LbTotalGeneralInt.Text.ToDouble + TotalRow).ToString.FormatoNumero + TxtCantidad.Focus() + UPGVInt.Update() + Else + 'Alert("No se pudo agregar el detalle") + End If + ObjContratos.Dispose() End Sub -#Region "GVInternos" +#Region "GVInternos" - Protected Sub GVInt_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvInt.RowEditing - GvInt.EditIndex = e.NewEditIndex - GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") - GvInt.DataBind() - UPGVInt.Update() - End Sub - Protected Sub GvInt_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvInt.RowUpdating - Dim Cantidad, PU As Double : Dim CvePS, CveContratoDetalle, CveUM As Integer - CveContratoDetalle = GvInt.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero - Dim NoIdentificacion As String = "" - Dim LimitarCantidad As Boolean - 'Row("NoIdentificacion") = txtNoIdentificacion.Text.Trim - Cantidad = GvInt.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.Trim.ToDouble - PU = GvInt.Rows(e.RowIndex).FCTextBox("TxtPU").Text.Trim.ToDouble - LimitarCantidad = False - CvePS = GvInt.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero - CveUM = GvInt.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedValue.ToEntero - - 'NoIdentificacion = GvInt.Rows(e.RowIndex).FCDropDownList("NoIdentificacion").ToString - Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) - Dim c1 = row("Cantidad").ToString.ToEntero - Dim p1 = row("PU").ToString.ToEntero - Dim cvum1 = row("CveUM").ToString.ToEntero - If c1 <> Cantidad OrElse p1 <> PU OrElse CveUM <> cvum1 Then - - Dim ObjContratos As New ClsContratos - If ObjContratos.UpdateContratosDetalle(CveContratoDetalle, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, Nothing, LimitarCantidad, "") Then - If Autorizado Then - Dim msj As String = String.Format("Se realizaron los siguientes cambios, el Presupuesto Interno se modificó: {1} {0} {2:C2} a {3} {0} {4:C2}", - row("PS").ToString, row("Cantidad"), row("PU").ToString, Cantidad, PU) - guardarBitacora(msj) - End If - row("Cantidad") = Cantidad - row("PU") = PU - row("Total") = Cantidad * PU - row("CveUM") = CveUM - row("UM") = GvInt.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedItem.Text - Else - End If - ObjContratos.Dispose() - Else - Alert("No realizaste ningun Cambio") - End If - GvInt.EditIndex = -1 - GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") - GvInt.DataBind() - LbTotalGeneralInt.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1").SUM("Total").FormatoNumero - End Sub - Protected Sub GVInt_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvInt.RowCancelingEdit - GvInt.EditIndex = -1 - GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") - GvInt.DataBind() - UPGVInt.Update() - End Sub - Protected Sub GVInt_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvInt.RowDeleting - Dim ObjContratos As New ClsContratos - Dim DbRow As DataRow = Nothing - Dim CveContratoDetalle As Integer = GvInt.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero - - If ObjContratos.RemoveContratosDetalle(CveContratoDetalle, CveContrato) Then - DbRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) - If Autorizado Then - Dim msj As String = String.Format("Se eliminaron {0} {1} {2} con el precio {3:C2}", DbRow("Cantidad"), DbRow("UM"), DbRow("PS"), DbRow("PU")) - guardarBitacora(msj) - End If - TmpDT.Rows.Remove(DbRow) - GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") - GvInt.DataBind() - UPGVInt.Update() - LbTotalGeneralInt.Text = GvInt.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.FCLabel("LtTotal").Text.ToDouble).ToString.FormatoNumero - Else - Alert("Ocurrió un error al eliminar el detalle (Producto/Servicio). Por favor vuelva a intentar", TipoMensaje.MsgAdvertencia) - End If - - ObjContratos.Dispose() - End Sub - Protected Sub GVInt_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvInt.RowCommand - If e.CommandName = "Sel" Then - ' Seleccionado = e.CommandArgument.ToString - GvInt.SelectRow(e.CommandArgument.ToString.ToEntero - 1) - End If + Protected Sub GVInt_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvInt.RowEditing + GvInt.EditIndex = e.NewEditIndex + GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") + GvInt.DataBind() + UPGVInt.Update() End Sub -#End Region + Protected Sub GvInt_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvInt.RowUpdating + Dim Cantidad, PU As Double : Dim CvePS, CveContratoDetalle, CveUM As Integer + CveContratoDetalle = GvInt.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero + Dim NoIdentificacion As String = "" + Dim LimitarCantidad As Boolean + 'Row("NoIdentificacion") = txtNoIdentificacion.Text.Trim + Cantidad = GvInt.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.Trim.ToDouble + PU = GvInt.Rows(e.RowIndex).FCTextBox("TxtPU").Text.Trim.ToDouble + LimitarCantidad = False + CvePS = GvInt.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero + CveUM = GvInt.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedValue.ToEntero -#End Region + 'NoIdentificacion = GvInt.Rows(e.RowIndex).FCDropDownList("NoIdentificacion").ToString + Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + Dim c1 = row("Cantidad").ToString.ToEntero + Dim p1 = row("PU").ToString.ToEntero + Dim cvum1 = row("CveUM").ToString.ToEntero + If c1 <> Cantidad OrElse p1 <> PU OrElse CveUM <> cvum1 Then -#End Region + Dim ObjContratos As New ClsContratos + If ObjContratos.UpdateContratosDetalle(CveContratoDetalle, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, Nothing, LimitarCantidad, "") Then + If Autorizado Then + Dim msj As String = String.Format("Se realizaron los siguientes cambios, el Presupuesto Interno se modificó: {1} {0} {2:C2} a {3} {0} {4:C2}", + row("PS").ToString, row("Cantidad"), row("PU").ToString, Cantidad, PU) + guardarBitacora(msj) + End If + row("Cantidad") = Cantidad + row("PU") = PU + row("Total") = Cantidad * PU + row("CveUM") = CveUM + row("UM") = GvInt.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedItem.Text + Else + End If + ObjContratos.Dispose() + Else + Alert("No realizaste ningun Cambio") + End If + GvInt.EditIndex = -1 + GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") + GvInt.DataBind() + LbTotalGeneralInt.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1").SUM("Total").FormatoNumero + End Sub + Protected Sub GVInt_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvInt.RowCancelingEdit + GvInt.EditIndex = -1 + GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") + GvInt.DataBind() + UPGVInt.Update() + End Sub + Protected Sub GVInt_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvInt.RowDeleting + Dim ObjContratos As New ClsContratos + Dim DbRow As DataRow = Nothing + Dim CveContratoDetalle As Integer = GvInt.Rows(e.RowIndex).DataKey("CveContratoDetalle").ToString.ToEntero -#Region " TAB: REPORTE AVANCES " - Private Sub CargaDatosAvance() - If CveContrato <= 0 Then - Exit Sub - End If - - TabReporteAvance.Visible = True - 'lbImprimirAvance.Visible = True - - Dim Modalidad = IfNull(Request("Tipo"), 1, 2) - - If Modalidad.ToString.ToEntero = 2 Then - TAB.ActiveTabIndex = 2 - End If - - Dim ObjContratos As New ClsContratos - - If ObjContratos.GetReporteContratosObraAvancesDetalle(CveContrato, UsuarioActual.CveEmpresa) Then - GvDatosAvance.DataSource = ObjContratos.DtResultados - SumaAvance = ObjContratos.DtResultados.SUM("AvanceImporte", "CveClasificacion IS NULL") - SumaUtilidad = ObjContratos.DtResultados.SUM("AvanceUtilidad", "CveClasificacion IS NULL") - DtAvance = ObjContratos.DtResultados - Else - Alert("Ocurrió un Error al obtener el Reporte de Avances. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - 'ObjContratos.Dispose() - GvDatosAvance.DataBind() - - If (GvDatosAvance.Rows.Count > 0) Then - GvDatosAvance.UseAccessibleHeader = True - GvDatosAvance.HeaderRow.TableSection = TableRowSection.TableHeader - RegistraScript("OrdenarGV();") + If ObjContratos.RemoveContratosDetalle(CveContratoDetalle, CveContrato) Then + DbRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + If Autorizado Then + Dim msj As String = String.Format("Se eliminaron {0} {1} {2} con el precio {3:C2}", DbRow("Cantidad"), DbRow("UM"), DbRow("PS"), DbRow("PU")) + guardarBitacora(msj) + End If + TmpDT.Rows.Remove(DbRow) + GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") + GvInt.DataBind() + UPGVInt.Update() + LbTotalGeneralInt.Text = GvInt.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.FCLabel("LtTotal").Text.ToDouble).ToString.FormatoNumero + Else + Alert("Ocurrió un error al eliminar el detalle (Producto/Servicio). Por favor vuelva a intentar", TipoMensaje.MsgAdvertencia) + End If + + ObjContratos.Dispose() + End Sub + Protected Sub GVInt_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvInt.RowCommand + If e.CommandName = "Sel" Then + ' Seleccionado = e.CommandArgument.ToString + GvInt.SelectRow(e.CommandArgument.ToString.ToEntero - 1) + End If + End Sub +#End Region + +#End Region + +#End Region + +#Region " TAB: REPORTE AVANCES " + Private Sub CargaDatosAvance() + If CveContrato <= 0 Then + Exit Sub + End If + + TabReporteAvance.Visible = True + 'lbImprimirAvance.Visible = True + + Dim Modalidad = IfNull(Request("Tipo"), 1, 2) + + If Modalidad.ToString.ToEntero = 2 Then + TAB.ActiveTabIndex = 2 + End If + + Dim ObjContratos As New ClsContratos + + If ObjContratos.GetReporteContratosObraAvancesDetalle(CveContrato, UsuarioActual.CveEmpresa) Then + GvDatosAvance.DataSource = ObjContratos.DtResultados + SumaAvance = ObjContratos.DtResultados.SUM("AvanceImporte", "CveClasificacion IS NULL") + SumaUtilidad = ObjContratos.DtResultados.SUM("AvanceUtilidad", "CveClasificacion IS NULL") + DtAvance = ObjContratos.DtResultados + Else + Alert("Ocurrió un Error al obtener el Reporte de Avances. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + 'ObjContratos.Dispose() + GvDatosAvance.DataBind() + + If (GvDatosAvance.Rows.Count > 0) Then + GvDatosAvance.UseAccessibleHeader = True + GvDatosAvance.HeaderRow.TableSection = TableRowSection.TableHeader + RegistraScript("OrdenarGV();") End If If ObjContratos.GetReporteContratosAvancesDetalleControl(CveContrato, UsuarioActual.CveEmpresa) Then GvDatosAvanceControl.DataSource = ObjContratos.DtResultados - Else - Alert("Ocurrió un Error al obtener el Reporte de Avances de control. Por favor vuelva a intentar", TipoMensaje.MsgError) + Else + Alert("Ocurrió un Error al obtener el Reporte de Avances de control. Por favor vuelva a intentar", TipoMensaje.MsgError) End If @@ -2358,50 +2358,50 @@ Partial Class Contratos_ContratoObra ObjContratos.Dispose() UpGral.Update() - End Sub - - Protected Sub GvDatosAvance_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAvance.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.DBCampo("CveClasificacion").ToString.ToEntero = 0 Then - e.Row.CssClass = "Totales white" - ElseIf e.Row.DBCampo("CvePS").ToString.ToEntero = 0 Then - e.Row.CssClass = "SubTotales" - End If - - Dim Liga1 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|1" - e.Row.FCLinkButton("LBAvanceCantidad").CommandArgument = Liga1 - e.Row.FCLinkButton("LBAvanceImporte").CommandArgument = Liga1 - - Dim Liga2 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|2" - e.Row.FCLinkButton("LBAvanceXFacturarCantidad").CommandArgument = Liga2 - e.Row.FCLinkButton("LBAvanceXFacturarImporte").CommandArgument = Liga2 - - End If + End Sub + + Protected Sub GvDatosAvance_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAvance.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveClasificacion").ToString.ToEntero = 0 Then + e.Row.CssClass = "Totales white" + ElseIf e.Row.DBCampo("CvePS").ToString.ToEntero = 0 Then + e.Row.CssClass = "SubTotales" + End If + + Dim Liga1 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|1" + e.Row.FCLinkButton("LBAvanceCantidad").CommandArgument = Liga1 + e.Row.FCLinkButton("LBAvanceImporte").CommandArgument = Liga1 + + Dim Liga2 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|2" + e.Row.FCLinkButton("LBAvanceXFacturarCantidad").CommandArgument = Liga2 + e.Row.FCLinkButton("LBAvanceXFacturarImporte").CommandArgument = Liga2 + + End If End Sub Protected Sub GvDatosAvanceControl_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAvanceControl.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.DBCampo("CveClasificacion").ToString.ToEntero = 0 Then - e.Row.CssClass = "Totales white" - ElseIf e.Row.DBCampo("CveContratoDetalle").ToString.Length = 0 And e.Row.DBCampo("CveClasificacion").ToString.ToEntero <> 0 Then - e.Row.CssClass = "SubTotales" - End If - - 'Dim Liga1 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|1" - 'e.Row.FCLinkButton("LBAvanceCantidad").CommandArgument = Liga1 - 'e.Row.FCLinkButton("LBAvanceImporte").CommandArgument = Liga1 - - 'Dim Liga2 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|2" - 'e.Row.FCLinkButton("LBAvanceXFacturarCantidad").CommandArgument = Liga2 - 'e.Row.FCLinkButton("LBAvanceXFacturarImporte").CommandArgument = Liga2 - - End If - End Sub - + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveClasificacion").ToString.ToEntero = 0 Then + e.Row.CssClass = "Totales white" + ElseIf e.Row.DBCampo("CveContratoDetalle").ToString.Length = 0 And e.Row.DBCampo("CveClasificacion").ToString.ToEntero <> 0 Then + e.Row.CssClass = "SubTotales" + End If + + 'Dim Liga1 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|1" + 'e.Row.FCLinkButton("LBAvanceCantidad").CommandArgument = Liga1 + 'e.Row.FCLinkButton("LBAvanceImporte").CommandArgument = Liga1 + + 'Dim Liga2 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|2" + 'e.Row.FCLinkButton("LBAvanceXFacturarCantidad").CommandArgument = Liga2 + 'e.Row.FCLinkButton("LBAvanceXFacturarImporte").CommandArgument = Liga2 + + End If + End Sub + Protected Sub MuestaModalVentasAvance(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow) @@ -2420,25 +2420,25 @@ Partial Class Contratos_ContratoObra Dim CodigoPS As String = GvRow.DataKey("CodigoPS") Dim Clasificacion As String = GvRow.DataKey("Clasificacion") - Dim ObjContratos As New ClsContratos - - If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 1, -1, UsuarioActual.CveEmpresa) Then - GvDatosVentasAvance.DataSource = ObjContratos.DtResultados - RegistraScript("$('#ModalVentasAvance').modal('show');RecargaAvances = true;") - Else - Alert("Ocurrió un error al obtener el Listado de Ventas de Avance. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - ObjContratos.Dispose() + Dim ObjContratos As New ClsContratos + + If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 1, -1, UsuarioActual.CveEmpresa) Then + GvDatosVentasAvance.DataSource = ObjContratos.DtResultados + RegistraScript("$('#ModalVentasAvance').modal('show');RecargaAvances = true;") + Else + Alert("Ocurrió un error al obtener el Listado de Ventas de Avance. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + ObjContratos.Dispose() GvDatosVentasAvance.DataBind() LbTituloModalVentasAvance.Text = "Ventas de Avance" - LbClasificacionVentasAvance.Text = Clasificacion - LbPSVentasAvance.Text = CodigoPS - - UpVentasAvance.Update() - + LbClasificacionVentasAvance.Text = Clasificacion + LbPSVentasAvance.Text = CodigoPS + + UpVentasAvance.Update() + End Sub @@ -2468,8 +2468,8 @@ Partial Class Contratos_ContratoObra GvDatosVentasAvanceInternoMaquinaria.Visible = False End If - Dim ObjContratos As New ClsContratos - + Dim ObjContratos As New ClsContratos + If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 2, CveRubro, UsuarioActual.CveEmpresa) Then If CveRubro = 3 Then @@ -2478,13 +2478,13 @@ Partial Class Contratos_ContratoObra GvDatosVentasAvanceInternoMaquinaria.DataSource = ObjContratos.DtResultados Else GvDatosVentasAvanceInterno.DataSource = ObjContratos.DtResultados - End If - - RegistraScript("$('#ModalVentasAvance').modal('show');RecargaAvances = true;") - Else - Alert("Ocurrió un error al obtener el Listado de Ventas de Avance. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - + End If + + RegistraScript("$('#ModalVentasAvance').modal('show');RecargaAvances = true;") + Else + Alert("Ocurrió un error al obtener el Listado de Ventas de Avance. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + ObjContratos.Dispose() If CveRubro = 3 Then @@ -2498,609 +2498,609 @@ Partial Class Contratos_ContratoObra LbTituloModalVentasAvance.Text = "Compras de Avance" - LbClasificacionVentasAvance.Text = Clasificacion - LbPSVentasAvance.Text = CodigoPS - - UpVentasAvance.Update() - + LbClasificacionVentasAvance.Text = Clasificacion + LbPSVentasAvance.Text = CodigoPS + + UpVentasAvance.Update() + End Sub -#End Region +#End Region -#Region " TAB: REPORTE AVANCES POR DOCUMENTO " - Protected Sub RBLTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaDatosAvancePorDocumento() - End Sub - Private Sub CargaDatosAvancePorDocumento() - If CveContrato <= 0 Then - Exit Sub - End If - - Dim ObjContratos As New ClsContratos - - If ObjContratos.GetContratosAvancePorDocumento(CveContrato, RBLTipoDocto.SelectedValue, UsuarioActual.CveEmpresa) Then - GVAvanceXDocumento.DataSource = ObjContratos.DtResultados - DtAvanceDocumento = ObjContratos.DtResultados - If DtAvanceDocumento.Rows.Count > 0 Then - 'LBImprimir.Visible = True +#Region " TAB: REPORTE AVANCES POR DOCUMENTO " + Protected Sub RBLTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaDatosAvancePorDocumento() + End Sub + Private Sub CargaDatosAvancePorDocumento() + If CveContrato <= 0 Then + Exit Sub + End If + + Dim ObjContratos As New ClsContratos + + If ObjContratos.GetContratosAvancePorDocumento(CveContrato, RBLTipoDocto.SelectedValue, UsuarioActual.CveEmpresa) Then + GVAvanceXDocumento.DataSource = ObjContratos.DtResultados + DtAvanceDocumento = ObjContratos.DtResultados + If DtAvanceDocumento.Rows.Count > 0 Then + 'LBImprimir.Visible = True End If ' LBImprimirInformacionG.Visible = True - Else - Alert("Ocurrió un error al obtener el Reporte de Avances por Documento. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - ObjContratos.Dispose() - GVAvanceXDocumento.DataBind() - - If (GVAvanceXDocumento.Rows.Count > 0) Then - GVAvanceXDocumento.UseAccessibleHeader = True - GVAvanceXDocumento.HeaderRow.TableSection = TableRowSection.TableHeader - RegistraScript("OrdenarGVPorDocumento();") - End If - - UpGral.Update() - End Sub - - Private Sub GVAvanceXDocumento_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVAvanceXDocumento.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If Not e.Row.DBCampo("CveVenta").ToEntero > 0 Then - e.Row.Cells(2).Text = "TOTAL: " - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(0).Text = e.Row.DBCampo("Cantidad").FormatoNumero(0) - e.Row.CssClass = "Totales" - End If - End If + Else + Alert("Ocurrió un error al obtener el Reporte de Avances por Documento. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + ObjContratos.Dispose() + GVAvanceXDocumento.DataBind() + + If (GVAvanceXDocumento.Rows.Count > 0) Then + GVAvanceXDocumento.UseAccessibleHeader = True + GVAvanceXDocumento.HeaderRow.TableSection = TableRowSection.TableHeader + RegistraScript("OrdenarGVPorDocumento();") + End If + + UpGral.Update() End Sub -#End Region - -#Region " TAB: CONTRATO GASTOS " - Private Sub MandaCorreo(Para As String, Asunto As String, Body As String) - Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) - Dim Mail As New ClsSisMail() - Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) - End Sub - Protected Sub EnvioCorreo(Dr As DataRow) - Dim Body As String = GeneraCorreoContratoGasto(Dr) - Dim Asunto As String = $"Se agrego un gasto en el {LtlTitulo.Text}" - Dim Correo As String = "" - If UsuarioActual.CveEmpresa = 72 Then - Correo = "anamartinez@compuproveedores.com;benjamincarrillo@compuproveedores.com" - Else - Correo = "signotificaciones@adssistemas.mx" - End If - Try - Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Correo, Asunto, Body)) - Hilo.Start() - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - End Try - End Sub - Public Function GeneraCorreoContratoGasto(Dr As DataRow) As String - Dim strBody As New StringBuilder - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append("
") - strBody.AppendFormat("
Datos {0} ", "del contrato") - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Dr("DescripcionContrato").ToString) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Dr("NombreComercial").ToString) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Dr("Monto").ToString.FormatoNumero) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Dr("SubProyectoContrato")) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Dr("FechaInicial")) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Dr("FechaFinal")) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Dr("ContratoAvance").ToString.FormatoNumero) - strBody.Append(" ") - strBody.Append("
No. Contrato: " + Dr("NumeroContrato").ToString + "
Descripcion:{0}  
Cliente:{0}  
Monto Adjudicado:{0}  
SubProyecto:{0}  
Fecha Inicio:{0}  
Fecha Final:{0}  
Avance:{0}%  
") - strBody.Append("
") - strBody.Append("
") - strBody.AppendFormat("
Datos {0} ", "del gasto") - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", TxtDescripcion.Text) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", TxtImporteC.Text.FormatoNumero) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", TxtFecha.Text.ToDate.ToShortDateString) - strBody.Append(" ") - strBody.Append("
Descripción:{0}  
Importe:{0}  
Fecha:{0}  
") - strBody.Append("
") - strBody.Append("
") - strBody.Append("
") - strBody.AppendFormat(" Ir al contrato ", "http://sig.adssistemas.mx/", CveContrato) - strBody.Append("
") - strBody.Append("") - Return strBody.ToString - End Function - - Protected Sub LBAgregar_Click(sender As Object, e As EventArgs) Handles LBAgregar.Click - Dim ObjContrato As New ClsContratos - If ObjContrato.AddContratoGasto(CveContrato, TxtDescripcion.Text, TxtImporteC.Text.ToDecimal, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario) Then - MensajeAlert = New StringBuilder - MensajeAlert.AppendFormat("El Gasto del contrato se guardó correctamente.") - MensajeAlert.AppendFormat("

", Encripta(String.Format("OP=CONG&CVECONTRATO={0}&CVECONTRATOGASTO={1}", CveContrato, ObjContrato.CveContratoGasto))) - If ObjContrato.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then - If ObjContrato.DtResultados.Rows.Count > 0 Then - EnvioCorreo(ObjContrato.DtResultados.Rows(0)) - End If - End If - TxtDescripcion.Text = "" - TxtImporteC.Text = "" - TxtFecha.Text = "" - Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion) - CargaGVGastos() - RegistraScript("$('#ModalAgregarGastos').modal('hide');") - MensajeAlert = Nothing - End If - ObjContrato.Dispose() - End Sub - - Private Sub CargaGVGastos() - Dim objContrato As New ClsContratos - If objContrato.GetContratoGastos(CveContrato) Then - DtGastos = objContrato.DtResultados - GvContratosGastos.DataSource = DtGastos - SumaGasto = objContrato.DtResultados.SUM("Importe", "CveContratoGasto IS NULL") - Else - GvContratosGastos.DataSource = Nothing - End If - objContrato.Dispose() - GvContratosGastos.DataBind() - - If GvContratosGastos.Rows.Count > 0 Then - GvContratosGastos.HeaderRow.CssClass = "SinColor" - 'LBImprimirGastos.Visible = True - End If - - UpContratoGasto.Update() - End Sub - - Protected Sub GvContratoGastos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvContratosGastos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Or e.Row.DBCampo("CveVenta").ToString.ToEntero > 0 Then - If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then e.Row.CssClass = "SubTotales" : e.Row.Cells(0).Text = e.Row.DBCampo("Cantidad").FormatoNumero(0) - e.Row.FCLinkButton("imgE").Visible = False - e.Row.FCLinkButton("imgD").Visible = False - e.Row.FCLinkButton("LnkDescargar").Visible = False - Else - Dim lb As LinkButton = CType(e.Row.FindControl("LnkDescargar"), LinkButton) - ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(lb) - End If - End If - End Sub - - Protected Sub GvContratoGastos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvContratosGastos.RowDeleting - Dim objContrato As New ClsContratos - If objContrato.RemoveContratoGasto(GvContratosGastos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - GvContratosGastos.EditIndex = -1 - Alert("Se eliminó correctamente el gasto del contrato") - CargaGVGastos() - End If - objContrato.Dispose() - End Sub - - Protected Sub GvContratosGastos_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles GvContratosGastos.RowEditing - GvContratosGastos.EditIndex = e.NewEditIndex - CargaGVGastos() - End Sub - - Protected Sub GvContratosGastos_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GvContratosGastos.RowUpdating - Dim objContrato As New ClsContratos - - Dim CveContratoGasto As Integer = GvContratosGastos.DataKeys(e.RowIndex).Value.ToString.ToEntero - Dim Observaciones As String = GvContratosGastos.Rows(e.RowIndex).FCTextBox("TxtDescripcion").Text.Trim - Dim Importe As Decimal = GvContratosGastos.Rows(e.RowIndex).FCTextBox("TxtImporteC").Text.Trim.ToDecimal - Dim Fecha As Date = GvContratosGastos.Rows(e.RowIndex).FCTextBox("TxtFecha").Text.Trim.ToDate - - If objContrato.UpdateContratoGasto(CveContratoGasto, Observaciones, Importe, Fecha, UsuarioActual.CveUsuario) Then - GvContratosGastos.EditIndex = -1 - CargaGVGastos() - End If - objContrato.Dispose() - End Sub - Protected Sub GvContratosGastos_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvContratosGastos.RowCancelingEdit - GvContratosGastos.EditIndex = -1 - CargaGVGastos() - End Sub - - Protected Sub LnkDescargar_Click1(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=CONG&CVECONTRATO={0}&CVECONTRATOGASTO={1}", CveContrato, gvRow.DataKey("CveContratoGasto").ToString))}'") - End Sub -#End Region - -#Region "TAB: PEDIDOS / DEVOLUCIONES" - Private Sub CargaDatosPedDev() - Dim ObjContratos As New ClsContratos - If ObjContratos.GetRepDevolucionesPedidos(Me.CveContrato, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then - DsDatosPedDev = ObjContratos.DsResultados - - GvPedidos.DataSource = DsDatosPedDev.Tables(0) - GvDevs.DataSource = DsDatosPedDev.Tables(1) - End If - ObjContratos.Dispose() - - GvPedidos.DataBind() - GvDevs.DataBind() - - UpPedidosDevoluciones.Update() - End Sub - 'Protected Sub ImgExcelPedDev_Click(sender As Object, e As EventArgs) Handles LbImprimirPedDevExcel.Click - ' GenerarPDFPedDev("Excel") - 'End Sub - 'Protected Sub ImgImprimirPedDev_Click(sender As Object, e As EventArgs) Handles LbImprimirPedDev.Click - ' GenerarPDFPedDev() - 'End Sub - Private Sub GenerarPDFPedDev(Optional Formato As String = "PDF") - If DsDatosPedDev Is Nothing Then - Alert("No se pudieron consultar los pedidos y devoluciones", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - Dim params As New List(Of ReportParameter) - - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("FechaInicio", "-1")) - params.Add(New ReportParameter("FechaFin", "-1")) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Contrato", Me.Titulo)) - params.Add(New ReportParameter("Estatus", "")) - params.Add(New ReportParameter("Tipo", "-1")) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - - Dim lrds As New List(Of ReportDataSource) - lrds.Add(New ReportDataSource("DataSet1", DsDatosPedDev.Tables(0))) - lrds.Add(New ReportDataSource("DataSet2", DsDatosPedDev.Tables(1))) - - ImprimirPDF("Empresas/Grales/Formatos/RepPedDevolucionesXContrato.rdlc", lrds, params, "ReportePedidosDevoluciones", Formato) - - End Sub - - Protected Sub GvPedidos_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - - 'CABECERA - If e.Row.DBCampo("CodigoPS") = "" Then - e.Row.CssClass = "SubTotales2" - e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;") - e.Row.Cells(0).Text = "" - e.Row.Cells(4).Text = "" - e.Row.Cells(5).Text = "" - - Dim Texto = $"Pedido: {e.Row.DBCampo("SerieFolio")} | " - Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") - - e.Row.Cells(0).ColumnSpan = 2 - e.Row.Cells(1).Visible = False - e.Row.Cells(0).Text = Texto - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - Else - - If e.Row.DBCampo("CveMovimiento").ToString = "" Then - e.Row.Cells(1).Text = "SIN MOVIMIENTO DE ALMACÉN" - End If - - End If - End If - End Sub - Protected Sub GvDevs_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - - 'CABECERA - If e.Row.DBCampo("CodigoPS") = "" Then - e.Row.CssClass = "SubTotales2" - e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;") - e.Row.Cells(0).Text = "" - e.Row.Cells(4).Text = "" - e.Row.Cells(5).Text = "" - - Dim Texto = $"Devolución: {e.Row.DBCampo("SerieFolio")} | " - Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") - - e.Row.Cells(0).ColumnSpan = 2 - e.Row.Cells(1).Visible = False - e.Row.Cells(0).Text = Texto - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - Else - - If e.Row.DBCampo("CveMovimiento").ToString = "" Then - e.Row.Cells(1).Text = "SIN MOVIMIENTO DE ALMACÉN" - End If - - End If - End If + Private Sub GVAvanceXDocumento_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVAvanceXDocumento.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If Not e.Row.DBCampo("CveVenta").ToEntero > 0 Then + e.Row.Cells(2).Text = "TOTAL: " + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(0).Text = e.Row.DBCampo("Cantidad").FormatoNumero(0) + e.Row.CssClass = "Totales" + End If + End If End Sub -#End Region +#End Region -#Region " TAB: ALMACEN - ACTIVOS FIJBtnAlmacenEsInterno_ClickOS " - Private Sub CargaInventarios() - - Dim ObjInventarios As New ClsInventarios - 'cargar también los movimentos detalle - If ObjInventarios.GetMovimientosDetalleContrato(CveContrato, UsuarioActual.CveEmpresa, DdlEsinternoExternoFiltro.SelectedValue.ToEntero) Then - DtMovimientos = ObjInventarios.DtResultados - Else - Alert("Ocurrió un error al cargar la información de los Activos Fijos. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - ObjInventarios.Dispose() - - If DtMovimientos.Rows.Count > 0 Then - CargaGVDatosInventarios() - CargaDatosPedDev() - 'BtnDevolucionAlmacen.Visible = True - CveMovimientoDevolucion = -1 - If CveMovimientoDevolucion > 0 Then - HLSurtirAF.Visible = False - BtnDevolucionAlmacen.Visible = False - End If - Else - DivSinRegistrosAlmacen.Visible = True - GvDatosAlmacen.DataSource = Nothing - GvDatosAlmacen.DataBind() - - End If - - 'CARGA MODALIDAD ALMACEN - If TipoContrato.Contiene(8, 17) Then ' cuando es consignacion - HLSurtirAF.Visible = False - HLSurtirMercancia.NavigateUrl = $"/Ventas/Ventas.aspx?CveContrato={CveContrato}&Tipo=1" - Else - HLSurtirMercancia.Visible = False - HLSurtirAF.NavigateUrl = $"/Ventas/Ventas.aspx?CveContrato={CveContrato}&Tipo=0" - End If - - UpAlmacen.Update() - - End Sub - - Protected Sub RBLAlmacen_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaGVDatosInventarios() - End Sub - Private Sub CargaGVDatosInventarios() - Select Case RBLAlmacen.SelectedValue - Case "-1" - GvDatosAlmacen.DataSource = DtMovimientos - Actualiza(DtMovimientos) - Case "Vig" - GvDatosAlmacen.DataSource = DtMovimientos.FiltraParametros($"(CodigoPS IS NULL AND Cantidad - CantidadDevolucion > 0) OR (CodigoPS IS NOT NULL AND SerieFolioDevolucion IS NULL)") - Actualiza(DtMovimientos.FiltraParametros($"(CodigoPS IS NULL AND Cantidad - CantidadDevolucion > 0) OR (CodigoPS IS NOT NULL AND SerieFolioDevolucion IS NULL)")) - Case "Dev" - GvDatosAlmacen.DataSource = DtMovimientos.FiltraParametros($"SerieFolioDevolucion IS NOT NULL") - Actualiza(DtMovimientos.FiltraParametros($"SerieFolioDevolucion IS NOT NULL")) - Case Else - End Select - GvDatosAlmacen.DataBind() - End Sub - - Public Sub Actualiza(DT As DataTable) - - LblAFInternos.Text = DT.SUM("Cantidad", "CveMovimientoDetalle > 0 AND EsInterno = 1 ").ToString - LblAFExternos.Text = DT.SUM("Cantidad", "CveMovimientoDetalle > 0 AND (EsInterno = 0 OR EsInterno IS NULL)").ToString - - 'Dim ValorAF = DT.SUM("ValorImporte", "CveMovimientoDetalle > 0 AND TipoDocto = 'Ped'") - DT.SUM("ValorImporte", "TipoDocto = 'DPe'") - - LBLAFValorActivo.Text = DT.SUM("ValorImporte", "CveMovimientoDetalle > 0").ToString("###,###,###.00") - - Dim Total = DT.SUM("Cantidad", "CveMovimientoDetalle > 0 AND TipoDocto = 'Ped'") - DT.SUM("Cantidad", "TipoDocto = 'DPe'") - - LBLAFTotal.Text = DT.SUM("Cantidad", "CveMovimientoDetalle > 0").ToString() - UPAFResumen.Update() - - End Sub - Protected Sub GvDatosAlmacen_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAlmacen.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - 'CABECERA - If e.Row.DBCampo("CodigoPS") = "" Then - e.Row.CssClass = "SubTotales2" - e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;") - e.Row.Cells(0).Text = "" - e.Row.Cells(4).Text = "" - e.Row.Cells(5).Text = "" - - Dim Texto = $"{If(e.Row.DBCampo("TipoDocto") = "Ped", "Pedido", "Devolución") }: {e.Row.DBCampo("SerieFolio")} | " - Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") - - - e.Row.Cells(0).ColumnSpan = 2 - e.Row.Cells(1).Visible = False - 'e.Row.Cells(2).Visible = False - e.Row.Cells(0).Text = Texto - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - - If e.Row.DBCampo("TipoDocto") = "Ped" Then - If e.Row.DBCampo("Cantidad").ToDecimal - e.Row.DBCampo("CantidadDevolucion").ToDecimal > 0 Then - e.Row.Cells(9).Text = If(e.Row.DBCampo("CveMovimiento").ToString = "", "", $" Solicitud de devolución de pedido") - Else - e.Row.Cells(9).Text = "" - End If - End If - - Else - If e.Row.DBCampo("CveMovimiento").ToString = "" Then - e.Row.Cells(1).Text = "SIN MOVIMIENTO DE ALMACÉN" - End If - If e.Row.DBCampo("TipoDocto") = "Ped" Then - If e.Row.DBCampo("Cantidad").ToDecimal - e.Row.DBCampo("CantidadDevolucion").ToDecimal > 0 Then - e.Row.Cells(9).Text = If(e.Row.DBCampo("CveMovimiento").ToString = "", "", $" Solicitud de devolución de pedido") - End If - End If - - - e.Row.FCCheckBox("ChkEsInterno").Visible = True - - End If - - 'If e.Row.DBCampo("SerieLote").ToString = "-1" Then - ' e.Row.Cells(7).Text = "" - 'End If - End If - End Sub - - Private Sub BtnFiltraInternosExternos_Click(sender As Object, e As EventArgs) Handles BtnFiltraInternosExternos.Click - CargaInventarios() - End Sub - - - Protected Sub BtnAlmacenEsInterno_Click(sender As Object, e As EventArgs) - - Dim ObjInv As New ClsInventarios() - - For Each GRow As GridViewRow In GvDatosAlmacen.Rows - Dim CveMovimientoDetalle As Integer = GRow.DataKey("CveMovimientoDetalle").ToEntero - Dim ChkEsInterno = GRow.FCCheckBox("ChkEsInterno") - - If CveMovimientoDetalle > 0 And ChkEsInterno.Checked And DdlEsInterno.SelectedValue.ToEntero > 0 Then - Dim EsInterno As Boolean - - Select Case DdlEsInterno.SelectedValue.ToEntero - Case 1 - EsInterno = True - Case 2 - EsInterno = False - End Select - - If Not (ObjInv.UpdateMovimientoDetalleEsInterno(UsuarioActual.CveEmpresa, CveMovimientoDetalle, EsInterno)) Then - Exit For - End If - - End If - Next - - ObjInv.Dispose() - - 'LnkAjusteAF.Visible = True - DivHajusteAF.Visible = False - GvDatosAlmacen.Columns(6).Visible = False - - CargaInventarios() +#Region " TAB: CONTRATO GASTOS " + Private Sub MandaCorreo(Para As String, Asunto As String, Body As String) + Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) + Dim Mail As New ClsSisMail() + Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) + End Sub + Protected Sub EnvioCorreo(Dr As DataRow) + Dim Body As String = GeneraCorreoContratoGasto(Dr) + Dim Asunto As String = $"Se agrego un gasto en el {LtlTitulo.Text}" + Dim Correo As String = "" + If UsuarioActual.CveEmpresa = 72 Then + Correo = "anamartinez@compuproveedores.com;benjamincarrillo@compuproveedores.com" + Else + Correo = "signotificaciones@adssistemas.mx" + End If + Try + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Correo, Asunto, Body)) + Hilo.Start() + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + Public Function GeneraCorreoContratoGasto(Dr As DataRow) As String + Dim strBody As New StringBuilder + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append("
") + strBody.AppendFormat("
Datos {0} ", "del contrato") + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", Dr("DescripcionContrato").ToString) + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", Dr("NombreComercial").ToString) + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", Dr("Monto").ToString.FormatoNumero) + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", Dr("SubProyectoContrato")) + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", Dr("FechaInicial")) + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", Dr("FechaFinal")) + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", Dr("ContratoAvance").ToString.FormatoNumero) + strBody.Append(" ") + strBody.Append("
No. Contrato: " + Dr("NumeroContrato").ToString + "
Descripcion:{0}  
Cliente:{0}  
Monto Adjudicado:{0}  
SubProyecto:{0}  
Fecha Inicio:{0}  
Fecha Final:{0}  
Avance:{0}%  
") + strBody.Append("
") + strBody.Append("
") + strBody.AppendFormat("
Datos {0} ", "del gasto") + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", TxtDescripcion.Text) + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", TxtImporteC.Text.FormatoNumero) + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat(" ", TxtFecha.Text.ToDate.ToShortDateString) + strBody.Append(" ") + strBody.Append("
Descripción:{0}  
Importe:{0}  
Fecha:{0}  
") + strBody.Append("
") + strBody.Append("
") + strBody.Append("
") + strBody.AppendFormat(" Ir al contrato ", "http://sig.adssistemas.mx/", CveContrato) + strBody.Append("
") + strBody.Append("") + Return strBody.ToString + End Function + + Protected Sub LBAgregar_Click(sender As Object, e As EventArgs) Handles LBAgregar.Click + Dim ObjContrato As New ClsContratos + If ObjContrato.AddContratoGasto(CveContrato, TxtDescripcion.Text, TxtImporteC.Text.ToDecimal, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + MensajeAlert = New StringBuilder + MensajeAlert.AppendFormat("El Gasto del contrato se guardó correctamente.") + MensajeAlert.AppendFormat("

", Encripta(String.Format("OP=CONG&CVECONTRATO={0}&CVECONTRATOGASTO={1}", CveContrato, ObjContrato.CveContratoGasto))) + If ObjContrato.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then + If ObjContrato.DtResultados.Rows.Count > 0 Then + EnvioCorreo(ObjContrato.DtResultados.Rows(0)) + End If + End If + TxtDescripcion.Text = "" + TxtImporteC.Text = "" + TxtFecha.Text = "" + Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion) + CargaGVGastos() + RegistraScript("$('#ModalAgregarGastos').modal('hide');") + MensajeAlert = Nothing + End If + ObjContrato.Dispose() + End Sub + + Private Sub CargaGVGastos() + Dim objContrato As New ClsContratos + If objContrato.GetContratoGastos(CveContrato) Then + DtGastos = objContrato.DtResultados + GvContratosGastos.DataSource = DtGastos + SumaGasto = objContrato.DtResultados.SUM("Importe", "CveContratoGasto IS NULL") + Else + GvContratosGastos.DataSource = Nothing + End If + objContrato.Dispose() + GvContratosGastos.DataBind() + + If GvContratosGastos.Rows.Count > 0 Then + GvContratosGastos.HeaderRow.CssClass = "SinColor" + 'LBImprimirGastos.Visible = True + End If + + UpContratoGasto.Update() + End Sub + + Protected Sub GvContratoGastos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvContratosGastos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Or e.Row.DBCampo("CveVenta").ToString.ToEntero > 0 Then + If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then e.Row.CssClass = "SubTotales" : e.Row.Cells(0).Text = e.Row.DBCampo("Cantidad").FormatoNumero(0) + e.Row.FCLinkButton("imgE").Visible = False + e.Row.FCLinkButton("imgD").Visible = False + e.Row.FCLinkButton("LnkDescargar").Visible = False + Else + Dim lb As LinkButton = CType(e.Row.FindControl("LnkDescargar"), LinkButton) + ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(lb) + End If + End If + End Sub + + Protected Sub GvContratoGastos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvContratosGastos.RowDeleting + Dim objContrato As New ClsContratos + If objContrato.RemoveContratoGasto(GvContratosGastos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then + GvContratosGastos.EditIndex = -1 + Alert("Se eliminó correctamente el gasto del contrato") + CargaGVGastos() + End If + objContrato.Dispose() + End Sub + + Protected Sub GvContratosGastos_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles GvContratosGastos.RowEditing + GvContratosGastos.EditIndex = e.NewEditIndex + CargaGVGastos() + End Sub + + Protected Sub GvContratosGastos_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GvContratosGastos.RowUpdating + Dim objContrato As New ClsContratos + + Dim CveContratoGasto As Integer = GvContratosGastos.DataKeys(e.RowIndex).Value.ToString.ToEntero + Dim Observaciones As String = GvContratosGastos.Rows(e.RowIndex).FCTextBox("TxtDescripcion").Text.Trim + Dim Importe As Decimal = GvContratosGastos.Rows(e.RowIndex).FCTextBox("TxtImporteC").Text.Trim.ToDecimal + Dim Fecha As Date = GvContratosGastos.Rows(e.RowIndex).FCTextBox("TxtFecha").Text.Trim.ToDate + + If objContrato.UpdateContratoGasto(CveContratoGasto, Observaciones, Importe, Fecha, UsuarioActual.CveUsuario) Then + GvContratosGastos.EditIndex = -1 + CargaGVGastos() + End If + objContrato.Dispose() + End Sub + Protected Sub GvContratosGastos_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvContratosGastos.RowCancelingEdit + GvContratosGastos.EditIndex = -1 + CargaGVGastos() + End Sub + + Protected Sub LnkDescargar_Click1(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=CONG&CVECONTRATO={0}&CVECONTRATOGASTO={1}", CveContrato, gvRow.DataKey("CveContratoGasto").ToString))}'") + End Sub +#End Region + +#Region "TAB: PEDIDOS / DEVOLUCIONES" + Private Sub CargaDatosPedDev() + Dim ObjContratos As New ClsContratos + If ObjContratos.GetRepDevolucionesPedidos(Me.CveContrato, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then + DsDatosPedDev = ObjContratos.DsResultados + + GvPedidos.DataSource = DsDatosPedDev.Tables(0) + GvDevs.DataSource = DsDatosPedDev.Tables(1) + End If + ObjContratos.Dispose() + + GvPedidos.DataBind() + GvDevs.DataBind() + + UpPedidosDevoluciones.Update() + End Sub + 'Protected Sub ImgExcelPedDev_Click(sender As Object, e As EventArgs) Handles LbImprimirPedDevExcel.Click + ' GenerarPDFPedDev("Excel") + 'End Sub + 'Protected Sub ImgImprimirPedDev_Click(sender As Object, e As EventArgs) Handles LbImprimirPedDev.Click + ' GenerarPDFPedDev() + 'End Sub + Private Sub GenerarPDFPedDev(Optional Formato As String = "PDF") + If DsDatosPedDev Is Nothing Then + Alert("No se pudieron consultar los pedidos y devoluciones", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + Dim params As New List(Of ReportParameter) + + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("FechaInicio", "-1")) + params.Add(New ReportParameter("FechaFin", "-1")) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Contrato", Me.Titulo)) + params.Add(New ReportParameter("Estatus", "")) + params.Add(New ReportParameter("Tipo", "-1")) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + + Dim lrds As New List(Of ReportDataSource) + lrds.Add(New ReportDataSource("DataSet1", DsDatosPedDev.Tables(0))) + lrds.Add(New ReportDataSource("DataSet2", DsDatosPedDev.Tables(1))) + + ImprimirPDF("Empresas/Grales/Formatos/RepPedDevolucionesXContrato.rdlc", lrds, params, "ReportePedidosDevoluciones", Formato) + + End Sub + + Protected Sub GvPedidos_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + + 'CABECERA + If e.Row.DBCampo("CodigoPS") = "" Then + e.Row.CssClass = "SubTotales2" + e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;") + e.Row.Cells(0).Text = "" + e.Row.Cells(4).Text = "" + e.Row.Cells(5).Text = "" + + Dim Texto = $"Pedido: {e.Row.DBCampo("SerieFolio")} | " + Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") + + e.Row.Cells(0).ColumnSpan = 2 + e.Row.Cells(1).Visible = False + e.Row.Cells(0).Text = Texto + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left + Else + + If e.Row.DBCampo("CveMovimiento").ToString = "" Then + e.Row.Cells(1).Text = "SIN MOVIMIENTO DE ALMACÉN" + End If + + End If + End If + End Sub + Protected Sub GvDevs_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + + 'CABECERA + If e.Row.DBCampo("CodigoPS") = "" Then + e.Row.CssClass = "SubTotales2" + e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;") + e.Row.Cells(0).Text = "" + e.Row.Cells(4).Text = "" + e.Row.Cells(5).Text = "" + + Dim Texto = $"Devolución: {e.Row.DBCampo("SerieFolio")} | " + Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") + + e.Row.Cells(0).ColumnSpan = 2 + e.Row.Cells(1).Visible = False + e.Row.Cells(0).Text = Texto + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left + Else + + If e.Row.DBCampo("CveMovimiento").ToString = "" Then + e.Row.Cells(1).Text = "SIN MOVIMIENTO DE ALMACÉN" + End If + + End If + End If + End Sub + +#End Region + +#Region " TAB: ALMACEN - ACTIVOS FIJBtnAlmacenEsInterno_ClickOS " + Private Sub CargaInventarios() + + Dim ObjInventarios As New ClsInventarios + 'cargar también los movimentos detalle + If ObjInventarios.GetMovimientosDetalleContrato(CveContrato, UsuarioActual.CveEmpresa, DdlEsinternoExternoFiltro.SelectedValue.ToEntero) Then + DtMovimientos = ObjInventarios.DtResultados + Else + Alert("Ocurrió un error al cargar la información de los Activos Fijos. Por favor vuelva a intentar.", TipoMensaje.MsgError) + End If + ObjInventarios.Dispose() + + If DtMovimientos.Rows.Count > 0 Then + CargaGVDatosInventarios() + CargaDatosPedDev() + 'BtnDevolucionAlmacen.Visible = True + CveMovimientoDevolucion = -1 + If CveMovimientoDevolucion > 0 Then + HLSurtirAF.Visible = False + BtnDevolucionAlmacen.Visible = False + End If + Else + DivSinRegistrosAlmacen.Visible = True + GvDatosAlmacen.DataSource = Nothing + GvDatosAlmacen.DataBind() + + End If + + 'CARGA MODALIDAD ALMACEN + If TipoContrato.Contiene(8, 17) Then ' cuando es consignacion + HLSurtirAF.Visible = False + HLSurtirMercancia.NavigateUrl = $"/Ventas/Ventas.aspx?CveContrato={CveContrato}&Tipo=1" + Else + HLSurtirMercancia.Visible = False + HLSurtirAF.NavigateUrl = $"/Ventas/Ventas.aspx?CveContrato={CveContrato}&Tipo=0" + End If + + UpAlmacen.Update() + + End Sub + + Protected Sub RBLAlmacen_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaGVDatosInventarios() + End Sub + Private Sub CargaGVDatosInventarios() + Select Case RBLAlmacen.SelectedValue + Case "-1" + GvDatosAlmacen.DataSource = DtMovimientos + Actualiza(DtMovimientos) + Case "Vig" + GvDatosAlmacen.DataSource = DtMovimientos.FiltraParametros($"(CodigoPS IS NULL AND Cantidad - CantidadDevolucion > 0) OR (CodigoPS IS NOT NULL AND SerieFolioDevolucion IS NULL)") + Actualiza(DtMovimientos.FiltraParametros($"(CodigoPS IS NULL AND Cantidad - CantidadDevolucion > 0) OR (CodigoPS IS NOT NULL AND SerieFolioDevolucion IS NULL)")) + Case "Dev" + GvDatosAlmacen.DataSource = DtMovimientos.FiltraParametros($"SerieFolioDevolucion IS NOT NULL") + Actualiza(DtMovimientos.FiltraParametros($"SerieFolioDevolucion IS NOT NULL")) + Case Else + End Select + GvDatosAlmacen.DataBind() + End Sub + + Public Sub Actualiza(DT As DataTable) + + LblAFInternos.Text = DT.SUM("Cantidad", "CveMovimientoDetalle > 0 AND EsInterno = 1 ").ToString + LblAFExternos.Text = DT.SUM("Cantidad", "CveMovimientoDetalle > 0 AND (EsInterno = 0 OR EsInterno IS NULL)").ToString + + 'Dim ValorAF = DT.SUM("ValorImporte", "CveMovimientoDetalle > 0 AND TipoDocto = 'Ped'") - DT.SUM("ValorImporte", "TipoDocto = 'DPe'") + + LBLAFValorActivo.Text = DT.SUM("ValorImporte", "CveMovimientoDetalle > 0").ToString("###,###,###.00") + + Dim Total = DT.SUM("Cantidad", "CveMovimientoDetalle > 0 AND TipoDocto = 'Ped'") - DT.SUM("Cantidad", "TipoDocto = 'DPe'") + + LBLAFTotal.Text = DT.SUM("Cantidad", "CveMovimientoDetalle > 0").ToString() + UPAFResumen.Update() + + End Sub + Protected Sub GvDatosAlmacen_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAlmacen.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + 'CABECERA + If e.Row.DBCampo("CodigoPS") = "" Then + e.Row.CssClass = "SubTotales2" + e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;") + e.Row.Cells(0).Text = "" + e.Row.Cells(4).Text = "" + e.Row.Cells(5).Text = "" + + Dim Texto = $"{If(e.Row.DBCampo("TipoDocto") = "Ped", "Pedido", "Devolución") }: {e.Row.DBCampo("SerieFolio")} | " + Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") + + + e.Row.Cells(0).ColumnSpan = 2 + e.Row.Cells(1).Visible = False + 'e.Row.Cells(2).Visible = False + e.Row.Cells(0).Text = Texto + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left + + If e.Row.DBCampo("TipoDocto") = "Ped" Then + If e.Row.DBCampo("Cantidad").ToDecimal - e.Row.DBCampo("CantidadDevolucion").ToDecimal > 0 Then + e.Row.Cells(9).Text = If(e.Row.DBCampo("CveMovimiento").ToString = "", "", $" Solicitud de devolución de pedido") + Else + e.Row.Cells(9).Text = "" + End If + End If + + Else + If e.Row.DBCampo("CveMovimiento").ToString = "" Then + e.Row.Cells(1).Text = "SIN MOVIMIENTO DE ALMACÉN" + End If + If e.Row.DBCampo("TipoDocto") = "Ped" Then + If e.Row.DBCampo("Cantidad").ToDecimal - e.Row.DBCampo("CantidadDevolucion").ToDecimal > 0 Then + e.Row.Cells(9).Text = If(e.Row.DBCampo("CveMovimiento").ToString = "", "", $" Solicitud de devolución de pedido") + End If + End If + + + e.Row.FCCheckBox("ChkEsInterno").Visible = True + + End If + + 'If e.Row.DBCampo("SerieLote").ToString = "-1" Then + ' e.Row.Cells(7).Text = "" + 'End If + End If + End Sub + + Private Sub BtnFiltraInternosExternos_Click(sender As Object, e As EventArgs) Handles BtnFiltraInternosExternos.Click + CargaInventarios() + End Sub + + + Protected Sub BtnAlmacenEsInterno_Click(sender As Object, e As EventArgs) + + Dim ObjInv As New ClsInventarios() + + For Each GRow As GridViewRow In GvDatosAlmacen.Rows + Dim CveMovimientoDetalle As Integer = GRow.DataKey("CveMovimientoDetalle").ToEntero + Dim ChkEsInterno = GRow.FCCheckBox("ChkEsInterno") + + If CveMovimientoDetalle > 0 And ChkEsInterno.Checked And DdlEsInterno.SelectedValue.ToEntero > 0 Then + Dim EsInterno As Boolean + + Select Case DdlEsInterno.SelectedValue.ToEntero + Case 1 + EsInterno = True + Case 2 + EsInterno = False + End Select + + If Not (ObjInv.UpdateMovimientoDetalleEsInterno(UsuarioActual.CveEmpresa, CveMovimientoDetalle, EsInterno)) Then + Exit For + End If + + End If + Next + + ObjInv.Dispose() + + 'LnkAjusteAF.Visible = True + DivHajusteAF.Visible = False + GvDatosAlmacen.Columns(6).Visible = False + + CargaInventarios() UPHajusteAF.Update() ' UpHajusteAcciones.Update() - End Sub - - + End Sub + + Protected Sub LnkAjusteAF_Click(sender As Object, e As EventArgs) ' LnkAjusteAF.Visible = False - DivHajusteAF.Visible = True - GvDatosAlmacen.Columns(6).Visible = True - - CargaInventarios() - + DivHajusteAF.Visible = True + GvDatosAlmacen.Columns(6).Visible = True + + CargaInventarios() + UPHajusteAF.Update() ' UpHajusteAcciones.Update() - UpAlmacen.Update() - + UpAlmacen.Update() + End Sub -#Region " DEVOLUCION ALMACEN " - Protected Sub BtnDevolucionAlmacen_Click(sender As Object, e As EventArgs) - Dim ObjVentas As New ClsVentas - ObjVentas.IniciaTransacSQL() - Dim TieneError = False - - For Each Dr As DataRow In DtMovimientos.FiltraParametros("CveVenta IS NOT NULL AND CveMovimiento IS NOT NULL AND EsDevolucionVenta = 0", "", {"CveVenta"}).Rows - If Not ObjVentas.UpdateVentasDevolucionAlmacen(1, Dr("CveVenta").ToString.ToEntero) Then - TieneError = True - End If - Next - - - If Not TieneError Then - ObjVentas.Commit() - Alert("La solicitud de devolución se guardo correctamente.", TipoMensaje.MsgInformacion) - Else - ObjVentas.RollBack() - Alert("Ocurrió un error al guardar la solicitud de devolución. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - - ObjVentas.Dispose() +#Region " DEVOLUCION ALMACEN " + Protected Sub BtnDevolucionAlmacen_Click(sender As Object, e As EventArgs) + Dim ObjVentas As New ClsVentas + ObjVentas.IniciaTransacSQL() + Dim TieneError = False + + For Each Dr As DataRow In DtMovimientos.FiltraParametros("CveVenta IS NOT NULL AND CveMovimiento IS NOT NULL AND EsDevolucionVenta = 0", "", {"CveVenta"}).Rows + If Not ObjVentas.UpdateVentasDevolucionAlmacen(1, Dr("CveVenta").ToString.ToEntero) Then + TieneError = True + End If + Next + + + If Not TieneError Then + ObjVentas.Commit() + Alert("La solicitud de devolución se guardo correctamente.", TipoMensaje.MsgInformacion) + Else + ObjVentas.RollBack() + Alert("Ocurrió un error al guardar la solicitud de devolución. Por favor vuelva a intentar.", TipoMensaje.MsgError) + End If + + ObjVentas.Dispose() End Sub @@ -3117,256 +3117,256 @@ Partial Class Contratos_ContratoObra 'End Sub -#End Region +#End Region -#End Region +#End Region -#Region "TAB SISTEMA" - Protected Sub ChkPermitirAvance_CheckedChanged(sender As Object, e As EventArgs) - Dim ObjContrato As New ClsContratos - Dim Row As GridViewRow = DirectCast(DirectCast(sender, CheckBox).NamingContainer, GridViewRow) - ObjContrato.PermitirAvance(Gv.DataKeys(Row.RowIndex).Value.ToString.ToEntero, DirectCast(sender, CheckBox).Checked) - ObjContrato.Dispose() - Alert("Se ha permitido avance a la sección", TipoMensaje.MsgInformacion) - CargaDatos() - End Sub - - Protected Sub ChkPermitirEstimacion_CheckedChanged(sender As Object, e As EventArgs) - Dim ObjContrato As New ClsContratos - Dim Row As GridViewRow = DirectCast(DirectCast(sender, CheckBox).NamingContainer, GridViewRow) - ObjContrato.PermitirEstimacion(Gv.DataKeys(Row.RowIndex).Value.ToString.ToEntero, DirectCast(sender, CheckBox).Checked) - ObjContrato.Dispose() - Alert("Se ha permitido estimar en la sección", TipoMensaje.MsgInformacion) - CargaDatos() - End Sub -#End Region - -#End Region - -#Region " BITACORA " - Private Sub guardarBitacora(Descripcion As String) - Dim ObjEventoBitacora As New ClsOIEventos - If ObjEventoBitacora.AddEventoBitacora(Descripcion, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then - cargarBitacora() - End If - ObjEventoBitacora.Dispose() - End Sub - - Private Sub cargarBitacora() - Dim ObjEventoBitacora As New ClsOIEventos - If ObjEventoBitacora.GetEventos(-1, -1, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then - GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") - GvEB.DataBind() - HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveContrato=" & ViewState("CveContrato").ToString & "&TB_iframe=true&height=370&width=600;" - ' UpBitacora.Update() - End If - ObjEventoBitacora.Dispose() - End Sub - Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(200) - e.Row.Cells(1).Width = Unit.Pixel(200) - e.Row.Cells(2).Width = Unit.Pixel(100) - 'e.Row.Cells(3).Width = Unit.Pixel(500) 'VARIABLE PARA QUE SEA LO MAS GRANDE POSIBLE - e.Row.Cells(4).Width = Unit.Pixel(100) - e.Row.Cells(5).Width = Unit.Pixel(5) - End If - Dim asd As String = e.Row.DBCampo("Archivo").ToString - - If e.Row.DBCampo("Archivo").ToString <> "" And e.Row.DBCampo("Archivo").ToString <> "-1" Then - e.Row.FCLinkButton("LinkArchivo").Visible = True - e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString) - ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione - End If - - e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left - - If e.Row.DataKey("CveUsuarioIng").ToEntero = UsuarioActual.CveUsuario Then - e.Row.FCLinkButton("LinkEliminarBitacora").Visible = True - End If - - End If - End Sub - - Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click - Dim ObjEventoBitacora As New ClsOIEventos - - Dim FileExtension As String = "-1" - Dim Filesgral As List(Of Archivo) = txtFileBit.getfiles().Archivos - Dim Filename As String = "" - - For Each fileItem As Archivo In Filesgral - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Filename = fileItem.filename - Next - - If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then - If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) - End If - - cargarBitacora() - TxtEventoDescripcion.Text = "" - txtFileBit.getfiles().Archivos.Clear() - - txtFileBit.Text = "" - Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion) - RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") - - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() - - UPEventoBitacora.Update() - 'CargaEventoBitacora() - UPAddEventoBitacora.Update() - End Sub - - - Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs) - Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument) - Dim Archivo As New System.IO.FileInfo(filePath) - - HttpContext.Current.Response.Clear() - HttpContext.Current.Response.ClearContent() - HttpContext.Current.Response.ContentType = "application/octet-stream" - HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath)) - HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) - HttpContext.Current.Response.TransmitFile(filePath) - HttpContext.Current.Response.Flush() - HttpContext.Current.Response.End() - - Archivo = Nothing - End Sub - - Protected Sub GvEB_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) - Dim ObjEventoBitacora As New ClsOIEventos - If ObjEventoBitacora.RemoveEvento(GvEB.Rows(e.RowIndex).DataKey("CveEvento").ToEntero(), UsuarioActual.CveEmpresa) Then - cargarBitacora() - LimpiaModalBitacora() - Alert("El evento se elimino correctamente de la bitácora.", TipoMensaje.MsgInformacion) - End If - ObjEventoBitacora.Dispose() - End Sub - - Protected Sub LimpiaModalBitacora() - TxtEventoDescripcion.Text = "" - txtFileBit.getfiles().Archivos.Clear() - - txtFileBit.Text = "" +#Region "TAB SISTEMA" + Protected Sub ChkPermitirAvance_CheckedChanged(sender As Object, e As EventArgs) + Dim ObjContrato As New ClsContratos + Dim Row As GridViewRow = DirectCast(DirectCast(sender, CheckBox).NamingContainer, GridViewRow) + ObjContrato.PermitirAvance(Gv.DataKeys(Row.RowIndex).Value.ToString.ToEntero, DirectCast(sender, CheckBox).Checked) + ObjContrato.Dispose() + Alert("Se ha permitido avance a la sección", TipoMensaje.MsgInformacion) + CargaDatos() End Sub -#End Region + Protected Sub ChkPermitirEstimacion_CheckedChanged(sender As Object, e As EventArgs) + Dim ObjContrato As New ClsContratos + Dim Row As GridViewRow = DirectCast(DirectCast(sender, CheckBox).NamingContainer, GridViewRow) + ObjContrato.PermitirEstimacion(Gv.DataKeys(Row.RowIndex).Value.ToString.ToEntero, DirectCast(sender, CheckBox).Checked) + ObjContrato.Dispose() + Alert("Se ha permitido estimar en la sección", TipoMensaje.MsgInformacion) + CargaDatos() + End Sub +#End Region -#Region "SUBIR EXCEL" +#End Region + +#Region " BITACORA " + Private Sub guardarBitacora(Descripcion As String) + Dim ObjEventoBitacora As New ClsOIEventos + If ObjEventoBitacora.AddEventoBitacora(Descripcion, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then + cargarBitacora() + End If + ObjEventoBitacora.Dispose() + End Sub + + Private Sub cargarBitacora() + Dim ObjEventoBitacora As New ClsOIEventos + If ObjEventoBitacora.GetEventos(-1, -1, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then + GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") + GvEB.DataBind() + HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveContrato=" & ViewState("CveContrato").ToString & "&TB_iframe=true&height=370&width=600;" + ' UpBitacora.Update() + End If + ObjEventoBitacora.Dispose() + End Sub + Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.RowIndex = 0 Then + e.Row.Cells(0).Width = Unit.Pixel(200) + e.Row.Cells(1).Width = Unit.Pixel(200) + e.Row.Cells(2).Width = Unit.Pixel(100) + 'e.Row.Cells(3).Width = Unit.Pixel(500) 'VARIABLE PARA QUE SEA LO MAS GRANDE POSIBLE + e.Row.Cells(4).Width = Unit.Pixel(100) + e.Row.Cells(5).Width = Unit.Pixel(5) + End If + Dim asd As String = e.Row.DBCampo("Archivo").ToString + + If e.Row.DBCampo("Archivo").ToString <> "" And e.Row.DBCampo("Archivo").ToString <> "-1" Then + e.Row.FCLinkButton("LinkArchivo").Visible = True + e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString) + ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione + End If + + e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left + + If e.Row.DataKey("CveUsuarioIng").ToEntero = UsuarioActual.CveUsuario Then + e.Row.FCLinkButton("LinkEliminarBitacora").Visible = True + End If + + End If + End Sub + + Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click + Dim ObjEventoBitacora As New ClsOIEventos + + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = txtFileBit.getfiles().Archivos + Dim Filename As String = "" + + For Each fileItem As Archivo In Filesgral + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Filename = fileItem.filename + Next + + If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then + If Filename <> "" Then + Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) + End If + + cargarBitacora() + TxtEventoDescripcion.Text = "" + txtFileBit.getfiles().Archivos.Clear() + + txtFileBit.Text = "" + Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion) + RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") + + End If + ObjEventoBitacora.Dispose() + GvEB.DataBind() + + UPEventoBitacora.Update() + 'CargaEventoBitacora() + UPAddEventoBitacora.Update() + End Sub + + + Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs) + Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument) + Dim Archivo As New System.IO.FileInfo(filePath) + + HttpContext.Current.Response.Clear() + HttpContext.Current.Response.ClearContent() + HttpContext.Current.Response.ContentType = "application/octet-stream" + HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath)) + HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) + HttpContext.Current.Response.TransmitFile(filePath) + HttpContext.Current.Response.Flush() + HttpContext.Current.Response.End() + + Archivo = Nothing + End Sub + + Protected Sub GvEB_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) + Dim ObjEventoBitacora As New ClsOIEventos + If ObjEventoBitacora.RemoveEvento(GvEB.Rows(e.RowIndex).DataKey("CveEvento").ToEntero(), UsuarioActual.CveEmpresa) Then + cargarBitacora() + LimpiaModalBitacora() + Alert("El evento se elimino correctamente de la bitácora.", TipoMensaje.MsgInformacion) + End If + ObjEventoBitacora.Dispose() + End Sub + + Protected Sub LimpiaModalBitacora() + TxtEventoDescripcion.Text = "" + txtFileBit.getfiles().Archivos.Clear() + + txtFileBit.Text = "" + End Sub + +#End Region + +#Region "SUBIR EXCEL" Private Function GetPS(Opt As String, Valor As String) As String - Dim StrReturn As String = String.Empty - Dim CvePS As Integer = 0 - - CvePS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", String.Format("{0}= '{1}'", Opt, Valor.Replace("'", ""))).ToString.ToEntero - - If CvePS > 0 Then - StrReturn = "True|" & CvePS.ToString - Else - StrReturn = "False|" & Valor & " en la fila " & NumRow & ", columna " & Opt - End If - - Return StrReturn - - End Function - - Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click - If TxtExcel.getfiles().Archivos.Count > 0 Then - Dim file As Archivo = TxtExcel.getfiles().Archivos(0) - Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.path + Dim StrReturn As String = String.Empty + Dim CvePS As Integer = 0 + + CvePS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", String.Format("{0}= '{1}'", Opt, Valor.Replace("'", ""))).ToString.ToEntero + + If CvePS > 0 Then + StrReturn = "True|" & CvePS.ToString + Else + StrReturn = "False|" & Valor & " en la fila " & NumRow & ", columna " & Opt + End If + + Return StrReturn + + End Function + + Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click + If TxtExcel.getfiles().Archivos.Count > 0 Then + Dim file As Archivo = TxtExcel.getfiles().Archivos(0) + Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.path Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") ' CargarArchivo(Directorio, file.filename, Tipo) - Else - Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError) - End If + Else + Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError) + End If End Sub -#End Region +#End Region -#Region " IMPRESION " +#Region " IMPRESION " -#Region " IMPRIMIR AVANCE POR DOCUMENTO " +#Region " IMPRIMIR AVANCE POR DOCUMENTO " 'Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles LBImprimir.Click ' GenerarPDF() 'End Sub - Private Sub GenerarPDF(Optional Formato As String = "PDF") - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - Dim dt As DataTable = DtAvanceDocumento.FiltraParametros("CveVenta > 0") - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Contrato", Titulo)) - - 'Datos NUEVOS - params.Add(New ReportParameter("Proveedor", Contratante)) - params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) - params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) - params.Add(New ReportParameter("TipoContrato", TipoDocumento)) - params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) - ImprimirPDF("Empresas/Grales/Formatos/RepContratoAvanceDocumento.rdlc", dt, params, $"{Nombre}-AvanceDocumento", Formato:=Formato) + Private Sub GenerarPDF(Optional Formato As String = "PDF") + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + Dim dt As DataTable = DtAvanceDocumento.FiltraParametros("CveVenta > 0") + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Contrato", Titulo)) + + 'Datos NUEVOS + params.Add(New ReportParameter("Proveedor", Contratante)) + params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) + params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) + params.Add(New ReportParameter("TipoContrato", TipoDocumento)) + params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) + ImprimirPDF("Empresas/Grales/Formatos/RepContratoAvanceDocumento.rdlc", dt, params, $"{Nombre}-AvanceDocumento", Formato:=Formato) End Sub -#End Region +#End Region -#Region "I M P R E S I O N D E G A S T O S" +#Region "I M P R E S I O N D E G A S T O S" 'Protected Sub ImgImprimirGastos_Click(sender As Object, e As EventArgs) Handles LBImprimirGastos.Click ' GenerarPDFGastos() 'End Sub - Private Sub GenerarPDFGastos(Optional Formato As String = "PDF") - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Private Sub GenerarPDFGastos(Optional Formato As String = "PDF") + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) ' Dim UtilidadGastos As String = IIf(LblUtilidad.Text <> "", LblUtilidad.Text, "-").ToString - Dim dt As DataTable = DtGastos - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Contrato", TituloCorto)) - - 'Datos NUEVOS - params.Add(New ReportParameter("Proveedor", Contratante)) - params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) - params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) - params.Add(New ReportParameter("TipoContrato", TipoDocumento)) + Dim dt As DataTable = DtGastos + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Contrato", TituloCorto)) + + 'Datos NUEVOS + params.Add(New ReportParameter("Proveedor", Contratante)) + params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) + params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) + params.Add(New ReportParameter("TipoContrato", TipoDocumento)) params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) ' params.Add(New ReportParameter("Utilidad", UtilidadGastos)) - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) - ImprimirPDF("Empresas/Grales/Formatos/RepContratoGastos.rdlc", dt, params, $"{Nombre}-Gastos", Formato:=Formato) + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) + ImprimirPDF("Empresas/Grales/Formatos/RepContratoGastos.rdlc", dt, params, $"{Nombre}-Gastos", Formato:=Formato) End Sub 'Private Sub LBAgregarGasto_Click(sender As Object, e As EventArgs) Handles LBAgregarGasto.Click @@ -3377,230 +3377,230 @@ Partial Class Contratos_ContratoObra ' RegistraScript("$('#ModalAgregarGastos').modal();") 'End Sub -#End Region +#End Region -#Region "I M P R E S I O N D E S U M I N I S T R O S" +#Region "I M P R E S I O N D E S U M I N I S T R O S" 'Protected Sub ImgImprimirSuministros_Click(sender As Object, e As EventArgs) Handles LbImprimirSuministros.Click ' GenerarPDFSuministros() 'End Sub - Private Sub GenerarPDFSuministros(Optional Formato As String = "PDF") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - Dim dt As DataTable = DtSuministros - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Contrato", TituloCorto)) - - 'Datos NUEVOS - params.Add(New ReportParameter("Proveedor", Contratante)) - params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) - params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) - params.Add(New ReportParameter("TipoContrato", TipoDocumento)) - params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) - ImprimirPDF("Empresas/Grales/Formatos/RepContratoSuministros.rdlc", dt, params, $"{Nombre}-Suministros", Formato:=Formato) - End Sub -#End Region + Private Sub GenerarPDFSuministros(Optional Formato As String = "PDF") + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) -#Region "I M P R E S I O N D E A V A N C E " + Dim dt As DataTable = DtSuministros + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Contrato", TituloCorto)) + + 'Datos NUEVOS + params.Add(New ReportParameter("Proveedor", Contratante)) + params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) + params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) + params.Add(New ReportParameter("TipoContrato", TipoDocumento)) + params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) + ImprimirPDF("Empresas/Grales/Formatos/RepContratoSuministros.rdlc", dt, params, $"{Nombre}-Suministros", Formato:=Formato) + End Sub +#End Region + +#Region "I M P R E S I O N D E A V A N C E " 'Private Sub lbImprimirAvance_Click(sender As Object, e As EventArgs) Handles lbImprimirAvance.Click ' GenerarPDFAvance() 'End Sub - Private Sub GenerarPDFAvance(Optional Formato As String = "PDF") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - Dim dt As DataTable = DtAvance - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Contrato", TituloCorto)) - - 'Datos NUEVOS - params.Add(New ReportParameter("Proveedor", Contratante)) - params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) - params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) - params.Add(New ReportParameter("TipoContrato", TipoDocumento)) - params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) - ImprimirPDF("Empresas/Grales/Formatos/ContratoAvance.rdlc", dt, params, $"{Nombre}-Avance", Formato:=Formato) - End Sub -#End Region + Private Sub GenerarPDFAvance(Optional Formato As String = "PDF") + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) -#Region "I M P R E S I O N D E P R E S U P U E S T O " + Dim dt As DataTable = DtAvance + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Contrato", TituloCorto)) + + 'Datos NUEVOS + params.Add(New ReportParameter("Proveedor", Contratante)) + params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) + params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) + params.Add(New ReportParameter("TipoContrato", TipoDocumento)) + params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) + ImprimirPDF("Empresas/Grales/Formatos/ContratoAvance.rdlc", dt, params, $"{Nombre}-Avance", Formato:=Formato) + End Sub +#End Region + +#Region "I M P R E S I O N D E P R E S U P U E S T O " 'Private Sub lLbImprimirPresupuesto_Click(sender As Object, e As EventArgs) Handles LbImprimirPresupuesto.Click ' GenerarPDFPPresupuesto() 'End Sub - Private Sub GenerarPDFPPresupuesto(Optional Formato As String = "PDF") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - Dim dt As DataTable = DtPresupuestos - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Contrato", TituloCorto)) - - 'Datos NUEVOS - params.Add(New ReportParameter("Proveedor", Contratante)) - params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) - params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) - params.Add(New ReportParameter("TipoContrato", TipoDocumento)) - params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) - ImprimirPDF("Empresas/Grales/Formatos/RepContratoPresupuestos.rdlc", dt, params, $"{Nombre}-Presupuestos", Formato:=Formato) - End Sub -#End Region + Private Sub GenerarPDFPPresupuesto(Optional Formato As String = "PDF") + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) -#Region "I M P R E S I O N D E A C T I V O S F I J O S " + Dim dt As DataTable = DtPresupuestos + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Contrato", TituloCorto)) + + 'Datos NUEVOS + params.Add(New ReportParameter("Proveedor", Contratante)) + params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) + params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) + params.Add(New ReportParameter("TipoContrato", TipoDocumento)) + params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) + ImprimirPDF("Empresas/Grales/Formatos/RepContratoPresupuestos.rdlc", dt, params, $"{Nombre}-Presupuestos", Formato:=Formato) + End Sub +#End Region + +#Region "I M P R E S I O N D E A C T I V O S F I J O S " 'Private Sub LbImprmirAF_Click(sender As Object, e As EventArgs) Handles LbImprmirAF.Click ' GenerarPDFActivosFijos() 'End Sub 'Private Sub LbImprmirAFExcel_Click(sender As Object, e As EventArgs) Handles LbImprmirAFExcel.Click ' GenerarPDFActivosFijos("Excel") 'End Sub - Private Sub GenerarPDFActivosFijos(Optional Formato As String = "PDF") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - Dim dt As DataTable = Nothing - - Select Case RBLAlmacen.SelectedValue - Case "-1" - dt = DtMovimientos - Case "Vig" - dt = DtMovimientos.FiltraParametros($"(CodigoPS IS NULL AND Cantidad - CantidadDevolucion > 0) OR (CodigoPS IS NOT NULL AND SerieFolioDevolucion IS NULL)") - Case "Dev" - dt = DtMovimientos.FiltraParametros($"SerieFolioDevolucion IS NOT NULL") - Case Else - End Select - - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Contrato", TituloCorto)) - - 'Datos NUEVOS - params.Add(New ReportParameter("Proveedor", Contratante)) - params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) - params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) - params.Add(New ReportParameter("TipoContrato", TipoDocumento)) - params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) - - Dim Filtro As String = If(RBLAlmacen.SelectedValue = "-1", "Todos", If(RBLAlmacen.SelectedValue = "Vig", "Vigentes", "Devueltos")) - - params.Add(New ReportParameter("CantInternos", LblAFInternos.Text)) - params.Add(New ReportParameter("CantExternos", LblAFExternos.Text)) - params.Add(New ReportParameter("TotalCant", LBLAFTotal.Text)) - params.Add(New ReportParameter("ValorActivo", LBLAFValorActivo.Text)) - params.Add(New ReportParameter("FiltroContratos", Filtro)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) - ImprimirPDF("Empresas/Grales/Formatos/RepContratoActivosFijos.rdlc", dt, params, $"{Nombre}-ActivosFijos", Formato:=Formato) + Private Sub GenerarPDFActivosFijos(Optional Formato As String = "PDF") + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + Dim dt As DataTable = Nothing + + Select Case RBLAlmacen.SelectedValue + Case "-1" + dt = DtMovimientos + Case "Vig" + dt = DtMovimientos.FiltraParametros($"(CodigoPS IS NULL AND Cantidad - CantidadDevolucion > 0) OR (CodigoPS IS NOT NULL AND SerieFolioDevolucion IS NULL)") + Case "Dev" + dt = DtMovimientos.FiltraParametros($"SerieFolioDevolucion IS NOT NULL") + Case Else + End Select + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Contrato", TituloCorto)) + + 'Datos NUEVOS + params.Add(New ReportParameter("Proveedor", Contratante)) + params.Add(New ReportParameter("FechaInicio", TxtFechaInicial.Text.Trim)) + params.Add(New ReportParameter("FechaFin", TxtFechaFinal.Text.Trim)) + params.Add(New ReportParameter("TipoContrato", TipoDocumento)) + params.Add(New ReportParameter("TotalContrato", LblImporte.Text)) + + Dim Filtro As String = If(RBLAlmacen.SelectedValue = "-1", "Todos", If(RBLAlmacen.SelectedValue = "Vig", "Vigentes", "Devueltos")) + + params.Add(New ReportParameter("CantInternos", LblAFInternos.Text)) + params.Add(New ReportParameter("CantExternos", LblAFExternos.Text)) + params.Add(New ReportParameter("TotalCant", LBLAFTotal.Text)) + params.Add(New ReportParameter("ValorActivo", LBLAFValorActivo.Text)) + params.Add(New ReportParameter("FiltroContratos", Filtro)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) + ImprimirPDF("Empresas/Grales/Formatos/RepContratoActivosFijos.rdlc", dt, params, $"{Nombre}-ActivosFijos", Formato:=Formato) End Sub -#End Region +#End Region -#Region " IMPRIMIR DOCUMENTO - SABE " - Public Sub DescargarFormato(documento As String) - - Dim PathRoot As String = Server.MapPath("/") - Dim PathSource As String - Dim pathDesti As String - - PathSource = $"{UsuarioActual.Empresa.Ruta}\Formatos\Plantillas\{documento}" - pathDesti = PathRoot & "Temp\" & CveContrato & documento - - If File.Exists(pathDesti) Then - File.Delete(pathDesti) - End If - - File.Copy(PathSource, pathDesti) - - Dim objDoc As New clsGemBoxDocument(pathDesti) - Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString & " del " & Now.Year.ToString() - - objDoc.SustituirTags(GetDatosTagsDocumentos) - objDoc.Guardar(pathDesti) - - Dim fileinfo As New FileInfo(pathDesti) - - Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) - baseUrl = baseUrl & "/temp/" & fileinfo.Name - - RegistraScript("Download('" & baseUrl & "')") - End Sub - - Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) - Dim ListaTagsDocumentost = New List(Of TagsDocumentos) - Dim ObjContratos As New ClsContratos - If CveContrato <> -1 Then - If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then - ListaTagsDocumentost.Add(New TagsDocumentos("{{NumeroContrato}}", ObjContratos.NumeroContrato)) - ListaTagsDocumentost.Add(New TagsDocumentos("{{DescripcionContrato}}", ObjContratos.DescripcionContrato)) - ListaTagsDocumentost.Add(New TagsDocumentos("{{Ubicacion}}", ObjContratos.Ubicacion)) - ListaTagsDocumentost.Add(New TagsDocumentos("{{Responsable}}", ObjContratos.Responsable)) - ListaTagsDocumentost.Add(New TagsDocumentos("{{FechaInicial}}", ObjContratos.FechaInicial.ToString("d"))) - ListaTagsDocumentost.Add(New TagsDocumentos("{{FechaFinal}}", ObjContratos.FechaFinal.ToString("d"))) - ListaTagsDocumentost.Add(New TagsDocumentos("{{Moneda}}", GlobalDTMonedas().FiltroPrimeroValor("Moneda", $"CveMoneda = {ObjContratos.CveMoneda}"))) - ListaTagsDocumentost.Add(New TagsDocumentos("{{IVA}}", ObjContratos.PorIVA.ToString)) - ListaTagsDocumentost.Add(New TagsDocumentos("{{Anticipo}}", ObjContratos.PorAnticipo.ToString)) - ListaTagsDocumentost.Add(New TagsDocumentos("{{AmortizacionAnticipo}}", ObjContratos.PorAmortizacionAnticipo.ToString)) - ListaTagsDocumentost.Add(New TagsDocumentos("{{Garantia}}", ObjContratos.PorGarantia.ToString)) - If Not IsDBNull(ObjContratos.DtResultados(0)("Periodo")) Then - ListaTagsDocumentost.Add(New TagsDocumentos("{{Periodo}}", ObjContratos.DtResultados(0)("Periodo").ToString)) - End If - If Not IsDBNull(ObjContratos.DtResultados(0)("CveCuentaEquipo")) Then - ListaTagsDocumentost.Add(New TagsDocumentos("{{CuentaEquipo}}", "-1")) - End If - If Not IsDBNull(ObjContratos.DtResultados(0)("NombreComercial")) Then - ListaTagsDocumentost.Add(New TagsDocumentos("{{NombreComercial}}", ObjContratos.DtResultados(0)("NombreComercial").ToString)) - End If - End If - End If - ObjContratos.Dispose() - Return ListaTagsDocumentost - End Function - Private Sub CargaPlantillas() - Dim ObjGral As New ClsGenerales - If ObjGral.ContratosPlantillaGet(-1, UsuarioActual.CveEmpresa) Then +#Region " IMPRIMIR DOCUMENTO - SABE " + Public Sub DescargarFormato(documento As String) + + Dim PathRoot As String = Server.MapPath("/") + Dim PathSource As String + Dim pathDesti As String + + PathSource = $"{UsuarioActual.Empresa.Ruta}\Formatos\Plantillas\{documento}" + pathDesti = PathRoot & "Temp\" & CveContrato & documento + + If File.Exists(pathDesti) Then + File.Delete(pathDesti) + End If + + File.Copy(PathSource, pathDesti) + + Dim objDoc As New clsGemBoxDocument(pathDesti) + Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString & " del " & Now.Year.ToString() + + objDoc.SustituirTags(GetDatosTagsDocumentos) + objDoc.Guardar(pathDesti) + + Dim fileinfo As New FileInfo(pathDesti) + + Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) + baseUrl = baseUrl & "/temp/" & fileinfo.Name + + RegistraScript("Download('" & baseUrl & "')") + End Sub + + Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) + Dim ListaTagsDocumentost = New List(Of TagsDocumentos) + Dim ObjContratos As New ClsContratos + If CveContrato <> -1 Then + If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then + ListaTagsDocumentost.Add(New TagsDocumentos("{{NumeroContrato}}", ObjContratos.NumeroContrato)) + ListaTagsDocumentost.Add(New TagsDocumentos("{{DescripcionContrato}}", ObjContratos.DescripcionContrato)) + ListaTagsDocumentost.Add(New TagsDocumentos("{{Ubicacion}}", ObjContratos.Ubicacion)) + ListaTagsDocumentost.Add(New TagsDocumentos("{{Responsable}}", ObjContratos.Responsable)) + ListaTagsDocumentost.Add(New TagsDocumentos("{{FechaInicial}}", ObjContratos.FechaInicial.ToString("d"))) + ListaTagsDocumentost.Add(New TagsDocumentos("{{FechaFinal}}", ObjContratos.FechaFinal.ToString("d"))) + ListaTagsDocumentost.Add(New TagsDocumentos("{{Moneda}}", GlobalDTMonedas().FiltroPrimeroValor("Moneda", $"CveMoneda = {ObjContratos.CveMoneda}"))) + ListaTagsDocumentost.Add(New TagsDocumentos("{{IVA}}", ObjContratos.PorIVA.ToString)) + ListaTagsDocumentost.Add(New TagsDocumentos("{{Anticipo}}", ObjContratos.PorAnticipo.ToString)) + ListaTagsDocumentost.Add(New TagsDocumentos("{{AmortizacionAnticipo}}", ObjContratos.PorAmortizacionAnticipo.ToString)) + ListaTagsDocumentost.Add(New TagsDocumentos("{{Garantia}}", ObjContratos.PorGarantia.ToString)) + If Not IsDBNull(ObjContratos.DtResultados(0)("Periodo")) Then + ListaTagsDocumentost.Add(New TagsDocumentos("{{Periodo}}", ObjContratos.DtResultados(0)("Periodo").ToString)) + End If + If Not IsDBNull(ObjContratos.DtResultados(0)("CveCuentaEquipo")) Then + ListaTagsDocumentost.Add(New TagsDocumentos("{{CuentaEquipo}}", "-1")) + End If + If Not IsDBNull(ObjContratos.DtResultados(0)("NombreComercial")) Then + ListaTagsDocumentost.Add(New TagsDocumentos("{{NombreComercial}}", ObjContratos.DtResultados(0)("NombreComercial").ToString)) + End If + End If + End If + ObjContratos.Dispose() + Return ListaTagsDocumentost + End Function + Private Sub CargaPlantillas() + Dim ObjGral As New ClsGenerales + If ObjGral.ContratosPlantillaGet(-1, UsuarioActual.CveEmpresa) Then DtPlantillasContratos = ObjGral.DtResultados.FiltraParametros("Tipo = 'Con'") ' DdlPlantillaContrato.DataSource = DtPlantillasContratos - Else - DtPlantillasContratos = Nothing - End If - ObjGral.Dispose() - 'DdlPlantillaContrato.DataSource = DtPlantillasContratos - 'DdlPlantillaContrato.DataBind() + Else + DtPlantillasContratos = Nothing + End If + ObjGral.Dispose() + 'DdlPlantillaContrato.DataSource = DtPlantillasContratos + 'DdlPlantillaContrato.DataBind() End Sub 'Protected Sub BtnImprimirC_Click(sender As Object, e As EventArgs) Handles liImprimir.Click @@ -3608,147 +3608,147 @@ Partial Class Contratos_ContratoObra ' ' DescarFormato(docx) 'End Sub -#End Region +#End Region -#End Region +#End Region -#Region "CREAR A PARTIR DE" - Private Sub BtnAgregarContratoHijo_Click(sender As Object, e As EventArgs) Handles BtnAgregarContratoHijo.Click - Dim TieneError = False - - Dim ObjContratos As New ClsContratos - ObjContratos.IniciaTransacSQL() - - Try - Dim CveContratoHijo As Integer = -1 +#Region "CREAR A PARTIR DE" + Private Sub BtnAgregarContratoHijo_Click(sender As Object, e As EventArgs) Handles BtnAgregarContratoHijo.Click + Dim TieneError = False + + Dim ObjContratos As New ClsContratos + ObjContratos.IniciaTransacSQL() + + Try + Dim CveContratoHijo As Integer = -1 Dim Minimo, Maximo, Total As Double Minimo = -1 Maximo = -1 - Total = -1 - - 'If txtMinimo.Text.ToDouble > 0 And chkDetalleContrato.Checked Then Minimo = txtMinimo.Text.ToDouble Else Minimo = -1 - 'If txtMaximo.Text.ToDouble > 0 And chkDetalleContrato.Checked Then Maximo = txtMaximo.Text.ToDouble Else Maximo = -1 - 'If TxtTotal.Text.ToDouble > 0 And chkDetalleContrato.Checked Then Total = TxtTotal.Text.ToDouble Else Total = -1 - - Dim CveEstatusInicial As Integer = 10 'falta sacar por - If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then - CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero - End If - - CveContratoHijo = ObjContratos.AddContratos(TxtCodigoApartirDe.Text, TxtDescripcionApartirDe.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, txtFechaI4.Text.ToDate, txtFechaF4.Text.ToDate, - TxtUbicacion.Text, TxtResponsable.Text, CveSubProyecto, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble, - TxtPorGarantia.Text.ToDouble, "." & Session("FileExtension").ToString, "", CveContrato, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total, - DdlMoneda.SelectedValue.ToEntero, ModalidadDetalle, If(UsuarioActual.Empresa.CvePlataforma = 3, 1, CveEstatusInicial), TipoContrato, TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, PorcentajeComision:=0, - TipoGarantia:=-1, Folio:=0, FechaVenc:=Nothing, EstatusFianza:=-1, CvePeriodo:=-1, CveCuentaEquipo:=-1, CveContratoPlantilla:=-1, CveVendedor:=-1) - - - If CveContratoHijo > 0 Then - - If ChkCantidades.Checked Then - TieneError = AgregarDetalleHijo(CveContratoHijo, ObjContratos) - End If - - If ChkTrasAF.Checked Then - TieneError = AgregarMovimientosAFHijo(CveContratoHijo, ObjContratos) - End If - - Else - TieneError = True - Alert("Ocurrió un error al generar el contrato.", TipoMensaje.MsgError) - End If - - If Not TieneError Then - ObjContratos.Commit() - Dim Msj As New StringBuilder - Msj.Append($"Se ha generado correctamente el contrato {TxtCodigoApartirDe.Text}, a partir del contrato: {TxtNumeroContrato.Text}") - Msj.AppendFormat("
Ver Contrato", CveContratoHijo) - RegistraScript("$('#ModalCrearApartirDe').modal('hide');") - Alert(Msj.ToString, TipoMensaje.MsgInformacion) - Else - ObjContratos.RollBack() - End If - Catch ex As Exception - ObjContratos.RollBack() - OnError("Ocurrió un error al crear un nuevo contrato.", ex) - Finally - ObjContratos.Dispose() - End Try - - End Sub - - - Private Function AgregarDetalleHijo(CveContratoHijo As Integer, ByRef ObjContratos As ClsContratos) As Boolean - Dim TieneError = False - - Dim Cantidades As Double - For Each Row As DataRow In TmpDT.Rows - Cantidades = Row("CantidadContratada").ToString.ToDouble - 'If ChkCantidades.Checked Then - ' Cantidades = Row("CantidadContratada").ToString.ToDouble - 'Else - ' Cantidades = 0 - 'End If - - If Row("CveTipoPresupuesto").ToString.ToEntero = 1 Then - If ObjContratos.AddContratosDetalle(CveContratoHijo, Row("CvePS").ToString.ToEntero, Cantidades, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, Row("LimitarCantidad").ToString.ToEntero = 1, "") Then - If Autorizado Then - Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU")) - guardarBitacora(msj) - End If - Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") - Else - TieneError = True - Alert("Ocurrió un error al agregar el detalle del contrato", TipoMensaje.MsgError) - Exit For - End If - ElseIf Row("CveTipoPresupuesto").ToString.ToEntero = 2 Then - If ObjContratos.AddContratosDetalle(CveContratoHijo, Row("CvePS").ToString.ToEntero, Cantidades, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, Row("LimitarCantidad").ToString.ToEntero = 1, Row("OCInterna").ToString) Then - If Autorizado Then - Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU")) - guardarBitacora(msj) - End If - Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") - Else - TieneError = True - Alert("Ocurrió un error al agregar el detalle del contrato", TipoMensaje.MsgError) - Exit For - End If - End If - Next - - Return TieneError - End Function - - Private Function AgregarMovimientosAFHijo(CveContratoHijo As Integer, ByRef ObjContratos As ClsContratos) As Boolean - Dim TieneError As Boolean = False - - 'BUSCA LOS ACTIVOS FIJOS VIGENTES - Dim Dt As DataTable = DtMovimientos.FiltraParametros($"(CodigoPS IS NULL AND Cantidad - CantidadDevolucion > 0) OR (CodigoPS IS NOT NULL AND SerieFolioDevolucion IS NULL)") - - Dim DtVentas As DataTable = Dt.FiltraParametros($"No = 0") - - For Each Dr As DataRow In DtVentas.Rows - Dim CveVenta As Integer = Dr("CveVenta").ToString.ToEntero - Dim CveMovimiento As Integer = Dr("CveMovimiento").ToString.ToEntero - - TieneError = Not ObjContratos.UpdateMovimientoContrato(CveContratoHijo, CveMovimiento) - - If Not TieneError Then - TieneError = Not ObjContratos.UpdateVentasContrato(CveContratoHijo, CveVenta) - End If - - If TieneError Then - Exit For - End If - Next - - If TieneError Then - Alert("Ocurrió un error al traspasar los activos fijos del contrato", TipoMensaje.MsgError) - End If - - Return TieneError + Total = -1 + + 'If txtMinimo.Text.ToDouble > 0 And chkDetalleContrato.Checked Then Minimo = txtMinimo.Text.ToDouble Else Minimo = -1 + 'If txtMaximo.Text.ToDouble > 0 And chkDetalleContrato.Checked Then Maximo = txtMaximo.Text.ToDouble Else Maximo = -1 + 'If TxtTotal.Text.ToDouble > 0 And chkDetalleContrato.Checked Then Total = TxtTotal.Text.ToDouble Else Total = -1 + + Dim CveEstatusInicial As Integer = 10 'falta sacar por + If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then + CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero + End If + + CveContratoHijo = ObjContratos.AddContratos(TxtCodigoApartirDe.Text, TxtDescripcionApartirDe.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, txtFechaI4.Text.ToDate, txtFechaF4.Text.ToDate, + TxtUbicacion.Text, TxtResponsable.Text, CveSubProyecto, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble, + TxtPorGarantia.Text.ToDouble, "." & Session("FileExtension").ToString, "", CveContrato, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total, + DdlMoneda.SelectedValue.ToEntero, ModalidadDetalle, If(UsuarioActual.Empresa.CvePlataforma = 3, 1, CveEstatusInicial), TipoContrato, TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, PorcentajeComision:=0, + TipoGarantia:=-1, Folio:=0, FechaVenc:=Nothing, EstatusFianza:=-1, CvePeriodo:=-1, CveCuentaEquipo:=-1, CveContratoPlantilla:=-1, CveVendedor:=-1) + + + If CveContratoHijo > 0 Then + + If ChkCantidades.Checked Then + TieneError = AgregarDetalleHijo(CveContratoHijo, ObjContratos) + End If + + If ChkTrasAF.Checked Then + TieneError = AgregarMovimientosAFHijo(CveContratoHijo, ObjContratos) + End If + + Else + TieneError = True + Alert("Ocurrió un error al generar el contrato.", TipoMensaje.MsgError) + End If + + If Not TieneError Then + ObjContratos.Commit() + Dim Msj As New StringBuilder + Msj.Append($"Se ha generado correctamente el contrato {TxtCodigoApartirDe.Text}, a partir del contrato: {TxtNumeroContrato.Text}") + Msj.AppendFormat("
Ver Contrato", CveContratoHijo) + RegistraScript("$('#ModalCrearApartirDe').modal('hide');") + Alert(Msj.ToString, TipoMensaje.MsgInformacion) + Else + ObjContratos.RollBack() + End If + Catch ex As Exception + ObjContratos.RollBack() + OnError("Ocurrió un error al crear un nuevo contrato.", ex) + Finally + ObjContratos.Dispose() + End Try + + End Sub + + + Private Function AgregarDetalleHijo(CveContratoHijo As Integer, ByRef ObjContratos As ClsContratos) As Boolean + Dim TieneError = False + + Dim Cantidades As Double + For Each Row As DataRow In TmpDT.Rows + Cantidades = Row("CantidadContratada").ToString.ToDouble + 'If ChkCantidades.Checked Then + ' Cantidades = Row("CantidadContratada").ToString.ToDouble + 'Else + ' Cantidades = 0 + 'End If + + If Row("CveTipoPresupuesto").ToString.ToEntero = 1 Then + If ObjContratos.AddContratosDetalle(CveContratoHijo, Row("CvePS").ToString.ToEntero, Cantidades, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, Row("LimitarCantidad").ToString.ToEntero = 1, "") Then + If Autorizado Then + Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU")) + guardarBitacora(msj) + End If + Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") + Else + TieneError = True + Alert("Ocurrió un error al agregar el detalle del contrato", TipoMensaje.MsgError) + Exit For + End If + ElseIf Row("CveTipoPresupuesto").ToString.ToEntero = 2 Then + If ObjContratos.AddContratosDetalle(CveContratoHijo, Row("CvePS").ToString.ToEntero, Cantidades, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, Row("LimitarCantidad").ToString.ToEntero = 1, Row("OCInterna").ToString) Then + If Autorizado Then + Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU")) + guardarBitacora(msj) + End If + Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") + Else + TieneError = True + Alert("Ocurrió un error al agregar el detalle del contrato", TipoMensaje.MsgError) + Exit For + End If + End If + Next + + Return TieneError + End Function + + Private Function AgregarMovimientosAFHijo(CveContratoHijo As Integer, ByRef ObjContratos As ClsContratos) As Boolean + Dim TieneError As Boolean = False + + 'BUSCA LOS ACTIVOS FIJOS VIGENTES + Dim Dt As DataTable = DtMovimientos.FiltraParametros($"(CodigoPS IS NULL AND Cantidad - CantidadDevolucion > 0) OR (CodigoPS IS NOT NULL AND SerieFolioDevolucion IS NULL)") + + Dim DtVentas As DataTable = Dt.FiltraParametros($"No = 0") + + For Each Dr As DataRow In DtVentas.Rows + Dim CveVenta As Integer = Dr("CveVenta").ToString.ToEntero + Dim CveMovimiento As Integer = Dr("CveMovimiento").ToString.ToEntero + + TieneError = Not ObjContratos.UpdateMovimientoContrato(CveContratoHijo, CveMovimiento) + + If Not TieneError Then + TieneError = Not ObjContratos.UpdateVentasContrato(CveContratoHijo, CveVenta) + End If + + If TieneError Then + Exit For + End If + Next + + If TieneError Then + Alert("Ocurrió un error al traspasar los activos fijos del contrato", TipoMensaje.MsgError) + End If + + Return TieneError End Function 'Private Sub AgregarMovimientosAFHijo(CveContratoHijo As Integer) @@ -3838,194 +3838,194 @@ Partial Class Contratos_ContratoObra -#End Region +#End Region -#Region "FIANZAS" - Protected Sub LimpiarCamposModalFianzas() - txtFolioFianza.Text = "" - TxtModalAdjuntoArchivo.Text = "" - DdlFianza.SelectedValue = "-1" - txtFechaVenFianza.Text = DateTime.Today.ToShortDateString - End Sub - Protected Sub btnAgregarFianza_Click(sender As Object, e As EventArgs) - - LimpiarCamposModalFianzas() - EsEditarFianza = False - txth4Fianza.InnerText = "Agregar Fianza" - LnkDescargar.Visible = False - 'BtnGuardarFianza.Text = "Guardar" - UPModalFianza.Update() +#Region "FIANZAS" + Protected Sub LimpiarCamposModalFianzas() + txtFolioFianza.Text = "" + TxtModalAdjuntoArchivo.Text = "" + DdlFianza.SelectedValue = "-1" + txtFechaVenFianza.Text = DateTime.Today.ToShortDateString + End Sub + Protected Sub btnAgregarFianza_Click(sender As Object, e As EventArgs) + + LimpiarCamposModalFianzas() + EsEditarFianza = False + txth4Fianza.InnerText = "Agregar Fianza" + LnkDescargar.Visible = False + 'BtnGuardarFianza.Text = "Guardar" + UPModalFianza.Update() Me.RegistraScript("$('#DvModalFianza').modal();") End Sub - Private Sub GuardaAdjunto(FolioFechaVencimiento As String) - If Not TxtModalAdjuntoArchivo.getfiles.Archivos.Count > 0 Then - Exit Sub - End If - Dim ArchivoAdjunto As Archivo = TxtModalAdjuntoArchivo.getfiles.Archivos(0) - If ArchivoAdjunto.filenameO.Length > 114 Then - Alert("El nombre del archivo excede los 115 caracteres permitidos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Try - Dim Path As String = String.Format("{0}\\{1}\\{2}\\{3}", UsuarioActual.Empresa.Ruta, "Contratos", "Fianzas", FolioFechaVencimiento) - DirectoryExistsCreate(Path) - Dim ArchivoDestino As String = String.Format("{0}\\{1}", Path, ArchivoAdjunto.filenameO) - If File.Exists(ArchivoDestino) Then - System.IO.File.Delete(ArchivoDestino) - End If - System.IO.File.Move(ArchivoAdjunto.FileUrl, ArchivoDestino) - Catch ex As Exception - Alert("Ocurrió un error al guardar el archivo Adjunto. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End Try + Private Sub GuardaAdjunto(FolioFechaVencimiento As String) + If Not TxtModalAdjuntoArchivo.getfiles.Archivos.Count > 0 Then + Exit Sub + End If + Dim ArchivoAdjunto As Archivo = TxtModalAdjuntoArchivo.getfiles.Archivos(0) + If ArchivoAdjunto.filenameO.Length > 114 Then + Alert("El nombre del archivo excede los 115 caracteres permitidos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Try + Dim Path As String = String.Format("{0}\\{1}\\{2}\\{3}", UsuarioActual.Empresa.Ruta, "Contratos", "Fianzas", FolioFechaVencimiento) + DirectoryExistsCreate(Path) + Dim ArchivoDestino As String = String.Format("{0}\\{1}", Path, ArchivoAdjunto.filenameO) + If File.Exists(ArchivoDestino) Then + System.IO.File.Delete(ArchivoDestino) + End If + System.IO.File.Move(ArchivoAdjunto.FileUrl, ArchivoDestino) + Catch ex As Exception + Alert("Ocurrió un error al guardar el archivo Adjunto. Por favor vuelva a intentar.", TipoMensaje.MsgError) + End Try End Sub - Protected Sub LnkDescargar_Click(sender As Object, e As EventArgs) - 'DescargarAdjunto() + Protected Sub LnkDescargar_Click(sender As Object, e As EventArgs) + 'DescargarAdjunto() End Sub - Protected Sub imgEFianzaGv_Click(sender As Object, e As EventArgs) - LimpiarCamposModalFianzas() - EsEditarFianza = True - - Dim GvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow) - - IndexFianzaEditar = GvRow.DataItemIndex - - txtFolioFianza.Text = GvRow.DataKey("Folio").ToString() - DdlFianza.SelectedValue = GvRow.DataKey("CveEstatusFianza").ToString() - txtFechaVenFianza.Text = GvRow.DataKey("FechaVencimiento").ToString() - LnkDescargar.Visible = GvRow.DataKey("Adjunto").ToString <> "" - + Protected Sub imgEFianzaGv_Click(sender As Object, e As EventArgs) + LimpiarCamposModalFianzas() + EsEditarFianza = True + + Dim GvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow) + + IndexFianzaEditar = GvRow.DataItemIndex + + txtFolioFianza.Text = GvRow.DataKey("Folio").ToString() + DdlFianza.SelectedValue = GvRow.DataKey("CveEstatusFianza").ToString() + txtFechaVenFianza.Text = GvRow.DataKey("FechaVencimiento").ToString() + LnkDescargar.Visible = GvRow.DataKey("Adjunto").ToString <> "" + txth4Fianza.InnerText = "Editar Fianza" - UPModalFianza.Update() + UPModalFianza.Update() Me.RegistraScript("$('#DvModalFianza').modal();") - End Sub - Protected Sub CreaDtTmpFianzas() - DtTmpFianzas = New DataTable() - - - DtTmpFianzas.Columns.Add("CveContratoFianza", GetType(String)) - DtTmpFianzas.Columns.Add("Folio", GetType(String)) - DtTmpFianzas.Columns.Add("CveEstatusFianza", GetType(String)) - DtTmpFianzas.Columns.Add("EstatusFianza", GetType(String)) - DtTmpFianzas.Columns.Add("FechaVencimiento", GetType(String)) - DtTmpFianzas.Columns.Add("Adjunto", GetType(String)) - + End Sub + Protected Sub CreaDtTmpFianzas() + DtTmpFianzas = New DataTable() + + + DtTmpFianzas.Columns.Add("CveContratoFianza", GetType(String)) + DtTmpFianzas.Columns.Add("Folio", GetType(String)) + DtTmpFianzas.Columns.Add("CveEstatusFianza", GetType(String)) + DtTmpFianzas.Columns.Add("EstatusFianza", GetType(String)) + DtTmpFianzas.Columns.Add("FechaVencimiento", GetType(String)) + DtTmpFianzas.Columns.Add("Adjunto", GetType(String)) + DtTmpFianzasInicial = DtTmpFianzas.Copy - End Sub - - Protected Function GuardaFianzas(ObjContrato As ClsContratos) As Boolean - - Dim TieneError As Boolean = False - - For Each row As DataRow In DtTmpFianzas.Rows - Dim Folio As String = row("Folio").ToString() - Dim CveEstatus As Integer = row("CveEstatusFianza").ToString().ToEntero - Dim FechaVen As Date = Date.Parse(row("FechaVencimiento").ToString()) - Dim Adjunto As String = row("Adjunto").ToString() - - ' Si la cve es -1 es nuevo y lo agrega - If row("CveContratoFianza").ToString() = "-1" Then - - If Not ObjContrato.AddContratoFianza(CveContrato, Folio, CveEstatus, FechaVen, Adjunto) Then - TieneError = True - Exit For - End If - Else - Dim CveFianza As Integer = row("CveContratoFianza").ToString().ToEntero - - If Not ObjContrato.UpdateContratoFianza(CveFianza, Folio, CveEstatus, FechaVen, Adjunto) Then - TieneError = True - Exit For - End If - - End If - Next - ' Compara si aun existe la fianza, si ya no existe la elimina - For Each row As DataRow In DtTmpFianzasInicial.Rows - - Dim CveFianza As Integer = row("CveContratoFianza").ToString().ToEntero - Dim filtro As String = String.Format("CveContratoFianza ={0}", CveFianza) - - If DtTmpFianzas.FiltraParametros(filtro).Rows.Count = 0 Then - TieneError = Not ObjContrato.RemoveContratoFianza(CveFianza) - Exit For - End If - Next - - Return Not TieneError - End Function - - Protected Sub LnkDescargaAdjunto_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow) + End Sub + + Protected Function GuardaFianzas(ObjContrato As ClsContratos) As Boolean + + Dim TieneError As Boolean = False + + For Each row As DataRow In DtTmpFianzas.Rows + Dim Folio As String = row("Folio").ToString() + Dim CveEstatus As Integer = row("CveEstatusFianza").ToString().ToEntero + Dim FechaVen As Date = Date.Parse(row("FechaVencimiento").ToString()) + Dim Adjunto As String = row("Adjunto").ToString() + + ' Si la cve es -1 es nuevo y lo agrega + If row("CveContratoFianza").ToString() = "-1" Then + + If Not ObjContrato.AddContratoFianza(CveContrato, Folio, CveEstatus, FechaVen, Adjunto) Then + TieneError = True + Exit For + End If + Else + Dim CveFianza As Integer = row("CveContratoFianza").ToString().ToEntero + + If Not ObjContrato.UpdateContratoFianza(CveFianza, Folio, CveEstatus, FechaVen, Adjunto) Then + TieneError = True + Exit For + End If + + End If + Next + ' Compara si aun existe la fianza, si ya no existe la elimina + For Each row As DataRow In DtTmpFianzasInicial.Rows + + Dim CveFianza As Integer = row("CveContratoFianza").ToString().ToEntero + Dim filtro As String = String.Format("CveContratoFianza ={0}", CveFianza) + + If DtTmpFianzas.FiltraParametros(filtro).Rows.Count = 0 Then + TieneError = Not ObjContrato.RemoveContratoFianza(CveFianza) + Exit For + End If + Next + + Return Not TieneError + End Function + + Protected Sub LnkDescargaAdjunto_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow) IndexFianzaEditar = GvRow.DataItemIndex ' DescargarAdjunto() - End Sub - Protected Sub GvFianzas_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("Adjunto").ToString <> "" Then - e.Row.FCLinkButton("LnkDescargaAdjunto").Visible = True - Dim lb As LinkButton = CType(e.Row.FindControl("LnkDescargaAdjunto"), LinkButton) - ScriptManager.GetCurrent(Me).RegisterPostBackControl(lb) - End If - End If + End Sub + Protected Sub GvFianzas_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("Adjunto").ToString <> "" Then + e.Row.FCLinkButton("LnkDescargaAdjunto").Visible = True + Dim lb As LinkButton = CType(e.Row.FindControl("LnkDescargaAdjunto"), LinkButton) + ScriptManager.GetCurrent(Me).RegisterPostBackControl(lb) + End If + End If End Sub -#End Region +#End Region -#Region "CONVENIO DE PRECIO FIJO" - Protected Sub CargaConvenioPrecioFijo() - '12/04/2018 - oculta campo de licitacion, portlet finanzas y campo tipo de garantia - trLicitacion.Visible = False - 'DivFianzas.Visible = False - 'DivTipoGarantia.Visible = False - - UpGral.Update() +#Region "CONVENIO DE PRECIO FIJO" + Protected Sub CargaConvenioPrecioFijo() + '12/04/2018 - oculta campo de licitacion, portlet finanzas y campo tipo de garantia + trLicitacion.Visible = False + 'DivFianzas.Visible = False + 'DivTipoGarantia.Visible = False + + UpGral.Update() End Sub -#End Region +#End Region -#Region "NOMENCLATURA CONTRATOS" - Protected Sub GetNoContratoNuevo() - Dim ObjContratos As New ClsContratos() - - 'Dim TipoContrato As Integer = DdlTipoContrato.SelectedValue.ToEntero() - - - Dim SufijoContrato As String = "" - - Select Case TipoContrato - Case 7 'Contrato Comodato - SufijoContrato = "COM" - Case 8 'Contrato Consignacion - SufijoContrato = "CONSIG" - Case 10 'Contrato de Financiamiento - SufijoContrato = "FIN" - Case 13 'Contrato Servicio Administrado de Impresion (?) - SufijoContrato = "MPS" - Case 28 'Convenio Precio Fijo - SufijoContrato = "CON" - End Select - - Dim Serie As String = String.Format("-{0}-{1}", DateTime.Today.Year, SufijoContrato) - - If ObjContratos.GetContratoNomenclatura(Serie, UsuarioActual.CveEmpresa) Then - TxtNumeroContrato.Text = ObjContratos.DtResultados.Rows(0)("NoContrato").ToString - End If - - ObjContratos.Dispose() +#Region "NOMENCLATURA CONTRATOS" + Protected Sub GetNoContratoNuevo() + Dim ObjContratos As New ClsContratos() + + 'Dim TipoContrato As Integer = DdlTipoContrato.SelectedValue.ToEntero() + + + Dim SufijoContrato As String = "" + + Select Case TipoContrato + Case 7 'Contrato Comodato + SufijoContrato = "COM" + Case 8 'Contrato Consignacion + SufijoContrato = "CONSIG" + Case 10 'Contrato de Financiamiento + SufijoContrato = "FIN" + Case 13 'Contrato Servicio Administrado de Impresion (?) + SufijoContrato = "MPS" + Case 28 'Convenio Precio Fijo + SufijoContrato = "CON" + End Select + + Dim Serie As String = String.Format("-{0}-{1}", DateTime.Today.Year, SufijoContrato) + + If ObjContratos.GetContratoNomenclatura(Serie, UsuarioActual.CveEmpresa) Then + TxtNumeroContrato.Text = ObjContratos.DtResultados.Rows(0)("NoContrato").ToString + End If + + ObjContratos.Dispose() End Sub -#End Region +#End Region -#Region "IMPUESOS LOCALES" +#Region "IMPUESOS LOCALES" 'Protected Sub ChkImpuestosLocales_CheckedChanged(sender As Object, e As EventArgs) ' If ChkImpuestosLocales.Checked Then ' GvImpuestosLocales.Visible = True @@ -4044,7 +4044,7 @@ Partial Class Contratos_ContratoObra 'End Sub -#End Region +#End Region @@ -4384,7 +4384,7 @@ Partial Class Contratos_ContratoObra If TipoCargaPresupuesto = EnumTipoCargaPresupuesto.Ventas Then - DTCargaPresupuesto = CargaPreSupuestoExcel("Presupuesto") + DTCargaPresupuesto = CargaPresupuestoExcel("Presupuesto") If DTCargaPresupuesto.Rows.Count > 0 Then ProcesaDatosCargaPresupuesto(DTCargaPresupuesto, Nothing, Nothing, Nothing) @@ -4394,8 +4394,8 @@ Partial Class Contratos_ContratoObra Else - DTCargaPresupuesto = CargaPreSupuestoExcel("Insumos") - DTCargaPresupuestoManoObra = CargaPreSupuestoExcel("ManoObra") + DTCargaPresupuesto = CargaPresupuestoExcel("Insumos") + DTCargaPresupuestoManoObra = CargaPresupuestoExcel("ManoObra") DTCargaPresupuestoFlotillas = CargaPresupuestoExcel("Maquinaria") DTCargaPresupuestoIndirectos = CargaPresupuestoExcel("Indirectos") @@ -4438,21 +4438,21 @@ Partial Class Contratos_ContratoObra Private Function CargaPresupuestoExcel(Hoja As String) As DataTable - Dim FileExtension As String = "-1" - Dim Filesgral As List(Of Archivo) = TxtModalCargaPresupuesto.getfiles().Archivos + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = TxtModalCargaPresupuesto.getfiles().Archivos Dim Filename As String = "" Dim DTPS = New DataTable - For Each fileItem As Archivo In Filesgral - - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - + For Each fileItem As Archivo In Filesgral + + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + If Not FileExtension.ToUpper.Contiene("XLSX", "XSL") Then Alert("El archivo no es una archivo de Excel", TipoMensaje.MsgAdvertencia) Exit For End If - Dim tempArray() As String + Dim tempArray() As String tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) SpreadsheetInfo.SetLicense(Extensiones.SerialGemBoxSpreadsheet) Dim workbook = ExcelFile.Load(fileItem.FileUrl) @@ -4497,29 +4497,29 @@ Partial Class Contratos_ContratoObra Dim ErrorProceso = False - Dim DTPS = New DataTable - DTPS.Columns.Add("CveContratoDetalle", GetType(Integer)) - DTPS.Columns.Add("Cantidad", GetType(Double)) - DTPS.Columns.Add("CantidadContratada", GetType(Double)) - DTPS.Columns.Add("CveUM", GetType(Integer)) - DTPS.Columns.Add("UM", GetType(String)) - DTPS.Columns.Add("CveClasificacion", GetType(Integer)) - DTPS.Columns.Add("Clasificacion", GetType(String)) - DTPS.Columns.Add("CvePS", GetType(Integer)) - DTPS.Columns.Add("PS", GetType(String)) - DTPS.Columns.Add("CodigoPS", GetType(String)) - DTPS.Columns.Add("PU", GetType(Double)) - DTPS.Columns.Add("Total", GetType(Double)) - DTPS.Columns.Add("CveTipoPresupuesto", GetType(Integer)) - DTPS.Columns.Add("PermitirAvance", GetType(Integer)) - DTPS.Columns.Add("PermitirEstimacion", GetType(Integer)) - DTPS.Columns.Add("UsuarioAvance", GetType(Integer)) - DTPS.Columns.Add("Cantidad_Original", GetType(Double)) - DTPS.Columns.Add("PU_Original", GetType(Double)) - DTPS.Columns.Add("Total_Original", GetType(Double)) - DTPS.Columns.Add("NoIdentificacion", GetType(String)) - DTPS.Columns.Add("LimitarCantidad", GetType(Integer)) - DTPS.Columns.Add("OCInterna", GetType(String)) + Dim DTPS = New DataTable + DTPS.Columns.Add("CveContratoDetalle", GetType(Integer)) + DTPS.Columns.Add("Cantidad", GetType(Double)) + DTPS.Columns.Add("CantidadContratada", GetType(Double)) + DTPS.Columns.Add("CveUM", GetType(Integer)) + DTPS.Columns.Add("UM", GetType(String)) + DTPS.Columns.Add("CveClasificacion", GetType(Integer)) + DTPS.Columns.Add("Clasificacion", GetType(String)) + DTPS.Columns.Add("CvePS", GetType(Integer)) + DTPS.Columns.Add("PS", GetType(String)) + DTPS.Columns.Add("CodigoPS", GetType(String)) + DTPS.Columns.Add("PU", GetType(Double)) + DTPS.Columns.Add("Total", GetType(Double)) + DTPS.Columns.Add("CveTipoPresupuesto", GetType(Integer)) + DTPS.Columns.Add("PermitirAvance", GetType(Integer)) + DTPS.Columns.Add("PermitirEstimacion", GetType(Integer)) + DTPS.Columns.Add("UsuarioAvance", GetType(Integer)) + DTPS.Columns.Add("Cantidad_Original", GetType(Double)) + DTPS.Columns.Add("PU_Original", GetType(Double)) + DTPS.Columns.Add("Total_Original", GetType(Double)) + DTPS.Columns.Add("NoIdentificacion", GetType(String)) + DTPS.Columns.Add("LimitarCantidad", GetType(Integer)) + DTPS.Columns.Add("OCInterna", GetType(String)) DTPS.Columns.Add("Observacion", GetType(String)) DTPS.Columns.Add("CveRubro", GetType(Integer)) @@ -4990,21 +4990,21 @@ Partial Class Contratos_ContratoObra 'Dim btn As CheckBox = DirectCast(sender, CheckBox) 'Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) - Dim CveContratoDetalle As Integer = GvRow.DataKey("CveContratoDetalle").ToString.ToEntero + Dim CveContratoDetalle As Integer = GvRow.DataKey("CveContratoDetalle").ToString.ToEntero Dim objContrato As New ClsContratos - If objContrato.UpdateContratosDetalleAvance(CveContratoDetalle, IIf(PermitirAvance = 1, 0, 1).ToString.ToEntero) Then + If objContrato.UpdateContratosDetalleAvance(CveContratoDetalle, IIf(PermitirAvance = 1, 0, 1).ToString.ToEntero) Then Dim row = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) - row("PermitirAvance") = IIf(PermitirAvance = 1, 0, 1).ToString.ToEntero - - CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) - - Alert("Se ha permitido levantar avance", TipoMensaje.MsgInformacion) - Else - Alert("no se pudo permitir avance", TipoMensaje.MsgAdvertencia) - End If - + row("PermitirAvance") = IIf(PermitirAvance = 1, 0, 1).ToString.ToEntero + + CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) + + Alert("Se ha permitido levantar avance", TipoMensaje.MsgInformacion) + Else + Alert("no se pudo permitir avance", TipoMensaje.MsgAdvertencia) + End If + objContrato.Dispose() End Sub @@ -5197,13 +5197,13 @@ Partial Class Contratos_ContratoObra - Dim Con As New ClsContratos - Dim DTDatos As New DataTable - + Dim Con As New ClsContratos + Dim DTDatos As New DataTable + If Con.GetContratosObraRepAvances(MinFecha, MaxFecha, DdlCliente.SelectedValue.ToEntero, CveContrato, UsuarioActual.CveEmpresa) Then DTDatos = Con.DtResultados - End If - + End If + Con.Dispose() @@ -5325,10 +5325,10 @@ Partial Class Contratos_ContratoObra - DdlAF.Items.Insert(0, New ListItem("Todos", "-1")) - - UpModalMaquinariaFlotilla.Update() - + DdlAF.Items.Insert(0, New ListItem("Todos", "-1")) + + UpModalMaquinariaFlotilla.Update() + End Sub @@ -5440,6 +5440,6 @@ Partial Class Contratos_ContratoObra AddtabalCentrosdecotso(DdlCentroCostos.SelectedValue.ToEntero, DdlCentroCostos.SelectedItem.Text, TxtCentroCostosPorcentaje.Text.ToDecimal) End Sub -End Class - - +End Class + + diff --git a/CxC/RepCxCPeriodo.aspx.cs b/CxC/RepCxCPeriodo.aspx.cs index ea4952923..35de41dd3 100644 --- a/CxC/RepCxCPeriodo.aspx.cs +++ b/CxC/RepCxCPeriodo.aspx.cs @@ -287,7 +287,7 @@ public partial class CxC_RepCxCPeriodo : ClsPaginas StrFiltro.AppendFormat(" Clasificación Cliente: {0}", DdlClienteClasificacion.SelectedItem.Text); string RutaPDF = ""; - string Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas/{UsuarioActual.CveEmpresa}/"; + string Ruta = UsuarioActual.Empresa.Ruta; RutaPDF = $"{Ruta}/Formatos/RepCxCPeriodo.rdlc"; if (!System.IO.File.Exists(RutaPDF)) { diff --git a/GPS/CatDistribuidoresMaster.aspx.vb b/GPS/CatDistribuidoresMaster.aspx.vb index 4c21ac38b..6c532482b 100644 --- a/GPS/CatDistribuidoresMaster.aspx.vb +++ b/GPS/CatDistribuidoresMaster.aspx.vb @@ -98,11 +98,11 @@ Partial Class GPS_CatDistribuidoresMaster 'Dim CveSucursal = objSucursales.AddSucursal("MATRIZ", "M", 0.16, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", "", "", "", "", "", "", "", "", 1) 'If CveSucursal < 0 Then HuboError = True End If - If Not HuboError Then - If Not IO.Directory.Exists(String.Format("{0}\{1}", ModExtensiones.DirectorioBaseEmpresas, objEmpresa.CveEmpresa)) Then - IO.Directory.CreateDirectory(String.Format("{0}Empresas\{1}", ModExtensiones.DirectorioBaseEmpresas, objEmpresa.CveEmpresa)) - End If - Alert("El distribuidor se agregó correctamente", TipoMensaje.MsgInformacion) + If Not HuboError Then + If Not IO.Directory.Exists(String.Format("{0}", UsuarioActual.Empresa.Ruta)) Then + IO.Directory.CreateDirectory(String.Format("{0}", UsuarioActual.Empresa.Ruta)) + End If + Alert("El distribuidor se agregó correctamente", TipoMensaje.MsgInformacion) End If ElseIf EsEditar = 1 Then If objEmpresa.UpdateDistribuidorMaster(TxtRFC.Text, TxtEmpresa.Text, TxtTelefono.Text, TxtContacto.Text, TxtMail.Text, UsuarioActual.CveUsuario, chkEstatus.Checked, CveEmpresa) Then diff --git a/General/RepPaqueteriasGuias.aspx.cs b/General/RepPaqueteriasGuias.aspx.cs index 51a8138da..cb7120051 100644 --- a/General/RepPaqueteriasGuias.aspx.cs +++ b/General/RepPaqueteriasGuias.aspx.cs @@ -854,7 +854,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas string FechIngaFinal = TxtFechaFinalIngreso.Text; - string Ruta = string.Format("{0}Empresas/{1}/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa); + string Ruta = UsuarioActual.Empresa.Ruta; string RutaPDF = string.Format("{0}/Formatos/RepPaqueteriasGuias.rdlc", Ruta); if (!File.Exists(RutaPDF)) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 8b5dd2eca..9a71020a2 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -3000,7 +3000,7 @@ Partial Class Inventarios_EntradasSalidas End If If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, Now.ToString("HH-mm")), String.Format("Empresas\{0}\OI\Temp", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, Now.ToString("HH-mm")), String.Format("{0}OI\Temp", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If @@ -3083,7 +3083,7 @@ Partial Class Inventarios_EntradasSalidas If ObjEventoBitacora.AddEventoBitacora(descripcion, String.Format("{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMovimientoAlmacen:=CveMovimiento) Then If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GvBitacora.DataSource = ObjEventoBitacora.DtResultados diff --git a/Inventarios/PopUpBuscarMovto.aspx.vb b/Inventarios/PopUpBuscarMovto.aspx.vb index 3880f05ec..6765c901f 100644 --- a/Inventarios/PopUpBuscarMovto.aspx.vb +++ b/Inventarios/PopUpBuscarMovto.aspx.vb @@ -9,7 +9,7 @@ Partial Class PopUpBuscarFolio #Region "PROPIEDADES" Private ReadOnly Property Ruta As String Get - Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Return UsuarioActual.Empresa.Ruta End Get End Property #End Region diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index c8d89bea7..3c2820087 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -4284,7 +4284,7 @@ Partial Class Inventarios_RecepcionAlmacen End If If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, Now.ToString("HH-mm")), String.Format("Empresas\{0}\OI\Temp", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, Now.ToString("HH-mm")), String.Format("{0}OI\Temp", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If @@ -4495,7 +4495,7 @@ Partial Class Inventarios_RecepcionAlmacen Dim Compra As String = DdlFolio.SelectedItem.Text Dim RutaPDF As String - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta RutaPDF = $"{Ruta}\Formatos\EntradaAlmacen.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/EntradaAlmacen.rdlc" diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index ba9e4319b..7d4de7d44 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1707,7 +1707,7 @@ Partial Class Inventarios_RecepcionUsados End If If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, Now.ToString("HH-mm")), String.Format("Empresas\{0}\OI\Temp", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, Now.ToString("HH-mm")), String.Format("{0}OI\Temp", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If @@ -1790,7 +1790,7 @@ Partial Class Inventarios_RecepcionUsados If ObjEventoBitacora.AddEventoBitacora(descripcion, String.Format("{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMovimientoAlmacen:=CveMovimiento) Then If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GvBitacora.DataSource = ObjEventoBitacora.DtResultados diff --git a/Inventarios/RepConsumoInterno.aspx.cs b/Inventarios/RepConsumoInterno.aspx.cs index 5dd00883e..0268d9c13 100644 --- a/Inventarios/RepConsumoInterno.aspx.cs +++ b/Inventarios/RepConsumoInterno.aspx.cs @@ -177,7 +177,7 @@ public partial class Inventarios_RepConsumoInterno : ClsPaginas string FechaFin = DateTime.Parse(TxtFechaF.Text).ToShortDateString(); - string Ruta = string.Format("{0}Empresas/{1}/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa); + string Ruta = UsuarioActual.Empresa.Ruta; string RutaPDF = string.Format("{0}/Formatos/RepConsumoInterno.rdlc", Ruta); if (!File.Exists(RutaPDF)) diff --git a/Inventarios/RepEntradasSalidas.aspx.vb b/Inventarios/RepEntradasSalidas.aspx.vb index 6d03bc17b..0765352a7 100644 --- a/Inventarios/RepEntradasSalidas.aspx.vb +++ b/Inventarios/RepEntradasSalidas.aspx.vb @@ -368,7 +368,7 @@ Partial Class Inventarios_ReporteEntradasSalidas FechaF = Now End If Dim RutaPDF As String - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta Dim NombreArchivoDescarga = "ReporteEntradas-Salidas" If UsuarioActual.CveEmpresa.Contiene(119) Then diff --git a/Inventarios/RepEntregasForaneas.aspx.vb b/Inventarios/RepEntregasForaneas.aspx.vb index 23cb7c449..0e3044a3c 100644 --- a/Inventarios/RepEntregasForaneas.aspx.vb +++ b/Inventarios/RepEntregasForaneas.aspx.vb @@ -721,7 +721,7 @@ Partial Class Inventarios_RepEntregasForaneas Dim Tipo As String = DdlTipo.SelectedItem.Text Dim RutaPDF As String - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta RutaPDF = $"{Ruta}\Formatos\RepEntregasForaneas.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepEntregasForaneas.rdlc" diff --git a/Nomina/Finiquito.aspx.cs b/Nomina/Finiquito.aspx.cs index 39df74d49..fb3677356 100644 --- a/Nomina/Finiquito.aspx.cs +++ b/Nomina/Finiquito.aspx.cs @@ -762,7 +762,7 @@ public partial class Nomina_Finiquito : ClsPaginas //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", "")); //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", "")); //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", "")); - string urlfile = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, string.Format("Empresas/{0}/Formatos/SobreReciboFiniquito.rdlc", UsuarioActual.CveEmpresa)); + string urlfile = System.IO.Path.Combine(string.Format("{0}Formatos/SobreReciboFiniquito.rdlc", UsuarioActual.Empresa.Ruta)); if (!System.IO.File.Exists(urlfile)) { urlfile = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas/Grales/Formatos/SobreReciboFiniquito.rdlc"); diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index cf9a412a2..5dc327da1 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -2374,7 +2374,7 @@ public partial class Nomina_Nomina2 : ClsPaginas //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", "")); //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", "")); //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", "")); - string urlfile = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, string.Format("Empresas/{0}/Formatos/SobreRecibo.rdlc", UsuarioActual.CveEmpresa)); + string urlfile = System.IO.Path.Combine(string.Format("{0}Formatos/SobreRecibo.rdlc", UsuarioActual.Empresa.Ruta)); if (!System.IO.File.Exists(urlfile)) { urlfile = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas/Grales/Formatos/SobreRecibo.rdlc"); @@ -6230,7 +6230,7 @@ public partial class Nomina_Nomina2 : ClsPaginas { if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa)) { - Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\\{UsuarioActual.CveEmpresa}\\"; + Ruta = UsuarioActual.Empresa.Ruta; PathXML = $"{Ruta}XML\\Nomina\\{ObjNomina.SerieFolio}.xml"; PathXMLF = $"{Ruta}XML\\Nomina\\{ObjNomina.Serie}F-{ObjNomina.Folio}.xml"; Xmlname = ObjNomina.SerieFolio; diff --git a/OC/CotizacionEnLinea.aspx.vb b/OC/CotizacionEnLinea.aspx.vb index 3390f9e6d..bb512cde4 100644 --- a/OC/CotizacionEnLinea.aspx.vb +++ b/OC/CotizacionEnLinea.aspx.vb @@ -299,10 +299,10 @@ Partial Class OC_CotizacionEnLinea If FUArchivo.HasFile Then 'verificar que exista el directorio - If Not System.IO.Directory.Exists(String.Format("{0}/Empresas/{1}/Cotizaciones/", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa)) Then - System.IO.Directory.CreateDirectory(String.Format("{0}/Empresas/{1}/Cotizaciones/", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa)) + If Not System.IO.Directory.Exists(String.Format("{0}Cotizaciones/", Empresa.Ruta)) Then + System.IO.Directory.CreateDirectory(String.Format("{0}Cotizaciones/", Empresa.Ruta)) End If - FUArchivo.SaveAs(String.Format("{0}/Empresas/{1}/Cotizaciones/{2}{3}", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa, CveCotizacion, IO.Path.GetExtension(FUArchivo.FileName))) + FUArchivo.SaveAs(String.Format("{0}Cotizaciones/{1}{2}", Empresa.Ruta, CveCotizacion, IO.Path.GetExtension(FUArchivo.FileName))) End If For Each dr As GridViewRow In GvD.Rows diff --git a/OC/ListaRequisicion.aspx.cs b/OC/ListaRequisicion.aspx.cs index 36b8d6b66..447ef0980 100644 --- a/OC/ListaRequisicion.aspx.cs +++ b/OC/ListaRequisicion.aspx.cs @@ -102,7 +102,7 @@ public partial class OC_ListaRequisicion : ClsPaginas protected void ImprimiReporte(string Formato = "PDF") { - string Ruta = string.Format("{0}Empresas/{1}/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa); + string Ruta = UsuarioActual.Empresa.Ruta; string RutaPDF = string.Format("{0}/Formatos/ListaRequisicion.rdlc", Ruta); if (!File.Exists(RutaPDF)) diff --git a/OC/PopUpBuscarReq.aspx.vb b/OC/PopUpBuscarReq.aspx.vb index 1290d66c0..60be97147 100644 --- a/OC/PopUpBuscarReq.aspx.vb +++ b/OC/PopUpBuscarReq.aspx.vb @@ -19,7 +19,7 @@ Partial Class OC_PopUpBuscarReq End Property Private ReadOnly Property Ruta As String Get - Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Return UsuarioActual.Empresa.Ruta End Get End Property #End Region diff --git a/OC/RepCotizacionesDetalle.aspx.vb b/OC/RepCotizacionesDetalle.aspx.vb index e519b2935..787112c96 100644 --- a/OC/RepCotizacionesDetalle.aspx.vb +++ b/OC/RepCotizacionesDetalle.aspx.vb @@ -199,12 +199,12 @@ Partial Class PopOCCotizacionesDetalle TxtDiasCredito.Text.ToEntero, UsuarioActual.CveUsuario) Then 'verificar que exista el directorio - If Not System.IO.Directory.Exists(String.Format("{0}/Empresas/{1}/Cotizaciones/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) Then - System.IO.Directory.CreateDirectory(String.Format("{0}/Empresas/{1}/Cotizaciones/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) + If Not System.IO.Directory.Exists(String.Format("{0}Cotizaciones/", UsuarioActual.Empresa.Ruta)) Then + System.IO.Directory.CreateDirectory(String.Format("{0}Cotizaciones/", UsuarioActual.Empresa.Ruta)) End If If Filename <> "" Then - Filename.FilesMove(objCotizacion.CveCotizacion.ToString(), String.Format("Empresas\{0}\Cotizaciones", UsuarioActual.CveEmpresa)) + Filename.FilesMove(objCotizacion.CveCotizacion.ToString(), String.Format("{0}Cotizaciones", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If For Each dr As GridViewRow In GvDC.Rows @@ -220,12 +220,12 @@ Partial Class PopOCCotizacionesDetalle If objCotizacion.UpdateCotizacion(CboProveedores.SelectedValue.ToEntero, -1, TxtFolio.Text, TxtFecha.Text, FileExtension, ddlMoneda.SelectedValue.ToEntero, TxtDiasCredito.Text.ToEntero, UsuarioActual.CveUsuario, CveCotizacion) Then 'verificar que exista el directorio - If Not System.IO.Directory.Exists(String.Format("{0}/Empresas/{1}/Cotizaciones/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) Then - System.IO.Directory.CreateDirectory(String.Format("{0}/Empresas/{1}/Cotizaciones/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) + If Not System.IO.Directory.Exists(String.Format("{0}Cotizaciones/", UsuarioActual.Empresa.Ruta)) Then + System.IO.Directory.CreateDirectory(String.Format("{0}Cotizaciones/", UsuarioActual.Empresa.Ruta)) End If If Filename <> "" Then - Filename.FilesMove(CveCotizacion.ToString(), String.Format("Empresas\{0}\Cotizaciones", UsuarioActual.CveEmpresa)) + Filename.FilesMove(CveCotizacion.ToString(), String.Format("{0}Cotizaciones", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If For Each dr As GridViewRow In GvDC.Rows diff --git a/OI/CircularDetalle.aspx.vb b/OI/CircularDetalle.aspx.vb index 0931f4078..e5a6ed498 100644 --- a/OI/CircularDetalle.aspx.vb +++ b/OI/CircularDetalle.aspx.vb @@ -162,7 +162,7 @@ Partial Class OI_CircularDetalle End Function Private Function TituloAnterior() As String - Dim Directorio As New IO.DirectoryInfo(String.Format("{0}Empresas/{1}/Formatos/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) + Dim Directorio As New IO.DirectoryInfo(String.Format("{0}Formatos/", UsuarioActual.Empresa.Ruta)) Dim ArchivosArreglo As IO.FileInfo() = Directorio.GetFiles() Dim patronRegEx As String = String.Format("^{0}_.*", CveCircular) Dim archivoEncontrado As String = "" diff --git a/OI/CircularDetalleB.aspx.cs b/OI/CircularDetalleB.aspx.cs index 690fef2d1..84886f3f2 100644 --- a/OI/CircularDetalleB.aspx.cs +++ b/OI/CircularDetalleB.aspx.cs @@ -208,7 +208,7 @@ public partial class OI_CircularDetalleB : ClsPaginas private string TituloAnterior() { - System.IO.DirectoryInfo Directorio = new System.IO.DirectoryInfo(string.Format("{0}Empresas/{1}/Formatos/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)); + System.IO.DirectoryInfo Directorio = new System.IO.DirectoryInfo(string.Format("{0}Formatos/", UsuarioActual.Empresa.Ruta)); System.IO.FileInfo[] ArchivosArreglo = Directorio.GetFiles(); string patronRegEx = string.Format("^{0}_.*", CveCircular); string archivoEncontrado = ""; diff --git a/OI/DocumentoDetalle.aspx.cs b/OI/DocumentoDetalle.aspx.cs index ebd3aed72..027218fbe 100644 --- a/OI/DocumentoDetalle.aspx.cs +++ b/OI/DocumentoDetalle.aspx.cs @@ -680,7 +680,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas int CveUsuario = GvRow.DataKey("CveUsuario").ToEntero(); DataRow UsuarioSeleccionado = GetUsuarioParticipante(CveUsuario); string Propuesta = UsuarioSeleccionado["Adjunto"] == null ? "" : UsuarioSeleccionado["Adjunto"].ToString(); - string Ruta = string.Format("{0}Empresas/{1}/DocumentosRepo/{2}/{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, this.CveDocumento, Propuesta); + string Ruta = string.Format("{0}DocumentosRepo/{1}/{2}", UsuarioActual.Empresa.Ruta, this.CveDocumento, Propuesta); if (File.Exists(Ruta)) { byte[] archivoBytes = File.ReadAllBytes(Ruta); diff --git a/OI/Documentos.aspx.cs b/OI/Documentos.aspx.cs index 7a085368f..d55cbd28c 100644 --- a/OI/Documentos.aspx.cs +++ b/OI/Documentos.aspx.cs @@ -46,7 +46,7 @@ public partial class OI_Documentos : ClsPaginas string CveDocumento = GvRow.DataKey("CveDocumento"); //string NombreArchivo = ArchivoFisico.Split('_')[1]; - string Ruta = string.Format("{0}Empresas/{1}/DocumentosRepo/{2}/{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CveDocumento, ArchivoFisico); + string Ruta = string.Format("{0}DocumentosRepo/{1}/{2}", UsuarioActual.Empresa.Ruta, CveDocumento, ArchivoFisico); if (File.Exists(Ruta)) { byte[] archivoBytes = File.ReadAllBytes(Ruta); diff --git a/OI/EventoComentario.aspx.vb b/OI/EventoComentario.aspx.vb index 5d71becb9..78112c2b5 100644 --- a/OI/EventoComentario.aspx.vb +++ b/OI/EventoComentario.aspx.vb @@ -94,21 +94,21 @@ Partial Class OI_EventoComentario Protected Sub BtnCargarArchivo_Click(sender As Object, e As System.EventArgs) Handles BtnCargarArchivo.Click 'Preguntar si existe en temporales - If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString) Then - Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString) - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos") - If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & CveComentario & Extension) Then - File.Delete(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & CveComentario & Extension) - File.Move(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString, ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & CveComentario & Extension) + If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(UsuarioActual.Empresa.Ruta & "Temp\" & Session("FileUpload").ToString) Then + Dim Extension As String = Path.GetExtension(UsuarioActual.Empresa.Ruta & "Temp\" & Session("FileUpload").ToString) + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "OI\Eventos") Then Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "OI\Eventos") + If File.Exists(UsuarioActual.Empresa.Ruta & "OI\Eventos\" & CveComentario & Extension) Then + File.Delete(UsuarioActual.Empresa.Ruta & "OI\Eventos\" & CveComentario & Extension) + File.Move(UsuarioActual.Empresa.Ruta & "Temp\" & Session("FileUpload").ToString, UsuarioActual.Empresa.Ruta & "OI\Eventos\" & CveComentario & Extension) Else - File.Move(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString, ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\OI\Eventos\" & CveComentario & Extension) - End If - - Else - 'Imagen Default - 'If ImgPersonal.ImageUrl = "../Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" Then - ' ImgPersonal.ImageUrl = "/Imagenes/SinImagen.jpg" - 'End If - End If + File.Move(UsuarioActual.Empresa.Ruta & "Temp\" & Session("FileUpload").ToString, UsuarioActual.Empresa.Ruta & "OI\Eventos\" & CveComentario & Extension) + End If + + Else + 'Imagen Default + 'If ImgPersonal.ImageUrl = "../Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" Then + ' ImgPersonal.ImageUrl = "/Imagenes/SinImagen.jpg" + 'End If + End If End Sub End Class \ No newline at end of file diff --git a/OI/Normatividad.aspx.vb b/OI/Normatividad.aspx.vb index d3499d810..812dfa77f 100644 --- a/OI/Normatividad.aspx.vb +++ b/OI/Normatividad.aspx.vb @@ -152,7 +152,7 @@ Partial Class OI_Normatividad If File.Exists(ruta) Then File.Delete(ruta) End If - filemove.FilesMove(String.Format("OI{0}", IDSelected.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", IDSelected.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If Dim customerRow As Data.DataRow @@ -205,7 +205,7 @@ Partial Class OI_Normatividad Idnew = row("CveEvento").ToString().ToEntero If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", Idnew.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", Idnew.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If ArbolCuentas.DataSource = DtDatos diff --git a/OI/PopUpAgenda.aspx.vb b/OI/PopUpAgenda.aspx.vb index 7292474e9..39af5e7be 100644 --- a/OI/PopUpAgenda.aspx.vb +++ b/OI/PopUpAgenda.aspx.vb @@ -785,18 +785,18 @@ Partial Class OI_PopUpAgenda ObjEventos.Dispose() End Sub Protected Sub BtnCargarArchivo_Click(sender As Object, e As System.EventArgs) Handles BtnCargarArchivo.Click - If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString) Then - Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString) - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Eventos\Archivos") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Eventos\Archivos") - File.Move(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString, ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Eventos\" & CveEvento & "_" & ArchConsecutivo & Extension) + If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(UsuarioActual.Empresa.Ruta & "Temp\" & Session("FileUpload").ToString) Then + Dim Extension As String = Path.GetExtension(UsuarioActual.Empresa.Ruta & "Temp\" & Session("FileUpload").ToString) + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Eventos\Archivos") Then Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Eventos\Archivos") + File.Move(UsuarioActual.Empresa.Ruta & "Temp\" & Session("FileUpload").ToString, UsuarioActual.Empresa.Ruta & "Eventos\" & CveEvento & "_" & ArchConsecutivo & Extension) Session("FileUpload") = "" - If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Eventos\Archivos" & CveEvento & "_" & ArchConsecutivo & Extension) Then + If File.Exists(UsuarioActual.Empresa.Ruta & "Eventos\Archivos" & CveEvento & "_" & ArchConsecutivo & Extension) Then Dim ObjActivosFijos As New ClsAF If ObjActivosFijos.AddActivosFijosImagenes(CveEvento, CveEvento & "_" & ArchConsecutivo & Extension, UsuarioActual.CveUsuario) Then 'CargarArchivo() Else - File.Delete(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Eventos\Archivos" & CveEvento & "_" & ArchConsecutivo & Extension) + File.Delete(UsuarioActual.Empresa.Ruta & "Eventos\Archivos" & CveEvento & "_" & ArchConsecutivo & Extension) End If ObjActivosFijos.Dispose() @@ -840,8 +840,8 @@ Partial Class OI_PopUpAgenda 'End Sub Protected Sub BtnAddObs_Click(sender As Object, e As EventArgs) Handles BtnAddObs.Click - Dim RutaGuardar As String = String.Format("{0}Empresas\{1}\OI\", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) - Dim RutaArchivo As String = String.Format("{0}Empresas\{1}\OI\Temp\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Session("Eventos")) + Dim RutaGuardar As String = String.Format("OI\", UsuarioActual.Empresa.Ruta) + Dim RutaArchivo As String = String.Format("OI\Temp\{2}", UsuarioActual.Empresa.Ruta, Session("Eventos")) Dim tCveSeguimiento As Integer Dim Archivo As String = "" diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb index 647fd13a9..4f8681043 100644 --- a/OS/OrdenesServicios.aspx.vb +++ b/OS/OrdenesServicios.aspx.vb @@ -1329,7 +1329,7 @@ Partial Class OS_OrdenesServicios End If If Filename <> "" Then - Filename.FilesMove(String.Format("OS{0}-{1}", UsuarioActual.CveUsuario, Consecutivo), String.Format("Empresas\{0}\OS\Temp", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OS{0}-{1}", UsuarioActual.CveUsuario, Consecutivo), String.Format("{0}OS\Temp", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If AddPS(Consecutivo, -1, DdlPSDetalle.SelectedValue.ToEntero, DdlPSDetalle.SelectedItem.Text, TxtCantidad.Text.ToEntero, TxtObservacionesServicioDetalle.Text, HdnEspecificaciones.Value.ToString, LtlPSEspecificaciones.Text, "", @@ -1476,7 +1476,7 @@ Partial Class OS_OrdenesServicios If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveOS, -1, -1, -1, -1) Then If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GvEB.DataSource = ObjEventoBitacora.DtResultados diff --git a/Planeacion/CargarArchivo.aspx.vb b/Planeacion/CargarArchivo.aspx.vb index 929ee65a1..f4ea6329e 100644 --- a/Planeacion/CargarArchivo.aspx.vb +++ b/Planeacion/CargarArchivo.aspx.vb @@ -17,10 +17,10 @@ Partial Class CargarArchivo Protected Sub AFU_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AFU.UploadedComplete If AFU.HasFile Then - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp") Then - Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp") + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Temp") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Temp") End If - Dim UploadFolder As String = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" + Dim UploadFolder As String = UsuarioActual.Empresa.Ruta & "Temp\" Dim Extension As String = System.IO.Path.GetExtension(AFU.PostedFile.FileName) If System.IO.File.Exists(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension) Then diff --git a/Planeacion/CargarImagen.aspx.vb b/Planeacion/CargarImagen.aspx.vb index 96af0e798..4a4114b00 100644 --- a/Planeacion/CargarImagen.aspx.vb +++ b/Planeacion/CargarImagen.aspx.vb @@ -13,10 +13,10 @@ Partial Class CargarImagen Protected Sub AFU_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AFU.UploadedComplete If AFU.HasFile Then - If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp") Then - Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp") + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "Temp") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Temp") End If - Dim UploadFolder As String = ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" + Dim UploadFolder As String = UsuarioActual.Empresa.Ruta & "Temp\" Dim Extension As String = System.IO.Path.GetExtension(AFU.PostedFile.FileName) If System.IO.File.Exists(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension) Then diff --git a/Planeacion/Sucursal.aspx.vb b/Planeacion/Sucursal.aspx.vb index 69d00a738..2e9702867 100644 --- a/Planeacion/Sucursal.aspx.vb +++ b/Planeacion/Sucursal.aspx.vb @@ -62,7 +62,7 @@ Partial Class Sucursal Else Matriz.Checked = False End If - If System.IO.File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\Formatos\" & DT.Rows(0)("FormatoFactura").ToString) Then + If System.IO.File.Exists(UsuarioActual.Empresa.Ruta & "Formatos\" & DT.Rows(0)("FormatoFactura").ToString) Then 'DirectCast("HLVer", HtmlLink). = "Ver" End If diff --git a/PortalCliente/PortalCliente.aspx.vb b/PortalCliente/PortalCliente.aspx.vb index e6245a911..471ed5960 100644 --- a/PortalCliente/PortalCliente.aspx.vb +++ b/PortalCliente/PortalCliente.aspx.vb @@ -363,7 +363,7 @@ Partial Class Ventas_PortalCliente 'Dim ObjEmprea As New ClsEmpresas() 'If ObjEmprea.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then Dim ObjMail As New ClsSisMail() - Dim Ruta As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta If File.Exists(Ruta & "PDF\" & HdnFolioVenta.Value & ".pdf") AndAlso File.Exists(Ruta & "XML\" & HdnFolioVenta.Value & ".xml") Then Dim PDF As String = Ruta & "PDF\" & HdnFolioVenta.Value & ".pdf" @@ -1309,7 +1309,7 @@ Partial Class Ventas_PortalCliente If e.Row.RowIndex >= 0 Then e.Row.Cells(0).Width = Unit.Pixel(100) 'CARGAR IMAGENES DE PERSONAL - If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & e.Row.DBCampo("URL") & ".png") Then + If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & e.Row.DBCampo("URL") & ".png") Then e.Row.FCImage("ImgPersonal").ImageUrl = "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & e.Row.DBCampo("URL") & ".png" End If diff --git a/PortalProveedor/PortalProveedor.aspx.vb b/PortalProveedor/PortalProveedor.aspx.vb index 093cdb5ec..1c935a145 100644 --- a/PortalProveedor/PortalProveedor.aspx.vb +++ b/PortalProveedor/PortalProveedor.aspx.vb @@ -594,7 +594,7 @@ Partial Class Portal_PortalProveedor Protected Sub GvBancos_comprobante(sender As Object, e As EventArgs) Dim Gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim Path As String = String.Format("{0}{1}{2}{3}{4}{5}", ModExtensiones.DirectorioBaseEmpresas, "Empresas\", UsuarioActual.CveEmpresa, "\IE\", Gvr.FCHiddenField("CveIe").Value, ".png") + Dim Path As String = String.Format("{0}{1}{2}{3}", UsuarioActual.Empresa.Ruta, "IE\", Gvr.FCHiddenField("CveIe").Value, ".png") Dim Archivo As New System.IO.FileInfo(Path) If Archivo.Exists Then diff --git a/Prospectos/Prospectos.aspx.vb b/Prospectos/Prospectos.aspx.vb index 4934ab8ef..49ace671c 100644 --- a/Prospectos/Prospectos.aspx.vb +++ b/Prospectos/Prospectos.aspx.vb @@ -289,7 +289,7 @@ Partial Class Prospectos_Prospectos If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), -1, -1, CveProspecto, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If diff --git a/Proveedores/PortalProveedor.aspx.vb b/Proveedores/PortalProveedor.aspx.vb index 2a3a50e6d..ad4ae37f7 100644 --- a/Proveedores/PortalProveedor.aspx.vb +++ b/Proveedores/PortalProveedor.aspx.vb @@ -412,7 +412,7 @@ Partial Class Portal_PortalProveedor Protected Sub GvBancos_comprobante(sender As Object, e As EventArgs) Dim Gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim Path As String = String.Format("{0}{1}{2}{3}{4}{5}", ModExtensiones.DirectorioBaseEmpresas, "Empresas\", UsuarioActual.CveEmpresa, "\IE\", Gvr.FCHiddenField("CveIe").Value, ".png") + Dim Path As String = String.Format("{0}{1}{2}{3}", UsuarioActual.Empresa.Ruta, "IE\", Gvr.FCHiddenField("CveIe").Value, ".png") Dim Archivo As New System.IO.FileInfo(Path) If Archivo.Exists Then diff --git a/RH/CatCursos.aspx.vb b/RH/CatCursos.aspx.vb index cf3b85c55..461c691fe 100644 --- a/RH/CatCursos.aspx.vb +++ b/RH/CatCursos.aspx.vb @@ -327,9 +327,9 @@ Partial Class RH_CatCursos Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim params As New List(Of ReportParameter) - Dim Archivo As String = $"Empresas/{UsuarioActual.CveEmpresa}/Formatos/CursosInvitados.rdlc" + Dim Archivo As String = $"{UsuarioActual.Empresa.Ruta}Formatos/CursosInvitados.rdlc" - If Not File.Exists($"{Extensiones.DirectorioBaseEmpresas}/{Archivo}") Then + If Not File.Exists(Archivo) Then Archivo = "Empresas/Grales/Formatos/CursosInvitados.rdlc" End If diff --git a/RH/MiPerfil.aspx.vb b/RH/MiPerfil.aspx.vb index b2793709e..9fe5b2b49 100644 --- a/RH/MiPerfil.aspx.vb +++ b/RH/MiPerfil.aspx.vb @@ -467,7 +467,7 @@ Partial Class RH_MiPerfil puestoProp = "" End If - If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & ObjPersonal.URL) Then + If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.URL) Then ImgPersonal.ImageUrl = $"/Empresas/{UsuarioActual.CveEmpresa}/RH/Personal/{ObjPersonal.URL}" End If diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index da16a8d97..bc495a4c1 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -1470,17 +1470,17 @@ Partial Class RH_Personal End If - If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & ".jpg") Then + If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpg") Then Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.jpg", UsuarioActual.CveEmpresa, CvePersonal) Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) ImgPersonal.ImageUrl = logouri - ElseIf File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & ".png") Then + ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".png") Then Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.png", UsuarioActual.CveEmpresa, CvePersonal) Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) ImgPersonal.ImageUrl = logouri - ElseIf File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & ".bmp") Then + ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".bmp") Then Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.bmp", UsuarioActual.CveEmpresa, CvePersonal) Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) @@ -1689,9 +1689,9 @@ Partial Class RH_Personal Dim ObjCuentasDeposito As New ClsGenerales(ObjPersonal.IniciaTransacSQL()) Dim ObjAF As New ClsAF(ObjPersonal.IniciaTransacSQL()) - Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\RH\" & ViewState("Archivo").ToString()) + Dim Extension As String = Path.GetExtension(UsuarioActual.Empresa.Ruta & "Temp\RH\" & ViewState("Archivo").ToString()) Dim URL As String = CvePersonal & Extension - Dim Ruta = String.Format("{0}Empresas\{1}\Temp\RH\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ViewState("Archivo").ToString()) + Dim Ruta = String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, ViewState("Archivo").ToString()) Dim Archivo As New System.IO.FileInfo(Ruta) @@ -2817,7 +2817,7 @@ Partial Class RH_Personal If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal) Then If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GvEB.DataSource = ObjEventoBitacora.DtResultados @@ -3405,7 +3405,7 @@ Partial Class RH_Personal - If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & ObjPersonal.URL & ".png") Then + If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.URL & ".png") Then params.Add(New ReportParameter("LogoUri", "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & ObjPersonal.URL & ".png")) Else params.Add(New ReportParameter("LogoUri", "")) @@ -3507,7 +3507,7 @@ Partial Class RH_Personal - If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & ObjPersonal.URL & ".png") Then + If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.URL & ".png") Then params.Add(New ReportParameter("LogoUri", "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & ObjPersonal.URL & ".png")) Else params.Add(New ReportParameter("LogoUri", "")) @@ -3553,7 +3553,7 @@ Partial Class RH_Personal - If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & ObjPersonal.CvePersonal & ".png") Then + If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.CvePersonal & ".png") Then params.Add(New ReportParameter("LogoUri", String.Format("{0}://{1}:{2}/Empresas/{3}/RH/Personal/{4}.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, ObjPersonal.CvePersonal))) Else params.Add(New ReportParameter("LogoUri", "")) @@ -5348,9 +5348,9 @@ Partial Class RH_Personal FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") filemove = fileItem.filename - Dim yaExistente As String = String.Format("{0}Empresas\{1}\RH\Personal\{2}.jpg", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CvePersonal) - Dim yaExistentePNG As String = String.Format("{0}Empresas\{1}\RH\Personal\{2}.png", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CvePersonal) - Dim yaExistenteBMP As String = String.Format("{0}Empresas\{1}\RH\Personal\{2}.bmp", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CvePersonal) + Dim yaExistente As String = String.Format("{0}RH\Personal\{1}.jpg", UsuarioActual.Empresa.Ruta, CvePersonal) + Dim yaExistentePNG As String = String.Format("{0}RH\Personal\{1}.png", UsuarioActual.Empresa.Ruta, CvePersonal) + Dim yaExistenteBMP As String = String.Format("{0}RH\Personal\{1}.bmp", UsuarioActual.Empresa.Ruta, CvePersonal) If File.Exists(yaExistente) Then File.Delete(yaExistente) @@ -5361,11 +5361,11 @@ Partial Class RH_Personal End If If filemove <> "" Then - filemove.FilesMove(CvePersonal.ToString(), String.Format("Empresas\{0}\RH\Personal\", UsuarioActual.CveEmpresa)) + filemove.FilesMove(CvePersonal.ToString(), String.Format("{0}RH\Personal\", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If ViewState("Archivo") = String.Format("{0}.{1}", CvePersonal.ToString(), FileExtension) Next - If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & "." & FileExtension) Then + If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & "." & FileExtension) Then Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.{2}", UsuarioActual.CveEmpresa, CvePersonal, FileExtension) Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}&version={4}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica), Now) ImgPersonal.ImageUrl = logouri @@ -5596,7 +5596,7 @@ Partial Class RH_Personal Protected Sub GenerarPDFConsumo(Optional Formato As String = "PDF") Dim CodigoP As String = "" Dim NombreCompletoP As String = "" - Dim Ruta As String = String.Format("{0}Empresas/{1}/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) + Dim Ruta As String = UsuarioActual.Empresa.Ruta Dim RutaPDF As String = String.Format("{0}/Formatos/RepConsumoPersonal.rdlc", Ruta) If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepConsumoPersonal.rdlc" diff --git a/RH/Prospectos.aspx.vb b/RH/Prospectos.aspx.vb index 4934ab8ef..49ace671c 100644 --- a/RH/Prospectos.aspx.vb +++ b/RH/Prospectos.aspx.vb @@ -289,7 +289,7 @@ Partial Class Prospectos_Prospectos If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), -1, -1, CveProspecto, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If diff --git a/RH/RepBuzonCalidad.aspx.vb b/RH/RepBuzonCalidad.aspx.vb index 85ec18f65..a4ee140d9 100644 --- a/RH/RepBuzonCalidad.aspx.vb +++ b/RH/RepBuzonCalidad.aspx.vb @@ -66,7 +66,7 @@ Partial Class RH_RepBuzonCalidad e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left Else ' - If System.IO.File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & e.Row.DBCampo("CvePersonal") & ".png") Then + If System.IO.File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & e.Row.DBCampo("CvePersonal") & ".png") Then e.Row.FCImage("ImgPersonal").ImageUrl = "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & e.Row.DBCampo("CvePersonal") & ".png" End If e.Row.Cells(0).Visible = False diff --git a/Sistemas/Empresa.aspx.vb b/Sistemas/Empresa.aspx.vb index bf1c5fadc..66b11a5ce 100644 --- a/Sistemas/Empresa.aspx.vb +++ b/Sistemas/Empresa.aspx.vb @@ -1467,8 +1467,17 @@ Partial Class Sistemas_Empresa Dim Archivopfx As String Dim Archivokey As Archivo = Nothing Dim Archivocer As Archivo = Nothing - Dim dirbase = String.Format("{0}Empresas\{1}\Certificados\Fiel\", ModExtensiones.DirectorioBaseEmpresas, ViewState("CveEmpresa")) - Dim dirbasepfx = String.Format("{0}Empresas\{1}\Certificados\", ModExtensiones.DirectorioBaseEmpresas, ViewState("CveEmpresa")) + + Dim dirbase = "" ' String.Format("{0}Empresas\{1}\Certificados\Fiel\", ModExtensiones.DirectorioBaseEmpresas, ViewState("CveEmpresa")) + Dim dirbasepfx = "" ' String.Format("{0}Empresas\{1}\Certificados\", ModExtensiones.DirectorioBaseEmpresas, ViewState("CveEmpresa")) + If EmpresaEditar IsNot Nothing Then + dirbase = String.Format("{0}Certificados\Fiel\", EmpresaEditar.Ruta) + dirbasepfx = String.Format("{0}Certificados\", EmpresaEditar.Ruta) + Else + dirbase = String.Format("{0}Empresas\{1}\Certificados\Fiel\", ModExtensiones.DirectorioBaseEmpresas, ViewState("CveEmpresa")) + dirbasepfx = String.Format("{0}Empresas\{1}\Certificados\", ModExtensiones.DirectorioBaseEmpresas, ViewState("CveEmpresa")) + End If + If (Not Directory.Exists(dirbase)) Then Directory.CreateDirectory(dirbase) End If diff --git a/Site.master.vb b/Site.master.vb index 5f9de4168..a6f63e6b8 100644 --- a/Site.master.vb +++ b/Site.master.vb @@ -500,7 +500,7 @@ Partial Class Site Private Function ConvertCER() As String Try - Dim Archivo As String = String.Format("{0}Empresas\{1}\Certificados\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.ArchivoCer) + Dim Archivo As String = String.Format("{0}Certificados\{1}", UsuarioActual.Empresa.Ruta, UsuarioActual.Empresa.ArchivoCer) If File.Exists(Archivo) Then Dim CerFile As New FileStream(Archivo, FileMode.Open, FileAccess.Read) Dim Size As Integer = CerFile.Length.ToString().ToEntero() diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index f9cddc43f..83de68f2e 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -2121,7 +2121,7 @@ Partial Class Clientes If HdnCveVenta.Value <> "-1" AndAlso HdnFolioVenta.Value <> "-1" Then Dim ObjMail As New ClsSisMail() - Dim Ruta As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta Dim Cuerpo As String = TxtBody.Text Dim Asunto As String = "" @@ -3678,7 +3678,7 @@ Partial Class Clientes If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If GvEB.DataSource = ObjEventoBitacora.DtResultados @@ -5310,7 +5310,7 @@ Partial Class Clientes If HdnCveVenta2.Value <> "-1" AndAlso HdnFolioVenta2.Value <> "-1" Then Dim ObjMail As New ClsSisMail() - Dim Ruta As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta Dim Cuerpo As String = TxtBody2.Text Dim Asunto As String = "" @@ -7116,13 +7116,13 @@ Partial Class Clientes If GvRow.DataKey("Documentacion") = "Pagaré" AndAlso UsuarioActual.CveEmpresa = 140 Then - stringDescargaDocumento = ModExtensiones.DirectorioBaseEmpresas & String.Format("Empresas\{0}\Formatos\Pagaré.docx", UsuarioActual.CveEmpresa) + stringDescargaDocumento = UsuarioActual.Empresa.Ruta & "Formatos\Pagaré.docx" TxtDireccionAval.Text = "" TxtAval.Text = "" RegistraScript("$('#ModalDivPagare').modal('show')") Else - stringDescargaDocumento = ModExtensiones.DirectorioBaseEmpresas & String.Format("Empresas\{0}\DocElectronica\Clientes\{1}\{2}", UsuarioActual.CveEmpresa, CveCliente, Adjunto) + stringDescargaDocumento = UsuarioActual.Empresa.Ruta & String.Format("DocElectronica\Clientes\{0}\{1}", CveCliente, Adjunto) linkDescargaPagare = stringDescargaDocumento diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 17b13577e..95fe80359 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -776,7 +776,7 @@ Partial Class Ventas_ClientesAbonar 'Guardar archivo If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)) + filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If @@ -2507,8 +2507,8 @@ Partial Class Ventas_ClientesAbonar PDFReciboDePagos(-1, -1, ObjBancos.CveComplementoPago, False) - Dim LigaDescargaXML = $"../Empresas/{UsuarioActual.CveEmpresa}/XML/Pag/{ObjBancos.ComplementoSerieFolio}.xml" - Dim LigaDescargaPDF = $"../Empresas/{UsuarioActual.CveEmpresa}/PDF/Pag/{ObjBancos.ComplementoSerieFolio}.pdf" + 'Dim LigaDescargaXML = $"../Empresas/{UsuarioActual.CveEmpresa}/XML/Pag/{ObjBancos.ComplementoSerieFolio}.xml" + 'Dim LigaDescargaPDF = $"../Empresas/{UsuarioActual.CveEmpresa}/PDF/Pag/{ObjBancos.ComplementoSerieFolio}.pdf" Retorno.AppendFormat(" Complemento de pago {0}
", ObjBancos.ComplementoSerieFolio) Retorno.AppendFormat("XML    ", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CveComplementoPago={1}&CveIE={2}", ObjBancos.ComplementoSerieFolio, ObjBancos.CveComplementoPago, CveIE))) Retorno.AppendFormat("PDF   ", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CveComplementoPago={1}&CveIE={2}", ObjBancos.ComplementoSerieFolio, ObjBancos.CveComplementoPago, CveIE))) diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 1c5db7aa7..96dfaf3ed 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -227,7 +227,7 @@ Partial Class PV Private ReadOnly Property Ruta As String Get - Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Return UsuarioActual.Empresa.Ruta End Get End Property diff --git a/Ventas/PopUpBuscarFolio.aspx.vb b/Ventas/PopUpBuscarFolio.aspx.vb index 960074304..f6ecdce33 100644 --- a/Ventas/PopUpBuscarFolio.aspx.vb +++ b/Ventas/PopUpBuscarFolio.aspx.vb @@ -7,7 +7,7 @@ Partial Class PopUpBuscarFolio Private ReadOnly Property Ruta As String Get - Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Return UsuarioActual.Empresa.Ruta End Get End Property diff --git a/Ventas/PopUpImprimir.aspx.vb b/Ventas/PopUpImprimir.aspx.vb index bf9706395..5148fd881 100644 --- a/Ventas/PopUpImprimir.aspx.vb +++ b/Ventas/PopUpImprimir.aspx.vb @@ -64,7 +64,7 @@ Partial Class PopUpImprimir RegistraScript("$get('tdContenido').style.height='520px'") Else - Dim Path As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" & Ext & "\" & CveVenta & "." & Ext + Dim Path As String = UsuarioActual.Empresa.Ruta & Ext & "\" & CveVenta & "." & Ext Dim Archivo As New System.IO.FileInfo(Path) If Archivo.Exists Then diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index be2d00b05..c35cc0d46 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -2438,7 +2438,7 @@ Partial Class ProductosyServicios Dim Archivo = "" Dim DirectorioTemporal = "" - Dim DirectorioDestino = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\Ecommerce\Productos\Imagenes\" + Dim DirectorioDestino = $"{UsuarioActual.Empresa.Ruta}\Ecommerce\Productos\Imagenes\" If Not Directory.Exists(DirectorioDestino) Then Directory.CreateDirectory(DirectorioDestino) End If @@ -2473,7 +2473,7 @@ Partial Class ProductosyServicios If (CveImagenActivoFijo > 0) Then Dim ObjEcommerce As New ClsECommerce If ObjEcommerce.ProductosImagenesRemove(CveImagenActivoFijo, UsuarioActual.CveEmpresa) Then - File.Delete(String.Format("{0}Empresas\{1}\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ObjEcommerce.DtResultados.Rows(0)("URL"))) + File.Delete(String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjEcommerce.DtResultados.Rows(0)("URL"))) CargarGaleriaImagenesEcommerce() RegistraScript("initcarusel();") End If diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb index 47208fa02..cd2ca327a 100644 --- a/Ventas/RepPS.aspx.vb +++ b/Ventas/RepPS.aspx.vb @@ -226,8 +226,8 @@ Partial Class Ventas_RepPS End If params.Add(New ReportParameter("Parametros", SbParametros.ToString())) - If System.IO.File.Exists($"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc") Then - ImprimirPDF($"Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS") + If System.IO.File.Exists($"{UsuarioActual.Empresa.Ruta}Formatos/RepPS.rdlc") Then + ImprimirPDF($"{UsuarioActual.Empresa.Ruta}Formatos/RepPS.rdlc", DtReporte, params, "ReportePS") Else ImprimirPDF($"Empresas/Grales/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS") End If diff --git a/Ventas/RepRecuperacionDetalle.aspx.vb b/Ventas/RepRecuperacionDetalle.aspx.vb index bbbb91a97..1c99eed8e 100644 --- a/Ventas/RepRecuperacionDetalle.aspx.vb +++ b/Ventas/RepRecuperacionDetalle.aspx.vb @@ -341,7 +341,7 @@ Partial Class Ventas_RepRecuperacionDetalle If DdlClienteSucursal.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Cliente Sucursal: {0}", DdlClienteSucursal.SelectedItem.Text) Dim RutaPDF As String - Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = UsuarioActual.Empresa.Ruta '$"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" RutaPDF = $"{Ruta}\Formatos\RepRecuperacionDetalle.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepRecuperacionDetalle.rdlc" diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index c54c6f784..2a85b6ce7 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -1060,7 +1060,7 @@ <%----%> <%--0--%> diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index b9521be42..e34a4dfbe 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6949,6 +6949,11 @@ Partial Class Ventas GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlUnidadMedida").Enabled = False GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlClasificacion").Enabled = False End If + + If GvPS.Rows(e.NewEditIndex).DataKey("CvePromocionDetalle").ToString().ToEntero() > 0 Then + GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False + GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").ToolTip = "No se puede editar el descuento porque viene de una promoción" + End If End Sub Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit GvPS.EditIndex = -1 @@ -6971,7 +6976,7 @@ Partial Class Ventas Exit Sub End If - If UsuarioActual.CveEmpresa = 140 Then + If UsuarioActual.CveEmpresa = 140 OrElse DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then ObjDescuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero(), Cantidad, PU) End If @@ -7214,6 +7219,10 @@ Partial Class Ventas TmpDT.Rows(e.RowIndex)("PorcentajeRetISR") = ClienteRetISR TmpDT.Rows(e.RowIndex)("CuentaPredial") = CuentaPredial + If ObjDescuento IsNot Nothing Then + TmpDT.Rows(e.RowIndex)("CvePromocionDetalle") = ObjDescuento.CvePromocionDetalle + End If + If GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").Items.Count = 0 Then TmpDT.Rows(e.RowIndex)("Proyecto") = "Sin Proyecto Asignado" TmpDT.Rows(e.RowIndex)("CveSubProyecto") = -1 @@ -8442,7 +8451,7 @@ Partial Class Ventas Try - Dim DirectoriArchivoXML As String = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas", UsuarioActual.CveEmpresa.ToString(), ObjFactura.TipoDocto) + Dim DirectoriArchivoXML As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto) ' System.IO.Path.Combine() If Not Directory.Exists(DirectoriArchivoXML) Then Directory.CreateDirectory(DirectoriArchivoXML) End If @@ -13727,7 +13736,7 @@ Partial Class Ventas End If If UsuarioActual.Empresa.CvePlataforma = 2 Then - PdfFacturaPyME(ObjFactura, TmpDT) + PdfFacturaPyME(ObjFactura, TmpDT, False) Else 'REINICIA VALORES DE CONVERSION DE MONEDA @@ -13779,7 +13788,7 @@ Partial Class Ventas End Select - ImprimirbytesPDF(PdfFactura(ObjFactura), "Factura", "PDF") + ImprimirbytesPDF(PdfFactura(ObjFactura, Guardar:=False), "Factura", "PDF") Select Case ConversionRemision Case "*" @@ -16694,11 +16703,11 @@ Partial Class Ventas Dim dr As DataRow = Nothing If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then - dr = DtPromociones.FiltroPrimero(String.Format("CvePS = {0} AND (CveSubProyecto = {1} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {2} OR CveRinTamaño IS NULL) AND ((TipoPromocion <> 3 AND (CantidadMinima <= {3} OR CantidadMinima IS NULL)) OR (TipoPromocion = 3 AND CantidadMinima <= {3} ))", CvePS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc ") + dr = DtPromociones.FiltroPrimero(String.Format("CvePS = {0} AND (CveSubProyecto = {1} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {2} OR CveRinTamaño IS NULL) AND ((TipoPromocion <> 3 AND (CantidadMinima <= {3} OR CantidadMinima IS NULL)) OR (TipoPromocion = 3 AND CantidadMinima <= {3} ))", CvePS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, Cantidad), Orderby:="CantidadMinima desc ") If dr Is Nothing Then 'verifica marca, si tiene asignada la promocion - dr = DtPromociones.FiltroPrimero(String.Format("CvePS IS NULL AND CveClasificacion = {0} AND (CveMarca = {1} OR CveMarca IS NULL) AND (CveSubProyecto = {2} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {3} OR CveRinTamaño IS NULL) AND ((TipoPromocion <> 3 AND (CantidadMinima <= {4} OR CantidadMinima IS NULL)) OR (TipoPromocion = 3 AND CantidadMinima <= {4} )) ", CveClasifPS, CveMarcaPS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc") + dr = DtPromociones.FiltroPrimero(String.Format("CvePS IS NULL AND CveClasificacion = {0} AND (CveMarca = {1} OR CveMarca IS NULL) AND (CveSubProyecto = {2} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {3} OR CveRinTamaño IS NULL) AND ((TipoPromocion <> 3 AND (CantidadMinima <= {4} OR CantidadMinima IS NULL)) OR (TipoPromocion = 3 AND CantidadMinima <= {4} )) ", CveClasifPS, CveMarcaPS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, Cantidad), Orderby:="CantidadMinima desc") End If End If @@ -16714,7 +16723,7 @@ Partial Class Ventas TipoAplicacion = dr("TipoAplicacion").ToString().ToEntero() If CantMinima > 0 Then - Cant = Math.Floor(TxtCantidad.Text.ToDecimal / CantMinima).ToEntero() + Cant = Math.Floor(Cantidad / CantMinima).ToEntero() End If End If @@ -19762,7 +19771,7 @@ Partial Class Ventas Dim ObjEventos As New ClsOIEventos() If ObjEventos.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventos.CveEvento.ToString()), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}", ObjEventos.CveEvento.ToString()), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) End If End If ObjEventos.Dispose() @@ -21517,7 +21526,7 @@ Partial Class Ventas Dim RFC As String = "" Dim XMLDoc As New XmlDocument - Dim Archivo As String = String.Format("{0}Empresas\{1}\Ventas\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Request("RFC"), $"{Request("CveFactura")}.xml") + Dim Archivo As String = String.Format("{0}Ventas\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("RFC"), $"{Request("CveFactura")}.xml") If IO.File.Exists(Archivo) Then Dim Validada As Boolean = True @@ -22987,7 +22996,7 @@ Partial Class Ventas RequiereAlmacenOrigen = True DdlAlmacenOrigen.Items.Clear() DdlAlmacenOrigen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) - DdlAlmacenOrigen.SelectedValue = "-1" + DdlAlmacenOrigen.SelectedValueExist("-1") DdlAlmacenOrigen.DataBind() DdlAlmacenOrigen.Items.Insert(0, New ListItem("Almacen", DbRowVenta("CveAlmacenTraspasoDestino").ToString())) DdlAlmacenOrigen.SelectedValueExist(DbRowVenta("CveAlmacenTraspasoDestino").ToString()) @@ -30052,7 +30061,7 @@ Partial Class Ventas For Each drow As DataRow In factura.DtDetalle.Rows If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then Resultado = False Exit For @@ -31939,8 +31948,7 @@ Partial Class Ventas Adjunto = String.Format("{0}-{1}.{2}", LblSerie.Text, TxtFolio.Text, FileExtension) Dim objVentas As New ClsVentas Dim Path As String - Path = Extensiones.DirectorioBaseEmpresas - Path += String.Format("Empresas/{0}/Ventas", UsuarioActual.CveEmpresa) + Path = String.Format("{0}Ventas", UsuarioActual.Empresa.Ruta) If Not Directory.Exists(Path) Then Directory.CreateDirectory(Path) End If @@ -31967,8 +31975,7 @@ Partial Class Ventas Protected Sub BtnArchivoAdjunto_Click(sender As Object, e As System.EventArgs) Handles BtnArchivoAdjunto.Click Dim ruta As String = HttpContext.Current.Request.ApplicationPath - ruta = Extensiones.DirectorioBaseEmpresas - ruta += String.Format("Empresas/{0}/Ventas", UsuarioActual.CveEmpresa) + ruta = String.Format("{0}Ventas", UsuarioActual.Empresa.Ruta) ruta += $"/{Adjunto}" Dim Archivo As New System.IO.FileInfo(ruta) @@ -32003,7 +32010,7 @@ Partial Class Ventas Protected Sub BtnEliminarAdjunto_Click(sender As Object, e As System.EventArgs) Handles BtnEliminarAdjunto.Click Dim objVentas As New ClsVentas Dim Path As String - Path = String.Format("{0}Empresas/{1}/Ventas/{2}", Extensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Adjunto) + Path = String.Format("{0}Ventas/{1}", UsuarioActual.Empresa.Ruta, Adjunto) If File.Exists(Path) Then File.Delete(Path) End If diff --git a/Ventas/eFacturas.aspx.vb b/Ventas/eFacturas.aspx.vb index 2fe02e10e..92b66a211 100644 --- a/Ventas/eFacturas.aspx.vb +++ b/Ventas/eFacturas.aspx.vb @@ -48,7 +48,7 @@ Partial Class Ventas_eFacturas txtFechaF.Text = Now.ToShortDateString 'txtFechaI.Text.ToDate.AddMonths(1).AddDays(-1).ToShortDateString - Destino = String.Format("{0}Ventas\", UsuarioActual.Empresa.Ruta) 'string.format("{0}Empresas\{1}\Compras\", ModExtensiones.DirectorioBaseEmpresas ,UsuarioActual.CveEmpresa & "\Compras\" + Destino = String.Format("{0}Ventas\", UsuarioActual.Empresa.Ruta) Ejecutable = String.Format("{0}\Utilerias\eeeFacturas.exe", AppDomain.CurrentDomain.BaseDirectory) Form.DefaultButton = BtnConsultar.UniqueID @@ -354,7 +354,7 @@ Partial Class Ventas_eFacturas Protected Sub LnkNoRecibidas_Click(sender As Object, e As EventArgs) Handles LnkNoRecibias.Click Dim dt As New DataTable - Dim Ruta As String = String.Format("{0}\Empresas\{1}\Compras\NoRecibidas-{1}.xml", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) + Dim Ruta As String = String.Format("{0}Compras\NoRecibidas-{1}.xml", UsuarioActual.Empresa.Ruta, UsuarioActual.CveEmpresa) Dim Str As New StringBuilder If IO.File.Exists(Ruta) Then dt.ReadXml(Ruta) @@ -464,7 +464,7 @@ Partial Class Ventas_eFacturas Dim ObjProcess As Process = Nothing Dim Mensajes As String = "" Dim EjecutableUtilerias = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Utilerias\ADSUtilerias.exe") - Dim Folder = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas\") + Dim Folder = UsuarioActual.Empresa.Ruta.Replace($"{UsuarioActual.CveEmpresa.ToString()}\", "") 'Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas\") Dim error1 As Boolean = False Dim en As New CultureInfo("en-US") Dim fechai = txtFechaI.Text.Trim.ToDate.ToString("d", en)