// Recurring entries not done yet // public static void _SA_RecallPayment_Other(PAYMENT_OTHER PaymentRecord) // recall recurring entry. other payment only // { // // recall and post a recurring entry // // if (Functions.GoodData(PaymentRecord.recurringName)) // { // Trace.WriteLine("Recalling the recurring entry " + PaymentRecord.recurringName + ""); // // if (!PaymentsJournal.repo.SelfInfo.Exists()) // { // PaymentsJournal._SA_Invoke(); // } // // PaymentsJournal.repo.Transaction.Select("Make Other Payment"); // // PaymentsJournal.repo.Self.PressKeys("{Ctrl+r}"); // invoke Recall Recurring dialog // RecallRecurringDialog._SA_SelectEntryToRecall(PaymentRecord.recurringName); // PaymentsJournal._SA_CreatePayment_Other(PaymentRecord); // } // else // log the error // { // Functions.Verify(false, true, "recurring name found"); // } // } public static void _SA_Open(PAYMENT Payment) // for common code amongst all the payment types { if (!PaymentsJournal.repo.SelfInfo.Exists()) { PaymentsJournal._SA_Invoke(); } if (Payment.GetType() == typeof(PAYMENT_REMIT)) { PaymentsJournal.repo.Transaction.Select("Pay Remittance"); } else if (Payment.GetType() == typeof(PAYMENT_PURCH)) { PaymentsJournal.repo.Transaction.Select("Pay Purchase Invoices"); } else if (Payment.GetType() == typeof(PAYMENT_OTHER)) { PaymentsJournal.repo.Transaction.Select("Make Other Payment"); } else if (Payment.GetType() == typeof(PAYMENT_CREDIT_CARD)) { Ranorex.Report.Info("Credit card payment can not be looked up"); return; } else { Ranorex.Report.Info("Invalid payment type"); return; } PaymentsJournal.repo.SearchDialog.Click(); DialogJournalSearch._SA_SelectLookupDateRange(); DialogJournalSearch.repo.Name.Select(Payment.Vendor.name); if (Functions.GoodData(Payment.chequeNumber)) // enter cheque number { DialogJournalSearch.repo.Source.TextValue = Payment.chequeNumber; } else if (Functions.GoodData(Payment.directDepositNo)) // enter source number { DialogJournalSearch.repo.Source.TextValue = Payment.directDepositNo; } else // enter source number { DialogJournalSearch.repo.Source.TextValue = Payment.source; } DialogJournalSearch.repo.OK.Click(); }
public static void _SA_CreatePayment_CreditCard(PAYMENT_CREDIT_CARD PaymentRecord, bool bSave) { string source; // to be used in print statements if (Functions.GoodData(PaymentRecord.chequeNumber)) // paid by cheque { source = PaymentRecord.chequeNumber; } else { source = PaymentRecord.source; } Ranorex.Report.Info(String.Format("Creating credit card payment {0} ", source)); if (!PaymentsJournal.repo.SelfInfo.Exists()) { PaymentsJournal._SA_Invoke(); } PaymentsJournal.repo.Transaction.Select("Pay Credit Card Bill"); Common_HeaderSetup(PaymentRecord, false); // can't adjust credit card payments if (Functions.GoodData(PaymentRecord.additionalFees)) { PaymentsJournal.repo.AdditionalFeesAndInterest.TextValue = PaymentRecord.additionalFees; } if (Functions.GoodData(PaymentRecord.amount)) { PaymentsJournal.repo.PaymentAmount.TextValue = PaymentRecord.amount; // PaymentsJournal.repo.PaymentAmount.PressKeys("{Tab}"); } if (bSave) { PaymentsJournal.repo.Post.Click(); } }
public static void _SA_CreatePayment(PAYMENT_PURCH PaymentRecord, bool bSave, bool bEdit) { if (!PaymentsJournal.repo.SelfInfo.Exists()) { PaymentsJournal._SA_Invoke(); } // after invoke because checks for cheque number on screan if (!Variables.bUseDataFiles) { PaymentsJournal._SA_MatchDefaultsPayment(PaymentRecord); } string source; // to be used in print statements if (Functions.GoodData(PaymentRecord.chequeNumber)) // paid by cheque { source = PaymentRecord.chequeNumber; } else { source = PaymentRecord.source; } if (!(bEdit)) { Ranorex.Report.Info(String.Format("Creating payment {0} ", source)); } else { Ranorex.Report.Info(String.Format("Adjusting payment {0} ", source)); } PaymentsJournal.repo.Transaction.Select("Pay Purchase Invoices"); // Ensure prepayments button is depressed if (!PaymentsJournal.repo.PrepaymentAmountInfo.Exists()) { PaymentsJournal.repo.EnterPrepayments.Click(); } Common_HeaderSetup(PaymentRecord, bEdit); if (PaymentsJournal.repo.TransContainer.Enabled) // need to check if the container is enabled before entering data into it { PaymentsJournal.repo.TransContainer.ClickFirstCell(); List <List <string> > lsContents = PaymentsJournal.repo.TransContainer.GetContents(); int iPrePayLine = 100; // intialize to big number bool bPrePaysInList = false; for (int x = 0; x < lsContents.Count; x++) // search for prepayment line { if (lsContents[x][1].Trim().ToUpper() == "PREPAYMENTS") { bPrePaysInList = true; iPrePayLine = x; break; } } int iCurrentLine = 0; for (int y = 0; y < PaymentRecord.GridRows.Count; y++) { if (Functions.GoodData(PaymentRecord.GridRows[y].Invoice.transNumber)) { bool bFound = false; int x; // needs to be referenced outside the loop so declares here for (x = 0; x < lsContents.Count; x++) { string sFindString; if (Functions.GoodData(PaymentRecord.GridRows[y].Invoice.transNumber)) { sFindString = PaymentRecord.GridRows[y].Invoice.transNumber; } else { sFindString = PaymentRecord.GridRows[y].PrePayment.PrePayRefNumber; if (!bPrePaysInList) { break; // error, we don't see any prepayments } } if (lsContents[x][1] == sFindString) { if (Functions.GoodData(PaymentRecord.GridRows[y].PrePayment.PrePayRefNumber)) // if prepayment, be sure we found the prepayment and not an invoice above it { if (x > iPrePayLine) { bFound = true; break; } //else try again, you found an invoice with same number } else { bFound = true; break; } } } if (bFound) { if (iCurrentLine == 0) // see if first time in container { PaymentsJournal.repo.TransContainer.MoveRight(); // get to the discount field PaymentsJournal.repo.TransContainer.PressKeys("{Delete}"); // clear in case not line working with if (x > 0) { PaymentsJournal.repo.TransContainer.PressKeys("{Down " + Convert.ToString(x) + "}"); // get to the correct row } } else // else decide if we go up or down based on current location { if (x > iCurrentLine) { PaymentsJournal.repo.TransContainer.PressKeys("{Down " + Convert.ToString(x) + "}"); // get to the correct row } if (x < iCurrentLine) { PaymentsJournal.repo.TransContainer.PressKeys("{Up " + Convert.ToString(iCurrentLine - x) + "}"); // get to the correct row } } iCurrentLine = x; if (Functions.GoodData(PaymentRecord.GridRows[y].discountTaken)) { PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[y].discountTaken); } PaymentsJournal.repo.TransContainer.MoveRight(); // get to the amount field if (Functions.GoodData(PaymentRecord.GridRows[y].Amount)) { PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[y].Amount); } if (x < (iPrePayLine - 2)) { PaymentsJournal.repo.TransContainer.MoveRight(); } iCurrentLine++; } else { Functions.Verify(false, true, "Able to find Invoice/prepayment double in payment Grid"); } } } } if ((Functions.GoodData(PaymentRecord.PrePayRefNumber)) || (Functions.GoodData(PaymentRecord.PrePayAmount))) { if (PaymentsJournal.repo.PrepaymentAmountInfo.Exists()) { PaymentsJournal.repo.EnterPrepayments.Click(); } if (Functions.GoodData(PaymentRecord.PrePayRefNumber)) { PaymentsJournal.repo.PrepaymentReferenceNo.TextValue = PaymentRecord.PrePayRefNumber; } if (Functions.GoodData(PaymentRecord.PrePayAmount)) { PaymentsJournal.repo.PrepaymentAmount.TextValue = PaymentRecord.PrePayAmount; PaymentsJournal.repo.PrepaymentAmount.PressKeys("{Tab}"); } } if (PaymentsJournal.repo.ExchangeRate.Enabled) { if (Functions.GoodData(PaymentRecord.exchangeRate)) { PaymentsJournal.repo.ExchangeRate.TextValue = PaymentRecord.exchangeRate; } } if (bSave) { PaymentsJournal.repo.Post.Click(); } }
public static void _SA_CreatePayment_Remit(PAYMENT_REMIT PaymentRecord, bool bSave, bool bEdit) { if (!PaymentsJournal.repo.SelfInfo.Exists()) { PaymentsJournal._SA_Invoke(); } if (!(bEdit)) { Ranorex.Report.Info(String.Format("Creating Remittance {0} ", PaymentRecord.chequeNumber)); } else { Ranorex.Report.Info(String.Format("Adjusting Remittance {0} ", PaymentRecord.chequeNumber)); } PaymentsJournal.repo.Transaction.Select("Pay Remittance"); PaymentsJournal._SA_MatchDefaultsPayment_Remit(PaymentRecord); Common_HeaderSetup(PaymentRecord, bEdit); if (Functions.GoodData(PaymentRecord.reference)) { PaymentsJournal.repo.Reference.TextValue = PaymentRecord.reference; } if (Functions.GoodData(PaymentRecord.periodEnding) && PaymentsJournal.repo.EndDate.Enabled) { PaymentsJournal.repo.EndDate.TextValue = PaymentRecord.periodEnding; // PaymentsJournal.repo.EndDate.TypeKeys("<Tab>"); } if ((Functions.GoodData(PaymentRecord.remitFrequency) && PaymentsJournal.repo.FrequencyButton.Enabled)) { PaymentsJournal.repo.FrequencyButton.Click(); SelectRemittingFrequency.repo.Frequency.SelectListItem(PaymentRecord.remitFrequency); SelectRemittingFrequency.repo.Select.Click(); } if (PaymentsJournal.repo.TransContainer.Enabled) { // get the contents in the container List <List <string> > lsContents = PaymentsJournal.repo.TransContainer.GetContents(); //PaymentsJournal.Instance.TransContainer.ClickFirstCell(); //PaymentsJournal.Instance.TransContainer.MoveRight(); if (PaymentRecord.GridRows.Count != 0) { for (int x = 0; x < lsContents.Count; x++) { PaymentsJournal.repo.TransContainer.ClickFirstCell(); PaymentsJournal.repo.TransContainer.MoveRight(); PaymentsJournal.repo.TransContainer.PressKeys("{Down " + x + "}"); for (int y = 0; y < PaymentRecord.GridRows.Count; y++) { if (Functions.GoodData(PaymentRecord.GridRows[y].remitName)) { if (lsContents[x][0] == PaymentRecord.GridRows[y].remitName) // enter data for the matching payroll liability { if (Functions.GoodData(PaymentRecord.GridRows[y].adjustAccount)) { PaymentsJournal.repo.TransContainer.PressKeys(PaymentRecord.GridRows[y].adjustAccount); } PaymentsJournal.repo.TransContainer.MoveRight(); if (Functions.GoodData(PaymentRecord.GridRows[y].adjustment)) { PaymentsJournal.repo.TransContainer.PressKeys(PaymentRecord.GridRows[y].adjustment); } PaymentsJournal.repo.TransContainer.MoveRight(); PaymentsJournal.repo.TransContainer.PressKeys(PaymentRecord.GridRows[y].amount); PaymentsJournal.repo.TransContainer.MoveRight(); break; // go to the outter loop } } } } } } if (bSave) { PaymentsJournal.repo.Post.Click(); } }
public static void _SA_CreatePayment_Other(PAYMENT_OTHER PaymentRecord, bool bSave, bool bEdit, bool bRecur) { bool bCheckGlobalProject = false; if (!PaymentsJournal.repo.SelfInfo.Exists()) { PaymentsJournal._SA_Invoke(); } string source; // to be used in print statements if (Functions.GoodData(PaymentRecord.chequeNumber)) // paid by cheque { source = PaymentRecord.chequeNumber; } else { source = PaymentRecord.source; } if (!bEdit) { if (!bRecur) { Ranorex.Report.Info(String.Format("Creating Other Payment {0} ", source)); } //else is recurring entry and the message will be printed later. } else { Ranorex.Report.Info(String.Format("Adjusting Other Payment {0} ", source)); } PaymentsJournal.repo.Transaction.Select("Make Other Payment"); Common_HeaderSetup(PaymentRecord, bEdit); if (Functions.GoodData(PaymentRecord.reference)) { PaymentsJournal.repo.Reference.TextValue = PaymentRecord.reference; } PaymentsJournal.repo.TransContainer.ClickFirstCell(); PaymentsJournal.repo.TransContainer.PressKeys("{Tab}"); // go to the Description field first PaymentsJournal.repo.TransContainer.PressKeys("{LShiftKey down}{Tab}{LShiftKey up}"); // then come back to the Account field to activate the cell for (int x = 0; x < PaymentRecord.GridRows.Count; x++) { if (Functions.GoodData(PaymentRecord.GridRows[x])) { if (Functions.GoodData(PaymentRecord.GridRows[x].account.acctNumber)) { PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[x].account.acctNumber); PaymentsJournal.repo.TransContainer.MoveRight(); // tab to the Description field } else // pick a random account { PaymentsJournal.repo.TransContainer.PressKeys("<Enter>"); // press enter to bring up the select GL account window PaymentRecord.GridRows[x].account.acctNumber = SelectAccountDialog.repo.AccountName.RandPick(true); // the focus is set to descirption field automatically so no need to tab again } if (Functions.GoodData(PaymentRecord.GridRows[x].description)) { PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[x].description); } PaymentsJournal.repo.TransContainer.MoveRight(); PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[x].amount); PaymentsJournal.repo.TransContainer.MoveRight(); if (Functions.GoodData(PaymentRecord.GridRows[x].taxCode.code)) { PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[x].taxCode.code); } if (PaymentRecord.GridRows[x].Projects.Count != 0) // enter project allocation if provided { // get global settings if haven't alreayd if (!bCheckGlobalProject) { Settings._SA_Get_AllProjectSettings(); // PaymentsJournal.repo.Window.SetActive(); bCheckGlobalProject = true; } PaymentsJournal.repo.AllocateToProjects.Click(); if (ProjectAllocationDialog.repo.SelfInfo.Exists()) { ProjectAllocationDialog._SA_EnterProjectAllocationDetails(PaymentRecord.GridRows[x].Projects); } } PaymentsJournal.repo.TransContainer.PressKeys("{Tab}"); // move to the next row } } // Recurring entry not ready // if (bRecur && !bSave) // store recurring // { // Trace.WriteLine("Storing the recurring entry " + PaymentRecord.recurringName + ", " + PaymentRecord.recurringFrequency + ""); // PaymentsJournal.repo.PressKeys("{Ctrl+t}"); // StoreRecurringDialog.Instance._SA_DoStoreRecurring(PaymentRecord.recurringName, PaymentRecord.recurringFrequency); // // discard the transaction // PaymentsJournal.ClickUndoChanges(); // } if (bSave) { PaymentsJournal.repo.Post.Click(); } }