Exemple #1
0
        private void GetSalesRep()
        {
            try
            {
                DataSet ds = new DataSet();

                List <Drug_Report> pro = new Drug_Report().DrugInvRpt();

                foreach (var items in pro)
                {
                    ds.Tables["DrugInvDs"].Rows.Add
                        (new object[] {
                        items.ID,
                        items.DrugName,
                        items.UnitSellingPrice,
                        items.Category,
                        items.Reorder,
                        items.Type,
                        items.Shelf,
                        items.Qty
                    });
                }
                ReportDocument orep = new ReportDocument();
                orep.Load(System.AppDomain.CurrentDomain.BaseDirectory + @"GUI\Reporting\InventryRerport_RPT.rpt");
                orep.SetDataSource(ds);

                //SalesReport rpt = new SalesReport(date).rptSum();

                //decimal tot = 0;
                //if (rpt.Price != 0)
                //    tot = rpt.Price;
                //orep.SetParameterValue("Total", tot);
                //orep.SetParameterValue("Date", date);
                crystalReportsViewer1.ViewerCore.ReportSource = orep;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void GetSalesRepAll()
        {
            try
            {
                DataSet ds = new DataSet();

                List <Drug_Report> pro = new Drug_Report().DrugPurchasedMontlyAll();

                foreach (var items in pro)
                {
                    items.Month = items.Year.ToString() + "-" + items.Month;
                    ds.Tables["DrugPurchaseDS"].Rows.Add
                        (new object[] {
                        items.Year,
                        items.Month,
                        items.DrugName,
                        items.Category,
                        items.Qty
                    });
                }
                ReportDocument orep = new ReportDocument();
                orep.Load(System.AppDomain.CurrentDomain.BaseDirectory + @"GUI\Reporting\DrugPurchaseChart.rpt");
                orep.SetDataSource(ds);

                //SalesReport rpt = new SalesReport(date).rptSum();

                //decimal tot = 0;
                //if (rpt.Price != 0)
                //    tot = rpt.Price;
                //orep.SetParameterValue("Total", tot);
                //orep.SetParameterValue("Date", date);
                crystalReportsViewer1.ViewerCore.ReportSource = orep;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }