} //bt_Print_Click() private void bt_AlterMarginAmounts_Click(object sender, EventArgs e) { FutureMargins frm_FutMargin = new FutureMargins(); frm_FutMargin.FromParent(this, true); frm_FutMargin.Show(); } //bt_AlterMarginAmounts_Click()
} //FromParent() private void FuturesExplainWireTransfer_Shown(object sender, EventArgs e) { SystemLibrary.PositionFormOverParent(this, ParentForm1); // See if any Trades with Missing Margins String myMissingTicker = SystemLibrary.SQLSelectString("Exec sp_MissingFutureMargins"); if (myMissingTicker.Length > 0) { FutureMargins frm_FutMargin = new FutureMargins(); frm_FutMargin.FromParent(this, true); frm_FutMargin.Show(); } } // FuturesExplainWireTransfer_Shown()
} // 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()