Ejemplo n.º 1
0
        public string FinishCode1(string faxNotes, string faxNotes2, string newAddrName)
        {
            var strCuffMemo = NewNote.ReplaceApostrophes();
            var allProcess  = "Send the FAX ASAP";

            if (exception.ERR_CODE == "P040" && exception.ERR_CODE == "P041" || exception.ERR_CODE == "P042")
            {
                theMsg = "";
                var rtnNot = GetNotificationByExId(exception.EX_ID);
                //string lcSql = "select * from notifications where ex_id = '" + exception.EX_ID + "'";

                if (rtnNot.Count == 0) // _TALLY = 0
                {
                    theMsg = "Notification not found.  Please Recycle";
                }

                //Uses Address Name from screen...Needs to be passed in now
                if (String.IsNullOrWhiteSpace(theMsg))
                {
                    if (rtnNot[0].ADDNAME.ReplaceNull("") != newAddrName)
                    {
                        //Need user input to determine whether to continue
                        theMsg = "Additional Contact Names have been changed.  Do you want to update?";
                        //a = MESSAGEBOX("Additional Contact Names have been changed.  Do you want to update?", 36, "Update names")
                    }
                }
                return(theMsg);
            }
            else
            {
                //FOR THE NOTIFICATION EXCEPTIONS ONLY!!!
                if (faxNotes != faxNotes2)
                {
                    exception.FAXNOTES = faxNotes;
                    UpdateNotificationByEXIDToPending(exception.EX_ID);

                    allProcess = "Change Notification FaxNote";
                    InsertTranshist(exception, "", faxNotes, allProcess, PrepCode);
                }
                else
                {
                    UpdateNotificationByEXIDToPending(exception.EX_ID);
                }
                allProcess = "Send the FAX ASAP";
                InsertTranshist(exception, "", faxNotes, allProcess, PrepCode);

                notes.returnVal1 = "SENDASAP";
            }
            return("");
        }
Ejemplo n.º 2
0
        public bool FinishCode(string Invoice, double InvAmount, double POAmount, string VendName, String PrepCode)
        {
            var TheResponse = "Q";

            if (exception.ERR_CODE == "U084")
            {
                TheResponse = "B";
            }

            Report_ID  = "F01";
            ReportForm = "POMod Request";

            var responsenotes = NewNote.ReplaceApostrophes();

            UpdateException(exception, TheResponse, notes.returnVal7, notes.returnVal3, exception.RESPONSENOTES + "\r\rn" + NewNote.ReplaceApostrophes(), "");

            switch (exception.ERR_CODE)
            {
            case "P001":
            case "P024":
                break;

            case "P201":
                Status = "Pending";
                ExceptionP201();
                break;
            }

            var objException = new VITAPExceptions();

            objException.ActNum       = exception.ACT;
            objException.Po_id        = exception.PO_ID;
            objException.Rr_id        = exception.RR_ID;
            objException.Ae_id        = exception.AE_ID;
            objException.Err_response = "M";
            objException.Inv_key_id   = exception.INV_KEY_ID;
            objException.PrepCode     = PrepCode;

            if (exception.ERR_CODE == "D062" || exception.ERR_CODE == "P201")
            {
                objException.Err_code     = "P042";
                objException.Updinvstatus = "T";
            }
            else if (exception.ERR_CODE == "V299" && !String.IsNullOrWhiteSpace(exception.INV_KEY_ID))
            {
                objException.Err_code     = "P042";
                objException.Updinvstatus = "T";
            }
            else if (exception.ERR_CODE == "V299" && !String.IsNullOrWhiteSpace(exception.PO_ID))
            {
                objException.Err_code    = "O042";
                objException.Updpostatus = "T";
            }
            else
            {
                objException.Err_code = exception.ERR_CODE.Left(1) + "042";

                switch (exception.ERR_CODE.Left(1))
                {
                case "P":
                    objException.Updinvstatus = "T";
                    break;
                }
            }
            objException.Ex_memo = "Missing Modification";
            if (exception.ERR_CODE == "P201")
            {
                objException.Ex_memo = "Mod needed for additional goods: invoice " +
                                       Invoice + " / invoice amount " + InvAmount + " / PO amount " +
                                       POAmount + " / Vend Name " + VendName.ReplaceApostrophes();
            }

            objException.Updstatus = "T";
            if (!String.IsNullOrWhiteSpace(VendName))
            {
                objException.Vendname = VendName;
            }

            objException.AddException();
            var NewEx_id = objException.Ex_id;

            if (!String.IsNullOrWhiteSpace(NewEx_id))
            {
                //Send PO MOD request notificaton
                if (!CheckNotificationExists())
                {
                    InsertNotification();
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public string FinishCode2(string faxNotes, string faxNotes2, string newAddrName, bool Continue)
        {
            var strCuffMemo = NewNote.ReplaceApostrophes();
            var allProcess  = "";

            if (exception.ERR_CODE == "P040" && exception.ERR_CODE == "P041" || exception.ERR_CODE == "P042")
            {
                var rtnNot = GetNotificationByExId(exception.EX_ID);

                var fieldsToUpdate = new List <string>
                {
                    "ADDNAME"
                };

                foreach (var row in rtnNot)
                {
                    row.ADDNAME = newAddrName;
                    UpdateNotification(row, fieldsToUpdate);
                }

                faxNotes  = faxNotes.ReplaceApostrophes();
                faxNotes2 = faxNotes2.ReplaceApostrophes();

                NewNote = DateTime.Now.ShortDate() + " " + PrepCode + " ";
                NewNote = NewNote + faxNotes + "\r\n";

                if (faxNotes != faxNotes2)
                {
                    if (Continue)
                    {
                        fieldsToUpdate = new List <string>
                        {
                            "FAXNOTES"
                        };

                        foreach (var row in rtnNot)
                        {
                            exception.FAXNOTES = faxNotes;
                            UpdateException(exception, fieldsToUpdate);

                            UpdateNotificationByNotKeyIdToPending(row.NOT_KEY_ID, faxNotes);
                        }

                        strCuffMemo = NewNote.ReplaceApostrophes();
                        allProcess  = "Change Notification Fax Note";
                        InsertTranshist(exception, "", strCuffMemo, allProcess, PrepCode);
                    }
                    else
                    {
                        foreach (var row in rtnNot)
                        {
                            UpdateNotificationByNotKeyIdToPending(row.NOT_KEY_ID, "");
                        }
                    }
                }
                else
                {
                    foreach (var row in rtnNot)
                    {
                        UpdateNotificationByNotKeyIdToPending(row.NOT_KEY_ID, "");
                    }
                }

                strCuffMemo = NewNote.ReplaceApostrophes();
                allProcess  = "Send the FAX ASAP";
                InsertTranshist(exception, "", strCuffMemo, allProcess, PrepCode);
            }

            return("");
        }
        public void FinishCode(string prepCode)
        {
            if (exception.ERR_CODE.Right(3) == "200")
            {
                Report_ID          = "P02";
                ReportForm         = "RequestPO";
                Status             = "Pending";
                notes.returnVal7   = notes.returnVal7.ReplaceNull("").ReplaceApostrophes();
                exception.PREPCODE = prepCode;
                string responsenotes = exception.RESPONSENOTES + "\rPO requested" + "\r" + NewNote.ReplaceApostrophes();
                UpdateException(exception, "Q", notes.returnVal7, notes.returnVal3.ReplaceNull(""), responsenotes, "");

                var objException = new VITAPExceptions();
                objException.ActNum       = exception.ACT;
                objException.Po_id        = exception.PO_ID;
                objException.Pdocnopo     = exception.PDOCNO;
                objException.Rr_id        = exception.RR_ID;
                objException.Ae_id        = exception.AE_ID;
                objException.Err_response = "M";
                objException.PrepCode     = prepCode;

                objException.Inv_key_id = exception.INV_KEY_ID;
                //To avoid creating R041 Exceptions..

                if (!String.IsNullOrWhiteSpace(exception.INV_KEY_ID))
                {
                    objException.Err_code = "P041";

                    if (exception.ERR_CODE != "R200")
                    {
                        objException.Err_code = exception.ERR_CODE.Left(1) + "041";
                    }

                    objException.Ex_memo = "No PO in VITAP";

                    objException.Updinvstatus = "T";

                    if (!String.IsNullOrWhiteSpace(exception.VENDNAME))
                    {
                        objException.Vendname = exception.VENDNAME;
                    }

                    objException.AddException();

                    string newExId = "";

                    if (String.IsNullOrWhiteSpace(newExId))
                    {
                        var    rtnExc = GetExceptionByInvKeyID(exception.INV_KEY_ID);
                        string exId   = "";
                        foreach (var row in rtnExc)
                        {
                            if (row.ERR_CODE.Right(3) == "041")
                            {
                                exId = row.EX_ID;
                                break;
                            }
                        }
                        if (String.IsNullOrWhiteSpace(exId))
                        {
                            exId = newExId;
                        }
                    }
                }
                else
                {
                    Report_ID  = "F02";
                    ReportForm = "poreq";
                }

                if (!CheckNotificationExists())
                {
                    var Address = GetAddressFromInvoice(exception.INV_KEY_ID);
                    var rtnInv  = GetPegasysInvoiceByKey(exception.INV_KEY_ID);
                    RequestNo  = "";
                    Contact_ID = "";
                    Amount     = rtnInv.AMOUNT.Value;
                    var Search = Address;
                    InsertNotification();
                }
            }
        }
        /// <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");
        }