Ejemplo n.º 1
0
        private void Bill_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'OrderCoffeDataSet1.HoaDon' table. You can move, or remove it, as needed.
            this.HoaDonTableAdapter.Fill(this.OrderCoffeDataSet1.HoaDon, OrdersBus.GetIdOrder());
            Orders od = OrdersBus.getOrderById(OrdersBus.GetIdOrder());

            Microsoft.Reporting.WinForms.ReportParameter[] rp = new Microsoft.Reporting.WinForms.ReportParameter[]
            {
                new Microsoft.Reporting.WinForms.ReportParameter("DateExport", DateTime.Now.ToString()),
                new Microsoft.Reporting.WinForms.ReportParameter("PriceSales", od.TotalPrice.ToString()),
                new Microsoft.Reporting.WinForms.ReportParameter("Sales", od.Sales.ToString() + " %"),
            };
            this.reportViewer1.LocalReport.SetParameters(rp);
            this.reportViewer1.RefreshReport();
        }
 public void loadData()
 {
     try
     {
         List <OrderDetail> list = OrderDetailBus.GetAllOrderDetailByIdOrder(OrdersBus.GetIdOrder());
         listViewBill.Items.Clear();
         foreach (var item in list)
         {
             Products product = ProductsBus.GetProductsById(item.IdProducts);
             var      row     = new string[] { product.Name, string.Format("{0:#,##0}", product.Price), item.Quanity.ToString(), string.Format("{0:#,##0}", item.TotalPrice) };
             var      lvi     = new ListViewItem(row);
             lvi.Tag = item;
             listViewBill.Items.Add(lvi);
         }
         Orders orders = OrdersBus.getOrderById(OrdersBus.GetIdOrder());
         lbSales.Text = orders.Sales.ToString() + "  %";
         lbTotal.Text = string.Format("{0:#,##0}", orders.TotalPrice) + " VNĐ";
         lbdate.Text  = orders.Date.ToString();
     }
     catch (Exception)
     {
     }
 }