Ejemplo n.º 1
0
        public DolazakNaTreningMesecniIzvestaj(DateTime from, DateTime to, bool samoNedostajuceUplate)
        {
            if (samoNedostajuceUplate)
                Title = "Nedostaju\u0107e uplate";
            else
                Title = "Dolazak na trening i uplate - mese\u010Dni";
            string subtitle;
            string format = "MMMM yyyy";
            if (from.Year == to.Year && from .Month == to.Month)
            {
                subtitle = from.ToString(format);
            }
            else
            {
                subtitle = from.ToString(format) + " - " + to.ToString(format);
            }
            SubTitle = subtitle;
            DocumentName = Title;

            clanFont = new Font("Arial", 10, FontStyle.Bold);
            itemFont = new Font("Courier New", 9);
            Font itemsHeaderFont = null;
            Font groupTitleFont = new Font("Courier New", 10, FontStyle.Bold);
            lista = new DolazakNaTreningMesecniLista(from, to, this, 1, 0f,
                itemFont, itemsHeaderFont, groupTitleFont, samoNedostajuceUplate);
        }
Ejemplo n.º 2
0
        public DolazakNaTreningMesecniIzvestaj(DateTime from, DateTime to, bool samoNedostajuceUplate)
        {
            if (samoNedostajuceUplate)
            {
                Title = "Nedostaju\u0107e uplate";
            }
            else
            {
                Title = "Dolazak na trening i uplate - mese\u010Dni";
            }
            string subtitle;
            string format = "MMMM yyyy";

            if (from.Year == to.Year && from.Month == to.Month)
            {
                subtitle = from.ToString(format);
            }
            else
            {
                subtitle = from.ToString(format) + " - " + to.ToString(format);
            }
            SubTitle     = subtitle;
            DocumentName = Title;

            clanFont = new Font("Arial", 10, FontStyle.Bold);
            itemFont = new Font("Courier New", 9);
            Font itemsHeaderFont = null;
            Font groupTitleFont  = new Font("Courier New", 10, FontStyle.Bold);

            lista = new DolazakNaTreningMesecniLista(from, to, this, 1, 0f,
                                                     itemFont, itemsHeaderFont, groupTitleFont, samoNedostajuceUplate);
        }
Ejemplo n.º 3
0
        private void mnNedostajuceUplate_Click(object sender, EventArgs e)
        {
            BiracIntervala dlg;
            try
            {
                dlg = new BiracIntervala("Nedostajuce uplate", false, false, true);
                dlg.ShowDialog();
            }
            catch (InfrastructureException ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }
            catch (Exception ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }

            if (dlg.DialogResult != DialogResult.OK)
                return;

            PrintOrExportForm form = new PrintOrExportForm();
            if (form.ShowDialog() != DialogResult.OK)
                return;
            bool exportToFile = form.Eksportuj;
            String fileName = "";
            if (exportToFile)
            {
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.Title = "Snimi izvestaj";
                saveFileDialog1.Filter = "Text Documents (*.txt)|*.txt";
                saveFileDialog1.FileName = "Nedostajuce uplate.txt";
                if (saveFileDialog1.ShowDialog() != DialogResult.OK)
                    return;
                fileName = saveFileDialog1.FileName;
            }

            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();
            try
            {
                using (ISession session = NHibernateHelper.Instance.OpenSession())
                using (session.BeginTransaction())
                {
                    CurrentSessionContext.Bind(session);
                    if (exportToFile)
                    {
                        StreamWriter streamWriter = File.CreateText(fileName);
                        streamWriter.WriteLine("NEDOSTAJU\u0106E UPLATE");
                        streamWriter.WriteLine("");
                        List<object[]> items = new DolazakNaTreningMesecniLista(dlg.OdDatum, dlg.DoDatum, true).getItems();
                        foreach (object[] item in items)
                        {
                            streamWriter.WriteLine(item[0].ToString() + '\t' + item[1].ToString() + '\t' + item[2].ToString());
                        }
                        streamWriter.Close();
                    }
                    else
                    {
                        PreviewDialog p = new PreviewDialog();
                        p.setIzvestaj(new DolazakNaTreningMesecniIzvestaj(dlg.OdDatum, dlg.DoDatum, true));
                        p.ShowDialog();
                    }
                }
            }
            catch (InfrastructureException ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
            }
            catch (Exception ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
            }
            finally
            {
                CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory);
                Cursor.Hide();
                Cursor.Current = Cursors.Arrow;
            }
        }