OC edicion multiple
This commit is contained in:
22
OC/OC.aspx
22
OC/OC.aspx
@@ -486,12 +486,18 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="TrDescuentoProntoPago" runat="server" visible="false">
|
||||
<td><b>Descuento Pronto Pago:</b></td>
|
||||
<td>
|
||||
<asp:TextBox ID="TxtPorcentajeProntoPago" CssClass="form-control " runat="server" MaxLength="50" Width="100px" Height="28px"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtPorcentajeProntoPago" ValidChars="1234567890." />
|
||||
</td>
|
||||
</tr>
|
||||
<td><b>Descuento Pronto Pago:</b></td>
|
||||
<td>
|
||||
<asp:TextBox ID="TxtPorcentajeProntoPago" CssClass="form-control " runat="server" MaxLength="50" Width="100px" Height="28px"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtPorcentajeProntoPago" ValidChars="1234567890." />
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="TrEdicionMasiva" runat="server" visible="false">
|
||||
<td><b>Edición Masiva:</b></td>
|
||||
<td>
|
||||
<asp:Button runat="server" ID="BtnEdicionMasiva" Text="Editar" CssClass="btn btn-primary" OnClick="BtnEdicionMasiva_Click" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
@@ -963,6 +969,7 @@
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LtlCantidad" runat="server" Text='<%# Eval("Cantidad", "{0:#,###.######}")%>' Style="width: 100%"></asp:Label>
|
||||
<asp:TextBox ID="TxtEMCantEdit" runat="server" Text='<%# Eval("Cantidad", "{0:#,###.######}")%>' Width="45px" Height="24px" Visible="false" ></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%-- 1 --%>
|
||||
@@ -1005,6 +1012,7 @@
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlObsPS" runat="server" Text='<%# Eval("Observacion")%>'></asp:Literal>
|
||||
<asp:TextBox ID="TxtEMObsPS" CssClass="txtobs" runat="server" Rows="2" Text='<%# Eval("Observacion") %>' TextMode="MultiLine" MaxLength="750" Style="" Visible="false"></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TxtObsPS" CssClass="txtobs" runat="server" Rows="2" Text='<%# Eval("Observacion") %>' TextMode="MultiLine" MaxLength="750" Style=""></asp:TextBox>
|
||||
@@ -1060,6 +1068,7 @@
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:Label ToolTip='<%# If(Not IsDBNull(Eval("Importe")) AndAlso CDbl(Eval("Importe").ToString) <> -1, Eval("Importe"), "")%>' ID="LtlImporte" runat="server" Text='<%# If(Not IsDBNull(Eval("Importe")) AndAlso CDbl(Eval("Importe").ToString) <> -1, Eval("Importe", "{0:#,##0.00####}"), "")%>'></asp:Label>
|
||||
<asp:TextBox ID="TxtEMImporteEdit" runat="server" CausesValidation="true" ClientIDMode="Static" MaxLength="12" Text='<%# If(Not IsDBNull(Eval("Importe")) AndAlso CDbl(Eval("Importe").ToString) <> -1, Eval("Importe", "{0:#,##0.00####}"), "")%>' ValidationGroup="grpEditar" Width="55px" Height="24px" Visible="false" ></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:Literal ID="LtlImporte" runat="server" Text='<%# If(Not IsDBNull(Eval("Importe")) AndAlso CDbl(Eval("Importe").ToString) <> -1, Eval("Importe", "{0:#,##0.00####}"), "")%>' Visible="false"></asp:Literal>
|
||||
@@ -1075,6 +1084,7 @@
|
||||
<asp:TemplateField Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlDescuento" runat="server" Text='<%# Eval("Descuento", "{0:N2}")%>'></asp:Literal>
|
||||
<asp:TextBox ID="TxtEMDescuentoEdit" runat="server" onkeyup="ValidaDescuentoDetalle(this);" CausesValidation="true" MaxLength="12" Text='<%# Eval("Descuento", "{0:#,##0.00####}")%>' ValidationGroup="grpEditar" Width="55px" Height="24px" Visible="false" ></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TxtDescuentoEdit" runat="server" onkeyup="ValidaDescuentoDetalle(this);" CausesValidation="true" MaxLength="12" Text='<%# Eval("Descuento", "{0:#,##0.00####}")%>' ValidationGroup="grpEditar" Width="55px" Height="24px"></asp:TextBox>
|
||||
|
||||
258
OC/OC.aspx.vb
258
OC/OC.aspx.vb
@@ -968,6 +968,7 @@ Partial Class OC_OC
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
TrDescuentoEscalonado.Visible = True
|
||||
TrDescuentoProntoPago.Visible = True
|
||||
TrEdicionMasiva.Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -9330,6 +9331,7 @@ Partial Class OC_OC
|
||||
|
||||
Dim TotalTemp As Decimal = (PU * Cantidad)
|
||||
Dim Descuento As Decimal = 0
|
||||
|
||||
If descuentoParts.Length = 0 Then
|
||||
Descuento = 0
|
||||
Else
|
||||
@@ -9348,14 +9350,24 @@ Partial Class OC_OC
|
||||
Dim Total As Decimal = If(PU > 0, (PU * Cantidad) - Descuento, 0)
|
||||
|
||||
dRow("Descuento") = Descuento
|
||||
dRow("Total") = Total
|
||||
dRow("IEPSPS") = Math.Round(IEPSPSPorcentaje * Total, 2)
|
||||
dRow("IEPSPSIVA") = Math.Round(IEPSPSIVAPorcentaje * Total, 2)
|
||||
|
||||
dRow("IVA") = Math.Round(IVAPorcentaje * Total, 2)
|
||||
If dRow("Total").ToString.ToDecimal <> Total Then
|
||||
dRow("Total") = Total
|
||||
|
||||
dRow("IEPSPS") = Math.Round(IEPSPSPorcentaje * Total, 2)
|
||||
dRow("IEPSPSIVA") = Math.Round(IEPSPSIVAPorcentaje * Total, 2)
|
||||
|
||||
dRow("IVA") = Math.Round(IVAPorcentaje * Total, 2)
|
||||
|
||||
dRow("RetIVA") = (RetIVAPorcentaje * Total).RoundSQL(2)
|
||||
dRow("RetISR") = (RetISRPorcentaje * Total).RoundSQL(2)
|
||||
dRow("TipoDato") = 1
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
dRow("RetIVA") = (RetIVAPorcentaje * Total).RoundSQL(2)
|
||||
dRow("RetISR") = (RetISRPorcentaje * Total).RoundSQL(2)
|
||||
|
||||
|
||||
Next
|
||||
@@ -9372,5 +9384,239 @@ Partial Class OC_OC
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnEdicionMasiva_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If BtnEdicionMasiva.Text = "Editar" Then
|
||||
BtnEdicionMasiva.Text = "Aplicar"
|
||||
|
||||
For Each GvRow As GridViewRow In GvD.Rows
|
||||
|
||||
GvRow.FCTextBox("TxtEMObsPS").Visible = True
|
||||
GvRow.FCTextBox("TxtEMCantEdit").Visible = True
|
||||
GvRow.FCTextBox("TxtEMDescuentoEdit").Visible = True
|
||||
GvRow.FCTextBox("TxtEMImporteEdit").Visible = True
|
||||
|
||||
GvRow.FCLabel("LtlCantidad").Visible = False
|
||||
GvRow.FCLiteral("LtlObsPS").Visible = False
|
||||
GvRow.FCLiteral("LtlDescuento").Visible = False
|
||||
GvRow.FCLabel("LtlImporte").Visible = False
|
||||
|
||||
|
||||
'observación, PU, descuento, cantidad
|
||||
Next
|
||||
|
||||
Else
|
||||
|
||||
GvD_RecalculaEdicionMasiva()
|
||||
|
||||
BtnEdicionMasiva.Text = "Editar"
|
||||
For Each GvRow As GridViewRow In GvD.Rows
|
||||
GvRow.FCTextBox("TxtEMObsPS").Visible = False
|
||||
GvRow.FCTextBox("TxtEMCantEdit").Visible = False
|
||||
GvRow.FCTextBox("TxtEMDescuentoEdit").Visible = False
|
||||
GvRow.FCTextBox("TxtEMImporteEdit").Visible = False
|
||||
|
||||
GvRow.FCLabel("LtlCantidad").Visible = True
|
||||
GvRow.FCLiteral("LtlObsPS").Visible = True
|
||||
GvRow.FCLiteral("LtlDescuento").Visible = True
|
||||
GvRow.FCLabel("LtlImporte").Visible = True
|
||||
Next
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
UPPDetalle.Update()
|
||||
uppEstatus.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub GvD_RecalculaEdicionMasiva()
|
||||
|
||||
For Each gvr As GridViewRow In GvD.Rows
|
||||
|
||||
Dim Cantidad, Importe, Descuento As Decimal
|
||||
Dim CveUnidad, CveClasificacion, CvePS, CveSubProyecto, CveProyecto, CveCultivoCuadroDetalle As Integer
|
||||
Dim Obs, UM, Clasificacion, PS, SubProyecto, Proyecto, Cuadro As String
|
||||
|
||||
|
||||
Cantidad = gvr.FCTextBox("TxtEMCantEdit").Text.Trim.ToDecimal
|
||||
Importe = gvr.FCTextBox("TxtEMImporteEdit").Text.Trim.ToDecimal
|
||||
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
|
||||
CveClasificacion = gvr.DataKey("CveClasificacion").ToEntero
|
||||
Clasificacion = gvr.FCLabel("LblClasificacion").Text
|
||||
|
||||
'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
|
||||
Dim RetISR As Decimal = gvr.DataKey("RetISRPorcentaje").ToDecimal
|
||||
Dim RetIVA As Decimal = gvr.DataKey("RetIVAPorcentaje").ToDecimal
|
||||
'Dim IvaPS = gvr.DataKey("IVAPorcentaje").ToDecimal
|
||||
Dim IEPSPS As Decimal = gvr.DataKey("IEPSPSPorcentaje").ToDecimal
|
||||
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
|
||||
dr(0)("IEPSPS") = IEPSPS * Total
|
||||
dr(0)("IEPSPSPorcentaje") = IEPSPS
|
||||
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)
|
||||
|
||||
dr(0)("RetIVA") = (RetIVA * Total).RoundSQL(6)
|
||||
dr(0)("RetIVAPorcentaje") = RetIVA
|
||||
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()
|
||||
|
||||
|
||||
Next
|
||||
|
||||
|
||||
CargaDatosDetalles()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user