Esempio n. 1
0
        /// <summary>
        /// Pay all tagged documents
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void PayAllTagged(object sender, EventArgs e)
        {
            string MsgTitle = Catalog.GetString("Document Payment");

            this.Cursor = Cursors.WaitCursor;
            AccountsPayableTDS TempDS        = LoadTaggedDocuments();
            TFrmAPPayment      PaymentScreen = new TFrmAPPayment(FMainForm);

            List <int> PayTheseDocs = new List <int>();

            foreach (DataRowView rv in grdInvoices.PagedDataTable.DefaultView)
            {
                if ((rv.Row["Selected"].Equals(true) &&
                     ("|POSTED|PARTPAID|".IndexOf("|" + rv.Row["DocumentStatus"].ToString() + "|") >= 0)))
                {
                    PayTheseDocs.Add(Convert.ToInt32(rv.Row["ApDocumentId"]));
                }
            }

            if (PayTheseDocs.Count > 0)
            {
                if (PaymentScreen.AddDocumentsToPayment(TempDS, FMainForm.LedgerNumber, PayTheseDocs))
                {
                    this.Cursor = Cursors.Default;
                    PaymentScreen.Show();
                }

                this.Cursor = Cursors.Default;
            }
            else
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(Catalog.GetString("There are no tagged documents to be paid."), MsgTitle);
            }
        }
        private void PayDocument(object sender, EventArgs e)
        {
            if (FPetraUtilsObject.HasChanges)
            {
                MessageBox.Show(Catalog.GetString("Document should be saved before paying."), Catalog.GetString(
                                    "Pay Document"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            TFrmAPPayment PaymentScreen = new TFrmAPPayment(this);

            List <int> PayTheseDocs = new List <int>();

            PayTheseDocs.Add(FMainDS.AApDocument[0].ApDocumentId);

            if (PaymentScreen.AddDocumentsToPayment(FMainDS, FDocumentLedgerNumber, PayTheseDocs))
            {
                PaymentScreen.Show();
            }
        }
Esempio n. 3
0
        /// Add all selected invoices to the payment list and show that list so that the user can make the payment
        private void AddTaggedToPayment(object sender, EventArgs e)
        {
            List <Int32>       TaggedDocuments = new List <Int32>();
            AccountsPayableTDS TempDS          = new AccountsPayableTDS();

            foreach (DataRowView rv in FPagedDataTable.DefaultView)
            {
                if (
                    (rv.Row["Tagged"].Equals(true)) &&
                    (rv.Row["Currency"].ToString() == txtSupplierCurrency.Text) &&
                    ("|POSTED|PARTPAID|".IndexOf("|" + rv.Row["Status"].ToString()) >= 0)
                    )
                {
                    Int32 DocumentId = Convert.ToInt32(rv.Row["ApDocumentId"]);
                    TempDS.Merge(TRemote.MFinance.AP.WebConnectors.LoadAApDocument(FLedgerNumber, DocumentId));

                    // I've loaded this record in my DS, but I was not given a handle to it, so I need to find it!
                    TempDS.AApDocument.DefaultView.Sort = AApDocumentTable.GetApDocumentIdDBName();
                    Int32          Idx         = TempDS.AApDocument.DefaultView.Find(DocumentId);
                    AApDocumentRow DocumentRow = TempDS.AApDocument[Idx];

                    if ("|POSTED|PARTPAID|".IndexOf("|" + DocumentRow["a_document_status_c"].ToString()) >= 0)
                    {
                        TaggedDocuments.Add(DocumentId);
                    }
                }
            }

            if (TaggedDocuments.Count == 0)
            {
                return;
            }

            TFrmAPPayment frm = new TFrmAPPayment(this);

            if (frm.AddDocumentsToPayment(TempDS, FLedgerNumber, TaggedDocuments))
            {
                frm.Show();
            }
        }
        /// <summary>
        /// Pay all tagged documents
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void PayAllTagged(object sender, EventArgs e)
        {
            // This will throw an exception if insufficient permissions
            TSecurityChecks.CheckUserModulePermissions("FINANCE-2", "PayAllTagged [raised by Client Proxy for ModuleAccessManager]");

            string MsgTitle = Catalog.GetString("Document Payment");

            this.Cursor = Cursors.WaitCursor;
            AccountsPayableTDS TempDS        = LoadTaggedDocuments();
            TFrmAPPayment      PaymentScreen = new TFrmAPPayment(FMainForm);

            List <int> PayTheseDocs = new List <int>();

            foreach (DataRowView rv in grdInvoices.PagedDataTable.DefaultView)
            {
                if ((rv.Row["Selected"].Equals(true) &&
                     ("|POSTED|PARTPAID|".IndexOf("|" + rv.Row["DocumentStatus"].ToString() + "|") >= 0)))
                {
                    PayTheseDocs.Add(Convert.ToInt32(rv.Row["ApDocumentId"]));
                }
            }

            if (PayTheseDocs.Count > 0)
            {
                if (PaymentScreen.AddDocumentsToPayment(TempDS, FMainForm.LedgerNumber, PayTheseDocs))
                {
                    this.Cursor = Cursors.Default;
                    PaymentScreen.Show();
                }

                this.Cursor = Cursors.Default;
            }
            else
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(Catalog.GetString("There are no tagged documents to be paid."), MsgTitle);
            }
        }
        /// Add all selected invoices to the payment list and show that list so that the user can make the payment
        private void AddTaggedToPayment(object sender, EventArgs e)
        {
            List <Int32>TaggedDocuments = new List <Int32>();
            AccountsPayableTDS TempDS = new AccountsPayableTDS();

            foreach (DataRowView rv in FPagedDataTable.DefaultView)
            {
                if (
                    (rv.Row["Tagged"].Equals(true))
                    && (rv.Row["Currency"].ToString() == txtSupplierCurrency.Text)
                    && ("|POSTED|PARTPAID|".IndexOf("|" + rv.Row["Status"].ToString()) >= 0)
                    )
                {
                    Int32 DocumentId = Convert.ToInt32(rv.Row["ApDocumentId"]);
                    TempDS.Merge(TRemote.MFinance.AP.WebConnectors.LoadAApDocument(FLedgerNumber, DocumentId));

                    // I've loaded this record in my DS, but I was not given a handle to it, so I need to find it!
                    TempDS.AApDocument.DefaultView.Sort = AApDocumentTable.GetApDocumentIdDBName();
                    Int32 Idx = TempDS.AApDocument.DefaultView.Find(DocumentId);
                    AApDocumentRow DocumentRow = TempDS.AApDocument[Idx];

                    if ("|POSTED|PARTPAID|".IndexOf("|" + DocumentRow["a_document_status_c"].ToString()) >= 0)
                    {
                        TaggedDocuments.Add(DocumentId);
                    }
                }
            }

            if (TaggedDocuments.Count == 0)
            {
                return;
            }

            TFrmAPPayment frm = new TFrmAPPayment(this);

            if (frm.AddDocumentsToPayment(TempDS, FLedgerNumber, TaggedDocuments))
            {
                frm.Show();
            }
        }
        private void PayDocument(object sender, EventArgs e)
        {
            if (FPetraUtilsObject.HasChanges)
            {
                MessageBox.Show(Catalog.GetString("Document should be saved before paying."), Catalog.GetString(
                        "Pay Document"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            TFrmAPPayment PaymentScreen = new TFrmAPPayment(this);

            List <int>PayTheseDocs = new List <int>();

            PayTheseDocs.Add(FMainDS.AApDocument[0].ApDocumentId);

            if (PaymentScreen.AddDocumentsToPayment(FMainDS, FDocumentLedgerNumber, PayTheseDocs))
            {
                PaymentScreen.Show();
            }
        }
        /// <summary>
        /// Pay all tagged documents
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void PayAllTagged(object sender, EventArgs e)
        {
            string MsgTitle = Catalog.GetString("Document Payment");

            this.Cursor = Cursors.WaitCursor;
            AccountsPayableTDS TempDS = LoadTaggedDocuments();
            TFrmAPPayment PaymentScreen = new TFrmAPPayment(FMainForm);

            List <int>PayTheseDocs = new List <int>();

            foreach (DataRowView rv in grdInvoices.PagedDataTable.DefaultView)
            {
                if ((rv.Row["Selected"].Equals(true)
                     && ("|POSTED|PARTPAID|".IndexOf("|" + rv.Row["DocumentStatus"].ToString() + "|") >= 0)))
                {
                    PayTheseDocs.Add(Convert.ToInt32(rv.Row["ApDocumentId"]));
                }
            }

            if (PayTheseDocs.Count > 0)
            {
                if (PaymentScreen.AddDocumentsToPayment(TempDS, FMainForm.LedgerNumber, PayTheseDocs))
                {
                    this.Cursor = Cursors.Default;
                    PaymentScreen.Show();
                }

                this.Cursor = Cursors.Default;
            }
            else
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(Catalog.GetString("There are no tagged documents to be paid."), MsgTitle);
            }
        }