Exemple #1
0
        private D05F2140 LoadD05F2140()
        {
            D05F2140 frmTable = new D05F2140();
            string   TableID  = GridTable.GetFocusedRowCellValue("TableID").ToString();

            frmTable.Status              = Convert.ToInt32(GridTable.GetFocusedRowCellValue("Status"));
            frmTable.TableID             = TableID;
            frmTable.AmountPayment       = 0;
            frmTable.lbTableName.Content = "Tên bàn: " + GridTable.GetFocusedRowCellValue("TableName").ToString();
            if (frmTable.Status == 0)
            {
                frmTable.VoucherID = "";
            }
            else
            {
                DataTable dt = BLTable.LoadD05F2140(TableID, frmTable.Status);
                if (dt.Rows.Count > 0)
                {
                    frmTable.VoucherID = dt.Rows[dt.Rows.Count - 1]["VoucherID"].ToString();
                }
                else
                {
                    frmTable.VoucherID = "";
                }
            }
            return(frmTable);
        }
Exemple #2
0
 private void mnsNew_Click(object sender, RoutedEventArgs e)
 {
     BLTable.InitialTable(GridTable.GetFocusedRowCellValue("TableID").ToString());
     LoadSimple();
     mnsNew.IsEnabled = false;
     mnsPay.IsEnabled = true;
     mnsAdd.IsEnabled = true;
 }
Exemple #3
0
 private void tsbDelete_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
 {
     try
     {
         string TableID = GridTable.GetFocusedRowCellValue("TableID").ToString();
         BLTable.DeleteTable(TableID);
         LoadSimple();
         GridTable.FocusRowHandle(GridTable.ReturnVisibleRowCount - 1);
     }
     catch (NullReferenceException)
     {
         System.Windows.MessageBox.Show("Lỗi không thể xóa được bảng trống");
     }
 }
Exemple #4
0
 private void cmTable_Loaded(object sender, RoutedEventArgs e)
 {
     mnsNew.IsEnabled = false;
     mnsPay.IsEnabled = true;
     if (Convert.ToInt32(GridTable.GetFocusedRowCellValue("Status")) == 0)
     {
         mnsPay.IsEnabled = false;
     }
     if (Convert.ToInt32(GridTable.GetFocusedRowCellValue("Status")) == 2)
     {
         mnsNew.IsEnabled = true;
         mnsPay.IsEnabled = false;
         mnsAdd.IsEnabled = false;
     }
     if (Convert.ToInt32(GridTable.GetFocusedRowCellValue("Status")) == 1 && Convert.ToDecimal(GridTable.GetFocusedRowCellValue("TotalMoney")) == 0)
     {
         mnsNew.IsEnabled = true;
         mnsPay.IsEnabled = false;
     }
 }
Exemple #5
0
        private void tsbEdit_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
        {
            D05F2011 frm = new D05F2011();
            int      i   = 0;

            try
            {
                frm.TableID = GridTable.GetFocusedRowCellValue("TableID").ToString();
                i           = GridTable.View.FocusedRowData.RowHandle.Value;
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Chọn 1 dòng để sửa không phải dòng này!");
            }
            frm.FormState             = Lemon3.EnumFormState.FormEdit;
            frm.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            frm.ShowDialog();
            LoadSimple();
            GridTable.FocusRowHandle(i);
        }
Exemple #6
0
        private void mnsPay_Click(object sender, RoutedEventArgs e)
        {
            string    VoucherID = "";
            DataTable dt        = BLTable.SelectPayment(GridTable.GetFocusedRowCellValue("TableID").ToString(), GridTable.GetFocusedRowCellValue("Status").ToString());

            if (dt.Rows.Count > 0)
            {
                VoucherID = dt.Rows[dt.Rows.Count - 1]["VoucherID"].ToString();
            }
            D05F2141 frmPayment = new D05F2141();

            frmPayment.TotalMoney            = Convert.ToDecimal(dt.Rows[dt.Rows.Count - 1]["Amount"]);
            frmPayment.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            frmPayment.ShowDialog();
            if (!frmPayment.bClicked)
            {
                return;
            }
            decimal AmountPayment = frmPayment.TotalMoney;

            BLTable.UpdateMoney(L3SQLClient.SQLMoney(GridTable.GetFocusedRowCellValue("TotalMoney"), "n0"), L3SQLClient.SQLMoney(GridTable.GetFocusedRowCellValue("People"), "n0"), GridTable.GetFocusedRowCellValue("TableID"));
            BLTable.UpdateVoucherD91T2140(L3SQLClient.SQLMoney(AmountPayment, "n0"), VoucherID);
            LoadSimple();
        }