コード例 #1
0
ファイル: frmReport_Print.cs プロジェクト: Russ0410/pos
        private void btnSearch_Click(object sender, EventArgs e)
        {
            con.Open();
            DataSet1 ds = new DataSet1();

            adpt = new MySqlDataAdapter("SELECT * FROM tblorder WHERE STR_TO_DATE(Order_TransDate, '%m/%d/%Y') BETWEEN '" + dtFrom.Value.Date.ToString("yyyy-MM-dd") + "' AND '" + dtTo.Value.Date.ToString("yyyy-MM-dd") + "'", con);
            adpt.Fill(ds.tblorder);

            reports_sales receipt = new reports_sales();

            TextObject text2 = (TextObject)receipt.ReportDefinition.Sections["Section1"].ReportObjects["Text18"];

            text2.Text = dtFrom.Value.ToShortDateString();

            TextObject text3 = (TextObject)receipt.ReportDefinition.Sections["Section1"].ReportObjects["Text15"];

            text3.Text = dtTo.Value.ToShortDateString();

            TextObject text4 = (TextObject)receipt.ReportDefinition.Sections["Section4"].ReportObjects["prepared"];

            text4.Text = account.UserFullName;

            receipt.SetDataSource(ds);

            crpReports.ReportSource = receipt;
            crpReports.RefreshReport();
            con.Close();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            con.Open();
            DataSet1 ds = new DataSet1();

            adpt = new MySqlDataAdapter("SELECT * FROM tblorder ORDER BY Order_Id ASC", con);
            adpt.Fill(ds.tblorder);

            //adpt = new MySqlDataAdapter("SELECT * FROM tblaccount where userId = " + account.UserAccountId + "", con);
            //adpt.Fill(ds.tblaccount);

            reports_sales   receipt = new reports_sales();
            frmReport_Print rpt     = new frmReport_Print();

            int        count = ds.Tables[0].Rows.Count;
            DataRow    dr    = ds.Tables[0].Rows[0];
            DataRow    dr2   = ds.Tables[0].Rows[count - 1];
            TextObject text2 = (TextObject)receipt.ReportDefinition.Sections["Section1"].ReportObjects["Text18"];
            TextObject text3 = (TextObject)receipt.ReportDefinition.Sections["Section1"].ReportObjects["Text15"];

            if (count > 0)
            {
                DateTime dateAndTime1 = DateTime.Parse(dr["Order_TransDate"].ToString());
                DateTime dateAndTime2 = DateTime.Parse(dr2["Order_TransDate"].ToString());
                text2.Text = dateAndTime1.ToShortDateString();
                text3.Text = dateAndTime2.ToShortDateString();
            }
            else
            {
                text2.Text = "--/--/----";
                text3.Text = "--/--/----";
            }

            TextObject text4 = (TextObject)receipt.ReportDefinition.Sections["Section4"].ReportObjects["prepared"];

            text4.Text = account.UserFullName;

            receipt.SetDataSource(ds);

            rpt.crpReports.ReportSource = receipt;
            rpt.crpReports.RefreshReport();

            rpt.label1.Visible    = true;
            rpt.label2.Visible    = true;
            rpt.dtFrom.Visible    = true;
            rpt.dtTo.Visible      = true;
            rpt.btnSearch.Visible = true;
            rpt.label3.Visible    = true;
            rpt.cboxCat.Visible   = true;

            //account.Report_type = "Sales";
            rpt.Show(this);
            con.Close();

            //strLogs = "View Sales Report";
            //Logs2();
        }
コード例 #3
0
ファイル: frmReport_Print.cs プロジェクト: Russ0410/pos
        private void selectAll()
        {
            con.Open();
            DataSet1 ds = new DataSet1();

            adpt = new MySqlDataAdapter("SELECT * FROM tblorder", con);
            adpt.Fill(ds.tblorder);

            reports_sales receipt = new reports_sales();

            TextObject text4 = (TextObject)receipt.ReportDefinition.Sections["Section4"].ReportObjects["prepared"];

            text4.Text = account.UserFullName;

            receipt.SetDataSource(ds);

            crpReports.ReportSource = receipt;
            crpReports.RefreshReport();
            con.Close();
        }