Beispiel #1
0
        /// <summary>
        /// Create a new credit note
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateCreditNote(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            TFrmAPEditDocument frm = new TFrmAPEditDocument(this);

            frm.CreateAApDocument(FLedgerNumber, FPartnerKey, true);
            frm.Show();

            this.Cursor = Cursors.Default;
        }
Beispiel #2
0
        /// <summary>
        /// create a new credit note
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void CreateCreditNote(object sender, EventArgs e)
        {
            Int64 PartnerKey = GetCurrentlySelectedSupplier();

            if (PartnerKey != -1)
            {
                this.Cursor = Cursors.WaitCursor;
                TFrmAPEditDocument frm = new TFrmAPEditDocument(FMainForm);
                frm.CreateAApDocument(FMainForm.LedgerNumber, PartnerKey, true);
                this.Cursor = Cursors.Default;

                frm.Show();
            }
        }
        /// <summary>
        /// Open the selected invoice
        /// </summary>
        public void OpenSelectedInvoice(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            Int32 SelectedInvoice = GetCurrentlySelectedDocumentId();

            if (SelectedInvoice > 0)
            {
                TFrmAPEditDocument frm = new TFrmAPEditDocument(FMainForm);

                if (frm.LoadAApDocument(FMainForm.LedgerNumber, SelectedInvoice))
                {
                    frm.Show();
                }
            }

            this.Cursor = Cursors.Default;
        }
Beispiel #4
0
        /// <summary>
        /// Post all tagged documents in one GL Batch
        /// Uses static functions from TFrmAPEditDocument
        /// </summary>
        private void PostTaggedDocuments(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["Status"].ToString().Length > 0) && // Invoices have status, Payments don't.
                    ("|POSTED|PARTPAID|PAID".IndexOf("|" + rv.Row["Status"].ToString()) < 0) &&
                    (rv.Row["Currency"].ToString() == txtSupplierCurrency.Text)
                    )
                {
                    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 = "a_ap_document_id_i";
                    Int32          Idx         = TempDS.AApDocument.DefaultView.Find(DocumentId);
                    AApDocumentRow DocumentRow = TempDS.AApDocument[Idx];

                    if (TFrmAPEditDocument.ApDocumentCanPost(TempDS, DocumentRow))
                    {
                        TaggedDocuments.Add(DocumentId);
                    }
                }
            }

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

            if (TFrmAPEditDocument.PostApDocumentList(TempDS, FLedgerNumber, TaggedDocuments, this))
            {
                // TODO: print reports on successfully posted batch
                MessageBox.Show(Catalog.GetString("The AP documents have been posted successfully!"));

                // TODO: show posting register of GL Batch?

                LoadSupplier(FLedgerNumber, FPartnerKey);
            }
        }
Beispiel #5
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();
            }
        }
        /// <summary>
        /// Open the selected invoice
        /// </summary>
        public void OpenAllTagged(object sender, EventArgs e)
        {
            if (grdInvoices.PagedDataTable.DefaultView.Count > 0)
            {
                foreach (DataRowView rv in grdInvoices.PagedDataTable.DefaultView)
                {
                    if (rv.Row["Selected"].Equals(true))
                    {
                        TFrmAPEditDocument frm = new TFrmAPEditDocument(FMainForm);

                        if (frm.LoadAApDocument(FMainForm.LedgerNumber, Convert.ToInt32(rv.Row["ApDocumentId"])))
                        {
                            frm.Show();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(Catalog.GetString("There are no tagged invoices to be opened."), Catalog.GetString("Open Documents"));
            }
        }
        /// <summary>
        /// Post all tagged documents
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void PostAllTagged(object sender, EventArgs e)
        {
            // This will throw an exception if insufficient permissions
            TSecurityChecks.CheckUserModulePermissions("FINANCE-2", "PostAllTagged [raised by Client Proxy for ModuleAccessManager]");

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

            AccountsPayableTDS TempDS = LoadTaggedDocuments();

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

            TempDS.AApDocument.DefaultView.Sort = AApDocumentDetailTable.GetApDocumentIdDBName();

            string testString = "|CANCELLED|POSTED|PARTPAID|PAID|";

            if (FRequireApprovalBeforePosting)
            {
                testString += "OPEN|";
            }

            foreach (DataRowView rv in grdInvoices.PagedDataTable.DefaultView)
            {
                if ((rv.Row["Selected"].Equals(true) && (testString.IndexOf("|" + rv.Row["DocumentStatus"].ToString()) < 0)))
                {
                    int DocId = Convert.ToInt32(rv.Row["ApDocumentId"]);

                    int RowIdx = TempDS.AApDocument.DefaultView.Find(DocId);

                    if (RowIdx >= 0)
                    {
                        AApDocumentRow DocumentRow = (AApDocumentRow)TempDS.AApDocument.DefaultView[RowIdx].Row;

                        if (TFrmAPEditDocument.ApDocumentCanPost(TempDS, DocumentRow)) // This will produce an message box if there's a problem.
                        {
                            PostTheseDocs.Add(DocId);
                        }
                    }
                }
            }

            if (PostTheseDocs.Count > 0)
            {
                string msg = String.Format(Catalog.GetString("Are you sure that you want to post the {0} tagged document(s)?"), PostTheseDocs.Count);

                if (MessageBox.Show(msg, MsgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }

                if (TFrmAPEditDocument.PostApDocumentList(TempDS, FMainForm.LedgerNumber, PostTheseDocs, FMainForm))
                {
                    // TODO: print reports on successfully posted batch
                    MessageBox.Show(Catalog.GetString("The tagged documents have been posted successfully!"), MsgTitle);
                    FMainForm.IsInvoiceDataChanged = true;

                    LoadInvoices();

                    // TODO: show posting register of GL Batch?
                }
            }
            else
            {
                MessageBox.Show(Catalog.GetString("There are no tagged documents to be posted."), MsgTitle);
            }
        }
        /// <summary>
        /// Create a new credit note
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateCreditNote(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            TFrmAPEditDocument frm = new TFrmAPEditDocument(this);

            frm.CreateAApDocument(FLedgerNumber, FPartnerKey, true);
            frm.Show();

            this.Cursor = Cursors.Default;
        }
        // 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();
            }
        }
        /// <summary>
        /// create a new credit note
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void CreateCreditNote(object sender, EventArgs e)
        {
            Int64 PartnerKey = GetCurrentlySelectedSupplier();

            if (PartnerKey != -1)
            {
                this.Cursor = Cursors.WaitCursor;
                TFrmAPEditDocument frm = new TFrmAPEditDocument(FMainForm);
                frm.CreateAApDocument(FMainForm.LedgerNumber, PartnerKey, true);
                this.Cursor = Cursors.Default;

                frm.Show();
            }
        }
        /// <summary>
        /// Open the selected invoice
        /// </summary>
        public void OpenAllTagged(object sender, EventArgs e)
        {
            if (grdInvoices.PagedDataTable.DefaultView.Count > 0)
            {
                foreach (DataRowView rv in grdInvoices.PagedDataTable.DefaultView)
                {
                    if (rv.Row["Selected"].Equals(true))
                    {
                        TFrmAPEditDocument frm = new TFrmAPEditDocument(FMainForm);

                        if (frm.LoadAApDocument(FMainForm.LedgerNumber, Convert.ToInt32(rv.Row["ApDocumentId"])))
                        {
                            frm.Show();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(Catalog.GetString("There are no tagged invoices to be opened."), Catalog.GetString("Open Documents"));
            }
        }
        /// <summary>
        /// Open the selected invoice
        /// </summary>
        public void OpenSelectedInvoice(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            Int32 SelectedInvoice = GetCurrentlySelectedDocumentId();

            if (SelectedInvoice > 0)
            {
                TFrmAPEditDocument frm = new TFrmAPEditDocument(FMainForm);

                if (frm.LoadAApDocument(FMainForm.LedgerNumber, SelectedInvoice))
                {
                    frm.Show();
                }
            }

            this.Cursor = Cursors.Default;
        }