diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index b97b600fe..30857a704 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -1005,13 +1005,13 @@ Public Class ClsContratos Return Retorno End Function - Public Function AddContratosAvance(CveContratoDetalle As Integer, Cantidad As Double, Fecha As DateTime, CveUsuario As Integer, Optional CveEstimacion As Integer = -1) As Boolean + Public Function AddContratosAvance(CveContratoDetalle As Integer, Cantidad As Double, Fecha As Date, CveUsuario As Integer, Optional CveEstimacion As Integer = -1) As Boolean Dim Retorno = False DataAdapter("PA_Con_ContratosAvanceAdd") With SqlAdapter.SelectCommand.Parameters .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle .Add("@Cantidad", SqlDbType.Int).Value = Cantidad - .Add("@Fecha", SqlDbType.Date).Value = Fecha.ToString("yyyy/MM/dd") + .Add("@Fecha", SqlDbType.Date).Value = Fecha .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEstimacion", SqlDbType.Int).Value = CveEstimacion End With @@ -1078,9 +1078,32 @@ Public Class ClsContratos End Try Return Retorno - End Function + End Function #End Region + +#Region "ESTIMACION" + + Public Function GetContratosAvanceEstimacion(CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + DataAdapter("PA_Con_ContratosAvanceEstimacionGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cargar los avances del Contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + #Region " S E C C I O N E S " Public Function GetSecciones() As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index df81cf748..6a4739cf8 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -462,7 +462,7 @@ Public Class ClsVentas Optional TipoDocto As String = "Cot", Optional Vigencia As Date = MinFecha, Optional CondicionesPago As Integer = -1, Optional AtencionA As String = "-1", Optional PedidoContrato As String = "-1", Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional CveCliente As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional OrdenCompra As String = "-1", Optional RetIVA As Double = -1, - Optional RetISR As Double = -1, Optional Kilometraje As Double = 0) As Boolean + Optional RetISR As Double = -1, Optional Kilometraje As Double = 0, Optional CveUsoCFDi As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUpdate") @@ -493,6 +493,7 @@ Public Class ClsVentas .Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal .Add("@OrdenCompra", SqlDbType.VarChar).Value = OrdenCompra .Add("@Kilometraje", SqlDbType.Float).Value = Kilometraje + .Add("@CveUsoCFDi", SqlDbType.SmallInt).Value = CveUsoCFDi End With Try diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 20159e06d..b4fdc4a72 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1248,10 +1248,10 @@ Partial Class PopUpVerFactura Dim PuestoEnrego As String = ObjInventarios.PuestoEntrego Dim ResponsableCarga As String = ObjInventarios.ResponsableCarga Dim ResponsableRecibio As String = ObjInventarios.ResponsableRecibio + Dim UsuarioCapturo As String = ObjInventarios.DtResultados.FiltroPrimeroValor("UsuarioCapturo") If Recibio.Trim = "" Then Dim ObjRH As New ClsRH - If ObjRH.GetPersonal(ObjInventarios.CvePersonal, UsuarioActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then Recibio = ObjRH.DtResultados.Rows(0)("NombreCompleto").ToString End If @@ -1276,7 +1276,9 @@ Partial Class PopUpVerFactura Dim CveMovimientoRelacionado As Integer = -1 Dim FolioRelacionado As String = "" - Dim CveConceptoMovtoRelacionado As Integer = -1 + Dim CveConceptoMovtoRelacionado As Integer = -1 + + Dim CveTipoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacen}").ToString.ToEntero 'VERIFICA SI TIENE MOVIMIENTO VIRTUAL RELACIONADO If UsuarioActual.CveEmpresa = 140 AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then @@ -1285,6 +1287,9 @@ Partial Class PopUpVerFactura FolioRelacionado = ObjInventarios.DtResultados.FiltroPrimeroValor("FolioVirtual") CveConceptoMovtoRelacionado = 37 ElseIf CveConcepto.Contiene(36, 37) Then + FolioRelacionado = ObjInventarios.DtResultados.FiltroPrimeroValor("FolioRelacionado") + CveConceptoMovtoRelacionado = 3 + ElseIf CveConcepto.Contiene(2) AndAlso CveTipoAlmacen.Contiene(24, 25) Then FolioRelacionado = ObjInventarios.DtResultados.FiltroPrimeroValor("FolioRelacionado") CveConceptoMovtoRelacionado = 3 End If @@ -1316,7 +1321,7 @@ Partial Class PopUpVerFactura Dim CveTipoAlmacenRelacionado As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacenRelacionado}").ToString.ToEntero 'SI TIENE RELACIONADO UN MOVIMIENTO VIRTUAL DEBE AGREGAR ESTE MOVIMIENTO A LA IMPRESION - If CveTipoAlmacenRelacionado = 24 Then + If CveTipoAlmacenRelacionado.Contiene(24, 25) Then If ObjInventarios.GetMovimientosDetalle(CveMovimientoRelacionado, UsuarioActual.CveEmpresa) Then Dim DtUsados As DataTable = ObjInventarios.DtResultados.Copy() CantidadUsados = DtUsados.SUM("Cantidad").ToDecimal() @@ -1342,7 +1347,28 @@ Partial Class PopUpVerFactura End If End If - Dim CveTipoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacen}").ToString.ToEntero + If UsuarioActual.CveEmpresa = 140 AndAlso CveCompra > 0 Then + If ObjInventarios.RecepcionAlmacenGet(CveCompra, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then + Dim DtFaltante As DataTable = ObjInventarios.DtResultados.FiltraParametros("CantidadF > 0") + If DtFaltante.Rows.Count > 0 Then + Dim SbPendientes As New StringBuilder + SbPendientes.AppendFormat("Los siguientes productos quedaron pendientes por recibir:") + For Each Row As DataRow In DtFaltante.Rows + SbPendientes.AppendFormat(" PS:{0} Cant.:{1:N0},", Row("CodigoPS"), Row("CantidadF")) + Next + SbPendientes.Remove(SbPendientes.Length - 1, 1) + + SbPendientes.AppendFormat(" Total Cant.:{0:N0}, Total Costo:{1:N2}", DtFaltante.SUM("CantidadF"), DtFaltante.SUM("Total")) + + If Not String.IsNullOrEmpty(Observaciones) Then + Observaciones = SbPendientes.ToString() + ".
" + Observaciones + Else + Observaciones = SbPendientes.ToString() + End If + End If + DtFaltante.Dispose() + End If + End If If CveTipoAlmacen = 20 Then CveConcepto = 24 @@ -1359,7 +1385,7 @@ Partial Class PopUpVerFactura MunicipioDestino, EstadoDestino, PaisDestino, CPDestino, FechaMovimiento, NombreCapturo, PuestoRecibio, PuestoEnrego, RazonSocial, ResponsableCarga, ResponsableRecibio, NombreCliente, CantidadProductos:=CantidadProductos, CantidadUsados:=CantidadUsados, CveTipoAlmacen:=CveTipoAlmacen, NombreEntrego:=NombreEntrego, - CveConceptoMovRelacionado:=CveConceptoMovtoRelacionado, FolioRelacionado:=FolioRelacionado) + CveConceptoMovRelacionado:=CveConceptoMovtoRelacionado, FolioRelacionado:=FolioRelacionado, UsuarioRegistro:=UsuarioCapturo) End Sub Private Sub PUanacExtr(CveMoneda As Integer) 'preciounitario a moneda nacional o extranjera @@ -1377,7 +1403,7 @@ Partial Class PopUpVerFactura EstadoOrigen As String, PaisOrigen As String, CPOrigen As String, CalleDestino As String, NoExtDestino As String, ColoniaDestino As String, LocalidadDestino As String, MunicipioDestino As String, EstadoDestino As String, PaisDestino As String, CPDestino As String, FechaMovimiento As Date, NombreCapturo As String, PuestoRecibio As String, PuestoEntrego As String, RazonSocial As String, ResponsableCarga As String, ResponsableRecibio As String, NombreCliente As String, Optional CantidadProductos As Decimal = 0, Optional CantidadUsados As Decimal = 0, - Optional CveTipoAlmacen As Integer = -1, Optional NombreEntrego As String = "", Optional CveConceptoMovRelacionado As Integer = -1, Optional FolioRelacionado As String = "") + Optional CveTipoAlmacen As Integer = -1, Optional NombreEntrego As String = "", Optional CveConceptoMovRelacionado As Integer = -1, Optional FolioRelacionado As String = "", Optional UsuarioRegistro As String = "") Select Case CveConcepto @@ -1527,6 +1553,7 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("IVA", If(CveCompra > 0 AndAlso dr IsNot Nothing, dr("IVA").ToString.FormatoNumero(2), ""))) params.Add(New ReportParameter("Total", If(CveCompra > 0 AndAlso dr IsNot Nothing, dr("Total").ToString.FormatoNumero(2), ""))) 'params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) + params.Add(New ReportParameter("Observaciones", Observaciones)) params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) params.Add(New ReportParameter("CveConceptoMovRelacionado", CveConceptoMovRelacionado.ToString())) params.Add(New ReportParameter("FolioRelacionado", FolioRelacionado)) @@ -1762,7 +1789,8 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("NombreRecibio", Recibio)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("CveConceptoMovRelacionado", CveConceptoMovRelacionado.ToString())) - params.Add(New ReportParameter("FolioRelacionado", FolioRelacionado)) + params.Add(New ReportParameter("FolioRelacionado", FolioRelacionado)) + params.Add(New ReportParameter("UsuarioRegistro", UsuarioRegistro)) ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/Salidas.rdlc", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString), RDSName:="DsInventarios") Else @@ -2550,19 +2578,19 @@ Partial Class PopUpVerFactura If (UsuarioActual.CveEmpresa = 72) Then params.Add(New ReportParameter("DomicilioFiscal", DomicilioFiscalCompu)) End If - ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/SalidasGarantia.rdlc", DtMovimientos, params, String.Format("SalidaGarantia{0}", Folio.ToString), RDSName:="DsInventarios") - 'Else - ' params.Add(New ReportParameter("Folio", Folio)) - ' params.Add(New ReportParameter("Fecha", Fecha)) - ' params.Add(New ReportParameter("Almacen", Almacen)) - ' params.Add(New ReportParameter("SubProyecto", SubProyecto)) - ' params.Add(New ReportParameter("Observaciones", Observaciones)) - ' params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) - ' params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) - ' ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/Salidas.rdlc", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString), RDSName:="DsInventarios") - 'End If - - + ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/SalidasGarantia.rdlc", DtMovimientos, params, String.Format("SalidaGarantia{0}", Folio.ToString), RDSName:="DsInventarios") + 'Else + ' params.Add(New ReportParameter("Folio", Folio)) + ' params.Add(New ReportParameter("Fecha", Fecha)) + ' params.Add(New ReportParameter("Almacen", Almacen)) + ' params.Add(New ReportParameter("SubProyecto", SubProyecto)) + ' params.Add(New ReportParameter("Observaciones", Observaciones)) + ' params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) + ' params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) + ' ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/Salidas.rdlc", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString), RDSName:="DsInventarios") + 'End If + + Case 18 'D E V O L U C I O N D E L C L I E N T E Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/DevolucionCliente.rdlc", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -2739,36 +2767,36 @@ Partial Class PopUpVerFactura ImprimirPDF(Archivo, DtMovimientos, params, String.Format("Salida por Prestamo - {0}", Folio.ToString), RDSName:="DsInventarios") ElseIf CveConcepto = 22 Then ImprimirPDF(Archivo, DtMovimientos, params, String.Format("Entrada por Prestamo - {0}", Folio.ToString), RDSName:="DsInventarios") - End If - - 'Case 22 'ENTRADA POR PRESTAMO - ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - ' Dim params As New List(Of ReportParameter) - - ' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - ' If Imagen.Exists Then - ' params.Add(New ReportParameter("LogoPath", logouri)) - ' Else - ' params.Add(New ReportParameter("LogoPath", "")) - ' End If - - ' params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) - ' params.Add(New ReportParameter("Concepto", "Entrada por Prestamo")) - ' params.Add(New ReportParameter("Almacen", Almacen)) - ' params.Add(New ReportParameter("Fecha", Fecha)) - ' params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) - ' params.Add(New ReportParameter("Folio", Folio)) - ' params.Add(New ReportParameter("Descuentos", "")) - ' params.Add(New ReportParameter("IVA", "")) - ' params.Add(New ReportParameter("Total", "")) - ' 'params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) - ' params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) - ' params.Add(New ReportParameter("FacturadoA", NombreCliente)) - ' If (UsuarioActual.CveEmpresa = 72) Then - ' params.Add(New ReportParameter("DomicilioFiscal", DomicilioFiscalCompu)) - ' End If - ' ImprimirPDF("Empresas/Grales/Formatos/EntradaSalida.rdlc", DtMovimientos, params, String.Format("Entrada por Prestamo - {0}", Folio.ToString), RDSName:="DsInventarios") - + End If + + 'Case 22 'ENTRADA POR PRESTAMO + ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + ' Dim params As New List(Of ReportParameter) + + ' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + ' If Imagen.Exists Then + ' params.Add(New ReportParameter("LogoPath", logouri)) + ' Else + ' params.Add(New ReportParameter("LogoPath", "")) + ' End If + + ' params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) + ' params.Add(New ReportParameter("Concepto", "Entrada por Prestamo")) + ' params.Add(New ReportParameter("Almacen", Almacen)) + ' params.Add(New ReportParameter("Fecha", Fecha)) + ' params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) + ' params.Add(New ReportParameter("Folio", Folio)) + ' params.Add(New ReportParameter("Descuentos", "")) + ' params.Add(New ReportParameter("IVA", "")) + ' params.Add(New ReportParameter("Total", "")) + ' 'params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) + ' params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) + ' params.Add(New ReportParameter("FacturadoA", NombreCliente)) + ' If (UsuarioActual.CveEmpresa = 72) Then + ' params.Add(New ReportParameter("DomicilioFiscal", DomicilioFiscalCompu)) + ' End If + ' ImprimirPDF("Empresas/Grales/Formatos/EntradaSalida.rdlc", DtMovimientos, params, String.Format("Entrada por Prestamo - {0}", Folio.ToString), RDSName:="DsInventarios") + Case 24 'SALIDA POR RESGUARDO If DtMovimientos(0)("CveTipoAlmacen").ToString.ToEntero = 20 Or DtMovimientos(0)("CveTipoAlmacen").ToString.ToEntero = 19 Then Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -3251,11 +3279,11 @@ Partial Class PopUpVerFactura If CveConcepto = 2 Then ElseIf CveConcepto = 3 Then End If - End Sub - - + End Sub + + #End Region - + #Region "OP = 'OC' - IMPRIME PDF OC" Private Sub ImprimePDFOC(CveOrdenCompra As Integer) Dim reporte As Byte() = NewGeneraBytesOC(CveOrdenCompra, ConBitacora:=(UsuarioActual.Empresa.Funcionalidad(119) = "1")) diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 3069747e7..7f41f1fa3 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -555,7 +555,7 @@
diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 7a44163ab..319d8a3b0 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -2697,17 +2697,36 @@ Partial Class Compras_eFacturas namespaces.AddNamespace(XMLDoc.DocumentElement.Prefix, "http://www.sat.gob.mx/cfd/3") namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") - namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos") + + ' namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos") nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces) + nodeaGral = XMLDoc.SelectSingleNode(String.Format("//{0}:Comprobante", XMLDoc.DocumentElement.Prefix), namespaces) nodeTFD = nodeComp.SelectSingleNode(String.Format("//{0}:TimbreFiscalDigital", "tfd"), namespaces) - nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", "pago10"), namespaces) - nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", "pago10"), namespaces) - 'Monto = ValorXML(nodePagos, "Monto").ToDecimal - Dim nodePago As XmlNodeList = nodePagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", "pago10"), namespaces) + Dim PrefijoPagos As String = "" + + For Each nodoPrefijo As XmlNode In nodeComp.ChildNodes + If nodoPrefijo.Prefix <> "tfd" Then + PrefijoPagos = nodoPrefijo.Prefix + End If + Next + + namespaces.AddNamespace(PrefijoPagos, "http://www.sat.gob.mx/Pagos") + nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces) + + + nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", PrefijoPagos), namespaces) + nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", PrefijoPagos), namespaces) + + + + + + + ' Dim nodePago As XmlNodeList = nodePagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", "pago10"), namespaces) SeriePago = ValorXML(nodeaGral, "Serie") FolioPago = ValorXML(nodeaGral, "Folio") @@ -2735,11 +2754,12 @@ Partial Class Compras_eFacturas DTDocumentosRelacionados.Columns.Add("FechaPago", GetType(Date)) DTDocumentosRelacionados.Columns.Add("CveMetodoPago", GetType(Integer)) DTDocumentosRelacionados.Columns.Add("SerieFolioCompra") + DTDocumentosRelacionados.Columns.Add("CvePrePolizaDetalle", GetType(Integer)) Dim nodePagosN As XmlNodeList - nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", "pago10"), namespaces) + nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", PrefijoPagos), namespaces) @@ -2775,7 +2795,7 @@ Partial Class Compras_eFacturas Dim ObjCompraFolios As New ClsCompras - If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then + If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace($"{PrefijoPagos}:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then ' '.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then If ObjCompraFolios.DtResultados.Rows.Count > 0 Then @@ -2789,7 +2809,7 @@ Partial Class Compras_eFacturas dRow2("CveFactura") = drow("CveFactura").ToString.ToEntero dRow2("CveMetodoPago") = drow("CveMetodoPago").ToString.ToEntero dRow2("SerieFolioCompra") = drow("SerieFolioCompra").ToString - + dRow2("CvePrePolizaDetalle") = drow("CvePrePolizaDetalle").ToString If drow("CveIE").ToString.ToEntero > 0 Then @@ -2860,7 +2880,7 @@ Partial Class Compras_eFacturas Dim TieneRegistros As Boolean = False - If ObjCompras.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then + If ObjCompras.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", "").Replace("pagos10:", ""), UsuarioActual.CveEmpresa) Then GvVincularPago.DataSource = ObjCompras.DtResultados If ObjCompras.DtResultados.Rows.Count > 0 Then @@ -2982,9 +3002,9 @@ Partial Class Compras_eFacturas ObjCompra.IniciaTransacSQL() - For Each Gv As GridViewRow In GvVincularPago.Rows + For Each Gv As GridViewRow In GVPDocumentosRelacionadosPagos.Rows - If Not ObjCompra.AddComplementoPago(Gv.DataKey("CveIE").ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("Monto").ToDecimal, Gv.DataKey("CvePrePolizaDetalle").ToEntero, CveFacturaPago) > 0 Then + If Not ObjCompra.AddComplementoPago(Gv.DataKey("CveIE").ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("ImpPagado").ToDecimal, Gv.DataKey("CvePrePolizaDetalle").ToEntero, CveFacturaPago) > 0 Then TieneError = True End If diff --git a/Contratos/ContratoAvance.aspx b/Contratos/ContratoAvance.aspx index ab97df630..6b702897e 100644 --- a/Contratos/ContratoAvance.aspx +++ b/Contratos/ContratoAvance.aspx @@ -44,7 +44,13 @@ - + + + + + + +
@@ -70,8 +76,15 @@
-
-
+ + +
+ +
+ Fecha: +
+
+
@@ -82,12 +95,21 @@ -
- +
+
+ + + + +
+
+ @@ -107,13 +129,18 @@
Anexo
- +
+ + - + + @@ -148,27 +175,217 @@ + - + --%> + + + + + + + - -
- - - - - - - - - + + +
+
+ + + +
+ +
+
-
+
+ + + + + + + + + + + +
+
+ +
+ +
+ +
+ + + +
+
+ + +
+
+ +
+
+
+
+
+ + +
+
+ + + + + + + + + + + + <%# Eval("Cantidad", "{0:N2}")%> + + + + + <%# Eval("Importe", "{0:N2}")%> + + + + + <%# Eval("Cantidad_Ultima", "{0:N2}")%> + + + + + <%# Eval("Importe_Ultima", "{0:N2}")%> + + + + <%-- + + + + + + + + + + + + + + + + + + + + + + + + --%> + + + + + +
+
+ + +
+
+
+ + + +
+
+
+ +
+
+ + +
+
+ + + + + + + + + + + + + <%----%>
- diff --git a/Contratos/ContratoAvance.aspx.vb b/Contratos/ContratoAvance.aspx.vb index 54cdf7e7d..db1c3340b 100644 --- a/Contratos/ContratoAvance.aspx.vb +++ b/Contratos/ContratoAvance.aspx.vb @@ -46,22 +46,31 @@ Partial Class Contratos_ContratoAvance Set(value As String) ViewState("fecha") = value End Set - End Property - + End Property + #End Region - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not IsPostBack Then BtnGuardar.Visible = False - btnanexogral.Visible = False - CargaContrato() + btnanexogral.Visible = False + CargaContrato() + + End If + End Sub #Region "Filtros" Private Sub CargaContrato() - DdlContratos.DataSource = GlobalDTContratos.FiltraParametros(String.Format("CveContratoTipo=4")) + DdlContratos.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (4,30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}")) DdlContratos.DataBind() + + DDlContratosEstimaciones.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (4,30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}")) + DDlContratosEstimaciones.DataBind() + + CargaddlAvance() End Sub @@ -124,8 +133,10 @@ Partial Class Contratos_ContratoAvance End Sub Protected Sub GV_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Gv.RowDataBound If e.Row.RowIndex > -1 Then + e.Row.FCTextBox("TxtCantidad").Visible = (fecha = "") - e.Row.FCLinkButton("LnkAnexo").Visible = Not (fecha = "") + e.Row.FCLinkButton("LnkAnexo").Visible = Not (fecha = "") + If e.Row.DBCampo("CveContratoDetalle").ToString.ToEntero = 0 Then e.Row.FCTextBox("TxtCantidad").Visible = False e.Row.FCLinkButton("LnkAnexo").Visible = False @@ -140,9 +151,32 @@ Partial Class Contratos_ContratoAvance e.Row.CssClass = "SubTotales3" End If End If + + If e.Row.DataKey("CveContratoDetalle").ToEntero > 0 Then + + Dim LnkAnexo As LinkButton = e.Row.FCLinkButton("LnkModalDropzone") + 'LnkAnexo.Visible = True + Dim DVAnexo As Control = DirectCast(e.Row.FindControl("ModalAnexoEvidencia"), Control) + LnkAnexo.OnClientClick = $" $('#{DVAnexo.ClientID}').modal('show'); return false;" + + If DdlAvances.SelectedIndex > 0 Then + LnkAnexo.Visible = False + Else + LnkAnexo.Visible = True + End If + + End If + + + End If End Sub - Protected Sub GetAnexos(sender As Object, e As System.EventArgs) + Protected Sub GetAnexos(sender As Object, e As System.EventArgs) + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + + LblTituloModalAnexo.Text = "Anexo " & GvRow.DataKey("PS") + 'Get the button that raised the event Dim btn As LinkButton = DirectCast(sender, LinkButton) Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) @@ -154,22 +188,49 @@ Partial Class Contratos_ContratoAvance GvAnexos.Visible = True Else GvAnexos.Visible = False - End If - objContrato.Dispose() + End If + + objContrato.Dispose() + + UpModalAnexos.Update() + + RegistraScript("$('#ModalAnexos').modal('show');") + End Sub - Protected Sub GvAnexos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvAnexos.RowDataBound + Protected Sub GvAnexos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvAnexos.RowDataBound + If e.Row.RowIndex > -1 Then Dim Archivo As String = e.Row.DBCampo("Archivo").ToString Dim start As Integer = Len(Archivo.Split("-"c)(0)) - Dim link As HyperLink = e.Row.FCHyperLink("HPLArchivo") - link.Text = Archivo.Substring(start + 1) - link.NavigateUrl = String.Format("/Empresas/{0}/Contrato/{1}/Anexos/{2}", UsuarioActual.CveEmpresa, CveContrato, Archivo) + Dim LnkArchivo As LinkButton = e.Row.FCLinkButton("LnkArchivo") + + LnkArchivo.Text = Archivo.Substring(start + 1) + 'link.NavigateUrl = String.Format("/Empresas/{0}/Contrato/{1}/Anexos/{2}", UsuarioActual.CveEmpresa, CveContrato, Archivo) + + ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkArchivo) End If - End Sub + + End Sub + + Protected Sub LnkArchivo_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim Archivo As String = GvRow.DataKey("Archivo").ToString + + Response.ContentType = "application/octet-stream" + Response.AppendHeader("Content-Disposition", $"attachment; filename={Archivo}") + Response.TransmitFile($"{UsuarioActual.Empresa.Ruta}\Contrato\{DdlContratos.SelectedValue.ToEntero}\Anexos\{Archivo}") + Response.End() + + End Sub + + #End Region - - + + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click + Dim ObjContratos As New ClsContratos ObjContratos.IniciaTransacSQL() Dim TieneError = False @@ -177,47 +238,58 @@ Partial Class Contratos_ContratoAvance Dim Cantidad As Double Dim filesgral As List(Of Archivo) = AnexoGral.getfiles().Archivos Dim guardarArchivos As New List(Of Archivo) - For Each gvr As GridViewRow In Gv.Rows - CveContratoDetalle = gvr.DataKey("CveContratoDetalle").ToEntero - If CveContratoDetalle > 0 Then - Cantidad = gvr.FCTextBox("TxtCantidad").Text.ToDouble + + For Each gvr As GridViewRow In Gv.Rows + + CveContratoDetalle = gvr.DataKey("CveContratoDetalle").ToEntero + + If CveContratoDetalle > 0 Then + + Cantidad = gvr.FCTextBox("TxtCantidad").Text.ToDouble + If Cantidad > 0 Then - If ObjContratos.AddContratosAvance(CveContratoDetalle, Cantidad, TxtFecha.Text.ToDateTime, UsuarioActual.CveUsuario) Then + If ObjContratos.AddContratosAvance(CveContratoDetalle, Cantidad, TxtFecha.Text.ToDateTime, UsuarioActual.CveUsuario) Then + Dim CveContratoAvance As Integer = ObjContratos.DtResultados.Rows(0)("CveContratoAvance").ToString.ToEntero Dim files As List(Of Archivo) = gvr.FCTextBox("TXTAnexo").getfiles().Archivos - For Each fileItem As Archivo In filesgral - guardarArchivos.Add(fileItem) - If Not ObjContratos.AddContratosAvanceAnexo(CveContratoAvance, fileItem.filename, UsuarioActual.CveUsuario) Then - TieneError = True - Exit For - End If - Next - For Each fileItem As Archivo In files + 'For Each fileItem As Archivo In filesgral 'GENERAL + ' guardarArchivos.Add(fileItem) + ' If Not ObjContratos.AddContratosAvanceAnexo(CveContratoAvance, fileItem.filename, UsuarioActual.CveUsuario) Then + ' TieneError = True + ' Exit For + ' End If + 'Next + + For Each fileItem As Archivo In files guardarArchivos.Add(fileItem) If Not ObjContratos.AddContratosAvanceAnexo(CveContratoAvance, fileItem.filename, UsuarioActual.CveUsuario) Then TieneError = True Exit For End If Next + Else TieneError = True Exit For End If End If + End If + Next + If TieneError Then ObjContratos.RollBack() 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) - For Each fileItem As Archivo In filesgral - fileItem.filename.filesMove(fileItem.filename, urlsave) - Next + Dim urlsave As String = String.Format("Empresas\{0}\Contrato\{1}\Anexos", UsuarioActual.CveEmpresa, CveContrato) + For Each fileItem As Archivo In filesgral + fileItem.filename.FilesMove(fileItem.filename, urlsave) + Next For Each fileItem As Archivo In guardarArchivos - fileItem.filename.filesMove(fileItem.filename, urlsave) + fileItem.filename.FilesMove(fileItem.filename.Replace($".{fileItem.Extencion}", ""), urlsave) Next ObjContratos.Commit() Alert("se guardo Correctamente") @@ -226,8 +298,84 @@ Partial Class Contratos_ContratoAvance ObjContratos.Dispose() CargaddlAvance() CargaDatosAvance() - End Sub - + End Sub + + + +#Region "ESTIMACION" + + + Private Sub CargaAvancesParaEstimar() + + + Dim ObjContratos As New ClsContratos() + Dim DTEstimaciones As New DataTable + + + If ObjContratos.GetContratosAvanceEstimacion(DDlContratosEstimaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + DTEstimaciones = ObjContratos.DtResultados + BtnGuardarEstimacion.Visible = True + Else + BtnGuardarEstimacion.Visible = False + End If + + + ObjContratos.Dispose() + + + If DTEstimaciones.Rows.Count > 0 Then + GvEstimaciones.DataSource = DTEstimaciones + Else + GvEstimaciones.DataSource = Nothing + End If + GvEstimaciones.DataBind() + + UpEstimaciones.Update() + End Sub + + Private Sub BtnConsultarEstimaciones_Click(sender As Object, e As EventArgs) Handles BtnConsultarEstimaciones.Click + + CargaAvancesParaEstimar() + + End Sub + + Private Sub GvEstimaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEstimaciones.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveContratoDetalle").ToString.ToEntero = 0 Then + + + If e.Row.DBCampo("CveSubFamilias").ToString.ToEntero = 0 Then + If e.Row.DBCampo("CveFamilias").ToString.ToEntero = 0 Then + e.Row.CssClass = "SubTotales" + Else + e.Row.CssClass = "SubTotales2" + End If + Else + e.Row.CssClass = "SubTotales3" + End If + End If + End If + + + + + End Sub + + Private Sub BtnGuardarEstimacion_Click(sender As Object, e As EventArgs) Handles BtnGuardarEstimacion.Click + + Dim ObjContratos As New ClsContratos() + + + + ObjContratos.Dispose() + + End Sub + + +#End Region + End Class diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx index c8230178d..d42a38359 100644 --- a/Contratos/ContratoObra.aspx +++ b/Contratos/ContratoObra.aspx @@ -929,7 +929,7 @@
@@ -997,7 +997,6 @@ - @@ -1013,12 +1012,18 @@ - - - + + + + + + + + - + diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index 063bf57b7..1dccd7ef6 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -924,9 +924,10 @@ Partial Class Contratos_ContratoObra #Region " CARGA DATOS " Private Sub CargaDatos() Dim ObjContratos As New ClsContratos() - Dim Ruta = Request.ApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" - 'DivTipoContrato.Visible = False - + 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 @@ -2042,12 +2043,14 @@ Partial Class Contratos_ContratoObra End Sub Protected Sub GV_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Gv.RowDataBound - If e.Row.RowIndex > -1 Then - - e.Row.FCCheckBox("CHKPAvance").Visible = Autorizado - 'e.Row.FCCheckBox("CHKPEstimacion").Visible = Autorizado + 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 + LnkHabilitaAvance.Enabled = True End If If e.Row.DBCampo("PermitirAvance").ToString = "1" Then @@ -2065,7 +2068,20 @@ Partial Class Contratos_ContratoObra If CveTipoContrato = 25 Then e.Row.Cells(1).Width = Unit.Pixel(10) e.Row.Cells(6).Width = Unit.Pixel(250) + End If + + + + + If e.Row.DBCampo("PermitirAvance").ToString = "1" Then + LnkHabilitaAvance.Text = "" + LnkHabilitaAvance.Attributes.Add("data-original-title", "¿Deshabilitar avance?") + 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) @@ -5026,6 +5042,36 @@ Partial Class Contratos_ContratoObra + Protected Sub LnkHabilitaAvance_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim PermitirAvance As Integer = GvRow.DataKey("PermitirAvance").ToEntero + + '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 = GvRow.DataKey("CveContratoDetalle").ToString.ToEntero + Dim objContrato As New ClsContratos + + 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 + + objContrato.Dispose() + + End Sub End Class diff --git a/Empresas/140/Formatos/Salidas.rdlc b/Empresas/140/Formatos/Salidas.rdlc index 595add00f..54efe605a 100644 --- a/Empresas/140/Formatos/Salidas.rdlc +++ b/Empresas/140/Formatos/Salidas.rdlc @@ -1187,6 +1187,77 @@ 2pt + + true + true + + + + + Usuario Registró: + + + + + + + Textbox5 + 1.62251cm + 0.79137cm + 0.6cm + 2.90426cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!UsuarioRegistro.Value + + + + + + + Textbox33 + 1.62251cm + 3.69563cm + 0.6cm + 5.93606cm + 7 + + + 2pt + 2pt + 2pt + 2pt + +