public void HandleRR(AddressValuesModel Search, PEGASYSRR_FRM RRFrmQuery, string thismemo)
        {
            NewNotes();
            //F05
            var DateQueued = DateTime.Now;

            Report_ID  = "F05";
            ReportForm = "RR Reject";
            //Don't have the RRQuery...Need to get it set up
            if (RRFrmQuery != null)
            {
                exception.RR_ID = RRFrmQuery.RR_ID;
            }

            if (!notes.returnVal2.Contains("DUPLICATE"))
            {
                if (String.IsNullOrWhiteSpace(exception.FAXNOTES))
                {
                    if (thismemo == "CANCEL")
                    {
                        //DisplayMessage("Only Notification canceled - RR will still be rejected!", 0, "Nothing");
                    }
                    else
                    {
                        var properties = new List <string>
                        {
                            "FAXNOTES"
                        };

                        exception.FAXNOTES = thismemo; //objmemo.p_thismemo;
                        UpdateException(exception, properties);
                    }

                    if (!CheckNotificationExists())
                    {
                        Status = "Pending";
                        InsertNotification();
                    }
                }
                var S_Note = "Yes";

                NewNote = "Reject RR " + "\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 rtnRR = GetPegasysRRByKey(exception.RR_ID);

            if (rtnRR != null)
            {
                UpdatePegasysRRToReject(rtnRR);
            }
        }
示例#2
0
        protected string GetRRStatus(PEGASYSRR_FRM rtnRR)
        {
            var NewStatus = "MATCHREADY";

            if (rtnRR.VERIFICATION_FL == "T" && rtnRR.DATAENTRY_FL == "T" && rtnRR.PREVALIDATION_FL == "T")
            {
                NewStatus = "MATCHREADY";
            }
            else if (rtnRR.VERIFICATION_FL == "T" && rtnRR.DATAENTRY_FL == "T" && rtnRR.PREVALIDATION_FL == "F")
            {
                NewStatus = "KEYED";
            }
            else if (rtnRR.VERIFICATION_FL == "T" && rtnRR.DATAENTRY_FL == "F" && rtnRR.PREVALIDATION_FL == "F")
            {
                NewStatus = "KEYREADY";
            }
            else if (rtnRR.VERIFICATION_FL == "F" && rtnRR.DATAENTRY_FL == "F" && rtnRR.PREVALIDATION_FL == "F")
            {
                NewStatus = "NEW";
            }

            return(NewStatus);
        }
        /// <summary>
        /// Handls U049 exceptions
        /// Deals with either Invoices, RRs, or POs depending on data
        /// If notes.returnVal2 does not contain "DUPLICATE", it adds a notification and transhist record
        /// Clears V299 exceptions for invoices
        /// Sets the PegasysInvoice, PegasysRR_frm or PegasysPO_frm records to "REJECT"
        /// Users the RRQuery.RR_ID and POQuery.MODNO values, so those need to be passed in
        /// </summary>
        /// <param name="exception"></param>
        public void ExceptionU049(EXCEPTION exception, AddressValuesModel Search, AddressValuesModel Address,
                                  PEGASYSRR_FRM RRFrmQuery, PEGASYSPO_FRM POFrmQuery, string thismemo)
        {
            var Ex_Date = exception.EX_DATE;

            Report_ID = "";
            string S_Note = "No";

            ReportForm       = "";
            exception.PDOCNO = "";
            string strCuffMemo = "";

            Status = "Pending";

            if (!String.IsNullOrWhiteSpace(exception.INV_KEY_ID))
            {
                var DateQueued = DateTime.Now;
                Report_ID = "P08";

                Pegasys         = true;
                ReportForm      = "PegInvReject";
                exception.PO_ID = String.IsNullOrWhiteSpace(exception.PDOCNO) ? exception.PO_ID : exception.PDOCNO;

                // Not sending Notification if its a DUPLICATE Invoice
                if (!notes.returnVal2.Contains("DUPLICATE"))
                {
                    //Open MandMemo screen to get user input
                    if (thismemo == "CANCEL")
                    {
                        //DisplayMessage("Only Notification cancelled - Invoice will still be rejected!", 0, "Nothing");
                    }
                    else
                    {
                        exception.FAXNOTES = thismemo;


                        if (!CheckNotificationExists())
                        {
                            InsertNotification();
                        }
                    }

                    S_Note  = "Yes";
                    NewNote = "Reject Invoice " + "\r\n" + "Send Notification " + S_Note + " " + ReportForm + "\r\n" + NewNote;

                    strCuffMemo = "Reject - " + "\r\n" + "Send Notification " + S_Note + ": " +
                                  Report_ID + " - " + ReportForm + "\r" + NewNote;
                    InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode);
                }

                //Updating Invoice Table to Reject the Invoice

                var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID);
                //Doesn't set lasttime to 0
                UpdatePegasysInvoiceToReject(rtnInv);

                // Just in case there is a V299 on Hold
                var rtnExc = GetExceptionV299();
                if (rtnExc != null)
                {
                    UpdateExceptionV299(exception.INV_KEY_ID);
                }

                // Creating a Custom TransHist Entry
                strCuffMemo = "U044 Invoice Number Changed Not Approved, Rejected back to Vendor";
                InsertTranshist(exception, "X", strCuffMemo, "Rejected by Manager", PrepCode);
            }
            else if (!String.IsNullOrWhiteSpace(exception.RR_ID))
            {
                //F05
                var DateQueued = DateTime.Now;
                Report_ID       = "F05";
                ReportForm      = "RR Reject";
                exception.RR_ID = RRFrmQuery.RR_ID;

                if (!notes.returnVal2.Contains("DUPLICATE"))
                {
                    if (String.IsNullOrWhiteSpace(exception.FAXNOTES))
                    {
                        if (thismemo == "CANCEL")
                        {
                            //DisplayMessage("Only Notification cancelled - RR will still be rejected!", 0, "Nothing");
                        }
                        else
                        {
                            exception.FAXNOTES = thismemo;

                            if (!CheckNotificationExists())
                            {
                                InsertNotification();
                            }
                        }
                    }

                    S_Note      = "Yes";
                    NewNote     = "Reject RR " + "\r\n" + "Send Notification " + S_Note + " " + ReportForm + "\r\n" + NewNote;
                    strCuffMemo = "Reject - " + "\r\n" + "Send Notification " + S_Note + ": " +
                                  Report_ID + " - " + ReportForm + "\r" + NewNote;
                    InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode);
                }

                var rtnRR = GetPegasysRRByKey(exception.RR_ID);

                UpdatePegasysRRToReject(rtnRR);
            }

            else if (!String.IsNullOrWhiteSpace(exception.PO_ID))
            {
                var DateQueued = DateTime.Now;
                ReportForm = "";

                if (!String.IsNullOrWhiteSpace(POFrmQuery.MODNO))
                {
                    Report_ID  = "F06";
                    ReportForm = "Mod Reject";
                }
                else
                {
                    Report_ID  = "F03";
                    ReportForm = "PO Reject";
                }

                if (!notes.returnVal2.Contains("DUPLICATE"))
                {
                    if (String.IsNullOrWhiteSpace(exception.FAXNOTES))
                    {
                        if (thismemo == "CANCEL")
                        {
                            //DisplayMessage("Only Notification cancelled - PO will still be rejected!", 0, "Nothing");
                        }
                        else
                        {
                            exception.FAXNOTES = thismemo;

                            if (!CheckNotificationExists())
                            {
                                InsertNotification();
                            }
                        }
                    }

                    S_Note  = "Yes";
                    NewNote = "Reject PO/Mod " + "\r\n" + "Send Notification " + S_Note + " " + ReportForm + "\r\n" + NewNote;

                    strCuffMemo = "Reject - " + "\r\n" + "Send Notification " + S_Note + ": " + Report_ID + " - " + ReportForm + "\r" + NewNote;
                    InsertTranshist(exception, "X", strCuffMemo, "Reject Notification", PrepCode);
                }

                var rtnPO = GetPegasysPOFrmByKey(exception.PO_ID);
                //Doesn't update lasttime
                UpdatePegasysPOToReject(rtnPO);
            }
            else
            {
                //Need to do error handling here
                //DisplayMessage("Unexpected Branching of code..Needs Investigation..Contact Helpdesk..", 64, "Unexpected Outcome!!");
            }
        }
        /// <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>
        /// 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);
            }
        }