Ejemplo n.º 1
0
        public void combo_a(string FILE_NAME)
        {
            string temp;

            cmb_año.Items.Clear();
            operaciones_archivos op         = new operaciones_archivos();
            DateTime             fecha_hora = DateTime.Now;

            string[] archivos = op.revicion_total(FILE_NAME);
            string[] espliteado;
            for (int i = 0; i < archivos.Length - 1; i++)
            {
                temp       = archivos[i];
                espliteado = temp.Split(G_parametros);
                cmb_año.Items.Add(espliteado[0]);
            }
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------

        public void combo_a(string FILE_NAME)
        {
            lbl_ganancia.Visible = false;
            txt_ganancia.Visible = false;

            string temp;

            cmb_año.Items.Clear();                                        //limpia contenido del combo
            operaciones_archivos op         = new operaciones_archivos(); //op es la clase operaciones de archivos
            DateTime             fecha_hora = DateTime.Now;               //contiene la fecha y hora de hoy

            string[] archivos = op.revicion_total(FILE_NAME);             //revisa todo el contenido del archivo
            string[] espliteado;                                          //es una arreglo
            for (int i = 0; i < archivos.Length - 1; i++)
            {
                temp       = archivos[i];
                espliteado = temp.Split(G_parametros);
                cmb_año.Items.Add(espliteado[0]);
            }
        }
Ejemplo n.º 3
0
        public void grafica_ganancias(string FILE_NAME, string FILE_NAME2, string nombre_serie, string nombre_serie2, bool comparacion = false)
        {
            chrt_ventas.Series.Clear();
            try
            {
                chrt_ventas.Series.Add(nombre_serie);
                chrt_ventas.Series.Add(nombre_serie2);
            }
            catch (Exception)
            {
                MessageBox.Show("tienen que ser diferentes las fechas de comparacion");
                return;
            }

            chrt_ventas.Series[nombre_serie].ChartType  = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chrt_ventas.Series[nombre_serie2].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            operaciones_archivos op = new operaciones_archivos();

            string[] esplitedo     = { "", "" }, esplitedo2 = { "", "" }, historial, historial2;
            int      cual_es_mayor = 0;

            historial  = op.revicion_total(FILE_NAME);
            historial2 = op.revicion_total(FILE_NAME2);

            if (historial.Length >= historial2.Length)//esta la puse para el listbox saber cuantos items  va  a contener
            {
                cual_es_mayor = historial.Length;
            }
            else
            {
                cual_es_mayor = historial2.Length;
            }

            int cual_anotar = 0;

            for (int i = 0; i < cual_es_mayor; i++)
            {
                if (i < historial.Length)
                {
                    esplitedo = historial[i].Split(G_parametros);
                    chrt_ventas.Series[0].Points.AddXY(esplitedo[0], esplitedo[1]);
                    cual_anotar = cual_anotar + 1;
                }
                if (i < historial2.Length)
                {
                    esplitedo2 = historial2[i].Split(G_parametros);
                    chrt_ventas.Series[1].Points.AddXY(esplitedo2[0], esplitedo2[1]);
                    cual_anotar = cual_anotar + 2;
                }

                switch (cual_anotar)
                {
                case 1:
                    lst_ventas.Items.Add(esplitedo[0] + G_parametros[0] + esplitedo[1] + "          ");
                    break;

                case 2:
                    lst_ventas.Items.Add("          " + esplitedo2[0] + G_parametros[0] + esplitedo2[1]);
                    break;

                case 3:
                    lst_ventas.Items.Add(esplitedo[0] + G_parametros[0] + esplitedo[1] + "          " + esplitedo2[0] + G_parametros[0] + esplitedo2[1]);
                    break;

                default:
                    MessageBox.Show("error switch");
                    break;
                }

                cual_anotar = 0;
            }
            esplitedo  = historial[historial.Length - 1].Split(G_parametros);
            esplitedo2 = historial2[historial2.Length - 1].Split(G_parametros);

            txt_total.Text    = "ventas: " + esplitedo[1];
            txt_total.Text    = txt_total.Text + ";  " + "gastos: " + esplitedo2[1];
            txt_ganancia.Text = "" + (Convert.ToDouble(esplitedo[1]) - Convert.ToDouble(esplitedo2[1]));
        }