/// <summary> /// Deal with cancellation XBRL /// </summary> private static Dividend ApproveXBRL1_cancellation_XBRL(Dividend existing_dvd, XBRL_SavedFile xsf) { if (existing_dvd == null) { MessageBox.Show("No Dividend created for this cancellation XBRL"); if (xsf != null) { xsf.processState.Value = 2; } } else { Helper_Dividend.CancelDivdiend(existing_dvd);//cancel existing dividend MessageBox.Show("Dividend " + existing_dvd.DividendIndex + " is cancelled"); if (xsf != null) { xsf.processState.Value = 1; } } if (xsf != null) { xsf.Update_to_DB(); } return(existing_dvd); }
public static Dividend ApproveXBRL(int xbrl_id) { XBRL_SavedFile xsf = Helper_XBRL_approval.ApproveXBRL0_get_xsFile(xbrl_id); XBRL_event_info xei = new XBRL_event_info(xsf.XBRLobj); Security sec = SecurityMaster.XBRL_Create_or_Get_Security(xei, true); if (sec == null) { MessageBox.Show("Helper_XBRL error 0: no Security info in either XBRL or Security Master"); return(null); } Dividend existing_dvd = Helper_XBRL_approval.ApproveXBRL0_find_existingDividend(xei); if (xei.IsCancellation_flag) { return(Helper_XBRL_approval.ApproveXBRL1_cancellation_XBRL(existing_dvd, xsf)); } Action next_step = XBRL_event_matrix.ApproveXBRL_action(xei, existing_dvd); Dividend approved_dvd = null; if (next_step == Action.Create_New_Event) { approved_dvd = Helper_XBRL_approval.ApproveXBRL2_CreateNewDividend(xei, sec); Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, approved_dvd); if (approved_dvd != null) { if (existing_dvd == null) { MessageBox.Show("New Dividend " + approved_dvd.DividendIndex + " created"); } else { MessageBox.Show("Another Dividend " + approved_dvd.DividendIndex + " created with existing Dividend " + existing_dvd.DividendIndex); } } } else if (next_step == Action.Update_Existing_event) { approved_dvd = Helper_XBRL_approval.ApproveXBRL2_UpdateDividend(xei, existing_dvd, sec); Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, approved_dvd); if (approved_dvd != null) { MessageBox.Show("Existing Dividend " + approved_dvd.DividendIndex + " is updated"); } } else if (next_step == Action.Add_Ref_to_Current) { approved_dvd = Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, existing_dvd); if (approved_dvd != null) { MessageBox.Show("XBRL ref# is added to existing Dividend " + approved_dvd.DividendIndex); } } if (approved_dvd != null)//Mark [XBRL_SavedFile] as approved { xsf.processState.Value = 1; xsf.DividendIndex.Value = approved_dvd.DividendIndex; xsf.Update_to_DB();/*Commented out for testing by Steven if needed*/ } return(approved_dvd); }