public ActionResult ReverseRecord(GLInitialRepo GLRepo)
        {
            try
            {
                if (GLRepo.TID < 1)
                {
                    X.Mask.Hide();
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! No Transaction has been selected for reversal.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                //if (string.IsNullOrEmpty(GLRepo.Reversal_Reason))
                //{
                //    X.Mask.Hide();
                //    X.Msg.Show(new MessageBoxConfig
                //    {
                //        Title = "Error",
                //        Message = "Please enter reason for reversal.",
                //        Buttons = MessageBox.Button.OK,
                //        Icon = MessageBox.Icon.ERROR,
                //        Width = 350
                //    });
                //    return this.Direct();
                //}


                ///approve pending purchases
                GLRepo.Reverse_Initial(GLRepo);

                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "Initial GL Transaction Successfully Reversed.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                ClearControls_Reversal();
                Store store = X.GetCmp <Store>("InitialReversal_Store");
                store.Reload();

                return(this.Direct());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult ApproveRecord(GLInitialRepo GLRepo)
        {
            try
            {
                if (GLRepo.TID < 1)
                {
                    X.Mask.Hide();
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! No Transaction has been selected for approval.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }


                ///approve pending purchases
                GLRepo.Approve_Initial(GLRepo);

                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "GL Initial Transaction Successfully Approved.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                //ClearControls_Approve();
                //Store store = X.GetCmp<Store>("InitialApprove_Store");
                //store.Reload();

                //return this.Direct();

                var pvr = new Ext.Net.MVC.PartialViewResult
                {
                    ViewName    = "GLInitialApprovePartial",
                    ContainerId = "MainArea",
                    RenderMode  = RenderMode.AddTo,
                };
                this.GetCmp <TabPanel>("MainArea").SetLastTabAsActive();
                return(pvr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult ApproveRecord(GLInitialRepo GLRepo)
        {
            try
            {
                if (GLRepo.TID < 1)
                {
                    X.Mask.Hide();
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! No Transaction has been selected for approval.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }


                ///approve pending purchases
                GLRepo.Approve_Initial(GLRepo);

                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "GL Initial Transaction Successfully Approved.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                ClearControls_Approve();
                Store store = X.GetCmp <Store>("InitialApprove_Store");
                store.Reload();

                return(this.Direct());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult SaveRecord(GLInitialRepo GLRepo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    GLRepo.SaveRecord(GLRepo);

                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Success",
                        Message = "Initial GL Amount Successfully Processed.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    //ClearControls();
                    //Store store = X.GetCmp<Store>("GLInitialStore");
                    //store.Reload();
                    //return this.Direct();
                    var pvr = new Ext.Net.MVC.PartialViewResult
                    {
                        ViewName    = "GLInitialCreatePartial",
                        ContainerId = "MainArea",
                        RenderMode  = RenderMode.AddTo,
                    };
                    this.GetCmp <TabPanel>("MainArea").SetLastTabAsActive();
                    return(pvr);
                }
                else
                {
                    string messages = string.Join(Environment.NewLine, ModelState.Values
                                                  .SelectMany(x => x.Errors)
                                                  .Select(x => x.ErrorMessage));
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = messages, // " Insufficient data. Operation Aborted",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }
            }
            catch (Exception ex)
            {
                string ora_code = ex.Message.Substring(0, 9);
                if (ora_code == "ORA-20000")
                {
                    ora_code = "Record already exist. Process aborted..";
                }
                else if (ora_code == "ORA-20100")
                {
                    ora_code = "Not all records are supplied. Process aborted..";
                }
                else
                {
                    ora_code = ex.ToString();
                }
                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Error",
                    Message = ora_code,
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                //log.Write(level: Serilog.Events.LogEventLevel.Information, messageTemplate: ex.Message + " " + DateTime.Now);
                return(this.Direct());
            }
        }