Exemplo n.º 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) {
            }
        }
Exemplo n.º 2
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) {
            }
        }
Exemplo n.º 3
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) {
            }
        }
Exemplo n.º 4
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) {
            }
        }
Exemplo n.º 5
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) {
            }
        }