This commit is contained in:
2020-11-25 22:10:21 -07:00
6 changed files with 179 additions and 20 deletions

View File

@@ -440,7 +440,7 @@ Public Class ClsCompras
Optional AF_Medida As Integer = -1, Optional AF_TipoMantenimiento As Integer = -1, Optional Referencia As String = "", Optional OtrosGastos As Decimal = 0,
Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0,
Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, Optional IEPSPSIVAPorcentaje As Double = 0,
Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1) As Boolean
Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1) As Boolean
Dim Retorno As Boolean = False
@@ -484,6 +484,7 @@ Public Class ClsCompras
.Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje
.Add("@NoDeducible", SqlDbType.Bit).Value = NoDeducible
.Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle
.Add("@CveCultivoCuadroDetalle", SqlDbType.Int).Value = CveCultivoCuadroDetalle
End With
Try
@@ -535,6 +536,7 @@ Public Class ClsCompras
.Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje
.Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje
.Add("@NoDeducible", SqlDbType.Bit).Value = NoDeducible
End With
Try

View File

@@ -3356,6 +3356,38 @@ Public Class ClsGenerales
#End Region
#Region "CULTIVOS"
Public Function GetCultivosCuadro(CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Agro_CultivosCuadroGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError($"Ocurrió un error al obtener los datos de cultivo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#End Region
#Region " IDisposable Support "
' Visual Basic agregó este código para implementar correctamente el modelo descartable.
Public Sub Dispose() Implements IDisposable.Dispose

View File

@@ -3488,6 +3488,7 @@ Public Class ClsPaginas
End Set
End Property
Property GlobalDTAcumGarantiasMesesTipoUso(CveEmpresa As Integer, CveMarca As Integer) As DataTable
Get
Dim AppNombre As String = String.Format("GlobalDTAcumGarantiasMesesTipoUso-{0}", CveEmpresa)
@@ -3516,6 +3517,41 @@ Public Class ClsPaginas
End Property
Property GlobalDTCultivosCuadro(CveEmpresa As Integer) As DataTable
Get
Dim AppNombre As String = String.Format("GlobalDTCultivosCuadro-{0}", CveEmpresa)
If Application(AppNombre) Is Nothing Then
Dim ObjGenerales As New ClsGenerales()
If ObjGenerales.GetCultivosCuadro(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados
ObjGenerales.Dispose()
End If
'If CveMarca <> -1 Then
' Dim Str As StringBuilder = New StringBuilder()
' If CveMarca <> -1 Then Str.AppendFormat("CveMarca = {0}", CveMarca)
' Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows)
' GlobalDTCultivosCuadro = Dv.ToTable
' Dv.Dispose()
'Else
'End If
GlobalDTCultivosCuadro = DirectCast(Application(AppNombre), DataTable)
End Get
Set(value As DataTable)
Dim AppNombre As String = String.Format("GlobalDTCultivosCuadro-{0}", CveEmpresa)
Application(AppNombre) = value
End Set
End Property
Property GlobalDTAcumTamaños() As DataTable
Get
GlobalDTAcumTamaños = DirectCast(Application("GlobalDTAcumTamaños"), DataTable)

View File

@@ -2680,6 +2680,7 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("CveContrato", GetType(Integer))
TmpDT.Columns.Add("DifPSSat", GetType(Integer))
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
GvPS.DataSource = TmpDT
@@ -4547,7 +4548,7 @@ Partial Class Compras_Compras
'End If
'METODO DE PREPOLIZA DE ALMACEN
If UsuarioActual.CveEmpresa.Contiene(1, 119, 72, 80, 140, 141) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then
If UsuarioActual.CveEmpresa.Contiene(1, 119, 72, 80, 140, 141, 153) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then
Dim ImporteAlmacen = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal
If ImporteAlmacen > 0 Then
If Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then
@@ -5056,7 +5057,7 @@ Partial Class Compras_Compras
RetIVA:=Row("RetIVA").ToString.ToDouble, RetISR:=Row("RetISR").ToString.ToDouble, IEPSPS:=Row("IEPSPS").ToString.ToDouble, IEPSPSIVA:=Row("IEPSPSIVA").ToString.ToDouble,
IVAPorcentaje:=Row("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=Row("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=Row("RetISRPorcentaje").ToString.ToDouble,
IEPSPSPorcentaje:=Row("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=Row("IEPSPSIVAPorcentaje").ToString.ToDouble, NoDeducible:=If((Row("NoDeducible").ToString().ToUpper().Contiene("TRUE", "1")) AndAlso EsNoDeducible, True, False),
CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero) Then
CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CveCultivoCuadroDetalle:=Row("CveCultivoCuadroDetalle").ToString.ToEntero) Then
ErrorDetalles = True
Exit For
@@ -11264,6 +11265,7 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("DifPSSat", GetType(Integer))
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
TmpDTOriginal = New DataTable
TmpDTOriginal.Columns.Add("Consec", GetType(Integer))
@@ -11371,6 +11373,7 @@ Partial Class Compras_Compras
TmpDTOriginal.Columns.Add("Importe", GetType(Double))
TmpDTOriginal.Columns.Add("CveContratoDetalle", GetType(Double))
TmpDTOriginal.Columns.Add("CveCultivoCuadroDetalle", GetType(Double))
End Sub
@@ -15653,6 +15656,7 @@ Partial Class Compras_Compras
Dim CveTipoGasto As Integer = dr("CveTipoGastoObra").ToString.ToEntero
Dim TipoGasto As String = dr("TipoGasto").ToString
Dim CveContratoDetalle As Integer = dr("CveContratoDetalle").ToString.ToEntero
Dim CveCultivoCuadroDetalle As Integer = dr("CveCultivoCuadroDetalle").ToString.ToEntero
'[IPP] PROVISIONAL PARA TIPO GASTO
If GlobalDTTiposGastos(UsuarioActual.CveEmpresa) IsNot Nothing AndAlso GlobalDTTiposGastos(UsuarioActual.CveEmpresa).Rows.Count = 1 Then
@@ -15664,7 +15668,7 @@ Partial Class Compras_Compras
End If
AddPS(Cantidad, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyectoContrato, SubProyecto, Proyecto, CveProyecto, Obs, PU, Total, IVA, RetIVA, RetISR, IEPSPS, IEPSPSIVA, Descuento, CveOrdenCompraDetalle, False,
CantidadF:=CantidadF, EntregaDirecta:=EntregaDirecta, CveSATPS:=CveSATPS, CveTipoGasto:=CveTipoGasto, TipoGasto:=TipoGasto, CveContratoDetalle:=CveContratoDetalle)
CantidadF:=CantidadF, EntregaDirecta:=EntregaDirecta, CveSATPS:=CveSATPS, CveTipoGasto:=CveTipoGasto, TipoGasto:=TipoGasto, CveContratoDetalle:=CveContratoDetalle, CveCultivoCuadroDetalle:=CveCultivoCuadroDetalle)
'CARGA PE
Index = TmpDT.Rows.Count - 1
@@ -17903,7 +17907,7 @@ Partial Class Compras_Compras
Obs As String, PU As Double, Total As Double, IVA As Double, RetIVA As Double, RetISR As Double, IEPSPS As Double, IEPSPSIVA As Double, Descuento As Double, Optional CveOrdenCompraDetalle As Integer = -1, Optional TCalculaTotales As Boolean = True,
Optional PSCodigo As String = "-", Optional PSDescripcion As String = "-", Optional CantidadF As Double = -1, Optional EntregaDirecta As Integer = -1, Optional OtrosGastos As Double = 0,
Optional CveSATPS As Integer = -1, Optional CargaXml As Boolean = False, Optional CveTipoGasto As Integer = -1, Optional TipoGasto As String = "", Optional PorcentajeIVA As Double = 0,
Optional PorcentajeIEPS As Double = 0, Optional PorcentajeRetIVA As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1) As Integer
Optional PorcentajeIEPS As Double = 0, Optional PorcentajeRetIVA As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1) As Integer
Dim Row As DataRow = Nothing
@@ -18026,6 +18030,8 @@ Partial Class Compras_Compras
Row("CveContratoDetalle") = CveContratoDetalle
Row("CveCultivoCuadroDetalle") = CveCultivoCuadroDetalle
If UsuarioActual.Empresa.UsaAC Then
Row("CveProgramaOperativo") = DdlACGeneral1.SelectedValue.ToEntero
Row("CveUnidadAdministrativa") = DdlACGeneral2.SelectedValue.ToEntero

View File

@@ -809,6 +809,13 @@
<ajax:ValidatorCalloutExtender ID="VCORVSubProyecto" runat="server" HighlightCssClass="vco" TargetControlID="RVSubProyecto" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:RequiredFieldValidator ID="RFVSubProyecto" runat="server" InitialValue="-1" ControlToValidate="DdlSubProyecto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''SubProyecto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpDetalleGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCORFVSubProyecto" runat="server" HighlightCssClass="vco" TargetControlID="RFVSubProyecto" Width="300px"></ajax:ValidatorCalloutExtender>
<div runat="server" id="DVCultivosCuadro" visible ="false">
<asp:DropDownList ID="DdlCultivosCuadro" CssClass=" form-control input-sm select2me" runat="server" DataTextField="Cuadro" Style="width: 100%; max-width: 600px;"
DataValueField="CveCultivoCuadroDetalle" ValidationGroup="GrpDetalleGuardar">
</asp:DropDownList>
</div>
</td>
<td id="TdActivoFijo" runat="server">
@@ -875,7 +882,7 @@
<asp:GridView ID="GvD" runat="server" AutoGenerateColumns="False" GridLines=" none" BorderColor="Transparent" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn"
DataKeyNames="SubProyecto, Cantidad, Importe, Descuento, CveOrdenCompra, CveUnidadMedida, CvePresupuestoEgreso, PS,CveClasificacion, CvePS, CveSubProyecto, CveActivoFijo, CodigoAF, TipoDato, Observacion, CveOrdenCompraDetalle,CveCompra,IVAPorcentaje,RetIVAPorcentaje,RetISRPorcentaje,IEPSPSPorcentaje,IEPSPSIVAPorcentaje,CantidadNoEditable" data-tableheader=".GVDHeader" ShowHeader="false" data-rows="0">
DataKeyNames="SubProyecto, Cantidad, Importe, Descuento, CveOrdenCompra, CveUnidadMedida, CvePresupuestoEgreso, PS,CveClasificacion, CvePS, CveSubProyecto, CveActivoFijo, CodigoAF, TipoDato, Observacion, CveOrdenCompraDetalle,CveCompra,IVAPorcentaje,RetIVAPorcentaje,RetISRPorcentaje,IEPSPSPorcentaje,IEPSPSIVAPorcentaje,CantidadNoEditable,CveCultivoCuadroDetalle" data-tableheader=".GVDHeader" ShowHeader="false" data-rows="0">
<Columns>
<asp:TemplateField>
<EditItemTemplate>
@@ -932,17 +939,33 @@
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlSubProyecto" runat="server" Text='<%# String.Format("{0}<br/>{1}", Eval("Proyecto"), Eval("SubProyecto")) %>'></asp:Literal>
<asp:Literal ID="LtlSubProyecto" runat="server" Text='<%# String.Format("{0}<br/>{1}{2}", Eval("Proyecto"), Eval("SubProyecto"), If(Eval("CveCultivoCuadroDetalle").ToString <> "" And Eval("CveCultivoCuadroDetalle").ToString <> "0" And Eval("CveCultivoCuadroDetalle").ToString <> "-1", String.Format("<br/>{0}", Eval("Cuadro")), "")) %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="DdlProyectoEdit" runat="server" Style="width: 100%" AppendDataBoundItems="true" AutoPostBack="true" CssClass=" form-control input-sm select2me" DataTextField="Proyecto" DataValueField="CveProyecto" ValidationGroup="grpEditar" OnSelectedIndexChanged="DdlProyectoEdit_SelectedIndexChanged">
<asp:ListItem Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DdlSubProyectoEdit" Style="width: 100%" runat="server" AppendDataBoundItems="true" CssClass=" form-control input-sm select2me" DataTextField="SubProyecto" DataValueField="CveSubProyecto" ValidationGroup="grpEditar">
<asp:DropDownList ID="DdlSubProyectoEdit" Style="width: 100%" runat="server" AppendDataBoundItems="true" CssClass=" form-control input-sm select2me" OnSelectedIndexChanged="DdlSubProyectoEdit_SelectedIndexChanged" AutoPostBack="true"
DataTextField="SubProyecto" DataValueField="CveSubProyecto" ValidationGroup="grpEditar">
<asp:ListItem Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DdlCultivosCuadroEdit" Visible="false" CssClass=" form-control input-sm select2me" runat="server" DataTextField="Cuadro" Style="width: 100%; max-width: 600px;"
DataValueField="CveCultivoCuadroDetalle" >
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ValidationGroup="grpEditar" ID="RFVSubProyecto" runat="server" InitialValue="-1" ControlToValidate="DdlSubProyectoEdit" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''SubProyecto''</b> es necesario, por favor ingréselo."></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCORFVSubProyecto" runat="server" HighlightCssClass="vco" TargetControlID="RFVSubProyecto" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>

View File

@@ -798,6 +798,13 @@ Partial Class OC
DdlSubProyectoContrato.DataBind()
DdlSubProyectoContrato.Items.Insert(0, New ListItem("Seleccione", "-1"))
If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then
DVCultivosCuadro.Visible = True
DdlCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
End If
'SOLO SE MUESTRA CUANDO ES REGISTRO NUEVO
If Not CveOrdenCompra > 0 Then
If UsuarioActual.Empresa.EsComercializadora And Not CveCotizacion > 0 Then
@@ -1085,6 +1092,8 @@ Partial Class OC
DtDetalle.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer))
DtDetalle.Columns.Add("CveTipoGastoObra", GetType(Integer))
DtDetalle.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
DtDetalle.Columns.Add("Cuadro", GetType(String))
'DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
@@ -2141,7 +2150,7 @@ Partial Class OC
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)
DdlACGeneral5.SelectedValue.ToEntero, RetIVA, RetISR, CveCultivoCuadroDetalle:=DdlCultivosCuadro.SelectedValue.ToEntero, Cuadro:=DdlCultivosCuadro.SelectedItem.Text)
TxtCant.Text = ""
CboUnidadMedida.SelectedIndex = 0
@@ -2171,7 +2180,8 @@ Partial Class OC
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,
CveOrdenCompraDetalle As Integer, CveOrdenCompra As Integer, IdCuentaPorEjercer As Integer, IdCuentaComprometido As Integer, CveProgramaOperativo As Integer, CveUnidadAdministrativa As Integer,
CveFuenteFinanciamiento As Integer, CveTipoGasto As Integer, CveClasificacionOG As Integer, RetIVA As Double, RetISR As Double, Optional CveContratoDetalle As Integer = -1, Optional CveTipoGastoObra As Integer = -1)
CveFuenteFinanciamiento As Integer, CveTipoGasto As Integer, CveClasificacionOG As Integer, RetIVA As Double, RetISR As Double, Optional CveContratoDetalle As Integer = -1, Optional CveTipoGastoObra As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1,
Optional Cuadro As String = "")
If DtDetalle IsNot Nothing Then
Dim dr As DataRow = DtDetalle.NewRow
@@ -2228,6 +2238,9 @@ Partial Class OC
dr("CveClasificacionOG") = CveClasificacionOG
dr("CveContratoDetalle") = CveContratoDetalle
dr("CveTipoGastoObra") = CveTipoGastoObra
dr("CveCultivoCuadroDetalle") = CveCultivoCuadroDetalle
dr("Cuadro") = Cuadro
DtDetalle.Rows.Add(dr)
@@ -2511,7 +2524,7 @@ Partial Class OC
IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble,
RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble,
RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble,
IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then
TieneError = True
Exit For
End If
@@ -2589,7 +2602,7 @@ Partial Class OC
dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, pCveOrdenCompraPadre:=CveOrdenCompraPadre, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble,
IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero,
IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble,
IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then
TieneError = True
Exit For
End If
@@ -2702,7 +2715,7 @@ Partial Class OC
'inserto los nuevos detalles
If Not TieneError Then
For Each dr As DataRow In DtDetalle.FiltraParametros("TipoDato = 0").Rows
If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then
TieneError = True
Exit For
Else
@@ -3182,7 +3195,7 @@ Partial Class OC
CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble,
RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble,
IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble,
CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then
HuboError = True
Exit For
End If
@@ -3223,7 +3236,7 @@ Partial Class OC
'CveOrdenCompra = objOrdenCompra.CveOrdenCompra
If Not HuboError Then
For Each dr As DataRow In DtDetalle.Rows
If Not objOrdenCompra.AddOrdenCompraDetalle(objOrdenCompra.CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CveOrdenCompra, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
If Not objOrdenCompra.AddOrdenCompraDetalle(objOrdenCompra.CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CveOrdenCompra, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then
HuboError = True
Exit For
End If
@@ -3729,6 +3742,18 @@ Partial Class OC
End If
End If
If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then
e.Row.FCDropDownList("DdlCultivosCuadroEdit").Visible = True
e.Row.FCDropDownList("DdlCultivosCuadroEdit").DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {e.Row.DBCampo("CveSubProyecto").ToEntero}")
e.Row.FCDropDownList("DdlCultivosCuadroEdit").DataBind()
e.Row.FCDropDownList("DdlCultivosCuadroEdit").Items.Insert(0, New ListItem("Seleccione uno", "-1"))
e.Row.FCDropDownList("DdlCultivosCuadroEdit").SelectedValueExist(e.Row.DBCampo("CveCultivoCuadroDetalle").ToEntero)
End If
e.Row.FCTextBox("LblEditCodigo").Attributes.Add("onkeyup", String.Format("EnterAFEdit(event,this,{0},{1});", e.Row.FCHiddenField("HdnCveActivoFijo").ClientID, e.Row.FCHiddenField("HdnCodigoAF").ClientID))
e.Row.FCTextBox("LblEditCodigo").Attributes.Add("onblur", String.Format("AFBlurEdit(this,{0},{1});", e.Row.FCHiddenField("HdnCveActivoFijo").ClientID, e.Row.FCHiddenField("HdnCodigoAF").ClientID))
e.Row.FCImage("ImgAF").Attributes.Add("onclick", String.Format("AbrirVentana('/AF/PopUpBuscarAF.aspx?OPCION=OCE&RI={0}',950,600,'N');", e.Row.RowIndex))
@@ -3787,8 +3812,8 @@ Partial Class OC
End Sub
Protected Sub GvD_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvD.RowUpdating
Dim Cantidad, Importe, Descuento As Double
Dim CveUnidad, CveClasificacion, CveActivoFijo, CvePS, CveSubProyecto, CveProyecto As Integer
Dim Obs, UM, Clasificacion, Codigo, PS, SubProyecto, Proyecto As String
Dim CveUnidad, CveClasificacion, CveActivoFijo, CvePS, CveSubProyecto, CveProyecto, CveCultivoCuadroDetalle As Integer
Dim Obs, UM, Clasificacion, Codigo, PS, SubProyecto, Proyecto, Cuadro As String
Dim gvr As GridViewRow = GvD.Rows(e.RowIndex)
Cantidad = gvr.FCTextBox("TxtCantEdit").Text.Trim.ToDouble
@@ -3839,6 +3864,11 @@ Partial Class OC
CveSubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedValue.ToEntero
SubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedItem.Text
CveCultivoCuadroDetalle = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedValue.ToEntero
Cuadro = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedItem.Text
If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Or UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then
CveProyecto = -1
Proyecto = "Seleccione"
@@ -3857,8 +3887,8 @@ Partial Class OC
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.ToDouble
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.ToDouble
End If
End If
If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{DateTime.Now.Year - 1}".ToDate, Now, UsuarioActual.CveEmpresa, CveProyecto,
@@ -3935,6 +3965,9 @@ Partial Class OC
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()
@@ -6830,6 +6863,18 @@ Partial Class OC
If UsuarioActual.Empresa.Funcionalidad(141) = "1" Or True Then
SeleccionaSucursal()
End If
If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then
DdlCultivosCuadro.Items.Clear()
DdlCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($" CveSubProyecto = {DdlSubProyecto.SelectedValue}")
DdlCultivosCuadro.DataBind()
DdlCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
End If
End Sub
Private Sub CargaSucursal()
DdlSucursal.DataSource = GlobalDTSubProyectos(-1).FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
@@ -8361,7 +8406,7 @@ Partial Class OC
CveUnidadMedida, IvaPS, IEPSPS, IEPSPSIVA, CveClasificacion, UMAbreviatura, Clasificacion, CveProyecto, Proyecto,
CveSubProyecto, SubProyecto, Codigo, -1, 0, -1, -1, IdCuentaPorEjercer,
IdCuentaComprometido, -1, -1, -1, -1,
-1, RetIVA, RetISR, CveContratoDetalle:=CveContratoDetalle, CveTipoGastoObra:=CveTipoGastoObra)
-1, RetIVA, RetISR, CveContratoDetalle:=CveContratoDetalle, CveTipoGastoObra:=CveTipoGastoObra, CveCultivoCuadroDetalle:=-1, Cuadro:="")
ContratoObraAplciado = True
@@ -8380,4 +8425,19 @@ Partial Class OC
End Sub
Protected Sub DdlSubProyectoEdit_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = CType(CType(sender, DropDownList).BindingContainer, GridViewRow)
Dim DdlSubProyectoEdit As DropDownList = GvRow.FCDropDownList("DdlSubProyectoEdit")
Dim DdlCultivosCuadroEdit As DropDownList = GvRow.FCDropDownList("DdlCultivosCuadroEdit")
Dim CveCultivoCuadroDetalle As Integer = GvRow.DataKey("CveCultivoCuadroDetalle").ToString.ToEntero
DdlCultivosCuadroEdit.Items.Clear()
DdlCultivosCuadroEdit.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoEdit.SelectedValue}")
DdlCultivosCuadroEdit.DataBind()
DdlCultivosCuadroEdit.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
DdlCultivosCuadroEdit.SelectedValueExist(CveCultivoCuadroDetalle)
End Sub
End Class