예제 #1
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string   vPartyID  = string.Empty;
                DateTime vDateFrom = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo   = DateTime.Today.Date; // DateTime.Today.Date.Month.ToString() + "/" + DateTime.Today.Date.Day.ToString() + "/" + DateTime.Today.Date.Year.ToString();

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    MessageBox.Show("Must Select a Party First!!!", "Missing Information");
                    return;
                }

                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    vPartyID = this.txtVendorID.Text;
                }



                if (optRange.Checked == true)
                {
                    vDateFrom = dt_From.Value;   //dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString();
                    vDateTo   = dt_ToDate.Value; //dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString();
                }


                //DataTable dt = objDAL.getPartyLedger(vPartyID, dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString(), dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString());
                DataTable dt = objDAL.getPartyLedger(vPartyID, vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowPartyLedger(vPartyID, string.Empty, vDateFrom, vDateTo, dt, chkLetterPad.Checked);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }