예제 #1
0
        private void FinishThread()
        {
            // Fetch the first page of data
            DataTable dataTable = null;

            try
            {
                grdSuppliers.MinimumPageSize = 200;
                dataTable = grdSuppliers.LoadFirstDataPage(@GetDataPagedResult);
            }
            catch (Exception E)
            {
                MessageBox.Show(E.ToString());
                return;
            }

            if (dataTable == null)
            {
                // we lost the supplierFind object - probably means the screen is closing down so quit now
                return;
            }

            InitialiseGrid();

            DataView myDataView = FSupplierTable.DefaultView;

            myDataView.AllowNew     = false;
            grdSuppliers.DataSource = new DevAge.ComponentModel.BoundDataView(myDataView);

            SetSupplierFilters(null, null);
            string currentFilter = FFilterAndFindObject.CurrentActiveFilter;

            ApplyFilterManual(ref currentFilter);

            if (grdSuppliers.TotalPages > 0)
            {
                if (grdSuppliers.TotalPages > 1)
                {
                    // Now we can load the remaining pages ...
                    grdSuppliers.LoadAllDataPages();
                }

                // Highlight first Row
                SelectRowInGrid(1);
            }

            // Size it
            grdSuppliers.AutoResizeGrid();

            grdSuppliers.SetHeaderTooltip(0, Catalog.GetString("Supplier Key"));
            grdSuppliers.SetHeaderTooltip(1, Catalog.GetString("Supplier Name"));
            grdSuppliers.SetHeaderTooltip(2, Catalog.GetString("Currency"));
            grdSuppliers.SetHeaderTooltip(3, Catalog.GetString("Status"));

            UpdateRecordNumberDisplay();
            FMainForm.ActionEnabledEvent(null, new ActionEventArgs("cndSelectedSupplier", grdSuppliers.TotalPages > 0));
        }
예제 #2
0
        private void ApplyFilterManual(ref string AFilter)
        {
            if (FSupplierTable != null)
            {
                FSupplierTable.DefaultView.RowFilter = AFilter;

                bool gotRows = (grdDetails.Rows.Count > 1);

                ActionEnabledEvent(null, new ActionEventArgs("actEditDetails", gotRows));
                ActionEnabledEvent(null, new ActionEventArgs("actSupplierTransactions", gotRows));
                ActionEnabledEvent(null, new ActionEventArgs("actNewInvoice", gotRows));
                ActionEnabledEvent(null, new ActionEventArgs("actNewCreditNote", gotRows));

                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actSupplierEditSupplier", gotRows));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actSupplierOpenTransactions", gotRows));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actSupplierNewInvoice", gotRows));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actSupplierNewCreditNote", gotRows));

                if (gotRows)
                {
                    grdDetails.Selection.SelectRow(1, true);
                }
            }
        }
예제 #3
0
        private void ApplyFilterManual(ref string AFilter)
        {
            if (FInvoiceTable != null)
            {
                FInvoiceTable.DefaultView.RowFilter = AFilter;

                bool gotRows    = (grdDetails.Rows.Count > 1);
                bool canApprove = ((RadioButton)FFilterAndFindObject.FilterPanelControls.FindControlByName("rbtForApproval")).Checked && gotRows;
                bool canPost    = ((RadioButton)FFilterAndFindObject.FilterPanelControls.FindControlByName("rbtForPosting")).Checked && gotRows;
                bool canPay     = ((RadioButton)FFilterAndFindObject.FilterPanelControls.FindControlByName("rbtForPaying")).Checked && gotRows;

                bool canTag = canApprove || canPost || canPay;

                ActionEnabledEvent(null, new ActionEventArgs("actTagAll", canTag));
                ActionEnabledEvent(null, new ActionEventArgs("actUntagAll", canTag));
                ActionEnabledEvent(null, new ActionEventArgs("actOpenSelectedInvoice", gotRows));
                ActionEnabledEvent(null, new ActionEventArgs("actApproveTagged", canApprove));
                ActionEnabledEvent(null, new ActionEventArgs("actPostTagged", canPost));
                ActionEnabledEvent(null, new ActionEventArgs("actDeleteTagged", canPost));
                ActionEnabledEvent(null, new ActionEventArgs("actPayTagged", canPay));
                ActionEnabledEvent(null, new ActionEventArgs("actReverseTagged", canPay));

                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actOpenSelected", gotRows));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actApproveTagged", canApprove));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actPostTagged", canPost));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actDeleteTagged", canPost));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actPayTagged", canPay));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actReverseTagged", canPay));

                grdInvoices.Columns[0].Visible = canTag;

                if (canTag)
                {
                    grdInvoices.ShowCell(new SourceGrid.Position(grdInvoices.Selection.ActivePosition.Row, 0), true);
                }

                UpdateDisplayedBalance();
            }
        }
        private void ApplyFilterManual(ref string AFilter)
        {
            if (FInvoiceTable != null)
            {
                FInvoiceTable.DefaultView.RowFilter = AFilter;

                bool gotRows    = (grdDetails.Rows.Count > 1);
                bool canApprove = ((RadioButton)FFilterAndFindObject.FilterPanelControls.FindControlByName("rbtForApproval")).Checked && gotRows;
                bool canPost    = ((RadioButton)FFilterAndFindObject.FilterPanelControls.FindControlByName("rbtForPosting")).Checked && gotRows;
                bool canPay     = ((RadioButton)FFilterAndFindObject.FilterPanelControls.FindControlByName("rbtForPaying")).Checked && gotRows;

                bool canTag = canApprove || canPost || canPay;

                ActionEnabledEvent(null, new ActionEventArgs("actTagAll", canTag));
                ActionEnabledEvent(null, new ActionEventArgs("actUntagAll", canTag));
                ActionEnabledEvent(null, new ActionEventArgs("actOpenSelectedInvoice", gotRows));
                ActionEnabledEvent(null, new ActionEventArgs("actRunTagAction", canTag));
                ActionEnabledEvent(null, new ActionEventArgs("actCancelTagged", canPost || canApprove));
                ActionEnabledEvent(null, new ActionEventArgs("actReverseTagged", canPay));

                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actInvoiceOpenSelected", gotRows));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actInvoiceOpenTagged", gotRows && canTag));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actInvoiceApproveTagged", canApprove));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actInvoicePostTagged", canPost));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actInvoiceCancelTagged", canPost || canApprove));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actInvoicePayTagged", canPay));
                FMainForm.ActionEnabledEvent(null, new ActionEventArgs("actInvoiceReverseTagged", canPay));

                grdInvoices.Columns[0].Visible = canTag;

                btnTagAll.Visible        = canTag;
                btnUntagAll.Visible      = canTag;
                btnRunTagAction.Visible  = canTag;
                btnCancelTagged.Visible  = canTag;
                btnReverseTagged.Visible = canTag;

                if (canTag)
                {
                    grdInvoices.ShowCell(new SourceGrid.Position(grdInvoices.Selection.ActivePosition.Row, 0), true);
                }

                UpdateDisplayedBalance();

                if (canApprove)
                {
                    btnRunTagAction.Text = "Appro&ve Tagged";
                    FPetraUtilsObject.SetStatusBarText(btnRunTagAction, Catalog.GetString("Click to approve all the tagged items"));
                }
                else if (canPost)
                {
                    btnRunTagAction.Text = "&Post Tagged";
                    FPetraUtilsObject.SetStatusBarText(btnRunTagAction, Catalog.GetString("Click to post all the tagged items"));
                }
                else if (canPay)
                {
                    btnRunTagAction.Text = "Pa&y Tagged";
                    FPetraUtilsObject.SetStatusBarText(btnRunTagAction, Catalog.GetString("Click to pay or part pay all the tagged items"));
                }
                else
                {
                    btnRunTagAction.Text = "Pa&y Tagged";
                }
            }
        }