GDiaz - 2024.08.09
This commit is contained in:
@@ -221,7 +221,8 @@
|
||||
<asp:ListItem Text="Media" Value="2"></asp:ListItem>
|
||||
<asp:ListItem Text="Baja" Value="3"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<asp:DropDownList ID="DdlSubProyectoGral" Visible="false" CssClass="form-control select2me" runat="server" Width="85%" DataTextField="SubProyecto" DataValueField="CveSubProyecto" OnSelectedIndexChanged ="DdlSubProyectoGral_SelectedIndexChanged" AutoPostBack="true">
|
||||
<asp:DropDownList ID="DdlSubProyectoGral" Visible="false" CssClass="form-control select2me" runat="server" Width="85%" DataTextField="SubProyecto" DataValueField="CveSubProyecto"
|
||||
OnSelectedIndexChanged ="DdlSubProyectoGral_SelectedIndexChanged" AutoPostBack="true">
|
||||
<asp:ListItem Selected="True" Text="-" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
@@ -808,7 +809,7 @@
|
||||
Producto o Servicio(<asp:HyperLink ID="HplPS" NavigateUrl="/Ventas/CatPS.aspx" runat="server">+</asp:HyperLink>)</th>
|
||||
<th scope="col">Unidad</th>
|
||||
<th scope="col">Observación</th>
|
||||
<th scope="col">
|
||||
<th scope="col" runat="server" id="TdProyectoSubPrpyecto">
|
||||
<asp:Label ID="TtituloProyecto" Text="" runat="server" />
|
||||
<asp:Label ID="TituloSubProyecto" Text="" runat="server" />
|
||||
</th>
|
||||
@@ -854,7 +855,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<asp:TextBox ID="TxtObsPS" CssClass=" form-control input-sm txtobs" runat="server" Rows="2" TextMode="MultiLine" MaxLength="750"></asp:TextBox></td>
|
||||
<td>
|
||||
<td runat="server" id="TdProyectoSubPrpyectoDdl">
|
||||
<asp:DropDownList ID="DdlProyecto" CssClass=" form-control input-sm select2me" runat="server" AppendDataBoundItems="true" Style="width: 100%; max-width: 600px;" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto">
|
||||
</asp:DropDownList>
|
||||
<asp:DropDownList ID="DdlSubProyecto" CssClass=" form-control input-sm select2me" runat="server" OnSelectedIndexChanged="DdlSubProyecto_SelectedIndexChanged" DataTextField="SubProyecto" Style="width: 100%; max-width: 600px;" DataValueField="CveSubProyecto" ValidationGroup="GrpDetalleGuardar">
|
||||
|
||||
209
OC/OC.aspx.vb
209
OC/OC.aspx.vb
@@ -606,6 +606,23 @@ Partial Class OC_OC
|
||||
End Property
|
||||
|
||||
|
||||
Private Property EstaEnmodiEdicionMasiva As Boolean
|
||||
Get
|
||||
If ViewState("EstaEnmodiEdicionMasiva") Is Nothing Then
|
||||
ViewState("EstaEnmodiEdicionMasiva") = False
|
||||
End If
|
||||
|
||||
Return Boolean.Parse(ViewState("EstaEnmodiEdicionMasiva").ToString)
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("EstaEnmodiEdicionMasiva") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
@@ -727,11 +744,19 @@ Partial Class OC_OC
|
||||
End If
|
||||
|
||||
'temporal
|
||||
|
||||
'If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
If UsuarioActual.CveEmpresa = 189 Then
|
||||
'GlobalDTOCEstatusUsuarios(CveEmpresaActual, UsuarioActual.CveUsuario, TipoOC)
|
||||
DdlSubProyectoGral.DataSource = GlobalDTOCEstatusUsuarios(CveEmpresaActual, UsuarioActual.CveUsuario, TipoOC).FiltraParametros("", "SubProyecto", DistinctColumns:={"CveSubProyecto", "SubProyecto"})
|
||||
DdlSubProyectoGral.DataBind()
|
||||
DdlSubProyectoGral.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
||||
DdlSubProyectoGral.SelectedValueExist(UsuarioActual.CveSubProyecto)
|
||||
TdProyectoSubPrpyectoDdl.Visible = False
|
||||
TdProyectoSubPrpyecto.Visible = False
|
||||
GvD.Columns(4).Visible = False
|
||||
UPPDetalle.Update()
|
||||
|
||||
End If
|
||||
|
||||
BtnGeneraContrato.Visible = True : CargaClientesContrato()
|
||||
@@ -2246,12 +2271,24 @@ Partial Class OC_OC
|
||||
#Region " AGREGAR "
|
||||
Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click
|
||||
|
||||
|
||||
|
||||
|
||||
'VALIDA CVEPS
|
||||
If DdlP2.SelectedValue().ToEntero <= 0 Then
|
||||
Alert("El campo <b>'Producto/Servicio'</b> es necesario, por favor seleccione uno.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'VALIDA
|
||||
If TxtDescuento.Text.ToDecimal > 0 AndAlso ((TxtCant.Text.ToDecimal * txtPrecioUnitario.Text.ToDecimal) <= TxtDescuentoAdd.Text.ToDecimal) Then
|
||||
Alert($"El campo <b>'Descuento'</b> no debe ser mayor o igual al total({(TxtCant.Text.ToDecimal * txtPrecioUnitario.Text.ToDecimal).ToString("###,###,###.00")}).", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
'Valida cantidad en contrato
|
||||
Dim TieneError As Boolean = False
|
||||
Dim dttemp As New DataTable ' GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
|
||||
@@ -4130,6 +4167,7 @@ Partial Class OC_OC
|
||||
DtDetalle.AcceptChanges()
|
||||
|
||||
CargaDatosDetalles()
|
||||
ModoEdicionMasiva()
|
||||
|
||||
|
||||
End Sub
|
||||
@@ -4173,6 +4211,14 @@ Partial Class OC_OC
|
||||
CveClasificacion = gvr.FCDropDownList("DdlClasificacion").SelectedValue.ToEntero
|
||||
Clasificacion = gvr.FCDropDownList("DdlClasificacion").SelectedItem.Text
|
||||
|
||||
'VALIDA
|
||||
If Descuento > 0 AndAlso ((Cantidad * Importe) <= Descuento) Then
|
||||
Alert($"El campo <b>'Descuento'</b> no debe ser mayor o igual al total({(Cantidad * Importe).ToString("###,###,###.00")}).", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'SE TOMAN VALORES EN CASO DE QUE LA CvePS SEA DIFERENTE DE LA ANTERIOR
|
||||
Dim CvePSAnterior As Integer = gvr.DataKey("CvePS").ToEntero
|
||||
PS = gvr.DataKey("PS").ToString
|
||||
@@ -9388,6 +9434,21 @@ Partial Class OC_OC
|
||||
Protected Sub BtnEdicionMasiva_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If BtnEdicionMasiva.Text = "Editar" Then
|
||||
EstaEnmodiEdicionMasiva = True
|
||||
Else
|
||||
If GvD_RecalculaEdicionMasiva() Then
|
||||
EstaEnmodiEdicionMasiva = False
|
||||
End If
|
||||
|
||||
End If
|
||||
ModoEdicionMasiva()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub ModoEdicionMasiva()
|
||||
|
||||
If EstaEnmodiEdicionMasiva Then
|
||||
BtnEdicionMasiva.Text = "Aplicar"
|
||||
|
||||
For Each GvRow As GridViewRow In GvD.Rows
|
||||
@@ -9401,6 +9462,7 @@ Partial Class OC_OC
|
||||
GvRow.FCLiteral("LtlObsPS").Visible = False
|
||||
GvRow.FCLiteral("LtlDescuento").Visible = False
|
||||
GvRow.FCLabel("LtlImporte").Visible = False
|
||||
GvRow.FCLinkButton("imgE").Visible = False
|
||||
|
||||
|
||||
'observación, PU, descuento, cantidad
|
||||
@@ -9408,7 +9470,7 @@ Partial Class OC_OC
|
||||
|
||||
Else
|
||||
|
||||
GvD_RecalculaEdicionMasiva()
|
||||
'GvD_RecalculaEdicionMasiva()
|
||||
|
||||
BtnEdicionMasiva.Text = "Editar"
|
||||
For Each GvRow As GridViewRow In GvD.Rows
|
||||
@@ -9421,6 +9483,8 @@ Partial Class OC_OC
|
||||
GvRow.FCLiteral("LtlObsPS").Visible = True
|
||||
GvRow.FCLiteral("LtlDescuento").Visible = True
|
||||
GvRow.FCLabel("LtlImporte").Visible = True
|
||||
GvRow.FCLinkButton("imgE").Visible = True
|
||||
|
||||
Next
|
||||
|
||||
|
||||
@@ -9431,10 +9495,28 @@ Partial Class OC_OC
|
||||
UPPDetalle.Update()
|
||||
uppEstatus.Update()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function GvD_RecalculaEdicionMasiva() As Boolean
|
||||
|
||||
Private Sub GvD_RecalculaEdicionMasiva()
|
||||
For Each gvr As GridViewRow In GvD.Rows
|
||||
|
||||
Dim Cantidad, Importe, Descuento As Decimal
|
||||
Cantidad = gvr.FCTextBox("TxtEMCantEdit").Text.Trim.ToDecimal
|
||||
Importe = gvr.FCTextBox("TxtEMImporteEdit").Text.Trim.ToDecimal
|
||||
Descuento = gvr.FCTextBox("TxtEMDescuentoEdit").Text.Trim.ToDecimal
|
||||
Dim PS As String = gvr.DataKey("PS").ToString
|
||||
Dim Total As Decimal = Importe * Cantidad - Descuento
|
||||
|
||||
'VALIDA
|
||||
If Descuento > 0 AndAlso ((Cantidad * Importe) <= Descuento) Then
|
||||
Alert($"El producto {PS}, cantidad {Cantidad}, el campo <b>'Descuento'</b> no debe ser mayor o igual al total({(Cantidad * Importe).ToString("###,###,###.00")}).", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
For Each gvr As GridViewRow In GvD.Rows
|
||||
|
||||
@@ -9448,8 +9530,7 @@ Partial Class OC_OC
|
||||
Descuento = gvr.FCTextBox("TxtEMDescuentoEdit").Text.Trim.ToDecimal
|
||||
Obs = gvr.FCTextBox("TxtEMObsPS").Text.Trim
|
||||
|
||||
'SubProyecto, Cantidad, Importe, Descuento, CveOrdenCompra, CveUnidadMedida, CvePresupuestoEgreso, PS,CveClasificacion, CvePS, CveSubProyecto, CveActivoFijo, CodigoAF, TipoDato, Observacion,
|
||||
'CveOrdenCompraDetalle,CveCompra,IVAPorcentaje,RetIVAPorcentaje,RetISRPorcentaje,IEPSPSPorcentaje,IEPSPSIVAPorcentaje,CantidadNoEditable,CveCultivoCuadroDetalle
|
||||
'
|
||||
|
||||
CveUnidad = gvr.DataKey("CveUnidadMedida").ToEntero
|
||||
UM = gvr.FCLiteral("LA").Text
|
||||
@@ -9466,118 +9547,10 @@ Partial Class OC_OC
|
||||
Dim IEPSPSIVA As Decimal = gvr.DataKey("IEPSPSIVAPorcentaje").ToDecimal
|
||||
Dim Total As Decimal = Importe * Cantidad - Descuento
|
||||
|
||||
|
||||
'VALORES DEL PS
|
||||
'CvePS = gvr.FCDropDownList("DdlPS").SelectedValue.ToEntero
|
||||
|
||||
'PS = gvr.FCDropDownList("DdlPS").SelectedItem.Text
|
||||
'Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("")
|
||||
'If DrPS Is Nothing Then
|
||||
' Alert("Ocurrió un error al cargar la información del producto para actualizar. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
'End If
|
||||
'Dim IvaPS As Decimal = DrPS("IVA").ToString.ToDecimal
|
||||
'IEPSPS = DrPS("IEPSPorcentaje").ToString.ToDecimal
|
||||
'IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0)
|
||||
|
||||
'If DdlProveedores.SelectedValue.ToEntero > 0 Then
|
||||
' 'Si es Proveedor Extranjero el IVA es 0%
|
||||
' Dim drProv As DataRow = GlobalDTCompProveedores(CveEmpresaActual, CveProveedor:=DdlProveedores.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
' If drProv IsNot Nothing Then
|
||||
' If drProv("CodigoRegimenFiscal").ToString = "626" Then 'simplificado lleva retencion de 1.25 de isr
|
||||
' RetISR = 0.0125D
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'If CvePS <> CvePSAnterior Or Not CveOrdenCompra > 0 Then
|
||||
' RetISR = DrPS("RetISR").ToString.ToDecimal
|
||||
' RetIVA = DrPS("RetIVA").ToString.ToDecimal
|
||||
' If Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2) = 0.08 Then
|
||||
' RetIVA = RetIVA / 2
|
||||
' End If
|
||||
' If IvaPS <> 0 Then IvaPS = -1
|
||||
'End If
|
||||
|
||||
'CveSubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedValue.ToEntero
|
||||
'SubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedItem.Text
|
||||
|
||||
'CveCultivoCuadroDetalle = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedValue.ToEntero
|
||||
'Cuadro = ""
|
||||
'If CveCultivoCuadroDetalle > 0 Then
|
||||
' Cuadro = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedItem.Text
|
||||
'End If
|
||||
|
||||
'If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Or UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then
|
||||
' CveProyecto = -1
|
||||
' Proyecto = "Seleccione"
|
||||
'Else
|
||||
' CveProyecto = gvr.FCDropDownList("DdlProyectoEdit").SelectedValue.ToEntero
|
||||
' Proyecto = gvr.FCDropDownList("DdlProyectoEdit").SelectedItem.Text
|
||||
'End If
|
||||
|
||||
'If UsuarioActual.Empresa.Funcionalidad(532).Contiene("1", "2") Then
|
||||
' Dim ObjCon As New ClsContratos
|
||||
' Dim CvePresupuesto As Integer = 0
|
||||
' Dim Autorizado As Decimal = 0
|
||||
' Dim Ejercido As Decimal = 0
|
||||
' If ObjCon.GetPresupuestos(-1, "-1", CveSubProyecto, 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 = {CveClasificacion} And Importe > 0").Rows.Count > 0 Then
|
||||
' Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {CveClasificacion} And Importe > 0").Rows(0)("Importe").ToString.ToDecimal
|
||||
' End If
|
||||
' End If
|
||||
' If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{NowADS().Year - 1}".ToDate, NowADS(), UsuarioActual.CveEmpresa, CveProyecto,
|
||||
' CveSubProyecto, UsuarioActual.CveUsuario, CveClasificacion) Then
|
||||
' If ObjCon.DtResultados.Rows.Count > 0 Then
|
||||
' Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDecimal
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
' ObjCon.Dispose()
|
||||
|
||||
' If CvePresupuesto > 0 And Autorizado > 0 Then
|
||||
' Dim Diferencia As Decimal = (Ejercido + Total) - Autorizado
|
||||
' If Diferencia > 0 Then
|
||||
' Alert($"No hay presupuesto disponible:<br/> - Subproyecto <b>{SubProyecto}</b> <br/> - Clasificación <b>{Clasificacion}</b> <br/> se excede por <b>{Diferencia.FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'Agarra el nuevo AF si se modifico o deja el pasado
|
||||
'CveActivoFijo = If(gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero > 0, gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero, HdnEditCveActivoFijo.Value.ToEntero)
|
||||
'Codigo = If(gvr.FCHiddenField("HdnCodigoAF").Value <> "-1", gvr.FCHiddenField("HdnCodigoAF").Value, HdnEditCodigo.Value)
|
||||
|
||||
'HdnEditCveActivoFijo.Value = ""
|
||||
'HdnEditCodigo.Value = ""
|
||||
|
||||
Dim dr As DataRow() = DtDetalle.Select("CveOrdenCompraDetalle = " & gvr.DataKey("CveOrdenCompraDetalle").ToString.ToEntero)
|
||||
|
||||
dr(0)("Cantidad") = Cantidad
|
||||
'dr(0)("CveUnidadMedida") = CveUnidad
|
||||
'dr(0)("UM") = UM
|
||||
'dr(0)("CveClasificacion") = CveClasificacion
|
||||
'dr(0)("Clasificacion") = Clasificacion
|
||||
|
||||
'If isWithFamily() Then
|
||||
' dr(0)("CveSubFamilia") = CveClasificacion
|
||||
' dr(0)("SubFamilia") = Clasificacion
|
||||
'End If
|
||||
|
||||
'dr(0)("CvePS") = CvePS
|
||||
'dr(0)("PS") = PS
|
||||
dr(0)("Observacion") = Obs
|
||||
|
||||
'dr(0)("CveSubProyecto") = CveSubProyecto
|
||||
'dr(0)("SubProyecto") = SubProyecto
|
||||
'dr(0)("CveProyecto") = CveProyecto
|
||||
'dr(0)("Proyecto") = Proyecto
|
||||
dr(0)("Importe") = Importe
|
||||
dr(0)("Descuento") = Descuento
|
||||
dr(0)("Total") = Total
|
||||
@@ -9586,8 +9559,6 @@ Partial Class OC_OC
|
||||
dr(0)("IEPSPSIVA") = IEPSPSIVA * Total
|
||||
dr(0)("IEPSPSIVAPorcentaje") = IEPSPSIVA
|
||||
|
||||
'If DdlIVA.SelectedValue.ToDecimal = 1 Then dr(0)("IVA") = 0 Else dr(0)("IVA") = IvaPS * Total
|
||||
'dr(0)("IVAPorcentaje") = If(IvaPS = -1, Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), 0)
|
||||
Dim TotalGravado As Decimal = Total
|
||||
If IEPSPSIVA > 0 Then TotalGravado = Total * (1 + IEPSPSIVA) 'grava para iva, el importe del IEPS
|
||||
dr(0)("IVA") = Math.Round(dr(0)("IVAPorcentaje").ToString.ToDecimal * TotalGravado, 2)
|
||||
@@ -9597,13 +9568,6 @@ Partial Class OC_OC
|
||||
dr(0)("RetISR") = (RetISR * Total).RoundSQL(6)
|
||||
dr(0)("RetISRPorcentaje") = RetISR
|
||||
|
||||
|
||||
'dr(0)("CveActivoFijo") = CveActivoFijo
|
||||
'dr(0)("CodigoAF") = Codigo
|
||||
|
||||
'dr(0)("CveCultivoCuadroDetalle") = CveCultivoCuadroDetalle
|
||||
'dr(0)("Cuadro") = Cuadro
|
||||
|
||||
'si el tipodato viene de la BD, entonces sufrió una actualización
|
||||
If dr(0)("TipoDato").ToString.ToEntero = 2 Then dr(0)("TipoDato") = 1
|
||||
DtDetalle.AcceptChanges()
|
||||
@@ -9614,8 +9578,9 @@ Partial Class OC_OC
|
||||
|
||||
CargaDatosDetalles()
|
||||
|
||||
Return True
|
||||
|
||||
End Sub
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
@@ -425,7 +425,7 @@
|
||||
<asp:BoundField DataField="ConceptoHistorialBitacora" HeaderText="Campo" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="Anterior" HeaderText="Anterior" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="Actual" HeaderText="Actual" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="Descripcio n" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="Descripcion" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="Usuario" HeaderText="Usuario" ItemStyle-HorizontalAlign="Left" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
Reference in New Issue
Block a user