This commit is contained in:
rakcsle
2021-07-20 08:43:52 -07:00
11 changed files with 336 additions and 261 deletions

View File

@@ -1503,7 +1503,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, Optional CveAlmacenes As String = "-1") As Boolean
Optional Orden As Integer = -1, Optional Marcas As String = "-1", Optional IncluyeProyectado As Integer = -1, Optional CveAlmacenes As String = "-1", Optional GPO As Integer = 1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_KardexAlmacenHorizontalGet")
@@ -1525,46 +1525,8 @@ Public Class ClsInventarios
.Add("@Marcas", SqlDbType.VarChar).Value = Marcas
.Add("@IncluyeProyectado", SqlDbType.TinyInt).Value = IncluyeProyectado
.Add("@CveAlmacenes", SqlDbType.NVarChar).Value = CveAlmacenes
End With
.Add("@GPO", SqlDbType.Int).Value = GPO
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch Ex1 As SqlException
Me.OnError("Ocurrió un error al obtener el kardex de almacen.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
Catch ex As Exception
OnError("Ocurrió un error al obtener el kardex de almacen.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetKardexAlmacenHorizontalAgrupado(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, Optional CveAlmacenes As String = "-1") As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_KardexAlmacenHorizontalGetAgrupado")
With SqlAdapter.SelectCommand.Parameters
'.Add("@FechaI", SqlDbType.VarChar).Value = FechaI
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
.Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida
.Add("@IncluyeTransitorios", SqlDbType.Int).Value = IncluyeTransitorios
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveProveedorCompra", SqlDbType.Int).Value = CveProveedor
.Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen
.Add("@ExistenciasCondicion", SqlDbType.Int).Value = CondicionExistencias
.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

View File

@@ -5400,12 +5400,16 @@
</div>
</div>
<br />
<div class="row col-md-12" align="right" runat="server" id="divBusqueda" visible="false">
<input type="text" id="TxtBusqueda3" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda3','{0}');", GvContratosControl.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda3','{0}');", GvContratosControl.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvContratosControl" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron partidas"
DataKeyNames="CveContratoDetalle,CvePS,PS,Cantidad,PU,CantidadMax,CveUnidadMedida,Abreviatura,CveSubProyecto,SubProyecto,Codigo,CveProyecto,Proyecto,IVA,RetISR,RetIVA,IEPSPorcentaje,IEPSGrabaIVA,CveClasificacion,Clasificacion"
CssClass="table GVEstimacion table-advance table-hover" GridLines="None" Width="100%">
CssClass="table GVEstimacion table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None" Width="100%">
<Columns>
<asp:TemplateField HeaderText="Producto">
@@ -5439,6 +5443,9 @@
</div>
</div>
<div class="row 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" Visible="false"/>
</div>

View File

@@ -18146,46 +18146,86 @@ Partial Class Compras_Compras
End If
ActualizaTotales = True
Select Case Modalidad
Case "A" 'ADD
Dim SATClavePS = -1
Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If PSRow IsNot Nothing Then
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
End If
Dim IVA As Double
If chkImportacion.Checked Then
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble))
Dim ObjContratos As New ClsContratos
Dim TieneError As Boolean = False
Dim Mensaje As String = ""
Dim dttemp As DataTable = GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then
Dim drContrato As DataRow = dttemp.Rows(0)
If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then
Dim dtContratodetalle As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlPS.SelectedValue.ToString))
If dtContratodetalle IsNot Nothing AndAlso dtContratodetalle.Rows.Count > 0 Then
Dim drContratoDetalle As DataRow = dtContratodetalle(0)
If Convert.ToBoolean(drContratoDetalle("LimitarCantidad")) Then
If ObjContratos.GetReporteContratosAvancesDetalleControl(drContrato("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
Dim dtContratodetalleControl As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlPS.SelectedValue.ToString))
If dtContratodetalleControl IsNot Nothing AndAlso dtContratodetalleControl.Rows.Count > 0 Then
Dim drContratoDetalleControl As DataRow = dtContratodetalleControl(0)
If TxtCantidad.Text.Trim.ToDouble > drContratoDetalleControl("FaltanteCantidad").ToString.ToDouble Then
Mensaje = String.Format("La cantidad del Producto/Servicio debe ser menor o igual a {0}", drContratoDetalleControl("FaltanteCantidad").ToString)
TieneError = True
End If
Else
Mensaje = "Este producto no pertence al contrato seleccionado"
TieneError = True
End If
Else
Mensaje = "Error al consultar el contrato"
End If
End If
Else
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)
Mensaje = "Este producto no pertence al contrato seleccionado"
TieneError = True
End If
AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero,
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA,
TxtRetIVAModal.Text.ToDouble / 100, TxtRetISRModal.Text.ToDouble / 100, TxtIEPSModal.Text.ToDouble / 100, 0, TxtDescuentoModal.Text.ToDouble, OtrosGastos:=TxtOtrosGastos.Text.ToDouble, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text,
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS)
Else
Mensaje = "Error al consultar el contrato"
AddPS2()
LimpiaAgregar()
End If
End If
If Not TieneError Then
Select Case Modalidad
Case "A" 'ADD
If ChkAgregar.Checked = True And Modalidad = "A" Then
RegistraScript("displayToastr(1);", "display")
Else
Dim SATClavePS = -1
Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If PSRow IsNot Nothing Then
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
End If
Dim IVA As Double
If chkImportacion.Checked Then
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble))
Else
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)
End If
AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero,
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA,
TxtRetIVAModal.Text.ToDouble / 100, TxtRetISRModal.Text.ToDouble / 100, TxtIEPSModal.Text.ToDouble / 100, 0, TxtDescuentoModal.Text.ToDouble, OtrosGastos:=TxtOtrosGastos.Text.ToDouble, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text,
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS)
AddPS2()
LimpiaAgregar()
If ChkAgregar.Checked = True And Modalidad = "A" Then
RegistraScript("displayToastr(1);", "display")
Else
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
End If
Case "U" 'UPDATE
UpdatePS()
Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion)
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
End If
End Select
ActualizaTotales = False
Case "U" 'UPDATE
UpdatePS()
Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion)
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
End Select
ActualizaTotales = False
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
If UsuarioActual.Empresa.UsaAC Then
CompruebaAgregar()
GuardaAC()
If UsuarioActual.Empresa.UsaAC Then
CompruebaAgregar()
GuardaAC()
End If
Else
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
End If
'If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
@@ -20808,9 +20848,17 @@ Partial Class Compras_Compras
If ObjContratos.DtResultados.Rows.Count > 0 Then
GvContratosControl.DataSource = ObjContratos.DtResultados
BtnAplicarContrato.Visible = True
divBusqueda.Visible = True
ChkContinualAgregandoControl.Visible = True
ChkContinualAgregandoControl.Checked = True
Else
GvContratosControl.DataSource = Nothing
BtnAplicarContrato.Visible = False
divBusqueda.Visible = False
ChkContinualAgregandoControl.Visible = False
ChkContinualAgregandoControl.Checked = False
End If
End If
@@ -20885,11 +20933,9 @@ Partial Class Compras_Compras
Next
AddPS2()
RegistraScript("$('#DivmodalConmtrato').modal('hide')")
If Not ChkContinualAgregandoControl.Checked Then
RegistraScript("$('#DivmodalConmtrato').modal('hide')")
End If
End Sub

View File

@@ -1046,21 +1046,26 @@
<ItemStyle Width="150px" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Dias" Visible="true">
<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="Limitar Cantidad" Visible="true">
<ItemTemplate>
<asp:Label ID="LtlLimitarCantidad" CssClass="ltltotalgvx2" Text='<%# Eval("LimitarCantidad")%>' 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>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red"
@@ -2869,6 +2874,11 @@
<asp:RequiredFieldValidator ID="RFVPU" runat="server" ControlToValidate="TxtPU" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''P.U.''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSVentas"></asp:RequiredFieldValidator>
<label for="<%= TxtPU.ClientID.ToString()%>">P.U.:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:CheckBox id="ChkLimitarCantidadAdd" runat="server" Checked="true"/>
<label for="<%= ChkLimitarCantidadAdd.ClientID.ToString()%>"> Limitar Cantidad</label>
</div>
<div class="form-group form-md-line-input input-iconright" style="text-align:right!important">
@@ -2892,7 +2902,7 @@
<%--MODAL CONTROL PRESUPUESTOS AGREGAR--%>
<div id="ModalControlAddPS" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 450px;">
<div class="modal-dialog" style="width: 500px;">
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModalControlAddPS" UpdateMode="Conditional">
<ContentTemplate>
@@ -2946,36 +2956,29 @@
<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="DVSubTipoActivoFijo" visible="false" >
<asp:DropDownList ID="DdlSubTipoActivoFijo" runat="server" DataTextField="SubTipoActivoFijo" DataValueField="CveSubTipoActivoFijo" CssClass="table-group-action-input form-control input-inline input-sm select2me" Style="width: 100%;"></asp:DropDownList>
<label for="<%= DdlSubTipoActivoFijo.ClientID.ToString()%>">Sub Tipo Activo Fijo:</label>
<asp:RequiredFieldValidator ID="RfvDdlSubTipoActivoFijo" runat="server" ControlToValidate="DdlActividades" InitialValue="-1" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Sub Tipo Activo Fijo''</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="DVSubTipoActivoFijo" visible="false" >
<asp:DropDownList ID="DdlSubTipoActivoFijo" runat="server" DataTextField="SubTipoActivoFijo" DataValueField="CveSubTipoActivoFijo" CssClass="table-group-action-input form-control input-inline input-sm select2me" Style="width: 100%;"></asp:DropDownList>
<label for="<%= DdlSubTipoActivoFijo.ClientID.ToString()%>">Sub Tipo Activo Fijo:</label>
<asp:RequiredFieldValidator ID="RfvDdlSubTipoActivoFijo" runat="server" ControlToValidate="DdlActividades" InitialValue="-1" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Sub Tipo Activo Fijo''</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>
<div class="form-group form-md-line-input input-iconright">
<asp:CheckBox id="ChkLimitarCantidad" runat="server" Checked="true"/>
<label for="<%= ChkLimitarCantidad.ClientID.ToString()%>"> Limitar Cantidad</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>

View File

@@ -1498,7 +1498,7 @@ Partial Class Contratos_ContratoObra
Row("CveTipoPresupuesto") = 2
Row("NoIdentificacion") = "" 'TxtNoIdentificacionv.Text.Trim
Row("OCInterna") = "" 'TxtOCInterna.Text.Trim
Row("LimitarCantidad") = False 'If(ChkLimitarVenta.Checked, 1, 0)
Row("LimitarCantidad") = ChkLimitarCantidadAdd.Checked 'If(ChkLimitarVenta.Checked, 1, 0)
Row("Observacion") = "" 'TxtObservacionesDetalles.Text
Row("CveRubro") = 1
@@ -1508,7 +1508,7 @@ Partial Class Contratos_ContratoObra
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, CveRubro:=1) 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")), "", 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"))
@@ -1557,13 +1557,15 @@ Partial Class Contratos_ContratoObra
'OCInterna = TxtOCInterna.Text.Trim
'LimitarCantidad = If(ChkLimitarVenta.Checked, True, False)
Observaciones = ""
Dim limitarCantidad As Boolean = ChkLimitarCantidad.Checked
Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalleEditar))(0)
Dim LimitarCantidadValidator As Boolean = row("LimitarCantidad").ToString = "True"
Dim ObjContratos As New ClsContratos
If ObjContratos.UpdateContratosDetalle(CveContratoDetalleEditar, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, NoIdentificacion, False, "", Observaciones, CveRubro:=1) Then
If ObjContratos.UpdateContratosDetalle(CveContratoDetalleEditar, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, NoIdentificacion, limitarCantidad, "", 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}",
@@ -1579,7 +1581,7 @@ Partial Class Contratos_ContratoObra
row("UM") = DdlUM.SelectedItem.Text
row("NoIdentificacion") = NoIdentificacion
row("OCInterna") = ""
row("LimitarCantidad") = False
row("LimitarCantidad") = limitarCantidad
row("Observacion") = Observaciones
TmpDT.AcceptChanges()
@@ -1591,15 +1593,13 @@ Partial Class Contratos_ContratoObra
ObjContratos.Dispose()
Gv.EditIndex = -1
LbTotalGeneral.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=2").SUM("Total").FormatoNumero
LblImporte.Text = LbTotalGeneral.Text
CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2"))
End If
CveContratoDetalleEditar = -1
End Sub
Private Sub CargaDatosPresup()
@@ -1850,7 +1850,7 @@ Partial Class Contratos_ContratoObra
Row("Total") = (TxtCantidadInsumos.Text.ToDouble * TxtPUInsumos.Text.ToDouble).FormatoNumero
Row("CveTipoPresupuesto") = 1
Row("NoIdentificacion") = "" 'TxtNoIdentificacionvInsumos.Text.Trim
Row("LimitarCantidad") = False
Row("LimitarCantidad") = ChkLimitarCantidad.Checked
Row("CveRubro") = DdlRubro.SelectedValue.ToEntero
Row("Rubro") = DdlRubro.SelectedItem.Text
@@ -1909,7 +1909,7 @@ Partial Class Contratos_ContratoObra
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, "",
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")), "",
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"))
@@ -1977,12 +1977,14 @@ Partial Class Contratos_ContratoObra
Cantidad = TxtCantidadInsumos.Text.ToDouble
PU = TxtPUInsumos.Text.ToDouble
Dim limitarCantidad As Boolean = ChkLimitarCantidad.Checked
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, "", CveRubro:=CveRubro, CveActividad:=CveActividad, CveSubTipoActivoFijo:=CveSubTipoActivoFijo, Dias:=Dias) Then
If ObjContratos.UpdateContratosDetalle(CveContratoDetalleEditar, CveContrato, CvePS, Cantidad, PU, UsuarioActual.CveUsuario, "", limitarCantidad, "", 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}",
@@ -1999,7 +2001,7 @@ Partial Class Contratos_ContratoObra
row("CveUM") = CveUM
row("NoIdentificacion") = "" 'NoIdentificacion
row("LimitarCantidad") = False
row("LimitarCantidad") = limitarCantidad
row("CveActividad") = CveActividad
row("CveSubTipoActivoFijo") = CveSubTipoActivoFijo
@@ -2028,10 +2030,10 @@ Partial Class Contratos_ContratoObra
End If
ObjContratos.Dispose()
GvInsumos.EditIndex = -1
LbTotalGeneralInsumos.Text = TmpDT.FiltraParametros("CveTipoPresupuesto=1").SUM("Total").FormatoNumero
CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1"))
CveContratoDetalleEditar = -1
End If
@@ -2067,9 +2069,14 @@ Partial Class Contratos_ContratoObra
'e.Row.FCLinkButton("imgE").Visible = False
'e.Row.FCLinkButton("imgD").Visible = False
End If
End If
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
If e.Row.FCLabel("LtlLimitarCantidad").Text.ToString = "True" Then
e.Row.FCLabel("LtlLimitarCantidad").Text = "Si"
Else
e.Row.FCLabel("LtlLimitarCantidad").Text = "No"
End If
End If
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlUMEdit").DataBind()
e.Row.FCDropDownList("DdlUMEdit").SelectedValue = e.Row.DataKey("CveUM")
@@ -4200,7 +4207,7 @@ Partial Class Contratos_ContratoObra
End Sub
Protected Sub LnkModalAddPSVentas_Click(sender As Object, e As EventArgs)
CveContratoDetalleEditar = -1
ModalVentasPSAdd = True
ChkContinualAgregandoVentas.Visible = True
ChkContinualAgregandoVentas.Checked = True
@@ -4210,7 +4217,7 @@ Partial Class Contratos_ContratoObra
End Sub
Protected Sub LnkModalAddPSControl_Click(sender As Object, e As EventArgs)
CveContratoDetalleEditar = -1
ModalControlPSAdd = True
ChkContinualAgregandoControl.Visible = True
ChkContinualAgregandoControl.Checked = True
@@ -4264,8 +4271,7 @@ Partial Class Contratos_ContratoObra
DdlClasificacionAddInsumos.SelectedValueExist(gvRow.DataKey("CveClasificacion").ToEntero)
DdlProductowsInsumos.txtText.Value = gvRow.DataKey("PS").ToString
DdlProductowsInsumos.txtValue.Value = gvRow.DataKey("CvePS").ToString
DdlProductowsInsumos.ddl.SelectedValueExist(gvRow.DataKey("CvePS").ToString.ToEntero)
DdlUMInsumos.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductowsInsumos.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa)
@@ -4273,6 +4279,8 @@ Partial Class Contratos_ContratoObra
DdlUMInsumos.SelectedValueExist(gvRow.DataKey("CveUM").ToDouble.ToString)
TxtPUInsumos.Text = gvRow.DataKey("PU").ToDouble.ToString
Dim limitarCantidad As String = gvRow.DataKey("LimitarCantidad").ToString
ChkLimitarCantidad.Checked = limitarCantidad = "True"
DdlRubro.SelectedValueExist(gvRow.DataKey("CveRubro").ToString)
@@ -4344,6 +4352,7 @@ Partial Class Contratos_ContratoObra
DdlProductows.txtValue.Value = ""
DdlUM.SelectedValueExist(-1)
TxtPU.Text = ""
ChkLimitarCantidad.Checked = False
If ModalVentasPSAdd = True Then

View File

@@ -349,7 +349,10 @@
</div>
</div>
<br />
<div class="row col-md-12" align="right" id="DivBuscador" runat="server">
<div class="row col-md-4" align="left" id="divRegistrados" runat="server">
<asp:Label runat="server">Número de registros: <b><asp:Literal ID="LtlTotalRegistros" runat="server"></asp:Literal></b></asp:Label>
</div>
<div class="row col-md-8" align="right" id="DivBuscador" runat="server">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="return Filtrar(event);" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvIFD.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
<div style="display: inline-block;" id="SumFiltra"></div>

View File

@@ -139,6 +139,7 @@ Partial Class Inventarios_InventarioFisicoDetalle
LBAvance.Visible = UsuarioActual.TienePermisoProceso(178) ' si tiene permiso de ver el avance, se activa
End Select
GvIFD.Visible = False
divRegistrados.Visible = False
DivBuscador.Visible = False
If ObjInventario.GetInventarioFisicoDetallesAlmacen(CveInventarioFisico, UsuarioActual.CveEmpresa) Then
@@ -250,7 +251,9 @@ Partial Class Inventarios_InventarioFisicoDetalle
Protected Sub BtnVerRegistrados_Click(sender As Object, e As EventArgs)
GvIFD.Visible = True
DivBuscador.Visible = True
DivBuscador.Visible = True
divRegistrados.Visible = True
Dim Inventario As New ClsInventarios
If Inventario.GetInventarioFisicoDetalle(CveInventarioFisico, ddlUsuario.SelectedValue.ToString.ToEntero) Then
If Inventario.DtResultados.Rows.Count > 0 Then
@@ -263,6 +266,7 @@ Partial Class Inventarios_InventarioFisicoDetalle
GvIFD.DataSource = Nothing
End If
' DtDatos = Inventario.DtResultados
LtlTotalRegistros.Text = Inventario.DtResultados.Rows.Count
End If
Inventario.Dispose()
GvIFD.DataBind()
@@ -456,7 +460,9 @@ Partial Class Inventarios_InventarioFisicoDetalle
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
End If
GvIFD.Visible = False
DivBuscador.Visible = False
DivBuscador.Visible = False
divRegistrados.Visible = False
UPPInventario.Update()
End Sub

View File

@@ -141,12 +141,19 @@
</div>
</div>
<label class="col-md-1 truncate">Producto:</label>
<div class="col-md-2">
<div class="col-md-1">
<asp:DropDownList ID="DdlExistencia" runat="server" CssClass="select2me" Width="100%" CssStyle="width: 100%;">
<asp:ListItem Text="Con existencia" Value="2" />
<asp:ListItem Text="Sin existencia" Value="3" />
</asp:DropDownList>
</div>
<label class="col-md-1 truncate">Ver por:</label>
<div class="col-md-1">
<asp:DropDownList ID="Ddlgrupo" runat="server" CssClass="select2me" Width="100%" CssStyle="width: 100%;">
<asp:ListItem Text="Almacenes" Value="1" />
<asp:ListItem Text="Sucursales" Value="2" />
</asp:DropDownList>
</div>
</div>
</div>
</div>
@@ -216,10 +223,6 @@
<asp:ListItem Text="No" Value="0" Selected="True" />
</asp:DropDownList>
</div>
<div class="col-md-1"><span>Ver por SubProyecto:</span></div>
<div class="col-md-1">
<asp:CheckBox runat="server" ID="chkAgruparSubProyecto"/>
</div>
</asp:Panel>
</div>
</div>

View File

@@ -139,60 +139,46 @@ Partial Class Inventarios_KardexAlmacen
Dim CveAlmacenes As String = ddlAlmacen.GetSelectedValues()
Dim CveProveedorCompra As Integer = If(DdlProveedor.SelectedValue.ToEntero > 0, DdlProveedor.SelectedValue.ToEntero, -1)
Dim Marcas As String = If(DdlMarca.GetSelectedValuesM = "", "-1", DdlMarca.GetSelectedValuesM)
Dim dtMovs As DataTable = Nothing
Dim GPO As Integer = Ddlgrupo.SelectedValue.ToEntero
If chkAgruparSubProyecto.Checked Then
If ObjMovimientos.GetKardexAlmacenHorizontalAgrupado(CvePS, FechaF, -1, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), DdlIncluyeTransitorios.SelectedValue.ToEntero(), DdlClasificacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CondicionExistencias:=DdlExistencia.SelectedValue, Orden:=DdlOrden.SelectedValue.ToEntero(), Marcas:=Marcas, IncluyeProyectado:=DdlProyeccionFiltro.SelectedValue.ToEntero, CveAlmacenes:=CveAlmacenes) Then
If ObjMovimientos.DtResultados IsNot Nothing AndAlso ObjMovimientos.DtResultados.Rows.Count > 0 Then
dt = ObjMovimientos.DtResultados
End If
Else
ObjMovimientos.Dispose()
Alert("Ocurrió un error al consultar el Kardex.", TipoMensaje.MsgError)
Exit Sub
If ObjMovimientos.GetKardexAlmacenHorizontal(CvePS, FechaF, -1, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), DdlIncluyeTransitorios.SelectedValue.ToEntero(),
DdlClasificacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CondicionExistencias:=DdlExistencia.SelectedValue,
Orden:=DdlOrden.SelectedValue.ToEntero(), Marcas:=Marcas, IncluyeProyectado:=DdlProyeccionFiltro.SelectedValue.ToEntero, CveAlmacenes:=CveAlmacenes, GPO:=GPO) Then
If ObjMovimientos.DtResultados IsNot Nothing AndAlso ObjMovimientos.DtResultados.Rows.Count > 0 Then
dt = ObjMovimientos.DtResultados
Dim ListaBorrar As New List(Of DataColumn)
For index = 3 To dt.Columns.Count - 1
Dim TotColumna As Double = 0
For Each Dr As DataRow In dt.Rows
TotColumna += Dr.Item(index).ToString.ToDouble
Next
'If Not TotColumna > 0 Then
' ListaBorrar.Add(dt.Columns(index))
'End If
Next
For Each item As DataColumn In ListaBorrar
dt.Columns().Remove(item)
Next
dt.AcceptChanges()
GvDatos.DataSource = dt
Else
Alert("La búsqueda no contiene resultados.", TipoMensaje.MsgAdvertencia)
GvDatos.Columns.Clear()
dt = Nothing
Exit Sub
End If
Else
If ObjMovimientos.GetKardexAlmacenHorizontal(CvePS, FechaF, -1, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), DdlIncluyeTransitorios.SelectedValue.ToEntero(), DdlClasificacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CondicionExistencias:=DdlExistencia.SelectedValue, Orden:=DdlOrden.SelectedValue.ToEntero(), Marcas:=Marcas, IncluyeProyectado:=DdlProyeccionFiltro.SelectedValue.ToEntero, CveAlmacenes:=CveAlmacenes) Then
If ObjMovimientos.DtResultados IsNot Nothing AndAlso ObjMovimientos.DtResultados.Rows.Count > 0 Then
dt = ObjMovimientos.DtResultados
End If
Else
ObjMovimientos.Dispose()
Alert("Ocurrió un error al consultar el Kardex.", TipoMensaje.MsgError)
Exit Sub
End If
End If
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
Dim ListaBorrar As New List(Of DataColumn)
For index = 3 To dt.Columns.Count - 1
Dim TotColumna As Double = 0
For Each Dr As DataRow In dt.Rows
TotColumna += Dr.Item(index).ToString.ToDouble
Next
'If Not TotColumna > 0 Then
' ListaBorrar.Add(dt.Columns(index))
'End If
Next
For Each item As DataColumn In ListaBorrar
dt.Columns().Remove(item)
Next
dt.AcceptChanges()
GvDatos.DataSource = dt
GvDatos.DataBind()
Else
Alert("La búsqueda no contiene resultados.", TipoMensaje.MsgAdvertencia)
GvDatos.Columns.Clear()
dt = Nothing
Exit Sub
ObjMovimientos.Dispose()
Alert("Ocurrió un error al consultar el Kardex.", TipoMensaje.MsgError)
Exit Sub
End If
GvDatos.DataBind()
For index = 4 To GvDatos.Rows(0).Cells.Count - 1
GvDatos.HeaderRow.Cells(index).Text = GvDatos.HeaderRow.Cells(index).Text.Split("|")(0)
Next
ObjMovimientos.Dispose()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound

View File

@@ -2747,33 +2747,33 @@
</div>
</div>
<br />
<div class="row col-md-12" align="right" runat="server" id="divBusqueda" visible="false">
<input type="text" id="TxtBusqueda3" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda3','{0}');", GvContratosControl.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda3','{0}');", GvContratosControl.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvContratosControl" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron partidas"
DataKeyNames="CveContratoDetalle,CvePS,PS,Cantidad,PU,CantidadMax,CveUnidadMedida,Abreviatura,CveSubProyecto,SubProyecto,Codigo,CveProyecto,Proyecto,IVA,RetISR,RetIVA,IEPSPorcentaje,IEPSGrabaIVA,CveClasificacion,Clasificacion"
CssClass="table GVEstimacion table-advance table-hover" GridLines="None" Width="100%">
CssClass="table GVEstimacion table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None" Width="100%">
<Columns>
<asp:TemplateField HeaderText="Producto">
<ItemTemplate>
<asp:Label ID="LblPS" runat="server" CssClass="Texto" Text='<%# Eval("PS")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cant. Max" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<span><%# Eval("CantidadMax", "{0:N2}")%></span>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" Text="" CssClass="txtcant" onkeyup="ValidateCant(this)" type="number" step="any"
data-cantidad='<%# Eval("CantidadMax")%>' data-pu='<%# Eval("PU")%>' data-cve='<%# Eval("CveContratoDetalle") %>'
Width="70" runat="server"></asp:TextBox>
<asp:Label ID="LblPS" runat="server" CssClass="Texto" Text='<%# Eval("PS")%>' Width="250px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PU" ItemStyle-HorizontalAlign="Right">
<asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" Text="" CssClass="txtcant" onkeyup="ValidateCantCon(this)" type="number" step="any"
data-cantidad='<%# Eval("CantidadMax")%>' data-pu='<%# Eval("PU")%>' data-cve='<%# Eval("CveContratoDetalle") %>'
Width="90" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PU">
<ItemTemplate>
<span><%# Eval("PU", "{0:N2}")%></span>
</ItemTemplate>
@@ -2790,8 +2790,9 @@
</div>
</div>
<div class="row 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" Visible="false"/>
</div>
</div>
<div class="modal-footer">

View File

@@ -2094,101 +2094,142 @@ Partial Class OC
Exit Sub
End If
If DtDetalle IsNot Nothing Then
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
Dim ObjCon As New ClsContratos
Dim CvePresupuesto As Integer = 0
Dim Autorizado As Double = 0
Dim Ejercido As Double = 0
If ObjCon.GetPresupuestos(-1, "-1", DdlSubProyecto.SelectedValue.ToEntero, 2, -1, UsuarioActual.CveEmpresa) Then
If ObjCon.DtResultados.Rows.Count > 0 Then
CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero
If CvePresupuesto > 0 Then
If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then
If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows.Count > 0 Then
Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows(0)("Importe").ToString.ToDouble
'Valida cantidad en contrato
Dim ObjContratos As New ClsContratos
Dim TieneError As Boolean = False
Dim Mensaje As String = ""
Dim dttemp As DataTable = GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then
Dim drContrato As DataRow = dttemp.Rows(0)
If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then
Dim dtContratodetalle As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlP2.SelectedValue.ToString))
If dtContratodetalle IsNot Nothing AndAlso dtContratodetalle.Rows.Count > 0 Then
Dim drContratoDetalle As DataRow = dtContratodetalle(0)
If Convert.ToBoolean(drContratoDetalle("LimitarCantidad")) Then
If ObjContratos.GetReporteContratosAvancesDetalleControl(drContrato("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
Dim dtContratodetalleControl As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlP2.SelectedValue.ToString))
If dtContratodetalleControl IsNot Nothing AndAlso dtContratodetalleControl.Rows.Count > 0 Then
Dim drContratoDetalleControl As DataRow = dtContratodetalleControl(0)
If TxtCant.Text.Trim.ToDouble > drContratoDetalleControl("FaltanteCantidad").ToString.ToDouble Then
Mensaje = String.Format("La cantidad del Producto/Servicio debe ser menor o igual a {0}", drContratoDetalleControl("FaltanteCantidad").ToString)
TieneError = True
End If
Else
Mensaje = "Este producto no pertence al contrato seleccionado"
TieneError = True
End If
If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{DateTime.Now.Year - 1}".ToDate, Now, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero,
Else
Mensaje = "Error al consultar el contrato"
End If
End If
Else
Mensaje = "Este producto no pertence al contrato seleccionado"
TieneError = True
End If
Else
Mensaje = "Error al consultar el contrato"
End If
End If
If Not TieneError Then
ObjContratos.Dispose()
If DtDetalle IsNot Nothing Then
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
Dim ObjCon As New ClsContratos
Dim CvePresupuesto As Integer = 0
Dim Autorizado As Double = 0
Dim Ejercido As Double = 0
If ObjCon.GetPresupuestos(-1, "-1", DdlSubProyecto.SelectedValue.ToEntero, 2, -1, UsuarioActual.CveEmpresa) Then
If ObjCon.DtResultados.Rows.Count > 0 Then
CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero
If CvePresupuesto > 0 Then
If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then
If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows.Count > 0 Then
Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows(0)("Importe").ToString.ToDouble
End If
End If
If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{DateTime.Now.Year - 1}".ToDate, Now, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero,
DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveUsuario, DdlClasificacion.SelectedValue.ToEntero) Then
If ObjCon.DtResultados.Rows.Count > 0 Then
Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDouble
If ObjCon.DtResultados.Rows.Count > 0 Then
Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDouble
End If
End If
End If
End If
End If
End If
ObjCon.Dispose()
ObjCon.Dispose()
If CvePresupuesto > 0 And Autorizado > 0 Then
Dim Diferencia As Double = (Ejercido + If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)) - Autorizado
If Diferencia > 0 Then
Alert($"No hay presupuesto disponible en el subproyecto <b>{DdlSubProyecto.SelectedItem.Text}</b> y la clasificación <b>{DdlClasificacion.SelectedItem.Text}</b> se excede por <b>{Diferencia.FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
Exit Sub
If CvePresupuesto > 0 And Autorizado > 0 Then
Dim Diferencia As Double = (Ejercido + If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)) - Autorizado
If Diferencia > 0 Then
Alert($"No hay presupuesto disponible en el subproyecto <b>{DdlSubProyecto.SelectedItem.Text}</b> y la clasificación <b>{DdlClasificacion.SelectedItem.Text}</b> se excede por <b>{Diferencia.FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
End If
Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble
Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble
Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble
Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble
Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble
Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble
'If IvaPS = -1 Then 'IVA DE LA SUCURSAL
' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble
'End If
'If IvaPS = -1 Then 'IVA DE LA SUCURSAL
' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble
'End If
Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble
Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0)
Dim IdCuentaPorEjercer As Integer = If(HdnCveCuentaPorEjercer.Value = String.Empty, -1, HdnCveCuentaPorEjercer.Value.ToEntero)
Dim IdCuentaComprometido As Integer = If(HdnCveCuentaComprometido.Value = String.Empty, -1, HdnCveCuentaComprometido.Value.ToEntero)
Dim Proyecto As String = If(DdlProyecto.SelectedValue.ToString.ToEntero > 0, DdlProyecto.SelectedItem.Text, "Sin Proyecto")
Dim SubProyecto As String = If(DdlSubProyecto.SelectedValue.ToString.ToEntero > 0, DdlSubProyecto.SelectedItem.Text, "Sin SubProyecto")
Dim TotalPS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)
Dim ImportePS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, txtPrecioUnitario.Text.ToDouble, 0)
Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100
Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble
Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0)
Dim IdCuentaPorEjercer As Integer = If(HdnCveCuentaPorEjercer.Value = String.Empty, -1, HdnCveCuentaPorEjercer.Value.ToEntero)
Dim IdCuentaComprometido As Integer = If(HdnCveCuentaComprometido.Value = String.Empty, -1, HdnCveCuentaComprometido.Value.ToEntero)
Dim Proyecto As String = If(DdlProyecto.SelectedValue.ToString.ToEntero > 0, DdlProyecto.SelectedItem.Text, "Sin Proyecto")
Dim SubProyecto As String = If(DdlSubProyecto.SelectedValue.ToString.ToEntero > 0, DdlSubProyecto.SelectedItem.Text, "Sin SubProyecto")
Dim TotalPS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)
Dim ImportePS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, txtPrecioUnitario.Text.ToDouble, 0)
Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100
'Si es Proveedor Extranjero el IVA es 0%
If GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue} AND RFC = 'XEXX010101000'").Rows.Count = 1 Then
IvaPS = 0
End If
'Si es Proveedor Extranjero el IVA es 0%
If GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue} AND RFC = 'XEXX010101000'").Rows.Count = 1 Then
IvaPS = 0
End If
AddPS(TxtCant.Text, DdlP2.SelectedValue.ToEntero, DdlP2.SelectedText, TxtObsPS.Text, ImportePS, TxtDescuentoAdd.Text.ToDouble, TotalPS,
AddPS(TxtCant.Text, DdlP2.SelectedValue.ToEntero, DdlP2.SelectedText, TxtObsPS.Text, ImportePS, TxtDescuentoAdd.Text.ToDouble, TotalPS,
CboUnidadMedida.SelectedValue.ToEntero, IvaPS, IEPSPS, IEPSPSIVA, DdlClasificacion.SelectedValue.ToEntero, CboUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedItem.Text, DdlProyecto.SelectedValue.ToEntero, Proyecto,
DdlSubProyecto.SelectedValue.ToEntero, SubProyecto, LblCodigo.Text, HdnCveActivoFijo.Value.ToEntero, 0, CveOrdenCompraDetalle, CveOrdenCompra, IdCuentaPorEjercer,
IdCuentaComprometido, DdlACGeneral1.SelectedValue.ToEntero, DdlACGeneral2.SelectedValue.ToEntero, DdlACGeneral3.SelectedValue.ToEntero, DdlACGeneral4.SelectedValue.ToEntero,
DdlACGeneral5.SelectedValue.ToEntero, RetIVA, RetISR, CveCultivoCuadroDetalle:=DdlCultivosCuadro.SelectedValue.ToEntero, Cuadro:=DdlCultivosCuadro.SelectedItem.Text)
TxtCant.Text = ""
CboUnidadMedida.SelectedIndex = 0
DdlClasificacion.SelectedIndex = 0
DdlP2.SelectedValue = "-1"
DdlP2.SelectedText = "Seleccione un producto o servicio"
txtPrecioUnitario.Text = ""
TxtObsPS.Text = ""
HdnCveActivoFijo.Value = ""
LblCodigo.Text = ""
LblCvePOA.Text = ""
TxtCant.Focus()
TxtCant.Text = ""
CboUnidadMedida.SelectedIndex = 0
DdlClasificacion.SelectedIndex = 0
DdlP2.SelectedValue = "-1"
DdlP2.SelectedText = "Seleccione un producto o servicio"
txtPrecioUnitario.Text = ""
TxtObsPS.Text = ""
HdnCveActivoFijo.Value = ""
LblCodigo.Text = ""
LblCvePOA.Text = ""
TxtCant.Focus()
Total.Text = "0.00"
TxtDescuentoAdd.Text = "0.00"
Total.Text = "0.00"
TxtDescuentoAdd.Text = "0.00"
End If
CargaSuperior()
CargaDatosDetalles()
UPPDetalle.Update()
Else
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
End If
CargaSuperior()
CargaDatosDetalles()
UPPDetalle.Update()
ObjContratos.Dispose()
End Sub
Private Sub AddPS(Cantidad As String, CvePS As Integer, PS As String, Observaciones As String, Importe As Double, Descuento As Double, Total As Double, CveUnidadMedida As Integer, IVAPS As Double, IEPSPS As Double, IEPSPSIVA As Double, CveClasificacion As Integer,
UM As String, Clasificacion As String, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, CodigoAF As String, CveActivoFijo As Integer, TipoDato As Integer,
@@ -8396,9 +8437,17 @@ Partial Class OC
If ObjContratos.DtResultados.Rows.Count > 0 Then
GvContratosControl.DataSource = ObjContratos.DtResultados
BtnAplicarContrato.Visible = True
divBusqueda.Visible = True
ChkContinualAgregandoControl.Visible = True
ChkContinualAgregandoControl.Checked = True
Else
GvContratosControl.DataSource = Nothing
BtnAplicarContrato.Visible = False
divBusqueda.Visible = False
ChkContinualAgregandoControl.Visible = False
ChkContinualAgregandoControl.Checked = False
End If
End If