2401 lines
136 KiB
C#
2401 lines
136 KiB
C#
using Ease.Core.Model;
|
|
using iTextSharp.text;
|
|
using iTextSharp.text.html.simpleparser;
|
|
using iTextSharp.text.pdf;
|
|
using NPOI.SS.Formula.Functions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Diagnostics.Metrics;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Reflection;
|
|
using static NPOI.POIFS.Crypt.Dsig.SignatureInfo;
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
|
|
[Serializable]
|
|
public class BusinessTemplateBuilder : BasicBaseObject
|
|
{
|
|
const string ProbationAssessment = "LetterTempletes/Probation_Assessment_Confirmation.html";
|
|
private static string _letterRequestfilePath = @"ClientApp\Documents\";
|
|
public string templateDesktopBasePath = null;
|
|
public string logoPath = null;
|
|
public BusinessTemplateBuilder(bool IsWeb = true)
|
|
{
|
|
if (IsWeb)
|
|
{
|
|
//templateBasePath = System.Web.HttpContext.Current.Server.MapPath("~/Claim/");
|
|
//templateDesktopBasePath = System.Web.HttpContext.Current.Server.MapPath("~/");
|
|
//logoPath = System.Web.HttpContext.Current.Server.MapPath("~/Images/TemplateLogo.png");
|
|
//signaturepath = System.Web.HttpContext.Current.Server.MapPath("~/Images/");
|
|
}
|
|
else
|
|
{
|
|
//templateBasePath = Application.StartupPath + "\\";
|
|
//logoPath = Application.StartupPath + "\\Images\\TemplateLogo.png";
|
|
//signaturepath = Application.StartupPath + "\\Images\\";
|
|
}
|
|
}
|
|
#region declarations
|
|
PMPProcess ps = null;
|
|
HRRequest _hrRequest = null;
|
|
//PMPIncrementSimulation pmpIncrement = null;
|
|
//CorporateKPIDistribution corporateKPI = null;
|
|
//ObjectsTemplate<SalesEmployee> _salesEmps = null;
|
|
//ObjectsTemplate<PromotionHistory> _promotionHistorys = null;
|
|
HREmployee oHrEmployee = null;
|
|
int pmpYearID = 0;
|
|
Grade oGrade = null;
|
|
Grade oNewGrade = null;
|
|
List<ADParameter> oADParams = null;
|
|
List<AllowanceDeduction> oAllowDeductBasics = null;
|
|
AllowanceDeduction oAllowDeduct = null;
|
|
ADParameter oADParameter = null;
|
|
double grossSalary = 0;
|
|
double basicSalary = 0;
|
|
double houseRent = 0;
|
|
double conveyance = 0;
|
|
double medical = 0;
|
|
double passageFreeTravel = 0;
|
|
|
|
//PMPIncrementSimulation incrementData = null;
|
|
//CorporateKPIDistribution bonusData = null;
|
|
|
|
public const int BasicSalaryItemID = -101;
|
|
public const int HouseRentItemID = 2;
|
|
public const int ConveyanceItemID = 61;
|
|
public const int MedicalItemID = 60;
|
|
public const int PassageFreeTravelItemID = 62;
|
|
Dictionary<string, string> _specialMTEmpNoMapper = new Dictionary<string, string>
|
|
{
|
|
{"8173","12835" },
|
|
{"8605","12835" },
|
|
{"8644","12835" },
|
|
{"8805","12636" },
|
|
{"10112","12835" },
|
|
{"10215","12835" },
|
|
{"10646","12844" },
|
|
{"10789","12844" },
|
|
{"10830","12835" },
|
|
{"10926","12835" },
|
|
{"12124","12584" },
|
|
{"12339","12844" },
|
|
{"12529","12844" },
|
|
{"12596","12835" },
|
|
{"12703","12835" },
|
|
{"12742","12835" }
|
|
|
|
};
|
|
|
|
string templateBasePath, signaturepath;
|
|
|
|
List<LetterRequest> _letterRequests = null;
|
|
LetterRequest _letterRequest = new LetterRequest();
|
|
#endregion
|
|
|
|
#region constants
|
|
|
|
|
|
const string headerTemplatePath = "LetterTempletes/TemplateHeader.html";
|
|
const string footerTemplatePath = "LetterTempletes/TemplateFooter.html";
|
|
const string SignatureTemplatePath = "LetterTempletes/SignatureTemplate.html";
|
|
const string SignatureTemplateRightPath = "LetterTempletes/SignatureTemplateRight.html";
|
|
const string travelNOCPersonalWithFamilyTemplatePath = "LetterTempletes/TravelNOCPersonalWithFamily.html";
|
|
const string travelNOCPersonalWithoutFamilyTemplatePath = "LetterTempletes/NOC Single Personal Trip.html";
|
|
const string insuranceVisaPersonalTripTemplatePath = "LetterTempletes/NOC Single Personal Trip.html";
|
|
const string resignationLetterTemplatePath = "LetterTempletes/Resignation Letter With Notice Period.html";
|
|
const string experienceCertificateTemplatePath = "LetterTempletes/ExperienceCertificate.html";
|
|
const string employmentCertificateTemplatePath = "LetterTempletes/EmploymentCertificate.html";
|
|
|
|
const string letterRequestNoc = "LetterTempletes/NOC.html";
|
|
const string letterRequestBusinessLetter = "LetterTempletes/Business Letter.html";
|
|
const string letterRequestEmploymentCertificate = "LetterTempletes/Employment Certificate.html";
|
|
const string letterRequestEmploymentCerWithJd = "LetterTempletes/Employment Certificate with JD.html";
|
|
const string letterRequestSalaryCertificate = "LetterTempletes/Salary.html";
|
|
|
|
const string letterRequestNocToWhomItMayConcern = "LetterTempletes/NOC_To Whom it may concern.html";
|
|
const string letterRequestSalaryTemplateToWhomItMayConcern = "LetterTempletes/Salary template_to whom it may concern.html";
|
|
const string letterRequestEmploymentCertificateToWhomItMayConcern = "LetterTempletes/Employment Certificate_to whom it may concern.html";
|
|
const string letterRequestExperienceCertificate = "LetterTempletes/Experience_letter_new.html";
|
|
|
|
const string apbTemplatePath = "LetterTempletes/APB.html";
|
|
const string apbTemplatePathOld = "LetterTempletes/APBOld.html";
|
|
const string apbTemplatePathNew = "LetterTempletes/APBNew.html";
|
|
const string apbTemplatePath2020 = "LetterTempletes/APBNew2020.html";
|
|
const string apbTemplatePath2021 = "LetterTempletes/APBNew2021.html";
|
|
|
|
const string apbIncrementTemplatePath = "LetterTempletes/Annual_Increment.html";
|
|
const string apbIncrementTemplatePathNew = "LetterTempletes/Annual_IncrementNew.html";
|
|
const string apbIncrementTemplatePathHRNew = "LetterTempletes/Annual_IncrementHRNew.html";
|
|
const string apbIncrementTemplatePathHR = "LetterTempletes/Annual_Increment_HR.html";
|
|
const string apbPromotionTemplatePath = "LetterTempletes/Annual_Promotion.html";
|
|
const string apbPromotionTemplatePathNew = "LetterTempletes/Annual_PromotionNew.html";
|
|
const string apbPromotionTemplatePathHRNew = "LetterTempletes/Annual_PromotionHRNew.html";
|
|
const string apbPromotionTemplatePathHR = "LetterTempletes/Annual_Promotion_HR.html";
|
|
const string releaseLetter = "LetterTempletes/Release letter.html";
|
|
|
|
const string headerTag = "{{HEADER}}";
|
|
const string footerTag = "{{FOOTER}}";
|
|
const string signatureTag = "{{Signature}}";
|
|
const string signatureCHRTag = "{{CHRSignature}}";
|
|
const string logoTag = "{{LOGO}}";
|
|
const string sealTag = "{{SEAL}}";
|
|
const string sealupTag = "{{SEALUP}}";
|
|
const string sealdownTag = "{{SEALDOWN}}";
|
|
const string authSignTag = "{{AUTHSIGN}}";
|
|
const string employeeNoTag = "{{EMPLOYEENO}}";
|
|
const string currentDateTag = "{{CURRENTDATE}}";
|
|
const string salutaTionTag = "{{SALUTATION}}";
|
|
const string fullNameTag = "{{FULLNAME}}";
|
|
const string lastNameTag = "{{LASTNAME}}";
|
|
const string joiningDate = "{{EMPLOYEEJOININGDATE}}";
|
|
const string capitalGenderTemplatePassiveTag = "{{HISHER}}";
|
|
const string lowerGenderTemplatePassiveTag = "{{hisher}}";
|
|
const string designationTag = "{{EMPLOYEEDESIG}}";
|
|
const string departmentTag = "{{EMPLOYEEDEPT}}";
|
|
const string functionTag = "{{EMPLOYEEFUNCTION}}";
|
|
const string capitalGenderTemplateActiveTag = "{{HESHE}}";
|
|
const string lowerGenderTemplateActiveTag = "{{heshe}}";
|
|
const string signatoryNameTag = "{{SIGNATORYNAME}}";
|
|
const string signatoryDesignationTag = "{{SIGNATORYDESIGNATION}}";
|
|
const string countryTag = "{{COUNTRY}}";
|
|
const string fromDateTag = "{{FROMDATE}}";
|
|
const string toDateTag = "{{TODATE}}";
|
|
const string visitTypeTag = "{{VISITTYPE}}";
|
|
const string embassyNameTag = "{{NAMEOFEMBASSY}}";
|
|
const string embassyAddressTag = "{{ADDRESSOFEMBASSY}}";
|
|
const string passportNoTag = "{{PASSPORTNO}}";
|
|
const string familyInfoTableTag = "{{FAMILYINFOTABLE}}";
|
|
const string annualProratedSalaryTag = "{{PRORATEDSALARY}}";
|
|
const string maximumEligibilityTag = "{{MAXIMUMELIGIBILITY}}";
|
|
const string totalDaysTag = "{{TOTALDAYS}}";
|
|
const string personalSplitTag = "{{PERSONALSPLIT}}";
|
|
const string corporateSplitTag = "{{CORPORATESPLIT}}";
|
|
const string personalKPITag = "{{PERSONALKPI}}";
|
|
const string corporateKPITag = "{{CORPORATEKPI}}";
|
|
const string personalAmountTag = "{{PERSONALAMOUNT}}";
|
|
const string corporateAmountTag = "{{CORPORATEAMOUNT}}";
|
|
const string totalBonusAmountTag = "{{TOTALBONUSAMOUNT}}";
|
|
const string bonusMultiplierTag = "{{BONUSMULTIPLIER}}";
|
|
const string netBonusAmountTag = "{{NETBONUSAMOUNT}}";
|
|
const string incrementPercentTag = "{{INCREMENTPERCENT}}";
|
|
const string basicSalaryTag = "{{BASICSALARY}}";
|
|
const string houseRentTag = "{{HOUSERENT}}";
|
|
const string conveyanceTag = "{{CONVEYANCE}}";
|
|
const string medicalTag = "{{MEDICAL}}";
|
|
const string passageFreeTravelTag = "{{PASSAGEFREETRAVEL}}";
|
|
const string grossSalaryTag = "{{GROSSSALARY}}";
|
|
const string deduction = "{{DEDUCTION}}";
|
|
const string hodTag = "{{HOD}}";
|
|
const string hodDesignationTag = "{{HODDESIGNATION}}";
|
|
const string chrTag = "{{CHR}}";
|
|
const string chrDesignationTag = "{{CHRDESIGNATION}}";
|
|
const string hodFunctionTag = "{{HODFUNCTION}}";
|
|
const string newBandCodeTag = "{{NEWBANDCODE}}";
|
|
const string newBandNameTag = "{{NEWBANDNAME}}";
|
|
|
|
const string newJobTitleTag = "{{NEWJOBTITLE}}";
|
|
const string newDivisionTag = "{{NEWDIVISION}}";
|
|
const string yearTag = "{{YEAR}}";
|
|
const string appYearTag = "{{APPYEAR}}";
|
|
const string previousYear = "{{PREVIOUSYEAR}}";
|
|
const string incORrPro = "{{INCREMENTORPROMOTIONPERCENT}}";
|
|
const string pfContributon = "{{PFCONTRIBUTION}}";
|
|
const string pfLoanDeduction = "{{PFLOANDEDUCTION}}";
|
|
const string organization = "{{ORGANIZATION}}";
|
|
const string concernedPerson = "{{CONCERNPERSON}}";
|
|
#endregion
|
|
|
|
const string _revenueTarget = "{{REVENUETARGET}}";
|
|
const string _revenueAchieve = "{{REVENUEACHIEVE}}";
|
|
|
|
const string _ebitdaTarget = "{{EBITDATARGET}}";
|
|
const string _ebitdaAchieve = "{{EBITDAACHIEVE}}";
|
|
|
|
const string _cashflowTarget = "{{CASHTARGET}}";
|
|
const string _cashflowAchieve = "{{CASHACHIEVE}}";
|
|
|
|
const string _costintensityTarget = "{{COSTINTENSITYTARGET}}";
|
|
const string _costintensityAchieve = "{{COSTINTENSITYACHIEVE}}";
|
|
const string _totalAchieve = "{{TOTALACHIEVEMENT}}";
|
|
|
|
const string visitPurpose = "{{VISITPURPOSE}}";
|
|
const string companySealTag = "{{COMPANYSEAL}}";
|
|
|
|
//newly added
|
|
//NOC
|
|
const string _referenceNo = "{{REF NO}}";
|
|
const string _currentDate = "{{CURRENTDATE}}";
|
|
const string _embassyName = "{{EMBASSYNAME}}";
|
|
const string _embassyPersonel = "{{EMBASSYPERSONEL}}";///
|
|
const string _embassyAddress1 = "{{EMBASSYADDRESS1}}";
|
|
const string _embassyAddress2 = "{{EMBASSYADDRESS2}}";
|
|
const string _embassyAddress3 = "{{EMBASSYADDRESS3}}";
|
|
const string _fullName = "{{FULLNAME}}";
|
|
const string _employeeNO = "{{EMPLOYEENO}}";
|
|
const string _empNO = "{{EMPNO}}";
|
|
const string _employeeJoiningDate = "{{EMPLOYEEJOININGDATE}}";
|
|
const string _employeebdpoJoiningDate = "{{BDPOJOININGDATE}}";
|
|
const string _employmentType = "{{EMPLOYMENTTYPE}}";
|
|
const string _heOrShe = "{{HeShe}}";
|
|
const string _heshe = "{{heshe}}";
|
|
const string _employeeDesignation = "{{EMPLOYEEDESIG}}";
|
|
const string _employeeDept = "{{EMPLOYEEDEPT}}";
|
|
const string _salutation = "{{SALUTATION}}";
|
|
const string _lastName = "{{LASTNAME}}";
|
|
const string _leaveFromDate = "{{LEAVEFROMDATE}}";
|
|
const string _leaveToDate = "{{LEAVETODATE}}";
|
|
const string _passsportNo = "{{PASSPORTNO}}";
|
|
const string _headHrName = "{{HEADHRNAME}}";
|
|
const string _headHrDesignation = "{{HEADHRDESIG}}";
|
|
const string _headHrDepartment = "{{HEADHRDEPT}}";
|
|
const string _headHrMail = "{{HEADHREMAIL}}";
|
|
const string _headHrMobile = "{{HEADHRMOBILE}}";
|
|
const string _signature = "{{SIGNATURE}}";
|
|
|
|
//Business Letter
|
|
const string _visaType = "{{visatype}}";
|
|
const string _countryToVisit = "{{COUNTRYTOVISIT}}";
|
|
const string _conferenceName = "{{conferrencename}}";
|
|
const string _organizer = "{{Organizer}}";
|
|
const string _hostingCity = "{{Hostingcity}}";
|
|
const string _conferenceStartDate = "{{conferrencestartdate}}";
|
|
const string _conferenceEndDate = "{{conferrenceenddate}}";
|
|
const string _nationality = "{{NATIONALITY}}";
|
|
const string _passportIssueDate = "{{Passportissuedate}}";
|
|
const string _passportExpiryDate = "{{Passportexpiredate}}";
|
|
const string _heSheEr = "{{hisher}}";
|
|
const string _HisHer = "{{HisHer}}";
|
|
const string _himOrher = "{{himher}}";
|
|
const string _countryTag = "{{COUNTRY}}";
|
|
|
|
//Employment Certificate
|
|
const string _officeName = "{{Office Name}}";
|
|
const string _officeAddress1 = "{{Address}}";
|
|
const string _officeAddress2 = "{{Address}}";
|
|
const string _officeAddress3 = "{{Address}}";
|
|
const string _employeeGrade = "{{EMPLOYEEGRADE}}";
|
|
const string _responsibilities = "{{RESPONSIBILITIES}}";
|
|
|
|
//Salary Certificate
|
|
const string _bankEmpDesignation = "{{BankempDesignation}}";
|
|
const string _bank = "{{Bank}}";
|
|
const string _bankLocation = "{{BankLocation}}";
|
|
const string _empBirthDate = "{{EMPBirthDate}}";
|
|
const string _empDivision = "{{Empdivision}}";
|
|
const string _basic = "{{basic}}";
|
|
const string _houseRent = "{{hrent}}";
|
|
const string _conveyance = "{{conveyance}}";
|
|
const string _passageFreeTravel = "{{PFT}}";
|
|
const string _medical = "{{Medical}}";
|
|
const string _gross = "{{gross}}";
|
|
const string _carAllowance = "{{carallowance}}";
|
|
const string _barcode = "{{BARCODE}}";
|
|
const string currency = "{{CURRENCY}}";
|
|
|
|
//resignation Letter
|
|
const string lmName = "{{LMNAME}}";
|
|
const string lmDesignation = "{{LMDESIGNATION}}";
|
|
const string lmDepartment = "{{LMDEPARTMENT}}";
|
|
const string effectiveDate = "{{RESIGNDATE}}";
|
|
const string lastWorkingDate = "{{LASTWORKINGDATE}}";
|
|
const string lmLastName = "{{LMLASTNAME}}";
|
|
const string lmSalutation = "{{LMSALUTATION}}";
|
|
const string lmEmail = "{{LMEMAIL}}";
|
|
|
|
const string signatoryname = "{{SIGNATORYNAME}}";
|
|
const string signatoryDesignation = "{{SIGNATORYDESIGNATION}}";
|
|
const string signatoryEmail = "{{SIGNATORYEMAIL}}";
|
|
const string signatoryExt = "{{SIGNATORYEXTENSION}}";
|
|
const string signatoryPhone = "{{SIGNATORYPHONE}}";
|
|
|
|
//Visa NOC Personal
|
|
const string businessNocLastLine = "{{_BUSINESSNOCLASTLINE}}";
|
|
const string businessNocMiddleLine = "{{_BUSINESSNOCMIDDLELINE}}";
|
|
|
|
public string CreateLetter(Employee emp, string letterFilePath, string mainPath)
|
|
{
|
|
string filePath = string.Empty;
|
|
string fileName = string.Empty;
|
|
|
|
//PrepareObject(emp);
|
|
filePath = letterFilePath + "Probation_Assessment_Confirmation.pdf";
|
|
fileName = "Probation_Assessment_Confirmation.pdf";
|
|
TransmitTemplate(mainPath);
|
|
|
|
//return filePath + "-----" + fileName;
|
|
return filePath;
|
|
}
|
|
private void TransmitTemplate(string mainPath)
|
|
{
|
|
string templatePath = string.Empty;
|
|
string employmentType = string.Empty;
|
|
templatePath = ProcessTemplateTransmission(2, mainPath);
|
|
}
|
|
private string ProcessTemplateTransmission(int version, string mainPath)
|
|
{
|
|
// PrepareProbationAssessmentLetter(version, mainPath);
|
|
return "Probation_Assessment_Confirmation.pdf";
|
|
}
|
|
//private void PrepareProbationAssessmentLetter(int version, string mainPath)
|
|
//{
|
|
// try
|
|
// {
|
|
// Document document = new Document(PageSize.LETTER, 72f, 72f, 30f, 0f);
|
|
// WebClient wc = new WebClient();
|
|
|
|
// string tempHtmlText = string.Empty;
|
|
|
|
// if (version == 1)
|
|
// {
|
|
// PdfWriter.GetInstance(document, new FileStream(templateBasePath + "TempFolder/" + _oProbationAssessment.EmployeeID + "_Probation_Assessment.pdf", FileMode.Create));
|
|
// document.Open();
|
|
|
|
// tempHtmlText = wc.DownloadString(templateBasePath + ProbationAssessment);
|
|
// }
|
|
// else if (version == 2)
|
|
// {
|
|
// PdfWriter.GetInstance(document, new FileStream(mainPath + "Probation_Assessment_Confirmation.pdf", FileMode.Create));
|
|
// document.Open();
|
|
|
|
// tempHtmlText = wc.DownloadString(templateDesktopBasePath + ProbationAssessment);
|
|
// }
|
|
|
|
// tempHtmlText = PrepareHtmlForPDF(tempHtmlText, "CALIBRI.TTF");
|
|
|
|
// List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(tempHtmlText), null);
|
|
|
|
// for (int k = 0; k < htmlarraylist.Count; k++)
|
|
// document.Add((IElement)htmlarraylist[k]);
|
|
|
|
// document.Close();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw new Exception("Tag Replacement Error in NOC With Personal Letter!!!");
|
|
// }
|
|
//}
|
|
//private string PrepareHtmlForPDF(string tempHtmlText, string v)
|
|
//{
|
|
// FontFactory.FontImp = new FontFactoryImp(); //UnicodeFontFactory(font);
|
|
|
|
// tempHtmlText = ReplacingCommonTagForProbationAssessment(tempHtmlText); ReplaceCommonTag(tempHtmlText);
|
|
|
|
// return tempHtmlText;
|
|
//}
|
|
//private string ReplacingCommonTagForProbationAssessment(string htmlText)
|
|
//{
|
|
// Employee emp = Employee.Get(_oProbationAssessment.EmployeeID);
|
|
// ID id = null;
|
|
// AuthorizedPerson signatory = id != null ? AuthorizedPerson.Get(id) : new AuthorizedPerson();
|
|
|
|
// if (emp != null)
|
|
// {
|
|
// return htmlText.Replace(currentDateTag, DateTime.Today.ToString("dd MMMM yyyy")).
|
|
// Replace(salutaTionTag, emp.Gender == EnumGender.Male ? "Mr." : "Ms.").
|
|
// Replace(fullNameTag, emp.Name).
|
|
// Replace(joiningDate, emp.JoiningDate.ToString("dd MMMM yyyy")).
|
|
// Replace(capitalGenderTemplatePassiveTag, emp.Gender == EnumGender.Male ? "His" : "Her").
|
|
// Replace(lowerGenderTemplatePassiveTag, emp.Gender == EnumGender.Male ? "his" : "her").
|
|
// Replace(designationTag, emp.Designation.Name).
|
|
// Replace(departmentTag, emp.Department.Name).
|
|
// Replace(capitalGenderTemplateActiveTag, emp.Gender == EnumGender.Male ? "He" : "She").
|
|
// Replace(lowerGenderTemplateActiveTag, emp.Gender == EnumGender.Male ? "he" : "she").
|
|
// Replace(signatoryNameTag, signatory.Name).
|
|
// Replace(signatoryDesignationTag, signatory.Designation).
|
|
// Replace(countryTag, "").
|
|
// Replace(fromDateTag, _oProbationAssessment.CreatedDate.ToString("dd MMMM yyyy")).
|
|
// Replace(passportNoTag, new HREmployee().Get(emp.ID).PassportNo);
|
|
// }
|
|
// else
|
|
// return htmlText;
|
|
//}
|
|
//private void PrepareObject(Employee oemp)
|
|
//{
|
|
// string Designation = oemp.Designation.Name;
|
|
// string Department = oemp.Department.Name;
|
|
// Grade grade = Grade.Get(oemp.GradeID);
|
|
// PrepareCommonProperty(oemp.ID, "");
|
|
|
|
//}
|
|
//private void PrepareCommonProperty(ID currentEmpID, string v)
|
|
//{
|
|
// _oProbationAssessment = new ProbationAssessment();
|
|
// _oProbationAssessment.EmployeeID = currentEmpID;
|
|
// _oProbationAssessment.CreatedBy = User.CurrentUser.ID;
|
|
// _oProbationAssessment.CreatedDate = DateTime.Now;
|
|
//}
|
|
//const string _systemDate = "{{System Date}}";
|
|
//const string _systemDate2 = "{{System Date2}}";
|
|
//const string _serialNumberLetter = "{{Serial Number}}";
|
|
|
|
//const string _nameOfSalaryApprover = "{{Name of Salary Approver }}";
|
|
//const string _designationOfSalaryApprover = "{{Designation of Salary Approver}}";
|
|
//const string _divisionOfSalaryApprover = "{{Division of Salary Approver}}";
|
|
//const string _emailOfSalaryApprover = "{{email add of Salary Approver}}";
|
|
//const string _phoneOfSalaryApprover = "{{phone no of Salary Approver}}";
|
|
|
|
//const string _signature = "{{SIGNATURE}}";
|
|
|
|
//const string _vehicleExpenseForSc = "{{VehicleExpense}}";
|
|
//const string _carAllowanceForSc = "{{CarAllowance}}";
|
|
|
|
List<ADParameter> _carAllowanceParameters;
|
|
List<AllowanceDeduction> _carAllowances;
|
|
List<ADParameterEmployee> _individualCarAllowances;
|
|
EmployeeGradeSalary _gradeSalary;
|
|
|
|
List<ADParameter> _vehicleAllowanceParameters;
|
|
List<AllowanceDeduction> _vehicleAllowances;
|
|
List<ADParameterEmployee> _individualVehicleAllowances;
|
|
|
|
//#region properties
|
|
|
|
//public static ObjectsTemplate<Country> Countries
|
|
//{
|
|
// get { return Country.Get(); }
|
|
//}
|
|
|
|
//public static ObjectsTemplate<AuthorizedPerson> AuthorizedPersons
|
|
//{
|
|
// get { return AuthorizedPerson.Get(); }
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
//#region methods
|
|
|
|
public void PrepareCommonProperty(EnumBusinessTemplateType enumLetterType, int currentEmpID, string signatoryId)
|
|
{
|
|
_hrRequest = new HRRequest();
|
|
_hrRequest.Amount = 0;
|
|
_hrRequest.LetterTypeID = Convert.ToInt32(enumLetterType);
|
|
_hrRequest.EmployeeID = currentEmpID;
|
|
_hrRequest.RequestDate = DateTime.Today;
|
|
_hrRequest.RequestType = EnumRequestType.Letter;
|
|
_hrRequest.WfStatus = (EnumwfStatus)enumwfStatus.End;
|
|
_hrRequest.RequestComplted = false;
|
|
_hrRequest.CreatedBy = 1;
|
|
_hrRequest.CreatedDate = DateTime.Now;
|
|
|
|
|
|
}
|
|
|
|
public void PrepareCommonProperty(EnumLetterType enumLetterType, int currentEmpID)
|
|
{
|
|
_hrRequest = new HRRequest();
|
|
_hrRequest.LetterTypeID = Convert.ToInt32(enumLetterType);
|
|
_hrRequest.EmployeeID = currentEmpID;
|
|
_hrRequest.RequestDate = DateTime.Today;
|
|
_hrRequest.CreatedBy = 1;
|
|
_hrRequest.CreatedDate = DateTime.Now;
|
|
}
|
|
|
|
public void PrepareVariableProperty(string issuerAddress, DateTime fromDate, DateTime toDate, string countryId, bool isOfficial,
|
|
bool isWithFamily, string description, string embassyName, string embassyPersonnelAddress,
|
|
string nationalityID, DateTime resignDate, string passportNo, string spousePassportNo, string sAddressLine1, string sAddressLine2, string sAddressLine3, string Nationality)
|
|
{
|
|
_hrRequest.IssuerAddress = issuerAddress;
|
|
_hrRequest.FromDate = fromDate;
|
|
_hrRequest.ToDate = toDate;
|
|
_hrRequest.IsOfficial = isOfficial;
|
|
_hrRequest.IsWithFamily = isWithFamily;
|
|
_hrRequest.Description = description;
|
|
_hrRequest.Purpose = description;
|
|
|
|
//oHrEmployee = new HREmployee().Get(_hrRequest.Employee.ID);
|
|
//_letterRequests = LetterRequest.GetByEmployee(_hrRequest.Employee.ID);
|
|
|
|
}
|
|
|
|
public void SetEmployee(Employee emp)
|
|
{
|
|
_hrRequest.Employee = new Employee();
|
|
_hrRequest.Employee = emp;
|
|
}
|
|
|
|
//public string ProcessTemplateTransmission(ID yearID, PMPIncrementSimulation incrementData, CorporateKPIDistribution bonusData, string extension = "pdf")
|
|
//{
|
|
// extension = extension.StartsWith(".") ? extension : ("." + extension);
|
|
// pmpYearID = yearID;
|
|
|
|
// ps = PMPProcess.GetByPMPProcessID(pmpYearID);
|
|
// switch ((EnumLetterType)Enum.Parse(typeof(EnumLetterType), _hrRequest.LetterTypeID.ToString()))
|
|
// {
|
|
// case EnumLetterType.Annual_Performance_Bonus_Letter:
|
|
// PreparePMSRelatedLetter("_Annual_Performance_Bonus" + "_" + ps.PmpOnlyYear.ToString() + extension, EnumLetterType.Annual_Performance_Bonus_Letter, incrementData, bonusData);
|
|
// return _hrRequest.Employee.EmployeeNo + "_Annual_Performance_Bonus" + "_" + ps.PmpOnlyYear.ToString() + extension;
|
|
// case EnumLetterType.Annual_Performance_Bonus_and_Increment:
|
|
// PreparePMSRelatedLetter("_Annual_Increment" + "_" + (ps.PmpOnlyYear + 1).ToString() + extension, EnumLetterType.Annual_Performance_Bonus_and_Increment, incrementData, bonusData);
|
|
// return _hrRequest.Employee.EmployeeNo + "_Annual_Increment" + "_" + (ps.PmpOnlyYear + 1).ToString() + extension;
|
|
// case EnumLetterType.Annual_Performance_Bonus_and_Promotion:
|
|
// PreparePMSRelatedLetter("_Annual_Promotion" + "_" + (ps.PmpOnlyYear + 1).ToString() + extension, EnumLetterType.Annual_Performance_Bonus_and_Promotion, incrementData, bonusData);
|
|
// return _hrRequest.Employee.EmployeeNo + "_Annual_Promotion" + "_" + (ps.PmpOnlyYear + 1).ToString() + extension;
|
|
// default:
|
|
// return string.Empty;
|
|
// }
|
|
|
|
// return string.Empty;
|
|
//}
|
|
|
|
//public string ProcessTemplateTransmission(string folderpath, ID yearID, PMPIncrementSimulation incrementData, CorporateKPIDistribution bonusData, string extension = "pdf")
|
|
//{
|
|
// extension = extension.StartsWith(".") ? extension : ("." + extension);
|
|
// pmpYearID = yearID;
|
|
// ps = PMPProcess.GetByPMPProcessID(pmpYearID);
|
|
// switch ((EnumLetterType)Enum.Parse(typeof(EnumLetterType), _hrRequest.LetterTypeID.ToString()))
|
|
// {
|
|
// case EnumLetterType.Annual_Performance_Bonus_Letter:
|
|
// PreparePMSRelatedLetter(folderpath, "_Annual_Performance_Bonus" + "_" + ps.PmpOnlyYear.ToString() + extension, EnumLetterType.Annual_Performance_Bonus_Letter, incrementData, bonusData);
|
|
// return _hrRequest.Employee.EmployeeNo + "_Annual_Performance_Bonus" + "_" + ps.PmpOnlyYear.ToString() + extension;
|
|
// case EnumLetterType.Annual_Performance_Bonus_and_Increment:
|
|
// PreparePMSRelatedLetter(folderpath, "_Annual_Increment" + "_" + (ps.PmpOnlyYear + 1).ToString() + extension, EnumLetterType.Annual_Performance_Bonus_and_Increment, incrementData, bonusData);
|
|
// return _hrRequest.Employee.EmployeeNo + "_Annual_Increment" + "_" + (ps.PmpOnlyYear + 1).ToString() + extension;
|
|
// case EnumLetterType.Annual_Performance_Bonus_and_Promotion:
|
|
// PreparePMSRelatedLetter(folderpath, "_Annual_Promotion" + "_" + (ps.PmpOnlyYear + 1).ToString() + extension, EnumLetterType.Annual_Performance_Bonus_and_Promotion, incrementData, bonusData);
|
|
// return _hrRequest.Employee.EmployeeNo + "_Annual_Promotion" + "_" + (ps.PmpOnlyYear + 1).ToString() + extension;
|
|
// default:
|
|
// return string.Empty;
|
|
// }
|
|
|
|
// return string.Empty;
|
|
//}
|
|
|
|
private void ProcessTemplateTransmission(int version, string sPath, LetterRequest lr, string barcodePath, string signaturePath, string fileName, string extension, string generatedPath, DataSet dsSalary)
|
|
{
|
|
extension = extension.StartsWith(".") ? extension : ("." + extension);
|
|
|
|
switch ((EnumBusinessTemplateType)Enum.Parse(typeof(EnumBusinessTemplateType), _hrRequest.LetterTypeID.ToString()))
|
|
{
|
|
case EnumBusinessTemplateType.Travel_NOC_Personal_without_Family:
|
|
PrepareTravelNOCPersonalLetter(version, sPath, lr, barcodePath, signaturePath, fileName, generatedPath, dsSalary);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_Business_Letter:
|
|
PrepareLetterRequest(sPath, lr, fileName, EnumBusinessTemplateType.Letter_Request_Business_Letter, barcodePath, signaturePath, generatedPath, dsSalary, extension);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_Employment_Certificate:
|
|
PrepareLetterRequest(sPath, lr, fileName, EnumBusinessTemplateType.Letter_Request_Employment_Certificate, barcodePath, signaturePath, generatedPath, dsSalary, extension);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_Employment_Certificate_with_JD:
|
|
PrepareLetterRequest(sPath, lr, fileName, EnumBusinessTemplateType.Letter_Request_Employment_Certificate_with_JD, barcodePath, signaturePath, generatedPath, dsSalary, extension);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_Salary_Certificate:
|
|
PrepareLetterRequest(sPath, lr, fileName, EnumBusinessTemplateType.Letter_Request_Salary_Certificate, barcodePath, signaturePath, generatedPath, dsSalary, extension);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_NOC_To_Whom_it_may_concern:
|
|
PrepareLetterRequest(sPath, lr, fileName, EnumBusinessTemplateType.Letter_Request_NOC_To_Whom_it_may_concern, barcodePath, signaturePath, generatedPath, dsSalary, extension);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_Employment_Certificate_to_whom_it_may_concern:
|
|
PrepareLetterRequest(sPath, lr, fileName, EnumBusinessTemplateType.Letter_Request_Employment_Certificate_to_whom_it_may_concern, barcodePath, signaturePath, generatedPath, dsSalary, extension);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern:
|
|
PrepareLetterRequest(sPath, lr, fileName, EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern, barcodePath, signaturePath, generatedPath, dsSalary, extension);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_Insurance_of_visa_perosnal_trip:
|
|
PrepareInsuranceVisaPersonalLetter(version, sPath, lr, barcodePath, signaturePath, fileName, generatedPath, dsSalary);
|
|
break;
|
|
case EnumBusinessTemplateType.Letter_Request_Resignation_letter_with_notice_period:
|
|
PrepareResignationLetterWithNoticePeriod(version, sPath, lr, barcodePath, signaturePath, fileName, generatedPath, dsSalary);
|
|
break;
|
|
case EnumBusinessTemplateType.Experience_Certificate:
|
|
PrepareLetterRequest(sPath, lr, fileName, EnumBusinessTemplateType.Experience_Certificate, barcodePath, signaturePath, generatedPath, dsSalary, extension);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
private string PrepareHtmlForPDF(string tempHtmlText, string font, LetterRequest lr, EnumBusinessTemplateType enumBusinessTemplateType, string barcodePath, string signaturePath, DataSet dsSalary)
|
|
{
|
|
FontFactory.FontImp = new FontFactoryImp(); //UnicodeFontFactory(font);
|
|
|
|
tempHtmlText = ReplaceCommonTag(tempHtmlText, lr, enumBusinessTemplateType, barcodePath, signaturePath, dsSalary);
|
|
|
|
return tempHtmlText;
|
|
}
|
|
public void PrepareTravelNOCPersonalLetter(int version, string sPath, LetterRequest lr, string barcodePath, string signaturePath, string fileName, string generatedPath, DataSet dsSalary)
|
|
{
|
|
try
|
|
{
|
|
Document document = new Document(PageSize.LETTER, 72f, 72f, 30f, 0f);
|
|
WebClient wc = new WebClient();
|
|
|
|
string tempHtmlText = string.Empty;
|
|
//PdfWriter.GetInstance(document, new FileStream(sPath + "\\" + fileName, FileMode.Create));
|
|
var pdfFileCreationPath = System.IO.Path.Combine(generatedPath, fileName);
|
|
PdfWriter.GetInstance(document, new FileStream(pdfFileCreationPath, FileMode.Create));
|
|
document.Open();
|
|
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + travelNOCPersonalWithoutFamilyTemplatePath);
|
|
tempHtmlText = AddHeaderText(tempHtmlText);
|
|
tempHtmlText = AddFooterText(tempHtmlText);
|
|
|
|
tempHtmlText = PrepareHtmlForPDF(tempHtmlText, "CALIBRI.TTF", lr, EnumBusinessTemplateType.Travel_NOC_Personal_without_Family, barcodePath, signaturePath, dsSalary);
|
|
|
|
List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(tempHtmlText), null);
|
|
|
|
for (int k = 0; k < htmlarraylist.Count; k++)
|
|
document.Add((IElement)htmlarraylist[k]);
|
|
|
|
document.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("Tag Replacement Error in NOC With Personal Letter!!!");
|
|
}
|
|
}
|
|
|
|
public void PrepareInsuranceVisaPersonalLetter(int version, string sPath, LetterRequest lr, string barcodePath, string signaturePath, string fileName, string generatedPath, DataSet dsSalary)
|
|
{
|
|
try
|
|
{
|
|
Document document = new Document(PageSize.LETTER, 72f, 72f, 30f, 0f);
|
|
WebClient wc = new WebClient();
|
|
|
|
string tempHtmlText = string.Empty;
|
|
//PdfWriter.GetInstance(document, new FileStream(sPath + "\\" + fileName, FileMode.Create));
|
|
var pdfFileCreationPath = System.IO.Path.Combine(generatedPath, fileName);
|
|
PdfWriter.GetInstance(document, new FileStream(pdfFileCreationPath, FileMode.Create));
|
|
document.Open();
|
|
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + insuranceVisaPersonalTripTemplatePath);
|
|
tempHtmlText = AddHeaderText(tempHtmlText);
|
|
tempHtmlText = AddFooterText(tempHtmlText);
|
|
|
|
tempHtmlText = PrepareHtmlForPDF(tempHtmlText, "CALIBRI.TTF", lr, EnumBusinessTemplateType.Travel_NOC_Personal_without_Family, barcodePath, signaturePath, dsSalary);
|
|
|
|
List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(tempHtmlText), null);
|
|
|
|
for (int k = 0; k < htmlarraylist.Count; k++)
|
|
document.Add((IElement)htmlarraylist[k]);
|
|
|
|
document.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("Tag Replacement Error in NOC With Personal Letter!!!");
|
|
}
|
|
}
|
|
|
|
public void PrepareResignationLetterWithNoticePeriod(int version, string sPath, LetterRequest lr, string barcodePath, string signaturePath, string fileName, string generatedPath, DataSet dsSalary)
|
|
{
|
|
try
|
|
{
|
|
Document document = new Document(PageSize.LETTER, 72f, 72f, 30f, 0f);
|
|
WebClient wc = new WebClient();
|
|
|
|
string tempHtmlText = string.Empty;
|
|
var pdfFileCreationPath = System.IO.Path.Combine(generatedPath, fileName);
|
|
PdfWriter.GetInstance(document, new FileStream(pdfFileCreationPath, FileMode.Create));
|
|
document.Open();
|
|
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + resignationLetterTemplatePath);
|
|
tempHtmlText = AddHeaderText(tempHtmlText);
|
|
tempHtmlText = AddFooterText(tempHtmlText);
|
|
|
|
tempHtmlText = PrepareHtmlForPDF(tempHtmlText, "CALIBRI.TTF", lr, EnumBusinessTemplateType.Letter_Request_Resignation_letter_with_notice_period, barcodePath, signaturePath, dsSalary);
|
|
|
|
List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(tempHtmlText), null);
|
|
|
|
for (int k = 0; k < htmlarraylist.Count; k++)
|
|
document.Add((IElement)htmlarraylist[k]);
|
|
|
|
document.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("Tag Replacement Error in NOC With Personal Letter!!!");
|
|
}
|
|
}
|
|
|
|
private void PrepareLetterRequest(string sPath, LetterRequest lr, string letterName, EnumBusinessTemplateType enumBusinessTemplateType, string barcodePath, string signaturePath, string generatedPath, DataSet dsSalary, string extension = "pdf")
|
|
{
|
|
try
|
|
{
|
|
extension = extension.StartsWith(".") ? extension : ("." + extension);
|
|
WebClient wc = new WebClient();
|
|
string tempHtmlText = string.Empty;
|
|
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Travel_NOC_Personal_without_Family)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestNoc);
|
|
}
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Business_Letter)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestBusinessLetter);
|
|
}
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Employment_Certificate)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestEmploymentCertificate);
|
|
}
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Employment_Certificate_with_JD)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestEmploymentCerWithJd);
|
|
}
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Salary_Certificate)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestSalaryCertificate);
|
|
}
|
|
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_NOC_To_Whom_it_may_concern)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestNocToWhomItMayConcern);
|
|
}
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Employment_Certificate_to_whom_it_may_concern)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestEmploymentCertificateToWhomItMayConcern);
|
|
}
|
|
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestSalaryTemplateToWhomItMayConcern);
|
|
}
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Experience_Certificate)
|
|
{
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestExperienceCertificate);
|
|
}
|
|
tempHtmlText = AddHeaderText(tempHtmlText);
|
|
tempHtmlText = AddFooterText(tempHtmlText);
|
|
tempHtmlText = PrepareHtmlForPDF(tempHtmlText, "CALIBRI.TTF", lr, enumBusinessTemplateType, barcodePath, signaturePath, dsSalary);
|
|
|
|
// var pdfFileCreationPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, _letterdlfilePath, letterName);
|
|
var pdfFileCreationPath = System.IO.Path.Combine(generatedPath, letterName);
|
|
|
|
if (extension.Trim().ToUpper() == ".PDF")
|
|
{
|
|
using (FileStream fStream = new FileStream(pdfFileCreationPath, FileMode.Create))
|
|
{
|
|
Document document = new Document(PageSize.LETTER, 72f, 72f, 30f, 0f);
|
|
|
|
PdfWriter.GetInstance(document, fStream);
|
|
document.Open();
|
|
|
|
List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(tempHtmlText), null);
|
|
|
|
for (int k = 0; k < htmlarraylist.Count; k++)
|
|
document.Add((IElement)htmlarraylist[k]);
|
|
|
|
document.Close();
|
|
}
|
|
}
|
|
else if (extension.Trim().ToUpper() == ".DOCX" || extension.Trim().ToUpper() == ".DOC")
|
|
{
|
|
//var generatedHtmlFile = fullFilePath + ".html";
|
|
//File.WriteAllText(generatedHtmlFile, tempHtmlText);
|
|
//Spire.Doc.Document doc = new Spire.Doc.Document();
|
|
//doc.LoadFromFile(generatedHtmlFile, Spire.Doc.FileFormat.Html, Spire.Doc.Documents.XHTMLValidationType.None);
|
|
//doc.SaveToFile(fullFilePath, extension.Trim().ToUpper() == ".DOCX" ? Spire.Doc.FileFormat.Docx : Spire.Doc.FileFormat.Doc);
|
|
//File.Delete(generatedHtmlFile);
|
|
|
|
//using (WordprocessingDocument wordPrpcessingDoc = WordprocessingDocument.Create(sPath + "\\" + letterName, WordprocessingDocumentType.Document))
|
|
//{
|
|
// MainDocumentPart mainPart = wordPrpcessingDoc.AddMainDocumentPart();
|
|
// mainPart.Document = new DocumentFormat.OpenXml.Wordprocessing.Document();
|
|
// DocumentFormat.OpenXml.Wordprocessing.Body body = mainPart.Document.AppendChild(new DocumentFormat.OpenXml.Wordprocessing.Body());
|
|
// DocumentFormat.OpenXml.Wordprocessing.Paragraph para = body.AppendChild(new DocumentFormat.OpenXml.Wordprocessing.Paragraph());
|
|
// DocumentFormat.OpenXml.Wordprocessing.Run run = para.AppendChild(new DocumentFormat.OpenXml.Wordprocessing.Run());
|
|
// run.AppendChild(new DocumentFormat.OpenXml.Wordprocessing.Text("AAAA"));
|
|
//}
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.InnerException != null ? ex.InnerException.Message.ToString() : ex.Message.ToString());
|
|
}
|
|
}
|
|
|
|
//public byte[] PrepareLetterRequestForSalaryCertificate(string sPath, Payroll.BO.LetterRequest lr, string letterName, EnumBusinessTemplateType enumBusinessTemplateType, string barcodePath, string signaturePath)
|
|
//{
|
|
// try
|
|
// {
|
|
// string filename = sPath + "\\" + _hrRequest.Employee.EmployeeNo + letterName;
|
|
// string contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
|
|
// WebClient wc = new WebClient();
|
|
|
|
// string tempHtmlText = string.Empty;
|
|
|
|
|
|
// if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Salary_Certificate)
|
|
// {
|
|
// tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestSalaryCertificate);
|
|
// }
|
|
|
|
// if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern)
|
|
// {
|
|
// tempHtmlText = wc.DownloadString(templateDesktopBasePath + letterRequestSalaryTemplateToWhomItMayConcern);
|
|
// }
|
|
|
|
// tempHtmlText = PrepareHtmlForPDF(tempHtmlText, "CALIBRI.TTF", lr, enumBusinessTemplateType, barcodePath, signaturePath);
|
|
|
|
|
|
// string html = tempHtmlText;
|
|
|
|
// using (MemoryStream generatedDocument = new MemoryStream())
|
|
// {
|
|
// using (WordprocessingDocument package = WordprocessingDocument.Create(generatedDocument, WordprocessingDocumentType.Document))
|
|
// {
|
|
// MainDocumentPart mainPart = package.MainDocumentPart;
|
|
// if (mainPart == null)
|
|
// {
|
|
// mainPart = package.AddMainDocumentPart();
|
|
// new DocumentFormat.OpenXml.Wordprocessing.Document(new DocumentFormat.OpenXml.Wordprocessing.Body()).Save(mainPart);
|
|
// }
|
|
|
|
// HtmlToOpenXml.HtmlConverter converter = new HtmlToOpenXml.HtmlConverter(mainPart);
|
|
|
|
// DocumentFormat.OpenXml.Wordprocessing.Body body = mainPart.Document.Body;
|
|
|
|
// var paragraphs = converter.Parse(html);
|
|
// for (int i = 0; i < paragraphs.Count; i++)
|
|
// {
|
|
// body.Append(paragraphs[i]);
|
|
// }
|
|
|
|
// mainPart.Document.Save();
|
|
// }
|
|
|
|
// byte[] bytesInStream = generatedDocument.ToArray(); // simpler way of converting to array
|
|
// generatedDocument.Close();
|
|
|
|
// return bytesInStream;
|
|
// }
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw new Exception(ex.InnerException != null ? ex.InnerException.Message.ToString() : ex.Message.ToString());
|
|
// }
|
|
//}
|
|
//private byte[] ProcessTemplateTransmissionForSalaryCertificate(int version, string sPath, Payroll.BO.LetterRequest lr, string barcodePath, string signaturePath)
|
|
//{
|
|
// switch ((EnumBusinessTemplateType)Enum.Parse(typeof(EnumBusinessTemplateType), _hrRequest.LetterTypeID.ToString()))
|
|
// {
|
|
// case EnumBusinessTemplateType.Letter_Request_Salary_Certificate:
|
|
// return PrepareLetterRequestForSalaryCertificate(sPath, lr, "Salary Certificate.pdf", EnumBusinessTemplateType.Letter_Request_Salary_Certificate, barcodePath, signaturePath);
|
|
|
|
// case EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern:
|
|
// return PrepareLetterRequestForSalaryCertificate(sPath, lr, "Salary template_to whom it may concern.pdf", EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern, barcodePath, signaturePath);
|
|
// default:
|
|
// return null;
|
|
// }
|
|
//}
|
|
|
|
public string CreateLetter(LetterRequest lr, Employee emp, string letterFilePath, string mainPath, string signaturePath, string barcodePath, DataSet dsSalary, string extension = "pdf")
|
|
{
|
|
string filePath = string.Empty;
|
|
string fileName = string.Empty;
|
|
extension = extension.StartsWith(".") ? extension : ("." + extension);
|
|
if (lr.Purpose == EnumLetterRequestPurpose.NOC || lr.Purpose == EnumLetterRequestPurpose.NOC_For_Immigration)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Travel_NOC_Personal_without_Family, lr);
|
|
fileName = emp.EmployeeNo + "_Travel_NOC_Personal" + extension;
|
|
}
|
|
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Visa_Request_NOC_Personal)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Insurance_of_visa_perosnal_trip, lr);
|
|
fileName = emp.EmployeeNo + "_Insurance_Visa_Personal" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Registration_Letter_With_Notice_Period)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Resignation_letter_with_notice_period, lr);
|
|
fileName = emp.EmployeeNo + "_Resignation_Letter_With_Notice" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.NOC_To_Whom_it_may_concern)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_NOC_To_Whom_it_may_concern, lr);
|
|
fileName = emp.EmployeeNo + "_NOC_To Whom it may concern" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Business_Visa_Letter)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Business_Letter, lr);
|
|
fileName = emp.EmployeeNo + "_Business Letter" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Employment_Certificate)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Employment_Certificate, lr);
|
|
fileName = emp.EmployeeNo + "_Employment Certificate" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Employment_Certificate_with_JD)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Employment_Certificate_with_JD, lr);
|
|
fileName = emp.EmployeeNo + "_Employment Certificate with JD" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Employment_Certificate_to_whom_it_may_concern)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Employment_Certificate_to_whom_it_may_concern, lr);
|
|
fileName = emp.EmployeeNo + "_Employment Certificate_to whom it may concern" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Salary_Certificate)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Salary_Certificate, lr);
|
|
fileName = emp.EmployeeNo + "_Salary Certificate" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Salary_Certificate_to_whom_it_may_concern)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern, lr);
|
|
fileName = emp.EmployeeNo + "_Salary template_to whom it may concern" + extension;
|
|
}
|
|
if (lr.Purpose == EnumLetterRequestPurpose.Experience_Certificate)
|
|
{
|
|
PrepareObject(emp, EnumBusinessTemplateType.Experience_Certificate, lr);
|
|
fileName = emp.EmployeeNo + "_Experience Certificate" + extension;
|
|
}
|
|
|
|
filePath = letterFilePath + fileName;//generated
|
|
|
|
TransmitTemplate(lr, barcodePath, mainPath, signaturePath, fileName, letterFilePath, dsSalary, extension);
|
|
|
|
return filePath;
|
|
}
|
|
|
|
//public byte[] CreateLetterForSalaryCertificate(LetterRequest lr, Employee emp, string letterFilePath, string mainPath, string signaturePath, string barcodeFullPath)
|
|
//{
|
|
// string filePath = string.Empty;
|
|
// string fileName = string.Empty;
|
|
|
|
// if (lr.Purpose == EnumLetterRequestPurpose.Salary_Certificate)
|
|
// {
|
|
// PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Salary_Certificate, lr);
|
|
// filePath = letterFilePath + "Salary Certificate.pdf";
|
|
// fileName = emp.EmployeeNo + "_Salary Certificate.pdf";
|
|
// }
|
|
// if (lr.Purpose == EnumLetterRequestPurpose.Salary_Certificate_to_whom_it_may_concern)
|
|
// {
|
|
// PrepareObject(emp, EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern, lr);
|
|
// filePath = letterFilePath + "Salary template_to whom it may concern.pdf";
|
|
// fileName = emp.EmployeeNo + "_Salary template_to whom it may concern.pdf";
|
|
// }
|
|
|
|
// return TransmitTemplateForSalaryCertificate(lr, barcodeFullPath, mainPath, signaturePath);
|
|
//}
|
|
|
|
private void PrepareObject(Employee oemp, EnumBusinessTemplateType enumBusinessTemplateType, LetterRequest lr)
|
|
{
|
|
|
|
//string Designation = oemp.Designation.Name;
|
|
//string Department = oemp.Department != null ? oemp.Department.Name : string.Empty;
|
|
// Grade grade = Grade.Get(oemp.GradeID);
|
|
|
|
EnumBusinessTemplateType templateType = enumBusinessTemplateType;
|
|
PrepareCommonProperty(templateType, oemp.ID, "");
|
|
|
|
PrepareVariableProperty(null, Convert.ToDateTime(DateTime.Now),
|
|
Convert.ToDateTime(DateTime.Now), "1", false, false, "Purpose",
|
|
"temp", null, "temp", DateTime.MinValue, "temp", string.Empty
|
|
, lr.AddressLine1, lr.AddressLine2, "", "");
|
|
SetEmployee(oemp);
|
|
|
|
}
|
|
|
|
private void TransmitTemplate(LetterRequest lr, string barcodePath, string mainPath, string signaturePath, string fileName, string generatedPath, DataSet dsSalary, string extension = ".PDF")
|
|
{
|
|
ProcessTemplateTransmission(2, mainPath, lr, barcodePath, signaturePath, fileName, extension, generatedPath, dsSalary);
|
|
}
|
|
|
|
////private byte[] TransmitTemplateForSalaryCertificate(Payroll.BO.LetterRequest lr, string barcodePath, string mainPath, string signaturePath)
|
|
////{
|
|
//// //return ProcessTemplateTransmissionForSalaryCertificate(2, mainPath, lr, barcodePath, signaturePath);
|
|
//// return ProcessTemplateTransmissionForSalaryCertificate(2, mainPath, lr, barcodePath, signaturePath);
|
|
|
|
////}
|
|
|
|
//private void CollectCarAllowanceRawData(string carAllowanceCodes, string vehicleAllowanceCodes)
|
|
//{
|
|
// //string carLoanAllowanceCodeStrings = ConfigurationManager.GetStringValue("incrementsimulation", "carallowancecodes", EnumConfigurationType.Logic);
|
|
// string carLoanAllowanceCodeStrings = carAllowanceCodes;
|
|
// string vehicleAllowanceCodeStrings = vehicleAllowanceCodes;
|
|
|
|
// string[] carLoanAllowanceCode = carLoanAllowanceCodeStrings.Split(',');
|
|
// string[] vehicleAllowanceCode = vehicleAllowanceCodeStrings.Split(',');
|
|
|
|
// _carAllowances = Payroll.BO.AllowanceDeduction.Get(EnumStatus.Active);
|
|
|
|
// int[] allowDeductIDs = _carAllowances
|
|
// .Where(x => carLoanAllowanceCode.Contains(x.Code.Trim()) && x.AllowOrDeductType == EnumAllowOrDeduct.Allowance)
|
|
// .Select(x => x.ID.Integer).ToArray();
|
|
|
|
// int[] vehicleAllowDeductIDs = _carAllowances
|
|
// .Where(x => vehicleAllowanceCode.Contains(x.Code.Trim()) && x.AllowOrDeductType == EnumAllowOrDeduct.Allowance)
|
|
// .Select(x => x.ID.Integer).ToArray();
|
|
|
|
// _carAllowances = _carAllowances.Where(x => allowDeductIDs.Contains(x.ID.Integer)).ToList();
|
|
|
|
// _vehicleAllowances = _carAllowances.Where(x => vehicleAllowDeductIDs.Contains(x.ID.Integer)).ToList();
|
|
|
|
// _carAllowanceParameters = ADParameter.GetWithDetail(EnumStatus.Active, Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer)
|
|
// .Where(x => allowDeductIDs.Contains(x.AllowDeductID.Integer)).ToList();
|
|
|
|
// _vehicleAllowanceParameters = ADParameter.GetWithDetail(EnumStatus.Active, Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer)
|
|
// .Where(x => vehicleAllowDeductIDs.Contains(x.AllowDeductID.Integer)).ToList();
|
|
|
|
// _individualCarAllowances = ADParameterEmployee.Get(GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate),
|
|
// GlobalFunctions.LastDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate),
|
|
// Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer)
|
|
// .Where(x => allowDeductIDs.Contains(x.AllowDeductID.Integer)).ToList();
|
|
|
|
// _individualVehicleAllowances = ADParameterEmployee.Get(GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate),
|
|
// GlobalFunctions.LastDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate),
|
|
// Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer)
|
|
// .Where(x => vehicleAllowDeductIDs.Contains(x.AllowDeductID.Integer)).ToList();
|
|
|
|
// _gradeSalary = new EmployeeGradeSalary();
|
|
//}
|
|
|
|
//private double CalculateCarAllowance(Employee oEmployee)
|
|
//{
|
|
// double carAllowance = 0;
|
|
|
|
// var employeeCarAllowanceParameters = _carAllowanceParameters.Where(x => x.ADParameterGrades.Any(y => y.GradeID.Integer == oEmployee.GradeID.Integer)).ToList();
|
|
|
|
// foreach (var carAllowanceParam in employeeCarAllowanceParameters)
|
|
// {
|
|
|
|
// if (carAllowanceParam.EntitleType == EnumEntitleType.Grade)
|
|
// {
|
|
// carAllowance += carAllowanceParam.GetGradeDefinedAmount(oEmployee, oEmployee.BasicSalary, oEmployee.GrossSalary, _gradeSalary);
|
|
// }
|
|
// else
|
|
// {
|
|
// var indAllowance = _individualCarAllowances.FirstOrDefault(x => x.AllowDeductID.Integer == carAllowanceParam.AllowDeductID.Integer &&
|
|
// x.EmployeeID.Integer == oEmployee.ID.Integer &&
|
|
// x.ADEmpType == EnumADEmpType.AppliedToIndividual);
|
|
// if (indAllowance != null)
|
|
// {
|
|
// carAllowance += indAllowance.MonthlyAmount;
|
|
// }
|
|
// }
|
|
// }
|
|
// return carAllowance;
|
|
//}
|
|
|
|
//private double CalculateVehicleAllowance(Employee oEmployee)
|
|
//{
|
|
// double vehicleAllowance = 0;
|
|
|
|
// var employeeVehicleAllowanceParameters = _vehicleAllowanceParameters.Where(x => x.ADParameterGrades.Any(y => y.GradeID == oEmployee.GradeID)).ToList();
|
|
|
|
// foreach (var vehicleAllowanceParam in employeeVehicleAllowanceParameters)
|
|
// {
|
|
|
|
// if (vehicleAllowanceParam.EntitleType == EnumEntitleType.Grade)
|
|
// {
|
|
// vehicleAllowance += vehicleAllowanceParam.GetGradeDefinedAmount(oEmployee, oEmployee.BasicSalary, oEmployee.GrossSalary, _gradeSalary);
|
|
// }
|
|
// else
|
|
// {
|
|
// var indAllowance = _individualVehicleAllowances.FirstOrDefault(x => x.AllowDeductID == vehicleAllowanceParam.AllowDeductID &&
|
|
// x.EmployeeID == oEmployee.ID &&
|
|
// x.ADEmpType == EnumADEmpType.AppliedToIndividual);
|
|
// if (indAllowance != null)
|
|
// {
|
|
// vehicleAllowance += indAllowance.MonthlyAmount;
|
|
// }
|
|
// }
|
|
// }
|
|
// return vehicleAllowance;
|
|
//}
|
|
|
|
private string ReplaceCommonTag(string htmlText, LetterRequest lr, EnumBusinessTemplateType enumBusinessTemplateType, string barcodePath, string signaturePath, DataSet dsSalary)
|
|
{
|
|
int id = 0;// _hrRequest.SignatoryId;
|
|
//AuthorizedPerson signatory = id != null ? AuthorizedPerson.Get(id)
|
|
// : new AuthorizedPerson();
|
|
|
|
//Employee salaryApprover = Employee.Get(lr.ApproverId);
|
|
//DataSet dsGrossItems = LetterRequest.GetGrossItems(_hrRequest.Employee.ID, SystemInformation.CurrentSysInfo.LastPayProcessDate);
|
|
//DataSet dsDivisionOfEmployee = LetterRequest.GetDivisionOfEmployee(_hrRequest.Employee.EmployeeNo, "DIVISION");
|
|
//DataSet dsDivisionOfSalaryApprover = LetterRequest.GetDivisionOfEmployee(salaryApprover.EmployeeNo, "DEPARTMENT");
|
|
//string signature = signaturePath + ".jpg";
|
|
//if (!File.Exists(signature))
|
|
//{
|
|
// signature = signaturePath + "none.jpg";
|
|
//}
|
|
|
|
string signature = signaturePath + "none.jpg";
|
|
string seal = signaturePath + "none.jpg";
|
|
string sealup = signaturePath + "none.jpg";
|
|
string sealdown = signaturePath + "none.jpg";
|
|
string authsign = signaturePath + "none.jpg";
|
|
if (lr.IsDisgitalSinature== true)
|
|
{
|
|
authsign = signaturePath + (lr.SignatoryFileName == null ? "none.jpg" : "TempSignatureFiles\\" + lr.SignatoryFileName);
|
|
seal = signaturePath + "PulsSeal.png";
|
|
sealup = signaturePath + "SealUp.png";
|
|
sealdown = signaturePath + "SealDown.png";
|
|
}
|
|
//seal = signaturePath + "PulsSeal.png";
|
|
//string lettertemplatefullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, @"ClientApp\Documents\LetterTempletes\Signatures\none.jpg");
|
|
//double basic = double.Parse(dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Basic").FirstOrDefault() != null ? dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Basic").FirstOrDefault().ItemArray[1].ToString() : "0");
|
|
//double houseRent = double.Parse(dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "House rent Allowance").FirstOrDefault() != null ? dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "House rent Allowance").FirstOrDefault().ItemArray[1].ToString() : "0");
|
|
//double conveyance = double.Parse(dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Conveyance").FirstOrDefault() != null ? dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Conveyance").FirstOrDefault().ItemArray[1].ToString() : "0");
|
|
//double passageFreeTravel = double.Parse(dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Passage Free Travel (Local)").FirstOrDefault() != null ? dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Passage Free Travel (Local)").FirstOrDefault().ItemArray[1].ToString() : "0");
|
|
//double medical = double.Parse(dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Medical").FirstOrDefault() != null ? dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Medical").FirstOrDefault().ItemArray[1].ToString() : "0");
|
|
//double carAllowance = double.Parse(dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Car Allowance").FirstOrDefault() != null ? dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Car Allowance").FirstOrDefault().ItemArray[1].ToString() : "0");
|
|
//double gross = double.Parse(dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Net Amount").FirstOrDefault() != null ? dsGrossItems.Tables[0].AsEnumerable().Where(x => x["DESCRIPTION"].ToString() == "Net Amount").FirstOrDefault().ItemArray[1].ToString() : "0");
|
|
|
|
double basic = 0;
|
|
double houseRent = 0;
|
|
double conveyance = 0;
|
|
double passageFreeTravel = 0;
|
|
double medical = 0;
|
|
double carAllowance = 0;
|
|
|
|
// double gross = _hrRequest.Employee.GrossSalary;
|
|
|
|
double vehicleExpenseForSc = 0;
|
|
double carAllowanceForSc = 0;
|
|
string division = string.Empty;
|
|
string purposeOfVisit = string.Empty;
|
|
string concernPerson = string.Empty;
|
|
string visaNocLastLine = string.Empty;
|
|
string visaNocMiddleLine = string.Empty;
|
|
|
|
string divisionOfSalaryApprover = string.Empty;
|
|
|
|
//if (dsDivisionOfEmployee.Tables[0].Rows.Count > 0) division = dsDivisionOfEmployee.Tables[0].Rows[0]["DIVISION"].ToString().Replace("&", "&");
|
|
|
|
//if (dsDivisionOfSalaryApprover.Tables[0].Rows.Count > 0) divisionOfSalaryApprover = dsDivisionOfSalaryApprover.Tables[0].Rows[0]["DEPARTMENT"].ToString();
|
|
|
|
if (enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Salary_Certificate || enumBusinessTemplateType == EnumBusinessTemplateType.Letter_Request_Salary_template_to_whom_it_may_concern)
|
|
{
|
|
// 006 for Car Allowance and 058 for Vehicle Expenses Reimbursement
|
|
//CollectCarAllowanceRawData("006", "058");
|
|
//carAllowanceForSc = CalculateCarAllowance(_hrRequest.Employee);
|
|
//vehicleExpenseForSc = CalculateVehicleAllowance(_hrRequest.Employee);
|
|
}
|
|
|
|
if(lr.TripType== EnumLetterRequestTrip.Business_Trip)
|
|
{
|
|
purposeOfVisit = "Business Trip";
|
|
concernPerson = "company";
|
|
visaNocLastLine = string.Empty;
|
|
visaNocMiddleLine= string.Empty;
|
|
}
|
|
else if(lr.TripType == EnumLetterRequestTrip.Personal_Trip)
|
|
{
|
|
purposeOfVisit = "Personal Trip";
|
|
concernPerson = "employee";
|
|
visaNocLastLine = "Any loss or liability raised from the issuance of this letter will not bind the company or any of its officers.";
|
|
visaNocMiddleLine = "The company has granted leave (Vacation Entitlement) to undertake this travel.";
|
|
}
|
|
else
|
|
{
|
|
purposeOfVisit = string.Empty;
|
|
concernPerson = string.Empty;
|
|
visaNocLastLine= string.Empty;
|
|
visaNocMiddleLine = string.Empty;
|
|
}
|
|
|
|
|
|
double dGross = lr.GrossSalary;
|
|
double dDeduct = 0;
|
|
|
|
//if (dsSalary.Tables[0].Rows.Count > 0)
|
|
//{
|
|
// foreach (DataRow orr in dsSalary.Tables[0].Rows)
|
|
// {
|
|
// if (orr["GrossAmount"] != DBNull.Value)
|
|
// {
|
|
// dGross = Convert.ToDouble(orr["GrossAmount"].ToString());
|
|
// }
|
|
// }
|
|
|
|
// foreach (DataRow orr in dsSalary.Tables[1].Rows)
|
|
// {
|
|
// if (orr["Deductamount"] != DBNull.Value)
|
|
// {
|
|
// dDeduct = Convert.ToDouble(orr["Deductamount"].ToString());
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
return htmlText.Replace(_referenceNo, "1").
|
|
Replace(_currentDate, DateTime.Today.ToString("dd MMMM yyyy")).
|
|
Replace(_embassyName, lr.PurposeName).
|
|
Replace(_embassyPersonel, lr.RecipeintDesignation).
|
|
Replace(_embassyAddress1, !string.IsNullOrEmpty(lr.AddressLine1) ? lr.AddressLine1.TrimEnd(',') : string.Empty).
|
|
Replace(_embassyAddress2, !string.IsNullOrEmpty(lr.AddressLine2) ? lr.AddressLine2.TrimEnd(',') : string.Empty).
|
|
Replace(_embassyAddress3, !string.IsNullOrEmpty(lr.AddressLine3) ? lr.AddressLine3: string.Empty).
|
|
Replace(_fullName, _hrRequest.Employee.Name.Trim()).
|
|
Replace(_employeeNO, _hrRequest.Employee.EmployeeNo).
|
|
Replace(_employeeJoiningDate, _hrRequest.Employee.JoiningDate.ToString("dd MMMM yyyy")).
|
|
Replace(_employeebdpoJoiningDate, _hrRequest.Employee.JoiningDate.ToString("dd MMMM yyyy")).
|
|
Replace(_employmentType, _hrRequest.Employee.Category.Name.ToString().ToLower() == "confirmed" ? "permanent" : _hrRequest.Employee.Category.Name.ToString().ToLower()).
|
|
Replace(_heOrShe, _hrRequest.Employee.Gender == EnumGender.Male ? "He" : "She").
|
|
Replace(_heshe, _hrRequest.Employee.Gender == EnumGender.Male ? "he" : "she").
|
|
Replace(_employeeDesignation, _hrRequest.Employee.Designation.Name).
|
|
Replace(_employeeDept, _hrRequest.Employee.Department != null ? _hrRequest.Employee.Department.Name : string.Empty).
|
|
Replace(_salutation, _hrRequest.Employee.Gender == EnumGender.Male ? "Mr." : "Ms.").
|
|
Replace(_lastName, _hrRequest.Employee.Name).
|
|
Replace(fromDateTag, !string.IsNullOrEmpty(lr.FromDate.ToString()) ? lr.FromDate.Value.ToString("dd MMMM yyyy") : string.Empty).
|
|
Replace(toDateTag, !string.IsNullOrEmpty(lr.ToDate.ToString()) ? lr.ToDate.Value.ToString("dd MMMM yyyy") : string.Empty).
|
|
Replace(_passsportNo, lr.PassportNo).
|
|
Replace(_countryToVisit, lr.CountryToVisit).
|
|
Replace(_countryTag, lr.CountryToVisit).
|
|
Replace(_conferenceName, lr.ConferenceName).
|
|
Replace(_organizer, lr.Organizer).
|
|
Replace(_hostingCity, lr.Hostingcity).
|
|
Replace(_conferenceStartDate, !string.IsNullOrEmpty(lr.FromDate.ToString()) ? lr.FromDate.Value.ToString("dd MMMM yyyy") : string.Empty).
|
|
Replace(_conferenceEndDate, !string.IsNullOrEmpty(lr.ToDate.ToString()) ? lr.ToDate.Value.ToString("dd MMMM yyyy") : string.Empty).
|
|
Replace(_nationality, lr.Nationality).
|
|
//Replace(_passportIssueDate, oHrEmployee.PassportIssueDate.ToString("dd MMMM yyyy")).
|
|
//Replace(_passportExpiryDate, oHrEmployee.PassportExpDate.ToString("dd MMMM yyyy")).
|
|
Replace(_heSheEr, _hrRequest.Employee.Gender == EnumGender.Male ? "his" : "her").
|
|
Replace(_HisHer, _hrRequest.Employee.Gender == EnumGender.Male ? "His" : "Her").
|
|
Replace(_himOrher, _hrRequest.Employee.Gender == EnumGender.Male ? "him" : "her").
|
|
Replace(_visaType, !string.IsNullOrEmpty(lr.VisaType.ToString()) ? lr.VisaType.ToString() : string.Empty).
|
|
//Replace(_officeName, SystemInformation.CurrentSysInfo.name).
|
|
//Replace(_officeAddress1, SystemInformation.CurrentSysInfo.corporateAddress).
|
|
//Replace(_officeAddress2, SystemInformation.CurrentSysInfo.factoryAddress).
|
|
//Replace(_officeAddress3, SystemInformation.CurrentSysInfo.webAddress).
|
|
Replace(_employeeGrade, _hrRequest.Employee.Grade.Name).
|
|
Replace(_basic, GlobalFunctions.TakaFormat(basic)).
|
|
Replace(_houseRent, GlobalFunctions.TakaFormat(houseRent)).
|
|
Replace(_conveyance, GlobalFunctions.TakaFormat(conveyance)).
|
|
Replace(_passageFreeTravel, GlobalFunctions.TakaFormat(passageFreeTravel)).
|
|
Replace(_medical, GlobalFunctions.TakaFormat(medical)).
|
|
Replace(_carAllowance, GlobalFunctions.TakaFormat(carAllowance)).
|
|
//Replace(_gross, GlobalFunctions.TakaFormat(gross)).
|
|
//Replace(_carAllowanceForSc, GlobalFunctions.TakaFormat(carAllowanceForSc)).
|
|
//Replace(_vehicleExpenseForSc, GlobalFunctions.TakaFormat(vehicleExpenseForSc)).
|
|
Replace(_empBirthDate, _hrRequest.Employee.BirthDate.ToString("dd MMM yyyy")).
|
|
Replace(_empDivision, division).
|
|
Replace(_bankEmpDesignation, lr.BankEmpDesignation).
|
|
Replace(_bank, lr.Bank).
|
|
Replace(_bankLocation, lr.BankLocation).
|
|
//Replace(visitPurpose, lr.Remarks).
|
|
Replace(visitPurpose, purposeOfVisit).
|
|
Replace(_barcode, signature).
|
|
Replace(_signature, signature).
|
|
Replace(sealTag, seal).
|
|
Replace(sealupTag, sealup).
|
|
Replace(sealdownTag, sealdown).
|
|
Replace(authSignTag, authsign).
|
|
Replace(_empNO, _hrRequest.Employee.EmployeeNo).
|
|
Replace(grossSalaryTag, GlobalFunctions.TakaFormat(dGross)).
|
|
Replace(deduction, GlobalFunctions.TakaFormat(dDeduct)).
|
|
Replace(lmName, _hrRequest.Employee.LineManager).
|
|
Replace(lmDesignation, _hrRequest.Employee.LineManagerDeg != null ? _hrRequest.Employee.LineManagerDeg : string.Empty).
|
|
Replace(lmDepartment, _hrRequest.Employee.LineManagerDept != null ? _hrRequest.Employee.LineManagerDept : string.Empty).
|
|
Replace(effectiveDate, !string.IsNullOrEmpty(lr.LastWorkingDate.ToString()) ? lr.LastWorkingDate.Value.AddDays(1).ToString("dd MMMM yyyy") : string.Empty).
|
|
Replace(lastWorkingDate, !string.IsNullOrEmpty(lr.LastWorkingDate.ToString()) ? lr.LastWorkingDate.Value.ToString("dd MMMM yyyy") : string.Empty).
|
|
Replace(lmSalutation, _hrRequest.Employee.LMGender != null ? _hrRequest.Employee.LMGender == EnumGender.Male ? "Mr." : "Ms." : string.Empty).
|
|
Replace(lmLastName, _hrRequest.Employee.LineManager).
|
|
Replace(signatoryname, lr.SignatoryName).
|
|
Replace(signatoryDesignation, lr.SignatoryDeg).
|
|
Replace(lmEmail, _hrRequest.Employee.LineManagerEmail).
|
|
Replace(signatoryEmail, lr.SignatoryEmail).
|
|
Replace(signatoryExt, lr.SignatoryExt).
|
|
Replace(signatoryPhone, lr.SignatoryPhone).
|
|
Replace(pfContributon, GlobalFunctions.TakaFormat(lr.PFContribution)).
|
|
Replace(pfLoanDeduction, GlobalFunctions.TakaFormat(lr.PFLoanDeduction)).
|
|
Replace(organization, lr.Organization).
|
|
Replace(concernedPerson, concernPerson).
|
|
Replace(currency, lr.Currency).
|
|
Replace(logoTag, logoPath).
|
|
Replace(businessNocLastLine, visaNocLastLine).
|
|
Replace(businessNocMiddleLine, visaNocMiddleLine).
|
|
//Replace(_systemDate, lr.ApprovalDate != null ? ((DateTime)(lr.ApprovalDate)).ToString("dd-MMM-yyyy") : string.Empty).
|
|
//Replace(_systemDate2, lr.ApprovalDate != null ? ((DateTime)(lr.ApprovalDate)).ToString("yyyy") : string.Empty).
|
|
//Replace(_serialNumberLetter, lr.Barcode).
|
|
//Replace(_nameOfSalaryApprover, salaryApprover != null ? salaryApprover.Name : string.Empty).
|
|
//Replace(_designationOfSalaryApprover, salaryApprover != null ? salaryApprover.Designation.Name : string.Empty).
|
|
////Replace(_divisionOfSalaryApprover, salaryApprover != null ? salaryApprover.Department.Name : string.Empty).
|
|
//Replace(_divisionOfSalaryApprover, divisionOfSalaryApprover).
|
|
//Replace(_emailOfSalaryApprover, salaryApprover != null ? salaryApprover.EmailAddress : string.Empty).
|
|
//Replace(_phoneOfSalaryApprover, salaryApprover != null ? salaryApprover.MobileNo : string.Empty).
|
|
Replace(_responsibilities, "<ul><li type=\"circle\">" + lr.Remarks.Replace("\r\n", "</li><li type=\"circle\">") + "</li></ul>");
|
|
}
|
|
|
|
//private string ReplaceCommonTag(string htmlText)
|
|
//{
|
|
// ID id = null;// _hrRequest.SignatoryId;
|
|
// AuthorizedPerson signatory = id != null ? AuthorizedPerson.Get(id)
|
|
// : new AuthorizedPerson();
|
|
// //Country country = Country.Get(id);
|
|
|
|
|
|
// //return htmlText.Replace(currentDateTag, DateTime.Today.ToString("dd MMMM yyyy")).
|
|
// // Replace(salutaTionTag, _hrRequest.Employee.Gender == EnumGender.Male ? "Mr." : "Ms.").
|
|
// // Replace(fullNameTag, _hrRequest.Employee.Name).
|
|
// // Replace(joiningDate, _hrRequest.Employee.JoiningDate.ToString("dd MMMM yyyy")).
|
|
// // Replace(capitalGenderTemplatePassiveTag, _hrRequest.Employee.Gender == EnumGender.Male ? "His" : "Her").
|
|
// // Replace(lowerGenderTemplatePassiveTag, _hrRequest.Employee.Gender == EnumGender.Male ? "his" : "her").
|
|
// // Replace(designationTag, _hrRequest.Employee.Designation.Name).
|
|
// // Replace(departmentTag, _hrRequest.Employee.Department.Name).
|
|
// // Replace(capitalGenderTemplateActiveTag, _hrRequest.Employee.Gender == EnumGender.Male ? "He" : "She").
|
|
// // Replace(lowerGenderTemplateActiveTag, _hrRequest.Employee.Gender == EnumGender.Male ? "he" : "she").
|
|
// // Replace(signatoryNameTag, signatory.Name).
|
|
// // Replace(signatoryDesignationTag, signatory.Designation).
|
|
// // Replace(countryTag, country.Name).
|
|
// // Replace(fromDateTag, _hrRequest.FromDate.ToString("dd MMMM yyyy")).
|
|
// // Replace(toDateTag, _hrRequest.ToDate.ToString("dd MMMM yyyy")).
|
|
// // Replace(visitTypeTag, _hrRequest.IsOfficial ? "Official" : _hrRequest.IsWithFamily ? "Family" : string.Empty).
|
|
// // Replace(passportNoTag, new HREmployee().Get(_hrRequest.Employee.ID).PassportNo);
|
|
|
|
// return htmlText.Replace(currentDateTag, DateTime.Today.ToString("dd MMMM yyyy")).
|
|
// Replace(salutaTionTag, _hrRequest.Employee.Gender == EnumGender.Male ? "Mr." : "Ms.").
|
|
// Replace(fullNameTag, _hrRequest.Employee.Name).
|
|
// Replace(joiningDate, _hrRequest.Employee.JoiningDate.ToString("dd MMMM yyyy")).
|
|
// Replace(capitalGenderTemplatePassiveTag, _hrRequest.Employee.Gender == EnumGender.Male ? "His" : "Her").
|
|
// Replace(lowerGenderTemplatePassiveTag, _hrRequest.Employee.Gender == EnumGender.Male ? "his" : "her").
|
|
// Replace(designationTag, _hrRequest.Employee.Designation.Name).
|
|
// Replace(departmentTag, _hrRequest.Employee.Department.Name).
|
|
// Replace(capitalGenderTemplateActiveTag, _hrRequest.Employee.Gender == EnumGender.Male ? "He" : "She").
|
|
// Replace(lowerGenderTemplateActiveTag, _hrRequest.Employee.Gender == EnumGender.Male ? "he" : "she").
|
|
// Replace(signatoryNameTag, signatory.Name).
|
|
// Replace(signatoryDesignationTag, signatory.Designation).
|
|
// Replace(countryTag, "").
|
|
// Replace(fromDateTag, _hrRequest.FromDate.ToString("dd MMMM yyyy")).
|
|
// Replace(toDateTag, _hrRequest.ToDate.ToString("dd MMMM yyyy")).
|
|
// Replace(visitTypeTag, _hrRequest.IsOfficial ? "Official" : _hrRequest.IsWithFamily ? "Family" : string.Empty).
|
|
// Replace(passportNoTag, new HREmployee().Get(_hrRequest.Employee.ID).PassportNo);
|
|
//}
|
|
|
|
////private DateTime GetNextEffectDateFromPromotionList(ObjectsTemplate<PromotionHistory> pHistories, int indexNumber)
|
|
////{
|
|
//// DateTime nextEffectDate = DateTime.MinValue;
|
|
//// if (indexNumber + 1 >= pHistories.Count)
|
|
//// nextEffectDate = new DateTime(2017, 12, 31);
|
|
//// else
|
|
//// nextEffectDate = pHistories[indexNumber + 1].LastPromotionDate.AddDays(-1);
|
|
//// return nextEffectDate;
|
|
////}
|
|
|
|
//private double GetPreviousGrossSalary(ObjectsTemplate<PromotionHistory> pHistories, int indexNumber)
|
|
//{
|
|
// double previousGross = 0.0;
|
|
// if (indexNumber == 0)
|
|
// return previousGross;
|
|
// else
|
|
// previousGross = pHistories[indexNumber - 1].CurrentGross;
|
|
// return previousGross;
|
|
//}
|
|
|
|
//public int GetMonthsBetween(DateTime from, DateTime to)
|
|
//{
|
|
|
|
// if (from > to) return GetMonthsBetween(to, from);
|
|
|
|
// var monthDiff = Math.Abs((to.Year * 12 + (to.Month - 1)) - (from.Year * 12 + (from.Month - 1)));
|
|
|
|
// if (from.AddMonths(monthDiff) > to || to.Day < from.Day)
|
|
// {
|
|
// return monthDiff - 1;
|
|
// }
|
|
// else
|
|
// {
|
|
// return monthDiff;
|
|
// }
|
|
//}
|
|
|
|
//private void CalculateDay(DateTime fromDate, DateTime toDate)
|
|
//{
|
|
// int[] monthDay = new int[12] { 31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|
|
|
// int year = 0;
|
|
// int month = 0;
|
|
// int day = 0;
|
|
|
|
// int increment = 0;
|
|
// //if (fromDate > toDate)
|
|
// {
|
|
// increment = monthDay[fromDate.Month - 1];
|
|
|
|
// if (increment == -1)
|
|
// {
|
|
// if (DateTime.IsLeapYear(fromDate.Year))
|
|
// {
|
|
// increment = 29;
|
|
// }
|
|
// else
|
|
// {
|
|
// increment = 28;
|
|
// }
|
|
// }
|
|
|
|
// if (increment != 0)
|
|
// {
|
|
// day = (toDate.Day + increment) - fromDate.Day;
|
|
// increment = 1;
|
|
// }
|
|
// else
|
|
// {
|
|
// day = toDate.Day - fromDate.Day;
|
|
// }
|
|
|
|
// if ((fromDate.Month + increment) > toDate.Month)
|
|
// {
|
|
// month = (toDate.Month + 12) - (fromDate.Month + increment);
|
|
// increment = 1;
|
|
// }
|
|
// else
|
|
// {
|
|
// month = (toDate.Month) - (fromDate.Month + increment);
|
|
// increment = 0;
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
|
|
|
|
////private double CalculateGrossSalary(ObjectsTemplate<PromotionHistory> pHistorys, Employee emp, double lwpDaysForSalesEmployee)
|
|
////{
|
|
//// double annualGrossAmount = 0;
|
|
//// double annualProratedGross = 0;
|
|
//// double workingDays = 0;
|
|
//// double currentGrossPerDay = 0;
|
|
//// double currentGross = 0;
|
|
//// DateTime firstEffectDate = DateTime.MinValue;
|
|
//// DateTime initialEffectDate = DateTime.MinValue;
|
|
//// DateTime nextEffectDate = DateTime.MinValue;
|
|
//// SalesEmployee salesEmp = null;
|
|
//// var appraisalYear = Ease.CoreV35.Utility.ConfigUtility.GetAppSettings("AppraisalYear");
|
|
|
|
//// DateTime firstDateOfYear = new DateTime(Convert.ToInt32(appraisalYear), 1, 1);
|
|
//// DateTime lastDateOfYear = new DateTime(Convert.ToInt32(appraisalYear), 12, 31);
|
|
//// double currentAmount = 0;
|
|
|
|
|
|
//// if (pHistorys.Count > 0)
|
|
//// {
|
|
//// int serial = 0;
|
|
//// initialEffectDate = pHistorys[serial].LastPromotionDate;
|
|
//// nextEffectDate = GetNextEffectDateFromPromotionList(pHistorys, serial);
|
|
//// double lWPDays = pHistorys[serial].LWPDays;
|
|
//// while (initialEffectDate <= lastDateOfYear)
|
|
//// {
|
|
//// double totalDays = initialEffectDate.Date.TotalDaysInMonth();
|
|
|
|
//// DateTime lastDateofMonth = initialEffectDate.Date.LastDateOfMonth();
|
|
|
|
//// while (nextEffectDate < lastDateofMonth)
|
|
//// {
|
|
//// workingDays = nextEffectDate.Date.Subtract(initialEffectDate.Date).Days + 1;
|
|
|
|
//// currentAmount = (workingDays - lWPDays) * (pHistorys[serial].CurrentGross / totalDays);
|
|
//// annualGrossAmount += currentAmount;
|
|
//// serial++;
|
|
//// initialEffectDate = pHistorys[serial].LastPromotionDate;
|
|
//// lWPDays = pHistorys[serial].LWPDays;
|
|
//// nextEffectDate = GetNextEffectDateFromPromotionList(pHistorys, serial);
|
|
//// }
|
|
|
|
//// workingDays = lastDateofMonth.Date.Subtract(initialEffectDate.Date).Days + 1;
|
|
//// if (lWPDays > workingDays)
|
|
//// {
|
|
//// lWPDays = lWPDays - workingDays;
|
|
//// }
|
|
//// else
|
|
//// {
|
|
//// currentAmount = (workingDays - lWPDays) * (pHistorys[serial].CurrentGross / totalDays);
|
|
//// annualGrossAmount += currentAmount;
|
|
//// lWPDays = 0;
|
|
//// }
|
|
|
|
//// initialEffectDate = initialEffectDate.AddMonths(1).FirstDateOfMonth();
|
|
//// if (initialEffectDate > nextEffectDate && initialEffectDate <= lastDateOfYear)
|
|
//// {
|
|
//// serial++;
|
|
//// initialEffectDate = pHistorys[serial].LastPromotionDate;
|
|
//// lWPDays = pHistorys[serial].LWPDays;
|
|
//// nextEffectDate = GetNextEffectDateFromPromotionList(pHistorys, serial);
|
|
//// }
|
|
|
|
//// }
|
|
|
|
|
|
//// //foreach (PromotionHistory item in pHistorys)
|
|
//// //{
|
|
//// // serial++;
|
|
//// // nextEffectDate = GetNextEffectDateFromPromotionList(pHistorys, serial);
|
|
//// // currentGross = item.CurrentGross;
|
|
//// // //currentGrossPerDay = (currentGross * 12) / 365;
|
|
//// // firstEffectDate = item.LastPromotionDate;
|
|
//// // int lastMonth = 0;
|
|
//// // DateTime currentMonth = firstEffectDate, nextMonth;
|
|
//// // int diff = GetMonthDifference(firstEffectDate, nextEffectDate);
|
|
//// // for (int i = 1; i <= diff; i++)
|
|
//// // {
|
|
//// // int total = currentMonth.TotalDaysInMonth();
|
|
//// // if (diff == 1 || currentMonth.Day != 1)
|
|
//// // currentAmount += ((GetPreviousGrossSalary(pHistorys, serial) / total) * (currentMonth.Day - 1)) + ((currentGross / total) * (total - currentMonth.Day + 1));
|
|
//// // else if (diff > 1)
|
|
//// // {
|
|
|
|
//// // }
|
|
//// // if (diff != 1 && currentMonth.Month == nextEffectDate.Month) currentMonth = nextEffectDate;
|
|
//// // }
|
|
|
|
//// // workingDays = Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("d", firstEffectDate, nextEffectDate) + 1;
|
|
//// // monthDiff = GetMonthsBetween(firstEffectDate, nextEffectDate);
|
|
//// // //CalculateDay(firstEffectDate, nextEffectDate);
|
|
//// // workingDays = workingDays - item.LWPDays;
|
|
//// // if (workingDays < 0)
|
|
//// // workingDays = 0;
|
|
//// // annualGrossAmount += workingDays * currentGrossPerDay;
|
|
//// //}
|
|
//// }
|
|
//// else
|
|
//// {
|
|
//// currentGross = emp.GrossSalary;
|
|
//// currentGrossPerDay = (currentGross * 12) / 365;
|
|
//// if (emp.JoiningDate.Date < new DateTime(2017, 1, 1))
|
|
//// workingDays = 365.0 - lwpDaysForSalesEmployee;
|
|
//// else
|
|
//// workingDays = (Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("d", emp.JoiningDate, new DateTime(2017, 12, 31)) + 1) - lwpDaysForSalesEmployee;
|
|
|
|
//// salesEmp = _salesEmps.Where(o => o.EmployeeNO == emp.EmployeeNo).FirstOrDefault();
|
|
//// if (salesEmp != null)
|
|
//// {
|
|
//// if (salesEmp.EmployeeType == EnumSalesEmployeeType.Sales_and_STI)
|
|
//// workingDays = salesEmp.STIDays;
|
|
//// else
|
|
//// workingDays = 0;
|
|
//// }
|
|
//// annualGrossAmount = workingDays * currentGrossPerDay;
|
|
//// }
|
|
//// return Math.Round(annualGrossAmount);
|
|
////}
|
|
|
|
////public int GetMonthDifference(DateTime startDate, DateTime endDate)
|
|
////{
|
|
//// int monthsApart = (12 * (startDate.Year - endDate.Year)) + startDate.Month - endDate.Month - 1;
|
|
//// return Math.Abs(monthsApart);
|
|
////}
|
|
|
|
//private double GetAnnualGrossSalary(ObjectsTemplate<SalaryMonthly> sMonthlys)
|
|
//{
|
|
// double yearlyGrossSalary = 0;
|
|
|
|
// foreach (SalaryMonthly item in sMonthlys)
|
|
// {
|
|
// foreach (SalaryMonthlyDetail smItem in item.Details)
|
|
// {
|
|
// if (smItem.itemGroupCode == EnumSalaryGroup.Gross || smItem.itemGroupCode == EnumSalaryGroup.Arrear)
|
|
// {
|
|
// if (smItem.ItemID == BasicSalaryItemID || smItem.ItemID == HouseRentItemID || smItem.ItemID == ConveyanceItemID || smItem.ItemID == MedicalItemID || smItem.ItemID == PassageFreeTravelItemID)
|
|
// {
|
|
// if (smItem.ItemCode == EnumSalaryItemCode.Bonus || smItem.ItemCode == EnumSalaryItemCode.Over_Time_Amount || smItem.ItemCode == EnumSalaryItemCode.Over_Time_Hours)
|
|
// {
|
|
// continue;
|
|
// }
|
|
// yearlyGrossSalary += smItem.ChangedAmount;
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// return yearlyGrossSalary;
|
|
//}
|
|
|
|
//private string ReplaceCommonTag(string htmlText, ID pmsYearID, EnumLetterType letterType)
|
|
//{
|
|
|
|
// double finalIncrementPercent = 0, lastYearProratedGross = 0;
|
|
// string mtName = string.Empty, mtDesig = string.Empty, mtFunction = string.Empty, newJobtitle = string.Empty, newDivision = string.Empty,
|
|
// chrName = string.Empty, chrDesig = string.Empty;
|
|
// grossSalary = 0;
|
|
// ID id = Ease.CoreV35.Model.ID.FromInteger(0);
|
|
// oGrade = Grade.Get(_hrRequest.Employee.GradeID);
|
|
// oAllowDeductBasics = AllowanceDeduction.Get(EnumStatus.Regardless);
|
|
// oADParams = ADParameter.Get(EnumStatus.Regardless, EnumAllowOrDeduct.Allowance);
|
|
// _promotionHistorys = PromotionHistory.GetByEmployeeID(_hrRequest.Employee.ID);
|
|
// pmpIncrement = PMPIncrementSimulation.GetByEmployeeID(pmsYearID, _hrRequest.EmployeeID);
|
|
|
|
// var appraisalYear = ps.PmpYear.ToString("dd MMM yyyy");//Ease.CoreV35.Utility.ConfigUtility.GetAppSettings("AppraisalYear");
|
|
// var appraisalYearOnly = ps.PmpOnlyYear.ToString();
|
|
// DateTime firstDateOfYear = DateTime.Today;
|
|
// DateTime lastDateOfYear = DateTime.Today;
|
|
// if (!string.IsNullOrWhiteSpace(appraisalYear))
|
|
// {
|
|
// firstDateOfYear = GlobalFunctions.FirstDateOfYear(Convert.ToDateTime(appraisalYear));
|
|
// lastDateOfYear = GlobalFunctions.LastDateOfYear(Convert.ToDateTime(appraisalYear));
|
|
// }
|
|
|
|
// var salaryMonthlies = SalaryMonthly.Get(_hrRequest.EmployeeID.Integer.ToString(), firstDateOfYear, lastDateOfYear);
|
|
|
|
|
|
|
|
// if (pmpIncrement != null)
|
|
// {
|
|
// // For Test
|
|
// //grossSalary = pmpIncrement.SimulationNewProposedGross;
|
|
// // For Live
|
|
// grossSalary = pmpIncrement.NewGross;
|
|
|
|
// if (pmpIncrement.IsBPPromoted && pmpIncrement.BPProposedGradeID != null)
|
|
// {
|
|
// oNewGrade = Grade.Get(pmpIncrement.BPProposedGradeID);
|
|
// }
|
|
// finalIncrementPercent = pmpIncrement.FinalIncrementPercent; //pmpIncrement.BPIncrementPercent;
|
|
// newJobtitle = string.IsNullOrWhiteSpace(pmpIncrement.NewJobTitle) ? "" : pmpIncrement.NewJobTitle;
|
|
// newDivision = string.IsNullOrWhiteSpace(pmpIncrement.NewDivision) ? "" : pmpIncrement.NewDivision;
|
|
|
|
// }
|
|
|
|
// basicSalary = Math.Round(grossSalary * (oGrade == null ? 1 : oGrade.BasicPercentofGross / 100), 2);
|
|
|
|
// oAllowDeduct = oAllowDeductBasics.Where(o => o.ID.Integer == AllowanceIDConstant.House_Rent).FirstOrDefault();
|
|
// oADParameter = ADParameter.GetApplicableParameter(_hrRequest.Employee, _hrRequest.Employee.GradeID, oADParams, oAllowDeduct == null ? id : oAllowDeduct.ID);
|
|
// houseRent = oADParameter == null ? 0 : Math.Round(grossSalary * (oADParameter.PercentOfGross / 100), 2);
|
|
|
|
// oAllowDeduct = oAllowDeductBasics.Where(o => o.ID.Integer == AllowanceIDConstant.Conveyance).FirstOrDefault();
|
|
// oADParameter = ADParameter.GetApplicableParameter(_hrRequest.Employee, _hrRequest.Employee.GradeID, oADParams, oAllowDeduct == null ? id : oAllowDeduct.ID);
|
|
// conveyance = oADParameter == null ? 0 : Math.Round(grossSalary * (oADParameter.PercentOfGross / 100), 2);
|
|
// if (conveyance > 0)
|
|
// {
|
|
// if (oADParameter.MaxAmount > 0 && oADParameter.MaxAmount < conveyance)
|
|
// conveyance = oADParameter.MaxAmount;
|
|
// }
|
|
|
|
// oAllowDeduct = oAllowDeductBasics.Where(o => o.ID.Integer == AllowanceIDConstant.Medical).FirstOrDefault();
|
|
// oADParameter = ADParameter.GetApplicableParameter(_hrRequest.Employee, _hrRequest.Employee.GradeID, oADParams, oAllowDeduct == null ? id : oAllowDeduct.ID);
|
|
// medical = oADParameter == null ? 0 : Math.Round(grossSalary * (oADParameter.PercentOfGross / 100), 2);
|
|
// if (medical > 0)
|
|
// {
|
|
// if (oADParameter.MaxAmount > 0 && oADParameter.MaxAmount < medical)
|
|
// medical = oADParameter.MaxAmount;
|
|
// }
|
|
|
|
// passageFreeTravel = grossSalary - (basicSalary + houseRent + conveyance + medical);
|
|
// if (passageFreeTravel < 0)
|
|
// passageFreeTravel = 0;
|
|
|
|
// corporateKPI = CorporateKPIDistribution.GetByEmployeeID(pmsYearID, _hrRequest.EmployeeID);
|
|
// lastYearProratedGross = corporateKPI != null ? corporateKPI.AnnualGrossSalary : GetAnnualGrossSalary(salaryMonthlies);
|
|
// _salesEmps = SalesEmployee.Get();
|
|
// DataSet oEmpDetails = Employee.GetEmpDetailsView();
|
|
// oHrEmployee = new HREmployee();
|
|
// oHrEmployee = oHrEmployee.Get(_hrRequest.Employee.EmployeeNo);
|
|
// //oDeptHead = Employee.GetDepartmentHead(_hrRequest.Employee.ID);
|
|
// Employee oMT = null;
|
|
// if (pmpIncrement != null && pmpIncrement.MTID != null && !pmpIncrement.MTID.IsUnassigned)
|
|
// {
|
|
// oMT = Employee.Get(pmpIncrement.MTID);
|
|
// }
|
|
// else
|
|
// {
|
|
// oMT = GetExceptionMTs(oHrEmployee != null ? oHrEmployee.EmployeeNo : string.Empty);
|
|
// }
|
|
// DataRow dtrowSelf = null;
|
|
|
|
// if (oEmpDetails != null && oEmpDetails.Tables.Count > 0)
|
|
// {
|
|
// dtrowSelf = oEmpDetails.Tables[0].AsEnumerable().Where(x => Convert.ToString(x["EmployeeNo"]) == _hrRequest.Employee.EmployeeNo).FirstOrDefault();
|
|
// //DataRow dtRowDH = oEmpDetails.Tables[0].AsEnumerable().Where(x => Convert.ToString(x["EmployeeNo"]) == (oDeptHead == null ? "" : oDeptHead.EmployeeNo)).FirstOrDefault();
|
|
// DataRow dtRowMT = oEmpDetails.Tables[0].AsEnumerable().Where(x => Convert.ToString(x["EmployeeNo"]) == (oMT == null ? "" : oMT.EmployeeNo.Trim())).FirstOrDefault();
|
|
// if (dtRowMT != null)
|
|
// {
|
|
// mtName = dtRowMT["Name"] == DBNull.Value ? "" : dtRowMT["Name"].ToString();
|
|
// mtDesig = dtRowMT["Designation"] == DBNull.Value ? "" : dtRowMT["Designation"].ToString();
|
|
// mtFunction = dtRowMT["Division"] == DBNull.Value ? "" : dtRowMT["Division"].ToString();
|
|
// }
|
|
|
|
// DataRow dtRowCHR = oEmpDetails.Tables[0].AsEnumerable().Where(x => Convert.ToString(x["EmployeeNo"]) == "12584").FirstOrDefault();
|
|
// if (dtRowCHR != null)
|
|
// {
|
|
// chrName = dtRowCHR["Name"] == DBNull.Value ? "" : dtRowCHR["Name"].ToString();
|
|
// chrDesig = dtRowCHR["Designation"] == DBNull.Value ? "" : dtRowCHR["Designation"].ToString();
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
// double netBonusAmount = 0;
|
|
// string maximumeligability = string.Empty;
|
|
// var personalSplitPercent = corporateKPI == null ? 0.00 : corporateKPI.PersonalSplit;
|
|
// string personalSplitAchievePercent = string.Empty;
|
|
// string printDateYear = string.Empty;
|
|
|
|
// if (corporateKPI != null)
|
|
// {
|
|
// if (ps != null && ps.PmpYear.Year == 2017)
|
|
// {
|
|
// netBonusAmount = Math.Round(corporateKPI.GrossAmount * (34.45 / 100.00));
|
|
// maximumeligability = corporateKPI.SalaryFactor.ToString();
|
|
// personalSplitAchievePercent = corporateKPI.PersonalObjectivesAchieve.ToString();
|
|
// printDateYear = "24 April " + Convert.ToDateTime(appraisalYear).AddYears(1).Year.ToString();
|
|
// }
|
|
// else
|
|
// {
|
|
// foreach (CorporateKPIDistributionSetup item in corporateKPI.CorporateKPIDistributionSetups)
|
|
// {
|
|
// netBonusAmount += item.Amount;
|
|
// }
|
|
// netBonusAmount = Math.Round(netBonusAmount + corporateKPI.PersonalObjectivesAmount);
|
|
// //netBonusAmount = Math.Round(corporateKPI.TotalObjectivesAmount);
|
|
// //netBonusAmount = Math.Round(corporateKPI.PersonalObjectivesAmount);
|
|
// maximumeligability = corporateKPI.SalaryFactor.ToString() + " %";
|
|
// personalSplitAchievePercent = Math.Round(((corporateKPI.PersonalObjectivesAchieve / 100.00) * (personalSplitPercent / 100.00)) * 100.00, 2).ToString() + " %";
|
|
// printDateYear = "21 April " + Convert.ToDateTime(appraisalYear).AddYears(1).Year.ToString();
|
|
// }
|
|
// }
|
|
|
|
// return htmlText.Replace(currentDateTag, printDateYear).
|
|
// Replace(incORrPro, Math.Round(finalIncrementPercent, 1).ToString("N1")).
|
|
// Replace(yearTag, appraisalYearOnly).
|
|
// Replace(appYearTag, Convert.ToDateTime(appraisalYear).AddYears(1).Year.ToString()).
|
|
// Replace(previousYear, Convert.ToDateTime(appraisalYear).AddYears(-1).Year.ToString()).
|
|
// Replace(salutaTionTag, _hrRequest.Employee.Gender == EnumGender.Male ? "Mr." : "Ms.").
|
|
// Replace(fullNameTag, _hrRequest.Employee.Name).
|
|
// Replace(employeeNoTag, _hrRequest.Employee.EmployeeNo).
|
|
// Replace(designationTag, dtrowSelf == null ? "" : dtrowSelf["Designation"] == DBNull.Value ? "" : dtrowSelf["Designation"].ToString()).
|
|
// Replace(functionTag, dtrowSelf == null ? "" : dtrowSelf["Division"] == DBNull.Value ? "" : dtrowSelf["Division"].ToString()).
|
|
// Replace(lastNameTag, oHrEmployee.LastName).
|
|
// Replace(annualProratedSalaryTag, lastYearProratedGross.ToString("N2")).
|
|
// Replace(personalSplitTag, personalSplitPercent.ToString()).
|
|
// Replace(corporateSplitTag, corporateKPI == null ? string.Empty : corporateKPI.CorporateSplit.ToString()).
|
|
// Replace(maximumEligibilityTag, maximumeligability).
|
|
// Replace(totalDaysTag, corporateKPI == null ? string.Empty : corporateKPI.DaysForEmployee.ToString()).
|
|
// Replace(personalKPITag, personalSplitAchievePercent).
|
|
// Replace(corporateKPITag, "3.6%").
|
|
// Replace(personalAmountTag, corporateKPI == null ? string.Empty : corporateKPI.PersonalObjectivesAmount.ToString("N0")).
|
|
// Replace(corporateAmountTag, corporateKPI == null ? string.Empty : (corporateKPI.TotalObjectivesAmount - corporateKPI.PersonalObjectivesAmount).ToString("N0")).
|
|
// Replace(totalBonusAmountTag, corporateKPI == null ? string.Empty : corporateKPI.TotalObjectivesAmount.ToString("N0")).
|
|
// Replace(bonusMultiplierTag, "34.45%").
|
|
// Replace(netBonusAmountTag, netBonusAmount.ToString("N0")).
|
|
// Replace(incrementPercentTag, Math.Round(finalIncrementPercent, 1).ToString("N1")).
|
|
// Replace(basicSalaryTag, basicSalary.ToString("N2")).
|
|
// Replace(houseRentTag, houseRent.ToString("N2")).
|
|
// Replace(conveyanceTag, conveyance.ToString("N2")).
|
|
// Replace(medicalTag, medical.ToString("N2")).
|
|
// Replace(passageFreeTravelTag, passageFreeTravel.ToString("N2")).
|
|
// Replace(grossSalaryTag, grossSalary.ToString("N2")).
|
|
// Replace(newBandNameTag, oNewGrade == null ? "" : oNewGrade.Name).
|
|
// Replace(newBandCodeTag, dtrowSelf == null ? "" : dtrowSelf["Designation"] == DBNull.Value ? "" : dtrowSelf["Designation"].ToString()).
|
|
// Replace(hodTag, mtName).
|
|
// Replace(hodDesignationTag, mtDesig).
|
|
// Replace(hodFunctionTag, mtFunction).
|
|
// Replace(newJobTitleTag, newJobtitle).
|
|
// Replace(newDivisionTag, newDivision).
|
|
// Replace(chrTag, chrName).
|
|
// Replace(chrDesignationTag, chrDesig).
|
|
// Replace(_revenueTarget, bonusData != null ? bonusData.RevenueTarget.ToString() : "0").
|
|
// Replace(_revenueAchieve, bonusData != null ? bonusData.RevenueAchieve.ToString() : "0").
|
|
// Replace(_ebitdaTarget, bonusData != null ? bonusData.EBITDATarget.ToString() : "0").
|
|
// Replace(_ebitdaAchieve, bonusData != null ? bonusData.EBITDAAchieve.ToString() : "0").
|
|
// Replace(_cashflowTarget, bonusData != null ? bonusData.CultureTarget.ToString() : "0").
|
|
// Replace(_cashflowAchieve, bonusData != null ? bonusData.CultureAchieve.ToString() : "0").
|
|
// Replace(_costintensityTarget, bonusData != null ? bonusData.DigitalTarget.ToString() : "0").
|
|
// Replace(_costintensityAchieve, bonusData != null ? bonusData.DigitalAchieve.ToString() : "0").
|
|
// Replace(_totalAchieve, bonusData != null ? (bonusData.RevenueAchieve + bonusData.EBITDAAchieve + bonusData.CultureAchieve + bonusData.DigitalAchieve).ToString() : "0");
|
|
//}
|
|
|
|
//private Employee GetExceptionMTs(string employeeNo)
|
|
//{
|
|
// Employee oMT = null;
|
|
|
|
// if (_specialMTEmpNoMapper.ContainsKey(employeeNo))
|
|
// {
|
|
// var mtEmployeeNo = _specialMTEmpNoMapper[employeeNo];
|
|
// oMT = Employee.Get(mtEmployeeNo);
|
|
// }
|
|
|
|
// return oMT;
|
|
//}
|
|
|
|
//private string PrepareFamilyInfoTable()
|
|
//{
|
|
// EmpSpouse spouse = null;
|
|
// EmpChildren children = null;
|
|
// string tableText = string.Empty;
|
|
|
|
// ObjectsTemplate<EmpSpouse> spouses = HREmployee.GetEmpSpouses(_hrRequest.Employee.ID);
|
|
// ObjectsTemplate<EmpChildren> childrens = HREmployee.GetEmpChildrens(_hrRequest.Employee.ID);
|
|
|
|
// //foreach (HRRequestPassport item in _hrRequest.HRRequestPassports)
|
|
// //{
|
|
// // if (item.Relation == "Spouse")
|
|
// // {
|
|
// // spouse = spouses.Find(x => x.ID.Integer == item.ObjectID.Integer);
|
|
// // PrepareSpouseTable(spouse, tableText);
|
|
// // }
|
|
// // else if (item.Relation == "Children")
|
|
// // {
|
|
// // children = childrens.Find(x => x.ID.Integer == item.ObjectID.Integer);
|
|
// // PrepareChildTable(children, tableText);
|
|
// // }
|
|
// //}
|
|
|
|
// return tableText;
|
|
//}
|
|
|
|
//private string PrepareSpouseTable(EmpSpouse spouse, string tableText)
|
|
//{
|
|
// tableText += @"<tr>
|
|
// <td width='127' valign='top' style='width: 95.3pt; border: solid windowtext 1.0pt;
|
|
// border-top: none; mso-border-top-alt: solid windowtext .5pt; mso-border-alt: solid windowtext .5pt;
|
|
// padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'> " + spouse.Name + @" <o:p></o:p></span></p>
|
|
// </td>
|
|
// <td width='123' valign='top' style='width: 92.0pt; border-top: none; border-left: none;
|
|
// border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
|
|
// mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;
|
|
// mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'> " + spouse.PassportNo + @" <o:p></o:p></span></p>
|
|
// </td>
|
|
// <td width='85' valign='top' style='width: 63.7pt; border-top: none; border-left: none;
|
|
// border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
|
|
// mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;
|
|
// mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'>
|
|
// <o:p> </o:p>
|
|
// </span>
|
|
// </p>
|
|
// </td>
|
|
// <td width='138' valign='top' style='width: 103.8pt; border-top: none; border-left: none;
|
|
// border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
|
|
// mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;
|
|
// mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'> " + spouse.PassportIssueDate.ToString("dd MMMM yyyy") + @" <o:p></o:p></span></p>
|
|
// </td>
|
|
// <td width='143' valign='top' style='width: 107.45pt; border-top: none; border-left: none;
|
|
// border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
|
|
// mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;
|
|
// mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'> " + spouse.PassportExpDate.ToString("dd MMM yyyy") + @" <o:p></o:p></span></p>
|
|
// </td>
|
|
// </tr>";
|
|
|
|
// return tableText;
|
|
//}
|
|
|
|
//private string PrepareChildTable(EmpChildren children, string tableText)
|
|
//{
|
|
// tableText += @"<tr>
|
|
// <td width='127' valign='top' style='width: 95.3pt; border: solid windowtext 1.0pt;
|
|
// border-top: none; mso-border-top-alt: solid windowtext .5pt; mso-border-alt: solid windowtext .5pt;
|
|
// padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'> " + children.Name + @" <o:p></o:p></span></p>
|
|
// </td>
|
|
// <td width='123' valign='top' style='width: 92.0pt; border-top: none; border-left: none;
|
|
// border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
|
|
// mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;
|
|
// mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'> " + children.PassportNo + @" <o:p></o:p></span></p>
|
|
// </td>
|
|
// <td width='85' valign='top' style='width: 63.7pt; border-top: none; border-left: none;
|
|
// border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
|
|
// mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;
|
|
// mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'>
|
|
// <o:p> </o:p>
|
|
// </span>
|
|
// </p>
|
|
// </td>
|
|
// <td width='138' valign='top' style='width: 103.8pt; border-top: none; border-left: none;
|
|
// border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
|
|
// mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;
|
|
// mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'> " + children.PassportIssueDate.ToString("dd MMMM yyyy") + @" <o:p></o:p></span></p>
|
|
// </td>
|
|
// <td width='143' valign='top' style='width: 107.45pt; border-top: none; border-left: none;
|
|
// border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
|
|
// mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;
|
|
// mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt'>
|
|
// <p class='MsoNormal' style='text-align: justify'>
|
|
// <span lang='EN-GB' style='font-size: 11.0pt'> " + children.PassportExpDate.ToString("dd MMM yyyy") + @" <o:p></o:p></span></p>
|
|
// </td>
|
|
// </tr>";
|
|
|
|
// return tableText;
|
|
//}
|
|
|
|
private string AddHeaderText(string templateHtml)
|
|
{
|
|
|
|
WebClient wc = new WebClient();
|
|
string headerHtmlText = wc.DownloadString(templateDesktopBasePath + headerTemplatePath);
|
|
headerHtmlText = headerHtmlText.Replace(logoTag, logoPath);
|
|
return templateHtml.Replace(headerTag, headerHtmlText);
|
|
}
|
|
|
|
private string AddFooterText(string templateHtml)
|
|
{
|
|
WebClient wc = new WebClient();
|
|
string footerHtmlText = wc.DownloadString(templateDesktopBasePath + footerTemplatePath);
|
|
return templateHtml.Replace(footerTag, footerHtmlText);
|
|
}
|
|
|
|
//private string AddSignatureText(string templateHtml)
|
|
//{
|
|
// WebClient wc = new WebClient();
|
|
// string signatureHtmlText = "";
|
|
|
|
// //oDeptHead = new Employee();
|
|
// //oDeptHead = Employee.GetDepartmentHead(_hrRequest.Employee.ID);
|
|
|
|
// Employee oMT = null;
|
|
// pmpIncrement = PMPIncrementSimulation.GetByEmployeeID(pmpYearID, _hrRequest.EmployeeID);
|
|
|
|
// if (pmpIncrement != null && pmpIncrement.MTID != null && !pmpIncrement.MTID.IsUnassigned)
|
|
// {
|
|
// oMT = Employee.Get(pmpIncrement.MTID);
|
|
// }
|
|
// else
|
|
// {
|
|
// oMT = GetExceptionMTs(_hrRequest.Employee.EmployeeNo);
|
|
// }
|
|
|
|
// if (oMT != null)
|
|
// {
|
|
// if (!string.IsNullOrWhiteSpace(oMT.EmployeeNo))
|
|
// {
|
|
// signatureHtmlText = wc.DownloadString(templateBasePath + SignatureTemplatePath);
|
|
// signatureHtmlText = signatureHtmlText.Replace(signatureTag, signaturepath + oMT.EmployeeNo.Trim() + ".png");
|
|
// }
|
|
// else
|
|
// {
|
|
// signatureHtmlText = wc.DownloadString(templateBasePath + SignatureTemplatePath);
|
|
// signatureHtmlText = signatureHtmlText.Replace(signatureTag, signaturepath + "Blank.png");
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// signatureHtmlText = wc.DownloadString(templateBasePath + SignatureTemplatePath);
|
|
// signatureHtmlText = signatureHtmlText.Replace(signatureTag, signaturepath + "Blank.png");
|
|
// }
|
|
|
|
// return templateHtml.Replace(signatureTag, signatureHtmlText);
|
|
//}
|
|
|
|
//private string AddCHRSignatureText(string templateHtml)
|
|
//{
|
|
// WebClient wc = new WebClient();
|
|
// string signatureHtmlText = "";
|
|
|
|
// signatureHtmlText = wc.DownloadString(templateBasePath + SignatureTemplateRightPath);
|
|
// signatureHtmlText = signatureHtmlText.Replace(signatureTag, signaturepath + "12584.png");
|
|
|
|
// return templateHtml.Replace(signatureCHRTag, signatureHtmlText);
|
|
//}
|
|
|
|
//private string AddFamilyInfoTableText(string templateHtml)
|
|
//{
|
|
// string tableHtmlText = PrepareFamilyInfoTable();
|
|
// return templateHtml.Replace(familyInfoTableTag, tableHtmlText);
|
|
//}
|
|
|
|
//public void PrepareTravelNOCPersonalWithFamilyLetter()
|
|
//{
|
|
// try
|
|
// {
|
|
// Document document = new Document();
|
|
// WebClient wc = new WebClient();
|
|
// PdfWriter.GetInstance(document, new FileStream(templateBasePath + "TempFolder/" + _hrRequest.Employee.EmployeeNo + "_Travel_NOC_Personal_With_Family.pdf", FileMode.Create));
|
|
// document.Open();
|
|
|
|
// string tempHtmlText = wc.DownloadString(templateBasePath + travelNOCPersonalWithFamilyTemplatePath);
|
|
// tempHtmlText = AddHeaderText(tempHtmlText);
|
|
// tempHtmlText = AddFooterText(tempHtmlText);
|
|
// tempHtmlText = AddFamilyInfoTableText(tempHtmlText);
|
|
// List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(ReplaceCommonTag(tempHtmlText)), null);
|
|
|
|
// for (int k = 0; k < htmlarraylist.Count; k++)
|
|
// document.Add((IElement)htmlarraylist[k]);
|
|
|
|
// document.Close();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw ex;
|
|
// }
|
|
//}
|
|
|
|
//public void PrepareTravelNOCPersonalWithoutFamilyLetter()
|
|
//{
|
|
// try
|
|
// {
|
|
// Document document = new Document();
|
|
// WebClient wc = new WebClient();
|
|
// PdfWriter.GetInstance(document, new FileStream(templateBasePath + "TempFolder/" + _hrRequest.Employee.EmployeeNo + "_Travel_NOC_Personal_Without_Family.pdf", FileMode.Create));
|
|
// document.Open();
|
|
|
|
// string tempHtmlText = wc.DownloadString(templateBasePath + travelNOCPersonalWithoutFamilyTemplatePath);
|
|
// tempHtmlText = AddHeaderText(tempHtmlText);
|
|
// tempHtmlText = AddFooterText(tempHtmlText);
|
|
// List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(ReplaceCommonTag(tempHtmlText)), null);
|
|
|
|
// for (int k = 0; k < htmlarraylist.Count; k++)
|
|
// document.Add((IElement)htmlarraylist[k]);
|
|
|
|
// document.Close();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw ex;
|
|
// }
|
|
//}
|
|
|
|
//private string GetAPBTemplatePath(int PMPYear)
|
|
//{
|
|
// string tempPath = string.Empty;
|
|
// switch (PMPYear)
|
|
// {
|
|
// case 2017:
|
|
// tempPath = apbTemplatePathOld;
|
|
// break;
|
|
// case 2018:
|
|
// tempPath = apbTemplatePath;
|
|
// break;
|
|
// case 2019:
|
|
// tempPath = apbTemplatePathNew;
|
|
// break;
|
|
// case 2020:
|
|
// tempPath = apbTemplatePath2020;
|
|
// break;
|
|
// case 2021:
|
|
// tempPath = apbTemplatePath2021;
|
|
// break;
|
|
// default:
|
|
// tempPath = apbTemplatePath2020;
|
|
// break;
|
|
// }
|
|
|
|
// return tempPath;
|
|
//}
|
|
|
|
|
|
//public void PreparePMSRelatedLetter(string letterName, EnumLetterType letterType, PMPIncrementSimulation incrementData1, CorporateKPIDistribution bonusData1)
|
|
//{
|
|
// try
|
|
// {
|
|
// incrementData = incrementData1;
|
|
// bonusData = bonusData1;
|
|
|
|
// Document document = new Document();
|
|
// WebClient wc = new WebClient();
|
|
// PdfWriter.GetInstance(document, new FileStream(templateBasePath + "TempLetter/" + _hrRequest.Employee.EmployeeNo + letterName, FileMode.Create));
|
|
// document.Open();
|
|
// string tempHtmlText = string.Empty;
|
|
// string tempPath = string.Empty;
|
|
// if (letterType == EnumLetterType.Annual_Performance_Bonus_Letter)
|
|
// {
|
|
// tempPath = ps != null ? GetAPBTemplatePath(ps.PmpYear.Year) : string.Empty;
|
|
// }
|
|
// else if (letterType == EnumLetterType.Annual_Performance_Bonus_and_Increment)
|
|
// {
|
|
// if (ps != null && ps.PmpYear.Year >= 2019)
|
|
// {
|
|
// DataSet dSet = Employee.GetEmpDetailsView(_hrRequest.EmployeeID.Integer.ToString());
|
|
// string empids = "12473,12497,12584,12737,8223";
|
|
// ObjectsTemplate<Employee> emps = Employee.GetByEmpNos(empids);
|
|
// if (dSet.Tables[0].Rows.Count > 0)
|
|
// {
|
|
// tempPath = dSet.Tables[0].Rows[0]["Division"].ToString().Trim() == "Human Resources & Administration" ? apbIncrementTemplatePathHRNew : apbIncrementTemplatePathNew;
|
|
// }
|
|
// else if (emps != null && emps.Count > 0)
|
|
// {
|
|
// tempPath = apbIncrementTemplatePathHRNew;
|
|
// }
|
|
// else
|
|
// {
|
|
// tempPath = apbIncrementTemplatePathNew;
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// DataSet dSet = Employee.GetEmpDetailsView(_hrRequest.EmployeeID.Integer.ToString());
|
|
// if (dSet.Tables[0].Rows.Count > 0)
|
|
// {
|
|
// tempPath = dSet.Tables[0].Rows[0]["Division"].ToString().Trim() == "Human Resources & Administration" ? apbIncrementTemplatePathHR : apbIncrementTemplatePath;
|
|
// }
|
|
// else
|
|
// {
|
|
// tempPath = apbIncrementTemplatePath;
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (letterType == EnumLetterType.Annual_Performance_Bonus_and_Promotion)
|
|
// {
|
|
// if (ps != null && ps.PmpYear.Year >= 2019)
|
|
// {
|
|
// tempPath = apbPromotionTemplatePathNew;
|
|
// DataSet dSet = Employee.GetEmpDetailsView(_hrRequest.EmployeeID.Integer.ToString());
|
|
// string empids = "12473,12497,12584,12737,8223";
|
|
// ObjectsTemplate<Employee> emps = Employee.GetByEmpNos(empids);
|
|
// if (dSet.Tables[0].Rows.Count > 0)
|
|
// {
|
|
// tempPath = dSet.Tables[0].Rows[0]["Division"].ToString().Trim() == "Human Resources & Administration" ? apbPromotionTemplatePathHRNew : apbPromotionTemplatePathNew;
|
|
// }
|
|
// else if (emps != null && emps.Count > 0)
|
|
// {
|
|
// tempPath = apbPromotionTemplatePathHRNew;
|
|
// }
|
|
// else
|
|
// {
|
|
// tempPath = apbPromotionTemplatePathNew;
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// DataSet dSet = Employee.GetEmpDetailsView(_hrRequest.EmployeeID.Integer.ToString());
|
|
// if (dSet.Tables[0].Rows.Count > 0)
|
|
// {
|
|
// tempPath = dSet.Tables[0].Rows[0]["Division"].ToString().Trim() == "Human Resources & Administration" ? apbPromotionTemplatePathHR : apbPromotionTemplatePath;
|
|
// }
|
|
// else
|
|
// {
|
|
// tempPath = apbPromotionTemplatePath;
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
// tempHtmlText = wc.DownloadString(templateBasePath + tempPath);
|
|
// tempHtmlText = AddHeaderText(tempHtmlText);
|
|
// tempHtmlText = AddSignatureText(tempHtmlText);
|
|
// tempHtmlText = AddCHRSignatureText(tempHtmlText);
|
|
// List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(ReplaceCommonTag(tempHtmlText, pmpYearID, letterType)), null);
|
|
|
|
// for (int k = 0; k < htmlarraylist.Count; k++)
|
|
// document.Add((IElement)htmlarraylist[k]);
|
|
|
|
// document.Close();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw ex;
|
|
// }
|
|
//}
|
|
|
|
|
|
//public void PreparePMSRelatedLetter(string folderpath, string letterName, EnumLetterType letterType, PMPIncrementSimulation incrementData1, CorporateKPIDistribution bonusData1)
|
|
//{
|
|
// try
|
|
// {
|
|
// incrementData = incrementData1;
|
|
// bonusData = bonusData1;
|
|
|
|
// Document document = new Document();
|
|
// WebClient wc = new WebClient();
|
|
// PdfWriter.GetInstance(document, new FileStream(folderpath + "/" + _hrRequest.Employee.EmployeeNo + letterName, FileMode.Create));
|
|
// document.Open();
|
|
// string tempHtmlText = string.Empty;
|
|
// string tempPath = string.Empty;
|
|
// if (letterType == EnumLetterType.Annual_Performance_Bonus_Letter)
|
|
// {
|
|
// tempPath = ps != null ? GetAPBTemplatePath(ps.PmpYear.Year) : string.Empty;
|
|
// }
|
|
// else if (letterType == EnumLetterType.Annual_Performance_Bonus_and_Increment)
|
|
// {
|
|
// if (ps != null && ps.PmpYear.Year >= 2019)
|
|
// {
|
|
// DataSet dSet = Employee.GetEmpDetailsView(_hrRequest.EmployeeID.Integer.ToString());
|
|
// string empids = "12473,12497,12584,12737,8223";
|
|
// ObjectsTemplate<Employee> emps = Employee.GetByEmpNos(empids);
|
|
// if (dSet.Tables[0].Rows.Count > 0)
|
|
// {
|
|
// tempPath = dSet.Tables[0].Rows[0]["Division"].ToString().Trim() == "Human Resources & Administration" ? apbIncrementTemplatePathHRNew : apbIncrementTemplatePathNew;
|
|
// }
|
|
// else if (emps != null && emps.Count > 0)
|
|
// {
|
|
// tempPath = apbIncrementTemplatePathHRNew;
|
|
// }
|
|
// else
|
|
// {
|
|
// tempPath = apbIncrementTemplatePathNew;
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// DataSet dSet = Employee.GetEmpDetailsView(_hrRequest.EmployeeID.Integer.ToString());
|
|
// if (dSet.Tables[0].Rows.Count > 0)
|
|
// {
|
|
// tempPath = dSet.Tables[0].Rows[0]["Division"].ToString().Trim() == "Human Resources & Administration" ? apbIncrementTemplatePathHR : apbIncrementTemplatePath;
|
|
// }
|
|
// else
|
|
// {
|
|
// tempPath = apbIncrementTemplatePath;
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (letterType == EnumLetterType.Annual_Performance_Bonus_and_Promotion)
|
|
// {
|
|
// if (ps != null && ps.PmpYear.Year >= 2019)
|
|
// {
|
|
// tempPath = apbPromotionTemplatePathNew;
|
|
// DataSet dSet = Employee.GetEmpDetailsView(_hrRequest.EmployeeID.Integer.ToString());
|
|
// string empids = "12473,12497,12584,12737,8223";
|
|
// ObjectsTemplate<Employee> emps = Employee.GetByEmpNos(empids);
|
|
// if (dSet.Tables[0].Rows.Count > 0)
|
|
// {
|
|
// tempPath = dSet.Tables[0].Rows[0]["Division"].ToString().Trim() == "Human Resources & Administration" ? apbPromotionTemplatePathHRNew : apbPromotionTemplatePathNew;
|
|
// }
|
|
// else if (emps != null && emps.Count > 0)
|
|
// {
|
|
// tempPath = apbPromotionTemplatePathHRNew;
|
|
// }
|
|
// else
|
|
// {
|
|
// tempPath = apbPromotionTemplatePathNew;
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// DataSet dSet = Employee.GetEmpDetailsView(_hrRequest.EmployeeID.Integer.ToString());
|
|
// if (dSet.Tables[0].Rows.Count > 0)
|
|
// {
|
|
// tempPath = dSet.Tables[0].Rows[0]["Division"].ToString().Trim() == "Human Resources & Administration" ? apbPromotionTemplatePathHR : apbPromotionTemplatePath;
|
|
// }
|
|
// else
|
|
// {
|
|
// tempPath = apbPromotionTemplatePath;
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
// tempHtmlText = wc.DownloadString(templateBasePath + tempPath);
|
|
// tempHtmlText = AddHeaderText(tempHtmlText);
|
|
// tempHtmlText = AddSignatureText(tempHtmlText);
|
|
// tempHtmlText = AddCHRSignatureText(tempHtmlText);
|
|
// List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(ReplaceCommonTag(tempHtmlText, pmpYearID, letterType)), null);
|
|
|
|
// for (int k = 0; k < htmlarraylist.Count; k++)
|
|
// document.Add((IElement)htmlarraylist[k]);
|
|
|
|
|
|
// document.Close();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw ex;
|
|
// }
|
|
//}
|
|
|
|
//public void PrepareEmploymentCertificateLetter()
|
|
//{
|
|
// try
|
|
// {
|
|
// ID iddd = null;
|
|
// Document document = new Document();
|
|
// WebClient wc = new WebClient();
|
|
// PdfWriter.GetInstance(document, new FileStream(templateBasePath + "TempLetter/" + _hrRequest.Employee.EmployeeNo + "_Employment_Certificate.pdf", FileMode.Create));
|
|
// document.Open();
|
|
|
|
// string tempHtmlText = wc.DownloadString(templateBasePath + employmentCertificateTemplatePath);
|
|
// tempHtmlText = AddHeaderText(tempHtmlText);
|
|
// tempHtmlText = AddFooterText(tempHtmlText);
|
|
// List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(ReplaceCommonTag(tempHtmlText, pmpYearID, EnumLetterType.Annual_Performance_Bonus_Letter)), null);
|
|
|
|
// for (int k = 0; k < htmlarraylist.Count; k++)
|
|
// document.Add((IElement)htmlarraylist[k]);
|
|
|
|
// document.Close();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw ex;
|
|
// }
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
public string createReleaseLettter(EmpResignationRequest err, Employee emp, string letterFilePath, string mainPath, string extension = "pdf")
|
|
{
|
|
string filePath = string.Empty;
|
|
string fileName = string.Empty;
|
|
extension = extension.StartsWith(".") ? extension : ("." + extension);
|
|
fileName = emp.EmployeeNo + "_Promotion Letter" + extension;
|
|
filePath = letterFilePath + fileName;//generated
|
|
|
|
extension = extension.StartsWith(".") ? extension : ("." + extension);
|
|
//TransmitTemplatePromotionLetter(ip, barcodePath, mainPath, signaturePath, fileName, letterFilePath, ds, extension);
|
|
//PreparePromotionLetterRequest(err, emp, mainPath, ip, emp, fileName, barcodePath, signaturePath, letterFilePath, ds, extension);
|
|
PrepareReleaseLettter(err, emp, fileName, null, letterFilePath, extension);
|
|
|
|
return filePath;
|
|
}
|
|
private void PrepareReleaseLettter(EmpResignationRequest err, Employee emp, string letterName, string signaturePath, string generatedPath, string extension = "pdf")
|
|
{
|
|
try
|
|
{
|
|
extension = extension.StartsWith(".") ? extension : ("." + extension);
|
|
WebClient wc = new WebClient();
|
|
string tempHtmlText = string.Empty;
|
|
tempHtmlText = wc.DownloadString(templateDesktopBasePath + releaseLetter);
|
|
|
|
FontFactory.FontImp = new FontFactoryImp(); //UnicodeFontFactory(font);
|
|
|
|
//tempHtmlText = AddHeaderText(tempHtmlText);
|
|
tempHtmlText = ReplaceCommonTagForReleaseLetter(tempHtmlText, err, emp, signaturePath);
|
|
|
|
|
|
var pdfFileCreationPath = System.IO.Path.Combine(generatedPath, letterName);
|
|
|
|
if (extension.Trim().ToUpper() == ".PDF")
|
|
{
|
|
using (FileStream fStream = new FileStream(pdfFileCreationPath, FileMode.Create))
|
|
{
|
|
Document document = new Document(PageSize.LETTER, 72f, 72f, 30f, 0f);
|
|
|
|
PdfWriter.GetInstance(document, fStream);
|
|
document.Open();
|
|
|
|
List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(tempHtmlText), null);
|
|
|
|
for (int k = 0; k < htmlarraylist.Count; k++)
|
|
document.Add((IElement)htmlarraylist[k]);
|
|
|
|
document.Close();
|
|
}
|
|
}
|
|
else if (extension.Trim().ToUpper() == ".DOCX" || extension.Trim().ToUpper() == ".DOC")
|
|
{
|
|
//var generatedHtmlFile = fullFilePath + ".html";
|
|
//File.WriteAllText(generatedHtmlFile, tempHtmlText);
|
|
//Spire.Doc.Document doc = new Spire.Doc.Document();
|
|
//doc.LoadFromFile(generatedHtmlFile, Spire.Doc.FileFormat.Html, Spire.Doc.Documents.XHTMLValidationType.None);
|
|
//doc.SaveToFile(fullFilePath, extension.Trim().ToUpper() == ".DOCX" ? Spire.Doc.FileFormat.Docx : Spire.Doc.FileFormat.Doc);
|
|
//File.Delete(generatedHtmlFile);
|
|
|
|
//using (WordprocessingDocument wordPrpcessingDoc = WordprocessingDocument.Create(sPath + "\\" + letterName, WordprocessingDocumentType.Document))
|
|
//{
|
|
// MainDocumentPart mainPart = wordPrpcessingDoc.AddMainDocumentPart();
|
|
// mainPart.Document = new DocumentFormat.OpenXml.Wordprocessing.Document();
|
|
// DocumentFormat.OpenXml.Wordprocessing.Body body = mainPart.Document.AppendChild(new DocumentFormat.OpenXml.Wordprocessing.Body());
|
|
// DocumentFormat.OpenXml.Wordprocessing.Paragraph para = body.AppendChild(new DocumentFormat.OpenXml.Wordprocessing.Paragraph());
|
|
// DocumentFormat.OpenXml.Wordprocessing.Run run = para.AppendChild(new DocumentFormat.OpenXml.Wordprocessing.Run());
|
|
// run.AppendChild(new DocumentFormat.OpenXml.Wordprocessing.Text("AAAA"));
|
|
//}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.InnerException != null ? ex.InnerException.Message.ToString() : ex.Message.ToString());
|
|
}
|
|
}
|
|
private string ReplaceCommonTagForReleaseLetter(string htmlText, EmpResignationRequest err, Employee emp, string signaturePath)
|
|
{
|
|
//Tags
|
|
//string authsign = signaturePath + "TempSignatureFiles\\Signature Tamanna.png";
|
|
|
|
return htmlText.Replace(currentDateTag, err.ApprovedDate?.ToString("dd MMMM yyyy")).
|
|
Replace(fullNameTag, emp.Name).
|
|
Replace(employeeNoTag, emp.EmployeeNo).
|
|
Replace(joiningDate, emp.JoiningDate.ToString("dd MMM yyyy")).
|
|
Replace(lastWorkingDate, err.LastWorkingDate?.ToString("dd MMM yyyy")).
|
|
Replace(designationTag, emp.Designation.Name).
|
|
Replace(departmentTag, emp.Department.Name);
|
|
}
|
|
|
|
}
|
|
}
|