private void BtnVerRangoFecha_Click(object sender, EventArgs e) { Cls_N_Reportes.acumulador = 0; ArrayList temp = new ArrayList(); DateTime fechainicio = Convert.ToDateTime(dtFechainicio.Value.ToShortDateString()); DateTime fechafin = Convert.ToDateTime(dtFechaFin.Value.ToShortDateString()); DateTime fecha; foreach (DataGridViewRow fila in dgBoleta.Rows) { fecha = Convert.ToDateTime(fila.Cells[3].Value); if (fecha >= fechainicio && fecha <= fechafin && fila.Cells[8].Value.ToString() != "0") { Cls_E_Boleta objE = new Cls_E_Boleta(); Cls_N_Reportes objN = new Cls_N_Reportes(); Cls_E_Boleta objEBoleta = new Cls_E_Boleta(); objEBoleta.Serie = fila.Cells[0].Value.ToString(); objEBoleta.Numero = fila.Cells[1].Value.ToString(); objEBoleta.Empleado = fila.Cells[2].Value.ToString(); objEBoleta.Fecha = Convert.ToDateTime(fila.Cells[3].Value.ToString()); objEBoleta.Cliente = fila.Cells[4].Value.ToString(); objEBoleta.Subtotal = double.Parse(fila.Cells[5].Value.ToString()); objEBoleta.Igv = double.Parse(fila.Cells[6].Value.ToString()); objEBoleta.Total = double.Parse(fila.Cells[7].Value.ToString()); objEBoleta.Estado = fila.Cells[8].Value.ToString(); temp.Add(objEBoleta); Cls_N_Reportes.acumulador = Cls_N_Reportes.acumulador + float.Parse(fila.Cells[7].Value.ToString()); } } dgConsultaBoleta.DataSource = null; dgConsultaBoleta.DataSource = temp; txtTotal.Text = Cls_N_Reportes.acumulador.ToString(); }
private void BtnMensual_Click(object sender, EventArgs e) { dgConsultas.DataSource = null; dgCompras.DataSource = null; Cls_N_Reportes objN = new Cls_N_Reportes(); mensual = objN.MtdGastosMensuales(); dgConsultas.DataSource = mensual; compras = objN.MtdComprasMensuales(); dgCompras.DataSource = compras; foreach (DataGridViewRow fila in dgConsultas.Rows) { Cls_E_ReporteGastos objE = new Cls_E_ReporteGastos(); objE.Total = double.Parse(fila.Cells[0].Value.ToString()); objE.Mes = fila.Cells[1].Value.ToString(); total.Add(objE); } //foreach (DataGridViewRow fila in dgCompras.Rows) //{ // int i = 1; // if (fila.Cells[1].Value.ToString() == i.ToString()) // { // double x = Convert.ToDouble(total[i]) + Convert.ToDouble(fila.Cells[0].Value); // total[i] = x; // } // i++; //} mtdGrafica2(); }
private void Button1_Click(object sender, EventArgs e) { Cls_N_Reportes.acumulador = 0; ArrayList temp = new ArrayList(); temp.Clear(); foreach (DataGridViewRow fila in dgBoleta.Rows) { if (fila.Cells[3].Value.ToString() == dtFecha.Value.ToShortDateString() && fila.Cells[8].Value.ToString() != "0") { Cls_N_Reportes objN = new Cls_N_Reportes(); Cls_E_Boleta objEBoleta = new Cls_E_Boleta(); objEBoleta.Serie = fila.Cells[0].Value.ToString(); objEBoleta.Numero = fila.Cells[1].Value.ToString(); objEBoleta.Empleado = fila.Cells[2].Value.ToString(); objEBoleta.Fecha = Convert.ToDateTime(fila.Cells[3].Value.ToString()); objEBoleta.Cliente = fila.Cells[4].Value.ToString(); objEBoleta.Subtotal = double.Parse(fila.Cells[5].Value.ToString()); objEBoleta.Igv = double.Parse(fila.Cells[6].Value.ToString()); objEBoleta.Total = double.Parse(fila.Cells[7].Value.ToString()); objEBoleta.Estado = fila.Cells[8].Value.ToString(); temp.Add(objEBoleta); if (objEBoleta.Estado != "0") { Cls_N_Reportes.acumulador = Cls_N_Reportes.acumulador + float.Parse(fila.Cells[7].Value.ToString()); } } } dgConsultaBoleta.DataSource = null; dgConsultaBoleta.DataSource = temp; txtTotal.Text = Cls_N_Reportes.acumulador.ToString(); mtdPintarCeldas(); }
private void Form_VentasDia_Load(object sender, EventArgs e) { Cls_N_Reportes objN = new Cls_N_Reportes(); Aboleta = objN.MtdLeerBoleta(); dgBoleta.DataSource = null; dgBoleta.DataSource = Aboleta; }
private void BtnRefrescar_Click(object sender, EventArgs e) { Cls_N_Reportes objN = new Cls_N_Reportes(); Aboleta = objN.MtdLeerBoleta(); dgBoleta.DataSource = null; dgBoleta.DataSource = Aboleta; }
private void BtnAnual_Click(object sender, EventArgs e) { dgConsultas.DataSource = null; Cls_N_Reportes objN = new Cls_N_Reportes(); mensual = objN.MtdGastosAnual(); dgConsultas.DataSource = mensual; mtdGrafica2(); }
private void Form_EmpleadoReporte_Load(object sender, EventArgs e) { dgConsultas.DataSource = null; Cls_N_Reportes objN = new Cls_N_Reportes(); mensual = objN.MtdEmpleadoProductivo(); dgConsultas.DataSource = mensual; mtdGrafica2(); }
private void BtnSemestral_Click(object sender, EventArgs e) { dgConsultas.DataSource = null; Cls_N_Reportes objN = new Cls_N_Reportes(); mensual = objN.MtdIngresosSEMESTRAL(); dgConsultas.DataSource = mensual; mtdGrafica2(); }
private void BtnSemestral_Click(object sender, EventArgs e) { dgConsultas.DataSource = null; Cls_N_Reportes objN = new Cls_N_Reportes(); mensual = objN.MtdGastosSemestrales(); dgConsultas.DataSource = mensual; compras = objN.MtdCompraSemestrales(); dgCompras.DataSource = compras; mtdGrafica2(); }
private void Form_VerGanancia_Load(object sender, EventArgs e) { double gastos = 0, ingresos = 0; Cls_N_Reportes objN = new Cls_N_Reportes(); DataTable gasto = objN.MtdGastosAnual(); DataTable ingreso = objN.MtdIngresosANUAL(); foreach (DataRow fila in gasto.Rows) { gastos = double.Parse(fila[0].ToString()); } foreach (DataRow fila in ingreso.Rows) { ingresos = double.Parse(fila[0].ToString()); } dgConsulta.Rows.Add(gastos.ToString(), "GASTOS"); dgConsulta.Rows.Add(ingresos.ToString(), "INGRESOS"); mtdGrafica2(); acumulador_ganancias = ingresos - gastos; txtGanancia.Text = acumulador_ganancias.ToString(); }
private void DgConsultaBoleta_Click(object sender, EventArgs e) { Cls_N_Reportes objN = new Cls_N_Reportes(); dgBoleta.DataSource = null; }
private void PicImprimir_Click(object sender, EventArgs e) { if (cbImpresion.SelectedIndex == 0) { SaveFileDialog ficheroPdf = new SaveFileDialog(); ficheroPdf.Filter = "PDF Files (*.pdf)|*.pdf|All Files (*.*)|*.*"; if (ficheroPdf.ShowDialog() == DialogResult.OK) { string filename = ficheroPdf.FileName; Document doc = new Document(PageSize.A3, 9, 9, 9, 9); Chunk encab = new Chunk("REPORTE DE VENTA DE FECHA " + dtFecha.Value.ToShortDateString(), FontFactory.GetFont("COURIER", 18)); Chunk salto = new Chunk("\n"); try { FileStream file = new FileStream(filename, FileMode.OpenOrCreate); PdfWriter writer = PdfWriter.GetInstance(doc, file); writer.ViewerPreferences = PdfWriter.PageModeUseThumbs; writer.ViewerPreferences = PdfWriter.PageLayoutOneColumn; doc.Open(); doc.Add(new Paragraph(encab)); doc.Add(new Paragraph(salto)); doc.Add(new Paragraph(salto)); Cls_N_Reportes objN = new Cls_N_Reportes(); GenerarDocumentos(doc); Process.Start(filename); doc.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } else if (cbImpresion.SelectedIndex == 2) { SaveFileDialog ficheroExcel = new SaveFileDialog(); ficheroExcel.Filter = "Excel (*.xls)|*.xls"; if (ficheroExcel.ShowDialog() == DialogResult.OK) { Microsoft.Office.Interop.Excel.Application aplicacion; Microsoft.Office.Interop.Excel.Workbook libros_trabajo; Microsoft.Office.Interop.Excel.Worksheet hoja_trabajo; aplicacion = new Microsoft.Office.Interop.Excel.Application(); libros_trabajo = aplicacion.Workbooks.Add(); hoja_trabajo = (Microsoft.Office.Interop.Excel.Worksheet)libros_trabajo.Worksheets.get_Item(1); hoja_trabajo.Cells[2, 2] = "REPORTE - FECHA " + dtFecha.Value.ToShortDateString(); hoja_trabajo.Cells[4, 1] = "SERIE"; hoja_trabajo.Cells[4, 2] = "NUMERO"; hoja_trabajo.Cells[4, 3] = "SERIE"; hoja_trabajo.Cells[4, 4] = "EMPLEADO"; hoja_trabajo.Cells[4, 5] = "FECHA"; hoja_trabajo.Cells[4, 6] = "IMPORTE"; hoja_trabajo.Cells[4, 7] = "IGV"; hoja_trabajo.Cells[4, 8] = "TOTAL"; hoja_trabajo.Cells[4, 9] = "ESTADO"; //Recorremos el DataGridView rellenando la hoja de trabajo for (int i = 0; i < dgConsultaBoleta.Rows.Count; i++) { for (int j = 0; j < dgConsultaBoleta.Columns.Count; j++) { hoja_trabajo.Cells[i + 5, j + 1] = dgConsultaBoleta.Rows[i].Cells[j].Value.ToString(); } } hoja_trabajo.Cells[dgConsultaBoleta.Rows.Count + 6, 7] = "TOTAL: "; hoja_trabajo.Cells[dgConsultaBoleta.Rows.Count + 6, 8] = txtTotal.Text; libros_trabajo.SaveAs(ficheroExcel.FileName, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal); libros_trabajo.Close(true); aplicacion.Quit(); } } else if (cbImpresion.SelectedIndex == 1) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Word Documents (*.doc)|*.doc"; sfd.FileName = ""; if (sfd.ShowDialog() == DialogResult.OK) { //ToCsV(dataGridView1, @"c:\export.xls"); ToCsV(dgConsultaBoleta, sfd.FileName); // Here dataGridview1 is your grid view name } } }