Exemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            SalesReporter rpt = new SalesReporter();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void generateReport()
        {
            SalesReporterData reportDetails = new SalesReporterData();
            DataTable         dtTable       = reportDetails.CompanyDetails;
            SalesReporter     Report        = new SalesReporter();

            readCompanyDetails();
            DataRow drr = dtTable.NewRow();

            drr["CompanyName"]    = companyName;
            drr["CompanyDetails"] = companyDetails;
            dtTable.Rows.Add(drr);
            Report.Database.Tables["CompanyDetails"].SetDataSource((DataTable)dtTable);
            storeList();
            DataTable dataTable = reportDetails.SalesReporterTable;

            for (int i = 0; i < bnoList.Count; i++)
            {
                DataRow  drow  = dataTable.NewRow();
                string[] fDate = Regex.Split(fromDate.ToString(), " ");
                drow["DateFrom"] = fDate[0];
                string[] tDate = Regex.Split(toDate.ToString(), " ");
                drow["DateTo"] = tDate[0];
                drow["BillNo"] = bnoList[i];
                string[] sDate = Regex.Split(saleDateList[i], " ");
                drow["SaleDate"]    = sDate[0];
                drow["Particulars"] = particularsList[i];
                drow["TotalPrice"]  = totalPriceList[i];
                drow["Discount"]    = discountList[i];
                drow["Gst"]         = netGstList[i];
                drow["SalesReturn"] = salesReturnList[i];
                drow["Credit"]      = creditList[i];
                drow["CashPaid"]    = cashPaidList[i];
                drow["GrandTotal"]  = grandTotalList[i];
                dataTable.Rows.Add(drow);
            }
            DataRow droww = dataTable.NewRow();

            droww["NetAmount"]        = totalPriceList.Sum();
            droww["TotalDiscount"]    = discountList.Sum();
            droww["TotalGst"]         = netGstList.Sum();
            droww["TotalSalesReturn"] = salesReturnList.Sum();
            droww["TotalCredit"]      = creditList.Sum();
            droww["TotalCashPaid"]    = cashPaidList.Sum();
            droww["TotalGrandTotal"]  = grandTotalList.Sum();
            droww["TotalInvoice"]     = bnoList.Count;
            dataTable.Rows.Add(droww);
            Report.Database.Tables["SalesReporterTable"].SetDataSource((DataTable)dataTable);
            expenseData();
            DataTable dTable = reportDetails.ExpenseData;
            DataRow   dr     = dTable.NewRow();

            dr["TotalExpense"] = expenseAmountList.Sum();
            dTable.Rows.Add(dr);
            Report.Database.Tables["ExpenseData"].SetDataSource((DataTable)dTable);
            sales_Reporter_Viewer.ViewerCore.ReportSource = Report;
            Report.Refresh();
        }