diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 64f7f20dc..ed8ddbc71 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1140,7 +1140,9 @@ Public Class ClsContabilidad Optional ObjConta As ClsContPAQi = Nothing, Optional pIDPoliza As Integer = -1) As Boolean Dim StrLog As New StringBuilder Dim Retorno As Boolean = False - StrLog.AppendFormat("CvePrep:{0} - Inicio", CvePrePoliza) + Dim OcurrioError As Boolean = False + + StrLog.AppendFormat("CvePrep:{0} - Inicio -", CvePrePoliza) If Empresa.TipoContabilizacion = 1 Then ' contabilidad en SIG @@ -1154,7 +1156,7 @@ Public Class ClsContabilidad If CvePrePoliza <= 0 Then Return False - Dim OcurrioError As Boolean = False + Dim ContaCompartida As Boolean = False If ObjConta Is Nothing Then @@ -1263,6 +1265,7 @@ Public Class ClsContabilidad If Not ObjConta.AddMovimiento(tIdPoliza, dr("IdCtaContable").ToString.ToEntero, tipoMovimiento, dr("ImporteMN").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegmentoNegocio").ToString.ToEntero, Fecha, SigReferencia, dr("CvePrePolizaDetalle").ToString.ToEntero, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal) Then OcurrioError = True + StrLog.AppendFormat(" Error 1.1 - ") Exit For End If @@ -1271,6 +1274,7 @@ Public Class ClsContabilidad If Not ObjConta.AddMovimiento(tIdPoliza, dr("IdCtaContable").ToString.ToEntero, tipoMovimiento, dr("Importe").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegmentoNegocio").ToString.ToEntero, Fecha, SigReferencia, dr("CvePrePolizaDetalle").ToString.ToEntero, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal) Then OcurrioError = True + StrLog.AppendFormat(" Error 1.2 - ") Exit For End If @@ -1279,6 +1283,7 @@ Public Class ClsContabilidad End If Else OcurrioError = True + StrLog.AppendFormat(" Error 1.3 - ") Mensaje.Append(String.Format("
La cuenta contable {0} es invalida", dr("ConceptoContable"))) Exit For End If @@ -1298,6 +1303,7 @@ Public Class ClsContabilidad dr("ISRRetenido").ToString.ToDecimal, dr("IVARetenido").ToString.ToDecimal, False) Then OcurrioError = True + StrLog.AppendFormat(" Error 1.4 - ") End If End If @@ -1347,6 +1353,7 @@ Public Class ClsContabilidad IdProveedor = ObjConta.AddProveedor(IdCtaContProveedores, RFC, RazonSocial, "") If IdProveedor <= 0 Then OcurrioError = True + StrLog.AppendFormat(" Error 1.5 - ") End If End If @@ -1364,6 +1371,7 @@ Public Class ClsContabilidad dr("Serie").ToString.ToString, dr("Folio").ToString.StrToNum, dr("FolioFiscal").ToString, Empresa.CveEmpresa) Then OcurrioError = True + StrLog.AppendFormat(" Error 1.6 - ") Mensaje.Append("La Poliza o la Cuenta no son válidas ") End If @@ -1377,12 +1385,14 @@ Public Class ClsContabilidad If Not OcurrioError Then If Not UpdatePrePolizasDetalleBloquear(CvePrePoliza, True) Then + StrLog.AppendFormat(" Error 2.1 - ") OcurrioError = True End If End If If Not OcurrioError Then If Not UpdatePrePoliza(Fecha, ObjConta.Folio, CveTipoPoliza, tIdPoliza, CvePrePoliza, Empresa.CveEmpresa, CveUsuarioModifico:=CveUsuario) Then + StrLog.AppendFormat(" Error 2.2 - ") OcurrioError = True End If End If @@ -1404,11 +1414,13 @@ Public Class ClsContabilidad Else OcurrioError = True + StrLog.AppendFormat(" Error 3.1 - ") End If Catch ex As Exception + StrLog.AppendFormat(" Error 4.1 - ") If Not ContaCompartida Then ObjConta.RollBack() OnError("Ocurrió un error al intentar contabilizar la PrePoliza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) 'Alert("Ocurrió un error al guardar la póliza", TipoMensaje.MsgAdvertencia) @@ -1417,8 +1429,9 @@ Public Class ClsContabilidad If Not ContaCompartida Then ObjConta.Dispose() End If + StrLog.AppendFormat(" - Con Retorno ({0}) - OcurrioError ({1}) ", Retorno, OcurrioError) StrLog.AppendFormat(" - Fin") - StrLog.ToString.GuardaLogAD("LogContabilidazacion") + StrLog.ToString.GuardaLogAD("LogContabilizacion") Return Retorno End Function @@ -4224,7 +4237,7 @@ Public Class ClsContabilidad Return Retorno End Function - Public Function GetAnexoCatalagoCC(CveCuenta As Integer, Ejercicio As Integer, CveSubproyecto As Integer, CveEmpresa As Integer, Divisor As Integer, Periodo As Integer, CveUsuario As Integer ) As Boolean + Public Function GetAnexoCatalagoCC(CveCuenta As Integer, Ejercicio As Integer, CveSubproyecto As Integer, CveEmpresa As Integer, Divisor As Integer, Periodo As Integer, CveUsuario As Integer) As Boolean Dim Retorno = False DataAdapter("PA_Conta_AnexoCatalogoCCGet") @@ -5525,7 +5538,7 @@ Public Class ClsContabilidad End Function #Region "IVAS" - Public Function GetRepIVA(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveUsuarioConsulta As Integer, Conciliado As Integer, CveEmpresa As Integer, TipoCambio As Integer, TCEspecifico As Double) As Boolean + Public Function GetRepIVA(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveUsuarioConsulta As Integer, CveCuentaBancaria As Integer, Conciliado As Integer, CveEmpresa As Integer, TipoCambio As Integer, TCEspecifico As Double) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_RepIVA") With SqlAdapter.SelectCommand.Parameters @@ -5533,6 +5546,7 @@ Public Class ClsContabilidad .Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@Opcion", SqlDbType.Int).Value = Opcion .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@CveCuentaBancaria", SqlDbType.Int).Value = CveCuentaBancaria .Add("@Conciliado", SqlDbType.Int).Value = Conciliado .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio @@ -5569,13 +5583,14 @@ Public Class ClsContabilidad End Function - Public Function GetRepIVAComparativo(FechaInicio As Date, FechaFin As Date, CveUsuarioConsulta As Integer, Conciliado As Integer, CveEmpresa As Integer) As Boolean + Public Function GetRepIVAComparativo(FechaInicio As Date, FechaFin As Date, CveUsuarioConsulta As Integer, CveCuentaBancaria As Integer, Conciliado As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_ImpuestosComparativo") With SqlAdapter.SelectCommand.Parameters .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@CveCuentaBancaria", SqlDbType.Int).Value = CveCuentaBancaria .Add("@Conciliado", SqlDbType.Int).Value = Conciliado .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa @@ -5589,7 +5604,7 @@ Public Class ClsContabilidad Return Retorno End Function - Public Function GetRepIVAAcumulado(FechaInicio As Date, FechaFin As Date, Conciliado As Integer, TipoImpuesto As Integer, CveUsuarioConsulta As Integer, CveEmpresa As Integer) As Boolean + Public Function GetRepIVAAcumulado(FechaInicio As Date, FechaFin As Date, Conciliado As Integer, TipoImpuesto As Integer, CveCuentaBancaria As Integer, CveUsuarioConsulta As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_IVAAcumulado") With SqlAdapter.SelectCommand.Parameters @@ -5597,6 +5612,7 @@ Public Class ClsContabilidad .Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@TipoImpuesto", SqlDbType.Int).Value = TipoImpuesto .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@CveCuentaBancaria", SqlDbType.Int).Value = CveCuentaBancaria .Add("@Conciliado", SqlDbType.Int).Value = Conciliado .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index b97b600fe..4aa1fc0a5 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -34,11 +34,17 @@ Public Class ClsContratos End Property Public Property NotificarAvanceAlcanzado As Boolean - Public Property CveContratoGasto As Integer - - + Public Property CveContratoGasto As Integer + + Public Property NumeroEstimacionNueva As Integer + Public Property CveEstimacionNueva As Integer + + + + + #End Region - + #Region "T R A N S A C C I O N E S" Public Function IniciaTransacSQL() As SqlTransaction If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() @@ -681,6 +687,94 @@ Public Class ClsContratos #End Region +#Region "ESTIMACION OBRA" + + Public Function GetContratosObraRepAvances(FechaI As Date, FechaF As Date, CveCliente As Integer, CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Con_ContratosObraRepAvancesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .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 consultar el avance de contratos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + Public Function GetContratosObraRepAvancesDetalle(CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Con_ContratosObraRepAvancesDetalleGet") + 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 consultar el detalle del avance.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + Public Function GetContratosObraRepAvancesPartida(CveEstimacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Con_ContratosObraRepAvancesPartidaGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstimacion", SqlDbType.Int).Value = CveEstimacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar las partidas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetContratosObraRepAvancesPartida(FechaI As Date, FechaF As Date, CveCliente As Integer, CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Con_ContratosObraRepAvancesPartidaGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .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 consultar el avance de partida.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + #Region "C I C L O C O M E R C I A L" Public Function CicloComercialAdd(CveContrato As Integer, CveCotizacion As Integer, CveCliente As Integer, FueFacturado As Boolean, CveFactura As Integer, Estatus As Integer, CveEmpresa As Integer, FechaVenc As Date) As Boolean Dim Retorno As Boolean = False @@ -1005,13 +1099,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 @@ -1060,14 +1154,15 @@ Public Class ClsContratos Return Retorno End Function - Public Function GetContratosAvanceAnexos(CveContratoDetalle As Integer, fecha As String, CveUsuario As Integer) As Boolean + Public Function GetContratosAvanceAnexos(CveContratoDetalle As Integer, fecha As String, CveUsuario As Integer, Optional CveEstimacion As Integer = -1) As Boolean Dim Retorno = False DataAdapter("PA_Con_ContratosAvanceAnexos") With SqlAdapter.SelectCommand.Parameters .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle .Add("@Fecha", SqlDbType.Date).Value = fecha - .Add("@CveUsuario", SqlDbType.Float).Value = CveUsuario + .Add("@CveUsuario", SqlDbType.Float).Value = CveUsuario + .Add("@CveEstimacion", SqlDbType.Float).Value = CveEstimacion End With Try @@ -1078,9 +1173,87 @@ 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 + + + Public Function AddContratosAvanceEstimacion(CveContrato As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + NumeroEstimacionNueva = -1 + CveEstimacionNueva = -1 + + DataAdapter("PA_Con_ContratosEstimacionAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@NumeroEstimacion", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@CveEstimacion", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + + SqlAdapter.Fill(Data) + NumeroEstimacionNueva = SqlAdapter.SelectCommand.Parameters("@NumeroEstimacion").Value.ToString.ToEntero + CveEstimacionNueva = SqlAdapter.SelectCommand.Parameters("@CveEstimacion").Value.ToString.ToEntero + + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al agregar la estimación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + Public Function UpdateContratosAvanceEstimacion(CveContratoAvance As Integer, CveEstimacion As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno = False + + DataAdapter("PA_Con_ContratosAvanceEstimacionUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContratoAvance", SqlDbType.Int).Value = CveContratoAvance + .Add("@CveEstimacion", SqlDbType.Int).Value = CveEstimacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el avance.", 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/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 24520e128..21d8a5b2d 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -962,7 +962,7 @@ Public Class ClsInventarios Optional CveMovimientoRelacionado As Integer = -1, Optional TipoCambio As Double = -1, Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, Optional MovimientoFijo As Boolean = False, Optional CveContrato As Integer = -1, Optional CveProveedor As Integer = -1, Optional Remision As String = "", Optional CveClienteSucursal As Integer = -1, Optional DepartamentoEntrega As String = "", Optional PedidoContrato As String = "", Optional GastoIndirecto As Double = -1, Optional CveChofer As Integer = -1, Optional Placa As String = "", Optional FechaEntrega As String = "", Optional EspecifUnidad As String = "", Optional ResponsableCarga As String = "", Optional ResponsableRecibio As String = "", Optional Identificacion As String = "", Optional Domicilio As String = "", - Optional Telefono As String = "", Optional Ciudad As String = "", Optional Licencia As String = "", Optional Modulo As String = "") As Integer + Optional Telefono As String = "", Optional Ciudad As String = "", Optional Licencia As String = "", Optional Modulo As String = "", Optional CveOP As Integer = -1) As Integer Dim Retorno As Integer = -1 @@ -1016,6 +1016,7 @@ Public Class ClsInventarios .Add("@Ciudad", SqlDbType.VarChar).Value = Ciudad .Add("@Licencia", SqlDbType.VarChar).Value = Licencia .Add("@Modulo", SqlDbType.VarChar).Value = Modulo + .Add("@CveOP", SqlDbType.Int).Value = CveOP End With Try @@ -1486,7 +1487,7 @@ Public Class ClsInventarios End Function Public Function GetKardexAlmacenHorizontal(CvePS As Integer, FechaFin As Date, CveAlmacen As Integer, CveUnidadMedida As Integer, CveProveedor As Integer, CveTipoAlmacen As Integer, IncluyeTransitorios As Integer, CveClasificacion As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CondicionExistencias As Integer = 0, - Optional Orden As Integer = -1, Optional Marcas As String = "-1", Optional IncluyeProyectado As Integer = -1) As Boolean + Optional Orden As Integer = -1, Optional Marcas As String = "-1", Optional IncluyeProyectado As Integer = -1, Optional CveAlmacenes As String = "-1") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_KardexAlmacenHorizontalGet") @@ -1507,6 +1508,7 @@ Public Class ClsInventarios .Add("@Orden", SqlDbType.Int).Value = Orden .Add("@Marcas", SqlDbType.VarChar).Value = Marcas .Add("@IncluyeProyectado", SqlDbType.TinyInt).Value = IncluyeProyectado + .Add("@CveAlmacenes", SqlDbType.NVarChar).Value = CveAlmacenes End With Try @@ -5259,13 +5261,13 @@ Public Class ClsInventarios Return Retorno End Function - Public Function DeleteMovimientosProyectados(TipoMovto As Integer) As Boolean + Public Function DeleteMovimientosProyectados(TipoMovto As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("Inv_MovimientosProyectadosDelete") With SqlAdapter.SelectCommand.Parameters .Add("@TipoMovto", SqlDbType.TinyInt).Value = TipoMovto - + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 836be534b..6ea168a78 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -155,7 +155,7 @@ Public Class ClsMovimientos Return Retorno End Function - Public Function GetCxCCliente(CveCliente As Integer, FechaI As String, FechaF As String, CveMoneda As Integer, CveSubProyecto As Integer, CveUsuarioRegistro As Integer, CveEmpresa As Integer, Optional TipoAgrupador As Integer = 1, Optional CveUsuarioConsulta As Integer = -1) As Boolean + Public Function GetCxCCliente(CveCliente As Integer, FechaI As String, FechaF As String, CveMoneda As Integer, CveSubProyecto As Integer, CveUsuarioRegistro As Integer, CveEmpresa As Integer, Optional TipoAgrupador As Integer = 1, Optional CveUsuarioConsulta As Integer = -1, Optional Cuenta As String = "-1") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Banc_Clientes") @@ -169,6 +169,7 @@ Public Class ClsMovimientos .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@TipoAgrupador", SqlDbType.Int).Value = TipoAgrupador .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@Cuenta", SqlDbType.NVarChar).Value = Cuenta End With diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 78af613be..fe7fee68d 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -745,7 +745,7 @@ Public Class ClsOIEventos OnError("Ocurrió un error al actualizar la relación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno - End Function + End Function Public Function UPEventosVinculo(CveEvento As Integer, CveTipoRelacion As Integer, CveRelacion As Integer, CveEmpresa As Integer, CveUsuarioIng As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_OI_EventosVinculoUP", CommandType.StoredProcedure) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index ad0cdcd60..38ccbc84f 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4981,13 +4981,12 @@ Public Class ClsPaginas PaginaDict.Add("/PV/PVRepVentasCompras.aspx".ToUpper(), 273) PaginaDict.Add("/Contratos/ContratoObra.aspx".ToUpper(), -1) - - - + PaginaDict.Add("/Contratos/RepContratosObraAvances.aspx".ToUpper(), -1) + PaginaDict.Add("/Contratos/RepContratosObraAvancesDetalle.aspx".ToUpper(), -1) + PaginaDict.Add("/Contratos/RepContratosObraAvancesPartida.aspx".ToUpper(), -1) 'Orden Produccion' - 'RMA PaginaDict.Add("/RMA/Garantias.aspx".ToUpper(), 175) diff --git a/App_Code/WS_PuntoVenta.vb b/App_Code/WS_PuntoVenta.vb index ee2e087e2..602e52a5b 100644 --- a/App_Code/WS_PuntoVenta.vb +++ b/App_Code/WS_PuntoVenta.vb @@ -850,7 +850,7 @@ Public Class WS_PuntoVenta If objVentas.GetVentaTerminal(objVenta.CveVentaTerminal, objVenta.Fecha, objVenta.CveSubProyecto, objVenta.CveEmpresa) Then - CvePrePoliza = ObjConta.AddPrePolizas("Vta", 4, objVenta.Total, objVenta.Total, objVenta.CveMoneda, objVenta.Fecha, "", objVenta.CveUsuario, objVenta.CveEmpresa) + CvePrePoliza = ObjConta.AddPrePolizas("Vta", 4, objVenta.Total, objVenta.Total, objVenta.CveMoneda, objVenta.Fecha, "Punto de Venta addVenta", objVenta.CveUsuario, objVenta.CveEmpresa) If objVentas.DtResultados.Rows.Count = 0 Then If objVentas.AddVenta(objVenta.TipoDocto, objVenta.FolioFact, objVenta.CveCliente, objVenta.CveClienteSucursal, @@ -858,7 +858,7 @@ Public Class WS_PuntoVenta objVenta.Total, objVenta.CveMoneda, objVenta.TipoCambio, objVenta.CveMetodoPago, objVenta.CondicionesPago, objVenta.FormaPago, Now, objVenta.Fecha, objVenta.MotivoDescuento, objVenta.Observaciones, objVenta.FechaEjecucion, objVenta.CveVendedor, If(objVenta.Alfa1 IsNot Nothing, objVenta.Alfa1, ""), If(objVenta.Alfa2 IsNot Nothing, objVenta.Alfa2, ""), If(objVenta.Alfa3 IsNot Nothing, objVenta.Alfa3, ""), objVenta.Num1, - objVenta.Num2, objVenta.Num3, Fech1, Fech2, Fech3, objVenta.CveCorte, objVenta.CveMesa, If(objVenta.NumeroPersonas > 255, 255, objVenta.NumeroPersonas), CvePrePoliza, objVenta.CveUsuario, objVenta.CveEmpresa, objVenta.Propina, objVenta.CveVentaTerminal) Then + objVenta.Num2, objVenta.Num3, Fech1, Fech2, Fech3, objVenta.CveCorte, objVenta.CveMesa, If(objVenta.NumeroPersonas > 255, 255, objVenta.NumeroPersonas), CvePrePoliza, objVenta.CveUsuario, objVenta.CveEmpresa, objVenta.Propina, objVenta.CveVentaTerminal, CveSubProyecto:=objVenta.CveSubProyecto, CveSubProyectoEjecucion:=objVenta.CveSubProyecto) Then objVenta.CveVenta = objVentas.CveVenta 'Ingresar los detalles For Each Detalle As ClsVentaWS.ClsVentaDetalleWS In objVenta.Detalle @@ -979,8 +979,9 @@ Public Class WS_PuntoVenta 'Se agrega movimiento separado por la cuenta de ventas (ER) ' For Each Row As DataRow In DT.Rows ImporteMov = objVenta.SubTotal ' TmpDT.SUM("Total", "IdCtaContVentas = '" & Row("IdCtaContVentas").ToString & "'") + Dim CveClasificacion_04 = -1 If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoVenta, " ", objVenta.Fecha, -1, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoVenta, " ", objVenta.Fecha, -1, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov, CveSubProyecto:=objVenta.CveSubProyecto, CveClasificacion:=CveClasificacion_04) Then ErrorMovtosVentas = True End If End If @@ -989,7 +990,7 @@ Public Class WS_PuntoVenta 'Se agregan los DSV DESCUENTOS ImporteMov = objVenta.Descuento If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoDSV, " ", objVenta.Fecha, IdCtaContDSV, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoDSV, " ", objVenta.Fecha, IdCtaContDSV, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then ErrorMovtosDSV = True End If End If @@ -998,7 +999,7 @@ Public Class WS_PuntoVenta 'Se agregan las CxC ImporteMov = objVenta.Total - TotalPagado If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoAfectacion, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoAfectacion, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then ErrorMovtosCxC = True End If End If @@ -1006,7 +1007,8 @@ Public Class WS_PuntoVenta 'Si hubo un pago agregarlo ImporteMov = TotalPagado If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", 2, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", 2, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then ErrorMovtosCxC = True End If End If @@ -1014,7 +1016,11 @@ Public Class WS_PuntoVenta 'Se agregan el Traslado de IVA ImporteMov = objVenta.IVA If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoIVA, " ", objVenta.Fecha, 0, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + Dim PorcentajeImpuesto = 0 + If objVenta.SubTotal > 0 Then + PorcentajeImpuesto = (objVenta.IVA / objVenta.SubTotal) + End If + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoIVA, " ", objVenta.Fecha, 0, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov, PorcentajeImpuesto:=PorcentajeImpuesto) Then ErrorMovtosTrasladoIVA = True End If End If @@ -1238,7 +1244,7 @@ Public Class WS_PuntoVenta Try - CvePrePoliza = ObjMov.AddPrePolizas("Banc", CvePlantillaPoliza, Importe, Importe, Moneda, Fecha, "", CveUsuario, CveEmpresa) + CvePrePoliza = ObjMov.AddPrePolizas("Banc", CvePlantillaPoliza, Importe, Importe, Moneda, Fecha, "Punto de venta IE", CveUsuario, CveEmpresa) 'valida prepoliza If CvePrePoliza > 0 Then @@ -1252,9 +1258,9 @@ Public Class WS_PuntoVenta If CveIE > 0 Then - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", CveConceptoContable, " ", Now, 0, -1, CveIE) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", CveConceptoContable, " ", Now, 0, -1, CveIE, ImporteMX:=Importe) Then Dim IVA As Double = 0 - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe - IVA - CIF, "", CveConceptoCompra, " ", Now, 0, -1, CveIE) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe - IVA - CIF, "", CveConceptoCompra, " ", Now, 0, -1, CveIE, ImporteMX:=Importe - IVA - CIF) Then Else MsgError = "no se pudo insertar el detalle de la póliza2" diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index b236d68a4..da8ccef26 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -2921,6 +2921,24 @@ Namespace Extensiones Return Retorno End Function + + Public Function ContabilizaMovimientoAlmacen(ByRef ObjConta As ClsContabilidad, Fecha As Date, Concepto As String, Modulo As String, CveMovimientoSalida As Integer, CveMovimientoEntrada As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer, Contabilizable As Boolean) As Integer + Dim Retorno As Integer = -1 + Dim ErrorMovInv As Boolean = False + + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas(Modulo, 53, 0, 0, 1, Fecha, Concepto, CveUsuario, CveEmpresa) + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", 68, Concepto, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=Importe, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 68, Concepto, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=Importe, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + + If Not ErrorMovInv Then Retorno = CvePrePoliza + + Return Retorno + End Function #End Region #Region "GPS" diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index eb6cd7d95..3c0189d72 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -10,7 +10,27 @@ Imports System.IO Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest - context.Response.ContentType = "text/plain" + If context.Request("metodo").ToString() = "GetTokenAngular" Then + 'context.Response.ContentType = "application/json; charset=utf-8" + + context.Response.ContentType = "text/json" + Dim origin As String = context.Request.UrlReferrer.ToString() + context.Response.AddHeader("Access-Control-Allow-Origin", origin.Substring(0, origin.Length - 1)) + 'context.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:4200") + 'context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST") + context.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept") + context.Response.AddHeader("Access-Control-Allow-Credentials", "true") + context.Response.StatusCode = 200 + Dim key As String = GetTokenAngular(context) + Dim json As String = JsonConvert.SerializeObject(key) + context.Response.Write(json) + context.Response.Flush() + context.Response.Close() + context.Response.End() + Else + context.Response.ContentType = "text/plain" + End If + Try Select Case context.Request("metodo") Case "getps" @@ -53,13 +73,27 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState context.Response.Write(sendMail(context)) Case "sendMailLPM" context.Response.Write(sendMailLPM(context)) - End Select Catch ex As Exception ex.GuardaLog(ex.Message) End Try End Sub + Private Function GetTokenAngular(context As HttpContext) As String + Dim usuario As Usuario = UsuarioActual(context) + Dim tokenDescriptor = New Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor With { + .Subject = New System.Security.Claims.ClaimsIdentity(New System.Security.Claims.Claim() {New System.Security.Claims.Claim("CvePlataforma", usuario.CvePlataforma.ToString()), + New System.Security.Claims.Claim("CveUsuario", usuario.CveUsuario.ToString()), New System.Security.Claims.Claim("CveEmpresa", usuario.CveEmpresa.ToString()), + New System.Security.Claims.Claim("CveRol", usuario.CveRol.ToString()), New System.Security.Claims.Claim("Fecha", Date.Now.ToLongDateString())}), + .Expires = Date.UtcNow.AddHours(3), + .SigningCredentials = New Microsoft.IdentityModel.Tokens.SigningCredentials( + New Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.ASCII.GetBytes("*_AsistenciaDesarrolloSistemas-SIGAPI_*17-06-2020")), + Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature)} + Dim tokenHandler = New System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler() + Dim newtoken = tokenHandler.CreateToken(tokenDescriptor) + Dim stokenn As String = tokenHandler.WriteToken(newtoken) + Return stokenn + End Function Private Function sendMailLPM(context As HttpContext) As String Dim retorno As String = "true" Dim nombre As String = "" diff --git a/Bancos/RepCxCCliente.aspx b/Bancos/RepCxCCliente.aspx index 271a7965a..6148a08dc 100644 --- a/Bancos/RepCxCCliente.aspx +++ b/Bancos/RepCxCCliente.aspx @@ -120,6 +120,9 @@ +
  • Cuenta:     + +
  • diff --git a/Bancos/RepCxCCliente.aspx.vb b/Bancos/RepCxCCliente.aspx.vb index 14e8cdfb6..1a02a421e 100644 --- a/Bancos/RepCxCCliente.aspx.vb +++ b/Bancos/RepCxCCliente.aspx.vb @@ -56,7 +56,9 @@ Partial Class Bancos_RepCxCCliente If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1" If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1" - If Mov.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAgrupador.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then + Dim Cuenta As String = If(TxtCuenta.Text = "", "-1", TxtCuenta.Text) + + If Mov.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAgrupador.SelectedValue.ToEntero, UsuarioActual.CveUsuario, Cuenta:=Cuenta) Then GvCxC.DataSource = Mov.DtResultados End If UsuarioActual.Sesion("CobroCliente-Sucursal") = DdlSubProyecto.SelectedValue @@ -139,7 +141,7 @@ Partial Class Bancos_RepCxCCliente If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1" Dim CveCliente = If(DdlClientesWS.SelectedValue.ToEntero > 0, DdlClientesWS.SelectedValue.ToEntero, -1) - If ObjMovtos.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then + If ObjMovtos.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, Cuenta:=TxtCuenta.Text) Then DTpp = ObjMovtos.DtResultados Else DTpp = Nothing diff --git a/Bin/ClosedXML.dll b/Bin/ClosedXML.dll index e945f5d26..4065a321f 100644 Binary files a/Bin/ClosedXML.dll and b/Bin/ClosedXML.dll differ diff --git a/Bin/DocumentFormat.OpenXml.dll b/Bin/DocumentFormat.OpenXml.dll index 53241bd1c..1698758e5 100644 Binary files a/Bin/DocumentFormat.OpenXml.dll and b/Bin/DocumentFormat.OpenXml.dll differ diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 15d95c293..0268da558 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -6698,8 +6698,15 @@ Partial Class Compras_Compras End If Next + 'obtengo si hay servicios + Dim CostosIndirectosTardados As Decimal = TmpDT.SUMD("Total", "ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1 And ISNULL(CveTipoPS,0) = 1") + 'consideracion, si la oc, se le agrego un servicio y este no se cargo en la entrada al almacen. + If CostoIndirectoAcum176 = 0 AndAlso CostosIndirectosTardados > 0 Then + CostosIndirectosTardados = CostosIndirectosTardados * TCO + End If + 'calcula la diferencia entre lo recibido por la OC, considerando costos indirectos y lo que se ingresaria en la compra - SumatoriaOCINV = SumatoriaInventario - (TmpDT.SUMD("Total") * TCO).RoundSQL 'sumatoria de la factura + SumatoriaOCINV = SumatoriaInventario - (TmpDT.SUMD("Total") * TCO).RoundSQL + CostosIndirectosTardados 'sumatoria de la factura If SumatoriaOCINV.RoundSQL <> 0 Then ' se abona el costo, cambiamos su naturaleza 'SumatoriaOCINV = -SumatoriaOCINV @@ -17669,7 +17676,7 @@ Partial Class Compras_Compras ViewState("IVAPS") = Drr("IVA").ToString().ToDouble() DdlProyecto.SelectedValueExist(Drr("CveProyecto")) - 'DdlIVA.Enabled = True + DdlIVA.Enabled = True If Not Modalidad = "U" Then @@ -17989,13 +17996,13 @@ Partial Class Compras_Compras Row("IEPSPSPorcentaje") = PorcentajeIEPS Else 'If DdlIVA.SelectedValue.ToDouble = 0 Then Row("IVA") = 0 Else Row("IVA") = Math.Round(IVA * Total, DecimalesPermitidos) - Row("IVA") = Math.Round(IVA * Total, DecimalesPermitidos) + Row("IVA") = Math.Round(IVA * Total, 2) Row("IVAPorcentaje") = IVA - Row("RetIVA") = Math.Round(RetIVA * Total, DecimalesPermitidos) + Row("RetIVA") = Math.Round(RetIVA * Total, 2) Row("RetIVAPorcentaje") = RetIVA - Row("RetISR") = Math.Round(RetISR * Total, DecimalesPermitidos) + Row("RetISR") = Math.Round(RetISR * Total, 2) Row("RetISRPorcentaje") = RetISR - Row("IEPSPS") = Math.Round(IEPSPS * Total, DecimalesPermitidos) + Row("IEPSPS") = Math.Round(IEPSPS * Total, 2) Row("IEPSPSPorcentaje") = IEPSPS End If Row("ImporteConImpuestos") = (Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble) + Row("IVA").ToString.ToDouble + Row("IEPSPS").ToString.ToDouble - (Row("RetIVA").ToString.ToDouble + Row("RetISR").ToString.ToDouble) diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 3069747e7..6644f7db1 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -214,7 +214,7 @@ - + @@ -555,7 +555,7 @@
    @@ -570,6 +570,13 @@ + + + + + + + diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 7a44163ab..899965cde 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 @@ -2906,6 +2926,9 @@ Partial Class Compras_eFacturas End If Next + + + If MSGComplemento.Trim.Length > 0 Then ' BtnVincularPago.Visible = False ViculacionConPUE = True @@ -2954,11 +2977,30 @@ Partial Class Compras_eFacturas GvVincularPago.DataBind() - UpVincularPago.Update() + ListaComprasPUE = ListaComprasPUEInterna + + If DivVincularPagoManualmente.Visible Then + + For Each GvRowValidaCompra As GridViewRow In GVPDocumentosRelacionadosPagos.Rows + If GvRowValidaCompra.DataKey("CveCompra").ToEntero > 0 Then + DivVincularPagoManualmente.Visible = True + Exit For + Else + DivVincularPagoManualmente.Visible = False + End If + Next + + End If + + + + UpVincularPago.Update() + + RegistraScript("$('#ModalVincularPago').modal('show')", "VincularPagoModalShow") End Sub @@ -2982,13 +3024,27 @@ 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 - TieneError = True + If HdnCveIE.Value.ToEntero > 0 Then + If Gv.DataKey("CveCompra").ToEntero > 0 And Gv.FCLabel("LblCveIE").Text.ToEntero > 0 Then + + If Not ObjCompra.AddComplementoPago(Gv.FCLabel("LblCveIE").Text.ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("ImpPagado").ToDecimal, Gv.FCLabel("LblCvePrePolizaDetalle").Text.ToEntero, CveFacturaPago) > 0 Then + TieneError = True + Exit For + End If + + End If + Else + If Gv.DataKey("CveCompra").ToEntero > 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 + Exit For + End If + + End If End If - - Next If Not TieneError AndAlso Not ObjCompra.AddVincularPago(CveFacturaPago) Then @@ -3001,6 +3057,7 @@ Partial Class Compras_eFacturas If ViculacionConPUE Then + For Each CveCompraVinculada In ListaComprasPUE objEventos.AddEventoBitacora($"Complemento { ComplementoConPUE } vinculado manualmente (Compra PUE) ", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=CveCompraVinculada) Next @@ -3020,6 +3077,8 @@ Partial Class Compras_eFacturas ObjCompra.Commit() + HdnCveIE.Value = "" + Alert("El pago fue vinculado correctamente", TipoMensaje.MsgInformacion) RegistraScript("$('#ModalVincularPago').modal('hide')", "VincularPagoModalHide") CargaDatos() @@ -3042,33 +3101,83 @@ Partial Class Compras_eFacturas End Sub Protected Sub BtnVincularManualmente_Click(sender As Object, e As EventArgs) + + If HdnCveIE.Value <> "-1" AndAlso IsNumeric(HdnCveIE.Value) AndAlso HdnCveIE.Value.ToEntero > 0 Then + Dim ImportePago As Double = 0 Dim ImporteIES As Double = 0 Dim SerieFolioIE As String = "" Dim ObjCompras As New ClsCompras + Dim ErrorVinculacion = True + If ObjCompras.GetCompararComplementoPago(CveProveedor, -1, "", UsuarioActual.CveEmpresa, HdnCveIE.Value.ToEntero) Then - GvVincularPago.DataSource = ObjCompras.DtResultados - If ObjCompras.DtResultados.Rows.Count > 0 Then - SerieFolioIE = ObjCompras.DtResultados.Rows(0)("SerieFolio").ToString - End If - ImportePago = ObjCompras.DtResultados.SUMD("Monto") + + 'GvVincularPago.DataSource = ObjCompras.DtResultados + + 'If ObjCompras.DtResultados.Rows.Count > 0 Then + ' SerieFolioIE = ObjCompras.DtResultados.Rows(0)("SerieFolio").ToString + 'End If + + + 'ImportePago = ObjCompras.DtResultados.SUMD("Monto") + + For Each Drow As DataRow In ObjCompras.DtResultados.Rows + For Each GvRow As GridViewRow In GVPDocumentosRelacionadosPagos.Rows + + If GvRow.RowType = DataControlRowType.DataRow Then + + If Drow("CveCompra").ToString.ToEntero = GvRow.DataKey("CveCompra").ToEntero Then + + GvRow.FCLabel("LblCveIE").Text = Drow("CveIE").ToString.ToEntero.ToString + GvRow.FCLabel("LblCvePrePolizaDetalle").Text = Drow("CvePrePolizaDetalle").ToString.ToEntero.ToString + + End If + + End If + + Next + Next + + + For Each GvRow As GridViewRow In GVPDocumentosRelacionadosPagos.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + If GvRow.FCLabel("LblCveIE").Text.ToEntero > 0 And GvRow.FCLabel("LblCvePrePolizaDetalle").Text.ToEntero > 0 Then + ErrorVinculacion = False + Exit For + Else + ErrorVinculacion = True + + End If + End If + Next + + Else + ErrorVinculacion = True End If - ImporteIES = ObjCompras.DtResultados.FiltraParametros("CveIE > 0").SUM("Importe") - ObjCompras.Dispose() + If Not ErrorVinculacion Then + ImporteIES = ObjCompras.DtResultados.FiltraParametros("CveIE > 0").SUM("Importe") + ObjCompras.Dispose() - BtnVincularPago.Visible = True + BtnVincularPago.Visible = True + + LblSerieFolioPago.Text = $"{SeriePago}-{FolioPago}" + LblImportePago.Text = ImportePago.FormatoNumero + 'LblSerieFolioIE.Text = SerieFolioIE + LblImporteIE.Text = ImporteIES.FormatoNumero + + GvVincularPago.DataBind() + UpVincularPago.Update() + ObjCompras.Dispose() + + Else + Alert("No se pudo realizar la vinculacion manual", TipoMensaje.MsgAdvertencia) + End If - LblSerieFolioPago.Text = $"{SeriePago}-{FolioPago}" - LblImportePago.Text = ImportePago.FormatoNumero - 'LblSerieFolioIE.Text = SerieFolioIE - LblImporteIE.Text = ImporteIES.FormatoNumero - GvVincularPago.DataBind() - UpVincularPago.Update() - ObjCompras.Dispose() End If + End Sub Private Sub GVPDocumentosRelacionadosPagos_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GVPDocumentosRelacionadosPagos.RowCreated diff --git a/Contabilidad/RepIVA.aspx b/Contabilidad/RepIVA.aspx index df71f1fcc..2418a9532 100644 --- a/Contabilidad/RepIVA.aspx +++ b/Contabilidad/RepIVA.aspx @@ -3,12 +3,12 @@ - @@ -16,21 +16,21 @@ Reporte de Impuestos -
  • +
  • PDF
  • - Excel + Excel
  • -
  • +
  • Ver Dlls en pesos
  • - + -
  • - Generar DIOT -
  • +
  • + Generar DIOT +
  • @@ -38,14 +38,14 @@
  • - Generales del proveedor + Generales del proveedor
  • - +
  • - Comparativo + Comparativo
  • -
    +
    @@ -59,6 +59,8 @@
    + "> +
    @@ -93,17 +95,23 @@
    - +
    - - + + -
    +
    -
    +
    > +
    + +
    + +
    +
    @@ -112,134 +120,134 @@ - - + + -
    +
    - -

    IVA Trasladado

    - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    +

    IVA Trasladado

    + + + + + + + + + + + + + + + -
    -

    IEPS por Porcentaje

    - - - - - - - - - -
    -
    -

    IVA por Porcentaje

    - - - - - - - - + + + + + + + +
    +
    +
    + +
    +

    IEPS por Porcentaje

    + + + + + + + + +
    -
    -
    - - - +
    +

    IVA por Porcentaje

    + + + + + - - -

    IVA Acreditable

    - - - - - - - - - - - - - - - - - - RetIVA
    Hon/Ser.Prof.
    -
    - - - -
    - - - - - - - - - - +
    +
    +
    +
    +
    - <%-- + + + + + +

    IVA Acreditable

    + + + + + + + + + + + + + + + + + + RetIVA
    Hon/Ser.Prof.
    +
    + + + +
    + + + + + + + + + + + + <%-- --%> - - - - - -
    -
    -
    -

    IVA por Porcentaje

    - - - - - - - - -
    - -
    -
    - + + + + + + + +
    +

    IVA por Porcentaje

    + + + + + + + + +
    + + + + @@ -279,7 +287,7 @@ - -
    -
    + + +
    + +
    + 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..9635f7334 100644 --- a/Contratos/ContratoAvance.aspx.vb +++ b/Contratos/ContratoAvance.aspx.vb @@ -33,7 +33,22 @@ Partial Class Contratos_ContratoAvance Set(value As Integer) ViewState("CveContrato") = value End Set + End Property + + + Private Property CveContratoEstimacion As Integer + Get + If ViewState("CveContratoEstimacion") Is Nothing Then + Return Nothing + Else + Return ViewState("CveContratoEstimacion").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveContratoEstimacion") = value + End Set End Property + 'fecha seleccionada del historico de avances Private Property fecha As String Get @@ -46,22 +61,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 +148,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 +166,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 +203,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 +253,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 +313,117 @@ Partial Class Contratos_ContratoAvance ObjContratos.Dispose() CargaddlAvance() CargaDatosAvance() - End Sub - + End Sub + + + +#Region "ESTIMACION" + + + Private Sub CargaAvancesParaEstimar() + CveContratoEstimacion = -1 + + Dim ObjContratos As New ClsContratos() + Dim DTEstimaciones As New DataTable + + + If ObjContratos.GetContratosAvanceEstimacion(DDlContratosEstimaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + DTEstimaciones = ObjContratos.DtResultados + + CveContratoEstimacion = DDlContratosEstimaciones.SelectedValue.ToEntero + + + End If + + + ObjContratos.Dispose() + + + If DTEstimaciones.Rows.Count > 0 Then + GvEstimaciones.DataSource = DTEstimaciones + BtnGuardarEstimacion.Visible = True + Else + GvEstimaciones.DataSource = Nothing + BtnGuardarEstimacion.Visible = False + 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() + Dim ErrorProceso As Boolean = False + Dim NuemeroEstimacion As Integer = -1 + ObjContratos.IniciaTransacSQL() + + + If ObjContratos.AddContratosAvanceEstimacion(CveContratoEstimacion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + + + NuemeroEstimacion = ObjContratos.NumeroEstimacionNueva + + For Each GvRow As GridViewRow In GvEstimaciones.Rows + + If GvRow.DataKey("CveContratoAvance").ToEntero > 0 Then + If Not ObjContratos.UpdateContratosAvanceEstimacion(GvRow.DataKey("CveContratoAvance").ToEntero, ObjContratos.CveEstimacionNueva, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + Exit For + End If + End If + Next + + Else + ErrorProceso = True + End If + + 'AddContratosAvanceEstimacion + 'UpdateContratosAvanceEstimacion + + + + If Not ErrorProceso Then + ObjContratos.Commit() + Alert($"Estimación {NuemeroEstimacion} agregada correctamente.") + Else + ObjContratos.RollBack() + End If + + ObjContratos.Dispose() + + End Sub + + +#End Region + End Class diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx index c8230178d..4ee9ea4b0 100644 --- a/Contratos/ContratoObra.aspx +++ b/Contratos/ContratoObra.aspx @@ -326,20 +326,40 @@ +
    +
    + +
    + + +
    + + +
    + + + +
    + + +
    + + +