From c8ceac00b18bdde74086ffbc791c44ff4079d101 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 17 Nov 2020 09:02:08 -0700 Subject: [PATCH 1/7] Global de tipos de contrato --- Contratos/CatContratosTipos.aspx.vb | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Contratos/CatContratosTipos.aspx.vb b/Contratos/CatContratosTipos.aspx.vb index f0bdc4aea..7b36b4837 100644 --- a/Contratos/CatContratosTipos.aspx.vb +++ b/Contratos/CatContratosTipos.aspx.vb @@ -16,8 +16,7 @@ Partial Class Contratos_CatContratosTipos Private Sub CargaDatos() Dim Objeto As New ClsContratos If Objeto.GetContratosTipos(UsuarioActual.CveEmpresa) Then - GvContratos.DataSource = Objeto.DtResultados - GlobalDTContratosTipos(UsuarioActual.CveEmpresa) = Objeto.DtResultados + GvContratos.DataSource = Objeto.DtResultados End If GvContratos.DataBind() Objeto.Dispose() @@ -40,9 +39,10 @@ Partial Class Contratos_CatContratosTipos UpDatos.Update() End If - Objeto.Dispose() - Alert("El Contrato se agregó correctamente.", TipoMensaje.MsgInformacion) + RecargaGlobal() + Alert("El Contrato se agregó correctamente.", TipoMensaje.MsgInformacion) + End Sub @@ -72,6 +72,7 @@ Partial Class Contratos_CatContratosTipos End If GvContratos.EditIndex = -1 CargaDatos() + RecargaGlobal() UpDatos.Update() End Sub @@ -92,10 +93,14 @@ Partial Class Contratos_CatContratosTipos Objeto.Dispose() GvContratos.EditIndex = -1 CargaDatos() - End Sub - - + RecargaGlobal() + End Sub + Private Sub RecargaGlobal() + GlobalDTContratosTipos(-1) = Nothing + End Sub + + #End Region - - + + End Class From edb8c16ab6c2d32b2a5884169278f55a8f8b29aa Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Mon, 23 Nov 2020 16:16:18 -0700 Subject: [PATCH 2/7] =?UTF-8?q?Contratos=20pesta=C3=B1a=20gastos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsContratos.vb | 80 +++- Contratos/ContratoObra.aspx | 225 +++++++++- Contratos/ContratoObra.aspx.vb | 765 ++++++++++++++++++++------------- 3 files changed, 760 insertions(+), 310 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index fb7ca7697..74b4d1432 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -146,6 +146,7 @@ Public Class ClsContratos Public Property Ubicacion As String Public Property Responsable As String Public Property Lugar As String + Public Property LimiteDeGasto As Double Public Property CveSubProyecto As Integer Public Property SubProyectoContrato As String Public Property CveProyecto As Integer @@ -291,7 +292,8 @@ Public Class ClsContratos Me.FechaVenc = Data.Rows(0)("FechaVenc").ToString.ToDate Me.CveVendedor = Data.Rows(0)("CveVendedor").ToString.ToEntero Me.ImporteTotal = Data.Rows(0)("ImporteTotal").ToString.ToDecimal - Me.Lugar = Data.Rows(0)("Lugar").ToString + Me.Lugar = Data.Rows(0)("Lugar").ToString + Me.LimiteDeGasto = Data.Rows(0)("LimiteDeGasto").ToString.ToDouble Observaciones = Data.Rows(0)("Observaciones").ToString CveDireccionEnvio = Data.Rows(0)("CveDireccionEnvio").ToString.ToEntero @@ -543,7 +545,7 @@ Public Class ClsContratos Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, - Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional Lugar As String = "") As Integer + Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional Lugar As String = "", Optional LimiteDeGasto As Double = 0) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Con_ContratosObraAdd") @@ -595,6 +597,7 @@ Public Class ClsContratos .Add("@AplicaImpuestosLocales", SqlDbType.Bit).Value = If(AplicaImpuestosLocales, 1, 0) .Add("@CorreoNotificacionPedDev", SqlDbType.VarChar).Value = CorreoNotificacionPedDev .Add("@Lugar", SqlDbType.VarChar).Value = Lugar + .Add("@LimiteDeGasto", SqlDbType.Money).Value = LimiteDeGasto .Add("@CveContrato", SqlDbType.Int).Direction = ParameterDirection.Output @@ -621,7 +624,7 @@ Public Class ClsContratos CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, - Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional Lugar As String = "") As Boolean + Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional Lugar As String = "", Optional LimiteDeGasto As Double = 0) As Boolean Dim Retorno = False DataAdapter("PA_Con_ContratosObraUpdate") @@ -671,7 +674,8 @@ Public Class ClsContratos .Add("@CveDireccionEnvio", SqlDbType.Int).Value = CveDireccionEnvio .Add("@AplicaImpuestosLocales", SqlDbType.Bit).Value = If(AplicaImpuestosLocales, 1, 0) .Add("@CorreoNotificacionPedDev", SqlDbType.VarChar).Value = CorreoNotificacionPedDev - .Add("@Lugar", SqlDbType.VarChar).Value = Lugar + .Add("@Lugar", SqlDbType.VarChar).Value = Lugar + .Add("@LimiteDeGasto", SqlDbType.Money).Value = LimiteDeGasto End With @@ -824,6 +828,74 @@ Public Class ClsContratos #End Region +#Region "GASTOS OBRA" + + + + + Public Function GetContratosObragGastosVeiculos(CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Con_ContratosObraGastosVeiculosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar los gastos de veiculos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + + Public Function GetContratosObragGastosCompras(CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Con_ContratosObraGastosComprasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar los gastos de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + Public Function GetContratosObragGastosNomina(CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Con_ContratosObraGastosNominaGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar los gastos de nomina.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + + #Region "C I C L O C O M E R C I A L" Public Function CicloComercialAdd(CveContrato As Integer, CveCotizacion As Integer, CveCliente As Integer, FueFacturado As Boolean, CveFactura As Integer, Estatus As Integer, CveEmpresa As Integer, FechaVenc As Date) As Boolean Dim Retorno As Boolean = False diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx index b710ac331..e3ccfab73 100644 --- a/Contratos/ContratoObra.aspx +++ b/Contratos/ContratoObra.aspx @@ -97,6 +97,11 @@ Agregar Presupuesto Interno + +
  • + Agregar Gasto +
  • + @@ -570,10 +575,20 @@ --%> + +
    + +
    + + +
    +
    +
    - + +
    @@ -1647,6 +1662,156 @@ + + + + + + + + +
    +
    + + + + + + + + + +
    Contrato:Gastos:Nomina:Indirectos:%Gasto:
    + +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    vehículos
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    Compras
    +
    +
    + + + + + + + + + + + + + + + + +
    +
    +
    + +
    + + +
    +
    + +
    +
    +
    + +
    +
    Nomina
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    + +
    + + + + + +
    +
    + + +
    +
    + @@ -2039,7 +2204,11 @@ - + + + + + <%-- @@ -2050,7 +2219,7 @@ - + --%> @@ -2761,14 +2930,11 @@ <%--Modal Carga Presupuesto--%> - - - - + @@ -2046,53 +2046,53 @@ " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> - +

    - - + + - - - - - - - - - - -   + + + + + + + + + + +   - - - - -   + + + + +   - - - - -   + + + + +   - - - - - - - - - - - - -
    + + + + + + + + + + + + +
    @@ -4188,7 +4188,7 @@ - + @@ -4197,7 +4197,7 @@ - + @@ -4210,6 +4210,31 @@ +
    +
    +
    +
    + + Saldo de Cliente +
    +
    +
    +
    +
    +
    +
    + + + + + + + +
    +
    +
    @@ -4302,8 +4327,8 @@ --%> + - @@ -4577,14 +4602,9 @@

    - - + + -
    diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index f6fcd022c..be55071aa 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -9161,6 +9161,11 @@ Partial Class Clientes End If + If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate) Then + GvUsadosResumen.DataSource = ObjAcum.DtResultados + End If + GvUsadosResumen.DataBind() + 'LnkFacturaUsadosCargos.Visible = If(ImporteCargo > 0, True, False) LnkFacturaUsadosBonificacion.Visible = If(ImporteBonificacion > 0, True, False) From 92b3d0d05fb08ff03f65e090a40f14086ef7ffc7 Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Tue, 24 Nov 2020 18:01:03 -0700 Subject: [PATCH 7/7] Cultivos OC y vinculacion en compras --- App_Code/ClsCompras.vb | 4 ++- App_Code/ClsGenerales.vb | 32 ++++++++++++++++++++++ App_Code/ClsPaginas.vb | 36 +++++++++++++++++++++++++ Compras/Compras.aspx.vb | 12 ++++++--- OC/OC.aspx | 27 +++++++++++++++++-- OC/OC.aspx.vb | 58 +++++++++++++++++++++++++++++++--------- 6 files changed, 151 insertions(+), 18 deletions(-) diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index 11f45eec7..825a06a64 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -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 diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 16d1f7a61..59017b394 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -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 diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 0cceddab1..b1d582319 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -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) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 8f1c3a848..6760d633d 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -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 @@ -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 diff --git a/OC/OC.aspx b/OC/OC.aspx index 2c413b4c3..d4dce1d93 100644 --- a/OC/OC.aspx +++ b/OC/OC.aspx @@ -809,6 +809,14 @@ + +
    + + + +
    + @@ -875,7 +883,7 @@ + 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"> @@ -932,17 +940,32 @@ - + + + + + + + + + + + + + + + diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 5bbe07768..ce5dfb98d 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -798,6 +798,14 @@ 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.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa) + DdlCultivosCuadro.DataBind() + 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 +1093,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 +2151,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 +2181,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 +2239,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 +2525,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 +2603,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 +2716,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 +3196,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 +3237,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 +3743,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) + 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 +3813,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 +3865,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 +3888,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 +3966,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() @@ -8361,7 +8395,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