public JSON GenerateRequestForPayment(RequestForPayment Param)
        {
            JSON returnJSON = new JSON();

            Application app      = new Application();
            object      misValue = System.Reflection.Missing.Value;

            if (File.Exists(FormController.ServerPathTempForms() + Param.FileName + ".docx"))
            {
                File.Delete(FormController.ServerPathTempForms() + Param.FileName + ".docx");
            }

            try
            {
                File.Copy(FormController.ServerPathFormsTemplate() + "Request for Payment.docx", FormController.ServerPathTempForms() + Param.FileName + ".docx");

                Document doc = app.Documents.Open(FormController.ServerPathTempForms() + Param.FileName + ".docx");

                Dictionary <string, string> bookmarks = new Dictionary <string, string> {
                    { "RequestDate", Param.RequestDate },
                    { "Payee", Param.Payee },
                    { "AmountInWords", $"{NumberToText.Convert(Param.AmountInValue)} Pesos" },
                    { "AmountInValue", "₱ " + String.Format("{0:n}", Param.AmountInValue) },
                    { "Purpose", Param.Purpose },
                    { "DueDate", Param.DueDate },
                    { "PreparedBy", GenFunct.ToTitleCase($"{Param.PreparedBy.FirstName} {Param.PreparedBy.MiddleName}. {Param.PreparedBy.LastName} {Param.PreparedBy.Suffix}") },
                    { "FormOfPayment", GetFormOfPaymentDescription(Param.FormOfPaymentID, Param.OtherFormOfPayment) },
                    //{ "OtherFormOfPayment", Param.OtherFormOfPayment },
                    { "RecommendedBy", GenFunct.ToTitleCase($"{Param.RecommendedBy.FirstName} {Param.RecommendedBy.MiddleName}. {Param.RecommendedBy.LastName} {Param.RecommendedBy.Suffix}") }
                };

                FormToWord.ApplyDataToBookmark(bookmarks, doc);

                doc.Save();
                doc.Close();

                app.Quit();

                LLFCForm LLFCFormObj = new LLFCForm();
                LLFCFormObj.FormDownloadFile = Param.FileName;

                returnJSON.FormData = LLFCFormObj;
            }
            catch (Exception ex)
            {
                app.Quit();
                returnJSON.Message = $"Error Occured: {ex.Message}";
            }

            return(returnJSON);
        }
        public IHttpActionResult GenerateRequestForPayment(RequestForPayment Param)
        {
            JSON returnJSON = new JSON();

            try
            {
                RequestForPaymentClass requestForPaymentClass = new RequestForPaymentClass();

                returnJSON = requestForPaymentClass.GenerateRequestForPayment(Param);

                var response = ResponseMessage(Response(returnJSON.FormData.FormDownloadFile));

                return(response);
            }
            catch (Exception ex)
            {
                returnJSON.Message = ex.Message;
                return(Json(returnJSON));
            }
        }