private void btnCreateVersion_Click(object sender, EventArgs e)
        {
            if (mAssignment.WorkflowStatusId != WorkflowStatus.Complete)
            {
                MessageBox.Show("Order must be saved as complete first");
                return;
            }

            int newVersion = mAssignment.AnalysisReportVersion + 1;

            if (mAssignment.AnalysisReportVersion > 0)
            {
                FormReportAuditComment form = new FormReportAuditComment();
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                mAssignment.AuditComment += "v." + newVersion + ": " + form.SelectedComment + Environment.NewLine;
            }

            SqlConnection conn = null;

            try
            {
                conn = DB.OpenConnection();
                mAssignment.AnalysisReportVersion = newVersion;
                mAssignment.Dirty = true;
                mAssignment.StoreToDB(conn, null);

                DataTable1TableAdapter.Fill(DSOrderReport.DataTable1, mAssignment.Name);
                DataTable2TableAdapter.Fill(DSOrderReport.DataTable2, mAssignment.Name);

                reportViewer.LocalReport.DataSources.Clear();
                ReportDataSource rd1 = new ReportDataSource("DataSet1", DSOrderReport.Tables[0]);
                ReportDataSource rd2 = new ReportDataSource("DataSet2", DSOrderReport.Tables[1]);
                reportViewer.LocalReport.DataSources.Add(rd1);
                reportViewer.LocalReport.DataSources.Add(rd2);
                reportViewer.LocalReport.Refresh();
                reportViewer.RefreshReport();

                mContent = reportViewer.LocalReport.Render("PDF", "");

                mHasNewVersion           = true;
                btnCreateVersion.Enabled = false;
            }
            catch (Exception ex)
            {
                Common.Log.Error(ex);
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn?.Close();
            }
        }
        private void FormReportViewer_Load(object sender, EventArgs e)
        {
            DataTable1TableAdapter.Fill(DSOrderReport.DataTable1, mAssignment.Name);
            DataTable2TableAdapter.Fill(DSOrderReport.DataTable2, mAssignment.Name);

            reportViewer.LocalReport.DataSources.Clear();
            ReportDataSource rd1 = new ReportDataSource("DataSet1", DSOrderReport.Tables[0]);
            ReportDataSource rd2 = new ReportDataSource("DataSet2", DSOrderReport.Tables[1]);

            reportViewer.LocalReport.DataSources.Add(rd1);
            reportViewer.LocalReport.DataSources.Add(rd2);
            reportViewer.LocalReport.Refresh();
            reportViewer.RefreshReport();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Master.DataFromPageLabelControl("Doctor");

        DataTable2TableAdapter adap = new DataTable2TableAdapter();
        DataSet1.DataTable2DataTable dt = new DataSet1.DataTable2DataTable();
           // Response.Write(Session["DocID"].ToString());
        dt = adap.GetData(Session["DocID"].ToString());

        GridView1.DataSource = dt;
        GridView1.DataBind();
        }
    }
Exemplo n.º 4
0
        private void recordWithPaymentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string company       = comboBox1.Text;
                string contactperson = textBox2.Text;
                string address       = textBox1.Text;
                Int64  ph            = Int64.Parse(maskedTextBox1.Text);
                string shiptoo       = "";
                try { shiptoo = textBox3.Text; }
                catch { shiptoo = ""; }

                string shipbyy = "";
                try { shipbyy = textBox6.Text; }
                catch { shipbyy = ""; }

                Int64 shipcost = 0;
                try
                { shipcost = Int64.Parse(maskedTextBox2.Text); }
                catch
                { shipcost = 0; }

                string date    = dateTimePicker1.Text;
                Int64  payment = 0;
                try { payment = Int64.Parse(domainUpDown2.Text); }
                catch { payment = 0; }

                string salesperson = "";
                try { salesperson = textBox5.Text; }
                catch { salesperson = ""; }

                string note = "";
                try { note = textBox4.Text; }
                catch { note = ""; }
                double      total  = double.Parse(label9.Text) + shipcost;
                double      paid   = double.Parse(label9.Text);
                double      change = 0;
                string      done   = "true";
                int         idd    = 0;
                ado_project d      = new ado_project();

                d.select_id_Companyname(company, ref idd);
                d.insert_invoice(company, contactperson, address, ph, shiptoo, shipbyy, shipcost, date, date, payment, salesperson, note, total, paid, change, done, idd);

                int use_id = 0;
                d.select_id(company, date, ref use_id);
                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    Int64  amount_num   = Int64.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString());
                    int    item         = int.Parse(dataGridView1.Rows[i].Cells[1].Value.ToString());
                    string descriiption = dataGridView1.Rows[i].Cells[2].Value.ToString();
                    Int64  unittprice   = Int64.Parse(dataGridView1.Rows[i].Cells[3].Value.ToString());
                    Int64  ssuptotal    = Int64.Parse(dataGridView1.Rows[i].Cells[4].Value.ToString());

                    //string itemm = "";
                    //d.select_itemmname(item,ref itemm);
                    d.insert_invoice2(amount_num, item, ssuptotal, use_id);

                    Int64 ref_unmber = 0;
                    d.select_itemname(item, ref ref_unmber);
                    Int64 new_num = ref_unmber - amount_num;
                    d.update_numberitem(item, new_num);
                }
                DialogResult dialogResult = MessageBox.Show("Recoding With Payment Done ,Do you Want Print Invoice?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    DataTable2TableAdapter          d2 = new DataTable2TableAdapter();
                    invoiceSet1.DataTable2DataTable dd = new invoiceSet1.DataTable2DataTable();
                    d2.Fill(dd, use_id);
                    testt rpt = new testt();
                    rpt.SetDataSource(dd[0].Table);


                    Report_Viewer vd = new Report_Viewer();

                    vd.crystalReportViewer1.ReportSource = rpt;
                    vd.ShowDialog();
                }
            }
            catch (Exception)
            { MessageBox.Show("Try Again"); }


            textBox3.Text       = "";
            textBox6.Text       = "";
            maskedTextBox1.Text = "";
            textBox4.Text       = "";
            textBox5.Text       = "";
            domainUpDown2.Text  = "";
            label9.Text         = "00.00";
        }