/// <summary> /// Needs to call the Pick list and pass in the table/list to it /// </summary> /// <param name="InvQuery"></param> public List <PEGASYSINVOICE> FinishCode(PEGASYSINVOICE InvQuery) { var rtnInv = GetPegasysInvoice(InvQuery.PDOCNOPO, InvQuery.VEND_CD); //picnt = _TALLY var rtnMFII = GetMFIIDataByVendCd(InvQuery.VEND_CD); foreach (var row in rtnMFII) { var pi = new PEGASYSINVOICE(); pi.INVOICE = row.INVC_NUM; pi.ACT = row.XSYS_DOC_NUM.Left(8); pi.INV_STATUS = row.DOC_STUS.Left(10); pi.INV_KEY_ID = row.DOC_NUM; pi.AMOUNT = row.INVD_TA; pi.INVDATE = row.INVC_DT; pi.ERR_CODE = "NONE"; pi.PDOCNOPO = ""; rtnInv.Add(pi); } rtnInv.Sort(); return(rtnInv); }
private bool ClaimPegasysInvoiceForKeying(PEGASYSINVOICE invoice) { // If update is successful, we claimed it. // If it wasn't (i.e., someone already set these fields), we failed. invoice.OUT = "T"; invoice.OUTPREP = prepcode; invoice.OUTDATE = DateTime.Now; return(pegInvoiceManager.UpdatePegasysInvoiceReturnResult(invoice)); }
/// <summary> /// Sets the PegasysInvoice.INV_STATUS = "REJECT" /// </summary> /// <param name="rtnInv"></param> private void UpdatePegasysInvoiceToReject(PEGASYSINVOICE rtnInv) { var fieldsToUpdate = new List <string> { "INV_STATUS", "ERR_CODE" }; rtnInv.INV_STATUS = "REJECT"; rtnInv.ERR_CODE = null; UpdatePegasysInvoice(rtnInv, fieldsToUpdate); }
private void InsertFieldChangeToTranshist(InvEditViewModel invoice, PEGASYSINVOICE PI, string Act, string cMemo, string FieldName) { var transhist = new TRANSHIST() { ACT = Act, PDOCNO = PI.PDOCNOPO, INV_KEY_ID = PI.INV_KEY_ID, ERR_CODE = "D/E", TRANSDATE = DateTime.Now, PREPCODE = PrepCode, CUFF_MEMO = cMemo, ALLPROCESS = FieldName, CLEARED_DATE = DateTime.Now }; InsertTranshist(transhist); }
private bool RejectPegasysInvoice(AddInvoiceViewModel viewModel) { // Grab the full invoice. PEGASYSINVOICE invoice = pegInvoiceManager.GetPegasysInvoiceByKeyId(viewModel.INV_KEY_ID); if (invoice == null) { return(false); } // Set rejection fields. invoice.OUT = null; invoice.OUTPREP = null; invoice.OUTDATE = null; invoice.INV_STATUS = DataEntry.ImgReject; // Update it. return(pegInvoiceManager.UpdatePegasysInvoiceReturnResult(invoice)); }
private void FormatInvoiceData(PEGASYSINVOICE invoice, AddInvoiceViewModel vm) { // Grab the legal business name from Pegasys, if it exists. string legalBusinessName = pegInvoiceManager.GetLegalBusinessName(invoice); // Address text area is as follows: // legalBusinessName // ADDR_L1 // ADDR_L2 // ADDR_L3 // ADDR_CITY, ADDR_STATE ADDR_ZPCD string address = ""; if (!string.IsNullOrEmpty(legalBusinessName)) { address = legalBusinessName + "\n"; } if (!string.IsNullOrEmpty(invoice.ADDR_L1)) { address += invoice.ADDR_L1 + "\n"; } if (!string.IsNullOrEmpty(invoice.ADDR_L2)) { address += invoice.ADDR_L2 + "\n"; } if (!string.IsNullOrEmpty(invoice.ADDR_L3)) { address += invoice.ADDR_L3 + "\n"; } if (!string.IsNullOrEmpty(invoice.ADDR_CITY)) { address += invoice.ADDR_CITY; } if (!string.IsNullOrEmpty(invoice.ADDR_STATE)) { address += ", " + invoice.ADDR_STATE; } if (!string.IsNullOrEmpty(invoice.ADDR_ZPCD)) { address += " " + invoice.ADDR_ZPCD; } vm.VENDADDRESS = address; }
private bool KeyPegasysInvoice(AddInvoiceViewModel viewModel) { // Grab the full invoice. PEGASYSINVOICE invoice = pegInvoiceManager.GetPegasysInvoiceByKeyId(viewModel.INV_KEY_ID); if (invoice == null) { return(false); } // Update invoice with our view model. invoice = AddInvoiceViewModel.MapToEntityFramework(viewModel, invoice); // Set keying specific fields. invoice.OUT = "F"; invoice.OUTPREP = null; invoice.OUTDATE = null; invoice.DATAENTRY_FL = "T"; invoice.KEYDATE = DateTime.Now; invoice.KEYPC = prepcode; invoice.PREPCODE = prepcode; invoice.INV_STATUS = DataEntry.Keyed; if (!viewModel.VENDORMATCH) { invoice.ADDR_L1 = null; invoice.ADDR_L2 = null; invoice.ADDR_L3 = null; invoice.ADDR_CITY = null; invoice.ADDR_STATE = null; invoice.ADDR_ZPCD = null; invoice.VEND_ADDR_CD = DataEntry.VendAddrCd; } if (viewModel.GENE043S) { invoice.NEEDERR_CODE = DataEntry.NeedErrCode; } // Update it. return(pegInvoiceManager.UpdatePegasysInvoiceReturnResult(invoice)); }
private bool CheckExceptionP() { var rtnInv = new PEGASYSINVOICE(); if (exception.ERR_CODE.Left(1) == "P") { if (notes.returnVal4 == "VITAP" || notes.returnVal4 == "PEGASYS/NON-VITAP") { //Uses rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID); if (rtnInv != null) { if (rtnInv.EDI_IND == "F") { var ImageID = rtnInv.IMAGEID; //This was updating the imagelist/imagelisthist tables in FoxPro but is obsolete return true; } } } } return false; }
protected string GetInvStatus(PEGASYSINVOICE rtnInv) { if (rtnInv.PDOCNOPO.Left(2) == "2I") { return("PREVAL3GS"); } else if (rtnInv.VERIFICATION_FL == "T" && rtnInv.DATAENTRY_FL == "T" && rtnInv.PREVALIDATION_FL == "T") { return("MATCHREADY"); } else if (rtnInv.VERIFICATION_FL == "T" && rtnInv.DATAENTRY_FL == "T" && rtnInv.PREVALIDATION_FL == "F") { return("KEYED"); } else if (rtnInv.VERIFICATION_FL == "T" && rtnInv.DATAENTRY_FL == "F" && rtnInv.PREVALIDATION_FL == "F") { return("KEYREADY"); } else if (rtnInv.VERIFICATION_FL == "F" && rtnInv.DATAENTRY_FL == "F" && rtnInv.PREVALIDATION_FL == "F") { return("RE-VERIFY"); } return("MATCHREADY"); }
public bool Initialize(EXCEPTION exc, string PrepCode, PEGASYSINVOICE InvQuery) { SetVariables(exception, PrepCode, "SHOWUSEDINVOICES"); return(true); }
public void FinishCode(PEGASYSINVOICE InvQuery, PEGASYSPO_FRM POFrmQuery, AddressValuesModel Search, string sNotesType, bool POExists, bool InvExists, bool RRExists) { NewNotes(); var cImageID = ""; switch (exception.ERR_CODE) { case "P060": case "P061": case "P005": cImageID = InvQuery.IMAGEID; break; case "V216": if (!String.IsNullOrWhiteSpace(exception.INV_KEY_ID)) { cImageID = InvQuery.IMAGEID; } else if (!String.IsNullOrWhiteSpace(exception.PO_ID)) { cImageID = POFrmQuery.IMAGEID; } break; default: if (POFrmQuery != null) { cImageID = POFrmQuery.IMAGEID; } break; } if (!String.IsNullOrWhiteSpace(cImageID)) { string cVendName = ""; if (String.IsNullOrWhiteSpace(exception.VENDNAME.Trim())) { if (!String.IsNullOrWhiteSpace(Search.VENDORNAME)) { cVendName = Search.VENDORNAME; } } else { cVendName = exception.VENDNAME.Trim(); } } if (exception.ERR_CODE.Right(3) == "230") { if (exception.ERR_CODE.Left(1) == "P") { U048table = "PEGINV"; } CreateExceptionU048(InvQuery, POFrmQuery); } else if (exception.ERR_CODE == "D062") { notes.returnVal3 = "D062"; U048table = notes.returnValZ; CreateExceptionU048(InvQuery, POFrmQuery); } else if (exception.ERR_CODE.Left(1) == "V") { //generate U048 & blank out the PO.last_status if (!String.IsNullOrWhiteSpace(exception.INV_KEY_ID)) { U048table = "PEGINV"; } else if (String.IsNullOrWhiteSpace(exception.PO_ID)) { U048table = "PEGPO"; } CreateExceptionU048(InvQuery, POFrmQuery); } else if (exception.ERR_CODE == "U043" || exception.ERR_CODE == "U044") { ExceptionU043(sNotesType, POExists, InvExists, RRExists); } else if (exception.ERR_CODE == "U049") { ExceptionU049(sNotesType); } else if (exception.ERR_CODE == "P060" || exception.ERR_CODE == "P061" || exception.ERR_CODE == "P005") { string responsenotes = exception.RESPONSENOTES + "\r\n" + NewNote; UpdateException(exception, "Q", notes.returnVal7, notes.returnVal3, responsenotes, ""); UpdatePegasysInvoiceStatusById("MATCHREADY"); //Disabled because it doesn't update the Oracle tables //SET CLASS TO exceptions ADDITIVE //objChg = CREATE("InterestCorrectDE") //objChg.r_act = THISFORM.r_act //objChg.r_rr_id = THISFORM.r_rr_id //objChg.r_inv_key_id = THISFORM.r_inv_key_id //objChg.r_pegasys = THISFORM.r_pegasys //objChg.SHOW } else { var responsenotes = exception.RESPONSENOTES + "\r\n" + NewNote; UpdateException(exception, "Q", notes.returnVal7, notes.returnVal3, responsenotes, ""); } }
protected void CreateExceptionU048(PEGASYSINVOICE InvQuery, PEGASYSPO_FRM POFrmQuery) { U048table = U048table.ToUpper(); var lGoU048 = true; if (U048table == "PEGINV") { //Updating PegasysInvoice ... var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID); var fieldsToUpdate = new List <string> { "ERR_CODE" }; rtnInv.ERR_CODE = "U048"; UpdatePegasysInvoice(rtnInv, fieldsToUpdate); } else if (U048table == "PEGPO") { //Updating Pegasyspo_frm ... var rtnPO = GetPegasysPOFrmByKey(exception.PO_ID); var fieldsToUpdate = new List <string> { "ERR_CODE" }; UpdatePegasysPO(rtnPO, fieldsToUpdate); } else if (U048table == "PEGRR") { //Updating Pegasysrr_frm ... var rtnRR = GetPegasysRRByKey(exception.RR_ID); var fieldsToUpdate = new List <string> { "ERR_CODE" }; UpdatePegasysRR(rtnRR, fieldsToUpdate); } if (lGoU048 == true) { //Generating U048... var objException = new VITAPExceptions(); objException.ActNum = exception.ACT; if (U048table.InList("PEGPO,PO")) { objException.Po_id = exception.PO_ID; objException.Updpostatus = "T"; } if (U048table.InList("PEGRR,RR")) { objException.Rr_id = exception.RR_ID; objException.Updrrstatus = "T"; } if (U048table.InList("PEGINV,INVOICE")) { objException.Inv_key_id = exception.INV_KEY_ID; objException.Updinvstatus = "T"; } if (U048table == "EXPENSEACCRUAL") { objException.Ae_id = exception.AE_ID; objException.Updaestatus = "T"; } if (U048table.InList("PEGINV,PEGPO,PEGRR")) { objException.Ex_fund = exception.EX_FUND; objException.Vendname = exception.VENDNAME; if (U048table == "PEGINV" && InvQuery.AMOUNT != null) { objException.Poamount = (double)InvQuery.AMOUNT; } else if (U048table == "PEGPO" && POFrmQuery.AMOUNT != null) { objException.Poamount = (double)POFrmQuery.AMOUNT; } } objException.Ex_memo = notes.returnVal3; objException.Err_code = "U048"; objException.PrepCode = PrepCode; objException.AddException(); var responsenotes = exception.RESPONSENOTES + "\r\n" + NewNote; UpdateException(exception, "Q", notes.returnVal7, notes.returnVal3, responsenotes, ""); } }
private void AddR200TranshistRecord(DateTime?StartDate, string newAct, string newPDocNo, PEGASYSINVOICE rtnInv) { if (rtnInv == null) { return; } DateTime?EndDate; if (((DateTime)StartDate).Month + 1 == 13) { EndDate = (DateTime?)Convert.ToDateTime("12/31/" + ((DateTime)StartDate).Year.ToString()); } else { string date = ((DateTime)StartDate).Month.ToString().PadLeft(2, '0') + "/01/" + ((DateTime)StartDate).Year.ToString(); EndDate = (DateTime?)Convert.ToDateTime(date); } if (rtnInv.EDI_IND == "T") { exception.ACT = newAct; exception.PDOCNO = newPDocNo; string strCuffMemo = "R200 PO Match changed the service period on the " + "electronic invoice from " + rtnInv.SVC_PERD_STRT.ToString() + "-" + rtnInv.SVC_PERD_END.ToString() + " to " + StartDate.ShortDate() + "-" + EndDate.ShortDate() + "'"; InsertTranshist(exception, "", strCuffMemo, "", PrepCode); } var fieldsToUpdate = new List <string> { "SVC_PERD_STRT", "SVC_PERD_END" }; rtnInv.SVC_PERD_STRT = StartDate; rtnInv.SVC_PERD_END = EndDate; UpdatePegasysInvoice(rtnInv, fieldsToUpdate); }
/// <summary> /// Calls the various Error Code methods /// Need to handle adding an exception under P041 /// U084 was in the case statement twice, so the second one was removed /// Z234, Z237, and Z310 has been removed /// </summary> /// <param name="exception"></param> public void FinishCode(EXCEPTION exception, AddressValuesModel Search, AddressValuesModel Address, PEGASYSINVOICE InvQuery, PEGASYSRR_FRM RRFrmQuery, PEGASYSPO_FRM POFrmQuery, String PrepCode) { //string _sEx_Memo2_Prefix = ""; //The following needs to be handled..It was being set in each method, but not necessary if we can do it once here. NewNotes(); var FaxNotes = notes.returnVal2 + notes.returnVal7; if (!String.IsNullOrWhiteSpace(FaxNotes)) { exception.FAXNOTES = FaxNotes; notes.FaxNotes = FaxNotes; } exception.FAXNOTES = exception.FAXNOTES.ReplaceNull("").ReplaceApostrophes(); NewNote = NewNote.ReplaceApostrophes(); if (exception.ERR_CODE.Right(3).InList("029,009,037")) { Exception_029_009_037(exception, Search, Address); } else if (exception.ERR_CODE.Right(3) == "036") { Exception_036(PrepCode); } else if (exception.ERR_CODE.Right(3).InList("230,232,234")) { Exception230(Search, Address, InvQuery, RRFrmQuery, POFrmQuery); } else if (exception.ERR_CODE.Right(3) == "046") { Exception046(exception, Search, Address); } else if (exception.ERR_CODE.Right(3) == "200") { ExceptionU200(Search, Address); } else { switch (exception.ERR_CODE) { //case "C500": //case "C520": // ExceptionC500(exception); // break; case "D062": case "M303": case "M224": case "M237": ExceptionM237(exception); break; case "P060": ExceptionD062(Search, Address); break; case "P001": case "P002": case "P004": case "P024": case "P008": ExceptionP002(exception, Search, Address); break; case "P041": if (Caption == "FINISH") { Exception046(exception, Search, Address); //Add the Exception E052 here AddException("", exception.ERR_CODE, PrepCode); } break; case "P140": case "P039": ExceptionP140(exception, Search, Address); break; case "P201": ExceptionU200(Search, Address); break; case "P231": Exception230(Search, Address, InvQuery, RRFrmQuery, POFrmQuery); break; case "V299": case "V216": case "V300": case "V215": ExceptionV299(Search, Address, InvQuery, POFrmQuery); break; case "A224": ExceptionA224(exception, Search, Address, RRFrmQuery); break; case "A226": ExceptionA226(exception, Search, Address); break; case "A237": ExceptionA237(exception, Search, Address); break; default: break; } } //Update the exception string responseNotes = exception.RESPONSENOTES + "\r\n" + NewNote; UpdateException(exception, "X", notes.returnVal7, notes.returnVal3, responseNotes, "REJECT"); }
/// <summary> /// Handles 230 exceptions /// Uses InvQuery.PDOCNOPO & POFrmQuery.PDOCNO values, so those need to be passed in /// Sets PegasysInvoice to REJECT, Adds a Notification, and a Transhist record /// </summary> private void Exception230(AddressValuesModel Search, AddressValuesModel Address, PEGASYSINVOICE InvQuery, PEGASYSRR_FRM RRFrmQuery, PEGASYSPO_FRM POFrmQuery) { if (!String.IsNullOrWhiteSpace(exception.INV_KEY_ID) && InvQuery != null) // && USED("invquery")) { PDocNo = InvQuery.PDOCNOPO; } else if (!String.IsNullOrWhiteSpace(exception.PO_ID) && POFrmQuery != null) // && USED("pofrmquery")) { PDocNo = POFrmQuery.PDOCNO; } else { PDocNo = ""; } if (exception.ERR_CODE.Left(1) == "P") { NewNote = "Reject Invoice - " + NewNote; var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID); if (rtnInv != null) { UpdatePegasysInvoiceToReject(rtnInv); } } else if (exception.ERR_CODE.Left(1) == "A") { NewNote = "Reject RR - " + NewNote; var rtnRR = GetPegasysRRByKey(exception.RR_ID); if (rtnRR != null) { UpdatePegasysRRToReject(rtnRR); } } else if (exception.ERR_CODE.Left(1) == "M") { NewNote = "Reject AE - " + NewNote; var rtnAE = GetPegasysAEByKey(exception.AE_ID); if (rtnAE != null) { UpdatePegasysAEToReject(rtnAE); } // Do not send Rejection Notification Letter for EA's. return; } if (notes.returnVal2 == null || !notes.returnVal2.Contains("DUPLICATE")) { if (exception.ERR_CODE.Left(1) == "P") { Report_ID = "P08"; ReportForm = "PegInvReject"; } else if (exception.ERR_CODE.Left(1) == "A") { Report_ID = "F05"; ReportForm = "PegRRReject"; } //Do not send Rejection Notification Letter for EA's. if (!CheckNotificationExists()) { Status = "Pending"; InsertNotification(); } var strCuffMemo = "Send Notification " + Report_ID + ": " + ReportForm; InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode); } }
/// <summary> /// Handles V299 exceptions /// Deals with either Invoices or POs /// Sets PegasysInvoice or PegasysPO_frm record to "REJECT" /// Adds notification and transhist records /// Did update C500 or C520 exceptions, but no longer needed /// Uses InvQuery.PDOCNOPO, POFrmQuery.PDOCNO, and GetEx.EX_DATE values so those need to be passed in /// /// </summary> private void ExceptionV299(AddressValuesModel Search, AddressValuesModel Address, PEGASYSINVOICE InvQuery, PEGASYSPO_FRM POFrmQuery) { //For Both Pegasys Vendor Exceptions V299 and V216 if (!String.IsNullOrWhiteSpace(exception.INV_KEY_ID)) { if (InvQuery != null) { PDocNo = InvQuery.PDOCNOPO.ReplaceNull(""); var Po_Id = InvQuery.PDOCNOPO.ReplaceNull(""); } else { PDocNo = ""; } //Update Pegasysinvoice table var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID); if (rtnInv != null) { UpdatePegasysInvoiceToReject(rtnInv); } NewNote = "Reject Invoice - " + NewNote; } else if (!String.IsNullOrWhiteSpace(exception.PO_ID)) { PDocNo = POFrmQuery.PDOCNO.ReplaceNull(""); //Update Pegasyspo_frm table var rtnPO = GetPegasysPOFrmByKey(exception.PO_ID); UpdatePegasysPOToReject(rtnPO); } //Create Notification V08 exception.PO_ID = String.IsNullOrWhiteSpace(exception.PDOCNO) ? exception.PO_ID : exception.PDOCNO; var FaxNotes = notes.returnVal7; var DateQueued = DateTime.Now; //exception.PREPCODE = objapp.prepcode; var strPegasys = ""; if (!String.IsNullOrWhiteSpace(exception.INV_KEY_ID) && exception.ERR_CODE.InList("V299,V300")) { Report_ID = "V08"; strPegasys = "PegInvReject-Vendor"; } else if (!String.IsNullOrWhiteSpace(exception.PO_ID)) { Report_ID = "F03"; strPegasys = "PegPOReject"; } Pegasys = true; if (notes.returnVal2 != null && !notes.returnVal2.Contains("DUPLICATE")) { if (!CheckNotificationExists()) { Status = "Pending"; InsertNotification(); } var s_Note = "Yes"; var strDate = ((DateTime)exception.EX_DATE).ToShortDateString(); var strCuffMemo = "Reject Document - " + "\r\n" + "Send Notification " + s_Note + ": " + Report_ID + " - " + strPegasys + "\r" + NewNote; InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode); } }