예제 #1
0
        private void Room_no_LostFocus(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Room_no.Text == "")
                {
                    MessageBox.Show("Please Enter Room No");
                }
                else
                {
                    //p.ROOM_NO = Room_no.Text;
                    //p.GetBillDetails();
                    //getting Checking Id By using Room No
                    bill_no    = p.GET_MAXBILLNO();
                    ch.ROOM_NO = Room_no.Text;
                    ch.getCheckinId();
                    CheckinId    = ch.CHECKIN_ID;
                    Checkout1.LL = CheckinId;
                    co.ROOM_NO   = Room_no.Text;
                    co.CheckingBillgeneration();
                    if (co.RESERVATION_ID == "")
                    {
                        Room_no.Text = "";
                        MessageBox.Show("You have already splited this Bill");
                    }
                    else
                    {
                        first_name.Text = ch.FIRSTNAME;
                        mobile_no.Text  = ch.MOBILE_NUMBER.ToString();

                        if (CheckinId == 0)
                        {
                            Clear();
                            MessageBox.Show("No Rooms Found");
                        }
                        else
                        {
                            //getting advance amount By using Room No & checkin Id
                            ad.ROOM_NO = Room_no.Text;
                            ad.GetadvanceAmount(CheckinId);
                            advance_db = Convert.ToDouble(ad.AMOUNT_RECEIVED);

                            //getting discount amount By using Room No & checkin Id
                            dc.CHECKIN_ID = CheckinId;
                            dc.ROOM_NO    = Room_no.Text;
                            dc.GetdiscountAmount();
                            discount_db = Convert.ToDouble(dc.AMOUNT);

                            //getting postscharges amount By using Room No & checkin Id
                            pc.CHECKIN_ID = CheckinId;
                            pc.ROOMNO     = Convert.ToInt16(Room_no.Text);
                            pc.Getpostcharges();
                            postcharges_db = Convert.ToDouble(pc.TOTAL_AMOUNT);

                            //getting postscharges amount By using Room No & checkin Id
                            pc.CHECKIN_ID = CheckinId;
                            pc.ROOMNO     = Convert.ToInt16(Room_no.Text);
                            pc.Getpostcharges();
                            postcharges_db = Convert.ToDouble(pc.CHARGES);

                            //getting nightaudit charges by using Room no and checkin ID
                            pc.CHECKIN_ID = CheckinId;
                            pc.ROOMNO     = Convert.ToInt16(Room_no.Text);
                            pc.GetNightAuditcharges();
                            roomtarrif_db   = pc.ROOM_TARRIF;
                            extrabed_a_db   = pc.EXTRABED_ADULT;
                            extrabed_c_db   = pc.EXTRABED_CHILD;
                            total_amount_db = (roomtarrif_db + extrabed_a_db + extrabed_c_db + postcharges_db) - discount_db;//+ advance_db
                            amount.Text     = total_amount_db.ToString();
                            if (total_amount_db < 1000.00)
                            {
                                taxamount = 0.01 * total_amount_db;
                            }
                            else if (total_amount_db >= 1000.00 && total_amount_db <= 2499.00)
                            {
                                taxamount = 0.12 * total_amount_db;
                            }
                            else if (total_amount_db <= 4999.00 && total_amount_db >= 2500.00)
                            {
                                taxamount = 0.18 * total_amount_db;
                            }
                            else if (total_amount_db >= 5000.00)
                            {
                                taxamount = 0.25 * total_amount_db;
                            }
                            name1.Text    = ch.FIRSTNAME;
                            name2.Text    = ch.FIRSTNAME;
                            name3.Text    = ch.FIRSTNAME;
                            name4.Text    = ch.FIRSTNAME;
                            name5.Text    = ch.FIRSTNAME;
                            name6.Text    = ch.FIRSTNAME;
                            name7.Text    = ch.FIRSTNAME;
                            name8.Text    = ch.FIRSTNAME;
                            name9.Text    = ch.FIRSTNAME;
                            name10.Text   = ch.FIRSTNAME;
                            billno1.Text  = bill_no.ToString();
                            billno2.Text  = (bill_no + 1).ToString();
                            billno3.Text  = (bill_no + 2).ToString();
                            billno4.Text  = (bill_no + 3).ToString();
                            billno5.Text  = (bill_no + 4).ToString();
                            billno6.Text  = (bill_no + 5).ToString();
                            billno7.Text  = (bill_no + 6).ToString();
                            billno8.Text  = (bill_no + 7).ToString();
                            billno9.Text  = (bill_no + 8).ToString();
                            billno10.Text = (bill_no + 9).ToString();

                            No_of_bills           = 0;
                            Split2.IsChecked      = false;
                            Split3.IsChecked      = false;
                            Split4.IsChecked      = false;
                            Split5.IsChecked      = false;
                            Split6.IsChecked      = false;
                            Split7.IsChecked      = false;
                            Split8.IsChecked      = false;
                            Split9.IsChecked      = false;
                            Split10.IsChecked     = false;
                            stackrow1.Visibility  = Visibility.Hidden;
                            stackrow2.Visibility  = Visibility.Hidden;
                            stackrow3.Visibility  = Visibility.Hidden;
                            stackrow4.Visibility  = Visibility.Hidden;
                            stackrow5.Visibility  = Visibility.Hidden;
                            stackrow6.Visibility  = Visibility.Hidden;
                            stackrow7.Visibility  = Visibility.Hidden;
                            stackrow8.Visibility  = Visibility.Hidden;
                            stackrow9.Visibility  = Visibility.Hidden;
                            stackrow10.Visibility = Visibility.Hidden;
                            final_amout_text.Text = "";
                            final_amout.Text      = "";
                            with_tax.IsChecked    = true;
                        }
                    }
                }
            }
            catch (Exception) { }
        }