Пример #1
0
        public JSON GenerateFieldWorkAuthorizationMemo(FieldWorkAuthMemo 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() + "Field Work Authorization Memorandum.docx", FormController.ServerPathTempForms() + Param.FileName + ".docx");

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

                Dictionary <string, string> bookmarks = new Dictionary <string, string> {
                    { "ToName", GenFunct.ToTitleCase($"{Param.Employee.EmployeeFirstName} {Param.Employee.EmployeeMiddleName}. {Param.Employee.EmployeeLastName} {Param.Employee.EmployeeSuffix}") },
                    { "ToPosition", Param.Position.PositionDescription },
                    { "Subject", Param.Subject },
                    { "Date", Param.Date },
                    { "DateOfFW", Param.DateOfFieldWork },
                    { "TimeOfFW", $"{DateTime.Parse(Param.FromTimeOfFiedWork).ToString(@"hh\:mm tt")} to {DateTime.Parse(Param.ToTimeOfFiedWork).ToString(@"hh\:mm tt")}" },
                    { "ProceedDirectlyFromResidence", Param.ProceedDirectlyFromResidence },
                    { "PersonToSee", GenFunct.ToTitleCase($"{Param.PersonToSee.FirstName} {Param.PersonToSee.MiddleName}. {Param.PersonToSee.LastName} {Param.PersonToSee.Suffix}") },
                    { "OfficeBusinessName", Param.OfficeBusinessName },
                    { "CompleteAddress", Param.CompleteAddress },
                    { "Purpose", Param.Purpose },
                    { "OtherInstruction", Param.OtherInstruction },
                };

                FormToWord.ApplyDataToBookmark(bookmarks, doc);

                doc.Save();
                doc.ExportAsFixedFormat(FormController.ServerPathTempForms() + Param.FileName + ".pdf", WdExportFormat.wdExportFormatPDF);
                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);
        }
Пример #2
0
        public JSON GenerateJobOfferForSupervisoryAndRankAndFile(JobOfferForOfficer 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() + "Job Offer For Supervisory And Rank & File.docx", FormController.ServerPathTempForms() + Param.Filename + ".docx");

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

                Dictionary <string, string> bookmarks = new Dictionary <string, string> {
                    { "Date", Param.Date },
                    { "PersonName", GenFunct.ToTitleCase($"{Param.PersonName.FirstName} {Param.PersonName.MiddleName}. {Param.PersonName.LastName} {Param.PersonName.Suffix}") },
                    { "PositionTitle", Param.Position.PositionDescription },
                    { "SalaryGrade", $"{Param.SalaryGrade} / {Param.SalaryGradeStep}" },
                    { "MonthlySalary", Param.MonthlySalary },
                    { "GroupUnit", Param.GroupUnit },
                    { "StartDate", Param.StartDate },
                    { "WorkIn", Param.WorkIn },
                    { "WorkOut", Param.WorkOut },
                };

                FormToWord.ApplyDataToBookmark(bookmarks, doc);

                doc.Save();
                doc.ExportAsFixedFormat(FormController.ServerPathTempForms() + Param.Filename + ".pdf", WdExportFormat.wdExportFormatPDF);
                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 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);
        }
Пример #4
0
        public JSON GeneratePurchaseRequest(PurchaseRequest 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() + "Purchase Request.docx", FormController.ServerPathTempForms() + Param.FileName + ".docx");

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

                Dictionary <string, string> bookmarks = new Dictionary <string, string> {
                    { "GroupUnit", Param.GroupUnit.GroupUnitDescription },
                    { "Date", Param.Date },
                    { "Purpose", Param.Purpose },
                    { "Attachments", Param.Attachments }
                };

                Table PurchaseItemRequest = doc.Tables[2];

                int TableRowCount = PurchaseItemRequest.Rows.Count;

                int itemCount = Param.Items.Count;

                for (int i = 0; i <= TableRowCount; i++)
                {
                    int row = i + 2;
                    PurchaseItemRequest.Cell(row, 1).Range.Text = Param.Items[i].Quantity.ToString();
                    PurchaseItemRequest.Cell(row, 2).Range.Text = Param.Items[i].Unit.ToString();
                    PurchaseItemRequest.Cell(row, 3).Range.Text = Param.Items[i].ItemDescription.ToString();
                    PurchaseItemRequest.Cell(row, 4).Range.Text = Param.Items[i].EstimatedUnitCost.ToString();
                    PurchaseItemRequest.Cell(row, 5).Range.Text = Param.Items[i].EstimatedCost.ToString();

                    itemCount = itemCount - 1;

                    if (itemCount == 0)
                    {
                        break;
                    }
                }

                FormToWord.ApplyDataToBookmark(bookmarks, doc);

                doc.Save();
                doc.ExportAsFixedFormat(FormController.ServerPathTempForms() + Param.FileName + ".pdf", WdExportFormat.wdExportFormatPDF);
                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 JSON GenerateWebsiteJobRequest(WebsiteJobRequest 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() + "Website Job Request Form.docx", FormController.ServerPathTempForms() + Param.FileName + ".docx");

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

                Dictionary <string, string> bookmarks = new Dictionary <string, string> {
                    { "RequestedBy", GenFunct.ToTitleCase($"{Param.RequestedBy.EmployeeFirstName} {Param.RequestedBy.EmployeeMiddleName}. {Param.RequestedBy.EmployeeLastName} {Param.RequestedBy.EmployeeSuffix}") },
                    { "ConfirmedBy", GenFunct.ToTitleCase($"{Param.ConfirmedBy.EmployeeFirstName} {Param.ConfirmedBy.EmployeeMiddleName}. {Param.ConfirmedBy.EmployeeLastName} {Param.ConfirmedBy.EmployeeSuffix}") },
                };

                Table JobRequestContents = doc.Tables[1];

                int TableRowCount = JobRequestContents.Rows.Count;

                int itemCount = Param.WebsiteContentRequest.Count;

                for (int i = 0; i <= TableRowCount; i++)
                {
                    int row = i + 2;

                    JobRequestContents.Cell(row, 1).Range.Text = Param.WebsiteContentRequest[i].ContentRequest.ToString();
                    JobRequestContents.Cell(row, 2).Range.Text = Param.WebsiteContentRequest[i].Comments.ToString();

                    itemCount = itemCount - 1;

                    if (itemCount == 0)
                    {
                        break;
                    }
                }

                FormToWord.ApplyDataToBookmark(bookmarks, doc);

                doc.Save();
                doc.ExportAsFixedFormat(FormController.ServerPathTempForms() + Param.FileName + ".pdf", WdExportFormat.wdExportFormatPDF);
                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);
        }
Пример #6
0
        public JSON GenerateITAccessRequest(ITAccessRequest 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() + "IT Access Request.docx", FormController.ServerPathTempForms() + Param.FileName + ".docx");

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

                Dictionary <string, string> bookmarks = new Dictionary <string, string> {
                    { "EmployeeName", GenFunct.ToTitleCase($"{Param.Employee.EmployeeFirstName} {Param.Employee.EmployeeMiddleName}. {Param.Employee.EmployeeLastName} {Param.Employee.EmployeeSuffix}") },
                    { "EmployeeCode", Param.Employee.EmployeeCode.ToString() },
                    { "Position", Param.Position.PositionDescription },
                    { "GroupUnit", Param.GroupUnit.GroupUnitDescription },
                };

                if (Param.LLFCEmail.Selected == 1)
                {
                    IfYes(bookmarks, "LLFCEmailYes", "LLFCEmailRemarks", Param.LLFCEmail.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "LLFCEmailNo", "LLFCEmailRemarks", Param.LLFCEmail.Remarks);
                }
                if (Param.Internet.Selected == 1)
                {
                    IfYes(bookmarks, "InternetYes", "InternetRemarks", Param.Internet.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "InternetNo", "InternetRemarks", Param.Internet.Remarks);
                }
                if (Param.MainEntrance.Selected == 1)
                {
                    IfYes(bookmarks, "MainEntranceYes", "MainEntranceRemarks", Param.MainEntrance.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "MainEntranceNo", "MainEntranceRemarks", Param.MainEntrance.Remarks);
                }
                if (Param.SecurityRoom.Selected == 1)
                {
                    IfYes(bookmarks, "SecurityRoomYes", "SecurityRoomRemarks", Param.SecurityRoom.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "SecurityRoomNo", "SecurityRoomRemarks", Param.SecurityRoom.Remarks);
                }
                if (Param.ServerRoom.Selected == 1)
                {
                    IfYes(bookmarks, "ServerRoomYes", "ServerRoomRemarks", Param.ServerRoom.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "ServerRoomNo", "ServerRoomRemarks", Param.ServerRoom.Remarks);
                }
                if (Param.PrinterBlackCopy.Selected == 1)
                {
                    IfYes(bookmarks, "PrinterBlackYes", "PrinterBlackRemarks", Param.PrinterBlackCopy.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "PrinterBlackNo", "PrinterBlackRemarks", Param.LLFCEmail.Remarks);
                }
                if (Param.PrinterColoredCopy.Selected == 1)
                {
                    IfYes(bookmarks, "PrinterColoredYes", "PrinterColoredRemarks", Param.PrinterColoredCopy.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "PrinterColoredNo", "PrinterColoredRemarks", Param.PrinterColoredCopy.Remarks);
                }
                if (Param.Telephone.Selected == 1)
                {
                    IfYes(bookmarks, "TelephoneYes", "TelephoneRemarks", Param.Telephone.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "TelephoneNo", "TelephoneRemarks", Param.Telephone.Remarks);
                }
                if (Param.Biometrics.Selected == 1)
                {
                    IfYes(bookmarks, "BiometricsYes", "BiometricsRemarks", Param.Biometrics.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "BiometricsNo", "BiometricsRemarks", Param.Biometrics.Remarks);
                }
                if (Param.Jeonsoft.Selected == 1)
                {
                    IfYes(bookmarks, "JPSYes", "JPSRemarks", Param.Jeonsoft.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "JPSNo", "JPSRemarks", Param.Jeonsoft.Remarks);
                }
                if (Param.DMS.Selected == 1)
                {
                    IfYes(bookmarks, "DMSYes", "DMSRemarks", Param.DMS.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "DMSNo", "DMSRemarks", Param.DMS.Remarks);
                }
                if (Param.FMS.Selected == 1)
                {
                    IfYes(bookmarks, "FMSYes", "FMSRemarks", Param.FMS.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "FMSNo", "FMSRemarks", Param.FMS.Remarks);
                }
                if (Param.Jet.Selected == 1)
                {
                    IfYes(bookmarks, "JetReportsYes", "JetReportsRemarks", Param.Jet.Remarks);
                }
                else
                {
                    IfYes(bookmarks, "JetReportsNo", "JetReportsRemarks", Param.Jet.Remarks);
                }

                FormToWord.ApplyDataToBookmark(bookmarks, doc);

                doc.Save();
                doc.ExportAsFixedFormat(FormController.ServerPathTempForms() + Param.FileName + ".pdf", WdExportFormat.wdExportFormatPDF);
                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);
        }
Пример #7
0
        public JSON GenerateITIssuance(ITIssuance 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() + "IT Issuance.docx", FormController.ServerPathTempForms() + Param.FileName + ".docx");

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

                Dictionary <string, string> bookmarks = new Dictionary <string, string> {
                    { "ControlNumber", Param.ControlNumber },
                    { "Date", Param.Date },
                    { "IssuedTo", GenFunct.ToTitleCase($"{Param.EmployeeFullName.EmployeeFirstName} {Param.EmployeeFullName.EmployeeMiddleName}. {Param.EmployeeFullName.EmployeeLastName} {Param.EmployeeFullName.EmployeeSuffix}") },
                    { "Unit", Param.GroupUnit.GroupUnitDescription },
                };

                Table EquipmentSpec = doc.Tables[2];

                int TableRowCount = EquipmentSpec.Rows.Count;

                int itemCount = Param.EquipmentSpecification.Count;

                for (int i = 0; i <= TableRowCount; i++)
                {
                    int row = i + 2;
                    EquipmentSpec.Cell(row, 1).Range.Text = Param.EquipmentSpecification[i].Quantity.ToString();
                    EquipmentSpec.Cell(row, 2).Range.Text = Param.EquipmentSpecification[i].Unit.ToString();
                    EquipmentSpec.Cell(row, 3).Range.Text = Param.EquipmentSpecification[i].Particulars.ToString();
                    EquipmentSpec.Cell(row, 4).Range.Text = Param.EquipmentSpecification[i].AcquisitionCost.ToString();
                    EquipmentSpec.Cell(row, 5).Range.Text = Param.EquipmentSpecification[i].PropertyNumber.ToString();

                    itemCount = itemCount - 1;

                    if (itemCount == 0)
                    {
                        break;
                    }
                }

                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);
        }