コード例 #1
0
        public Checkout()
        {
            InitializeComponent();
            pd_grid.Columns.Add("Roomno", typeof(string));
            pd_grid.Columns.Add("Tarrif", typeof(string));
            pd_grid.Columns.Add("Charges", typeof(string));
            pd_grid.Columns.Add("Cgst", typeof(string));
            pd_grid.Columns.Add("Sgst", typeof(string));
            pd_grid.Columns.Add("Advance", typeof(string));
            pd_grid.Columns.Add("Discount", typeof(string));
            pd_grid.Columns.Add("Refund", typeof(string));
            pd_grid.Columns.Add("Transfer", typeof(string));
            pd_grid.Columns.Add("Pending_Amount", typeof(string));

            na_grid.Columns.Add("Date", typeof(string));
            na_grid.Columns.Add("Tariff", typeof(decimal));
            na_grid.Columns.Add("CGST", typeof(decimal));
            na_grid.Columns.Add("SGST", typeof(decimal));
            na_grid.Columns.Add("Advance", typeof(decimal));
            na_grid.Columns.Add("PostCharges", typeof(decimal));
            reports.a = 3;
            string    s   = null;
            DataTable dt  = co.GET_ROOMCATEGORY();
            int       row = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                s = dt.Rows[i]["ROOM_CATEGORY"].ToString();
                if (li.Contains(s))
                {
                }
                else
                {
                    li.Add(s);
                    int   NO_OF_ROOMS = 0;
                    Label LB          = new Label();
                    LB.Content    = s;
                    LB.FontSize   = 15;
                    LB.Width      = 130;
                    LB.FontWeight = FontWeights.Bold;
                    WrapPanel WP = new WrapPanel();
                    WP.Orientation = Orientation.Horizontal;
                    WP.Margin      = new System.Windows.Thickness(0, 0, 10, 8);
                    Grid g = new Grid();
                    g.Children.Add(WP);
                    WP.Children.Add(LB);
                    Label  L = new Label();
                    string K = ":";
                    L.Content    = s + " " + K;
                    L.FontWeight = FontWeights.Bold;
                    L.FontSize   = 15;
                    DT           = co.GET_ROOM_NO(s);

                    for (int J = 0; J < DT.Rows.Count; J++)
                    {
                        string SRI = DT.Rows[J]["BACKGROUND_COLOR"].ToString();
                        if (SRI == "Orange")
                        {
                            int    ROOMNO = Convert.ToInt16(DT.Rows[J]["ROOM_NO"]);
                            Button BT     = new Button();
                            BT.Height = 24; BT.Width = 70;
                            if (J == 6)
                            {
                                BT.Margin = new System.Windows.Thickness(132, 5, 2, 0);
                            }
                            else if (J == 12)
                            {
                                BT.Margin = new System.Windows.Thickness(132, 5, 2, 0);
                            }
                            else if (J == 18)
                            {
                                BT.Margin = new System.Windows.Thickness(132, 5, 2, 0);
                            }
                            else if (J == 24)
                            {
                                BT.Margin = new System.Windows.Thickness(132, 5, 2, 0);
                            }
                            else
                            {
                                BT.Margin = new System.Windows.Thickness(2, 5, 2, 0);
                            }
                            BT.Padding  = new System.Windows.Thickness(0, -3, 0, 0);
                            BT.Content  = ROOMNO;
                            BT.FontSize = 15;
                            BT.Click   += BT_Click;
                            WP.Children.Add(BT);
                            NO_OF_ROOMS = J + 1;
                        }
                        else if (SRI == "Gray")
                        {
                            int    ROOMNO = Convert.ToInt16(DT.Rows[J]["ROOM_NO"]);
                            Button BT     = new Button();
                            BT.Height = 24; BT.Width = 70;
                            if (J == 6)
                            {
                                BT.Margin = new System.Windows.Thickness(132, 5, 2, 0);
                            }
                            else if (J == 12)
                            {
                                BT.Margin = new System.Windows.Thickness(132, 5, 2, 0);
                            }
                            else if (J == 18)
                            {
                                BT.Margin = new System.Windows.Thickness(132, 5, 2, 0);
                            }
                            else if (J == 24)
                            {
                                BT.Margin = new System.Windows.Thickness(132, 5, 2, 0);
                            }
                            else
                            {
                                BT.Margin = new System.Windows.Thickness(2, 5, 2, 0);
                            }
                            BT.Padding  = new System.Windows.Thickness(0, -3, 0, 0);
                            BT.Content  = ROOMNO;
                            BT.FontSize = 15;
                            BT.Click   += BT_Click;
                            WP.Children.Add(BT);
                            BT.Background = Brushes.Gray;
                            NO_OF_ROOMS   = J + 1;
                        }
                    }
                    RowDefinition rd = new RowDefinition();
                    rd.Height = new GridLength(20, GridUnitType.Star);
                    g.RowDefinitions.Add(rd);
                    WRAP.Children.Add(g);
                    Grid.SetRow(g, row);
                    row++;
                }
            }
        }