private void button3_Click(object sender, EventArgs e) { cotizaciones_local cotizaciones = new cotizaciones_local(); var modulos = (from x in cotizaciones.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (modulos != null) { Bitmap bm = new Bitmap(tableLayoutPanel1.Width, tableLayoutPanel1.Height); tableLayoutPanel1.DrawToBitmap(bm, new Rectangle(0, 0, tableLayoutPanel1.Width, tableLayoutPanel1.Height)); Bitmap gm_2 = new Bitmap(bm, 120, 105); modulos.pic = constants.imageToByte(gm_2); modulos.dir = 3; bm = null; gm_2 = null; modulos.new_desing = setNewDesing(); cotizaciones.SaveChanges(); if (Application.OpenForms["articulos_cotizacion"] != null) { ((articulos_cotizacion)Application.OpenForms["articulos_cotizacion"]).reloadModulos(); } if (Application.OpenForms["edit_expresss"] != null) { ((edit_expresss)Application.OpenForms["edit_expresss"]).reloadALL(); } this.Close(); } }
// //Cargar esquemas inherentes private void cargarEsquemasInherentes() { cotizaciones_local cotizaciones = new cotizaciones_local(); var modulo_c = (from x in cotizaciones.modulos_cotizaciones where x.merge_id == id select x); if (modulo_c != null) { foreach (var n in modulo_c) { listas_entities_pva listas = new listas_entities_pva(); int modulo_id = (int)n.modulo_id; var modulo = (from x in listas.modulos where x.id == modulo_id select x).SingleOrDefault(); if (modulo != null) { int id_diseño = (int)modulo.id_diseño; var diseño = (from x in listas.esquemas where x.id == id_diseño select x).SingleOrDefault(); if (diseño != null) { string[] e = diseño.esquemas.ToString().Split(','); foreach (string v in e) { if (v != "") { treeView2.Nodes[0].Nodes.Add(v); } } } } } } }
private float getMedidas(int id, string dimension) { cotizaciones_local cotizaciones = new cotizaciones_local(); var modulos = (from x in cotizaciones.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (modulos != null) { if (dimension == "largo") { return((float)modulos.largo); } else if (dimension == "alto") { return((float)modulos.alto); } else { return(0); } } else { return(0); } }
private void añadirConcepto(int id) { cotizaciones_local cotizaciones = new cotizaciones_local(); var modulos = (from x in cotizaciones.modulos_cotizaciones where x.merge_id == merged_id select x).Count(); if (modulos < 5) { if (datagridviewNE2.Rows.Count <= 0) { borrarImagenPredeterminada(merged_id); } setDir dir = new setDir(id, merged_id, img, getMedidas(id, "largo"), getMedidas(id, "alto")); dir.ShowDialog(); if (dir.close == true) { cargarMergedItems(merged_id); cargarModulosCotizados(); } } else { MessageBox.Show("[Error] este concepto ya tiene demaciados artículos.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void insertarCortes(string clave, string articulo, int modulo_id, string partida, float longitud_corte, float tramo_perfil, string acabado, float cantidad) { cotizaciones_local cotizaciones = new cotizaciones_local(); try { var p = new corte() { clave = clave, articulo = articulo, modulo_id = modulo_id, partida = partida, longitud_corte = longitud_corte, tramo_perfil = tramo_perfil, acabado = acabado, cantidad = cantidad }; cotizaciones.cortes.Add(p); cotizaciones.SaveChanges(); } catch (Exception err) { constants.errorLog(err.ToString()); } }
//Set Data to Report private void setData(int id, byte[] pic, string descripcion, string observaciones, string ubicacion, string medidas, string vista, string apertura, string aluminio, string cristal, string otros, string herrajes, int cantidad) { try { cotizaciones_local data = new cotizaciones_local(); produccion_t p = new produccion_t() { id = id, pic = pic, ubicacion = ubicacion, descripcion = descripcion, observaciones = observaciones, medidas = medidas, vista = vista, apertura = apertura, aluminio = aluminio, cristal = cristal, otros = otros, herrajes = herrajes, cantidad = cantidad }; data.produccion_t.Add(p); data.SaveChanges(); } catch (Exception err) { constants.errorLog(err.ToString()); } }
private void updateMateriales(string c_clave, float cant, float m_lineales, float m_cuadrados, string acabado = "") { cotizaciones_local cotizaciones = new cotizaciones_local(); try { if (acabado != "") { var materiales = (from x in cotizaciones.materiales_modulos where x.clave == c_clave && x.acabado == acabado select x).SingleOrDefault(); if (materiales != null) { materiales.cantidad = materiales.cantidad + cant; materiales.metros_lineales = materiales.metros_lineales + m_lineales; materiales.metros_cuadrados = materiales.metros_cuadrados + m_cuadrados; } cotizaciones.SaveChanges(); } else { var materiales = (from x in cotizaciones.materiales_modulos where x.clave == c_clave select x).SingleOrDefault(); if (materiales != null) { materiales.cantidad = materiales.cantidad + cant; materiales.metros_lineales = materiales.metros_lineales + m_lineales; materiales.metros_cuadrados = materiales.metros_cuadrados + m_cuadrados; } cotizaciones.SaveChanges(); } } catch (Exception err) { constants.errorLog(err.ToString()); } }
private void insertarMateriales(int concepto, string clave, string articulo, float cant, float m_lineales, float m_cuadrados, string acabado = "", float largo_perfil = 0) { cotizaciones_local cotizaciones = new cotizaciones_local(); try { var p = new materiales_modulos() { concepto = concepto, clave = clave, articulo = articulo, cantidad = cant, metros_lineales = m_lineales, metros_cuadrados = m_cuadrados, acabado = acabado, largo_perfil = largo_perfil }; cotizaciones.materiales_modulos.Add(p); cotizaciones.SaveChanges(); } catch (Exception err) { constants.errorLog(err.ToString()); } }
private void button1_Click(object sender, EventArgs e) { cotizaciones_local cotizaciones = new cotizaciones_local(); cotizaciones.Database.ExecuteSqlCommand("TRUNCATE TABLE copybox"); cotizaciones.Database.ExecuteSqlCommand("DBCC CHECKIDENT (copybox, RESEED, 1)"); loadCopy(); datagridviewNE1.Refresh(); }
private void borrarImagenPredeterminada(int perso_id) { cotizaciones_local cotizaciones = new cotizaciones_local(); var concepto = (from x in cotizaciones.modulos_cotizaciones where x.id == perso_id select x).SingleOrDefault(); if (concepto != null) { concepto.pic = null; } cotizaciones.SaveChanges(); }
private void setFactor(cotizaciones_local cotizaciones) { var desglose = from x in cotizaciones.materiales_modulos select x; foreach (var x in desglose) { x.cantidad = x.cantidad * factor; x.metros_lineales = x.metros_lineales * factor; x.metros_cuadrados = x.metros_cuadrados * factor; } cotizaciones.SaveChanges(); }
private void cargarTabla() { cotizaciones_local cotizaciones = new cotizaciones_local(); setFactor(cotizaciones); //--------------------------> var data = from x in cotizaciones.materiales_modulos orderby x.concepto ascending select new { Componente = x.concepto == 1 ? "Perfil" : x.concepto == 2 ? "Cristal" : x.concepto == 3 ? "Herraje" : x.concepto == 4 ? "Otros" : "n/a", Clave = x.clave, Artículo = x.articulo, Acabado = x.acabado, Cantidad = Math.Round((float)x.cantidad, 2), Metros_Lineales = x.metros_lineales > 0 ? Math.Round((float)(x.metros_lineales / 1000), 2) + " m" : "", Metros_Cuadrados = x.metros_cuadrados > 0 ? Math.Round((float)(x.metros_cuadrados / 1000), 2) + " m2" : "", Perfiles = x.concepto == 1 ? Math.Round(Math.Round((float)(x.metros_lineales / 1000), 2) / (float)x.largo_perfil, 2) + "/" + x.largo_perfil : "" }; if (data != null) { if (datagridviewNE1.InvokeRequired == true) { datagridviewNE1.Invoke((MethodInvoker) delegate { datagridviewNE1.DataSource = data.ToList(); if (datagridviewNE1.RowCount <= 0) { datagridviewNE1.DataSource = null; } else { acomodarDesglose(datagridviewNE1); } }); } else { datagridviewNE1.DataSource = data.ToList(); if (datagridviewNE1.RowCount <= 0) { datagridviewNE1.DataSource = null; } else { acomodarDesglose(datagridviewNE1); } } } }
//Unificar Conceptos private void unificarAConceptosToolStripMenuItem_Click(object sender, EventArgs e) { cotizaciones_local cotizaciones = new cotizaciones_local(); try { var modulo_p = new modulos_cotizaciones { folio = 00000, modulo_id = -1, descripcion = "", mano_obra = 0, dimensiones = "", largo = 0, alto = 0, acabado_perfil = "", claves_cristales = "", cantidad = 1, flete = 0, desperdicio = 0, utilidad = 0, articulo = "", linea = "", diseño = "", clave = "md", total = 0, claves_otros = "", claves_herrajes = "", ubicacion = "", claves_perfiles = "", pic = constants.imageToByte(Properties.Resources.new_concepto), merge_id = -1, concept_id = 0, sub_folio = constants.sub_folio, dir = 0, news = "", new_desing = "", orden = 0 }; cotizaciones.modulos_cotizaciones.Add(modulo_p); cotizaciones.SaveChanges(); ((Form1)Application.OpenForms["Form1"]).countCotizacionesArticulo(); ((Form1)Application.OpenForms["Form1"]).loadCountArticulos(); cargarModulosCotizados(); } catch (Exception err) { constants.errorLog(err.ToString()); MessageBox.Show("[Error] <?>.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void deleteCopy(int id) { cotizaciones_local cotizaciones = new cotizaciones_local(); var copy = (from x in cotizaciones.copyboxes where x.id == id select x).SingleOrDefault(); if (copy != null) { cotizaciones.copyboxes.Remove(copy); cotizaciones.SaveChanges(); loadCopy(); datagridviewNE1.Refresh(); } }
private void setNewDir(int id, int dir) { cotizaciones_local cotizacion = new cotizaciones_local(); var modulo = (from x in cotizacion.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (modulo != null) { modulo.dir = dir; } cotizacion.SaveChanges(); constants.updateModuloPersonalizado(perso_id); constants.getMargedItems(datagridviewNE1, perso_id); }
private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { if (reportViewer1.InvokeRequired == true) { reportViewer1.Invoke((MethodInvoker) delegate { try { cotizaciones_local cotizaciones = new cotizaciones_local(); resetReport(cotizaciones); string[] p = e.Argument as string[]; if (p.Length == 7) { string informe = sql.selectRegistroPresupuestos(constants.stringToInt(p[0]), "informe"); reportViewer1.LocalReport.SetParameters(new ReportParameter("informe", informe)); reportViewer1.LocalReport.SetParameters(new ReportParameter("responsable", p[3])); reportViewer1.LocalReport.SetParameters(new ReportParameter("etapa", p[4])); reportViewer1.LocalReport.SetParameters(new ReportParameter("fecha_inicio", p[5])); reportViewer1.LocalReport.SetParameters(new ReportParameter("fecha_entrega", p[6])); var reporte = new datos_reporte() { Cliente = p[1], Nombre_Proyecto = p[2], Fecha = DateTime.Today.ToString("dd/MM/yyyy"), Folio = p[0], Subtotal = 0, IVA = 0, Total = 0 }; cotizaciones.datos_reporte.Add(reporte); cotizaciones.SaveChanges(); } var datos = (from x in cotizaciones.datos_reporte select x); datos_reporteBindingSource.DataSource = datos.ToList(); this.datos_reporteTableAdapter.Fill(this.reportes_dataSet.datos_reporte); this.reportViewer1.LocalReport.Refresh(); this.reportViewer1.RefreshReport(); } catch (Exception err) { MessageBox.Show(err.ToString()); } }); } }
private void loadReporte() { if (reportViewer1.InvokeRequired == true) { reportViewer1.Invoke((MethodInvoker) delegate { reportViewer1.LocalReport.SetParameters(new ReportParameter("Image", constants.getExternalImage("header"))); reportViewer1.LocalReport.SetParameters(new ReportParameter("user", constants.user)); try { cotizaciones_local cotizaciones = new cotizaciones_local(); cotizaciones.Database.ExecuteSqlCommand("TRUNCATE TABLE datos_reporte"); cotizaciones.Database.ExecuteSqlCommand("DBCC CHECKIDENT (datos_reporte, RESEED, 1)"); cotizaciones.Database.ExecuteSqlCommand("TRUNCATE TABLE produccion_t"); cotizaciones.Database.ExecuteSqlCommand("DBCC CHECKIDENT (filas_borradas, RESEED, 1)"); loadData(); var reporte = new datos_reporte() { Cliente = constants.nombre_cotizacion, Nombre_Proyecto = constants.nombre_proyecto, Fecha = DateTime.Today.ToString("dd/MM/yyyy"), Folio = folio.ToString(), }; cotizaciones.datos_reporte.Add(reporte); cotizaciones.SaveChanges(); var datos = (from x in cotizaciones.datos_reporte select x); var datos_2 = (from x in cotizaciones.produccion_t select x); datos_reporteBindingSource.DataSource = datos.ToList(); produccion_tBindingSource.DataSource = datos_2.ToList(); this.datos_reporteTableAdapter.Fill(this.reportes_dataSet.datos_reporte); this.produccion_tTableAdapter.Fill(this.reportes_dataSet.produccion_t); this.reportViewer1.LocalReport.Refresh(); this.reportViewer1.RefreshReport(); } catch (Exception err) { MessageBox.Show(err.ToString()); } }); } }
//cambiar imagen private void button2_Click(object sender, EventArgs e) { if (tableLayoutPanel1.Controls.Count > 0 || pictureBox1.Image != null) { cotizaciones_local cotizaciones = new cotizaciones_local(); var data = (from x in cotizaciones.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (data != null) { if (tableLayoutPanel1.Controls.Count > 0) { Bitmap bm = new Bitmap(tableLayoutPanel1.Width, tableLayoutPanel1.Height); tableLayoutPanel1.DrawToBitmap(bm, new Rectangle(0, 0, tableLayoutPanel1.Width, tableLayoutPanel1.Height)); Bitmap gm_2 = new Bitmap(bm, 120, 105); data.pic = constants.imageToByte(gm_2); data.dir = 3; data.new_desing = desing > 0 ? desing.ToString() : ""; cotizaciones.SaveChanges(); bm = null; gm_2 = null; } else if (pictureBox1.Image != null) { data.pic = constants.imageToByte(pictureBox1.Image); data.dir = 3; cotizaciones.SaveChanges(); } if (Application.OpenForms["articulos_cotizacion"] != null) { ((articulos_cotizacion)Application.OpenForms["articulos_cotizacion"]).reloadModulos(); } if (Application.OpenForms["edit_expresss"] != null) { ((edit_expresss)Application.OpenForms["edit_expresss"]).reloadALL(); } this.Close(); } } else { MessageBox.Show("[Error] no se ha seleccionado un esquema o imagen.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Diseño_p_Shown(object sender, EventArgs e) { cotizaciones_local cotizaciones = new cotizaciones_local(); var data = (from x in cotizaciones.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (data != null) { if (data.modulo_id != -2) { comboBox4.Enabled = false; acabado = data.acabado_perfil; } if (data.new_desing != "" && data.new_desing != null) { getNewDesing(data.new_desing); } } }
//Añadir a concepto private void añadirAConceptoToolStripMenuItem_Click(object sender, EventArgs e) { if (datagridviewNE1.RowCount > 0) { if (datagridviewNE1.CurrentRow.Cells[4].Value.ToString() != "-2") { cotizaciones_local cotizaciones = new cotizaciones_local(); var modulos = (from x in cotizaciones.modulos_cotizaciones where x.merge_id == perso_id select x).Count(); if (modulos < 5) { if (modulos <= 0) { borrarImagenPredeterminada(perso_id); } int id = (int)datagridviewNE1.CurrentRow.Cells[0].Value; setDir dir = new setDir(id, perso_id, constants.byteToImage((byte[])datagridviewNE1.CurrentRow.Cells[1].Value), getMedidas(id, "largo"), getMedidas(id, "alto")); dir.ShowDialog(); if (dir.close == true) { constants.getItemsToGetMerged(datagridviewNE1); if (Application.OpenForms["articulos_cotizacion"] != null) { ((articulos_cotizacion)Application.OpenForms["articulos_cotizacion"]).reloadModulos(); } if (datagridviewNE1.RowCount <= 0) { this.Close(); } } } else { MessageBox.Show(this, "[Error] este concepto ya tiene demaciados artículos.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show(this, "[Error] no posible añadir esté artículo.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void eliminarConfiguraciónToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "¿Deseas eliminar toda la configuración de integración?", constants.msg_box_caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { cotizaciones_local cotizacion = new cotizaciones_local(); var modulos = from x in cotizacion.modulos_cotizaciones where x.merge_id == perso_id select x; if (modulos != null) { foreach (var x in modulos) { x.dir = 0; } cotizacion.SaveChanges(); reloadMergedItems(); } } }
//Cargar merged items private void cargarMergedItems(int id) { merged_id = id; if (datagridviewNE2.RowCount > 0) { datagridviewNE2.Rows.Clear(); } if (datagridviewNE2.ColumnCount > 0) { datagridviewNE2.Columns.Clear(); } datagridviewNE2.Refresh(); DataGridViewImageColumn clm = new DataGridViewImageColumn(); clm.Name = "CS"; clm.HeaderText = "CS"; datagridviewNE2.Columns.Add("Id", "Id"); datagridviewNE2.Columns.Add(clm); datagridviewNE2.Columns.Add("Módulo_Id", "Módulo_Id"); cotizaciones = new cotizaciones_local(); var data = (from x in cotizaciones.modulos_cotizaciones where x.merge_id == id && x.sub_folio == constants.sub_folio select x); float sum = 0; foreach (var c in data) { if (c != null) { datagridviewNE2.Rows.Add(c.id, c.pic, c.modulo_id); sum = (sum + (float)c.total); } } sum = sum * constants.iva; var modulo = (from x in cotizaciones.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (modulo != null) { label6.Text = "Largo: " + modulo.largo.ToString(); label7.Text = "Alto: " + modulo.alto.ToString(); } }
private void button4_Click(object sender, EventArgs e) { cotizaciones_local cotizaciones = new cotizaciones_local(); var data = (from x in cotizaciones.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (data != null) { data.dir = 0; cotizaciones.SaveChanges(); if (Application.OpenForms["articulos_cotizacion"] != null) { ((articulos_cotizacion)Application.OpenForms["articulos_cotizacion"]).reloadModulos(); } if (Application.OpenForms["edit_expresss"] != null) { ((edit_expresss)Application.OpenForms["edit_expresss"]).reloadALL(); } this.Close(); } // }
private void cambiar_imagen_Load(object sender, EventArgs e) { new sqlDateBaseManager().dropTableOnGridView(datagridviewNE1, "esquemas"); datagridviewNE1.ClearSelection(); loadColoresAluminio(); cotizaciones_local cotizaciones = new cotizaciones_local(); listas_entities_pva listas = new listas_entities_pva(); var data = (from x in cotizaciones.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (data != null) { if (data.modulo_id != -2) { comboBox2.Enabled = false; acabado = data.acabado_perfil; if (data.modulo_id >= 0) { int modulo_id = (int)data.modulo_id; var modulo = (from x in listas.modulos where x.id == modulo_id select x).SingleOrDefault(); if (modulo != null) { int diseño_id = (int)modulo.id_diseño; LeerDiseño(diseño_id); } } } if (data.new_desing != "" && data.new_desing != null) { if (constants.stringToInt(data.new_desing) > 0) { desing = constants.stringToInt(data.new_desing); LeerDiseño(desing); } } } }
//Sin imagen private void button5_Click(object sender, EventArgs e) { cotizaciones_local cotizaciones = new cotizaciones_local(); var data = (from x in cotizaciones.modulos_cotizaciones where x.id == id select x).SingleOrDefault(); if (data != null) { data.pic = constants.imageToByte(Properties.Resources.blank); data.dir = 3; cotizaciones.SaveChanges(); if (Application.OpenForms["articulos_cotizacion"] != null) { ((articulos_cotizacion)Application.OpenForms["articulos_cotizacion"]).reloadModulos(); } if (Application.OpenForms["edit_expresss"] != null) { ((edit_expresss)Application.OpenForms["edit_expresss"]).reloadALL(); } this.Close(); } }
//------------------------------------------ public void guardarCotizacion(TextBox textbox, TextBox textbox2, Button boton, Label label, BackgroundWorker worker, bool new_cotizacion = false, Form form = null) { sqlDateBaseManager sql = new sqlDateBaseManager(); cotizaciones_local cotizaciones = new cotizaciones_local(); int folio = constants.setFolio(); string subfolios_titulos = constants.serializeSubfolio(); if (subfolios_titulos == null) { subfolios_titulos = string.Empty; } try { var t_cristales = (from x in cotizaciones.cristales_cotizados select x); var t_aluminios = (from x in cotizaciones.aluminio_cotizado select x); var t_herrajes = (from x in cotizaciones.herrajes_cotizados select x); var t_otros = (from x in cotizaciones.otros_cotizaciones select x); var t_modulos = (from x in cotizaciones.modulos_cotizaciones select x); if (sql.findSQLValue("folio", "folio", "cotizaciones", constants.folio_abierto.ToString()) == false) { if (sql.isFolioExist(folio) == false) { if (textbox.Text != "") { deleteAllDeletedArticulos(); sql.insertCotizacion(folio, textbox.Text, constants.user, DateTime.Today.ToString("dd/MM/yyyy") + " -", textbox2.Text, constants.desc_cotizacion, constants.utilidad_cotizacion, constants.org_name, constants.iva_desglosado, "Sin Registro", constants.tc, subfolios_titulos, constants.precio_especial_desc, constants.tasa_cero); constants.cotizacion_error = false; constants.folio_abierto = folio; constants.nombre_cotizacion = textbox.Text; constants.nombre_proyecto = textbox2.Text; constants.autor_cotizacion = constants.user; constants.fecha_cotizacion = DateTime.Today.ToString("dd/MM/yyyy"); foreach (var cristales in t_cristales) { if (cristales != null) { cristales.folio = constants.folio_abierto; sql.insertCotizacionCristal(constants.folio_abierto, cristales.clave, cristales.articulo, cristales.lista, (float)cristales.largo, (float)cristales.alto, cristales.canteado, cristales.biselado, cristales.desconchado, cristales.pecho_paloma, cristales.perforado_media_pulgada, cristales.perforado_una_pulgada, cristales.perforado_dos_pulgadas, cristales.grabado, cristales.esmerilado, cristales.tipo_venta, (float)cristales.cantidad, (float)cristales.descuento, (float)cristales.total, cristales.proveedor, (float)cristales.filo_muerto, cristales.descripcion); } } foreach (var aluminio in t_aluminios) { if (aluminio != null) { aluminio.folio = constants.folio_abierto; sql.insertCotizacionAluminio(constants.folio_abierto, aluminio.clave, aluminio.articulo, aluminio.lista, aluminio.linea, aluminio.largo_total.ToString(), aluminio.acabado, (float)aluminio.cantidad, (float)aluminio.descuento, (float)aluminio.total, aluminio.proveedor, aluminio.descripcion); } } foreach (var herrajes in t_herrajes) { if (herrajes != null) { herrajes.folio = constants.folio_abierto; sql.insertCotizacionHerrajes(constants.folio_abierto, herrajes.clave, herrajes.articulo, herrajes.proveedor, herrajes.linea, herrajes.caracteristicas, herrajes.color, (float)herrajes.cantidad, (float)herrajes.descuento, (float)herrajes.total, herrajes.descripcion); } } foreach (var otros in t_otros) { if (otros != null) { otros.folio = constants.folio_abierto; sql.insertCotizacionOtros(constants.folio_abierto, otros.clave, otros.articulo, otros.proveedor, otros.linea, otros.caracteristicas, otros.color, (float)otros.cantidad, (float)otros.descuento, (float)otros.total, (float)otros.largo, (float)otros.alto, otros.descripcion); } } foreach (var modulos in t_modulos) { if (modulos != null) { modulos.folio = constants.folio_abierto; sql.insertCotizacionModulo(constants.folio_abierto, (int)modulos.modulo_id, modulos.descripcion, (float)modulos.mano_obra, modulos.dimensiones, modulos.acabado_perfil, modulos.claves_cristales, (int)modulos.cantidad, (int)modulos.largo, (int)modulos.alto, (float)modulos.flete, (float)modulos.desperdicio, (float)modulos.utilidad, modulos.claves_otros, modulos.claves_herrajes, modulos.ubicacion, modulos.claves_perfiles, modulos.pic, (int)modulos.merge_id, (int)modulos.concept_id, modulos.articulo, (float)Math.Round((float)modulos.total, 2), (int)modulos.sub_folio, (int)modulos.dir, modulos.news, modulos.new_desing, (int)modulos.orden); } } } else { MessageBox.Show(form, "[Error]: La cotización necesita ser ligada a un cliente para ser guardada.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); worker.CancelAsync(); constants.cotizacion_error = true; } } else { MessageBox.Show(form, "[Error]: La cotización no puede ser guardada en este momento, intenta de nuevo.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); worker.CancelAsync(); constants.cotizacion_error = true; } } else { if (new_cotizacion == true) { if (sql.isFolioExist(folio) == false) { if (textbox.Text != "") { deleteAllDeletedArticulos(); sql.insertCotizacion(folio, textbox.Text, constants.user, DateTime.Today.ToString("dd/MM/yyyy") + " -", textbox2.Text, constants.desc_cotizacion, constants.utilidad_cotizacion, constants.org_name, constants.iva_desglosado, "Sin Registro", constants.tc, subfolios_titulos, constants.precio_especial_desc, constants.tasa_cero); constants.cotizacion_error = false; constants.folio_abierto = folio; constants.nombre_cotizacion = textbox.Text; constants.nombre_proyecto = textbox2.Text; constants.autor_cotizacion = constants.user; constants.fecha_cotizacion = DateTime.Today.ToString("dd/MM/yyyy"); foreach (var cristales in t_cristales) { if (cristales != null) { cristales.folio = constants.folio_abierto; sql.insertCotizacionCristal(constants.folio_abierto, cristales.clave, cristales.articulo, cristales.lista, (float)cristales.largo, (float)cristales.alto, cristales.canteado, cristales.biselado, cristales.desconchado, cristales.pecho_paloma, cristales.perforado_media_pulgada, cristales.perforado_una_pulgada, cristales.perforado_dos_pulgadas, cristales.grabado, cristales.esmerilado, cristales.tipo_venta, (float)cristales.cantidad, (float)cristales.descuento, (float)cristales.total, cristales.proveedor, (float)cristales.filo_muerto, cristales.descripcion); } } foreach (var aluminio in t_aluminios) { if (aluminio != null) { aluminio.folio = constants.folio_abierto; sql.insertCotizacionAluminio(constants.folio_abierto, aluminio.clave, aluminio.articulo, aluminio.lista, aluminio.linea, aluminio.largo_total.ToString(), aluminio.acabado, (float)aluminio.cantidad, (float)aluminio.descuento, (float)aluminio.total, aluminio.proveedor, aluminio.descripcion); } } foreach (var herrajes in t_herrajes) { if (herrajes != null) { herrajes.folio = constants.folio_abierto; sql.insertCotizacionHerrajes(constants.folio_abierto, herrajes.clave, herrajes.articulo, herrajes.proveedor, herrajes.linea, herrajes.caracteristicas, herrajes.color, (float)herrajes.cantidad, (float)herrajes.descuento, (float)herrajes.total, herrajes.descripcion); } } foreach (var otros in t_otros) { if (otros != null) { otros.folio = constants.folio_abierto; sql.insertCotizacionOtros(constants.folio_abierto, otros.clave, otros.articulo, otros.proveedor, otros.linea, otros.caracteristicas, otros.color, (float)otros.cantidad, (float)otros.descuento, (float)otros.total, (float)otros.largo, (float)otros.alto, otros.descripcion); } } foreach (var modulos in t_modulos) { if (modulos != null) { modulos.folio = constants.folio_abierto; sql.insertCotizacionModulo(constants.folio_abierto, (int)modulos.modulo_id, modulos.descripcion, (float)modulos.mano_obra, modulos.dimensiones, modulos.acabado_perfil, modulos.claves_cristales, (int)modulos.cantidad, (int)modulos.largo, (int)modulos.alto, (float)modulos.flete, (float)modulos.desperdicio, (float)modulos.utilidad, modulos.claves_otros, modulos.claves_herrajes, modulos.ubicacion, modulos.claves_perfiles, modulos.pic, (int)modulos.merge_id, (int)modulos.concept_id, modulos.articulo, (float)Math.Round((float)modulos.total, 2), (int)modulos.sub_folio, (int)modulos.dir, modulos.news, modulos.new_desing, (int)modulos.orden); } } } else { MessageBox.Show(form, "[Error]: La cotización necesita ser ligada a un cliente para ser guardada.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); worker.CancelAsync(); constants.cotizacion_error = true; } } else { MessageBox.Show(form, "[Error]: La cotización no puede ser guardada en este momento, intenta de nuevo.", constants.msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error); worker.CancelAsync(); constants.cotizacion_error = true; } } else { //update si se tiene el mismo folio DialogResult r = MessageBox.Show(form, "Ya existe una operación con el mismo número de folio.\n\n ¿Desea sobreescribirla?", constants.msg_box_caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (r == DialogResult.Yes) { deleteAllDeletedArticulos(); sql.updateCotizacion(constants.folio_abierto, constants.getStringToPoint(sql.getSingleSQLValueById("cotizaciones", "fecha", "folio", constants.folio_abierto, 0)) + "- UM: " + DateTime.Today.ToString("dd/MM/yyyy"), textbox.Text, textbox2.Text, constants.desc_cotizacion, constants.utilidad_cotizacion, constants.iva_desglosado, constants.tc, subfolios_titulos, constants.precio_especial_desc, constants.tasa_cero); constants.nombre_cotizacion = textbox.Text; constants.nombre_proyecto = textbox2.Text; foreach (var cristales in t_cristales) { if (cristales != null) { if (cristales.folio > 0) { sql.updateCotizacionCristal(constants.getIDFromClave(cristales.clave), constants.folio_abierto, constants.getClave(cristales.clave), cristales.articulo, cristales.lista, (float)cristales.largo, (float)cristales.alto, cristales.canteado, cristales.biselado, cristales.desconchado, cristales.pecho_paloma, cristales.perforado_media_pulgada, cristales.perforado_una_pulgada, cristales.perforado_dos_pulgadas, cristales.grabado, cristales.esmerilado, cristales.tipo_venta, (float)cristales.cantidad, (float)cristales.descuento, (float)cristales.total, cristales.proveedor, (float)cristales.filo_muerto, cristales.descripcion); } else { sql.insertCotizacionCristal(constants.folio_abierto, cristales.clave, cristales.articulo, cristales.lista, (float)cristales.largo, (float)cristales.alto, cristales.canteado, cristales.biselado, cristales.desconchado, cristales.pecho_paloma, cristales.perforado_media_pulgada, cristales.perforado_una_pulgada, cristales.perforado_dos_pulgadas, cristales.grabado, cristales.esmerilado, cristales.tipo_venta, (float)cristales.cantidad, (float)cristales.descuento, (float)cristales.total, cristales.proveedor, (float)cristales.filo_muerto, cristales.descripcion); } } } foreach (var aluminio in t_aluminios) { if (aluminio != null) { if (aluminio.folio > 0) { sql.updateCotizacionAluminio(constants.getIDFromClave(aluminio.clave), constants.folio_abierto, constants.getClave(aluminio.clave), aluminio.articulo, aluminio.lista, aluminio.linea, aluminio.largo_total.ToString(), aluminio.acabado, (float)aluminio.cantidad, (float)aluminio.descuento, (float)aluminio.total, aluminio.proveedor, aluminio.descripcion); } else { sql.insertCotizacionAluminio(constants.folio_abierto, aluminio.clave, aluminio.articulo, aluminio.lista, aluminio.linea, aluminio.largo_total.ToString(), aluminio.acabado, (float)aluminio.cantidad, (float)aluminio.descuento, (float)aluminio.total, aluminio.proveedor, aluminio.descripcion); } } } foreach (var herrajes in t_herrajes) { if (herrajes != null) { if (herrajes.folio > 0) { sql.updateCotizacionHerrajes(constants.getIDFromClave(herrajes.clave), constants.folio_abierto, constants.getClave(herrajes.clave), herrajes.articulo, herrajes.proveedor, herrajes.linea, herrajes.caracteristicas, herrajes.color, (float)herrajes.cantidad, (float)herrajes.descuento, (float)herrajes.total, herrajes.descripcion); } else { sql.insertCotizacionHerrajes(constants.folio_abierto, herrajes.clave, herrajes.articulo, herrajes.proveedor, herrajes.linea, herrajes.caracteristicas, herrajes.color, (float)herrajes.cantidad, (float)herrajes.descuento, (float)herrajes.total, herrajes.descripcion); } } } foreach (var otros in t_otros) { if (otros != null) { if (otros.folio > 0) { sql.updateCotizacionOtros(constants.getIDFromClave(otros.clave), constants.folio_abierto, constants.getClave(otros.clave), otros.articulo, otros.proveedor, otros.linea, otros.caracteristicas, otros.color, (float)otros.cantidad, (float)otros.descuento, (float)otros.total, (float)otros.largo, (float)otros.alto, otros.descripcion); } else { sql.insertCotizacionOtros(constants.folio_abierto, otros.clave, otros.articulo, otros.proveedor, otros.linea, otros.caracteristicas, otros.color, (float)otros.cantidad, (float)otros.descuento, (float)otros.total, (float)otros.largo, (float)otros.alto, otros.descripcion); } } } foreach (var modulos in t_modulos) { if (modulos != null) { if (modulos.folio > 0) { sql.updateCotizacionModulo(constants.getIDFromClave(modulos.clave), constants.folio_abierto, (int)modulos.modulo_id, modulos.descripcion, (float)modulos.mano_obra, modulos.dimensiones, modulos.acabado_perfil, modulos.claves_cristales, (int)modulos.cantidad, (int)modulos.largo, (int)modulos.alto, (float)modulos.flete, (float)modulos.desperdicio, (float)modulos.utilidad, modulos.claves_otros, modulos.claves_herrajes, modulos.ubicacion, modulos.claves_perfiles, modulos.pic, (int)modulos.merge_id, (int)modulos.concept_id, modulos.articulo, (float)Math.Round((float)modulos.total, 2), (int)modulos.sub_folio, (int)modulos.dir, modulos.news, modulos.new_desing, (int)modulos.orden); } else { sql.insertCotizacionModulo(constants.folio_abierto, (int)modulos.modulo_id, modulos.descripcion, (float)modulos.mano_obra, modulos.dimensiones, modulos.acabado_perfil, modulos.claves_cristales, (int)modulos.cantidad, (int)modulos.largo, (int)modulos.alto, (float)modulos.flete, (float)modulos.desperdicio, (float)modulos.utilidad, modulos.claves_otros, modulos.claves_herrajes, modulos.ubicacion, modulos.claves_perfiles, modulos.pic, (int)modulos.merge_id, (int)modulos.concept_id, modulos.articulo, (float)Math.Round((float)modulos.total, 2), (int)modulos.sub_folio, (int)modulos.dir, modulos.news, modulos.new_desing, (int)modulos.orden); } } } } else { DialogResult n = MessageBox.Show(form, "¿Desea guardar una nueva cotización a partir de estos datos?", constants.msg_box_caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (n == DialogResult.Yes) { ((guardar_cotizacion)Application.OpenForms["guardar_cotizacion"]).new_cotizacion = true; textbox.Enabled = true; textbox2.Enabled = true; boton.Enabled = true; label.Text = constants.setFolio().ToString(); textbox.Text = ""; textbox2.Text = ""; worker.CancelAsync(); } else { worker.CancelAsync(); } } } } } catch (Exception err) { constants.errorLog(err.ToString()); } finally { cotizaciones.Dispose(); } }
public void loadCopy(string filter = "") { cotizaciones_local cotizaciones = new cotizaciones_local(); StringConverter converter = new StringConverter(); if (filter != "") { var data = (from x in cotizaciones.copyboxes where x.merge_id <= 0 && (x.ubicacion.Contains(filter) || x.clave.Contains(filter) || x.id.ToString().StartsWith(filter)) select x).AsEnumerable().Select(o => new { Id = o.id, CS = o.pic, Folio = o.folio, Clave = o.clave, Modulo_Id = o.modulo_id, Artículo = o.articulo, Linea = o.linea, Diseño = o.diseño, Descripción = o.descripcion, Ubicación = o.ubicacion, Cristales = constants.getCristales(o.claves_cristales, o.news), Acabado = o.acabado_perfil, Largo = o.largo, Alto = o.alto, Cantidad = o.cantidad, Total = o.total }); if (data != null) { if (datagridviewNE1.InvokeRequired == true) { datagridviewNE1.Invoke((MethodInvoker) delegate { datagridviewNE1.DataSource = data.ToList(); if (datagridviewNE1.RowCount <= 0) { datagridviewNE1.DataSource = null; } }); } else { datagridviewNE1.DataSource = data.ToList(); if (datagridviewNE1.RowCount <= 0) { datagridviewNE1.DataSource = null; } } } } else { var data = (from x in cotizaciones.copyboxes where x.merge_id <= 0 select x).AsEnumerable().Select(o => new { Id = o.id, CS = o.pic, Folio = o.folio, Clave = o.clave, Modulo_Id = o.modulo_id, Artículo = o.articulo, Linea = o.linea, Diseño = o.diseño, Descripción = o.descripcion, Ubicación = o.ubicacion, Cristales = constants.getCristales(o.claves_cristales, o.news), Acabado = o.acabado_perfil, Largo = o.largo, Alto = o.alto, Cantidad = o.cantidad, Total = o.total }); if (data != null) { if (datagridviewNE1.InvokeRequired == true) { datagridviewNE1.Invoke((MethodInvoker) delegate { datagridviewNE1.DataSource = data.ToList(); if (datagridviewNE1.RowCount <= 0) { datagridviewNE1.DataSource = null; } }); } else { datagridviewNE1.DataSource = data.ToList(); if (datagridviewNE1.RowCount <= 0) { datagridviewNE1.DataSource = null; } } } } }
//cargar articulos cotizados private void cargarModulosCotizados() { if (datagridviewNE1.RowCount > 0) { datagridviewNE1.Rows.Clear(); } if (datagridviewNE1.ColumnCount > 0) { datagridviewNE1.Columns.Clear(); } datagridviewNE1.Refresh(); DataGridViewImageColumn clm = new DataGridViewImageColumn(); clm.Name = "CS"; clm.HeaderText = "CS"; datagridviewNE1.Columns.Add("Id", "Id"); datagridviewNE1.Columns.Add(clm); datagridviewNE1.Columns.Add("Ubicación", "Ubicación"); datagridviewNE1.Columns.Add("Módulo_Id", "Módulo_Id"); datagridviewNE1.Columns[2].DefaultCellStyle.BackColor = Color.LightGreen; datagridviewNE1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; datagridviewNE1.Columns[2].DefaultCellStyle.Font = new Font("Arial", 12f, FontStyle.Bold); datagridviewNE1.Columns[2].DefaultCellStyle.WrapMode = DataGridViewTriState.True; cotizaciones = new cotizaciones_local(); var data = (from x in cotizaciones.modulos_cotizaciones where x.modulo_id != -2 && x.merge_id <= 0 && x.sub_folio == constants.sub_folio select x); if (constants.ac_sort == "Linea") { data = data.OrderBy(x => x.linea); } else if (constants.ac_sort == "Ubicación") { data = data.OrderBy(x => x.ubicacion); } else { data = data.OrderBy(x => x.orden); } float sum = 0; if (textBox1.Text != "") { string param = textBox1.Text; data = null; data = (from x in cotizaciones.modulos_cotizaciones where x.modulo_id != -2 && x.merge_id <= 0 && x.sub_folio == constants.sub_folio && (x.id.ToString().StartsWith(param) || x.ubicacion.Contains(param)) select x); } foreach (var c in data) { if (c != null) { if (c.pic == null) { c.pic = constants.imageToByte(Properties.Resources.new_concepto); } datagridviewNE1.Rows.Add(c.id, c.pic, c.ubicacion, c.modulo_id); sum = (sum + (float)c.total); } } if (datagridviewNE1.RowCount > 0) { datagridviewNE1.FirstDisplayedScrollingRowIndex = datagridviewNE1.RowCount - 1; } sum = sum * constants.iva; label5.Text = "$ " + sum.ToString("n");; label2.Text = "Se encontrarón: " + datagridviewNE1.RowCount + " partidas."; getUnificados(); }
private void getNext(bool row) { cotizaciones_local cotizaciones = new cotizaciones_local(); string dir; var z = (from x in cotizaciones.modulos_cotizaciones where x.merge_id == perso_id select x); int x_0 = 0; int y_0 = 0; bool r = false; if (z != null) { for (int i = 0; i < 8; i++) { if (row) { dir = (comboBox1.Text + (i + 1).ToString() + (label7.Text == "Vertical" ? "0" : "1")); } else { dir = ((i + 1).ToString() + comboBox2.Text + (label7.Text == "Vertical" ? "0" : "1")); } r = false; foreach (var x in z) { if (x.dir >= 110) { tableLayoutPanel1.GetControlFromPosition(constants.stringToInt(x.dir.ToString()[1].ToString()) - 1, constants.stringToInt(x.dir.ToString()[0].ToString()) - 1).BackColor = Color.Red; string _dir = x.dir.ToString(); if ("" + _dir[0].ToString() + _dir[1].ToString() == "" + dir[0] + dir[1]) { r = true; break; } } } if (r == false) { this.dir = dir; label6.Text = dir[0] + "," + dir[1]; if (row) { x_0 = constants.stringToInt(comboBox1.Text); if (x_0 > 0) { tableLayoutPanel1.GetControlFromPosition(i, x_0 - 1).BackColor = Color.Green; } } else { y_0 = constants.stringToInt(comboBox2.Text); if (y_0 > 0) { tableLayoutPanel1.GetControlFromPosition(y_0 - 1, i).BackColor = Color.Green; } } break; } } } }
private void loadAnaliticas() { cotizaciones_local cotizaciones = new cotizaciones_local(); reportViewer1.LocalReport.SetParameters(new ReportParameter("Image", constants.getExternalImage("header"))); if (utilidad > 0) { reportViewer1.LocalReport.SetParameters(new ReportParameter("u_label", "+ Utilidad: " + utilidad + "%")); } else { reportViewer1.LocalReport.SetParameters(new ReportParameter("u_label", " ")); } try { float _utilidad = 0; float _total = 0; float _total_desc = 0; float _sub_total = this.subtotal; //Incluir utilidad if (constants.op9) { _utilidad = this.utilidad > 0 ? (this.utilidad / 100) + 1 : 1; } else { _utilidad = 1; } cotizaciones.Database.ExecuteSqlCommand("TRUNCATE TABLE datos_reporte"); cotizaciones.Database.ExecuteSqlCommand("TRUNCATE TABLE articulos_reporte"); cotizaciones.Database.ExecuteSqlCommand("DBCC CHECKIDENT (datos_reporte, RESEED, 1)"); cotizaciones.Database.ExecuteSqlCommand("DBCC CHECKIDENT (articulos_reporte, RESEED, 1)"); if (descuento > 0) { reportViewer1.LocalReport.SetParameters(new ReportParameter("desc_n", descuento.ToString())); reportViewer1.LocalReport.SetParameters(new ReportParameter("desc_cant", desc_cant.ToString())); reportViewer1.LocalReport.SetParameters(new ReportParameter("descuento", "Descuento: (-" + descuento + "%)")); iva = subtotal * (constants.iva - 1); total = subtotal + iva; } else { reportViewer1.LocalReport.SetParameters(new ReportParameter("desc_cant", "0")); reportViewer1.LocalReport.SetParameters(new ReportParameter("desc_n", "0")); reportViewer1.LocalReport.SetParameters(new ReportParameter("descuento", " ")); } var reporte = new datos_reporte() { Cliente = cliente, Nombre_Proyecto = proyecto, Fecha = DateTime.Today.ToString("dd/MM/yyyy"), Folio = folio, Subtotal = subtotal, IVA = iva, Total = total }; cotizaciones.datos_reporte.Add(reporte); cotizaciones.SaveChanges(); var modulos = from x in cotizaciones.modulos_cotizaciones where x.merge_id <= 0 && x.sub_folio == constants.sub_folio orderby x.orden select x; byte[] p = null; int s = 0; float desperdicio = 0; float flete = 0; float mano_o = 0; float utilidad = 0; float _t = 0; foreach (var c in modulos) { if (c.pic != null) { p = c.pic; Bitmap bm = new Bitmap(constants.byteToImage(p), 100, 85); p = constants.imageToByte(bm); bm = null; } s = 0; desperdicio = 0; flete = 0; mano_o = 0; utilidad = 0; if (c.modulo_id == -1) { int n = c.id; var k = from x in cotizaciones.modulos_cotizaciones where x.merge_id == n select x; foreach (var j in k) { s++; desperdicio = (float)j.desperdicio + desperdicio; flete = (float)j.flete + flete; mano_o = (float)j.mano_obra + mano_o; utilidad = (float)j.utilidad + utilidad; } } if (s > 0) { desperdicio = desperdicio / s; flete = flete / s; mano_o = mano_o / s; utilidad = utilidad / s; } _total = (float)c.total; _total_desc = ((_total) - ((_total) * (descuento / 100))); if (c.modulo_id != -2) { if (utilidad != 0) { utilidad_total = utilidad_total + (_total - (_total / ((utilidad / 100) + 1))); gasto_total = gasto_total + (_total / ((utilidad / 100) + 1)); } else { utilidad_total = utilidad_total + (float)(_total - (_total / ((c.utilidad / 100) + 1))); gasto_total = gasto_total + (float)(_total / ((c.utilidad / 100) + 1)); } if (c.modulo_id != -1) { _t = (float)(_total / ((c.utilidad / 100) + 1)); _t = (float)(_t / ((c.mano_obra / 100) + 1)); _t = (float)(_t / ((c.flete / 100) + 1)); _t = (float)(_t / ((c.desperdicio / 100) + 1)); costo_materiales = costo_materiales + _t; } else { int q = (int)c.id; var u = from x in cotizaciones.modulos_cotizaciones where x.merge_id == q select x; if (u != null) { foreach (var x in u) { _t = (float)(x.total / ((x.utilidad / 100) + 1)); _t = (float)(_t / ((x.mano_obra / 100) + 1)); _t = (float)(_t / ((x.flete / 100) + 1)); _t = (float)(_t / ((x.desperdicio / 100) + 1)); costo_materiales = costo_materiales + _t; } } } } var v = new articulos_reporte() { concepto = c.ubicacion + " - " + c.linea + " - " + c.acabado_perfil, largo = Math.Round((float)c.largo / 1000, 2), alto = Math.Round((float)c.alto / 1000, 2), cantidad = c.cantidad, total = _total, pic = p, desp = desperdicio != 0 ? desperdicio.ToString() : c.desperdicio.ToString(), flete = flete != 0 ? flete.ToString() : c.flete.ToString(), mano_obra = mano_o != 0 ? mano_o.ToString() : c.mano_obra.ToString(), utilidad = utilidad != 0 ? utilidad.ToString() : c.utilidad.ToString(), desc_p = descuento > 0 ? "(-" + descuento + "%)\n$" + _total_desc.ToString("n") : "" }; cotizaciones.articulos_reporte.Add(v); } cotizaciones.SaveChanges(); utilidad_total = utilidad_total + (_sub_total * (this.utilidad / 100)); reportViewer1.LocalReport.SetParameters(new ReportParameter("gasto_total", Math.Round(gasto_total, 2).ToString())); reportViewer1.LocalReport.SetParameters(new ReportParameter("utilidad_total", Math.Round(utilidad_total, 2).ToString())); reportViewer1.LocalReport.SetParameters(new ReportParameter("costo_mats", Math.Round(costo_materiales, 2).ToString())); var datos = (from x in cotizaciones.datos_reporte select x); var datos_2 = (from x in cotizaciones.articulos_reporte select x); datos_reporteBindingSource.DataSource = datos.ToList(); articulos_reporteBindingSource.DataSource = datos_2.ToList(); } catch (Exception err) { MessageBox.Show(err.ToString()); } }