private void btncheck_Click(object sender, EventArgs e)
        {
            System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(InformationforCheck));
            System.IO.StreamWriter file = new System.IO.StreamWriter("3.xml");
            writer.Serialize(file, inf);
            file.Close();
            report r = new report("ReportTIcket.frx");

            r.Show();
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //    r.dgvr.Columns[0].Name = "№ маршрута";
            //    r.dgvr.Columns[1].Name = "Откуда";
            //    r.dgvr.Columns[2].Name = "Куда";
            //    r.dgvr.Columns[3].Name = "Кол-во проданных билетов";
            //    r.dgvr.Columns[4].Name = "Общая стоимость";
            //    r.dgvr.Columns[5].Name = "Кол-во возврщенных билетов на сумму";
            //    r.dgvr.Columns[6].Name = "На сумму";
            ForReportCashier fr  = new ForReportCashier();
            DateTime         now = DateTime.Now;
            var startDate        = new DateTime(now.Year, now.Month, 1);
            var endDate          = startDate.AddMonths(1).AddDays(-1);

            if ((cbroutsr.Text == "Все"))
            {
                fr.routs = "По маршрутам";
                if (rballc.Checked == true)
                {
                    fr.period = startDate.ToShortDateString() + "-" + endDate.ToShortDateString();
                }
                else
                {
                    fr.period = DateTime.Now.ToShortDateString();
                }
                fr.dateofmaking = DateTime.Now.ToLongDateString();
                for (int i = 0; i < dgvr.Rows.Count - 1; i++)
                {
                    fr.dg.Add(new ForDGVCahier(dgvr[0, i].Value.ToString(), dgvr[1, i].Value + "-" + dgvr[2, i].Value, dgvr[3, i].Value.ToString(), dgvr[5, i].Value.ToString(), (Convert.ToDouble(dgvr[4, i].Value) + Convert.ToDouble(dgvr[6, i].Value)).ToString()));
                }
                System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(ForReportCashier));
                System.IO.StreamWriter file = new System.IO.StreamWriter("2.xml");
                writer.Serialize(file, fr);
                file.Close();
                report r = new report("ReportCashier.frx");
                r.ShowDialog();
            }
            else
            {
                InformationforReport n = new InformationforReport();

                n.rout = tbrc.Text;
                if (rballc.Checked == true)
                {
                    n.fromdate = startDate.ToShortDateString();
                    n.todate   = endDate.ToShortDateString();
                }
                else
                {
                    n.fromdate = DateTime.Now.ToShortDateString();
                    n.todate   = "";
                }
                int q = 0;
                for (int i = 0; i < dgvr.Rows.Count; i++)
                {
                    q += Convert.ToInt32(dgvr[3, i].Value);
                }
                n.quantitysoldticket   = q;
                n.quantityreturnticket = Convert.ToInt32(tbrtcq.Text);
                double qd = 0;
                for (int i = 0; i < dgvr.Rows.Count; i++)
                {
                    qd += Convert.ToDouble(dgvr[4, i].Value);
                }
                n.gain = Math.Round(qd + Convert.ToDouble(tbsum.Text), 2);
                //fm.dgvman.Columns[0].Name = "№ маршрута";
                //fm.dgvman.Columns[1].Name = "Откуда";
                //fm.dgvman.Columns[2].Name = "Куда";
                //fm.dgvman.Columns[3].Name = "Кол-во проданных билетов";
                //fm.dgvman.Columns[4].Name = "Общая стоимость";
                for (int i = 0; i < dgvr.Rows.Count - 1; i++)
                {
                    n.a.Add(new DGVforReport(dgvr[1, i].Value.ToString() + "-" + dgvr[2, i].Value.ToString(), Convert.ToInt32(dgvr[3, i].Value), Convert.ToDouble(dgvr[4, i].Value)));
                }
                System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(InformationforReport));
                System.IO.StreamWriter file = new System.IO.StreamWriter("1.xml");
                writer.Serialize(file, n);
                file.Close();
                report r = new report("ReportSales.frx");
                r.Show();
            }
        }