public EXCEPTION Skip(EXCEPTION exception, string prepCode = null) { var fieldsToUpdate = new List <string> { "ERR_RESPONSE", "OUT", "PREPCODE", "CLEARED_DATE" }; exception.ERR_RESPONSE = "S"; exception.OUT = "T"; if (!string.IsNullOrEmpty(prepCode)) { exception.PREPCODE = prepCode; } exception.CLEARED_DATE = DateTime.Now; var mgr = new ExceptionsManager(); mgr.UpdateException(exception, fieldsToUpdate); return(exception); }
/// <summary> /// Opens the Notes screen for user input /// Need to determine ReturnAction and ReturnController /// </summary> /// <param name="exception"></param> /// <param name="ButtonType"></param> /// <returns></returns> public NotesViewModel Open(EXCEPTION exception, string ButtonType) { //Runs on all Buttons except DON'T ACCRUAL string Val1 = exception.ACT, Val2 = exception.EX_ID, Val3 = exception.PDOCNO; ExceptionsController ec = new ExceptionsController(); NotesViewModel nvm = new NotesViewModel(); switch (exception.ERR_CODE) { case "U047": bool p_tin_as_key = Tin_As_Key; // r_tin_as_key; if (Tin_As_Key == true) { nvm.Tin = Tin; } else { nvm.VendNo = VendNo; } break; case "P040": nvm.Act = exception.ACT; break; } //Need to determine ReturnAction and ReturnController values ec.GetNotesView(exception.ERR_CODE, ButtonType, Val1, Val2, Val3, "ACTIONRESULT", "EXCEPTION"); ec.FinishNotesVM(nvm); return(nvm); }
/// <summary> /// Handles A237 exceptions /// If notes.returnVal2 does not contain "DUPLICATE", it adds a notification and transhist record /// Update PegasysRR record to "REJECT" /// </summary> private void ExceptionA237(EXCEPTION exception, AddressValuesModel Search, AddressValuesModel Address) { var rtnRR = GetPegasysRRByKey(exception.RR_ID); UpdatePegasysRRToReject(rtnRR); var Ex_Date = exception.EX_DATE; ReportForm = ""; //Generating EA Rejection notification var S_Note = "No"; Report_ID = "F05"; ReportForm = "PRRReject"; if (!notes.returnVal2.Contains("DUPLICATE")) { if (!CheckNotificationExists()) { InsertNotification(); } S_Note = "Yes"; var strCuffMemo = "Reject - " + "\r\n" + "Send Notification " + S_Note + ": " + Report_ID + " - " + ReportForm + "\r" + NewNote; InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode); } }
/// <summary> /// Used for 009, 029, and 037 exceptions handled here /// Need to handle setting exception.FAXNOTES value /// Uses Ac_Id field, but this field doesn't exist in the exceptions table anymore /// Need to test the code for adding the Notifications /// </summary> /// <param name="exception"></param> private void Exception_029_009_037(EXCEPTION exception, AddressValuesModel Search, AddressValuesModel Address) { if (notes.returnVal2 == "Other") { exception.FAXNOTES = notes.returnVal7; } else { exception.FAXNOTES = notes.returnVal2; } //Does not exist in Exceptions //Ac_Id = exception.AC_ID var Ex_Date = exception.EX_DATE; var S_Note = "No"; Report_ID = "F08"; ReportForm = "eaReject"; Status = "Pending"; if (!notes.returnVal2.Contains("DUPLICATE")) { if (!CheckNotificationExists()) { InsertNotification(); } S_Note = "Yes"; var strCuffMemo = "Reject - " + "\r\n" + "Send Notification " + S_Note + ": " + Report_ID + " - " + ReportForm + "\r" + NewNote; InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode); } }
public bool Initialize(EXCEPTION exc, string prepCode, string pDocNo) { SetVariables(exc, pDocNo, prepCode, "POMATCH"); ButtonPushed = "NONE"; return(true); }
public string Initialize(EXCEPTION exc, string prepCode) { theMsg = ""; SetVariables(exc, prepCode, "ROUTE"); if (!Check_230_Exceptions()) { return theMsg; } return ""; }
public bool Initialize(EXCEPTION exc, string prepCode) { Caption = "NEXTDAY"; exception = exc; PrepCode = prepCode; return(true); }
public bool Initialize(EXCEPTION exc, string Pdocno, string prepCode, List <X200Model> X200) { SetVariables(exc, Pdocno, prepCode, "POMATCH"); PDocNo = X200[0].PDOCNO; ButtonPushed = "NONE"; return(true); }
public bool Initialize(EXCEPTION exc, string Pdocno, string newPDocNo, string prepCode) { SetVariables(exc, Pdocno, prepCode, "POMATCH"); PDocNo = newPDocNo; ButtonPushed = "NONE"; return(true); }
/// <summary> /// Handles P001, P002, P004, and P024 exceptions /// Sets the ReturnValZ, but not sure what it does with that...maybe something on the screen afterwards? /// Adds a notification and transhist record /// Sets PegasysInvoice record to "REJECT" /// </summary> /// <param name="exception"></param> private void ExceptionP002(EXCEPTION exception, AddressValuesModel Search, AddressValuesModel Address) { PDocNo = ""; var Ex_Date = exception.EX_DATE; var S_Note = "No"; Status = "Pending"; if (exception.ERR_CODE == "P024") { //Not sure what happens with this...Need to handle notes.returnValZ = "INV"; } //Generate rejection notification //WAIT "Generating Invoice Rejection Notification..." WINDOW NOWAIT var pdocno = ""; var FaxNotes = notes.returnVal7; if (Pegasys) { Report_ID = "P08"; ReportForm = "PegInvReject"; pdocno = exception.PO_ID; } else { Report_ID = "L08"; ReportForm = "Inv Reject"; pdocno = ""; } if (!notes.returnVal2.Contains("DUPLICATE")) { if (!CheckNotificationExists()) { InsertNotification(); } S_Note = "Yes"; NewNote = "Reject Invoice " + "\r\n" + "Send Notification " + S_Note + " " + ReportForm + "\r\n" + NewNote; var strCuffMemo = "Reject - " + "\r\n" + "Send Notification " + S_Note + ": " + Report_ID + " - " + ReportForm + "\r" + NewNote; InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode); var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID); if (rtnInv != null) { UpdatePegasysInvoiceToReject(rtnInv); } } }
/// <summary> /// Handles M237 exceptions /// </summary> private void ExceptionM237(EXCEPTION exception) { NewNote = "Reject AE - " + NewNote; var rtnAE = GetPegasysAEByKey(exception.AE_ID); if (rtnAE != null) { UpdatePegasysAEToReject(rtnAE); } }
/// <summary> /// Button Click Code /// Does not appear to have any missing code or issues at this time...Still untested /// </summary> /// <param name="exception"></param> public string Initialize(EXCEPTION exc, string prepCode) { theMsg = ""; SetVariables(exc, prepCode, DocStatus.Processed); if (!Check_230_Exceptions()) { return(theMsg); } return(theMsg); }
/// <summary> /// Correct or Correct DE button /// </summary> /// <param name="exc"></param> /// <param name="InvQuery"></param> /// <param name="POFrmQuery"></param> /// <param name="Search"></param> /// <param name="pdocno"></param> /// <param name="prepCode"></param> /// <returns></returns> public bool Initialize(EXCEPTION exc, string pdocno, string prepCode) { SetVariables(exc, prepCode, "CORRECTDE"); if (exception.ERR_CODE.Right(3) == "230") { return(false); } return(true); }
public string Initialize(EXCEPTION exc, string Pdocno, string prepCode) { SetVariables(exc, Pdocno, prepCode, "REPROCESS"); if (!Check_P_Exceptions()) { return(theMsg); } return(""); }
/* * Need to handle Adding Exceptions in P041 exception */ public string Initialize(EXCEPTION exc, string Pdocno, string prepCode) { theMsg = ""; SetVariables(exc, Pdocno, prepCode, "REJECT"); if (!Check_P_Exceptions()) { return(theMsg); } if (!Check_230_Exceptions()) { return(theMsg); } return(""); }
/// <summary> /// Skip Button Checks P and 230 exceptions /// It opens the notes screen /// It checks which button is pushed /// Adds a Transhist record /// Updates the Exception record /// Repulled the exception before, but it updates the existing one, so it's not necessary /// </summary> public string Initialize(EXCEPTION exc, string pdocno, string ex_id, string prepCode) { //Need to see if variables need to be set after the exceptions values are updated SetVariables(exc, prepCode, "SKIP"); if (!Check_P_Exceptions()) { return(theMsg); } if (!Check_230_Exceptions()) { return(theMsg); } return(""); }
public bool Initialize(EXCEPTION exc, string Pdocno, string prepCode) { SetVariables(exc, Pdocno, prepCode, "TRANSHIST"); var tc = new TransHistController(); if (String.IsNullOrWhiteSpace(exception.ACT)) { tc.Index(Pdocno, "PDOCNO", "", "", "", exception.ACT, Pdocno, ""); } else { tc.Index(exception.ACT, "ACT", "", "", "", exception.ACT, Pdocno, ""); } return(true); }
public void Add(EXCEPTION exception) { int n = this.exceptions.Length; int i = this.length++; if (i == n) { EXCEPTION[] new_exceptions = new EXCEPTION[n + 8]; for (int j = 0; j < n; j++) { new_exceptions[j] = exceptions[j]; } this.exceptions = new_exceptions; } this.exceptions[i] = exception; }
/// <summary> /// Handles 046 exceptions /// Sets the S_Note value, but not sure what it does with it. /// It may be used in the screens later, but not sure /// Generates an EA Rejection notification if a the notes.returnVal2 in the notes screen does not contain "DUPLICATE" /// </summary> /// <param name="exception"></param> private void Exception046(EXCEPTION exception, AddressValuesModel Search, AddressValuesModel Address) { var Ex_Date = exception.EX_DATE; ReportForm = ""; //Generating EA Rejection notification Report_ID = "F08"; ReportForm = "EA Rejection"; Status = "Pending"; if (!notes.returnVal2.Contains("DUPLICATE")) { if (!CheckNotificationExists()) { InsertNotification(); } } }
public bool Initialize(EXCEPTION exception, string pdocno, string prepCode) { ButtonPushed = "NONE"; SetVariables(exception, pdocno, prepCode, "NONE"); if (!r_Pegasys && exception.ERR_CODE.Left(1) == "C") { //Need to figure out how to run this functionality, or if it is needed //objapp.m_append("validationchange", "exceptions", 1, false, Act, Mdl, exception.PO_ID); } else { bool bResult = ValidateGrid(); if (bResult == false) { return(false); } } return(true); }
/// <summary> /// Handles A224 exceptions /// If notes.returnVal2 does not contain "DUPLICATE", it adds a notification and transhist record /// Update PegasysRR record to "REJECT" /// Update Exceptions Properties /// </summary> private void ExceptionA224(EXCEPTION exception, AddressValuesModel Search, AddressValuesModel Address, PEGASYSRR_FRM RRFrmQuery) { var rtnRR = GetPegasysRRByKey(exception.RR_ID); UpdatePegasysRRToReject(rtnRR); var Ex_Date = exception.EX_DATE; ReportForm = ""; var S_Note = "No"; Report_ID = "F05"; ReportForm = "PRRReject"; if (!notes.returnVal2.Contains("DUPLICATE")) { if (!CheckNotificationExists()) { InsertNotification(); } S_Note = "Yes"; var strCuffMemo = "Reject - " + "\r\n" + "Send Notification " + S_Note + ": " + Report_ID + " - " + ReportForm + "\r" + NewNote; InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode); } var properties = new List <string> { "VENDNAME", "RRAMOUNT" }; exception.VENDNAME = RRFrmQuery.VENDNAME; exception.RRAMOUNT = RRFrmQuery.AMOUNT; UpdateException(exception, properties); }
/// <summary> /// Handles P140 exceptions /// If notes.returnVal2 does not contain "DUPLICATE", it adds a notification and transhist record /// Updates PegasysInvoice to reject /// </summary> /// <param name="exception"></param> private void ExceptionP140(EXCEPTION exception, AddressValuesModel Search, AddressValuesModel Address) { var PDocNo = ""; var Ex_Date = exception.EX_DATE; var S_Note = "No"; Status = "Pending"; //WAIT "Generating Invoice Rejection Notification..." WINDOW NOWAIT if (!notes.returnVal2.ReplaceNull("").Contains("DUPLICATE")) { var FaxNotes = notes.returnVal7; exception.PO_ID = String.IsNullOrWhiteSpace(exception.PDOCNO) ? exception.PO_ID : exception.PDOCNO; Report_ID = "P08"; ReportForm = "PegInvReject"; PDocNo = exception.PO_ID; if (!CheckNotificationExists()) { InsertNotification(); } S_Note = "Yes"; NewNote = "Reject Invoice " + "\r\n" + "Send Notification " + S_Note + " " + ReportForm + "\r\n" + NewNote; var strCuffMemo = "Reject RR - " + "\r\n" + "Send Notification " + S_Note + ": " + Report_ID + " - " + ReportForm + "\r" + NewNote; InsertTranshist(exception, "X", "", "Reject Notification", PrepCode); } var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID); if (rtnInv != null) { UpdatePegasysInvoiceToReject(rtnInv); } }
int EnterException(EXCEPTION id) { uint mode; int DATA_S; uint vector; switch (id) { case EXCEPTION.RESET: mode = (uint)OPERATING_MODE.SVC; DATA_S = 0; vector = VECTOR_RESET; break; case EXCEPTION.UNDEFINED_INSTRUCTION: mode = (uint)OPERATING_MODE.UND; DATA_S = Save(); vector = VECTOR_UDEF; break; case EXCEPTION.SOFTWARE_INTERRUPT: mode = (uint)OPERATING_MODE.SVC; DATA_S = Save(); vector = VECTOR_SWI; break; case EXCEPTION.NORMAL_INTERRUPT: mode = (uint)OPERATING_MODE.IRQ; DATA_S = Save(); vector = VECTOR_IRQ; break; default: throw new ArgumentException(); } F = (F & ~MODE_BITS) | mode | FLAG_I; Branch(vector); return(DATA_S); }
public bool Initialize(EXCEPTION exc, string prepCode, string strACT) { SetVariables(exc, prepCode, "CHANGEACT"); var AskVal = "EMPTY"; //Used thisform.r_act before if (!String.IsNullOrWhiteSpace(exception.ACT)) { AskVal = exception.ACT; } //Update Exceptions Table. var fieldsToUpdate = new List <string> { "ACT" }; exception.ACT = strACT; UpdateException(exception, fieldsToUpdate); //Update the related Pegasys frm table and transhist if (exception.ERR_CODE == "P200") { TransHistManager transHistManager = new TransHistManager(); transHistManager.UpdateActByInvKeyId(exception.INV_KEY_ID, strACT); var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID); if (rtnInv != null) { fieldsToUpdate = new List <string> { "ACT" }; rtnInv.ACT = strACT; UpdatePegasysInvoice(rtnInv, fieldsToUpdate); } } else if (exception.ERR_CODE == "A200") { TransHistManager transHistManager = new TransHistManager(); transHistManager.UpdateActByRRId(exception.RR_ID, strACT); var rtnRR = GetPegasysRRByKey(exception.RR_ID); if (rtnRR != null) { fieldsToUpdate = new List <string> { "ACT" }; rtnRR.ACT = strACT; UpdatePegasysRR(rtnRR, fieldsToUpdate); } } else if (exception.ERR_CODE == "M200") { TransHistManager transHistManager = new TransHistManager(); transHistManager.UpdateActByAeId(exception.AE_ID, strACT); var rtnAE = GetPegasysAEByKey(exception.AE_ID); if (rtnAE != null) { fieldsToUpdate = new List <string> { "ACT" }; rtnAE.ACT = strACT; UpdatePegasysAE(rtnAE, fieldsToUpdate); } } //Insert a Transhist Record recording the change to Act number //Used thisform.r_act before var strCuffMemo = string.Format("ACT Number Changed from {0} to {1}.", exception.ACT, strACT); InsertTranshist(exception, "", strCuffMemo, "", prepCode); //Does not close out of the screen and enables the button //By returning true it should enable the button on the screen return(true); //THISFORM.cmdPoRequest1.ENABLED = true; }
public bool Initialize(EXCEPTION exc, string PrepCode, PEGASYSINVOICE InvQuery) { SetVariables(exception, PrepCode, "SHOWUSEDINVOICES"); return(true); }
public static extern void RaiseException(uint dwExceptionCode, EXCEPTION dwExceptionFlags, uint nNumberOfArguments, [In] IntPtr lpArguments);
/// <summary> /// The main job to add an exception (after setting some variables) /// </summary> /// <returns></returns> public bool AddException() { //Lookup the Exception Memo if empty (fox table now) //lookup the poamount if 0 and have po_id //lookup the rramount if 0 and have rr_id if (err_code == "U063" || err_code == "U065" || err_code == "U066") { // indicator for returning status to "Z" (or whatever) when exception is cleared. updstatus = "F"; } // Get pdocno from po_id if available. if (String.IsNullOrWhiteSpace(pdocnopo) && !String.IsNullOrWhiteSpace(po_id)) { pdocnopo = po_id; } //pull imagebatch, vendname and pdocnopo from invoice if inv_key_id if (inv_key_id != String.Empty) { var rtnInv = GetPegasysInvoiceByKey(inv_key_id); if (rtnInv != null) { if (String.IsNullOrWhiteSpace(pdocnopo)) { pdocnopo = rtnInv.PDOCNOPO; } if (String.IsNullOrWhiteSpace(imagebatch)) { imagebatch = rtnInv.IMAGEBATCH; } if (String.IsNullOrWhiteSpace(vendname)) { vendname = rtnInv.VENDNAME; } } } //end ! empty inv_key_id //remove & from pdocnopo if needed if (pdocnopo.IndexOf("&") > -1) { pdocnopo = pdocnopo.Substring(0, pdocnopo.IndexOf("&") + 1); } using (var contextVitap = new OracleVitapContext()) { contextVitap.Configuration.AutoDetectChangesEnabled = true; using (var contextPeg = new PegasysEntities.OraclePegasysContext()) { //add fund, orgcode and BA information to the exception record if (String.IsNullOrEmpty(orgcode) && !String.IsNullOrEmpty(pdocnopo)) { bool inKeys = false; // Are values stored in keys? // Start with PEGASYSPOACCT_FRM var poAcctRows = contextVitap.PEGASYSPOACCT_FRM.Where(x => x.PO_ID.Contains(pdocnopo)) .Select(x => new { Fund = x.FUND, OrgCode = x.ORGCODE, Ba = x.BA_PROG, Lnum = x.LNUM }).OrderBy(x => x.Lnum).ToList(); // Check MF_IO_HDAL with pdocnopo. if (poAcctRows == null || poAcctRows.Count() == 0) { string pdocLookup = "&1423&1609&" + pdocnopo.Left(2) + '&' + pdocnopo + '&'; poAcctRows = contextPeg.MF_IO_HDAL.Where(x => x.PARN_OF_LINE_ID.Contains(pdocLookup)) .Select(x => new { Fund = x.FUND_ID, OrgCode = x.ORGN_ID, Ba = x.PROG_ID, Lnum = x.LNUM }).OrderBy(x => x.Lnum).ToList(); inKeys = poAcctRows != null; } // Check MF_IO_HDAL with act. if ((poAcctRows == null || poAcctRows.Count() == 0) && !String.IsNullOrEmpty(act)) { var actTrim = act.Trim(); var actLookup = contextPeg.MF_IO.Where(y => y.DTYP_ID != "&1609&4B" && y.XSYS_DOC_NUM == actTrim && y.DOC_STUS != "CANCELLED").FirstOrDefault().UIDY; if (!string.IsNullOrEmpty(actLookup)) { poAcctRows = contextPeg.MF_IO_HDAL.Where(x => x.PARN_OF_LINE_ID.Contains(actLookup)) .Select(x => new { Fund = x.FUND_ID, OrgCode = x.ORGN_ID, Ba = x.PROG_ID, Lnum = x.LNUM }).OrderBy(x => x.Lnum).ToList(); inKeys = poAcctRows != null; } } if (poAcctRows != null && poAcctRows.Count() > 0) { var poAcctRow = poAcctRows.FirstOrDefault(); // Pull values out of keys. if (inKeys) { poAcctRow = new { Fund = poAcctRow.Fund.GetPegIdPart(2), OrgCode = poAcctRow.OrgCode.GetPegIdPart(2), Ba = poAcctRow.Ba.GetPegIdPart(2), Lnum = poAcctRow.Lnum }; } orgcode = poAcctRow.OrgCode == null ? "" : poAcctRow.OrgCode.Trim(); ba = poAcctRow.Ba == null ? "" : poAcctRow.Ba.Trim().Length >= 2 ? poAcctRow.Ba.Trim().Right(2) : poAcctRow.Ba.Trim(); if (String.IsNullOrEmpty(ex_fund)) { var fund442 = poAcctRows.Where(x => x.Fund.Contains("442")).FirstOrDefault(); if (fund442 != null) { ex_fund = fund442.Fund == null ? "" : fund442.Fund.Trim(); } } } } //ex_fund if (String.IsNullOrWhiteSpace(ex_fund)) { if (rr_id.ReplaceNull("").Length >= 2) { if (rr_id.Substring(0, 2) == "HC" || rr_id.Substring(0, 2) == "2C") { ex_fund = "299X"; } } if (ae_id.ReplaceNull("").Length >= 2) { if (ae_id.Substring(0, 2) == "HE" || ae_id.Substring(0, 2) == "2E") { ex_fund = "299X"; } } if (pdocnopo.ReplaceNull("").Length >= 2) { if (pdocnopo.Substring(0, 2) == "HB" || pdocnopo.Substring(0, 2) == "2B") { ex_fund = "299X"; } } if (ex_fund == String.Empty && pdocnopo != String.Empty) { if (pdocnopo.Substring(0, 2) == "1B" || pdocnopo.Substring(0, 2) == "PJ" || pdocnopo.Substring(0, 2) == "PS" || pdocnopo.Substring(0, 2) == "RO" || pdocnopo.Substring(0, 2) == "EP") { ex_fund = "192X"; } } if (ex_fund == String.Empty && pdocnopo != String.Empty) { List <String> rtnPOFund = contextPeg.MF_IO_HDAL.Where(x => x.PARN_OF_LINE_ID == "&1423&1609&" + pdocnopo.Substring(0, 2) + "&" + pdocnopo + "&") .Select(x => x.FUND_ID).ToList(); if (rtnPOFund.Count == 0) { // Check Itemized PO rtnPOFund = (from actg in contextPeg.MF_ORD_ACTG_LN join itmz in contextPeg.MF_IO_ITMZ_LN on actg.PARN_OF_LINE_ID equals itmz.UIDY where itmz.PARN_OF_LINE_ID == "&1423&1609&" + pdocnopo.Substring(0, 2) + "&" + pdocnopo + "&" select actg.FUND_ID).ToList(); } if (rtnPOFund.Count > 0) { // If any PO accounting line has a fund 442 line, then mark the document as 442. bool b442 = false; for (int row = 0; row < rtnPOFund.Count; row++) { if (rtnPOFund[row].Contains("442")) { b442 = true; } } if (b442) { ex_fund = "442"; } else { string[] fundid = rtnPOFund[0].Split('&'); ex_fund = fundid[1]; } } } } //end ex_fund //lookup pdocnopo if only act (ONLY workd for OLD orders that were processed in VITAP) if (pdocnopo == String.Empty & !String.IsNullOrEmpty(act)) { List <string> rtnPegPO = (from temp in contextVitap.PEGASYSPOes where temp.ACT == act select temp.PO_ID).ToList(); if (rtnPegPO.Count > 0) { po_id = rtnPegPO[0]; } } //lookup pegsystem if (pegsystem == String.Empty) { if (ex_fund == "442") { pegsystem = "ARRA"; } if (pa_id.ReplaceNull("").Length >= 2) { if (pa_id.Substring(0, 2) == "UD") { pegsystem = "UPPS"; } } if (ae_id.ReplaceNull("").Length >= 2) { if (ae_id.Substring(0, 2) == "UE") { pegsystem = "UPPS"; } if (ae_id.Substring(0, 2) == "HE") { pegsystem = "TOPS"; } if (ae_id.Substring(0, 2) == "2E") { pegsystem = "FTS"; } } if (po_id.ReplaceNull("").Length >= 2) { if (po_id.Substring(0, 2) == "HB") { pegsystem = "TOPS"; } if (po_id.Substring(0, 2) == "2B") { pegsystem = "FTS"; } } if (rr_id.ReplaceNull("").Length >= 2) { if (rr_id.Substring(0, 2) == "HC") { pegsystem = "TOPS"; } if (rr_id.Substring(0, 2) == "2C") { pegsystem = "FTS"; } } if (pdocnopo.ReplaceNull("").Length >= 2) { if (pdocnopo.Substring(0, 2) == "HB") { pegsystem = "TOPS"; } if (pdocnopo.Substring(0, 2) == "2B") { pegsystem = "FTS"; } if (pdocnopo.Substring(0, 2) == "RO") { pegsystem = "VCPO"; } if (pdocnopo.Substring(0, 2) == "1B" || pdocnopo.Substring(0, 2) == "PJ" || pdocnopo.Substring(0, 2) == "EP" || pdocnopo.Substring(0, 2) == "PP" || pdocnopo.Substring(0, 2) == "PS" || pdocnopo.Substring(0, 2) == "PN") { pegsystem = "PBS"; } } if (ex_fund.ReplaceNull("").Length >= 3) { if (ex_fund.Substring(0, 3) == "299" || ex_fund.Substring(0, 3) == "285" || ex_fund.Substring(0, 3) == "295") { pegsystem = "FTS"; } if (err_code.Substring(0, 1) == "R") { pegsystem = "VCPO"; } if (ex_fund.Substring(0, 3) == "192") { pegsystem = "PBS"; } } if (pegsystem == String.Empty && imagebatch != String.Empty) { if (BCEImageBatchString == String.Empty || BCFImageBatchString == String.Empty) { ConfigManager cfg = new ConfigManager(); BCEImageBatchString = cfg.GetConfigValue("VITAP", "BCE_INVOICE_IMAGEBATCH_PREFIXES"); BCFImageBatchString = cfg.GetConfigValue("VITAP", "BCF_INVOICE_IMAGEBATCH_PREFIXES"); } // end empty image strings if (imagebatch.ReplaceNull("").Length >= 3 && BCEImageBatchString != String.Empty && BCEImageBatchString.IndexOf(imagebatch.Substring(0, 3)) != -1) { pegsystem = "06"; } if (imagebatch.ReplaceNull("").Length >= 2 && (imagebatch.Substring(0, 2) == "R6" || imagebatch.Substring(0, 2) == "P6")) { pegsystem = "06"; } if (imagebatch.ReplaceNull("").Length >= 3 && imagebatch.Substring(0, 3) == "IN6") { pegsystem = "06"; } if (imagebatch.ReplaceNull("").Length >= 3 & BCFImageBatchString != String.Empty && BCFImageBatchString.IndexOf(imagebatch.Substring(0, 3)) != -1) { pegsystem = "07"; } if (imagebatch.ReplaceNull("").Length >= 2 && (imagebatch.Substring(0, 2) == "R7" || imagebatch.Substring(0, 2) == "P7")) { pegsystem = "07"; } if (imagebatch.ReplaceNull("").Length >= 3 && imagebatch.Substring(0, 3) == "IN7") { pegsystem = "07"; } if (pegsystem == String.Empty) { pegsystem = "07"; } } } //end if empty pegasystem if (ex_memo.ReplaceNull("").Length > 200) { ex_memo = ex_memo.Substring(0, 200); } if (ex_memo2.ReplaceNull("").Length > 500) { ex_memo2 = ex_memo2.Substring(0, 500); } if (vendname.ReplaceNull("").Length > 35) { vendname = vendname.Substring(0, 35); } if (allprocess.ReplaceNull("").Length > 30) { allprocess = allprocess.Substring(0, 30); } EXCEPTION exc = new EXCEPTION(); exc.EX_ID = ""; exc.ACT = act; exc.PDOCNO = pdocnopo; exc.PO_ID = po_id; exc.RR_ID = rr_id; exc.AE_ID = ae_id; exc.PA_ID = pa_id; exc.INV_KEY_ID = inv_key_id; exc.EX_FUND = ex_fund; exc.ERR_CODE = err_code; exc.ERR_RESPONSE = Err_response; exc.PARTIAL_MATCH_VENDNO = partial_match_vendno; exc.EX_DATE = DateTime.Now; exc.EX_MEMO = ex_memo; exc.EX_MEMO2 = ex_memo2; exc.MISC_AMOUNT = (Decimal?)misc_amount; exc.PAY_AMOUNT = (Decimal?)pay_amount; exc.RRAMOUNT = (Decimal?)rramount; exc.POAMOUNT = (Decimal?)poamount; exc.HOLD_DATE = hold_date; exc.UPDSTATUS = updstatus; exc.NOT_KEY_ID = not_key_id; exc.ORGCODE = orgcode; exc.BA = ba; exc.NETDAYS = (byte)netdays; exc.VENDNAME = vendname; exc.PODOCTYPE = podoctype; exc.PEGSYSTEM = pegsystem; exc.ALLPROCESS = allprocess; exc.ADDPC = prepcode; exc.OUT = "F"; contextVitap.EXCEPTIONS.Add(exc); contextVitap.SaveChanges(); //Repull Exception to get it's ID Ex_id = contextVitap.EXCEPTIONS.OrderByDescending(x => x.EX_DATE).FirstOrDefault(x => x.INV_KEY_ID == exc.INV_KEY_ID && x.ERR_CODE == exc.ERR_CODE).EX_ID;; if (updinvstatus == "T" && inv_key_id != String.Empty) { var fieldsToUpdate = new List <string> { "INV_STATUS", "ERR_CODE" }; var rtnInv = GetPegasysInvoiceByKey(inv_key_id); if (rtnInv != null) { rtnInv.INV_STATUS = "EXCEPTION"; rtnInv.ERR_CODE = err_code; UpdatePegasysInvoice(rtnInv, fieldsToUpdate); } } if (updrrstatus == "T" && Rr_id != String.Empty) { var fieldsToUpdate = new List <string> { "RR_STATUS", "ERR_CODE" }; var rtnrr = GetPegasysRRByKey(Rr_id); if (rtnrr != null) { rtnrr.RR_STATUS = "EXCEPTION"; rtnrr.ERR_CODE = err_code; UpdatePegasysRR(rtnrr, fieldsToUpdate); } } return(true); } } } //end AddException
protected override void Visit_EXCEPTION(EXCEPTION node) { /* MOVE CODE HERE */ }
protected string ExceptionP231(EXCEPTION exception) { string ThisRR = "", OneRR = "", ThisPO = "", Doc_Date = "", SchedDate = "", P7Num = "", RefdLimit = "", RR_List = ""; decimal?PayAmt = 0, Interest = 0; //Check MF_II table - MFMI in FoxPro var rtnMFII = GetMFIIData(exception.INV_KEY_ID); if (rtnMFII.Count == 0) { return(""); } //Invoice was changed and processed if (rtnMFII[0].INVD_AM == 0 || rtnMFII[0].CLSD_AM == 0) { //Still a P231/ P232 Exception return("Invoice has not been paid yet.."); } //Update the Exception var responsenotes = exception.RESPONSENOTES + "\r\n" + NewNote + "\r" + "Exception cleared because the Invoice is no longer in the Pegasys form table -- " + "it was revised and processed by the user."; UpdateException(exception, "Q", notes.returnVal7, notes.returnVal3, responsenotes, "PROCESSED"); UpdatePegasysInvoiceToInPeg(exception.INV_KEY_ID); var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID); //"Checking if Invoice has been PAID.." var InvPeg = GetMFRefInfo(exception.INV_KEY_ID); if (InvPeg.Count == 0) { Doc_Date = rtnMFII[0].CLSD_DT.ShortDate(); SchedDate = "???"; P7Num = "???"; PayAmt = rtnMFII[0].CLSD_AM; Interest = 0; } else { var invPegPA = new List <MFIPDataResult>(); foreach (var row in InvPeg) { invPegPA = GetMFIPData(row); if (invPegPA[0].DOC_STUS == DocStatus.Processed) { break; } } if (invPegPA[0].DOC_STUS != DocStatus.Processed) { return(""); } PayAmt = getPayAmt(invPegPA[0]); Interest = 0; if (invPegPA[0].DSBD_AM > 0) { Interest = invPegPA[0].DSBD_AM - invPegPA[0].AUTD_AM; } SchedDate = invPegPA[0].SCHD_DT.ShortDate(); Doc_Date = invPegPA[0].DOC_DT.ShortDate(); P7Num = InvPeg[InvPeg.Count - 1].REFG_DOC_NUM.Trim(); RR_List = ""; RefdLimit = ""; if (rtnInv.INV_KEY_ID.Left(1) == "I") { RefdLimit = "I"; } else { RefdLimit = "R"; } var MFRip7 = GetMFRip7(RefdLimit, P7Num); if (MFRip7.Count == 0) { if (rtnInv.PDOCNORR == null) { ThisRR = ""; OneRR = ""; } else { ThisRR = rtnInv.PDOCNORR; OneRR = rtnInv.PDOCNORR; } } else if (MFRip7.Count == 1) { ThisRR = MFRip7[0].REFD_DOC_NUM; OneRR = MFRip7[0].REFD_DOC_NUM; } else if (MFRip7.Count > 1) { ThisRR = "MRR"; OneRR = MFRip7[0].REFD_DOC_NUM; RR_List = ""; foreach (var row in MFRip7) { RR_List += row.REFD_DOC_NUM + ", "; } RR_List = RR_List.Left(RR_List.Length - 2); } var rtnPO = GetPOInfoFromPegasys(OneRR); ThisPO = rtnInv.PDOCNOPO; if (rtnPO != null && rtnPO.REFD_DOC_NUM.Substring(1, 1) != "E") { ThisPO = rtnPO.REFD_DOC_NUM; } } if (String.IsNullOrWhiteSpace(ThisPO)) { return(""); } else { var strInterest = Interest > 0 ? " -- Interest $" + Interest.ToString() : ""; var strCuffMemo = P7Num.Trim() + " was generated by Pegasys in the amount of " + PayAmt + " for invoice " + rtnMFII[0].INVC_NUM + " on " + Doc_Date + strInterest + " --- Estimated Schedule date " + SchedDate + " " + RR_List; using (var contextVitap = new OracleVitapContext()) { contextVitap.Configuration.AutoDetectChangesEnabled = true; var transhist = new TRANSHIST() { ACT = rtnInv.ACT, PDOCNO = ThisPO, PO_ID = ThisPO, RR_ID = ThisRR, INV_KEY_ID = rtnInv.INV_KEY_ID, TRANSDATE = DateTime.Now, TRANSAMT = PayAmt, ACTNCODE = "P7", PREPCODE = "VI", CUFF_MEMO = strCuffMemo, PA_ID = P7Num.Trim() }; contextVitap.TRANSHISTs.Add(transhist); contextVitap.SaveChanges(); } var fieldsToUpdate = new List <string> { "INV_STATUS", "PAIDDATE", "PAY_AMT", "INVOICE" }; rtnInv.INV_STATUS = DocStatus.Paid; rtnInv.PAIDDATE = DateTime.Parse(Doc_Date); rtnInv.PAY_AMT = PayAmt; strCuffMemo = "Invoice number changed from " + rtnInv.INVOICE + " to" + rtnMFII[0].INVC_NUM + " per Pegasys"; bool insertTransHist = false; if (rtnInv.INVOICE != rtnMFII[0].INVC_NUM) { rtnInv.INVOICE = rtnMFII[0].INVC_NUM; insertTransHist = true; } UpdatePegasysInvoice(rtnInv, fieldsToUpdate); if (insertTransHist) { InsertTranshist(exception, "", strCuffMemo, "Invoice", PrepCode); } } return(""); }
/// <summary> /// For User Exceptions only with override code /// Uses Notes screen /// Uses InvEdit screen /// </summary> /// <param name="exc"></param> /// <param name="prepCode"></param> /// <returns></returns> public bool Initialize(EXCEPTION exc, string prepCode) { SetVariables(exc, prepCode, "CORRECTDE"); return(true); }
public bool Initialize(EXCEPTION exc, string Pdocno, string prepCode) { SetVariables(exc, Pdocno, prepCode, "NOTTHISONE"); return(true); }