void txtPrecioConIva_Validating(object sender, CancelEventArgs e)
        {
            DevExpress.XtraEditors.CalcEdit Editor = (DevExpress.XtraEditors.CalcEdit) this.gridControl1.MainView.ActiveEditor;
            if (!Editor.IsModified)
            {
                return;
            }
            Plato plato = (Plato)this.bs.Current;

            plato.PrecioConIva = Basicas.Round((double)Editor.Value);
            plato.Precio       = Basicas.Round(plato.PrecioConIva / (1 + (plato.TasaIva) / 100));
        }
예제 #2
0
        void btnAumento_Click(object sender, EventArgs e)
        {
            if (!Basicas.IsNumeric(toolPorcentaje.Text))
            {
                toolPorcentaje.Text = "0";
                return;
            }
            double Aumento = Convert.ToDouble(toolPorcentaje.Text);

            foreach (Plato p in db.Platos)
            {
                p.PrecioConIva = p.PrecioConIva + (p.PrecioConIva * Aumento / 100);
                p.Precio       = Basicas.Round(p.PrecioConIva.GetValueOrDefault(0) / (1 + (p.TasaIva.GetValueOrDefault(0) / 100)));
            }
            this.gridControl1.RefreshDataSource();
        }
예제 #3
0
        public void Totalizar(bool Servicio, double descuento, double?tasaIva)
        {
            foreach (FacturasPlato item in this.FacturasPlatos.Where(x => x.TasaIva > 0))
            {
                item.TasaIva      = tasaIva;
                item.PrecioConIva = Basicas.Round(item.Precio + (item.Precio * tasaIva / 100));
                item.Total        = item.PrecioConIva * item.Cantidad;
            }
            this.MontoExento   = this.FacturasPlatos.Where(x => x.TasaIva == 0).Sum(x => x.Cantidad * x.Precio);
            this.MontoGravable = this.FacturasPlatos.Where(x => x.TasaIva > 0).Sum(x => x.Cantidad * x.Precio);
            if (Servicio)
            {
                this.MontoServicio = Basicas.Round((MontoGravable.GetValueOrDefault(0) + MontoExento.GetValueOrDefault(0)) * 0.1);
            }

            this.MontoIva   = this.FacturasPlatos.Where(x => x.TasaIva > 0).Sum(x => x.Cantidad * x.Precio * tasaIva / 100);
            this.MontoTotal = this.MontoGravable.GetValueOrDefault(0) + this.MontoExento.GetValueOrDefault(0) + this.MontoIva.GetValueOrDefault(0) + this.MontoServicio.GetValueOrDefault(0);
            this.MontoTotal = this.MontoTotal - (this.MontoTotal * descuento / 100);
            this.calcularSaldo();
        }
예제 #4
0
        private void Aceptar_Click(object sender, EventArgs e)
        {
            try
            {
                platoBindingSource.EndEdit();
                registro        = (Plato)platoBindingSource.Current;
                registro.Precio = Basicas.Round(registro.PrecioConIva.GetValueOrDefault(0) / (1 + (registro.TasaIva.GetValueOrDefault(0) / 100)));
                if (string.IsNullOrEmpty(registro.Codigo))
                {
                    throw new Exception("Error codigo no puede estar vacio");
                }
                if (string.IsNullOrEmpty(registro.Grupo))
                {
                    throw new Exception("Error el grupo no puede estar vacio");
                }
                if (registro.Codigo.Length > 6)
                {
                    throw new Exception("Error codigo no puede tener mas de 6 caracteres");
                }
                if (registro.Grupo.Length > 20)
                {
                    throw new Exception("Error grupo no puede tener mas de 20 caracteres");
                }
                this.DialogResult = DialogResult.OK;
                if (esNuevo)
                {
                    if (registro.IdPlato == null)
                    {
                        registro.IdPlato = FactoryContadores.GetMax("IdPlato");
                        registro.Activo  = true;
                    }
                }
                foreach (PlatosIngrediente p in registro.PlatosIngredientes)
                {
                    if (p.IdPlatoIngrediente == null)
                    {
                        p.IdPlatoIngrediente = FactoryContadores.GetMax("IdPlatoIngrediente");
                    }
                }
                foreach (PlatosContorno p in registro.PlatosContornos)
                {
                    if (p.IdPlatoContorno == null)
                    {
                        p.IdPlatoContorno = FactoryContadores.GetMax("IdPlatoContorno");
                    }
                }
                foreach (PlatosComentario p in registro.PlatosComentarios)
                {
                    if (p.IdPlatoComentario == null)
                    {
                        p.IdPlatoComentario = FactoryContadores.GetMax("IdPlatoComentario");
                    }
                }
                foreach (PlatosCombo p in registro.PlatosCombos)
                {
                    if (p.IdPlatoCombo == null)
                    {
                        p.IdPlatoCombo = FactoryContadores.GetMax("IdPlatoCombo");
                    }
                }

                if (esNuevo)
                {
                    db.Platos.AddObject(registro);
                }
                db.SaveChanges();
                FactoryPlatos.ActualizarCosto(registro);
                this.Close();
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                if (ex.InnerException != null)
                {
                    s = ex.InnerException.Message;
                }
                else
                {
                    MessageBox.Show("Error al guardar los datos:" + s, "Atencion", MessageBoxButtons.OK);
                }
            }
        }
예제 #5
0
 void PrecioConIvaCalcEdit_Validating(object sender, CancelEventArgs e)
 {
     DevExpress.XtraEditors.CalcEdit editor = (DevExpress.XtraEditors.CalcEdit)sender;
     registro.PrecioConIva = (double)editor.Value;
     registro.Precio       = Basicas.Round(registro.PrecioConIva.GetValueOrDefault(0) / (1 + (registro.TasaIva.GetValueOrDefault(0) / 100)));
 }
예제 #6
0
 void PrecioConIvaCalcEdit_Validating(object sender, CancelEventArgs e)
 {
     platoBindingSource.EndEdit();
     registro.Precio = Basicas.Round(registro.PrecioConIva.GetValueOrDefault(0) / (1 + (registro.TasaIva.GetValueOrDefault(0) / 100)));
 }