Ejemplo 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();
            }
        }
Ejemplo n.º 3
0
        // Opens an individual document or payment
        private void OpenADocumentOrPayment(DataRowView ADataRow)
        {
            if (ADataRow["Status"].ToString().Length > 0) // invoices have status, and payments don't.
            {
                Int32 DocumentId       = Convert.ToInt32(ADataRow["ApDocumentId"]);
                TFrmAPEditDocument frm = new TFrmAPEditDocument(this);

                if (frm.LoadAApDocument(FLedgerNumber, DocumentId))
                {
                    frm.Show();
                }
            }
            else
            {
                Int32         PaymentNumber = Convert.ToInt32(ADataRow["ApNum"]);
                TFrmAPPayment frm           = new TFrmAPPayment(this);
                frm.ReloadPayment(FLedgerNumber, PaymentNumber);
                frm.Show();
            }
        }
Ejemplo n.º 4
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);
            }
        }
        private void ReverseSelected(object sender, EventArgs e)
        {
            DataRowView[] SelectedGridRow = grdResult.SelectedDataRowsAsDataRowView;

            if (SelectedGridRow.Length >= 1)
            {
                if (SelectedGridRow[0]["Status"].ToString().Length > 0) // invoices have status, and payments don't.
                {  // Reverse invoice to a previous (unposted) state
                    string barstatus = "|" + SelectedGridRow[0]["Status"].ToString();

                    if (barstatus == "|POSTED")
                    {
                        TVerificationResultCollection Verifications;
                        Int32 DocumentId = Convert.ToInt32(SelectedGridRow[0]["ApDocumentId"]);
                        List <Int32>ApDocumentIds = new List <Int32>();
                        ApDocumentIds.Add(DocumentId);

                        TDlgGLEnterDateEffective dateEffectiveDialog = new TDlgGLEnterDateEffective(
                            FLedgerNumber,
                            Catalog.GetString("Select reversal date"),
                            Catalog.GetString("The date effective for this reversal") + ":");

                        if (dateEffectiveDialog.ShowDialog() != DialogResult.OK)
                        {
                            MessageBox.Show(Catalog.GetString("Reversal was cancelled."), Catalog.GetString(
                                    "No Success"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        DateTime PostingDate = dateEffectiveDialog.SelectedDate;

                        if (TRemote.MFinance.AP.WebConnectors.PostAPDocuments(
                                FLedgerNumber,
                                ApDocumentIds,
                                PostingDate,
                                true,
                                out Verifications))
                        {
                            System.Windows.Forms.MessageBox.Show("Invoice reversed to Approved status.", Catalog.GetString("Reversal"));
                            Reload();
                            return;
                        }
                        else
                        {
                            string ErrorMessages = String.Empty;

                            foreach (TVerificationResult verif in Verifications)
                            {
                                ErrorMessages += "[" + verif.ResultContext + "] " +
                                                 verif.ResultTextCaption + ": " +
                                                 verif.ResultText + Environment.NewLine;
                            }

                            System.Windows.Forms.MessageBox.Show(ErrorMessages, Catalog.GetString("Reversal"));
                        }

                        return;
                    } // reverse posted invoice

                    if ("|PAID|PARTPAID".IndexOf(barstatus) >= 0)
                    {
                        MessageBox.Show("Can't reverse a paid invoice. Reverse the payment instead.", "Reverse");
                    }
                }
                else // Reverse payment
                {
                    Int32 PaymentNum = (Int32)SelectedGridRow[0]["ApNum"];
                    TFrmAPPayment PaymentScreen = new TFrmAPPayment(this);
                    PaymentScreen.ReversePayment(FLedgerNumber, PaymentNum);
                }
            }
        }
        // Opens an individual document or payment
        private void OpenADocumentOrPayment(DataRowView ADataRow)
        {
            if (ADataRow["Status"].ToString().Length > 0) // invoices have status, and payments don't.
            {
                Int32 DocumentId = Convert.ToInt32(ADataRow["ApDocumentId"]);
                TFrmAPEditDocument frm = new TFrmAPEditDocument(this);

                if (frm.LoadAApDocument(FLedgerNumber, DocumentId))
                {
                    frm.Show();
                }
            }
            else
            {
                Int32 PaymentNumber = Convert.ToInt32(ADataRow["ApNum"]);
                TFrmAPPayment frm = new TFrmAPPayment(this);
                frm.ReloadPayment(FLedgerNumber, PaymentNumber);
                frm.Show();
            }
        }
        /// 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();
            }
        }
Ejemplo n.º 10
0
        private void ReverseSelected(object sender, EventArgs e)
        {
            DataRowView[] SelectedGridRow = grdResult.SelectedDataRowsAsDataRowView;

            if (SelectedGridRow.Length >= 1)
            {
                if (SelectedGridRow[0]["Status"].ToString().Length > 0) // invoices have status, and payments don't.
                {                                                       // Reverse invoice to a previous (unposted) state
                    string barstatus = "|" + SelectedGridRow[0]["Status"].ToString();

                    if (barstatus == "|POSTED")
                    {
                        TVerificationResultCollection Verifications;
                        Int32        DocumentId    = Convert.ToInt32(SelectedGridRow[0]["ApDocumentId"]);
                        List <Int32> ApDocumentIds = new List <Int32>();
                        ApDocumentIds.Add(DocumentId);

                        TDlgGLEnterDateEffective dateEffectiveDialog = new TDlgGLEnterDateEffective(
                            FLedgerNumber,
                            Catalog.GetString("Select reversal date"),
                            Catalog.GetString("The date effective for this reversal") + ":");

                        if (dateEffectiveDialog.ShowDialog() != DialogResult.OK)
                        {
                            MessageBox.Show(Catalog.GetString("Reversal was cancelled."), Catalog.GetString(
                                                "No Success"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        DateTime PostingDate = dateEffectiveDialog.SelectedDate;

                        if (TRemote.MFinance.AP.WebConnectors.PostAPDocuments(
                                FLedgerNumber,
                                ApDocumentIds,
                                PostingDate,
                                true,
                                out Verifications))
                        {
                            System.Windows.Forms.MessageBox.Show("Invoice reversed to Approved status.", Catalog.GetString("Reversal"));
                            Reload();
                            return;
                        }
                        else
                        {
                            string ErrorMessages = String.Empty;

                            foreach (TVerificationResult verif in Verifications)
                            {
                                ErrorMessages += "[" + verif.ResultContext + "] " +
                                                 verif.ResultTextCaption + ": " +
                                                 verif.ResultText + Environment.NewLine;
                            }

                            System.Windows.Forms.MessageBox.Show(ErrorMessages, Catalog.GetString("Reversal"));
                        }

                        return;
                    } // reverse posted invoice

                    if ("|PAID|PARTPAID".IndexOf(barstatus) >= 0)
                    {
                        MessageBox.Show("Can't reverse a paid invoice. Reverse the payment instead.", "Reverse");
                    }
                }
                else // Reverse payment
                {
                    Int32         PaymentNum    = (Int32)SelectedGridRow[0]["ApNum"];
                    TFrmAPPayment PaymentScreen = new TFrmAPPayment(this);
                    PaymentScreen.ReversePayment(FLedgerNumber, PaymentNum);
                }
            }
        }
        /// <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);
            }
        }