public static void _SA_Delete(GENERAL_JOURNAL GJRecord) { Trace.WriteLine("Deleting the general jorunal entry " + GJRecord.source + ""); GeneralJournal._SA_Open(GJRecord); GeneralJournal.repo.ToolBar.Reverse.Click(); // dw SimplyMessage.repo._SA_HandleMessage(SimplyMessage.YES_LOC, SimplyMessage._MSG_AREYOUSUREYOUWANTTOREMOVE_LOC); }
public static void _SA_Open(GENERAL_JOURNAL GJRecord) { if (!GeneralJournal.repo.SelfInfo.Exists()) { GeneralJournal._SA_Invoke(); } GeneralJournal.repo.ToolBar.Adjust.Click(); DialogJournalSearch._SA_SelectLookupDateRange(); // Assume there are no diplicate sources DialogJournalSearch.repo.Source.TextValue = GJRecord.source; DialogJournalSearch.repo.OK.Click(); }
public static void _SA_Create(GENERAL_JOURNAL GJRecord, bool bSave, bool bEdit, bool bRecur) { bool bCheckGlobalProject = false; if (!GeneralJournal.repo.SelfInfo.Exists()) { GeneralJournal._SA_Invoke(); } if (bEdit) { if (GeneralJournal.repo.Source.TextValue != GJRecord.source) // load the journal entry for editing { GeneralJournal._SA_Open(GJRecord); } Ranorex.Report.Info("Adjusting General Journal " + GJRecord.source + ""); } else if (!(bRecur)) { Ranorex.Report.Info("Creating General Journal " + GJRecord.source + ""); } if (Functions.GoodData(GJRecord.source)) { GeneralJournal.repo.Source.TextValue = GJRecord.source; } if (Functions.GoodData(GJRecord.journalDate)) { GeneralJournal.repo.JournalDate.TextValue = GJRecord.journalDate; } if (Functions.GoodData(GJRecord.comment)) { GeneralJournal.repo.Comment.TextValue = GJRecord.comment; } if (Functions.GoodData(GJRecord.currCode)) { if (GeneralJournal.repo.CurrencyCodeInfo.Exists()) { GeneralJournal.repo.CurrencyCode.Select(GJRecord.currCode); if ((bEdit && Variables.bUseDataFiles)) { // dw SimplyMessage.repo._SA_HandleMessage(SimplyMessage.YES_LOC, SimplyMessage._MSG_YOUHAVESELECTEDADIFFERENTFOREIGNCURRENCY_LOC, false, true); } } } if (Functions.GoodData(GJRecord.exchRate)) { if (GeneralJournal.repo.ExchangeRateInfo.Exists() && Functions.GoodData(GJRecord.exchRate)) { GeneralJournal.repo.ExchangeRate.TextValue = GJRecord.exchRate; } } // click to first cell GeneralJournal.repo.DetailsContainer.ClickFirstCell(); //int x; if (bEdit) { //clear all the existing lines in the grid int x = 0; while (GeneralJournal.repo.DetailsContainer.GetContents().Count != 0) { if (x > 100) { Functions.Verify(false, true, "able to clear all details of table on edit"); break; } GeneralJournal.repo.DetailsContainer.PressKeys("<Alt+e>"); // to remove line GeneralJournal.repo.DetailsContainer.PressKeys("r"); x++; } } if (Functions.GoodData(GJRecord.GridRows)) { double nTotalDebit = 0; // total debit amount double nTotalCredit = 0; // total credit amount //int iDelay = 2; // sleep 2 sec for (int x = 0; x < GJRecord.GridRows.Count; x++) { // enter account GeneralJournal.repo.DetailsContainer.PressKeys(GJRecord.GridRows[x].Account.acctNumber + "{Tab}"); // enter Debit/Crecit amount if (x == 0) { if (Functions.GoodData(GJRecord.GridRows[x].debitAmt) && GJRecord.GridRows[x].debitAmt != "0") { GeneralJournal.repo.DetailsContainer.PressKeys(GJRecord.GridRows[x].debitAmt); nTotalDebit += Convert.ToDouble(GJRecord.GridRows[x].debitAmt); GeneralJournal.repo.DetailsContainer.MoveRight(); } else { GeneralJournal.repo.DetailsContainer.MoveRight(); if (Functions.GoodData(GJRecord.GridRows[x].creditAmt)) { GeneralJournal.repo.DetailsContainer.SetText(GJRecord.GridRows[x].creditAmt); nTotalCredit += Convert.ToDouble(GJRecord.GridRows[x].creditAmt); } GeneralJournal.repo.DetailsContainer.MoveRight(); } } // All lines after the first one will be depending on the total debit amount and total credit amount else { //if((GoodData (GJRecord.GridRows[1].debitAmt) && (GJRecord.GridRows[1].debitAmt != "0"))) if (nTotalDebit > nTotalCredit) // focus set to the credit field { if (Functions.GoodData(GJRecord.GridRows[x].creditAmt) && (GJRecord.GridRows[x].creditAmt != "0")) { GeneralJournal.repo.DetailsContainer.SetText(GJRecord.GridRows[x].creditAmt); nTotalCredit += Convert.ToDouble(GJRecord.GridRows[x].creditAmt); GeneralJournal.repo.DetailsContainer.MoveRight(); } else { GeneralJournal.repo.DetailsContainer.PressKeys("{Delete}"); GeneralJournal.repo.DetailsContainer.PressKeys("{LShiftKey down}{Tab}{LShiftKey up}"); GeneralJournal.repo.DetailsContainer.SetText(GJRecord.GridRows[x].debitAmt); nTotalDebit += Convert.ToDouble(GJRecord.GridRows[x].debitAmt); GeneralJournal.repo.DetailsContainer.MoveRight(); } } else // focus set to the debit field { if (Functions.GoodData(GJRecord.GridRows[x].debitAmt) && (GJRecord.GridRows[x].debitAmt != "0")) { GeneralJournal.repo.DetailsContainer.SetText(GJRecord.GridRows[x].debitAmt); nTotalDebit += Convert.ToDouble(GJRecord.GridRows[x].debitAmt); GeneralJournal.repo.DetailsContainer.MoveRight(); } else { GeneralJournal.repo.DetailsContainer.PressKeys("{Delete}"); GeneralJournal.repo.DetailsContainer.MoveRight(); GeneralJournal.repo.DetailsContainer.SetText(GJRecord.GridRows[x].creditAmt); nTotalCredit += Convert.ToDouble(GJRecord.GridRows[x].creditAmt); GeneralJournal.repo.DetailsContainer.MoveRight(); } } } // enter line comment if (Functions.GoodData(GJRecord.GridRows[x].lineComment)) { GeneralJournal.repo.DetailsContainer.SetText(GJRecord.GridRows[x].lineComment); } // enter project allocation for the line if (GeneralJournal.repo.AllocateToProject.Enabled && GJRecord.GridRows[x].Projects.Count > 0) { if (Functions.GoodData(GJRecord.GridRows[x].Projects)) { // get global settings if haven't alreayd if (!bCheckGlobalProject) { Settings._SA_Get_AllProjectSettings(); GeneralJournal.repo.Self.Activate(); bCheckGlobalProject = true; } GeneralJournal.repo.AllocateToProject.Click(); if (ProjectAllocationDialog.repo.SelfInfo.Exists()) { ProjectAllocationDialog._SA_EnterProjectAllocationDetails(GJRecord.GridRows[x].Projects); } } } // move to the next line GeneralJournal.repo.DetailsContainer.MoveRight(); } } // if (bRecur && !bSave) // { // Ranorex.Report.Info("Storing the recurring entry " + GJRecord.recurrName + ", " + GJRecord.recurrFrequency + ""); // GeneralJournal.repo.Self.PressKeys("<Ctrl+t>"); // StoreRecurringDialog.repo._SA_DoStoreRecurring (GJRecord.recurrName, GJRecord.recurrFrequency); // GeneralJournal.repo.ToolBar.Undo.Click(); // } if (bSave) { GeneralJournal.repo.Post.Click(); if (Variables.bUseDataFiles) // handle possible messages { while (!GeneralJournal.repo.Self.Enabled) { // dw SimplyMessage.repo._SA_HandleMessage(SimplyMessage.YES_LOC, SimplyMessage._MSG_THISTRANSACTIONUSESLINKEDTAXACCOUNTS_LOC, false, true); // dw SimplyMessage.repo._SA_HandleMessage(SimplyMessage.YES_LOC, SimplyMessage._MSG_THISENTRYUSESLINKEDCONTROLACCOUNTS_LOC, false, true); // dw SimplyMessage.repo._SA_HandleMessage(SimplyMessage.YES_LOC, SimplyMessage._MSG_THERECURRINGTRANSACTIONHASBEENCHANGED_LOC, false, true); } } // dw SimplyMessage.repo._SA_HandleMessage(SimplyMessage.NO_LOC, SimplyMessage._MSG_DOYOUWANTTOSAVENEWEXCHANGERATE_LOC, false, true); } }
public static void _SA_Invoke() { GeneralJournal._SA_Invoke(true); }
public static GENERAL_JOURNAL _SA_Read(string sIDToRead) // method will read all fields and store the data in a RECEIPT record { GENERAL_JOURNAL GJE = new GENERAL_JOURNAL(); if (Functions.GoodData(sIDToRead)) { GJE.source = sIDToRead; if (GeneralJournal.repo.Source.TextValue != GJE.source) { GeneralJournal._SA_Open(GJE); } } GJE.journalDate = GeneralJournal.repo.JournalDate.TextValue; GJE.comment = GeneralJournal.repo.Comment.TextValue; if (GeneralJournal.repo.SelfInfo.Exists()) { GJE.currCode = GeneralJournal.repo.CurrencyCode.SelectedItem.Text; } GJE.GridRows.Clear(); List <List <string> > lsContents = GeneralJournal.repo.DetailsContainer.GetContents(); //if (Functions.GoodData (lsContents)) NC - no longer need to check since the lsContents.Count sort of does the same thing //{ for (int x = 0; x < lsContents.Count; x++) { // check for blank line if (lsContents[x][0] != "") { GJ_ROW GR = new GJ_ROW(); GR.Account.acctNumber = lsContents[x][0]; if (lsContents[x][1].Trim() == "--") { GR.debitAmt = "0"; } else { GR.debitAmt = lsContents[x][1]; } if (lsContents[x][2].Trim() == "--") { GR.creditAmt = "0"; } else { GR.creditAmt = lsContents[x][2]; } GR.lineComment = lsContents[x][3]; GJE.GridRows.Add(GR); } } //} // Get project allocations // Move to first cell GeneralJournal.repo.DetailsContainer.ClickFirstCell(); if (Functions.GoodData(GJE.GridRows)) { for (int x = 0; x < GJE.GridRows.Count; x++) { if (GeneralJournal.repo.AllocateToProject.Enabled) { GJE.GridRows[x].Projects.Clear(); GeneralJournal.repo.AllocateToProject.Click(); if (ProjectAllocationDialog.repo.SelfInfo.Exists()) { //List<List<string>> lsContents = ProjectAllocationDialog.repo.DataGrid.GetContents(); //if (Functions.GoodData (lsContents)) //{ // for (int y = 0; y < lsContents.Count; y++) // { // if (Functions.GetField.Trim(' '), 1)) == "") // { // break; // } // else // { // PROJECT_ALLOCATION PA = new PROJECT_ALLOCATION(); // PA.Project.name = Functions.Functions.GetField (lsContents[y], " ", 1); // if(Functions.GetField.Trim(' '), 2)) == "--") // { // PA.Amount = "0"; // } // else // { // PA.Amount = Functions.Functions.GetField (lsContents[y], " ", 2); // } // if(Functions.GetField.Trim(' '), 3)) == "--") // { // PA.Percent = "0"; // } // else // { // PA.Percent = Functions.Functions.GetField (lsContents[y], " ", 3); // } // GJE.GridRows[x].Projects.Add(PA); // } // } GJE.GridRows[x].Projects = ProjectAllocationDialog._SA_GetProjectAllocationDetails(); } ProjectAllocationDialog.repo.Cancel.Click(); } GeneralJournal.repo.DetailsContainer.PressKeys("<Down>"); } } return(GJE); }