Пример #1
0
        private void GetSalesRep()
        {
            try
            {
                DataSet ds = new DataSet();


                List <Purchase_Report> sal = new Purchase_Report(date, date2).purchaseRptChart();

                foreach (var items in sal)
                {
                    ds.Tables[3].Rows.Add
                        (new object[] {
                        items.Date.ToString(),
                        items.Quantity
                    });
                }
                ReportDocument orep = new ReportDocument();
                orep.Load(System.AppDomain.CurrentDomain.BaseDirectory + @"GUI\Reporting\PurchaseChart_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);
            }
        }
Пример #2
0
        private void GetPurchaseRep()
        {
            priceTot = 0;
            try
            {
                DataSet ds = new DataSet();


                List <Purchase_Report> sal = new Purchase_Report(date).purchaseRpt();

                foreach (var items in sal)
                {
                    var drugDetails = db.Drug_Inventory.Where(d => d.Name == items.DrugName).FirstOrDefault();

                    items.Price = drugDetails.Unit_Buying_Price * items.Quantity;
                    priceTot    = priceTot + items.Price;
                    ds.Tables[1].Rows.Add
                        (new object[] {
                        items.ID.ToString(),
                        items.DrugName.ToString(),
                        items.Quantity.ToString(),
                        items.Supplier.ToString(),
                        items.Price.ToString()
                    });
                }
                ReportDocument orep = new ReportDocument();
                orep.Load(System.AppDomain.CurrentDomain.BaseDirectory + @"GUI\Reporting\PurchaseReport_RPT.rpt");
                orep.SetDataSource(ds);

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

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