예제 #1
0
        internal void print()
        {
            try {
                DataTable dT = new DataTable();
                dT.Columns.Add("ID", typeof(int));
                dT.Columns.Add("Date", typeof(String));
                dT.Columns.Add("Amount", typeof(String));
                dT.Columns.Add("Receiver", typeof(String));
                dT.Columns.Add("Details", typeof(String));

                Expense e = getExpenseForFilter();
                e.LimitStart = expenseManager.Pagination.LimitStart;
                e.LimitEnd   = expenseManager.Pagination.LimitCount;
                List <Expense> list = get(e);
                double         tot  = 0;
                foreach (Expense expense in list)
                {
                    tot += expense.Amount;
                    dT.Rows.Add(expense.Id, expense.Date.ToString("yyyy-MM-dd"), expense.Amount.ToString("#,##0.00"), expense.Receiver, expense.Details);
                }

                PrepareReport prepareReport = new PrepareReport();
                prepareReport.addCommon();
                prepareReport.addParameter("reportType", "Expense Details");
                prepareReport.addParameter("reportDescription", "");

                prepareReport.addParameter("totalValue", tot.ToString("#,##0.00"));

                new ReportViewer(dT, "Expences", prepareReport.getParameters()).Show();
            } catch (Exception) {
            }
        }
        public void GeneratePDF(IJSRuntime js, List <Report> iReport)
        {
            PrepareReport iPrepareReport = new PrepareReport();

            js.InvokeAsync <Report>(
                "SaveAsFile",
                "Submission.pdf",
                Convert.ToBase64String(iPrepareReport.PDFReport(iReport)));
        }
예제 #3
0
        internal void printDailyProfit()
        {
            try {
                PrepareReport prepareReport = new PrepareReport();
                prepareReport.addParameter("reportType", "Daily Profit");
                prepareReport.addParameter("reportDescription", "");

                prepareReport.addCommon();

                DataTable dt = new DataTable();
                dt.Columns.Add("ID", typeof(int));
                dt.Columns.Add("Date", typeof(String));
                dt.Columns.Add("Amount", typeof(String));
                dt.Columns.Add("Expenses", typeof(String));
                dt.Columns.Add("Total", typeof(String));

                DataSet dataSet = ReportDao.getDailyProfit((dailyProfit.datePicker_from.SelectedDate != null ? Convert.ToDateTime(dailyProfit.datePicker_from.SelectedDate).ToString("yyyy-MM-dd") : null),
                                                           (dailyProfit.datePicker_to.SelectedDate != null ? Convert.ToDateTime(dailyProfit.datePicker_to.SelectedDate).ToString("yyyy-MM-dd") : null),
                                                           false, dailyProfit.Pagination.LimitStart, dailyProfit.Pagination.LimitCount);

                double profit   = 0;
                double expenses = 0;
                double total    = 0;

                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    profit   += Convert.ToDouble(row[1]);
                    expenses += Convert.ToDouble(row[2]);
                    total    += Convert.ToDouble(row[3]);
                    dt.Rows.Add(0, Convert.ToDateTime(row[0]).ToString("yyyy-MM-dd"),
                                Convert.ToDouble(row[1]).ToString("#,##0.00"), Convert.ToDouble(row[2]).ToString("#,##0.00"),
                                Convert.ToDouble(row[3]).ToString("#,##0.00"));
                }

                prepareReport.addParameter("totalProfit", profit.ToString("#,##0.00"));
                prepareReport.addParameter("reportExpenses", expenses.ToString("#,##0.00"));
                prepareReport.addParameter("reportTotal", total.ToString("#,##0.00"));                /**/

                new ReportViewer(dt, "DailyProfit", prepareReport.getParameters()).Show();
            } catch (Exception) {
            }
        }
예제 #4
0
        private void print()
        {
            try {
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add("Id", typeof(String));
                dataTable.Columns.Add("Note", typeof(String));
                dataTable.Columns.Add("Quantity", typeof(String));
                dataTable.Columns.Add("LineTotal", typeof(String));
                double total = 0;
                int    count = 0;
                foreach (Label label in noteList)
                {
                    double note      = 0;
                    double quantity  = 0;
                    double lineTotal = 0;
                    try {
                        note = Convert.ToDouble(label.Content);
                    } catch (Exception) {
                        note = 1;
                    }
                    try {
                        quantity = Convert.ToDouble(quantityList[count].Text);
                    } catch (Exception) {
                    }
                    try {
                        lineTotal = Convert.ToDouble(lineTotalList[count].Content);
                    } catch (Exception) {
                    }
                    lineTotal = note * quantity;
                    dataTable.Rows.Add("", (note == 1) ? "Coins" : note.ToString("#,##0.00"), quantity, lineTotal.ToString("#,##0.00"));
                    total += lineTotal;
                    count++;
                }

                PrepareReport prepareReport = new PrepareReport();
                prepareReport.addParameter("total", total.ToString("#,##0.00"));
                prepareReport.addParameter("shopName", Session.Preference["shopName"]);
                prepareReport.addParameter("date", DateTime.Now.ToString());
                new ReportViewer(dataTable, "CashCounterPos", prepareReport.getParameters()).Show();
            } catch (Exception) {
            }
        }
예제 #5
0
        private void button_print_Click(object sender, RoutedEventArgs e)
        {
            try {
                if (isValidForm())
                {
                    PrepareReport prepareReport = new PrepareReport();
                    prepareReport.addParameter("reportType", "Cheque Print");
                    //prepareReport.addParameter("reportDescription", "Test text");
                    prepareReport.addReportPeriod(null, null);
                    prepareReport.addParameter("date", getChequeDate());
                    prepareReport.addParameter("payTo", textBox_payTo.TrimedText);

                    prepareReport.addParameter("amountText", getAmountInText());
                    prepareReport.addParameter("amountNumeric", textBox_amountNumeric.FormattedValue);
                    prepareReport.addParameter("cross", (checkBox_cross.IsChecked == true) ? "//" : "");
                    prepareReport.addParameter("accountPayeeOnly", (checkBox_accountPayeeOnly.IsChecked == true) ? "Account Payee Only" : "");
                    new ReportViewer(null, "ChequePrint", prepareReport.getParameters()).Show();
                }
            } catch (Exception) {
            }
        }
예제 #6
0
        internal void printDailySale()
        {
            try {
                PrepareReport prepareReport = new PrepareReport();
                prepareReport.addParameter("reportType", "Daily Sale");
                prepareReport.addParameter("reportDescription", "");

                prepareReport.addCommon();

                DataTable dt = new DataTable();
                dt.Columns.Add("ID", typeof(int));
                dt.Columns.Add("Date", typeof(String));
                dt.Columns.Add("GrossSale", typeof(String));
                dt.Columns.Add("Discount", typeof(String));
                dt.Columns.Add("CompanyRTN", typeof(String));
                dt.Columns.Add("GoodRTN", typeof(String));
                dt.Columns.Add("WasteRTN", typeof(String));
                dt.Columns.Add("NetSale", typeof(String));
                dt.Columns.Add("Cash", typeof(String));
                dt.Columns.Add("Cheque", typeof(String));
                dt.Columns.Add("Account", typeof(String));
                dt.Columns.Add("Other", typeof(String));
                dt.Columns.Add("Credit", typeof(String));
                dt.Columns.Add("BadDebts", typeof(String));

                DataSet dataSet = ReportDao.getDailySale((dailySale.datePicker_from.SelectedDate != null ? Convert.ToDateTime(dailySale.datePicker_from.SelectedDate).ToString("yyyy-MM-dd") : null),
                                                         (dailySale.datePicker_to.SelectedDate != null ? Convert.ToDateTime(dailySale.datePicker_to.SelectedDate).ToString("yyyy-MM-dd") : null),
                                                         false, dailySale.Pagination.LimitStart, dailySale.Pagination.LimitCount);

                double totalGross    = 0;
                double totalDiscount = 0;
                double totalCRTN     = 0;
                double totalGRTN     = 0;
                double totalWRTN     = 0;
                double totalNet      = 0;
                double totalCash     = 0;
                double totalCheque   = 0;
                double totalCredit   = 0;
                double totalBadDebts = 0;

                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    totalGross    += Convert.ToDouble(row[1]);
                    totalDiscount += Convert.ToDouble(row[2]);
                    totalCRTN     += Convert.ToDouble(row[3]);
                    totalGRTN     += Convert.ToDouble(row[4]);
                    totalWRTN     += Convert.ToDouble(row[5]);
                    totalNet      += Convert.ToDouble(row[6]);
                    totalCash     += Convert.ToDouble(row[7]);
                    totalCheque   += Convert.ToDouble(row[8]);
                    totalCredit   += Convert.ToDouble(row[11]);
                    totalBadDebts += Convert.ToDouble(row[12]);
                    dt.Rows.Add(0, Convert.ToDateTime(row[0]).ToString("yyyy-MM-dd"), Convert.ToDouble(row[1]).ToString("#,##0.00"),
                                Convert.ToDouble(row[2]).ToString("#,##0.00"), Convert.ToDouble(row[3]).ToString("#,##0.00"),
                                Convert.ToDouble(row[4]).ToString("#,##0.00"), Convert.ToDouble(row[5]).ToString("#,##0.00"),
                                Convert.ToDouble(row[6]).ToString("#,##0.00"), Convert.ToDouble(row[7]).ToString("#,##0.00"),
                                Convert.ToDouble(row[8]).ToString("#,##0.00"), Convert.ToDouble(row[9]).ToString("#,##0.00"),
                                Convert.ToDouble(row[10]).ToString("#,##0.00"), Convert.ToDouble(row[11]).ToString("#,##0.00"),
                                Convert.ToDouble(row[12]).ToString("#,##0.00"));
                }

                prepareReport.addParameter("totalGross", totalGross.ToString("#,##0.00"));
                prepareReport.addParameter("totalDiscount", totalDiscount.ToString("#,##0.00"));
                prepareReport.addParameter("totalCRTN", totalCRTN.ToString("#,##0.00"));
                prepareReport.addParameter("totalGRTN", totalGRTN.ToString("#,##0.00"));
                prepareReport.addParameter("totalWRTN", totalWRTN.ToString("#,##0.00"));
                prepareReport.addParameter("totalNet", totalNet.ToString("#,##0.00"));
                prepareReport.addParameter("totalCash", totalCash.ToString("#,##0.00"));
                prepareReport.addParameter("totalCheque", totalCheque.ToString("#,##0.00"));
                prepareReport.addParameter("totalCredit", totalCredit.ToString("#,##0.00"));
                prepareReport.addParameter("totalBadDebts", totalBadDebts.ToString("#,##0.00"));

                new ReportViewer(dt, "DailySale", prepareReport.getParameters()).Show();
            } catch (Exception) {
            }
        }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            long ReportId = 0;
            long UserId   = 0;
            try
            {
                ReportId = Convert.ToInt64(Request.QueryString["reportid"]);
                UserId   = Convert.ToInt64(Request.QueryString["userid"]);
            }
            catch
            {
                ReportId = 0;
                UserId   = 0;
            }
            //ReportId = 636712298336242996;
            //UserId = 0;

            PrepareReport    PR_obj  = new PrepareReport();
            ReportViewerData RVD_obj = new ReportViewerData();
            mReportViewer    RV_obj  = new mReportViewer();
            ConvertDate      CD_obj  = new ConvertDate();

            RVD_obj = getReportData(ReportId, UserId);
            if (RVD_obj.CurrentCulture == 0)
            {
                Title = "Report Viewer";
            }
            else
            {
                Title = "عرض التقرير";
            }
            //UpdateReportData(ReportId, UserId);
            RV_obj = PR_obj.getReportData(RVD_obj.Employees, RVD_obj.ReportName, RVD_obj.From, RVD_obj.To, RVD_obj.CurrentCulture, RVD_obj.culture, RVD_obj.FromDate, RVD_obj.ToDate, RVD_obj.EmployeeLocation, RVD_obj.isHijri, RVD_obj.InterruptionPeriod);


            ReportParameter ReportDatetmp = new ReportParameter();
            ReportParameter ReportMonth   = new ReportParameter();
            ReportParameter StartOfPeriod = new ReportParameter();
            ReportParameter EndOfPeriod   = new ReportParameter();
            ReportParameter CurrentTime   = new ReportParameter();
            ReportParameter InterruptionPeriodParameter = new ReportParameter(); // added by Lara Almomani
            ReportParameter currentUserParameter        = new ReportParameter(); // added by Lara Almomani

            Microsoft.Reporting.WebForms.ReportDataSource rds = new ReportDataSource();

            if (RV_obj.DataSourceName != "Report_MonthlyAttendance")
            {
                rds = new Microsoft.Reporting.WebForms.ReportDataSource(RV_obj.DataSourceName, RV_obj.DataSource);
            }
            else
            {
                ReportMonth = new ReportParameter("ReportMonth", RVD_obj.FromDate.Split('/')[1]);
                rds         = new ReportDataSource(RV_obj.DataSourceName, RV_obj.MonthlyAttendanceReport);
            }
            string dt = DateTime.Now.ToString("dd/MM/yyyy");
            if (RVD_obj.CurrentCulture == 2)
            {
                dt = CD_obj.GregorianToHijri(dt);
            }
            ReportDatetmp = new ReportParameter("ReportDate", dt);
            StartOfPeriod = new ReportParameter("From", RVD_obj.FromDate);
            EndOfPeriod   = new ReportParameter("To", RVD_obj.ToDate);
            CurrentTime   = new ReportParameter("Time", DateTime.Now.ToString("h:mm:ss tt"));

            #region InterruptionPeriod Report and MissingPunchReport
            // added by Lara Almomani
            if (RVD_obj.ReportName == "EmployeesWorkInterruptionReport")
            {
                InterruptionPeriodParameter = new ReportParameter("InterruptionPeriodParam", RVD_obj.InterruptionPeriod.ToString());
            }
            // added by Lara Almomani
            if (RVD_obj.ReportName == "MissingPunchReport" || RVD_obj.ReportName == "EmployeesWorkInterruptionReport")
            {
                currentUserParameter = new ReportParameter("currentUserParam", RVD_obj.userName);
            }
            #endregion


            reportViewer.LocalReport.ReportPath = RV_obj.ReportPath;
            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.DataSources.Add(rds);
            reportViewer.LocalReport.SetParameters(ReportMonth);
            reportViewer.LocalReport.SetParameters(EndOfPeriod);
            reportViewer.LocalReport.SetParameters(StartOfPeriod);
            reportViewer.LocalReport.SetParameters(ReportDatetmp);
            reportViewer.LocalReport.SetParameters(CurrentTime);

            // added by Lara Almomani
            if (RVD_obj.ReportName == "EmployeesWorkInterruptionReport")
            {
                reportViewer.LocalReport.SetParameters(InterruptionPeriodParameter);
            }
            // added by Lara Almomani
            if (RVD_obj.ReportName == "MissingPunchReport" || RVD_obj.ReportName == "EmployeesWorkInterruptionReport")
            {
                reportViewer.LocalReport.SetParameters(currentUserParameter);
            }

            reportViewer.LocalReport.Refresh();
        }
    }