Beispiel #1
0
        private void grdpaymentdetails_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            na_grid.Rows.Clear();
            int index = grdpaymentdetails.SelectedIndex;

            if (co.ROOM_NO == "" || co.ROOM_NO == null)
            {
                MessageBox.Show("Please select the Room No");
            }
            else
            {
                Roomno.Text = co.ROOM_NO;
                DataTable dt = co.room_category();
                co.ROOM_CATEGORY  = dt.Rows[0]["ROOM_CATEGORY"].ToString();
                roomcategory.Text = co.ROOM_CATEGORY;
                DataTable Checking_RC = co.CheckingIfRoomChanged();
                if (Checking_RC.Rows.Count > 0)
                {
                    transfered_txt.Visibility = Visibility.Visible;
                    transfered_txt.Text       = "Transfered from " + Checking_RC.Rows[0]["MAIN_ROOM"] + " Room";
                }
                else
                {
                    transfered_txt.Visibility = Visibility.Hidden;
                }
                DataTable NA_Details = co.Room_NA_Details();
                if (NA_Details.Rows.Count > 0)
                {
                    //na_grid
                    for (int i = 0; i < NA_Details.Rows.Count; i++)
                    {
                        DataRow na = na_grid.NewRow();
                        na["Date"] = Convert.ToDateTime(NA_Details.Rows[i]["INSERT_DATE"]).ToShortDateString() + " " + NA_Details.Rows[i]["INSERT_TIME"].ToString();
                        if (NA_Details.Rows[i]["ROOM_TARRIF"].ToString() == null || NA_Details.Rows[i]["ROOM_TARRIF"].ToString() == "")
                        {
                            NA_Tariff = 0;
                        }
                        else
                        {
                            NA_Tariff = Convert.ToDecimal(NA_Details.Rows[i]["ROOM_TARRIF"]);
                        }
                        if (NA_Details.Rows[i]["GST"].ToString() == null || NA_Details.Rows[i]["GST"].ToString() == "")
                        {
                            NA_Tax = 0;
                        }
                        else
                        {
                            NA_Tax = Convert.ToDecimal(NA_Details.Rows[i]["GST"]);
                        }
                        if (i == (NA_Details.Rows.Count - 1))
                        {
                            co.From_dt = Convert.ToDateTime(NA_Details.Rows[i]["INSERT_DATE"]);
                            co.To_dt   = Convert.ToDateTime(NA_Details.Rows[i]["INSERT_DATE"]).AddDays(1);
                            co.GetAdvance();
                            co.GetCharges();
                            NA_Advance = co.NA_Advance;
                            NA_Charges = co.NA_Charges;
                        }
                        else
                        {
                            if (NA_Details.Rows[i]["ADVANCE"].ToString() == null || NA_Details.Rows[i]["ADVANCE"].ToString() == "")
                            {
                                NA_Advance = 0;
                            }
                            else
                            {
                                NA_Advance = Convert.ToDecimal(NA_Details.Rows[i]["ADVANCE"]);
                            }
                            if (NA_Details.Rows[i]["CHARGES"].ToString() == null || NA_Details.Rows[i]["CHARGES"].ToString() == "")
                            {
                                NA_Charges = 0;
                            }
                            else
                            {
                                NA_Charges = Convert.ToDecimal(NA_Details.Rows[i]["CHARGES"]);
                            }
                        }
                        NA_CSGST          = (NA_Tariff * NA_Tax) / 100;
                        na["Tariff"]      = Math.Round(NA_Tariff, 2, MidpointRounding.AwayFromZero);
                        na["CGST"]        = Math.Round(NA_CSGST / 2, 2, MidpointRounding.AwayFromZero);
                        na["SGST"]        = Math.Round(NA_CSGST / 2, 2, MidpointRounding.AwayFromZero);
                        na["Advance"]     = Math.Round(NA_Advance, 2, MidpointRounding.AwayFromZero);
                        na["PostCharges"] = Math.Round(NA_Charges, 2, MidpointRounding.AwayFromZero);
                        na_grid.Rows.Add(na);
                    }
                    checkoutgrid.ItemsSource = na_grid.DefaultView;
                }
                pop1.IsOpen = true;
            }
        }