예제 #1
0
        } // dg_Summary_CellClick()

        public static void dg_SummarySystemMenuItem_Click(object sender, MouseEventArgs e)
        {
            //
            // Purpose: A generic menu click event for the Detail Right-Click
            //

            // Local Variables
            ToolStripMenuItem ts_From     = (ToolStripMenuItem)sender;
            DetailMenuStruct  myDetailStr = (DetailMenuStruct)ts_From.Tag;

            switch (ts_From.Text)
            {
            case "Check 45 Day Rule":
                String mySql     = "Exec sp_Check_45_Day_Rule " + myDetailStr.TranID.ToString();
                String myMessage = SystemLibrary.SQLSelectString(mySql);
                if (myMessage.Length == 0)
                {
                    myMessage = "45 Day Rule checked and applied";
                }
                ((ProcessFundClosedTransactions)myDetailStr.myParentForm).LoadSummary();
                MessageBox.Show(myMessage, ts_From.Text);
                break;

            case "Move Franking Credit to another Sub-Fund(s)":
            case "Move Dividend to another Sub-Fund(s)":
            case "Apportion Interest to another Sub-Fund(s)":
                ProcessJournals frm = new ProcessJournals();
                frm.FromParent(myDetailStr.myParentForm, myDetailStr.TranID, myDetailStr.TranType, myDetailStr.EffectiveDate, myDetailStr.AccountID, myDetailStr.AccountType, myDetailStr.ParentFundID, myDetailStr.FundID, myDetailStr.PortfolioID, myDetailStr.Description, myDetailStr.Amount, myDetailStr.crncy);
                frm.Show();
                break;

            case "Reverse Interest Accrual Entry":
                ProcessJournals frm1 = new ProcessJournals();
                frm1.FromParent(myDetailStr.myParentForm, "Reverse Accrual", myDetailStr.TranID, myDetailStr.TranType, myDetailStr.EffectiveDate, myDetailStr.AccountID, myDetailStr.AccountType, myDetailStr.Description, myDetailStr.Amount, myDetailStr.crncy, myDetailStr.ParentFundID, myDetailStr.FundID, myDetailStr.PortfolioID);
                frm1.Show();
                break;

            case "General Journal":
            default:
                ProcessJournals frm2 = new ProcessJournals();
                frm2.FromParent(myDetailStr.myParentForm, "General Journal", myDetailStr.TranID, myDetailStr.TranType, myDetailStr.EffectiveDate, myDetailStr.AccountID, myDetailStr.AccountType, myDetailStr.Description, myDetailStr.Amount, myDetailStr.crncy, myDetailStr.ParentFundID, myDetailStr.FundID, myDetailStr.PortfolioID);
                frm2.Show();
                break;
            }
        } //dg_SummarySystemMenuItem_Click()
예제 #2
0
        } // dg_Detail_CellClick()

        public static void dg_DetailSystemMenuItem_Click(object sender, MouseEventArgs e)
        {
            //
            // Purpose: A generic menu click event for the Detail Right-Click
            //

            // Local Variables
            ToolStripMenuItem ts_From     = (ToolStripMenuItem)sender;
            DetailMenuStruct  myDetailStr = (DetailMenuStruct)ts_From.Tag;
            String            Reason      = "Deleted because {your text here}";

            if (ts_From.Text.StartsWith("Delete the Transactions that came from"))
            {
                if (SystemLibrary.InputBox(ts_From.Text, "You are about to remove a transactions sourced from '" + myDetailStr.Source + "'.\r\n" +
                                           "You will not be able to reverse this.\r\n\r\n" +
                                           "Press [Ok] to continue the deletion, or [Cancel] to abort.",
                                           ref Reason, ((ProcessUnallocatedTransactions)myDetailStr.myParentForm).validate_SaveAs, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    SystemLibrary.SQLExecute("Exec sp_RemoveTransaction " + myDetailStr.TranID.ToString() + ",'" + Reason + "'");
                    ((ProcessUnallocatedTransactions)myDetailStr.myParentForm).RefreshData();
                    MessageBox.Show("Transaction removed.");
                }
            }
            else if (ts_From.Text.Equals("Transfer Funds to another account of the same type"))
            {
                // Local Variables
                String mySql = "Select t.AccountID, a.AccountType, t.Amount, t.crncy, f.ParentFundID, t.PortfolioID " +
                               "From    Transactions t, " +
                               "        Accounts a, " +
                               "        Fund f " +
                               "Where   t.TranID = " + myDetailStr.TranID.ToString() + " " +
                               "And     a.AccountID = t.AccountID " +
                               "And     f.FundID = t.FundID";

                DataTable dt_Journal = SystemLibrary.SQLSelectToDataTable(mySql);

                if (dt_Journal.Rows.Count > 0)
                {
                    Int32  AccountID    = SystemLibrary.ToInt32(dt_Journal.Rows[0]["AccountID"]);
                    String AccountType  = SystemLibrary.ToString(dt_Journal.Rows[0]["AccountType"]);
                    Double Amount       = SystemLibrary.ToDouble(dt_Journal.Rows[0]["Amount"]);
                    String crncy        = SystemLibrary.ToString(dt_Journal.Rows[0]["crncy"]);
                    Int32  ParentFundID = SystemLibrary.ToInt32(dt_Journal.Rows[0]["ParentFundID"]);
                    Int32  PortfolioID  = SystemLibrary.ToInt32(dt_Journal.Rows[0]["PortfolioID"]);

                    ProcessJournals frm2 = new ProcessJournals();
                    frm2.FromParent(myDetailStr.myParentForm, "Between Accounts", myDetailStr.TranID, myDetailStr.TranType,
                                    myDetailStr.EffectiveDate, AccountID, AccountType, myDetailStr.Description,
                                    Amount, crncy, ParentFundID, myDetailStr.FundID, PortfolioID.ToString());
                    frm2.Show();
                }
            }
            else if (ts_From.Text.Equals("Create Other Side of Transfer to another account of the same type"))
            {
                // Local Variables
                String mySql = "Select t.AccountID, a.AccountType, t.Amount, t.crncy, f.ParentFundID, t.PortfolioID " +
                               "From    Transactions t, " +
                               "        Accounts a, " +
                               "        Fund f " +
                               "Where   t.TranID = " + myDetailStr.TranID.ToString() + " " +
                               "And     a.AccountID = t.AccountID " +
                               "And     f.FundID = t.FundID";

                DataTable dt_Journal = SystemLibrary.SQLSelectToDataTable(mySql);

                if (dt_Journal.Rows.Count > 0)
                {
                    Int32  AccountID    = SystemLibrary.ToInt32(dt_Journal.Rows[0]["AccountID"]);
                    String AccountType  = SystemLibrary.ToString(dt_Journal.Rows[0]["AccountType"]);
                    Double Amount       = SystemLibrary.ToDouble(dt_Journal.Rows[0]["Amount"]);
                    String crncy        = SystemLibrary.ToString(dt_Journal.Rows[0]["crncy"]);
                    Int32  ParentFundID = SystemLibrary.ToInt32(dt_Journal.Rows[0]["ParentFundID"]);
                    Int32  PortfolioID  = SystemLibrary.ToInt32(dt_Journal.Rows[0]["PortfolioID"]);

                    ProcessJournals frm2 = new ProcessJournals();
                    frm2.FromParent(myDetailStr.myParentForm, "Between Accounts - Other Half", myDetailStr.TranID, myDetailStr.TranType,
                                    myDetailStr.EffectiveDate, AccountID, AccountType, myDetailStr.Description,
                                    Amount, crncy, ParentFundID, myDetailStr.FundID, PortfolioID.ToString());
                    frm2.Show();
                }
            }
            else if (ts_From.Text.Equals("Manually Apportion Ticket Charges to sub accounts"))
            {
                // Local Variables
                String mySql = "Select t.AccountID, a.AccountType, t.Amount, t.crncy, f.ParentFundID, t.PortfolioID " +
                               "From    Transactions t, " +
                               "        Accounts a, " +
                               "        Fund f " +
                               "Where   t.TranID = " + myDetailStr.TranID.ToString() + " " +
                               "And     a.AccountID = t.AccountID " +
                               "And     f.FundID = t.FundID";

                DataTable dt_Journal = SystemLibrary.SQLSelectToDataTable(mySql);

                if (dt_Journal.Rows.Count > 0)
                {
                    Int32  AccountID    = SystemLibrary.ToInt32(dt_Journal.Rows[0]["AccountID"]);
                    String AccountType  = SystemLibrary.ToString(dt_Journal.Rows[0]["AccountType"]);
                    Double Amount       = SystemLibrary.ToDouble(dt_Journal.Rows[0]["Amount"]);
                    String crncy        = SystemLibrary.ToString(dt_Journal.Rows[0]["crncy"]);
                    Int32  ParentFundID = SystemLibrary.ToInt32(dt_Journal.Rows[0]["ParentFundID"]);
                    Int32  PortfolioID  = SystemLibrary.ToInt32(dt_Journal.Rows[0]["PortfolioID"]);

                    ProcessJournals frm2 = new ProcessJournals();
                    frm2.FromParent(myDetailStr.myParentForm, "Between Accounts - Manually Apportion Ticket Charges to sub accounts", myDetailStr.TranID, myDetailStr.TranType,
                                    myDetailStr.EffectiveDate, AccountID, AccountType, myDetailStr.Description,
                                    Amount, crncy, ParentFundID, myDetailStr.FundID, PortfolioID.ToString());
                    frm2.Show();
                }
            }
            else
            {
                switch (myDetailStr.TranType.ToUpper())
                {
                case "INTEREST":
                    InterestApportion frm = new InterestApportion();
                    frm.FromParent(myDetailStr.myParentForm, myDetailStr.TranID);
                    frm.Show();
                    break;

                case "STOCK LOAN FEE":
                    StockLoanFeeApportion frm1 = new StockLoanFeeApportion();
                    frm1.FromParent(myDetailStr.myParentForm, myDetailStr.TranID);
                    frm1.Show();
                    break;

                case "TICKET CHARGES":
                    String myMessage = SystemLibrary.SQLSelectString("Exec sp_ApportionTicketCharges " + myDetailStr.TranID.ToString() + " ");
                    ((ProcessUnallocatedTransactions)myDetailStr.myParentForm).RefreshData();
                    MessageBox.Show(myMessage, "Apportion Ticket Charges");
                    break;

                case "TRANSFER":
                    if (myDetailStr.Description.ToUpper() == "FUTURES MARGIN" || myDetailStr.Description.ToUpper() == "Day Profit + Future comm and charges".ToUpper())
                    {
                        if (ts_From.Text.StartsWith("Explain Future Margins movements for "))
                        {
                            FuturesExplainWireTransfer frm_Explain = new FuturesExplainWireTransfer();
                            frm_Explain.FromParent((ProcessUnallocatedTransactions)myDetailStr.myParentForm, myDetailStr.FundID, myDetailStr.EffectiveDate);
                            frm_Explain.Show();
                        }
                        else if (ts_From.Text.StartsWith("DO THIS FIRST - Update MISSING Future Margin Definition for "))
                        {
                            FutureMargins frm_FutMargin = new FutureMargins();
                            frm_FutMargin.FromParent(myDetailStr.myParentForm, true);
                            frm_FutMargin.Show();
                        }
                        else
                        {
                            SystemLibrary.SQLExecute("Exec sp_ReapplyMargin " + myDetailStr.FundID.ToString() + ", '" + myDetailStr.RecordDate.ToString("dd-MMM-yyyy") + "' ");
                            ((ProcessUnallocatedTransactions)myDetailStr.myParentForm).RefreshData();
                            MessageBox.Show("Futures Margins Reapplied");
                        }
                    }
                    break;
                }
            }
        } //dg_DetailSystemMenuItem_Click()