Contratos

This commit is contained in:
Rakcsle Supertramp
2020-12-11 20:43:57 -07:00
parent 9c6039c77d
commit 7a0ce67ee5
4 changed files with 376 additions and 165 deletions

View File

@@ -942,7 +942,7 @@
<div class="col-md-12">
<asp:GridView ID="GvInsumos" ClientIDMode="Static" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron Conceptos"
DataKeyNames="CveContratoDetalle,CveUM, CvePS, Cantidad, PU,CveTipoPresupuesto,CveClasificacion,CodigoPS,LimitarCantidad,PS,NoIdentificacion,CantidadContratada" ShowHeader="true" SelectedRowStyle-BackColor="#66CCFF"
DataKeyNames="CveContratoDetalle,CveUM, CvePS, Cantidad, PU,CveTipoPresupuesto,CveClasificacion,CodigoPS,LimitarCantidad,PS,NoIdentificacion,CantidadContratada,Dias,CveRubro,CveActividad,CveSubTipoActivoFijo" ShowHeader="true" SelectedRowStyle-BackColor="#66CCFF"
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None">
<Columns>
@@ -997,6 +997,13 @@
<ItemStyle Width="150px" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Dias" Visible="true">
<ItemTemplate>
<asp:Label ID="LtlDias" CssClass="ltltotalgvx2" Text='<%# Eval("Dias")%>' runat="server"></asp:Label>
</ItemTemplate>
<ItemStyle Width="150px" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Editar" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="LnkEditarPresupuestoControlDetalle" OnClick="LnkEditarPresupuestoControlDetalle_Click" runat="server" AlternateText="Editar" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
@@ -2696,7 +2703,15 @@
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlRubro" runat="server" CssClass="table-group-action-input form-control input-inline input-sm select2me" Style="width: 100%;" AutoPostBack="true" OnSelectedIndexChanged="DdlRubro_SelectedIndexChanged">
<asp:ListItem Value="2">Insumos</asp:ListItem>
<asp:ListItem Value="3">Mano de Obra</asp:ListItem>
<asp:ListItem Value="4">Flotillas</asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlRubro.ClientID.ToString()%>">Rubro:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
@@ -2704,34 +2719,21 @@
<ajax:FilteredTextBoxExtender ID="FETxtCantidadInsumos" runat="server" TargetControlID="TxtCantidadInsumos" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVTxtCantidadInsumos" runat="server" ControlToValidate="TxtCantidadInsumos" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSControl"> </asp:RequiredFieldValidator>
<label for="<%= TxtCantidadInsumos.ClientID.ToString()%>">Cantidad:</label>
</div>
</div>
<%-- <div class="form-group form-md-line-input input-iconright">
<asp:CheckBox ID="ChkLimitarInsumos" runat="server" CssClass="form-control" />
<label for="<%= ChkLimitarInsumos.ClientID.ToString()%>">Limitar:</label>
</div>--%>
<%-- <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtNoIdentificacionvInsumos" runat="server" MaxLength="15" CssClass="form-control" ></asp:TextBox>
<label for="<%= TxtNoIdentificacionvInsumos.ClientID.ToString()%>">Clave Interna:</label>
</div>--%>
<div class="form-group form-md-line-input input-iconright">
<div class="form-group form-md-line-input input-iconright" runat="server" visible="false" id="DVClasificacion" >
<asp:DropDownList ID="DdlClasificacionAddInsumos" runat="server" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" CssClass="table-group-action-input form-control input-inline input-sm select2me" Style="width: 100%;"></asp:DropDownList>
<label for="<%= DdlClasificacionAddInsumos.ClientID.ToString()%>">Clasificación:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<div class="form-group form-md-line-input input-iconright" runat="server" visible="false" id="DVPS" >
<label for="<%= DdlProductowsInsumos.ClientID.ToString()%>">Producto:</label>
<ADS:Dropdownlost runat="server" ID="DdlProductowsInsumos" CssStyle="width: 100%;" CssClassDdl="form-control select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
<ADS:Dropdownlost runat="server" ID="DdlProductowsInsumos" CssStyle="width: 100%;" CssClassDdl="form-control select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
</div>
<div class="form-group form-md-line-input input-iconright">
<div class="form-group form-md-line-input input-iconright" runat="server" visible="false" id="DVUM" >
<asp:DropDownList ID="DdlUMInsumos" runat="server" AutoPostBack="true" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" CssClass="form-control select2me" ></asp:DropDownList>
<label for="<%= DdlUMInsumos.ClientID.ToString()%>">U. M.:</label>
</div>
@@ -2744,10 +2746,28 @@
<label for="<%= TxtPUInsumos.ClientID.ToString()%>">P.U.:</label>
</div>
<div class="form-group form-md-line-input input-iconright" runat="server" id="DVActividadesRH" visible="false" >
<asp:DropDownList ID="DdlActividades" runat="server" DataTextField="Actividad" DataValueField="CveActividad" CssClass="table-group-action-input form-control input-inline input-sm select2me" Style="width: 100%;"></asp:DropDownList>
<label for="<%= DdlActividades.ClientID.ToString()%>">Actividad:</label>
<asp:RequiredFieldValidator ID="RFVDdlActividades" runat="server" ControlToValidate="DdlActividades" InitialValue="-1" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Actividad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSControl"></asp:RequiredFieldValidator>
</div>
<div class="form-group form-md-line-input input-iconright" runat="server" id="DVDias" visible="false">
<asp:TextBox ID="TxtDias" runat="server" CssClass="form-control" ></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilTxtDias" runat="server" TargetControlID="TxtDias" FilterType="Numbers" InvalidChars="-+.," />
<asp:RequiredFieldValidator ID="RFVTxtDias" runat="server" ControlToValidate="TxtDias" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Dias''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSControl" ></asp:RequiredFieldValidator>
<label for="<%= TxtDias.ClientID.ToString()%>">Dias:</label>
</div>
<div class="form-group form-md-line-input input-iconright" style="text-align:right!important">
<asp:CheckBox ID="ChkContinualAgregandoControl" runat="server" TextAlign="Left" Text="Continuar agregando" CssClass="form-control" Checked="true" />
</div>
</div>
<br />
<td id="TD1" runat="server" visible="false"></td>

View File

@@ -1490,10 +1490,14 @@ Partial Class Contratos_ContratoObra
Row("LimitarCantidad") = False 'If(ChkLimitarVenta.Checked, 1, 0)
Row("Observacion") = "" 'TxtObservacionesDetalles.Text
Row("CveRubro") = 1
Dim ObjContratos As New ClsContratos
If ObjContratos.AddContratosDetalle(CveContrato, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, False, "", 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, False, "", Observacion:=Row("Observacion").ToString, CveRubro:=1) Then
If Autorizado Then
Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU"))
@@ -1548,7 +1552,7 @@ Partial Class Contratos_ContratoObra
Dim ObjContratos As New ClsContratos
If ObjContratos.UpdateContratosDetalle(CveContratoDetalleEditar, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, NoIdentificacion, False, "", Observaciones) Then
If ObjContratos.UpdateContratosDetalle(CveContratoDetalleEditar, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, NoIdentificacion, False, "", Observaciones, CveRubro:=1) 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}",
@@ -1809,25 +1813,59 @@ Partial Class Contratos_ContratoObra
Dim Row As DataRow = TmpDT.NewRow()
Row("Cantidad") = TxtCantidadInsumos.Text.ToDouble.FormatoNumero
Row("CantidadContratada") = TxtCantidadInsumos.Text.ToDouble.FormatoNumero
Row("CveUM") = DdlUMInsumos.SelectedValue.ToEntero
Row("UM") = DdlUMInsumos.SelectedItem
Row("CveClasificacion") = DdlClasificacionAddInsumos.SelectedValue
Row("Clasificacion") = DdlClasificacionAddInsumos.SelectedItem
Row("CvePS") = DdlProductowsInsumos.SelectedValue.ToEntero
Row("PS") = DdlProductowsInsumos.SelectedText
Row("CodigoPS") = DdlProductowsInsumos.SelectedText
Row("PU") = TxtPUInsumos.Text.ToDouble.FormatoNumero
Row("Total") = (TxtCantidadInsumos.Text.ToDouble * TxtPUInsumos.Text.ToDouble).FormatoNumero
Row("CveTipoPresupuesto") = 1
Row("NoIdentificacion") = "" 'TxtNoIdentificacionvInsumos.Text.Trim
Row("LimitarCantidad") = False
Row("CveRubro") = DdlRubro.SelectedValue.ToEntero
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
Row("CveSubTipoActivoFijo") = -1
Row("CveUM") = -1
Row("UM") = ""
Row("CveClasificacion") = -1
Row("Clasificacion") = ""
Row("CvePS") = -1
Row("PS") = DdlActividades.SelectedItem.Text
Row("CodigoPS") = DdlActividades.SelectedItem.Text
Else
Row("CveActividad") = -1
Row("Actividad") = ""
Row("CveSubTipoActivoFijo") = -1
Row("Dias") = 0
Row("CveUM") = DdlUMInsumos.SelectedValue.ToEntero
Row("UM") = DdlUMInsumos.SelectedItem
Row("CveClasificacion") = DdlClasificacionAddInsumos.SelectedValue
Row("Clasificacion") = DdlClasificacionAddInsumos.SelectedItem
Row("CvePS") = DdlProductowsInsumos.SelectedValue.ToEntero
Row("PS") = DdlProductowsInsumos.SelectedText
Row("CodigoPS") = DdlProductowsInsumos.SelectedText
End If
Dim ObjContratos As New ClsContratos
If ObjContratos.AddContratosDetalle(CveContrato, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("PU").ToString.ToDouble, UsuarioActual.CveUsuario, Row("CveTipoPresupuesto").ToString.ToEntero, Row("NoIdentificacion").ToString, False, "") Then
If Autorizado Then
Dim msj As String = String.Format("Se agregaron {0} {1} del producto {2} con un precio ${3}.", Row("Cantidad"), Row("UM"), Row("PS"), Row("PU"))
guardarBitacora(msj)
End If
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, False, "",
CveRubro:=Row("CveRubro").ToString.ToEntero, CveActividad:=Row("CveActividad").ToString.ToEntero, CveSubTipoActivoFijo:=Row("CveSubTipoActivoFijo").ToString.ToEntero, Dias:=Row("Dias").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"))
' guardarBitacora(msj)
'End If
Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle")
TmpDT.Rows.Add(Row)
Dim TotalRow = Row("Total").ToString.ToDouble
@@ -1856,22 +1894,34 @@ Partial Class Contratos_ContratoObra
Dim Cantidad, PU As Double
Dim CvePS, CveUM As Integer
'Dim NoIdentificacion As String = ""
'Dim LimitarCantidad As Boolean
Dim CveRubro As Integer = DdlRubro.SelectedValue.ToEntero
Dim CveActividad As Integer = -1
Dim CveSubTipoActivoFijo As Integer = -1
Dim Dias As Integer = 0
If CveRubro = 3 Then
CveActividad = DdlActividades.SelectedValue.ToEntero
Dias = TxtDias.Text.ToEntero
CvePS = -1
CveUM = -1
Else
CvePS = DdlProductowsInsumos.SelectedValue.ToEntero
CveUM = DdlUMInsumos.SelectedValue.ToEntero
End If
Cantidad = TxtCantidadInsumos.Text.ToDouble
PU = TxtPUInsumos.Text.ToDouble
CvePS = DdlProductowsInsumos.SelectedValue.ToEntero
CveUM = DdlUMInsumos.SelectedValue.ToEntero
'NoIdentificacion = TxtNoIdentificacionvInsumos.Text.Trim
'LimitarCantidad = If(ChkLimitarInsumos.Checked, True, False)
Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalleEditar))(0)
Dim ObjContratos As New ClsContratos
If ObjContratos.UpdateContratosDetalle(CveContratoDetalleEditar, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, "", False, "") Then
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}",
@@ -4018,17 +4068,10 @@ Partial Class Contratos_ContratoObra
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
LimpiarModalVentas()
'CveContratoDetalle,CveUM,CvePS,Cantidad,PU,CveTipoPresupuesto,CveClasificacion,CodigoPS,LimitarCantidad
CveContratoDetalleEditar = GvRow.DataKey("CveContratoDetalle").ToEntero
'TxtOCInterna.Text = GvRow.DataKey("OCInterna")
TxtCantidad.Text = GvRow.DataKey("CantidadContratada").ToDouble.ToString
'ChkLimitarVenta.Checked = Boolean.Parse(GvRow.DataKey("LimitarCantidad"))
'TxtNoIdentificacionv.Text = GvRow.DataKey("NoIdentificacion").ToDouble.ToString
DdlClasificacionAdd.SelectedValueExist(GvRow.DataKey("CveClasificacion").ToEntero)
DdlProductows.txtText.Value = GvRow.DataKey("PS").ToString
@@ -4050,14 +4093,17 @@ Partial Class Contratos_ContratoObra
RegistraScript("$('#ModalVentasAddPS').modal('show')")
End Sub
Protected Sub LnkEditarPresupuestoControlDetalle_Click(sender As Object, e As EventArgs)
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim CveRubro As Integer = gvRow.DataKey("CveRubro").ToEntero
LimpiarModalControl()
CveContratoDetalleEditar = gvRow.DataKey("CveContratoDetalle").ToEntero
TxtCantidadInsumos.Text = gvRow.DataKey("CantidadContratada").ToDouble.ToString
'ChkLimitarInsumos.Checked = Boolean.Parse(gvRow.DataKey("LimitarCantidad"))
' TxtNoIdentificacionvInsumos.Text = gvRow.DataKey("NoIdentificacion")
DdlClasificacionAddInsumos.SelectedValueExist(gvRow.DataKey("CveClasificacion").ToEntero)
@@ -4069,16 +4115,42 @@ Partial Class Contratos_ContratoObra
DdlUMInsumos.DataBind()
DdlUMInsumos.SelectedValueExist(gvRow.DataKey("CveUM").ToDouble.ToString)
TxtPUInsumos.Text = gvRow.DataKey("PU").ToDouble.ToString
DdlRubro.SelectedValueExist(gvRow.DataKey("CveRubro").ToString)
If CveRubro = 3 Then
DVDias.Visible = True
DVActividadesRH.Visible = True
DVClasificacion.Visible = False
DVPS.Visible = False
DVUM.Visible = False
DdlActividades.SelectedValueExist(gvRow.DataKey("CveActividad"))
TxtDias.Text = gvRow.DataKey("Dias")
Else
DVDias.Visible = False
DVActividadesRH.Visible = False
DVClasificacion.Visible = True
DVPS.Visible = True
DVUM.Visible = True
DdlActividades.SelectedValueExist(-1)
TxtDias.Text = "0"
End If
ModalControlPSAdd = False
ChkContinualAgregandoControl.Visible = False
ChkContinualAgregandoControl.Checked = False
UpModalControlAddPS.Update()
RegistraScript("$('#ModalControlAddPS').modal('show')")
End Sub
@@ -4108,7 +4180,12 @@ Partial Class Contratos_ContratoObra
End Sub
Private Sub LimpiarModalControl()
DdlActividades.Items.Clear()
DdlActividades.DataSource = GlobalDTRHActividades(UsuarioActual.CveEmpresa)
DdlActividades.DataBind()
DdlActividades.Items.Insert(0, New ListItem("Seleccione una", "-1"))
TxtCantidadInsumos.Text = ""
'ChkLimitarInsumos.Checked = False
@@ -4120,6 +4197,21 @@ Partial Class Contratos_ContratoObra
DdlUMInsumos.SelectedValueExist(-1)
TxtPUInsumos.Text = ""
DdlRubro.SelectedValue = "2"
' DdlRubro_SelectedIndexChanged(Nothing, Nothing)
DVClasificacion.Visible = True
DVPS.Visible = True
DVUM.Visible = True
DVDias.Visible = False
DVActividadesRH.Visible = False
TxtDias.Text = ""
DdlActividades.SelectedValueExist(-1)
If ModalControlPSAdd = True Then
LtlModalControlPSTitulo.Text = "Agregar Producto Presupuesto Control"
@@ -4142,8 +4234,8 @@ Partial Class Contratos_ContratoObra
If TipoCargaPresupuesto = EnumTipoCargaPresupuesto.Ventas Then
DTCargaPresupuesto = CargaPreSupuestoExcel("Presupuesto")
DTCargaPresupuesto = CargaPreSupuestoExcel("Presupuesto")
If DTCargaPresupuesto.Rows.Count > 0 Then
ProcesaDatosCargaPresupuesto(DTCargaPresupuesto, Nothing, Nothing)
@@ -4151,7 +4243,6 @@ Partial Class Contratos_ContratoObra
Alert("No se encintraron partidas en el documento", TipoMensaje.MsgAdvertencia)
End If
Else
DTCargaPresupuesto = CargaPreSupuestoExcel("Insumos")
@@ -4257,6 +4348,7 @@ Partial Class Contratos_ContratoObra
DTCargaPresupuestoFlotillas.CaseSensitive = False
End If
Dim ErrorProceso = False
@@ -4372,7 +4464,8 @@ Partial Class Contratos_ContratoObra
Row("Observacion") = ""
DTPS.Rows.Add(Row)
Else
ErrorProceso = True
End If
Next
@@ -4380,44 +4473,77 @@ Partial Class Contratos_ContratoObra
If Not DTCargaPresupuestoManoObra Is Nothing Then
If Not DTCargaPresupuestoManoObra Is Nothing And Not ErrorProceso Then
For Each DrowPS As DataRow In DTCargaPresupuestoManoObra.Rows
Dim CveActividad As Integer = 0
Dim Actividad As String
CveActividad = GlobalDTRHActividades(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveActividad", $" Actividad = '{ DrowPS("Actividad").ToString.Trim }'").ToEntero
If CveActividad > 0 And DrowPS("Cantidad").ToString.ToDouble > 0 Then
If DrowPS("Actividad").ToString.Trim.Length > 0 Then
GlobalDTRHActividades(UsuarioActual.CveEmpresa) = Nothing
CveActividad = GlobalDTRHActividades(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveActividad", $" Actividad = '{ DrowPS("Actividad").ToString.Trim }'").ToEntero
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
If CveActividad <= 0 Then
Row("CveTipoPresupuesto") = 2
Row("CveRubro") = 3
Row("CveActividad") = CveActividad
Row("CveSubTipoActivoFijo") = -1
Row("Dias") = DrowPS("Dias").ToString.ToEntero
Row("NoIdentificacion") = ""
Row("OCInterna") = ""
Row("LimitarCantidad") = 0
Row("Observacion") = ""
Dim ObjRH As New ClsRH()
DTPS.Rows.Add(Row)
If ObjRH.AddActividades(DrowPS("Actividad").ToString.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
CveActividad = ObjRH.CveActividad
If CveActividad <= 0 Then
ErrorProceso = True
End If
GlobalDTRHActividades(UsuarioActual.CveEmpresa) = Nothing
Else
ErrorProceso = True
End If
ObjRH.Dispose()
End If
If CveActividad > 0 And DrowPS("Cantidad").ToString.ToDouble > 0 And Not ErrorProceso Then
Actividad = GlobalDTRHActividades(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Actividad", $" CveActividad = {CveActividad}")
Dim Row As DataRow = DTPS.NewRow()
Row("Cantidad") = DrowPS("Cantidad").ToString.ToDouble
Row("CantidadContratada") = DrowPS("Cantidad").ToString.ToDouble
Row("CveUM") = -1
Row("UM") = "Actividad RH"
Row("CveClasificacion") = -1
Row("Clasificacion") = ""
Row("CvePS") = -1
Row("PS") = Actividad
Row("CodigoPS") = Actividad
Row("PU") = DrowPS("PU").ToString.ToDouble
Row("Total") = DrowPS("Cantidad").ToString.ToDouble * DrowPS("PU").ToString.ToDouble
Row("CveTipoPresupuesto") = 1
Row("CveRubro") = 3
Row("CveActividad") = CveActividad
Row("CveSubTipoActivoFijo") = -1
Row("Dias") = DrowPS("Dias").ToString.ToEntero
Row("NoIdentificacion") = ""
Row("OCInterna") = ""
Row("LimitarCantidad") = 0
Row("Observacion") = ""
DTPS.Rows.Add(Row)
End If
End If
Next
End If
@@ -4426,101 +4552,114 @@ Partial Class Contratos_ContratoObra
End If
Dim ErrorProceso = False
Dim ObjContratos As New ClsContratos
Dim TotalRow As Double = 0
ObjContratos.IniciaTransacSQL()
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, CveRubro:=Row("CveRubro").ToString.ToEntero,
CveActividad:=Row("CveActividad").ToString.ToEntero, CveSubTipoActivoFijo:=Row("CveSubTipoActivoFijo").ToString.ToEntero, Dias:=Row("Dias").ToString.ToEntero) Then
If Not ErrorProceso Then
If Autorizado Then
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)
Dim ObjContratos As New ClsContratos
Dim TotalRow As Double = 0
ObjContratos.IniciaTransacSQL()
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, CveRubro:=Row("CveRubro").ToString.ToEntero,
CveActividad:=Row("CveActividad").ToString.ToEntero, CveSubTipoActivoFijo:=Row("CveSubTipoActivoFijo").ToString.ToEntero, Dias:=Row("Dias").ToString.ToEntero) Then
If Autorizado Then
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
Dim NrowTmpDT As DataRow = TmpDT.NewRow
NrowTmpDT("Cantidad") = Row("Cantidad")
NrowTmpDT("CantidadContratada") = Row("CantidadContratada")
NrowTmpDT("CveUM") = Row("CveUM")
NrowTmpDT("UM") = Row("UM")
NrowTmpDT("CveClasificacion") = Row("CveClasificacion")
NrowTmpDT("Clasificacion") = Row("Clasificacion")
NrowTmpDT("CvePS") = Row("CvePS")
NrowTmpDT("PS") = Row("PS")
NrowTmpDT("CodigoPS") = Row("CodigoPS")
NrowTmpDT("PU") = Row("PU")
NrowTmpDT("Total") = Row("Total")
NrowTmpDT("CveTipoPresupuesto") = Row("CveTipoPresupuesto")
NrowTmpDT("NoIdentificacion") = Row("NoIdentificacion")
NrowTmpDT("OCInterna") = Row("OCInterna")
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")
TmpDT.Rows.Add(NrowTmpDT)
TmpDT.AcceptChanges()
TotalRow = TotalRow + NrowTmpDT("Total").ToString.ToDouble
Else
ErrorProceso = True
Exit For
End If
Dim NrowTmpDT As DataRow = TmpDT.NewRow
Next
NrowTmpDT("Cantidad") = Row("Cantidad")
NrowTmpDT("CantidadContratada") = Row("CantidadContratada")
NrowTmpDT("CveUM") = Row("CveUM")
NrowTmpDT("UM") = Row("UM")
NrowTmpDT("CveClasificacion") = Row("CveClasificacion")
NrowTmpDT("Clasificacion") = Row("Clasificacion")
NrowTmpDT("CvePS") = Row("CvePS")
NrowTmpDT("PS") = Row("PS")
NrowTmpDT("CodigoPS") = Row("CodigoPS")
NrowTmpDT("PU") = Row("PU")
NrowTmpDT("Total") = Row("Total")
NrowTmpDT("CveTipoPresupuesto") = Row("CveTipoPresupuesto")
NrowTmpDT("NoIdentificacion") = Row("NoIdentificacion")
NrowTmpDT("OCInterna") = Row("OCInterna")
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")
TmpDT.Rows.Add(NrowTmpDT)
TmpDT.AcceptChanges()
TotalRow = TotalRow + NrowTmpDT("Total").ToString.ToDouble
If ErrorProceso Then
ObjContratos.RollBack()
Alert("Se presento un error al cargar el presupuesto.", TipoMensaje.MsgError)
Else
ErrorProceso = True
Exit For
ObjContratos.Commit()
Alert("Presupuesto Cargado correctamente")
Select Case TipoCargaPresupuesto
Case EnumTipoCargaPresupuesto.Ventas
CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2"))
UpGV.Update()
Exit Select
Case EnumTipoCargaPresupuesto.Control
CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1"))
UpGVInsumos.Update()
Exit Select
Case Else
End Select
LbTotalGeneral.Text = (LbTotalGeneral.Text.ToDouble + TotalRow).ToString.FormatoNumero
LblImporte.Text = LbTotalGeneral.Text
UpGral.Update()
End If
Next
ObjContratos.Dispose()
If ErrorProceso Then
ObjContratos.RollBack()
Alert("Se presento un error al cargar el presupuesto.", TipoMensaje.MsgError)
Else
ObjContratos.Commit()
Alert("Presupuesto Cargado correctamente")
Select Case TipoCargaPresupuesto
Case EnumTipoCargaPresupuesto.Ventas
CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2"))
UpGV.Update()
Exit Select
Case EnumTipoCargaPresupuesto.Control
CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1"))
UpGVInsumos.Update()
Exit Select
Case Else
End Select
LbTotalGeneral.Text = (LbTotalGeneral.Text.ToDouble + TotalRow).ToString.FormatoNumero
LblImporte.Text = LbTotalGeneral.Text
UpGral.Update()
End If
ObjContratos.Dispose()
If RowNoEncontrados.Length > 0 Then
Alert($"Productos no encontrados <br> {RowNoEncontrados} ")
End If
End Sub
@@ -4784,10 +4923,6 @@ Partial Class Contratos_ContratoObra
End Try
DVGraficas.Visible = True
UpGrafica.Update()
@@ -4797,6 +4932,29 @@ Partial Class Contratos_ContratoObra
Protected Sub DdlRubro_SelectedIndexChanged(sender As Object, e As EventArgs)
If DdlRubro.SelectedValue.ToEntero = 3 Then
DVDias.Visible = True
DVActividadesRH.Visible = True
DVClasificacion.Visible = False
DVPS.Visible = False
DVUM.Visible = False
Else
DVDias.Visible = False
DVActividadesRH.Visible = False
DVClasificacion.Visible = True
DVPS.Visible = True
DVUM.Visible = True
End If
UpModalControlAddPS.Update()
End Sub
End Class