protected void Page_Load(object sender, EventArgs e)
        {
            naslov.InnerText = "RAČUN ZA STO BROJ ";
            radnik.InnerText = "Radnik: " + WorkerBusiness.currentWoker.User_Name;
            naslov.Style.Add("color", "#a37417");
            naslov.Style.Add("font-size", "3.5rem");
            naslov.Style.Add("font-family", "times new roman");
            naslov.InnerHtml += $"<span style='color:black;'> {TableBusiness.curentTable.Table_ID}</span>";
            Label1.Text       = "Total: " + BillBusiness.currentBill.Total_Price.ToString() + " RSD";

            ArticleRepository  ab  = new ArticleRepository();
            BillItemRepository bib = new BillItemRepository();
            BillBusiness       br  = new BillBusiness();

            cb = bib.GetCaffeBillItems().Where(x => x.Bill_ID == br.GetCaffeBill.Bill_ID).ToList();

            foreach (CaffeBillItem c in cb)
            {
                HtmlGenericControl par = new HtmlGenericControl("p");
                par.Style.Add("font-size", "1.3rem");
                par.Style.Add("font-family", "Times New Roman");
                par.InnerText = ab.GetCaffeArticles().Where(x => x.Article_ID == c.Article_ID).ToList()[0].ToString() + "   x" + c.Quantity;
                contentmain.Controls.Add(par);
            }
        }
Example #2
0
        public Bill GetManaged()
        {
            var bill = BillBusiness.Get(Id);

            if (bill == null)
            {
                throw new Exception("Mã hóa đơn không tồn tại");
            }
            return(bill);
        }
Example #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            TableBusiness tb = new TableBusiness();

            TableBusiness.curentTable.Taken = false;
            tb.UpdateTable(TableBusiness.curentTable);
            BillBusiness bb = new BillBusiness();

            BillBusiness.currentBill.Paid = true;
            bb.UpdateCaffeBill(BillBusiness.currentBill);
            this.Hide();
        }
        protected void Button3_ServerClick(object sender, EventArgs e)
        {
            TableBusiness tb = new TableBusiness();
            BillBusiness  bb = new BillBusiness();

            TableBusiness.curentTable.Taken = false;
            tb.UpdateTable(TableBusiness.curentTable);
            BillBusiness.currentBill.Paid = true;
            bb.UpdateCaffeBill(BillBusiness.currentBill);
            BillBusiness.currentBill = null;
            Response.Redirect("Home.aspx");
        }
Example #5
0
        private void PrintBillReminds()
        {
            BillBusiness billOps = BillReminder();

            foreach (var item in billOps.RemindThings)
            {
                BillModel bill = (BillModel)item;
                divBillInfo.InnerHtml += string.Format("<div class=\"row\">");
                divBillInfo.InnerHtml += string.Format("<div class=\"col-md-4\">{0}</div>", bill.BillType);
                divBillInfo.InnerHtml += string.Format("<div class=\"col-md-4\">{0}</div>", bill.Amount);
                divBillInfo.InnerHtml += string.Format("<div class=\"col-md-4\">{0}</div>", bill.PaymentDueDate.ToShortDateString());
                divBillInfo.InnerHtml += "</div>";
            }
        }
Example #6
0
        private BillBusiness BillReminder()
        {
            BillBusiness bill     = new BillBusiness();
            UserModel    userInfo = authenticate.GetUserInfoFromSession();

            bill.RemindThings = bill.GetRemindedThings(userInfo.HomeId);
            bill.Name         = "Coming Bills";
            if (bill.RemindThings.Count == 0)
            {
                bill.Message = "No coming bills";
            }

            return(bill);
        }
Example #7
0
        private void B_Click(object sender, EventArgs e)
        {
            BillBusiness b11 = new BillBusiness();

            Button        b1 = sender as Button;
            TableBusiness tb = new TableBusiness();
            CaffeTable    t  = tb.getCaffeTables().Where(x => x.Table_ID == (Convert.ToInt32(b1.ID))).ToList()[0];

            tb.UpdateTable(t);


            BillBusiness.currentBill = b11.getCaffeBills().Where(x => x.Paid == false && t.Table_ID == x.Table_ID).ToList()[0];

            TableBusiness.curentTable = t;
            Response.Redirect("Bill.aspx");
        }
Example #8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ResponseMessage message = new ResponseMessage();

            try
            {
                UserModel    userInfo = authenticate.GetUserInfoFromSession();
                BillBusiness bill     = new BillBusiness(ddlBillType.SelectedValue, Convert.ToDecimal(txbAmount.Text), Convert.ToDateTime(txbPaymentDueDate.Text), userInfo.HomeId);
                bill.SaveBill();
                message.PrintSuccessMessage(spnMessage, "Bill successfully has been saved");
            }
            catch (Exception ex)
            {
                message.PrintFailureMessage(spnMessage, ex.Message);
            }
        }
Example #9
0
 public void Query_Receipt()
 {
     Database.WriteAsync(realm => realm.Add(new Receipt
     {
         Id                = 10,
         Money             = 1,
         BankAccountNumber = "11111",
         Bill              = BillBusiness.Get(1),
         Employee          = EmployeeBusiness.Get(Constant.adminName)
     })).Wait();
     SchemaHelper.Execute(
         @"/_GraphQL/Receipt/query.receipt.gql",
         @"/_GraphQL/Receipt/query.receipt.schema.json",
         new { id = 10 },
         p => p.PermissionGetAccountingVoucher = true
         );
 }
Example #10
0
        private void buttonPayment_Click(object sender, EventArgs e)
        {
            buttonPrint.Enabled   = true;
            buttonPayment.Enabled = false;
            bool         result       = true;
            BillBusiness billBusiness = new BillBusiness();
            Bill         bill         = new Bill()
            {
                MedicalRecordID = int.Parse(textMedicalRecordID.Text),
                MedicineFee     = medicineFee,
                ServiceFee      = serviceFee,
                DateOfBill      = (DateTime)dateDateOfBill.EditValue,
                Amount          = totalFee,
                UserID          = 1
            };


            int id = billBusiness.Insert(bill);

            if (id == 0)
            {
                result = false;
            }
            else
            {
                result = true;
            }
            var medicalRecord = medicalRecordBusiness.GetByMedicalRecordID((int)textMedicalRecordID.EditValue);

            medicalRecord.Status = "Payment";
            result = result && medicalRecordBusiness.Update(medicalRecord);

            if (result)
            {
                XtraMessageBox.Show(this, "Lưu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                XtraMessageBox.Show(this, "Lưu thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            LoadMedicalRecordNotPayment();
        }
Example #11
0
        public BillQuery()
        {
            Field <NonNullGraphType <ListGraphType <NonNullGraphType <BillType> > > >(
                _List,
                "Trả về một danh sách các hóa đơn",
                resolve: _CheckPermission_List(
                    p => p.PermissionGetAccountingVoucher,
                    context => BillBusiness.Get()
                    )
                );

            Field <NonNullGraphType <BillType> >(
                _Item,
                "Trả về thông tin một hóa đơn",
                _IdArgument(),
                _CheckPermission_Object(
                    p => p.PermissionGetAccountingVoucher,
                    context => BillBusiness.Get(_GetId <int>(context))
                    )
                );
        }
Example #12
0
        private void button13_Click(object sender, EventArgs e)
        {
            BillBusiness  b11 = new BillBusiness();
            TableBusiness tb  = new TableBusiness();
            CaffeTable    t   = tb.getCaffeTables().Where(x => x.Table_ID == Convert.ToInt32(button13.Text)).ToList()[0];

            TableBusiness.curentTable = t;
            t.Taken = true;
            tb.UpdateTable(t);
            try
            {
                BillBusiness.currentBill = b11.getCaffeBills().Where(x => x.Paid == false && t.Table_ID == x.Table_ID).ToList()[0];
            }
            catch (Exception ex)
            {
                b11.InsertCaffeBill(new CaffeBill(999, t.Table_ID, 0, DateTime.Now, false));
                BillBusiness.currentBill = b11.getCaffeBills().Where(x => x.Paid == false && t.Table_ID == x.Table_ID).ToList()[0];
            }
            Bill b = new Bill();

            b.Show();
        }
Example #13
0
        private void B1_Click(object sender, EventArgs e)
        {
            BillBusiness b11 = new BillBusiness();

            Button        b1 = sender as Button;
            TableBusiness tb = new TableBusiness();
            CaffeTable    t  = tb.getCaffeTables().Where(x => x.Table_ID == (Convert.ToInt32(b1.ID) - 99)).ToList()[0];

            t.Taken = true;
            tb.UpdateTable(t);
            try
            {
                BillBusiness.currentBill = b11.getCaffeBills().Where(x => x.Paid == false && t.Table_ID == x.Table_ID).ToList()[0];
            }
            catch (Exception ex)
            {
                b11.InsertCaffeBill(new CaffeBill(999, (Convert.ToInt32(b1.ID) - 99), 0, DateTime.Now, false));
                BillBusiness.currentBill = b11.getCaffeBills().Where(x => x.Paid == false && t.Table_ID == x.Table_ID).ToList()[0];
            }

            t.Table_ID = Convert.ToInt32(b1.CommandArgument);
            TableBusiness.curentTable = t;
            Response.Redirect("Bill.aspx");
        }
Example #14
0
        public BillMutation()
        {
            Field <NonNullGraphType <BillType> >(
                _Creation,
                "Tạo và trả về một đơn đặt phòng",
                new QueryArguments(
                    new QueryArgument <NonNullGraphType <ListGraphType <NonNullGraphType <BookingCreateInput> > > >
            {
                Name = "bookings"
            },
                    new QueryArgument <NonNullGraphType <BillCreateInput> > {
                Name = "bill"
            }
                    ),
                _CheckPermission_TaskObject(
                    p => p.PermissionManageRentingRoom,
                    async context =>
            {
                var employee = AuthenticationHelper.GetEmployee(context);
                var bill     = context.GetArgument <Bill>("bill");
                var bookings = context.GetArgument <List <Booking> >("bookings");

                var billInDatabase = await BillBusiness.Book(employee, bill, bookings);
                return(billInDatabase);
            }
                    )
                );

            Field <NonNullGraphType <BillType> >(
                "BookAndCheckIn",
                "Đặt và nhận phòng ngay tại khách sạn",
                new QueryArguments(
                    new QueryArgument <NonNullGraphType <ListGraphType <NonNullGraphType <BookAndCheckInCreateInput> > > >
            {
                Name = "bookings"
            },
                    new QueryArgument <NonNullGraphType <BillCreateInput> > {
                Name = "bill"
            }
                    ),
                _CheckPermission_TaskObject(
                    p => p.PermissionManageRentingRoom,
                    async context =>
            {
                var employee = AuthenticationHelper.GetEmployee(context);
                var bill     = context.GetArgument <Bill>("bill");
                var bookings = context.GetArgument <List <Booking> >("bookings");

                return(await BillBusiness.BookAndCheckIn(employee, bill, bookings));
            }
                    )
                );

            Field <NonNullGraphType <BillType> >(
                "PayTheBill",
                "Thanh toán hóa đơn (thanh toán tiền phòng)",
                _IdArgument(),
                _CheckPermission_TaskObject(
                    p => p.PermissionManageRentingRoom,
                    context =>
            {
                var employee = AuthenticationHelper.GetEmployee(context);
                return(BillBusiness.PayTheBill(employee, _GetId <int>(context)));
            }
                    )
                );
        }
Example #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            BillBusiness     billb = new BillBusiness();
            BillItemBusiness bb    = new BillItemBusiness();
            ArticleBusiness  ab    = new ArticleBusiness();

            if (comboBox1.Text != "Bezalkoholna pica")
            {
                string       tempname = comboBox1.Text.Split('-')[0];
                CaffeArticle ca       = ab.GetCaffeArticles().Where(x => x.Name == tempname).ToList()[0];
                BillBusiness.currentBill.Total_Price += ca.Price;
                billb.UpdateCaffeBill(BillBusiness.currentBill);
                try
                {
                    CaffeBillItem cb = new CaffeBillItem(ca.Article_ID, BillBusiness.currentBill.Bill_ID, 1);
                    bb.InsertBillItem(cb);
                }
                catch
                {
                    CaffeBillItem zeka = bb.GetCaffeBillItems().Where(x => x.Article_ID == ca.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0];
                    zeka.Quantity++;
                    bb.UpdateBillItem(zeka);
                }
                refresh();
            }
            if (comboBox2.Text != "Zestina")
            {
                string       tempname = comboBox2.Text.Split('-')[0];
                CaffeArticle ca       = ab.GetCaffeArticles().Where(x => x.Name == tempname).ToList()[0];
                BillBusiness.currentBill.Total_Price += ca.Price;
                billb.UpdateCaffeBill(BillBusiness.currentBill);
                try
                {
                    CaffeBillItem cb = new CaffeBillItem(ca.Article_ID, BillBusiness.currentBill.Bill_ID, 1);
                    bb.InsertBillItem(cb);
                }
                catch
                {
                    CaffeBillItem zeka = bb.GetCaffeBillItems().Where(x => x.Article_ID == ca.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0];
                    zeka.Quantity++;
                    bb.UpdateBillItem(zeka);
                }
                refresh();
            }
            if (comboBox3.Text != "Pivo")
            {
                string       tempname = comboBox3.Text.Split('-')[0];
                CaffeArticle ca       = ab.GetCaffeArticles().Where(x => x.Name == tempname).ToList()[0];
                BillBusiness.currentBill.Total_Price += ca.Price;
                billb.UpdateCaffeBill(BillBusiness.currentBill);
                try
                {
                    CaffeBillItem cb = new CaffeBillItem(ca.Article_ID, BillBusiness.currentBill.Bill_ID, 1);
                    bb.InsertBillItem(cb);
                }
                catch
                {
                    CaffeBillItem zeka = bb.GetCaffeBillItems().Where(x => x.Article_ID == ca.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0];
                    zeka.Quantity++;
                    bb.UpdateBillItem(zeka);
                }
                refresh();
            }
            if (comboBox4.Text != "Topli napici")
            {
                string       tempname = comboBox4.Text.Split('-')[0];
                CaffeArticle ca       = ab.GetCaffeArticles().Where(x => x.Name == tempname).ToList()[0];
                BillBusiness.currentBill.Total_Price += ca.Price;
                billb.UpdateCaffeBill(BillBusiness.currentBill);
                try
                {
                    CaffeBillItem cb = new CaffeBillItem(ca.Article_ID, BillBusiness.currentBill.Bill_ID, 1);
                    bb.InsertBillItem(cb);
                }
                catch
                {
                    CaffeBillItem zeka = bb.GetCaffeBillItems().Where(x => x.Article_ID == ca.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0];
                    zeka.Quantity++;
                    bb.UpdateBillItem(zeka);
                }
                refresh();
            }
        }
Example #16
0
        protected void dodaj_ServerClick(object sender, EventArgs e)
        {
            ArticleRepository  ab       = new ArticleRepository();
            BillItemRepository billItem = new BillItemRepository();
            BillBusiness       bp       = new BillBusiness();
            String             s        = toplinapici.Value;

            if (s != null && s != "Topli napici")
            {
                CaffeArticle c = ab.GetCaffeArticles().Where(x => x.Name.Equals(s)).ToList()[0];
                BillBusiness.currentBill.Total_Price += c.Price;
                HtmlGenericControl par = new HtmlGenericControl("p");
                par.InnerText = c.ToString();
                // contentmain.Controls.Add(par);
                BillItemRepository br = new BillItemRepository();
                try
                {
                    billItem.InsertCaffeBillItem(new CaffeBillItem(c.Article_ID, BillBusiness.currentBill.Bill_ID, 1));
                }
                catch (Exception xr)
                {
                    CaffeBillItem cs = cb.Where(x => x.Article_ID == c.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0];
                    cs.Quantity = cs.Quantity + 1;
                    billItem.UpdateBillItem(cs);
                }
                Label1.Text = "Total: " + BillBusiness.currentBill.Total_Price + " RSD";
                bp.UpdateCaffeBill(BillBusiness.currentBill);
            }
            String s1 = zestina.Value;

            if (s1 != null && s1 != "Žestina")
            {
                CaffeArticle c = ab.GetCaffeArticles().Where(x => x.Name.Equals(s1)).ToList()[0];
                BillBusiness.currentBill.Total_Price += c.Price;
                HtmlGenericControl par = new HtmlGenericControl("p");
                par.InnerText = c.ToString();
                // contentmain.Controls.Add(par);
                BillItemRepository br = new BillItemRepository();
                try
                {
                    billItem.InsertCaffeBillItem(new CaffeBillItem(c.Article_ID, BillBusiness.currentBill.Bill_ID, 1));
                }
                catch (Exception xr)
                {
                    CaffeBillItem cs = cb.Where(x => x.Article_ID == c.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0];
                    cs.Quantity = cs.Quantity + 1;
                    billItem.UpdateBillItem(cs);
                }
                Label1.Text = "Total: " + BillBusiness.currentBill.Total_Price + " RSD";
                bp.UpdateCaffeBill(BillBusiness.currentBill);
            }
            String s2 = Pivo.Value;

            if (s2 != null && s2 != "Pivo")
            {
                CaffeArticle c = ab.GetCaffeArticles().Where(x => x.Name.Equals(s2)).ToList()[0];
                BillBusiness.currentBill.Total_Price += c.Price;
                HtmlGenericControl par = new HtmlGenericControl("p");
                par.InnerText = c.ToString();
                // contentmain.Controls.Add(par);
                BillItemRepository br = new BillItemRepository();
                try
                {
                    billItem.InsertCaffeBillItem(new CaffeBillItem(c.Article_ID, BillBusiness.currentBill.Bill_ID, 1));
                }
                catch (Exception xr)
                {
                    CaffeBillItem cs = cb.Where(x => x.Article_ID == c.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0];
                    cs.Quantity = cs.Quantity + 1;
                    billItem.UpdateBillItem(cs);
                }
                Label1.Text = "Total: " + BillBusiness.currentBill.Total_Price + " RSD";
                bp.UpdateCaffeBill(BillBusiness.currentBill);
            }
            String s3 = bezalkohola.Value;

            if (s3 != null && s3 != "Bezalkoholna pića")
            {
                CaffeArticle c = ab.GetCaffeArticles().Where(x => x.Name.Equals(s3)).ToList()[0];
                BillBusiness.currentBill.Total_Price += c.Price;
                HtmlGenericControl par = new HtmlGenericControl("p");
                par.InnerText = c.ToString();
                // contentmain.Controls.Add(par);
                BillItemRepository br = new BillItemRepository();
                try
                {
                    billItem.InsertCaffeBillItem(new CaffeBillItem(c.Article_ID, BillBusiness.currentBill.Bill_ID, 1));
                }
                catch (Exception xr)
                {
                    CaffeBillItem cs = cb.Where(x => x.Article_ID == c.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0];
                    cs.Quantity = cs.Quantity + 1;
                    billItem.UpdateBillItem(cs);
                }
                Label1.Text = "Total: " + BillBusiness.currentBill.Total_Price + " RSD";
                bp.UpdateCaffeBill(BillBusiness.currentBill);
            }
            Response.Redirect("Bill.aspx");
        }