Ejemplo n.º 1
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere    = string.Empty;
                string vCriteria = string.Empty;

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

                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    vWhere = " AND Parties.PartyID=" + this.txtVendorID.Text;
                }

                decimal vDaysExc;
                decimal.TryParse(txtDaysExc.Text, out vDaysExc);

                vWhere += " and ((DATEDIFF(day, LastPurchase.LastPurchaseDate, GETDATE())>= " + vDaysExc + ") OR (DATEDIFF(day, Recovery.LastRecoveryDate, GETDATE()) >= " + vDaysExc + "))";

                vCriteria = " Salesman: " + cboSalesman.Text;

                DataTable dt = objDAL.getPartiesAgingRec(vWhere, Int64.Parse(cboSalesman.SelectedValue.ToString()));
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.PartyAgingRec(dt, vCriteria);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }