diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index e7b9a2971..a8235bf19 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -3493,10 +3493,63 @@ Public Class ClsContratos End Try Return Retorno - End Function + End Function + + + +#Region " MAQUINARIA FLOTILLA HERRAMIENTA " + + + Public Function AddContratosMaquinariaFlotilla(CveActivoFijo As Integer, Fecha As Date, CvePersonal As Integer, Importe As Decimal, CveContratoDetalle As Integer) As Boolean + Dim Retorno As Boolean = False + Dataset = New DataSet() + DataAdapter("PA_Con_ContratosMaquinariaFlotillaAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle + End With + + Try + SqlAdapter.Fill(Dataset) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el registro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + Public Function GetContratosMaquinariaFlotillaSubTipoAF(CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + Dataset = New DataSet() + DataAdapter("PA_Con_ContratosMaquinariaFlotillaSuibTipoAFGet") + + 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 obtener el registro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + +#End Region + #Region " IDisposable Support " - ' IDisposable + ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) If Not disposedValue Then If disposing Then diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 4f8101173..63d502979 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1366,7 +1366,15 @@ Partial Class Compras_Compras Dim ObjPersonal As New ClsRH ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa) DdlPersonal.DataSource = ObjPersonal.DtResultados - DdlPersonalReembolso.DataSource = ObjPersonal.DtResultados.FiltraParametros("CveEstatusPersonal = 1") + + If UsuarioActual.CveEmpresa = 119 Then + DdlPersonalReembolso.DataSource = ObjPersonal.DtResultados + Else + DdlPersonalReembolso.DataSource = ObjPersonal.DtResultados.FiltraParametros("CveEstatusPersonal = 1") + End If + + + ObjPersonal.Dispose() DdlPersonal.DataBind() DdlPersonalReembolso.DataBind() diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx index ea4c94e5d..bea7e596d 100644 --- a/Contratos/ContratoObra.aspx +++ b/Contratos/ContratoObra.aspx @@ -102,6 +102,10 @@ Agregar Gasto +
  • + Agregar Maquionaria Flotilla Herramienta +
  • + @@ -1011,19 +1015,7 @@ - <%-- - -
    - -
    -
    - - - -
    --%> + Insumos Mano de Obra - Flotillas + Maquinaria Herramienta Flotilla @@ -2764,18 +2756,30 @@
    - - + +
    + + +
    + + + + +
    +
    -
    + + + +
    @@ -2890,6 +2894,94 @@
    + + <%--MODAL CONTROL PRESUPUESTOS AGREGAR--%> + + + + diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index 84bf44ec2..e9b90179a 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -436,6 +436,7 @@ Partial Class Contratos_ContratoObra LnkModalAddPSControl.Visible = True LnkModalAddPresupuestoVentas.Visible = True LnkModalAddPresupuestoControl.Visible = True + LnkModalAddMaquinariaFlotilla.Visible = True End If @@ -1824,6 +1825,7 @@ Partial Class Contratos_ContratoObra Row("Rubro") = DdlRubro.SelectedItem.Text If DdlRubro.SelectedValue.ToEntero = 3 Then + Row("CveActividad") = DdlActividades.SelectedValue.ToEntero Row("Actividad") = DdlActividades.SelectedItem.Text Row("Dias") = TxtDias.Text.ToEntero @@ -1838,6 +1840,23 @@ Partial Class Contratos_ContratoObra Row("PS") = DdlActividades.SelectedItem.Text Row("CodigoPS") = DdlActividades.SelectedItem.Text + + ElseIf DdlRubro.SelectedValue.ToEntero = 4 Then + + Row("CveActividad") = -1 + Row("Actividad") = "" + Row("Dias") = TxtDias.Text.ToEntero + Row("CveSubTipoActivoFijo") = DdlSubTipoActivoFijo.SelectedValue.ToEntero + + + Row("CveUM") = -1 + Row("UM") = "" + Row("CveClasificacion") = -1 + Row("Clasificacion") = "" + Row("CvePS") = -1 + Row("PS") = DdlSubTipoActivoFijo.SelectedItem.Text + Row("CodigoPS") = DdlSubTipoActivoFijo.SelectedItem.Text + Else Row("CveActividad") = -1 Row("Actividad") = "" @@ -1903,11 +1922,22 @@ Partial Class Contratos_ContratoObra If CveRubro = 3 Then + CveSubTipoActivoFijo = -1 CveActividad = DdlActividades.SelectedValue.ToEntero Dias = TxtDias.Text.ToEntero CvePS = -1 CveUM = -1 + + ElseIf CveRubro = 4 Then + + CveSubTipoActivoFijo = DdlSubTipoActivoFijo.SelectedValue.ToEntero + CveActividad = -1 + Dias = TxtDias.Text.ToEntero + + CvePS = -1 + CveUM = -1 + Else CvePS = DdlProductowsInsumos.SelectedValue.ToEntero CveUM = DdlUMInsumos.SelectedValue.ToEntero @@ -1923,23 +1953,45 @@ Partial Class Contratos_ContratoObra Dim ObjContratos As New ClsContratos If ObjContratos.UpdateContratosDetalle(CveContratoDetalleEditar, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, "", False, "", CveRubro:=CveRubro, CveActividad:=CveActividad, CveSubTipoActivoFijo:=CveSubTipoActivoFijo, Dias:=Dias) Then - If Autorizado Then - Dim msj As String = String.Format("Se realizaron los siguientes cambios, el Presupuesto Interno se modificó: {1} {0} {2:C2} a {3} {0} {4:C2}", - row("PS").ToString, row("Cantidad").ToString, row("PU").ToString, Cantidad, PU) - guardarBitacora(msj) - End If + 'If Autorizado Then + ' Dim msj As String = String.Format("Se realizaron los siguientes cambios, el Presupuesto Interno se modificó: {1} {0} {2:C2} a {3} {0} {4:C2}", + ' row("PS").ToString, row("Cantidad").ToString, row("PU").ToString, Cantidad, PU) + ' guardarBitacora(msj) + 'End If + + row("Cantidad") = Cantidad row("CantidadContratada") = Cantidad row("PU") = PU row("Total") = Cantidad * PU row("CveUM") = CveUM - row("UM") = DdlUMInsumos.SelectedItem.Text + row("NoIdentificacion") = "" 'NoIdentificacion row("LimitarCantidad") = False + + row("CveActividad") = CveActividad + row("CveSubTipoActivoFijo") = CveSubTipoActivoFijo + row("Dias") = Dias + + + If CveRubro = 3 Then + row("PS") = DdlActividades.SelectedItem.Text + row("CodigoPS") = DdlActividades.SelectedItem.Text + row("UM") = "" + ElseIf CveRubro = 4 Then + row("PS") = DdlSubTipoActivoFijo.SelectedItem.Text + row("CodigoPS") = DdlSubTipoActivoFijo.SelectedItem.Text + row("UM") = "" + Else + row("UM") = DdlUMInsumos.SelectedItem.Text + End If + TmpDT.AcceptChanges() + Alert("Cambios realizados correctamente.", TipoMensaje.MsgInformacion) RegistraScript("$('#ModalControlAddPS').modal('hide')") + Else Alert("Error al Actualizar Detalle", TipoMensaje.MsgError) End If @@ -4163,22 +4215,43 @@ Partial Class Contratos_ContratoObra DVDias.Visible = True DVActividadesRH.Visible = True + DVSubTipoActivoFijo.Visible = False DVClasificacion.Visible = False DVPS.Visible = False DVUM.Visible = False DdlActividades.SelectedValueExist(gvRow.DataKey("CveActividad")) + DdlSubTipoActivoFijo.SelectedValueExist(-1) TxtDias.Text = gvRow.DataKey("Dias") + + ElseIf CveRubro = 4 Then + + + DVDias.Visible = True + DVActividadesRH.Visible = False + DVSubTipoActivoFijo.Visible = True + + + DVClasificacion.Visible = False + DVPS.Visible = False + DVUM.Visible = False + + DdlActividades.SelectedValueExist(-1) + DdlSubTipoActivoFijo.SelectedValueExist(gvRow.DataKey("CveSubTipoActivoFijo")) + TxtDias.Text = gvRow.DataKey("Dias") + Else DVDias.Visible = False DVActividadesRH.Visible = False + DVSubTipoActivoFijo.Visible = False DVClasificacion.Visible = True DVPS.Visible = True DVUM.Visible = True DdlActividades.SelectedValueExist(-1) + DdlSubTipoActivoFijo.SelectedValueExist(-1) TxtDias.Text = "0" End If @@ -4218,18 +4291,22 @@ Partial Class Contratos_ContratoObra UpModalVentasAddPS.Update() End Sub + Private Sub LimpiarModalControl() DdlActividades.Items.Clear() + DdlSubTipoActivoFijo.Items.Clear() + DdlActividades.DataSource = GlobalDTRHActividades(UsuarioActual.CveEmpresa) DdlActividades.DataBind() - DdlActividades.Items.Insert(0, New ListItem("Seleccione una", "-1")) + DdlSubTipoActivoFijo.DataSource = GlobalDTSubTipoActivoFijo(UsuarioActual.CveEmpresa) + DdlSubTipoActivoFijo.DataBind() + DdlSubTipoActivoFijo.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + TxtCantidadInsumos.Text = "" - 'ChkLimitarInsumos.Checked = False - 'TxtNoIdentificacionvInsumos.Text = "" DdlClasificacionAddInsumos.SelectedValueExist(-1) DdlProductowsInsumos.txtText.Value = "" @@ -4238,8 +4315,6 @@ Partial Class Contratos_ContratoObra TxtPUInsumos.Text = "" DdlRubro.SelectedValue = "2" - ' DdlRubro_SelectedIndexChanged(Nothing, Nothing) - DVClasificacion.Visible = True DVPS.Visible = True @@ -4263,7 +4338,33 @@ Partial Class Contratos_ContratoObra End Sub + Private Sub LimpiarModalMaquinaria() + DdlPersonal.Items.Clear() + + + + + DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) + DdlPersonal.DataBind() + DdlPersonal.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + Dim Objcontratos As New ClsContratos + If Objcontratos.GetContratosMaquinariaFlotillaSubTipoAF(CveContrato, UsuarioActual.CveEmpresa) Then + DdlSubTipoAF.DataSource = Objcontratos.DtResultados + End If + Objcontratos.Dispose() + DdlSubTipoAF.DataBind() + DdlSubTipoAF.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + + TxtFechaMaquinaria.Text = "" + + + + UpModalMaquinariaFlotilla.Update() + + End Sub Protected Sub BtnCargaPresupuesto_Click(sender As Object, e As EventArgs) @@ -4287,7 +4388,7 @@ Partial Class Contratos_ContratoObra DTCargaPresupuesto = CargaPreSupuestoExcel("Insumos") DTCargaPresupuestoManoObra = CargaPreSupuestoExcel("ManoObra") - DTCargaPresupuestoFlotillas = CargaPreSupuestoExcel("Flotillas") + DTCargaPresupuestoFlotillas = CargaPreSupuestoExcel("Maquinaria") ProcesaDatosCargaPresupuesto(DTCargaPresupuesto, DTCargaPresupuestoManoObra, DTCargaPresupuestoFlotillas) @@ -4579,6 +4680,7 @@ Partial Class Contratos_ContratoObra Row("Observacion") = "" DTPS.Rows.Add(Row) + Else End If End If @@ -4590,6 +4692,48 @@ Partial Class Contratos_ContratoObra If Not DTCargaPresupuestoFlotillas Is Nothing Then + For Each DrowPS As DataRow In DTCargaPresupuestoFlotillas.Rows + + Dim CveSubTipoActivoFijo As Integer = 0 + Dim SubTipoActivoFijo As String = DrowPS("SubTipoAF").ToString + + CveSubTipoActivoFijo = GlobalDTSubTipoActivoFijo(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubTipoActivoFijo", $" SubTipoActivoFijo = '{DrowPS("SubTipoAF").ToString }'").ToEntero + + If CveSubTipoActivoFijo > 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") = "Maquinaria Flotilla" + Row("CveClasificacion") = -1 + Row("Clasificacion") = "" + Row("CvePS") = -1 + Row("PS") = SubTipoActivoFijo + Row("CodigoPS") = SubTipoActivoFijo + Row("PU") = DrowPS("PU").ToString.ToDouble + Row("Total") = DrowPS("Cantidad").ToString.ToDouble * DrowPS("PU").ToString.ToDouble + + Row("CveTipoPresupuesto") = 1 + Row("CveRubro") = 3 + Row("CveActividad") = -1 + Row("CveSubTipoActivoFijo") = CveSubTipoActivoFijo + Row("Dias") = DrowPS("Horas").ToString.ToEntero + + Row("NoIdentificacion") = "" + Row("OCInterna") = "" + Row("LimitarCantidad") = 0 + Row("Observacion") = "" + + DTPS.Rows.Add(Row) + Else + + End If + + + Next + + End If @@ -4643,6 +4787,7 @@ Partial Class Contratos_ContratoObra NrowTmpDT("Rubro") = Row("Rubro") NrowTmpDT("Actividad") = Row("Actividad") NrowTmpDT("SubTipoActivoFijo") = Row("SubTipoActivoFijo") + NrowTmpDT("Dias") = Row("Dias") NrowTmpDT("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") @@ -4975,13 +5120,28 @@ Partial Class Contratos_ContratoObra Protected Sub DdlRubro_SelectedIndexChanged(sender As Object, e As EventArgs) - If DdlRubro.SelectedValue.ToEntero = 3 Then + If DdlRubro.SelectedValue.ToEntero = 3 Then 'Rubro RH DVDias.Visible = True DVActividadesRH.Visible = True DVClasificacion.Visible = False DVPS.Visible = False DVUM.Visible = False + + DVSubTipoActivoFijo.Visible = False + + + ElseIf DdlRubro.SelectedValue.ToEntero = 4 Then 'Rubro Maquinaria florilla herramienta + + DVDias.Visible = True + DVActividadesRH.Visible = False + + DVClasificacion.Visible = False + DVPS.Visible = False + DVUM.Visible = False + + DVSubTipoActivoFijo.Visible = True + Else DVDias.Visible = False DVActividadesRH.Visible = False @@ -4990,11 +5150,91 @@ Partial Class Contratos_ContratoObra DVPS.Visible = True DVUM.Visible = True + DVSubTipoActivoFijo.Visible = False + End If UpModalControlAddPS.Update() End Sub + + Protected Sub LnkModalAddMaquinariaFlotilla_Click(sender As Object, e As EventArgs) + + LimpiarModalMaquinaria() + RegistraScript("$('#ModalMaquinaria').modal('show');") + + End Sub + + + Protected Sub DdlSubTipoAF_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubTipoAF.SelectedIndexChanged + + DdlAF.Items.Clear() + + If DdlSubTipoAF.SelectedIndex > 0 Then + + + Dim CveSubTipoActivoFijo As Integer = 0 + + Dim Separador As Char() = {"-"c} + + Try + CveSubTipoActivoFijo = DdlSubTipoAF.SelectedValue.Split(Separador)(0).ToEntero + Catch ex As Exception + CveSubTipoActivoFijo = 0 + End Try + + If CveSubTipoActivoFijo > 0 Then + DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa, -1).FiltraParametros(String.Format("CveSubTipoActivoFijo IN ({0})", CveSubTipoActivoFijo)) + End If + + Else + DdlAF.DataSource = Nothing + + End If + + DdlAF.DataBind() + + + + DdlAF.Items.Insert(0, New ListItem("Todos", "-1")) + + UpModalMaquinariaFlotilla.Update() + + End Sub + + + + Protected Sub BtnModalMaquinariaAdd_Click(sender As Object, e As EventArgs) + + + Dim CveContratoDetalle As Integer = 0 + + Dim Separador As Char() = {"-"c} + + Try + CveContratoDetalle = DdlSubTipoAF.SelectedValue.Split(Separador)(1).ToEntero + Catch ex As Exception + CveContratoDetalle = 0 + End Try + + Dim ObjContrato As New ClsContratos + + If ObjContrato.AddContratosMaquinariaFlotilla(DdlAF.SelectedValue.ToEntero, TxtFechaMaquinaria.Text.ToDate, DdlPersonal.SelectedValue.ToEntero, TxtMaquinariaImporte.Text.ToDecimal, CveContratoDetalle) Then + + + If Not ChkModalMaquinaria.Checked Then + RegistraScript("$('#ModalMaquinaria').modal('hide');") + End If + + Alert("Registro agregado correctamente.") + + End If + + ObjContrato.Dispose() + + End Sub + + End Class