Пример #1
0
        private void ugItems_CellChange(object sender, CellEventArgs e)
        {
            try
            {
                ItemRendicionCotizacion Item = (ItemRendicionCotizacion)e.Cell.Row.Tag;
                switch (e.Cell.Column.Key)
                {
                case colCantidadReal:
                    Item.CantidadReal = Convert.ToDecimal(e.Cell.Text.Replace('_', ' '));
                    Item.TotalReal    = Item.CantidadReal * Item.PrecioReal;
                    MostrarItem(e.Cell.Row);
                    MostrarTotales();
                    break;

                case colPrecioReal:
                    Item.PrecioReal = Convert.ToDecimal(e.Cell.Text.Replace('_', ' '));
                    Item.TotalReal  = Item.CantidadReal * Item.PrecioReal;
                    MostrarItem(e.Cell.Row);
                    MostrarTotales();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                SoftException.Control(ex);
            }
        }
Пример #2
0
 private void ubNuevo_Click(object sender, EventArgs e)
 {
     try
     {
         FrmSelectedEntity FrmSeleccionar = new FrmSelectedEntity();
         Existencia        servicio       = (Existencia)FrmSeleccionar.GetSelectedEntity(typeof(Existencia), "Selección de Servicios");
         if (servicio != null)
         {
             ItemRendicionCotizacion item = new ItemRendicionCotizacion();
             item.Codigo             = servicio.Codigo;
             item.Descripcion        = servicio.Nombre;
             item.CantidadCotizacion = 0;
             item.PrecioCotizacion   = 0;
             item.TotalCotizacion    = 0;
             item.CantidadReal       = 0;
             item.PrecioReal         = 0;
             item.TotalReal          = 0;
             RendicionCotizacion.Items.Add(item);
             MostrarItems();
             MostrarTotales();
         }
     }
     catch (Exception ex)
     {
         SoftException.Control(ex);
     }
 }
Пример #3
0
        public void MostrarItem(UltraGridRow Row)
        {
            ItemRendicionCotizacion Item = (ItemRendicionCotizacion)Row.Tag;

            Row.Cells[colCodigo].Value             = Item.Codigo;
            Row.Cells[colDescripcion].Value        = Item.Descripcion;
            Row.Cells[colUnidad].Value             = Item.Unidad;
            Row.Cells[colCantidadCotizacion].Value = Item.CantidadCotizacion;
            Row.Cells[colPrecioCotizacion].Value   = Item.PrecioCotizacion;
            Row.Cells[colTotalCotizacion].Value    = Item.TotalCotizacion;
            Row.Cells[colCantidadReal].Value       = Item.CantidadReal;
            Row.Cells[colPrecioReal].Value         = Item.PrecioReal;
            Row.Cells[colTotalReal].Value          = Item.TotalReal;
        }
        public override void Start()
        {
            try
            {
                Cotizacion Cotizacion = (Cotizacion)base.m_ObjectFlow;

                if (!Cotizacion.EstadoAprobacion.Equals("APROBADO"))
                {
                    throw new Exception(String.Format("La Cotización Nº : {0} aún no ha sido APROBADA.", Cotizacion.Numeracion));
                }

                if (Cotizacion.EstadoRendicion.Equals("TOTAL"))
                {
                    throw new Exception(String.Format("La Cotización Nº : {0} ya ha sido RENDIDA.", Cotizacion.Numeracion));
                }

                RendicionCotizacion Rendicion = new RendicionCotizacion();
                Rendicion.IDCotizacion     = Cotizacion.ID;
                Rendicion.NumeroCotizacion = Cotizacion.Numeracion;
                foreach (ItemCotizacion ItemCotizacion in Cotizacion.Items)
                {
                    if (ItemCotizacion.Maquina != null)
                    {
                        ItemRendicionCotizacion ItemRendicion = new ItemRendicionCotizacion();
                        ItemRendicion.Codigo             = ItemCotizacion.Maquina.Codigo;
                        ItemRendicion.Descripcion        = ItemCotizacion.Maquina.Descripcion;
                        ItemRendicion.CantidadCotizacion = 1;
                        ItemRendicion.PrecioCotizacion   = ItemCotizacion.CostoMaquina;
                        ItemRendicion.TotalCotizacion    = ItemCotizacion.CostoMaquina / 1;
                        ItemRendicion.CantidadReal       = 1;
                        ItemRendicion.PrecioReal         = ItemCotizacion.CostoMaquina;
                        ItemRendicion.TotalReal          = ItemCotizacion.CostoMaquina / 1;
                        Rendicion.Items.Add(ItemRendicion);
                    }
                    foreach (ItemCotizacionServicio ItemServicio in ItemCotizacion.Servicios)
                    {
                        if (ItemServicio.Servicio != null && ItemServicio.UnidadServicio != null)
                        {
                            ItemRendicionCotizacion ItemRendicion = new ItemRendicionCotizacion();
                            ItemRendicion.Codigo             = ItemServicio.Servicio.Codigo;
                            ItemRendicion.Descripcion        = ItemServicio.Servicio.Descripcion;
                            ItemRendicion.Unidad             = ItemServicio.UnidadServicio.Unidad.Codigo;
                            ItemRendicion.CantidadCotizacion = ItemServicio.CantidadServicio;
                            ItemRendicion.PrecioCotizacion   = ItemServicio.CostoServicio / ItemServicio.CantidadServicio;
                            ItemRendicion.TotalCotizacion    = ItemServicio.CostoServicio;
                            ItemRendicion.CantidadReal       = ItemServicio.CantidadServicio;
                            ItemRendicion.PrecioReal         = ItemServicio.CostoServicio / ItemServicio.CantidadServicio;
                            ItemRendicion.TotalReal          = ItemServicio.CostoServicio;
                            Rendicion.Items.Add(ItemRendicion);
                        }
                        if (ItemServicio.Maquina != null && ItemServicio.UnidadMaquina != null)
                        {
                            ItemRendicionCotizacion ItemRendicion = new ItemRendicionCotizacion();
                            ItemRendicion.Codigo             = ItemServicio.Maquina.Codigo;
                            ItemRendicion.Descripcion        = ItemServicio.Maquina.Descripcion;
                            ItemRendicion.Unidad             = ItemServicio.UnidadMaquina.Codigo;
                            ItemRendicion.CantidadCotizacion = ItemServicio.CantidadMaquina;
                            ItemRendicion.PrecioCotizacion   = ItemServicio.CostoMaquina / ItemServicio.CantidadMaquina;
                            ItemRendicion.TotalCotizacion    = ItemServicio.CostoMaquina;
                            ItemRendicion.CantidadReal       = ItemServicio.CantidadMaquina;
                            ItemRendicion.PrecioReal         = ItemServicio.CostoMaquina / ItemServicio.CantidadMaquina;
                            ItemRendicion.TotalReal          = ItemServicio.CostoMaquina;
                            Rendicion.Items.Add(ItemRendicion);
                        }
                    }
                }
                base.m_ObjectFlow    = Rendicion;
                base.m_EntidadSF     = (EntidadSF)HelperNHibernate.GetEntityByField("EntidadSF", "NombreClase", "RendicionCotizacion");
                base.m_ResultProcess = EnumResult.SUCESS;
            }
            catch (Exception ex)
            {
                base.m_ResultProcess = EnumResult.ERROR;
                SoftException.ShowException(ex);
            }
            base.Start();
        }