public AdministracionGeneracionOPControl()
        {
            InitializeComponent();

            Context = new CooperativaProduccionEntities();

            _liquidaciones = new LiquidacionesParaOPViewModel()
            {
                Retenciones = new List <RetencionDetalleViewModel>(),
                Items       = new List <LiquidacionParaOPViewModel>()
            };

            _pagosManager      = new PagosManager();
            _messageBoxService = new MessageBoxService();

            // Generacion de Ordenes de Pago
            this.btnBuscarLiquidaciones.Click += this.btnBuscarLiquidaciones_Click;

            this.txtPorcentajePago.KeyPress += this.txtPorcentajePago_KeyPress;
            this.btnPorcentajePago.Click    += this.btnPorcentajePago_Click;
            this.txtPagoPorKilo.KeyPress    += this.txtPagoPorKilo_KeyPress;
            this.btnPagoPorKilo.Click       += this.btnPagoPorKilo_Click;

            this.btnGenerarOP.Click += this.btnGenerarOP_Click;

            this.gridViewLiquidacion.SelectionChanged        += gridViewLiquidacion_SelectionChanged;
            this.gridViewLiquidacion.CustomUnboundColumnData += gridViewLiquidacion_CustomUnboundColumnData;
        }
        public void BuscarLiquidacionesEnKilos(DateTime desde, DateTime hasta)
        {
            var kilosapagar = this.KilosPorPagar;

            _liquidaciones = _pagosManager.ListarLiquidacionesParaPagarEnKilos(kilosapagar, desde, hasta);

            ActualizarControlesGeneracionDeOrdenes();
        }
        public void BuscarLiquidacionesEnPorcentaje(DateTime desde, DateTime hasta)
        {
            var porcentajedepago = this.PorcentajePorPagar;

            _liquidaciones = _pagosManager.ListarLiquidacionesParaPagarEnPorcentaje(porcentajedepago, desde, hasta);

            ActualizarControlesGeneracionDeOrdenes();
        }
        public void BuscarLiquidaciones(DateTime desde, DateTime hasta)
        {
            _liquidaciones = _pagosManager.ListarLiquidacionesParaPagarEnPorcentaje(100, desde, hasta);//(porcentajedepago, desde, hasta);

            ActualizarControlesGeneracionDeOrdenes();
        }
        public void BuscarLiquidaciones()
        {
            _liquidaciones = _pagosManager.ListarLiquidacionesParaPagarEnPorcentaje(100);//(porcentajedepago);

            ActualizarControlesGeneracionDeOrdenes();
        }
Esempio n. 6
0
        private LiquidacionesParaOPViewModel _GetLiquidaciones(List <Vw_RomaneoOrdenPago> entities)
        {
            decimal coeficiente = decimal.Parse("1.21");

            // VALORES DE PRUEBA
            //decimal iva = decimal.Parse("21");
            //decimal gcias = decimal.Parse("0.02");
            //decimal iibb = decimal.Parse("0.0175");
            //decimal coeficientegral = decimal.Parse("0.5");

            var ordenes = new List <LiquidacionParaOPViewModel>();

            foreach (var x in entities)
            {
                var orden = new LiquidacionParaOPViewModel()
                {
                    PesadaId    = x.PesadaId,
                    ProductorId = x.ProductorId.Value,
                    NumeroDeLiquidacionInterno = x.NumInternoLiquidacion,
                    NumeroDeLiquidacionDeAFIP  = x.NumAfipLiquidacion,
                    FechaDeLiquidacionDeAFIP   = x.FechaAfipLiquidacion,
                    NombreDeProductor          = x.NOMBRE,
                    NumeroDeFET        = x.nrofet,
                    TotalEnKilos       = x.TotalKg,
                    ImporteBrutoSinIVA = x.ImporteBruto.Value,
                    ImportePorPagar    = decimal.Round(Convert.ToDecimal(x.Importeporpagar.Value), 2, MidpointRounding.AwayFromZero), // decimal.Round((x.ImporteBruto.Value * porcentajeporpagar) / 100, 2, MidpointRounding.AwayFromZero),
                    NetoPorPagar       = 0.0m
                };

                var retencionesAplicadas = new List <RetencionAplicadaDetalleViewModel>()
                {
                    new RetencionAplicadaDetalleViewModel()
                    {
                        Nombre     = RetencionTypes.RetencionGCIAS,
                        Porcentaje = x.GANANCIA.Value,
                        Base       = Convert.ToDecimal(x.BASEGANANCIA),
                        UsaBase    = true,
                        Importe    = _CalcularImporteDeRetencion(
                            Convert.ToDecimal(x.BASEGANANCIA),
                            coeficiente,
                            x.GANANCIA.Value)
                    },
                    new RetencionAplicadaDetalleViewModel()
                    {
                        Nombre     = RetencionTypes.RetencionIIBB,
                        Porcentaje = x.IIBB.Value,
                        UsaBase    = false,
                        Importe    = _CalcularImporteDeRetencion(
                            orden.ImportePorPagar,
                            coeficiente,
                            x.IIBB.Value)
                    },
                    new RetencionAplicadaDetalleViewModel()
                    {
                        Nombre     = RetencionTypes.RetencionSaludPublica,
                        Porcentaje = x.SP.Value,
                        Base       = 0.0m,
                        UsaBase    = false,
                        Importe    = _CalcularImporteDeRetencion(
                            orden.ImportePorPagar,
                            coeficiente,
                            x.SP.Value)
                    },
                    new RetencionAplicadaDetalleViewModel()
                    {
                        Nombre     = RetencionTypes.RetencionEEAOC,
                        Porcentaje = x.EEAOC.Value,
                        Base       = 0.0m,
                        UsaBase    = false,
                        Importe    = _CalcularImporteDeRetencion(
                            orden.ImportePorPagar,
                            coeficiente,
                            x.EEAOC.Value)
                    },
                    new RetencionAplicadaDetalleViewModel()
                    {
                        Nombre     = RetencionTypes.RetencionRiego,
                        Porcentaje = x.RIEGO.Value,
                        Base       = 0.0m,
                        UsaBase    = false,
                        Importe    = _CalcularImporteDeRetencion(
                            orden.ImportePorPagar,
                            coeficiente,
                            x.RIEGO.Value)
                    },
                    new RetencionAplicadaDetalleViewModel()
                    {
                        Nombre     = RetencionTypes.RetencionGADM,
                        Porcentaje = x.GADM.Value,
                        Base       = 0.0m,
                        UsaBase    = false,
                        Importe    = _CalcularImporteDeRetencion(
                            orden.ImportePorPagar,
                            coeficiente,
                            x.GADM.Value)
                    }
                };

                orden.RetencionesAplicadas = retencionesAplicadas;

                var neto = orden.ImportePorPagar;

                foreach (var item in orden.RetencionesAplicadas)
                {
                    neto -= item.Importe;
                }

                orden.NetoPorPagar = neto;

                ordenes.Add(orden);
            }

            ordenes = ordenes.OrderByDescending(x => x.FechaDeLiquidacionDeAFIP)
                      .ThenBy(x => x.NumeroDeFET)
                      .ToList();

            var result = new LiquidacionesParaOPViewModel()
            {
                CoeficienteDeRetenciones = coeficiente,
                Retenciones = new List <RetencionDetalleViewModel>()
                {
                    new RetencionDetalleViewModel()
                    {
                        Nombre      = RetencionTypes.RetencionGCIAS,
                        Descripcion = String.Empty
                    },
                    new RetencionDetalleViewModel()
                    {
                        Nombre      = RetencionTypes.RetencionIIBB,
                        Descripcion = String.Empty
                    },
                    new RetencionDetalleViewModel()
                    {
                        Nombre      = RetencionTypes.RetencionSaludPublica,
                        Descripcion = String.Empty
                    },
                    new RetencionDetalleViewModel()
                    {
                        Nombre      = RetencionTypes.RetencionEEAOC,
                        Descripcion = String.Empty
                    },
                    new RetencionDetalleViewModel()
                    {
                        Nombre      = RetencionTypes.RetencionRiego,
                        Descripcion = String.Empty
                    },
                    new RetencionDetalleViewModel()
                    {
                        Nombre      = RetencionTypes.RetencionGADM,
                        Descripcion = String.Empty
                    }
                },
                Items = ordenes
            };

            return(result);
        }