private void btnPrint_Click(object sender, EventArgs e)
        {
            if (dgvPurchase.Rows.Count > 0 || dgvSales.Rows.Count > 0)
            {
                try
                {
                    long id = 0;
                    string selectedValue = string.IsNullOrEmpty(cboProduct.ValueMember) ? string.Empty : Convert.ToString(((DataRowView)(cboProduct.SelectedItem)).Row[cboProduct.ValueMember]);//Convert.ToString( cbSelect.SelectedValue);
                    long.TryParse(selectedValue, out id);
                    ReportInfo info = new ReportInfo();
                    info.Report = Report.ProductDailySalePurchaseSummaryReport ;
                    info.StartDate = dtpStartDate.Value.Date;
                    info.EndDate = dtpEndDate.Value.Date;
                    if (chkAllDates.Checked)
                    {
                        info.StartDate = null;
                        info.EndDate = null;
                    }
                    info.Options = selectedValue;

                    Report_Viewer viewer = new Report_Viewer(info);
                    viewer.ShowDialog();
                }
                catch (Exception ex)
                {
                    ExceptionLog.LogException(Modules.SalesPurchaseReportControl, "btnPrint", ex, "SalePurchaseReportControl Exception");
                }
            }

            else
            {
                MessageBox.Show("Error ! No Record Found" + Environment.NewLine + "Please Made a valid transactions for print", "Supplier Transaction", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }
Beispiel #2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (Status_Customer == 0 && dgvTransactions.Rows.Count > 0)
            {
                try
                {

                    long id;
                    string selectedValue = string.IsNullOrEmpty(cbCustomersTransaction.ValueMember) ? string.Empty : cbCustomersTransaction.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCustomersTransaction.SelectedItem)).Row[cbCustomersTransaction.ValueMember]);//Convert.ToString(cbCustomersTransaction.SelectedValue);
                    long.TryParse(selectedValue, out id);
                    ReportInfo reportInfo = new ReportInfo();
                    reportInfo.Report = Report.CustomerTransactionsReport;
                    if (chkAllTransactions.Checked)
                    {
                        reportInfo.EndDate = null;
                        reportInfo.StartDate = null;
                    }
                    else
                    {
                        reportInfo.EndDate = dtpTo.Value.Date;
                        reportInfo.StartDate = dtpFrom.Value.Date;
                    }
                    reportInfo.Id = id;
                    EBusiness.Reports.Report_Viewer print = new Reports.Report_Viewer(reportInfo);
                    print.ShowDialog();

                }
                catch (Exception exe)
                {

                    ExceptionLog.LogException(Modules.TransactionReportControl, "Print Customer Report", exe, "Customer Transaction Report Error");
                }
            }
            else
            {
                if (dgvTransactions.Rows.Count == 0)
                {
                    MessageBox.Show("Error ! No Record Found" + Environment.NewLine + "Please made a Valid Transaction for Print", "Customer Code", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (Status_Customer != 0)
                {
                    Common.ShowInvlaidCodeMessage(cbCustomersTransaction, Modules.Customer);
                }
            }
        }