From 17348ffe57bb112e5d1268029eb6f53a3300656e Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Fri, 11 Dec 2020 12:46:26 -0700 Subject: [PATCH] Contratos --- App_Code/ClsContratos.vb | 16 +- App_Code/ClsPaginas.vb | 37 ++++ App_Code/ClsRH.vb | 45 ++-- Contratos/ContratoObra.aspx.vb | 315 ++++++++++++++++++++-------- Inventarios/TraspasoAlmacen.aspx.vb | 4 +- 5 files changed, 309 insertions(+), 108 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 2f6dc4b60..81bfc0d90 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -1007,14 +1007,15 @@ Public Class ClsContratos End Try Return Retorno - End Function - - - + End Function + + + #End Region - + #Region "CONTRATOS DETALLE" - Public Function AddContratosDetalle(CveContrato As Integer, CvePS As Integer, Cantidad As Double, PU As Double, CveUsuario As Integer, CveTipoPresupuesto As Integer, NoIdentificacion As String, LimitarCantidad As Boolean, OCInterna As String, Optional Observacion As String = "") As Boolean + Public Function AddContratosDetalle(CveContrato As Integer, CvePS As Integer, Cantidad As Double, PU As Double, CveUsuario As Integer, CveTipoPresupuesto As Integer, NoIdentificacion As String, LimitarCantidad As Boolean, OCInterna As String, + Optional Observacion As String = "", Optional CveRubro As Integer = -1, Optional CveActividad As Integer = -1, Optional CveSubTipoActivoFijo As Integer = -1) As Boolean Dim Retorno = False DataAdapter("PA_Con_ContratosDetalleAdd") @@ -1029,6 +1030,9 @@ Public Class ClsContratos .Add("@OCInterna", SqlDbType.VarChar).Value = OCInterna .Add("@LimitarCantidad", SqlDbType.Bit).Value = If(LimitarCantidad, 1, 0) .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@CveRubro", SqlDbType.Int).Value = CveRubro + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo 'NoIdentificacion End With diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 850cbb1c6..be81c310e 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -634,6 +634,8 @@ Public Class ClsPaginas Application("GlobalDTEmpresas") = value End Set End Property + + Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1, Optional CveClasificacion As Integer = -1) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTClasificaciones-{0}", CveEmpresa) @@ -664,6 +666,41 @@ Public Class ClsPaginas Application(AppNombre) = value End Set End Property + + + + + Property GlobalDTRHActividades(CveEmpresa As Integer) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTRHActividades-{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + + Dim ObjRH As New ClsRH + If ObjRH.GetActividades(CveEmpresa) Then Application(AppNombre) = ObjRH.DtResultados + ObjRH.Dispose() + + End If + + If CveEmpresa <> -1 Then + Dim Str As New StringBuilder + Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) + GlobalDTRHActividades = Dv.ToTable + Dv.Dispose() + Else + GlobalDTRHActividades = DirectCast(Application(AppNombre), DataTable) + End If + + + + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTRHActividades-{0}", CveEmpresa) + Application(AppNombre) = value + End Set + End Property + Property GlobalDTClasificaciones2(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTClasificaciones2-{0}", CveEmpresa) diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index de7538cf9..66e53ec8a 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -6865,21 +6865,40 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al eliminar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #End Region - - - 'Public msgsError As New StringBuilder() - 'Public Sub OnError(Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "") - ' GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) - ' msgsError.AppendLine(Mensaje) - ' msgsError.Append("
") - ' 'Alert(Obj, Mensaje, TipoMensaje.MsgError) - ' 'If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) - 'End Sub - + +#Region " A C T I V I D A D E S" + + + Public Function GetActividades(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_RH_ActividadesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el listado de checadores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function +#End Region + + + 'Public msgsError As New StringBuilder() + 'Public Sub OnError(Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "") + ' GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) + ' msgsError.AppendLine(Mensaje) + ' msgsError.Append("
") + ' 'Alert(Obj, Mensaje, TipoMensaje.MsgError) + ' 'If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) + 'End Sub + #Region " IDisposable Support " - ' IDisposable + ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) 'If msgsError.ToString().Length > 0 Then ' Alert(msgsError.ToString(), TipoMensaje.MsgError) diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index e04960ae0..15bce85a9 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -596,6 +596,16 @@ Partial Class Contratos_ContratoObra TmpDT.Columns.Add("LimitarCantidad", GetType(Integer)) TmpDT.Columns.Add("OCInterna", GetType(String)) TmpDT.Columns.Add("Observacion", GetType(String)) + + TmpDT.Columns.Add("CveRubro", GetType(Integer)) + TmpDT.Columns.Add("CveActividad", GetType(Integer)) + TmpDT.Columns.Add("CveSubTipoActivoFijo", GetType(Integer)) + + TmpDT.Columns.Add("Rubro", GetType(String)) + TmpDT.Columns.Add("Actividad", GetType(String)) + TmpDT.Columns.Add("SubTipoActivoFijo", GetType(String)) + + End Sub Protected Sub Limpiar() TxtNumeroContrato.Text = "" @@ -4126,27 +4136,58 @@ Partial Class Contratos_ContratoObra Protected Sub BtnCargaPresupuesto_Click(sender As Object, e As EventArgs) Dim DTCargaPresupuesto As New DataTable - DTCargaPresupuesto = CargaPreSupuestoExcel() + Dim DTCargaPresupuestoInsumos As New DataTable + Dim DTCargaPresupuestoManoObra As New DataTable + Dim DTCargaPresupuestoFlotillas As New DataTable + + + If TipoCargaPresupuesto = EnumTipoCargaPresupuesto.Ventas Then + DTCargaPresupuesto = CargaPreSupuestoExcel("Presupuesto") + + + If DTCargaPresupuesto.Rows.Count > 0 Then + ProcesaDatosCargaPresupuesto(DTCargaPresupuesto, Nothing, Nothing) + Else + Alert("No se encintraron partidas en el documento", TipoMensaje.MsgAdvertencia) + End If + - If DTCargaPresupuesto.Rows.Count > 0 Then - ProcesaDatosCargaPresupuesto(DTCargaPresupuesto) Else - Alert("No se encintraron partidas en el documento", TipoMensaje.MsgAdvertencia) + + DTCargaPresupuesto = CargaPreSupuestoExcel("Insumos") + DTCargaPresupuestoManoObra = CargaPreSupuestoExcel("ManoObra") + DTCargaPresupuestoFlotillas = CargaPreSupuestoExcel("Flotillas") + + ProcesaDatosCargaPresupuesto(DTCargaPresupuesto, DTCargaPresupuestoManoObra, DTCargaPresupuestoFlotillas) + End If + TxtModalCargaPresupuesto.Text = "" + End Sub Protected Sub BtnDecargaFormato_Click(sender As Object, e As EventArgs) - Dim FI As New IO.FileInfo($"{Extensiones.DirectorioBaseEmpresas}\Empresas\Grales\Formatos\FormatoPresupuestoObra.xlsx") + If TipoCargaPresupuesto = EnumTipoCargaPresupuesto.Ventas Then + FI = New IO.FileInfo($"{Extensiones.DirectorioBaseEmpresas}\Empresas\Grales\Formatos\FormatoPresupuestoObra.xlsx") + Else + FI = New IO.FileInfo($"{Extensiones.DirectorioBaseEmpresas}\Empresas\Grales\Formatos\FormatoPresupuestoObraInterno.xlsx") + End If + If FI.Exists Then Response.ContentType = "application/octet-stream" - Response.AppendHeader("Content-Disposition", $"attachment; filename=FormatoPresupuestoObra.xlsx") + + If TipoCargaPresupuesto = EnumTipoCargaPresupuesto.Ventas Then + Response.AppendHeader("Content-Disposition", $"attachment; filename=FormatoPresupuestoObra.xlsx") + Else + Response.AppendHeader("Content-Disposition", $"attachment; filename=FormatoPresupuestoObraInterno.xlsx") + End If + Response.TransmitFile(FI.FullName) Response.End() @@ -4156,7 +4197,7 @@ Partial Class Contratos_ContratoObra End Sub - Private Function CargaPreSupuestoExcel() As DataTable + Private Function CargaPreSupuestoExcel(Hoja As String) As DataTable Dim FileExtension As String = "-1" Dim Filesgral As List(Of Archivo) = TxtModalCargaPresupuesto.getfiles().Archivos @@ -4178,7 +4219,7 @@ Partial Class Contratos_ContratoObra tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) SpreadsheetInfo.SetLicense(Extensiones.SerialGemBoxSpreadsheet) Dim workbook = ExcelFile.Load(fileItem.FileUrl) - Dim worksheet = workbook.Worksheets(0) + Dim worksheet = workbook.Worksheets(Hoja) DTPS = worksheet.CreateDataTable(New CreateDataTableOptions() With { .ColumnHeaders = True, @@ -4190,7 +4231,7 @@ Partial Class Contratos_ContratoObra Next - TxtModalCargaPresupuesto.Text = "" + RegistraScript("$('#ModalUploadPresupuesto').modal('hide')") @@ -4201,7 +4242,25 @@ Partial Class Contratos_ContratoObra End Function - Private Sub ProcesaDatosCargaPresupuesto(DTPresupuesto As DataTable) + Private Sub ProcesaDatosCargaPresupuesto(DTPresupuesto As DataTable, DTCargaPresupuestoManoObra As DataTable, DTCargaPresupuestoFlotillas As DataTable) + + + If Not DTPresupuesto Is Nothing Then + DTPresupuesto.CaseSensitive = False + End If + + If Not DTCargaPresupuestoManoObra Is Nothing Then + DTCargaPresupuestoManoObra.CaseSensitive = False + End If + + If Not DTCargaPresupuestoFlotillas Is Nothing Then + DTCargaPresupuestoFlotillas.CaseSensitive = False + End If + + + + + Dim DTPS = New DataTable DTPS.Columns.Add("CveContratoDetalle", GetType(Integer)) @@ -4228,65 +4287,141 @@ Partial Class Contratos_ContratoObra DTPS.Columns.Add("OCInterna", GetType(String)) DTPS.Columns.Add("Observacion", GetType(String)) + DTPS.Columns.Add("CveRubro", GetType(Integer)) + DTPS.Columns.Add("CveActividad", GetType(Integer)) + DTPS.Columns.Add("CveSubTipoActivoFijo", GetType(Integer)) + + DTPS.Columns.Add("Rubro", GetType(String)) + DTPS.Columns.Add("Actividad", GetType(String)) + DTPS.Columns.Add("SubTipoActivoFijo", GetType(String)) + Dim RowNoEncontrados As String = "" - For Each DrowPS As DataRow In DTPresupuesto.Rows + If Not DTPresupuesto Is Nothing Then + For Each DrowPS As DataRow In DTPresupuesto.Rows - Dim StrArray() As String = GetPS("PS", DrowPS("PS").ToString).Split("|"c) - Dim CvePS As Integer - Dim CveUM As Integer + Dim StrArray() As String = GetPS("PS", DrowPS("Producto").ToString).Split("|"c) + Dim CvePS As Integer + Dim CveUM As Integer - If StrArray.Length > 0 Then - If CBool(StrArray(0)) = True Then - CvePS = StrArray(1).ToEntero - Else - RowNoEncontrados &= StrArray(1) & "<\BR>" + If StrArray.Length > 0 Then + If CBool(StrArray(0)) = True Then + CvePS = StrArray(1).ToEntero + Else + RowNoEncontrados &= StrArray(1) & "<\BR>" + End If End If - End If - - If CvePS > 0 And DrowPS("Cantidad").ToString.ToDouble > 0 Then - - CveUM = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveUnidadMedida", "").ToString.ToEntero - - Dim Row As DataRow = DTPS.NewRow() - Row("Cantidad") = DrowPS("Cantidad").ToString.ToDouble - Row("CantidadContratada") = DrowPS("Cantidad").ToString.ToDouble - Row("CveUM") = CveUM - Row("UM") = "" - Row("CveClasificacion") = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveClasificacion", "").ToString.ToEntero - Row("Clasificacion") = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = '{ Row("CveClasificacion").ToString }'").ToString - Row("CvePS") = CvePS - Row("PS") = DrowPS("PS").ToString - Row("CodigoPS") = DrowPS("PS").ToString - Row("PU") = DrowPS("PU").ToString.ToDouble - Row("Total") = DrowPS("Cantidad").ToString.ToDouble * DrowPS("PU").ToString.ToDouble - - - Select Case TipoCargaPresupuesto - Case EnumTipoCargaPresupuesto.Ventas - Row("CveTipoPresupuesto") = 2 - Exit Select - Case EnumTipoCargaPresupuesto.Control - Row("CveTipoPresupuesto") = 1 - Exit Select - Case Else - Row("CveTipoPresupuesto") = 1 - End Select - - - Row("NoIdentificacion") = "" - Row("OCInterna") = "" - Row("LimitarCantidad") = 0 - Row("Observacion") = "" - - DTPS.Rows.Add(Row) - - End If - Next + If CvePS > 0 And DrowPS("Cantidad").ToString.ToDouble > 0 Then + + + + CveUM = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $" UnidadMedida = '{ DrowPS("UnidadMedida").ToString.Trim }' OR Abreviatura = '{ DrowPS("UnidadMedida").ToString.Trim }'").ToEntero + + If CveUM <= 0 Then + CveUM = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveUnidadMedida", "").ToString.ToEntero + End If + + + Dim Row As DataRow = DTPS.NewRow() + Row("Cantidad") = DrowPS("Cantidad").ToString.ToDouble + Row("CantidadContratada") = DrowPS("Cantidad").ToString.ToDouble + Row("CveUM") = CveUM + Row("UM") = "" + Row("CveClasificacion") = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveClasificacion", "").ToString.ToEntero + Row("Clasificacion") = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = '{ Row("CveClasificacion").ToString }'").ToString + Row("CvePS") = CvePS + Row("PS") = DrowPS("Producto").ToString + Row("CodigoPS") = DrowPS("Producto").ToString + Row("PU") = DrowPS("PU").ToString.ToDouble + Row("Total") = DrowPS("Cantidad").ToString.ToDouble * DrowPS("PU").ToString.ToDouble + + + + + Select Case TipoCargaPresupuesto + Case EnumTipoCargaPresupuesto.Ventas + + Row("CveTipoPresupuesto") = 2 + Row("CveRubro") = 1 + Row("CveActividad") = -1 + Row("CveSubTipoActivoFijo") = -1 + + Exit Select + Case EnumTipoCargaPresupuesto.Control + Row("CveTipoPresupuesto") = 1 + Row("CveRubro") = 2 + Row("CveActividad") = -1 + Row("CveSubTipoActivoFijo") = -1 + Exit Select + Case Else + Row("CveTipoPresupuesto") = 1 + Row("CveActividad") = -1 + Row("CveSubTipoActivoFijo") = -1 + End Select + + + Row("NoIdentificacion") = "" + Row("OCInterna") = "" + Row("LimitarCantidad") = 0 + Row("Observacion") = "" + + DTPS.Rows.Add(Row) + + End If + Next + + End If + + + + If Not DTCargaPresupuestoManoObra Is Nothing Then + + + For Each DrowPS As DataRow In DTCargaPresupuestoManoObra.Rows + + Dim CveActividad As Integer = 0 + + CveActividad = GlobalDTRHActividades(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveActividad", $" Actividad = '{ DrowPS("Actividad").ToString.Trim }'").ToEntero + + If CveActividad > 0 And DrowPS("Cantidad").ToString.ToDouble > 0 Then + + Dim Row As DataRow = DTPS.NewRow() + Row("Cantidad") = DrowPS("Cantidad").ToString.ToDouble + Row("CantidadContratada") = DrowPS("Cantidad").ToString.ToDouble + Row("CveUM") = -1 + Row("UM") = "" + Row("CveClasificacion") = -1 + Row("Clasificacion") = "" + Row("CvePS") = -1 + Row("PS") = DrowPS("Actividad").ToString + Row("CodigoPS") = DrowPS("Actividad").ToString + Row("PU") = DrowPS("PU").ToString.ToDouble + Row("Total") = DrowPS("Cantidad").ToString.ToDouble * DrowPS("PU").ToString.ToDouble + + Row("CveTipoPresupuesto") = 2 + Row("CveRubro") = 3 + Row("CveActividad") = CveActividad + Row("CveSubTipoActivoFijo") = -1 + + Row("NoIdentificacion") = "" + Row("OCInterna") = "" + Row("LimitarCantidad") = 0 + Row("Observacion") = "" + + DTPS.Rows.Add(Row) + + End If + Next + + End If + + If Not DTCargaPresupuestoFlotillas Is Nothing Then + + End If Dim ErrorProceso = False Dim ObjContratos As New ClsContratos @@ -4295,10 +4430,12 @@ Partial Class Contratos_ContratoObra For Each Row As DataRow In DTPS.Rows - If ObjContratos.AddContratosDetalle(CveContrato, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, Convert.ToBoolean(Row("LimitarCantidad")), Row("OCInterna").ToString, Observacion:=Row("Observacion").ToString) Then + If ObjContratos.AddContratosDetalle(CveContrato, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, + Row("NoIdentificacion").ToString, Convert.ToBoolean(Row("LimitarCantidad")), Row("OCInterna").ToString, Observacion:=Row("Observacion").ToString, CveRubro:=Row("CveRubro").ToString.ToEntero, + CveActividad:=Row("CveActividad").ToString.ToEntero, CveSubTipoActivoFijo:=Row("CveSubTipoActivoFijo").ToString.ToEntero) Then If Autorizado Then - Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU")) + Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con rubro {4} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU"), Row("CveRubro")) guardarBitacora(msj) End If @@ -4322,6 +4459,14 @@ Partial Class Contratos_ContratoObra NrowTmpDT("LimitarCantidad") = Row("LimitarCantidad") NrowTmpDT("Observacion") = Row("Observacion") + NrowTmpDT("CveRubro") = Row("CveRubro") + NrowTmpDT("CveActividad") = Row("CveActividad") + NrowTmpDT("CveSubTipoActivoFijo") = Row("CveSubTipoActivoFijo") + + NrowTmpDT("Rubro") = Row("Rubro") + NrowTmpDT("Actividad") = Row("Actividad") + NrowTmpDT("SubTipoActivoFijo") = Row("SubTipoActivoFijo") + NrowTmpDT("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") @@ -4606,42 +4751,38 @@ Partial Class Contratos_ContratoObra Con.Dispose() - If DTDatos.Rows.Count > 0 Then + Try + If DTDatos.Rows.Count > 0 Then - Dim CantidadAvance As Decimal = DTDatos.Rows(0)("Cantidad").ToString.ToDecimal - Dim ImporteAvance As Decimal = DTDatos.Rows(0)("AvanceImporte").ToString.ToDecimal - Dim TotalAvancePorcentaje As Decimal = If(ImporteAvance > 0, (ImporteAvance * 100 / TotalAvanceVentas).RoundSQL(2), 0) + Dim CantidadAvance As Decimal = DTDatos.Rows(0)("Cantidad").ToString.ToDecimal + Dim ImporteAvance As Decimal = DTDatos.Rows(0)("AvanceImporte").ToString.ToDecimal + Dim TotalAvancePorcentaje As Decimal = If(ImporteAvance > 0, (ImporteAvance * 100 / TotalAvanceVentas).RoundSQL(2), 0) - Dim CantidadInterno As Decimal = DTDatos.Rows(0)("CantidadInterno").ToString.ToDecimal - Dim ImporteInterno As Decimal = DTDatos.Rows(0)("ImporteInterno").ToString.ToDecimal - Dim TotalFaltantePorcentaje As Decimal = If(ImporteInterno > 0, (ImporteInterno * 100 / TotalAvanceInterno).RoundSQL(2), 0) + Dim CantidadInterno As Decimal = DTDatos.Rows(0)("CantidadInterno").ToString.ToDecimal + Dim ImporteInterno As Decimal = DTDatos.Rows(0)("ImporteInterno").ToString.ToDecimal + Dim TotalFaltantePorcentaje As Decimal = If(ImporteInterno > 0, (ImporteInterno * 100 / TotalAvanceInterno).RoundSQL(2), 0) - LtlAvanceImporte.Text = $"$ { ImporteAvance.ToString("###,###,###.00") }" - LtlAvanceImporteProcentaje1.Text = $"{TotalAvancePorcentaje.ToString("###.00")} %" - LtlAvanceImporteProcentaje2.Text = $"{TotalAvancePorcentaje.ToString("###.00")}%" - SPAvance1.Attributes.Add("style", $"width:{TotalAvancePorcentaje.ToString.ToEntero}%") + LtlAvanceImporte.Text = $"$ { ImporteAvance.ToString("###,###,###.00") }" + LtlAvanceImporteProcentaje1.Text = $"{TotalAvancePorcentaje.ToString("###.00")} %" + LtlAvanceImporteProcentaje2.Text = $"{TotalAvancePorcentaje.ToString("###.00")}%" + SPAvance1.Attributes.Add("style", $"width:{TotalAvancePorcentaje.ToString.ToEntero}%") - LtlAvanceInternoImporte.Text = $"$ {DTDatos.Rows(0)("ImporteInterno").ToString.ToDecimal.ToString("###,###,###.00")}" - LtlAvanceInternoImportePorcentaje1.Text = $"{TotalFaltantePorcentaje.ToString("###.00")} %" - LtlAvanceInternoImportePorcentaje2.Text = $"{TotalFaltantePorcentaje.ToString("###.00")}%" - SPFaltante.Attributes.Add("style", $"width:{TotalFaltantePorcentaje.ToString.ToEntero}%") + LtlAvanceInternoImporte.Text = $"$ {DTDatos.Rows(0)("ImporteInterno").ToString.ToDecimal.ToString("###,###,###.00")}" + LtlAvanceInternoImportePorcentaje1.Text = $"{TotalFaltantePorcentaje.ToString("###.00")} %" + LtlAvanceInternoImportePorcentaje2.Text = $"{TotalFaltantePorcentaje.ToString("###.00")}%" + SPFaltante.Attributes.Add("style", $"width:{TotalFaltantePorcentaje.ToString.ToEntero}%") - End If + End If + + Catch ex As Exception + + End Try - 'Dim TotalContratos As Decimal = DTDatos.SUM("Importe") - 'Dim TotalAvance As Decimal = DTDatos.SUM("AvanceImporte") - 'Dim TotalFaltante As Decimal = TotalContratos - TotalAvance - 'Dim TotalAvancePorcentaje As Decimal = ((TotalAvance * 100) / TotalContratos).RoundAD(2) - 'Dim TotalFaltantePorcentaje As Decimal = (100 - TotalAvancePorcentaje).RoundAD(2) - - - ' LtlGrafNumeroContratos.Text = NumeroContratos.ToString - 'LtlGrafTotal.Text = TotalContratos.ToString("###,###,###.00") DVGraficas.Visible = True diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 434eaf4fb..4af10e301 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -1525,7 +1525,7 @@ Partial Class Inventarios_TraspasoAlmacen FolioBusqueda = If(TxtFolioRecepcion.Text = "", -1, TxtFolioRecepcion.Text.ToEntero) Dim ObjInventarios As New ClsInventarios - If ObjInventarios.GetMovimientosTransitorios(DdlAlmacenRecepcion.SelectedValue.ToEntero, -1, DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then + If ObjInventarios.GetMovimientosTransitorios(DdlAlmacenRecepcion.SelectedValue.ToEntero, -1, DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero, -1, FolioBusqueda, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4")) Else Alert("Ocurrió un error al consultar los movimientos transitorios. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -1820,7 +1820,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) '' verifica que no se halla recibido previamente, si ya se recibió da salida - If ObjInventario.GetMovimientosTransitorios(CveAlmacenDestino, -1, CveAlmacenTransitorio, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientosTransitorios(CveAlmacenDestino, -1, CveAlmacenTransitorio, -1, FolioBusqueda, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then Dtt = ObjInventario.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4"), "", {"CveMovimientoDetalle", "Codigo", "Cantidad"}) If Dtt IsNot Nothing AndAlso Dtt.FiltraParametros("Cantidad < 0").Rows.Count > 0 Then