private void getComprobanteParcialAlumno()
        {
            var client     = new MongoClient(Global.Path_DataBase);
            var database   = client.GetDatabase("Personas");
            var collection = database.GetCollection <BsonDocument>("Comprobantes");
            var filter     = Builders <BsonDocument> .Filter.Eq("Fecha", this.Fecha) & Builders <BsonDocument> .Filter.Eq("NumeroComprobante", this.NumeroComprobante);

            var result = collection.Find(filter).ToList();

            foreach (var doc in result)
            {
                this.NombrePersona = doc.GetValue("Nombre", "NO posee Nombre").AsString;
                var clases = doc.GetValue("Clases", "No posee").AsBsonArray;
                foreach (var clase in clases)
                {
                    Comprobantemin auxComprobantemin = new Comprobantemin();
                    auxComprobantemin.CantidadClases   = doc.GetValue("CantidadClases", "No posee").AsString;
                    auxComprobantemin.Profesor         = doc.GetValue("Profesor", "No posee").AsString;
                    auxComprobantemin.Precio           = doc.GetValue("Precio", "No posee").AsString;
                    auxComprobantemin.ClasesTomar      = doc.GetValue("ClasesTomar", "No posee").AsString;
                    auxComprobantemin.Descripcion      = doc.GetValue("Descripcion", "No posee").AsString;
                    auxComprobantemin.cantidadElegidos = doc.GetValue("cantidadElegidos", "No posee").AsString;
                    auxComprobantemin.Total            = doc.GetValue("Total", "No posee").AsString;
                    this.Clases.Add(auxComprobantemin);
                }
            }
        }
Пример #2
0
        public void retriveComprobante()
        {
            var client = new MongoClient(Global.Path_DataBase); var database = client.GetDatabase("Personas");
            var collection = database.GetCollection <BsonDocument>("Comprobantes");
            var builder    = Builders <BsonDocument> .Filter;
            var filter     = builder.Eq("NumeroComprobante", this.NumeroComprobante) & builder.Eq("Nombre", this.Nombre);
            var result     = collection.Find(filter).ToList();

            foreach (var doc in result)
            {
                this.Diferencia_Comprobante_Numero = doc.GetValue("DiferenciaReciboNumero", "").AsString;
                var clases = doc.GetValue("Clases", "No posee").AsBsonArray;
                this.comprobantes.Clear();
                foreach (var clase in clases)
                {
                    var            clase2         = clase.AsBsonDocument;
                    Comprobantemin comprobanteaux = new Comprobantemin();
                    comprobanteaux.CantidadClases   = clase2.GetValue("CantidadClases", "No Posee").AsString;
                    comprobanteaux.Profesor         = clase2.GetValue("Profesor", "No Posee").AsString;
                    comprobanteaux.Precio           = clase2.GetValue("Precio", "No Posee").AsString;
                    comprobanteaux.ClasesTomar      = clase2.GetValue("ClasesTomar", "No Posee").AsString;
                    comprobanteaux.Descripcion      = clase2.GetValue("Descripcion", "No Posee").AsString;
                    comprobanteaux.cantidadElegidos = clase2.GetValue("cantidadElegidos", "No Posee").AsString;
                    comprobanteaux.Total            = clase2.GetValue("Total", "No Posee").AsString;
                    this.comprobantes.Add(comprobanteaux);
                }
            }
        }
        private void borrarComprobateProfesor(Comprobantemin clase)
        {
            string   carpeta   = Global.getDire();
            DateTime oDate     = Convert.ToDateTime(this.Fecha);
            string   fecha     = oDate.ToString("yyyy") + oDate.ToString("MMMM") + clase.Profesor;
            string   direccion = @carpeta + "\\Liquidaciones\\" + fecha;

            try
            {
                File.Copy(Global.LiquidacionesServer + Path.GetFileName(direccion + ".xlsx"), Global.Liquidaciones + Path.GetFileName(direccion + ".xlsx"), true);
            }
            catch (System.IO.FileNotFoundException)
            {
            }


            object misValue = System.Reflection.Missing.Value;

            Excel.Application xlApp = new Excel.Application();
            Excel.Workbook    xlWorkbook;
            Excel._Worksheet  xlWorksheet;

            try
            {
                xlWorkbook  = xlApp.Workbooks.Open(direccion, Type.Missing, Type.Missing, Type.Missing, Global.Connect());
                xlWorksheet = (Excel.Worksheet)xlWorkbook.Worksheets.get_Item(1);
                Excel.Range xlRange   = xlWorksheet.UsedRange;
                int         rowNumber = xlRange.Rows.Count + 1;


                xlRange.Cells[rowNumber, "A"] = this.MinComprobanteAll.Fecha;
                xlRange.Cells[rowNumber, "B"] = this.MinComprobanteAll.Nombre;
                xlRange.Cells[rowNumber, "C"] = this.Motivo;
                xlRange.Cells[rowNumber, "D"] = clase.CantidadClases;
                xlRange.Cells[rowNumber, "E"] = clase.Profesor;
                xlRange.Cells[rowNumber, "F"] = "-" + clase.Total;
                xlRange.Cells[rowNumber, "G"] = this.MinComprobanteAll.NumeroComprobante;

                xlApp.DisplayAlerts = false;
                xlWorkbook.SaveAs(direccion);
                xlWorkbook.Close();
                xlApp.Quit();

                Marshal.ReleaseComObject(xlWorksheet);
                Marshal.ReleaseComObject(xlWorkbook);
                Marshal.ReleaseComObject(xlApp);

                File.Copy(Global.Liquidaciones + Path.GetFileName(direccion + ".xlsx"), Global.LiquidacionesServer + Path.GetFileName(direccion + ".xlsx"), true);
            }
            catch
            {
                MessageBox.Show("No existe ese archivo");
            }
        }
        private void button1_Click_4(object sender, EventArgs e)
        {
            try
            {
                MinComprobante auxComprobante = new MinComprobante();

                var client     = new MongoClient(Global.Path_DataBase);
                var database   = client.GetDatabase("Personas");
                var collection = database.GetCollection <BsonDocument>("Comprobantes");
                var builder    = Builders <BsonDocument> .Filter;
                var filter     = builder.Eq("NumeroComprobante", textBox1.Text);
                var result     = collection.Find(filter).ToList();
                foreach (var doc in result)
                {
                    auxComprobante.Fecha             = doc.GetValue("Fecha", "no posee").AsString;
                    auxComprobante.NumeroComprobante = doc.GetValue("NumeroComprobante", "no posee").AsString;
                    auxComprobante.Nombre            = doc.GetValue("Nombre", "no posee").AsString;

                    var clase = doc.GetValue("Clases", "No posee").AsBsonArray;
                    foreach (var doc2 in clase)
                    {
                        var            clase2         = doc2.AsBsonDocument;
                        Comprobantemin comprobanteaux = new Comprobantemin();
                        comprobanteaux.CantidadClases   = clase2.GetValue("CantidadClases", "No Posee").AsString;
                        comprobanteaux.Profesor         = clase2.GetValue("Profesor", "No Posee").AsString;
                        comprobanteaux.Precio           = clase2.GetValue("Precio", "No Posee").AsString;
                        comprobanteaux.ClasesTomar      = clase2.GetValue("ClasesTomar", "No Posee").AsString;
                        comprobanteaux.Descripcion      = clase2.GetValue("Descripcion", "No Posee").AsString;
                        comprobanteaux.cantidadElegidos = clase2.GetValue("cantidadElegidos", "No Posee").AsString;
                        comprobanteaux.Total            = clase2.GetValue("Total", "No Posee").AsString;
                        auxComprobante.comprobantes.Add(comprobanteaux);
                    }
                }

                this.Hide();
                //string name, string price, string teacher, string amount, string clasesTotal)
                Comprobante_Para_Reimpresion frm3 = new Comprobante_Para_Reimpresion(auxComprobante);
                frm3.ShowDialog();
                this.Show();
            }
            catch
            {
                MessageBox.Show("El Numero de recibo es incorrecto o el recibo no existe");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Comprobantemin auxClase = (Comprobantemin)objectListView1.CheckedObject;
            MinComprobante resp     = new MinComprobante();

            resp = this.comprobante;
            resp.Diferencia_Comprobante_Numero = Numero_Comprobante;
            resp.comprobantes.Clear();
            resp.comprobantes.Add(auxClase);

            if (auxClase == null)
            {
                MessageBox.Show("No Selecciono una clase para generar la diferencia");
            }
            else
            {
                this.Hide();
                //string name, string price, string teacher, string amount, string clasesTotal)
                Diferencia_Recibos frm3 = new Diferencia_Recibos(resp, comprobante.Nombre);
                frm3.ShowDialog();
                this.Show();
            }
        }
Пример #6
0
        public void CargarComprobanteEnAlumno(Stack <string> comprobantes)
        {
            Stack <MinComprobante> stackComprobantes = new Stack <MinComprobante>();
            var client     = new MongoClient(Global.Path_DataBase);
            var database   = client.GetDatabase("Personas");
            var collection = database.GetCollection <BsonDocument>("Comprobantes");

            foreach (var recibo in comprobantes)
            {
                var            builder        = Builders <BsonDocument> .Filter;
                var            filter         = builder.Eq("NumeroComprobante", recibo) & builder.Eq("Nombre", this.Name);
                var            result         = collection.Find(filter).ToList();
                MinComprobante auxComprobante = new MinComprobante();
                foreach (var doc in result)
                {
                    auxComprobante.Fecha             = doc.GetValue("Fecha", "no posee").AsString;
                    auxComprobante.NumeroComprobante = doc.GetValue("NumeroComprobante", "no posee").AsString;
                    auxComprobante.Nombre            = doc.GetValue("Nombre", "no posee").AsString;

                    var clase = doc.GetValue("Clases", "No posee").AsBsonArray;
                    foreach (var doc2 in clase)
                    {
                        var            clase2         = doc2.AsBsonDocument;
                        Comprobantemin comprobanteaux = new Comprobantemin();
                        comprobanteaux.CantidadClases   = clase2.GetValue("CantidadClases", "No Posee").AsString;
                        comprobanteaux.Profesor         = clase2.GetValue("Profesor", "No Posee").AsString;
                        comprobanteaux.Precio           = clase2.GetValue("Precio", "No Posee").AsString;
                        comprobanteaux.ClasesTomar      = clase2.GetValue("ClasesTomar", "No Posee").AsString;
                        comprobanteaux.Descripcion      = clase2.GetValue("Descripcion", "No Posee").AsString;
                        comprobanteaux.cantidadElegidos = clase2.GetValue("cantidadElegidos", "No Posee").AsString;
                        comprobanteaux.Total            = clase2.GetValue("Total", "No Posee").AsString;
                        auxComprobante.comprobantes.Add(comprobanteaux);
                    }
                    this.ComprobantesCompletosAlumnos.Add(auxComprobante);
                }
            }
        }
Пример #7
0
        private void Imprimir_Click(object sender, EventArgs e)
        {
            try
            {
                Comprobantemin auxComprobantemin = (Comprobantemin)objectListView1.CheckedObject;
                Clase          auxClase          = auxComprobantemin.trasforToClase();
                auxClase.Descripcion    = "Nota de Credito Recibo Numero: " + Comprobante.NumeroComprobante;
                auxClase.Total          = "-" + textBox1.Text;
                auxClase.Precio         = "-" + textBox1.Text;
                auxClase.CantidadClases = "Nota de Credito Recibo Numero: " + Comprobante.NumeroComprobante;
                List <Clase> listToSend = new List <Clase>();
                listToSend.Add(auxClase);

                this.Hide();
                //string name, string price, string teacher, string amount, string clasesTotal)
                ImprimirTicket frm3 = new ImprimirTicket(listToSend, Comprobante.Nombre, false);
                frm3.ShowDialog();
                this.Show();
            }
            catch
            {
                MessageBox.Show("No selecciono la clase");
            }
        }