Exemplo n.º 1
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            if (!saved)
            {
                SaveInfo();
            }

            ReportDocument report = new ReportDocument();

            report.Load(Server.MapPath("BuffetMovCR.rpt"));
            ClubDBEntities club = new ClubDBEntities();

            report.SetDataSource(club.getBuffetExpenseReport(Date));
            string printer = ClubWebApp.Properties.Settings.Default.DefaultPrinter;

            report.PrintOptions.PrinterName = printer;
            report.PrintToPrinter(1, false, 0, 0);
        }
Exemplo n.º 2
0
        protected void tbDate_TextChanged(object sender, EventArgs e)
        {
            if (!(string.IsNullOrEmpty(tbDate.Text)))
            {
                DateTime date = Convert.ToDateTime(tbDate.Text);
                if (show)
                {
                    BuffetReport buff = new BuffetReport();
                    using (ClubDBEntities club = new ClubDBEntities())
                    {
                        var re = club.getBuffetExpenseReport(date).First();
                        if (string.IsNullOrEmpty(re.CBalance))
                        {
                            reset();
                            lblError.Visible = true;
                            lblError.Text    = "لا يوجد بيانات لعرضها";
                        }
                        else
                        {
                            cbEdit.Visible = true;
                            // cash
                            tbCBank.Text = re.CBank;

                            tbCExpenses.Text   = re.CExpenses;
                            tbCIncome.Text     = re.CInvIncome;
                            tbCMigBalance.Text = re.CMigBalance;
                            tbCPreBalance.Text = re.CPreBalance;
                            tbCTotal.Text      = re.CBalance;

                            // buffet
                            //tbMigBalance.Text = re.BMigBalance;
                            //tbIncome.Text = re.BPurchase;
                            //tbTIncome.Text = re.BBalance;
                            //tbSales.Text = re.BSales;
                            //tbPreBalance.Text = re.BPreBalance;
                            Date = date;
                            // expenses
                            //tbOBalance.Text = re.EPlusBalance;
                            //tbOExpenses.Text = re.EExpenses;
                            //tbOMigBlanace.Text = re.EMigBalance;
                            //tbOPreBalance.Text = re.EPreBalance;
                            //tbOTBalance.Text = re.EBalance;

                            readOnly(true);
                        }
                    }
                }
                else
                {
                    DateTime predate = date.AddDays(-1);
                    string   day     = cul.DateTimeFormat.DayNames[(int)date.DayOfWeek];
                    if (day == "Saturday")
                    {
                        predate = date.AddDays(-2);
                    }

                    using (ClubDBEntities club = new ClubDBEntities())
                    {
                        var buffet = (from o in club.BuffetMovs
                                      where o.Date == predate
                                      select o.MigBalance).FirstOrDefault();
                        var cash = (from o in club.CashMovs
                                    where o.Date == predate
                                    select o.MigBalance).FirstOrDefault();
                        var ex = (from o in club.ExpensesMovs
                                  where o.Date == predate
                                  select o.MigBalance).FirstOrDefault();

                        //tbPreBalance.Text = buffet.ToString("0.00");
                        tbCPreBalance.Text = cash.ToString("0.00");


                        // get income
                        var sum = club.Deposits.Where(a => a.Date == date).Sum(a => (decimal?)a.Amount);
                        tbCIncome.Text = sum == null? "0" : sum.ToString();
                        var exp = club.Withdraws.Where(a => a.Date == date && a.BankID == null).Sum(a => (decimal?)a.Amount);
                        tbCExpenses.Text = exp == null ? "0": exp.ToString();
                        tbCTotal.Text    = getSub(getSum(tbCIncome.Text, tbCPreBalance.Text), tbCExpenses.Text);
                        //tbOMigBlanace.Text = getSub(tbOTBalance.Text, tbOExpenses.Text);
                        tbCMigBalance.Text = getSub(tbCTotal.Text, tbCBank.Text);
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected void tbDate_TextChanged(object sender, EventArgs e)
        {
            if (!(string.IsNullOrEmpty(tbDate.Text)))
            {
                DateTime date = Convert.ToDateTime(tbDate.Text);
                if (show)
                {
                    BuffetReport buff = new BuffetReport();
                    using (ClubDBEntities club = new ClubDBEntities())
                    {
                        var re = club.getBuffetExpenseReport(date).First();
                        if (string.IsNullOrEmpty(re.BBalance))
                        {
                            lblError.Visible = true;
                            lblError.Text    = "لا يوجد بيانات لعرضها";
                        }
                        else
                        {
                            // cash
                            tbCBank.Text       = re.CBalance;
                            tbCBuffet.Text     = re.CBuffetIncome;
                            tbCExpenses.Text   = re.CExpenses;
                            tbCIncome.Text     = re.CInvIncome;
                            tbCMigBalance.Text = re.CMigBalance;
                            tbCPreBalance.Text = re.CPreBalance;
                            tbCTotal.Text      = re.CBalance;

                            // buffet
                            tbMigBalance.Text = re.BMigBalance;
                            tbIncome.Text     = re.BPurchase;
                            tbTIncome.Text    = re.BBalance;
                            tbSales.Text      = re.BSales;
                            tbPreBalance.Text = re.BPreBalance;

                            // expenses
                            tbOBalance.Text    = re.EPlusBalance;
                            tbOExpenses.Text   = re.EExpenses;
                            tbOMigBlanace.Text = re.EMigBalance;
                            tbOPreBalance.Text = re.EPreBalance;
                            tbOTBalance.Text   = re.EBalance;

                            readOnly();
                        }
                    }
                }
                else
                {
                    DateTime predate = date.AddDays(-1);
                    using (ClubDBEntities club = new ClubDBEntities())
                    {
                        var buffet = (from o in club.BuffetMovs
                                      where o.Date == predate
                                      select o.MigBalance).FirstOrDefault();
                        var cash = (from o in club.CashMovs
                                    where o.Date == predate
                                    select o.MigBalance).FirstOrDefault();
                        var ex = (from o in club.ExpensesMovs
                                  where o.Date == predate
                                  select o.MigBalance).FirstOrDefault();

                        tbPreBalance.Text  = buffet.ToString("0.00");
                        tbCPreBalance.Text = cash.ToString("0.00");
                        tbOPreBalance.Text = ex.ToString("0.00");
                    }
                }
            }
        }