コード例 #1
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (rbsp.Checked)
     {
         PriceRepository priceRepository = new PriceRepository();
         var             costPrices      = priceRepository.GetSellingPrices(fromdt.Value, dtto.Value, txtProdFrom.Text, txtProdTo.Text, txtSuppFrom.Text, txtSuppTo.Text, txtDeptFrom.Text, txtDeptTo.Text).ToList();
         if (costPrices.Count <= 0)
         {
             MessageBox.Show("No records to display!!", "No Records!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             ReportDocument report = new PriceChange();
             report.SetDataSource(costPrices);
             report.SetParameterValue("@Company", Properties.Settings.Default.COMPANYNAME.ToUpper());
             report.SetParameterValue("@Branch", Properties.Settings.Default.BRANCHNAME.ToUpper());
             report.SetParameterValue("@Username", Properties.Settings.Default.USERNAME.ToUpper());
             report.SetParameterValue("@ReportName", "Selling");
             Form form = new frmPrint(report);
             form.Text = "Selling Price Change Report";
             form.Show();
         }
     }
     if (rbpc.Checked)
     {
         PriceRepository priceRepository = new PriceRepository();
         var             costPrices      = priceRepository.GetCostPrices(fromdt.Value, dtto.Value, txtProdFrom.Text, txtProdTo.Text, txtSuppFrom.Text, txtSuppTo.Text, txtDeptFrom.Text, txtDeptTo.Text).ToList();
         if (costPrices.Count <= 0)
         {
             MessageBox.Show("No records to display!!", "No Records!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             ReportDocument report = new PriceChange();
             report.SetDataSource(costPrices);
             report.SetParameterValue("@Company", Properties.Settings.Default.COMPANYNAME.ToUpper());
             report.SetParameterValue("@Branch", Properties.Settings.Default.BRANCHNAME.ToUpper());
             report.SetParameterValue("@Username", Properties.Settings.Default.USERNAME.ToUpper());
             report.SetParameterValue("@ReportName", "Cost");
             Form form = new frmPrint(report);
             form.Text = "Cost Price Change Report";
             form.Show();
         }
     }
 }