profile letter Template

This commit is contained in:
mashfiq 2025-01-15 17:30:18 +06:00
parent 4f7337c5b7
commit 7b8473faef
11 changed files with 6674 additions and 234 deletions

View File

@ -1377,11 +1377,11 @@ namespace HRM.BO
//return words;
#endregion
string[] Below20 = { "", "One ", "Two ", "Three ", "Four ",
"Five ", "Six " , "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
"Twelve " , "Thirteen ", "Fourteen ","Fifteen ",
"Sixteen " , "Seventeen ","Eighteen " , "Nineteen " };
"Five ", "Six " , "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
"Twelve " , "Thirteen ", "Fourteen ","Fifteen ",
"Sixteen " , "Seventeen ","Eighteen " , "Nineteen " };
string[] Below100 = { "", "", "Twenty ", "Thirty ",
"Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " };
"Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " };
string InWords = "";
if (Num >= 1 && Num < 20)
InWords += Below20[Num];
@ -1398,6 +1398,54 @@ namespace HRM.BO
return InWords;
}
public static string MillionToInWords(int no)
{
if (no == 0)
return "zero";
if (no < 0)
return "minus " + MillionToInWords(Math.Abs(no));
string stringValue = "";
if ((no / 1000000) > 0)
{
stringValue += MillionToInWords(no / 1000000) + " million ";
no %= 1000000;
}
if ((no / 1000) > 0)
{
stringValue += MillionToInWords(no / 1000) + " thousand ";
no %= 1000;
}
if ((no / 100) > 0)
{
stringValue += MillionToInWords(no / 100) + " hundred ";
no %= 100;
}
if (no > 0)
{
if (stringValue != "")
stringValue += "and ";
var units = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
var tens = new[] { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };
if (no < 20)
stringValue += units[no];
else
{
stringValue += tens[no / 10];
if ((no % 10) > 0)
stringValue += "-" + units[no % 10];
}
}
return stringValue;
}
}

View File

@ -417,7 +417,8 @@ namespace HRM.BO
{
Email = 1,
Event = 2,
Letter = 3
Letter = 3,
Desktop_Letter = 4
}
public enum EnumLeaveDayPeriod
@ -555,9 +556,14 @@ namespace HRM.BO
public const string CandidateDesig = "<<CANDIDATEDESIGNATION>>";
public const string CandidateGrade = "<<CANDIDATEGRADE>>";
public const string CandidateBasic = "<<CANDIDATEBASIC>>";
public const string CandidateBasicPercent = "<<CANDIDATEBASICPERCENT>>";
public const string AllowHR = "<<ALLOWHR>>";
public const string AllowHRPercent = "<<ALLOWHRPERCENT>>";
public const string AllowLTA = "<<ALLOWLTA>>";
public const string AllowMedical = "<<ALLOWMEDICAL>>";
public const string AllowMedicalPercent = "<<ALLOWMEDICALPERCENT>>";
public const string AllowConveyance = "<<ALLOWCONVEYANCE>>";
public const string AllowConveyancePercent = "<<ALLOWCONVEYANCEPERCENT>>";
public const string AllowTotal = "<<TOTAL>>";
public const string AcceptWithIN = "<<ACCEPTWITHIN>>";
public const string JoiningBefore = "<<JOINBEFORE>>";
@ -575,6 +581,53 @@ namespace HRM.BO
public const string LineManagerDesignation = "<<SUPERVISORDESIGNATION>>";
public const string FathersName = "<<FATHERSNAME>>";
public const string MothersName = "<<MOTHERSNAME>>";
public const string TakaInWord = "<<TakaInWord>>";
public const string EmpPresentAddress = "<<EMPPresentAddress>>";
public const string EmpPresentDistrict = "<<EMPPresentDistrict>>";
public const string EmpPresentThana = "<<EMPPresentThana>>";
public const string EmpPresentCountry = "<<EMPPresentCountry>>";
public const string EmpNationality = "<<EMPNationality>>";
public const string EmpPresentPhone = "<<EMPPresentPhone>>";
public const string EmpPresentMobile = "<<EMPPresentMobile>>";
public const string EmpReligion = "<<EmpReligion>>";
public const string EmpGender = "<<EmpGender>>";
public const string EmpMaritalStatus = "<<EmpMaritalStatus>>";
// Bangla Tags
public const string EmpNameBangla = "<<bvg>>";
public const string EmpCodeBangla = "<<‡KvW>>";
public const string EmpWorkType = "<<Kv‡RiaiY>>";
public const string EmpSpouseName = "<<¯^vgx/¯¿xibvg>>";
public const string JoiningDateBangla = "<<‡hvM`vb>>";
public const string EmpDesignaionBangla = "<<c`ex>>";
public const string EmpDepartmentBangla = "<<wefvM>>";
public const string BirthDateBangla = "<<Rb¥ZvwiL>>";
public const string ProbationDateBangla = "<<wk¶vbexkZvwiL>>";
public const string GradeBangla = "<<†MÖW>>";
public const string BasicSalaryBangla = "<<gyj†eZb>>";
public const string HouseRentBangla = "<<evoxfvov>>";
public const string ConveyenceBangla = "<<hvZvqvZfvZv>>";
public const string MedicalBangla = "<<wPwKrmvfvZv>>";
public const string FoodBangla = "<<Lv`¨fvZv>>";
public const string AttendenceBonusBangla = "<<ab>>";
public const string ConductBonusBangla = "<<cb>>";
public const string FatherNameBangla = "<<wcZvibvg>>";
public const string MotherNameBangla = "<<gvZvibvg>>";
public const string SpouseNameBangla = "<<¯úvD†Ri bvg>>";
public const string VillagePABangla = "<<¯vqxMÖvg>>";
public const string PostOfficePABangla = "<<¯vqx‡cvóAwdm>>";
public const string ThanaPABangla = "<<¯vqx_vbv>>";
public const string DistrictPABangla = "<<¯vqx‡Rjv>>";
public const string VillageTABangla = "<<eZ©gvbMÖvg>>";
public const string PostOfficeTABangla = "<<eZ©gvb‡cvóAwdm>>";
public const string ThanaTABangla = "<<eZ©gvb_vbv>>";
public const string DistrictTABangla = "<<eZ©gvb‡Rjv>>";
public const string TotalTakaBangla = "<<me©‡gvU>>";
public const string SectionBangla = "<<‡mKkb>>";
public const string BloodGroupBangla = "<<i‡³iMÖæc>>";
public const string FloorBangla = "<<‡d¬vi>>";
#endregion

View File

@ -26,7 +26,6 @@
<Compile Remove="Attendance\BuyerSetup.cs" />
<Compile Remove="Organogram\OrganisationChart.cs" />
<Compile Remove="Process\NotificationProcess.cs" />
<Compile Remove="TagOutput\MSWord.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -58,6 +58,7 @@ namespace HRM.BO
public string Experience { get; set; }
public string Skill { get; set; }
public string PrevCandidateStatus { get; set; }
public string TrackNo { get; set; }
#endregion
//#region Service Factory ICVService : ICVService

View File

@ -14,29 +14,60 @@ namespace HRM.BO
public class FixedLetterTemplte
{
//BAT Letter Template
public const int Visa_Letter_Business_Trip_With_Family = 1;
public const int Salary_Certificate = 2;
public const int Visa_Letter_Business_Trip = 3;
public const int Visa_Letter_Personal_Trip = 4;
public const int Visa_Letter_With_Family = 5;
public const int Loan_Letter_Bank = 6;
public const int Foreign_Currency_Bank_AC_For_secondee = 7;
public const int Visa_for_Business_trip_or_Family = 8;
public const int Visa_for_Company_Business = 9;
public const int Loan_Certificate_Letter_for_Authorization = 10;
public const int Loan_Certificate_Take_Home_Salary = 11;
public const int Intvw_BrdMember_Notify_Mail = 12;
public const int Employee_Intvw_Notify_Mail = 13;
public const int Applicant_Intvw_Notify_Mail = 14;
////BAT Letter Template
//public const int Visa_Letter_Business_Trip_With_Family = 1;
//public const int Salary_Certificate = 2;
//public const int Visa_Letter_Business_Trip = 3;
//public const int Visa_Letter_Personal_Trip = 4;
//public const int Visa_Letter_With_Family = 5;
//public const int Loan_Letter_Bank = 6;
//public const int Foreign_Currency_Bank_AC_For_secondee = 7;
//public const int Visa_for_Business_trip_or_Family = 8;
//public const int Visa_for_Company_Business = 9;
//public const int Loan_Certificate_Letter_for_Authorization = 10;
//public const int Loan_Certificate_Take_Home_Salary = 11;
//public const int Intvw_BrdMember_Notify_Mail = 12;
//public const int Employee_Intvw_Notify_Mail = 13;
//public const int Applicant_Intvw_Notify_Mail = 14;
//public const int Welcome_Mail_New_Joiner = 15;
//public const int Welcome_Mail_Employee = 16;
//public const int Induction_Request_New_Joiner = 17;
//public const int Induction_Request_Employee = 18;
//public const int Announcement_New_Joiner = 19;
//public const int Announcement_Employee = 20;
//public const int Candidate_Offer_Letter = 21;
//public const int Candidate_Appointment_Letter = 22;
//Echotex Letter Template
public const int None = 0;
public const int Officer_Appointment_Letter = 1;
public const int Staff_Appointment_Letter = 2;
public const int Worker_Appointment_Letter = 3;
public const int Salary_Certificate_Letter = 4;
public const int Official_Visa_Letter = 5;
public const int Visa_with_family_Letter = 6;
public const int University_admission_Letter = 7;
public const int Credit_card_Letter = 8;
public const int EXPERIENCE_CERTIFICATE_Letter = 9;
public const int Training_Notification = 10; //Done
public const int Applicant_Intvw_Notify_Mail = 11; //Done
public const int Employee_Intvw_Notify_Mail = 12; //Done
public const int Intvw_BrdMember_Notify_Mail = 13; //Done
public const int Candidate_Offer_Letter = 14; //Done
public const int Welcome_Mail_New_Joiner = 15;
public const int Welcome_Mail_Employee = 16;
public const int Induction_Request_New_Joiner = 17;
public const int Induction_Request_Employee = 18;
public const int Announcement_New_Joiner = 19;
public const int Announcement_Employee = 20;
public const int Candidate_Offer_Letter = 21;
public const int Candidate_Appointment_Letter = 22;
public const int Notify_Candidate_for_Interview = 21;
public const int Notify_Candidate_For_Not_Selected = 22;
public const int Travel_NOC_Business = 23;
public const int Travel_NOC_Personal_with_Family = 24;
public const int Travel_NOC_Personal_without_Family = 25;
public const int Employment_Certificate = 26;
public const int Salary_Without_Increment_Letter = 27;
public const int Salary_With_Increment_Letter = 28;
public static bool IsValidForDelete(int templateID)
{
if (templateID <= 17)

View File

@ -1,232 +1,230 @@
using Common.BO;
using Ease.Core.Model;
//using System;
//using System.Collections.Generic;
//using System.Text;
//using System.Collections;
//using System.Data;
//using System.IO;
////using Microsoft.Office.Interop;
//using Microsoft.Office.Interop.Word;
//using System.Reflection;
//namespace HRM.BO
//{
// public class MSWord
// {
// private Hashtable _Pair;
// private string _OriginalFile;
// private string _PreparedFile;
// private Application _wordapp;
// public MSWord()
// {
// //_wordapp = null;
// }
// public Hashtable Pair
// {
// get
// {
// return _Pair;
// }
// }
// public string OriginalFile
// {
// get
// {
// return _OriginalFile;
// }
// set
// {
// _OriginalFile = value;
// }
// }
// public string PreparedFile
// {
// get
// {
// return _PreparedFile;
// }
// }
// public void DeleteFile()
// {
// try
// {
// File.Delete(_PreparedFile);
// }
// catch
// {
// }
// }
// private void CreateCopy()
// {
// string sRoot = Path.GetDirectoryName(_OriginalFile);
// string sFileName = Path.GetFileNameWithoutExtension(_OriginalFile);
// string sExtention = Path.GetExtension(_OriginalFile);
// string sNewFileName = sRoot + "\\" + sFileName + DateTime.Now.ToString("hhmmss") + " " + new Random().Next().ToString()
// + sExtention;
// _PreparedFile = sNewFileName;
// if (File.Exists(OriginalFile) == true)
// {
// File.Copy(OriginalFile, PreparedFile);
// }
// else
// {
// throw new Exception("File Not Found : " + "File Path : " + _OriginalFile);
// }
// }
// private void CreateCopy(string destFileName)
// {
// _PreparedFile = destFileName;
// if (File.Exists(OriginalFile) == true)
// {
// File.Copy(OriginalFile, PreparedFile, true);
// FileInfo fi = new FileInfo(PreparedFile);
// if (fi.IsReadOnly)
// fi.IsReadOnly = false;
// }
// else
// {
// throw new Exception("File Not Found : " + "File Path : " + _OriginalFile);
// }
// }
// public void OpenWordApplication()
// {
// _wordapp = new Microsoft.Office.Interop.Word.Application();
// }
// public void CloseWordApplication()
// {
// object SaveChanges = true;
// object Missing = System.Reflection.Missing.Value;
// if (_wordapp != null)
// _wordapp.Quit(ref SaveChanges, ref Missing, ref Missing);
// }
// public void PrintWordDoc(object[] argValues, String[] argNames)
// {
// object Missing = System.Reflection.Missing.Value;
// object wb = _wordapp.WordBasic;
// //first arg is a printer name
// wb.GetType().InvokeMember("FilePrintSetup", BindingFlags.InvokeMethod, null,
// wb, argValues, null, null, argNames);
using Payroll.BO;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Reflection;
// object myTrue = true; // Print in background
// object myFalse = false;
namespace Payroll.BO
{
public class MSWord
{
private Hashtable _Pair;
private string _OriginalFile;
private string _PreparedFile;
private Microsoft.Office.Interop.Word.Application _wordapp;
public MSWord()
{
_wordapp = null;
}
public Hashtable Pair
{
get
{
return _Pair;
}
}
// _wordapp.PrintOutOld(ref myTrue,
// ref myFalse, ref Missing, ref Missing, ref Missing,
// ref Missing, ref Missing,
// ref Missing, ref Missing, ref Missing, ref myFalse,
// ref Missing, ref Missing, ref Missing, ref Missing);
public string OriginalFile
{
get
{
return _OriginalFile;
}
set
{
_OriginalFile = value;
}
}
public string PreparedFile
{
get
{
return _PreparedFile;
}
}
// while (_wordapp.BackgroundPrintingStatus > 0)
// {
// System.Threading.Thread.Sleep(250);
// }
public void DeleteFile()
{
try
{
File.Delete(_PreparedFile);
}
catch
{
// }
// public void ReplaceWords(string destFileName, Hashtable tagValueHashTable)
// {
// object SaveChanges = true;
// // if (_wordapp == null) OpenWordApplication();
}
}
// object Missing = System.Reflection.Missing.Value;
private void CreateCopy()
{
string sRoot = Path.GetDirectoryName(_OriginalFile);
string sFileName = Path.GetFileNameWithoutExtension(_OriginalFile);
string sExtention = Path.GetExtension(_OriginalFile);
string sNewFileName = sRoot + "\\" + sFileName + DateTime.Now.ToString("hhmmss") + " " + new Random().Next().ToString()
+ sExtention;
_PreparedFile = sNewFileName;
if (File.Exists(OriginalFile) == true)
{
File.Copy(OriginalFile, PreparedFile);
}
else
{
throw new Exception("File Not Found : " + "File Path : " + _OriginalFile);
}
}
private void CreateCopy(string destFileName)
{
_PreparedFile = destFileName;
if (File.Exists(OriginalFile) == true)
{
File.Copy(OriginalFile, PreparedFile, true);
FileInfo fi = new FileInfo(PreparedFile);
if (fi.IsReadOnly)
fi.IsReadOnly = false;
}
else
{
throw new Exception("File Not Found : " + "File Path : " + _OriginalFile);
}
}
public void OpenWordApplication()
{
_wordapp = new Microsoft.Office.Interop.Word.Application();
}
public void CloseWordApplication()
{
object SaveChanges = true;
object Missing = System.Reflection.Missing.Value;
if (_wordapp!=null)
_wordapp.Quit(ref SaveChanges, ref Missing, ref Missing);
}
public void PrintWordDoc(object[] argValues, String[] argNames)
{
object Missing = System.Reflection.Missing.Value;
object wb = _wordapp.WordBasic;
//first arg is a printer name
wb.GetType().InvokeMember("FilePrintSetup", BindingFlags.InvokeMethod, null,
wb, argValues, null, null, argNames);
// CreateCopy(destFileName);
// Microsoft.Office.Interop.Word.Document oDoc = null;
// try
// {
// object FileName = _PreparedFile;
// object ReadOnly = false;
// object TrueBool = true;
// object FalseBool = false;
// object IsVisible = true;
// object FindText = "";
// object ReplaceText = "";
object myTrue = true; // Print in background
object myFalse = false;
// oDoc = _wordapp.Documents.Open(ref FileName, ref Missing, ref ReadOnly, ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref IsVisible, ref Missing, ref Missing, ref Missing, ref Missing);
// oDoc.Activate();
_wordapp.PrintOutOld(ref myTrue,
ref myFalse, ref Missing, ref Missing, ref Missing,
ref Missing, ref Missing,
ref Missing, ref Missing, ref Missing, ref myFalse,
ref Missing, ref Missing, ref Missing, ref Missing);
// object FindContinue = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue;
// object ReplaceAll = Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll;
// object MatchCase = true;
// _Pair = (tagValueHashTable != null) ? tagValueHashTable : new Hashtable();
// foreach (string sKey in _Pair.Keys)
// {
// FindText = sKey;
// ReplaceText = tagValueHashTable[sKey];
// _wordapp.Selection.Find.Execute(ref FindText, ref MatchCase, ref TrueBool, ref Missing, ref Missing, ref Missing, ref TrueBool, ref FindContinue, ref Missing,
// ref ReplaceText, ref ReplaceAll, ref Missing, ref Missing, ref Missing, ref Missing);
// }
while (_wordapp.BackgroundPrintingStatus > 0)
{
System.Threading.Thread.Sleep(250);
}
// }
// catch (Exception ex)
// {
// throw new Exception("Error: Could not read file from disk. Original error: " + ex.Message);
// }
// finally
// {
// if (oDoc != null) _wordapp.Documents.Close(ref SaveChanges, ref Missing, ref Missing);
// }
// }
}
public void ReplaceWords(string destFileName, Hashtable tagValueHashTable)
{
object SaveChanges = true;
// if (_wordapp == null) OpenWordApplication();
object Missing = System.Reflection.Missing.Value;
// public void printDoc()
// {
// Microsoft.Office.Interop.Word.Application ac = new Microsoft.Office.Interop.Word.Application();
// Microsoft.Office.Interop.Word.Application app = ac.Application;
CreateCopy(destFileName);
Microsoft.Office.Interop.Word.Document oDoc=null;
try
{
object FileName = _PreparedFile;
object ReadOnly = false;
object TrueBool = true;
object FalseBool = false;
object IsVisible = true;
object FindText = "";
object ReplaceText = "";
// // I'm setting all of the alerts to be off as I am trying to get
// // this to print in the background
// app.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
oDoc = _wordapp.Documents.Open(ref FileName, ref Missing, ref ReadOnly, ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref IsVisible, ref Missing, ref Missing, ref Missing, ref Missing);
oDoc.Activate();
// // Open the document to print...
// object filename = "myFile.rtf";
// object missingValue = Type.Missing;
object FindContinue = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue;
object ReplaceAll = Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll;
object MatchCase = true;
_Pair = (tagValueHashTable != null) ? tagValueHashTable : new Hashtable();
foreach (string sKey in _Pair.Keys)
{
FindText = sKey;
ReplaceText = tagValueHashTable[sKey];
_wordapp.Selection.Find.Execute(ref FindText, ref MatchCase, ref TrueBool, ref Missing, ref Missing, ref Missing, ref TrueBool, ref FindContinue, ref Missing,
ref ReplaceText, ref ReplaceAll, ref Missing, ref Missing, ref Missing, ref Missing);
}
}
catch (Exception ex)
{
throw new Exception("Error: Could not read file from disk. Original error: " + ex.Message);
}
finally
{
if (oDoc != null) _wordapp.Documents.Close(ref SaveChanges, ref Missing, ref Missing);
}
}
// // Using OpenOld so as to be compatible with other versions of Word
// Microsoft.Office.Interop.Word.Document document = app.Documents.OpenOld(ref filename,
// ref missingValue, ref missingValue,
// ref missingValue, ref missingValue, ref missingValue,
// ref missingValue, ref missingValue, ref missingValue, ref missingValue);
public void printDoc()
{
Microsoft.Office.Interop.Word.Application ac = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Application app = ac.Application;
// // Set the active printer
// app.ActivePrinter = "My Printer Name";
// I'm setting all of the alerts to be off as I am trying to get
// this to print in the background
app.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
// object myTrue = true; // Print in background
// object myFalse = false;
// Open the document to print...
object filename = "myFile.rtf";
object missingValue = Type.Missing;
// //// Using PrintOutOld to be version independent
// //m_App.ActiveDocument.PrintOutOld(ref myTrue,
// //ref myFalse, ref missingValue, ref missingValue, ref missingValue,
// // missingValue, ref missingValue,
// //ref missingValue, ref missingValue, ref missingValue, ref myFalse,
// // ref missingValue, ref missingValue, ref m_MissingValue);
// Using OpenOld so as to be compatible with other versions of Word
Microsoft.Office.Interop.Word.Document document = app.Documents.OpenOld(ref filename,
ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue, ref missingValue);
// //document.Close(ref missingValue, ref missingValue, ref missingValue);
// Set the active printer
app.ActivePrinter = "My Printer Name";
// //// Make sure all of the documents are gone from the queue
// //while(m_App.BackgroundPrintingStatus > 0)
// //{
// //System.Threading.Thread.Sleep(250);
// //}
object myTrue = true; // Print in background
object myFalse = false;
// //app.Quitref missingValue, ref missingValue, ref missingValue);
// }
//// Using PrintOutOld to be version independent
//m_App.ActiveDocument.PrintOutOld(ref myTrue,
//ref myFalse, ref missingValue, ref missingValue, ref missingValue,
// missingValue, ref missingValue,
//ref missingValue, ref missingValue, ref missingValue, ref myFalse,
// ref missingValue, ref missingValue, ref m_MissingValue);
//document.Close(ref missingValue, ref missingValue, ref missingValue);
//// Make sure all of the documents are gone from the queue
//while(m_App.BackgroundPrintingStatus > 0)
//{
//System.Threading.Thread.Sleep(250);
//}
//app.Quitref missingValue, ref missingValue, ref missingValue);
}
}
}
// }
//}

View File

@ -9,6 +9,7 @@ using System.Linq.Expressions;
using HRM.BO;
using System.ComponentModel.DataAnnotations;
using static iTextSharp.text.pdf.AcroFields;
using System.Collections;
namespace HRM.DA
{
@ -5673,5 +5674,177 @@ namespace HRM.DA
return oEmpBasicInfos;
}
public Hashtable CollectDataForBanglaAppointmentHash(HREmployee employee, PayrollType payrollType)//, bool isPhotoNeeded = false)
{
Hashtable table = new Hashtable();
//DataRow oRow = null;
//DataTable dEmpInfo = new DataTable();
string sempId = Convert.ToString(employee.ID);
PhotoPath pPath = new PhotoPathService().Get().FirstOrDefault();
DataTable dtEmpBasicInfo = new EmployeeService().GetAllEmpBasicInfo(sempId)
.Tables[0]
.AsEnumerable()
.CopyToDataTable();
if (dtEmpBasicInfo.Rows.Count > 0)
{
DataRow drBasic = dtEmpBasicInfo.Rows[0];
//oRow = dEmpInfo.NewRow();
table.Add(TagOutputConstant.EmpNameBangla, drBasic["BanglaName"].ToString());
table.Add(TagOutputConstant.EmpCodeBangla, drBasic["EmployeeNo"].ToString());
table.Add(TagOutputConstant.EmpSpouseName, drBasic["SPOUSENAMEBANGLA"].ToString());
table.Add(TagOutputConstant.EmpWorkType, drBasic["WorkType"].ToString());
table.Add(TagOutputConstant.FatherNameBangla, drBasic["FATHERNAMEBANGLA"].ToString());
table.Add(TagOutputConstant.MotherNameBangla, drBasic["MOTHERNAMEBANGLA"].ToString());
table.Add(TagOutputConstant.SpouseNameBangla, drBasic["SPOUSENAMEBANGLA"].ToString());
//oRow["HusbandName"] = string.Empty;
table.Add(TagOutputConstant.JoiningDateBangla, Convert.ToDateTime(drBasic["JoiningDate"].ToString()).ToString("dd'/'MM'/'yyyy"));
table.Add(TagOutputConstant.ProbationDateBangla, Convert.ToDateTime(drBasic["JoiningDate"].ToString()).AddDays(90).ToString("dd'/'MM'/'yyyy"));
table.Add(TagOutputConstant.BirthDateBangla, Convert.ToDateTime(drBasic["BIRTHDATE"].ToString()).ToString("dd'/'MM'/'yyyy"));
//table.Add(TagOutputConstant.BloodGroupBangla, ((EnumBloodGroup)Convert.ToInt32(drBasic["BLOODGROUP"].ToString())).BloodGroupToBangla());
table.Add(TagOutputConstant.BloodGroupBangla, GlobalFunctions.BloodGroupToBangla((EnumBloodGroup)Convert.ToInt32(drBasic["BLOODGROUP"].ToString())));
//if (isPhotoNeeded && _rImageManager != null)
//{
// oRow["EmpPhotograph"] = _rImageManager.GetImage(drBasic["PhotoPath"].ToString());
//}
table.Add(TagOutputConstant.VillagePABangla, drBasic["PERMANENTADDRESSINBANGLA"].ToString());
table.Add(TagOutputConstant.PostOfficePABangla, drBasic["ParmanentPOInBangla"].ToString());
table.Add(TagOutputConstant.ThanaPABangla, drBasic["ParmanentThanaBangla"].ToString());
table.Add(TagOutputConstant.DistrictPABangla, drBasic["ParmanentDistricBANGLA"].ToString());
table.Add(TagOutputConstant.VillageTABangla, drBasic["PRESENTADDRESSINBANGLA"].ToString());
table.Add(TagOutputConstant.PostOfficeTABangla, drBasic["PresentPOInBangla"].ToString());
table.Add(TagOutputConstant.ThanaTABangla, drBasic["TempThanaBangla"].ToString());
table.Add(TagOutputConstant.DistrictTABangla, drBasic["TempDistricBANGLA"].ToString());
table.Add(TagOutputConstant.EmpDepartmentBangla, drBasic["DepartmentBangla"].ToString());
table.Add(TagOutputConstant.SectionBangla, drBasic["SectionBangla"].ToString());
table.Add(TagOutputConstant.FloorBangla, drBasic["FloorBangla"].ToString());
//oRow["EducationLevel"] = drBasic["EducationLevel"];
table.Add(TagOutputConstant.EmpDesignaionBangla, drBasic["BanglaDesignation"].ToString());
table.Add(TagOutputConstant.GradeBangla, drBasic["GradeBanglaName"].ToString());
//oRow["NationalID"] = drBasic["NationalID"];
string moneyFormat = "#,##0.00";
table.Add(TagOutputConstant.BasicSalaryBangla, employee.BasicSalary.ToString(moneyFormat));
table.Add(TagOutputConstant.HouseRentBangla, 0.ToString(moneyFormat));
table.Add(TagOutputConstant.ConveyenceBangla, 0.ToString(moneyFormat));
table.Add(TagOutputConstant.MedicalBangla, 0.ToString(moneyFormat));
table.Add(TagOutputConstant.FoodBangla, 0.ToString(moneyFormat));
table.Add(TagOutputConstant.AttendenceBonusBangla, 0.ToString(moneyFormat));
table.Add(TagOutputConstant.ConductBonusBangla, 0.ToString(moneyFormat));
List<ADParameterEmployee> adParamEmps = null;
List<ADParameter> adParams = new ADParameterService().Get(employee.GradeID, EnumEntitleType.Grade, EnumAllowOrDeduct.Allowance, payrollType.ID);
List<AllowanceDeduction> allowdeducitons = new AllowanceDeductionService().Get(EnumStatus.Regardless, payrollType.ID);
EmployeeGradeSalary oEmpGradeSalary = new EmployeeGradeSalaryService().GetBasicOnDateBAT(employee.ID, DateTime.Now);
if (adParams != null)
{
foreach (ADParameter adParam in adParams)
{
//double amount = new ADParameterService().GetGradeDefinedAmount(employee, employee.BasicSalary, employee.GrossSalary, payrollTypeID);
double amount = new ADParameterService().GetGradeDefinedAmount(employee, employee.BasicSalary, employee.GrossSalary, oEmpGradeSalary, adParam);
adParam.AllowanceDeduction = allowdeducitons.FirstOrDefault(x => x.ID == adParam.AllowDeductID);
switch (adParam.AllowanceDeduction.Code.Trim())
{
case "001":
table.Remove(TagOutputConstant.AttendenceBonusBangla);
table.Add(TagOutputConstant.AttendenceBonusBangla, amount.ToString(moneyFormat));
break;
case "002":
table.Remove(TagOutputConstant.ConductBonusBangla);
table.Add(TagOutputConstant.ConductBonusBangla, amount.ToString(moneyFormat));
break;
case "008":
table.Remove(TagOutputConstant.HouseRentBangla);
table.Add(TagOutputConstant.HouseRentBangla, amount.ToString(moneyFormat));
break;
case "010":
table.Remove(TagOutputConstant.ConveyenceBangla);
table.Add(TagOutputConstant.ConveyenceBangla, amount.ToString(moneyFormat));
break;
case "011":
table.Remove(TagOutputConstant.MedicalBangla);
table.Add(TagOutputConstant.MedicalBangla, amount.ToString(moneyFormat));
break;
case "006":
table.Remove(TagOutputConstant.FoodBangla);
table.Add(TagOutputConstant.FoodBangla, amount.ToString(moneyFormat));
break;
default:
break;
}
}
}
adParamEmps = new ADParameterEmployeeService().GetByEmployee(employee.ID, EnumAllowOrDeduct.Allowance, EnumADEmpType.AppliedToIndividual);
if (adParamEmps != null)
{
foreach (ADParameterEmployee adEmp in adParamEmps)
{
switch (adEmp.AllowDeduct.Code.Trim())
{
case "001":
table.Remove(TagOutputConstant.AttendenceBonusBangla);
table.Add(TagOutputConstant.AttendenceBonusBangla, adEmp.MonthlyAmount.ToString(moneyFormat));
break;
case "002":
table.Remove(TagOutputConstant.ConductBonusBangla);
table.Add(TagOutputConstant.ConductBonusBangla, adEmp.MonthlyAmount.ToString(moneyFormat));
break;
case "008":
table.Remove(TagOutputConstant.HouseRentBangla);
table.Add(TagOutputConstant.HouseRentBangla, adEmp.MonthlyAmount.ToString(moneyFormat));
break;
case "010":
table.Remove(TagOutputConstant.ConveyenceBangla);
table.Add(TagOutputConstant.ConveyenceBangla, adEmp.MonthlyAmount.ToString(moneyFormat));
break;
case "011":
table.Remove(TagOutputConstant.MedicalBangla);
table.Add(TagOutputConstant.MedicalBangla, adEmp.MonthlyAmount.ToString(moneyFormat));
break;
case "006":
table.Remove(TagOutputConstant.FoodBangla);
table.Add(TagOutputConstant.FoodBangla, adEmp.MonthlyAmount.ToString(moneyFormat));
break;
default:
break;
}
}
}
table.Add(TagOutputConstant.TotalTakaBangla, Math.Round(Convert.ToDouble(table[TagOutputConstant.BasicSalaryBangla]) +
Convert.ToDouble(table[TagOutputConstant.HouseRentBangla]) +
Convert.ToDouble(table[TagOutputConstant.ConveyenceBangla]) +
Convert.ToDouble(table[TagOutputConstant.MedicalBangla]) +
Convert.ToDouble(table[TagOutputConstant.FoodBangla]), 0).ToString(moneyFormat));
double epf = 0, cpf = 0;
double pfPercent = (payrollType.pFContriCompany / 100);
epf = cpf = employee.BasicSalary * pfPercent;
List<PFException> oPfExceptions = new PFExceptionService().Get();
PFException oEmpPFException = oPfExceptions.FirstOrDefault(x => x.EmployeeID == employee.ID);
if (oEmpPFException != null) // && oEmpPFException.StartDate <= salary.SalaryMonth)
{
epf = oEmpPFException.EPFPercent == 0 ? oEmpPFException.EPFAmount : GlobalFunctions.Round(employee.BasicSalary * (oEmpPFException.EPFPercent / 100));
cpf = oEmpPFException.EPFPercent == 0 ? oEmpPFException.CPFAmount : GlobalFunctions.Round(employee.BasicSalary * (oEmpPFException.CPFPercent / 100));
}
//oRow["EPF"] = epf;
//oRow["CPF"] = cpf;
}
return table;
}
}
}

View File

@ -5,7 +5,6 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using Payroll.BO;
using Ease.CoreV35;
using Ease.Core.Model;
using Ease.Core.Utility;
@ -20,6 +19,8 @@ using HRM.Service;
using HRM.BO.Configuration;
using Microsoft.Extensions.Configuration;
using NPOI.SS.Formula.Functions;
using System.Collections;
using Microsoft.AspNetCore.Http;
namespace HRM.Report
{
@ -3377,6 +3378,7 @@ namespace HRM.Report
oRow["Basic"] = employee.BasicSalary;
List<ADParameter> adParams = new ADParameterService().Get(employee.GradeID, EnumEntitleType.Grade, EnumAllowOrDeduct.Allowance, payrollTypeID);
List<ADParameterEmployee> adParamEmps = null;
List<AllowanceDeduction> allowdeducitons = new AllowanceDeductionService().Get(EnumStatus.Regardless, payrollTypeID);
//EmployeeGradeSalary oEmpGradeSalary = new EmployeeGradeSalaryService().Get();
EmployeeGradeSalary oEmpGradeSalary = new EmployeeGradeSalaryService().GetBasicOnDateBAT(employee.ID, DateTime.Now);
@ -3385,6 +3387,8 @@ namespace HRM.Report
foreach (ADParameter adParam in adParams)
{
double amount = new ADParameterService().GetGradeDefinedAmount(employee, employee.BasicSalary, employee.GrossSalary, oEmpGradeSalary, adParam);
adParam.AllowanceDeduction = allowdeducitons.FirstOrDefault(x => x.ID == adParam.AllowDeductID);
switch (adParam.AllowanceDeduction.Code.Trim())
{
case "008":
@ -3439,5 +3443,199 @@ namespace HRM.Report
return dEmpInfo;
}
public string Generate(LetterTemplte letterTemplte/*LetterTemplte oLetterTemplate*/, int employeeID, int payrollTypeID, string sFPath, string lFileName)
{
try
{
PayrollType payrollType = new PayrollTypeService().Get(payrollTypeID);
string[] sBody = { };
string sFilePath = string.Empty;
Hashtable table = new Hashtable();
// Commented for testing in development phase
//LetterTemplte letterTemplte = new LetterTemplteService().Get(oLetterTemplate.ID);
//PhotoPath oPhotoPath = new PhotoPathService().Get(ID.FromInteger(1));
PhotoPath oPhotoPath = new PhotoPathService().Get(1);
#region Expandable Objects
// These Objects are create as per demand of diferent letters
// These variables could grow depending on the type of ObjectID,suppordID etc
Employee oEmp = null;
HREmployee oHREmp = null;
Grade oGrade = null;
//For Recruitment
Candidate oCandidate = null;
CV oCV = null;
List<ADParameter> adParams;
//Letter Request Notification
HRRequest oHRRequest = new HRRequest();
#endregion
string sLetterName = string.Empty;
table = new Hashtable();
switch (letterTemplte.ID)
{
case FixedLetterTemplte.Officer_Appointment_Letter:
// Dont Know if it works or not
#region Management Appointment Letter
sLetterName = "Appointment Letter";
oEmp = new EmployeeService().Get(employeeID);
if (oEmp == null)
{
break;
}
//oHREmp = new HREmployeeService().Get(oEmp.EmployeeNo);
oHREmp = new HREmployeeService().Get(oEmp.ID);
table = new Hashtable();
table.Add(TagOutputConstant.CurrentDate, DateTime.Now.Date.ToString("dd MMMM, yyyy"));
table.Add(TagOutputConstant.FullName, oHREmp.Name);
if (oHREmp.Contacts.Any())
{
table.Add(TagOutputConstant.EmpPresentAddress, oHREmp.Contacts[0].PresentAddress);
table.Add(TagOutputConstant.EmpPresentThana, oHREmp.Contacts[0].PresentThana);
table.Add(TagOutputConstant.EmpPresentDistrict, oHREmp.Contacts[0].PresentDistrict);
table.Add(TagOutputConstant.EmpPresentCountry, "Bangladesh");
}
table.Add(TagOutputConstant.BirthDate, oHREmp.BirthDate != DateTime.MinValue ? oHREmp.BirthDate.ToString("dd MMMM, yyyy") : string.Empty);
table.Add(TagOutputConstant.EmpNationality, oHREmp.Nationality != null ? oHREmp.Nationality.Description : string.Empty);
table.Add(TagOutputConstant.EmpReligion, oHREmp.Religion != null ? oHREmp.Religion.Name : string.Empty);
table.Add(TagOutputConstant.EmpGender, oEmp.Gender.ToString());
table.Add(TagOutputConstant.EmpMaritalStatus, oEmp.MaritalStatus.ToString());
table.Add(TagOutputConstant.EmployeeDesig, oEmp.Designation != null ? oEmp.Designation.Name : string.Empty);
double TotalAllowance, Basic, HouseRent, Conveyence, Transport, Medical;
TotalAllowance = Basic = HouseRent = Conveyence = Transport = Medical = 0.0;
oGrade = new GradeService().Get((int)oEmp.GradeID);
adParams = new ADParameterService().Get((int)oEmp.GradeID, EnumEntitleType.Grade, EnumAllowOrDeduct.Allowance, payrollTypeID);
Func<ADParameter, double, double> calculateOther = (a, b) =>
a != null ? (a.PercentOfBasic == 0.0 ? a.FlatAmount : b * a.PercentOfBasic / 100) : 0.0;
Basic = oEmp.BasicSalary;
HouseRent = calculateOther(adParams.Where(obj => obj.AllowDeductID == 8).SingleOrDefault(), Basic);
Conveyence = calculateOther(adParams.Where(obj => obj.AllowDeductID == 9).SingleOrDefault(), Basic);
Medical = calculateOther(adParams.Where(obj => obj.AllowDeductID == 11).SingleOrDefault(), Basic);
TotalAllowance = Basic + HouseRent + Conveyence + Medical;
table.Add(TagOutputConstant.CandidateBasic, Basic.ToString("#,###.00"));
table.Add(TagOutputConstant.CandidateBasicPercent, TotalAllowance > 0 ? ((int)((Basic / TotalAllowance) * 100)).ToString() : "0");
table.Add(TagOutputConstant.AllowHR, HouseRent.ToString("#,###.00"));
table.Add(TagOutputConstant.AllowHRPercent, TotalAllowance > 0 ? (Math.Round((HouseRent / TotalAllowance) * 100)).ToString() : "0");
table.Add(TagOutputConstant.AllowMedical, Medical.ToString("#,###.00"));
table.Add(TagOutputConstant.AllowMedicalPercent, TotalAllowance > 0 ? (Math.Round((Medical / TotalAllowance) * 100)).ToString() : "0");
table.Add(TagOutputConstant.AllowConveyance, Conveyence.ToString("#,###.00"));
table.Add(TagOutputConstant.AllowConveyancePercent, TotalAllowance > 0 ? (Math.Round((Conveyence / TotalAllowance) * 100)).ToString() : "0");
table.Add(TagOutputConstant.AllowTotal, TotalAllowance.ToString("#,###.00"));
table.Add(TagOutputConstant.TakaInWord, HRM.BO.GlobalFunctions.MillionToInWords((int)TotalAllowance));
sFilePath = sFPath.TrimEnd('\\') + "\\" + oEmp.EmployeeNo + "-" + sLetterName + ".doc";
#endregion
break;
case FixedLetterTemplte.Staff_Appointment_Letter:
#region Staff Appointment Letter
sLetterName = "Appointment Letter Staff";
oEmp = new EmployeeService().Get(employeeID);
if (oEmp == null)
{
break;
}
//oHREmp = new HREmployeeService().Get(oEmp.EmployeeNo);
oHREmp = new HREmployeeService().Get(oEmp.ID);
table = new EmployeeService().CollectDataForBanglaAppointmentHash(oHREmp, payrollType);
sFilePath = sFPath.TrimEnd('\\') + "\\" + oEmp.EmployeeNo + "-" + sLetterName + ".doc";
#endregion
break;
case FixedLetterTemplte.Worker_Appointment_Letter:
#region Worker Appointment Letter
sLetterName = "Appointment Letter Worker";
oEmp = new EmployeeService().Get(employeeID);
if (oEmp == null)
{
break;
}
oHREmp = new HREmployeeService().Get(oEmp.ID);
table = new EmployeeService().CollectDataForBanglaAppointmentHash(oHREmp, payrollType);
sFilePath = sFPath.TrimEnd('\\') + "\\" + oEmp.EmployeeNo + "-" + sLetterName + ".doc";
#endregion
break;
default:
//letterTemplte = new LetterTemplteService().Get(oLetterTemplate.ID);
sLetterName = letterTemplte.Subject;
if (oCandidate.IsEmployee == false)
{
table.Add(TagOutputConstant.CandidateName, oCV.Name);
sFilePath = sFPath.TrimEnd('\\') + "\\" + oCV.TrackNo + "-" + sLetterName + ".doc";
}
else
{
sFilePath = sFPath.TrimEnd('\\') + "\\" + oEmp.EmployeeNo + "-" + sLetterName + ".doc";
}
break;
}
if (table != null)
{
//MSWord file = new MSWord();
//FileInfo ossInfo = null;
////file.OriginalFile = letterTemplte.FilePath.Trim();
//file.OriginalFile = System.IO.Path.Combine(System.Environment.CurrentDirectory + "\\Documents\\LetterTempFolder\\" + lFileName);
//ossInfo = new FileInfo(sFilePath);
//if (ossInfo.Exists)
//{
// ossInfo.Delete();
//}
//File.Copy(file.OriginalFile, sFilePath, true);
//file = new MSWord();
//file.OpenWordApplication();
//file.OriginalFile = letterTemplte.FilePath.Trim();
//file.ReplaceWords(sFilePath, table);
//file.CloseWordApplication();
}
return sFilePath;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
}

View File

@ -1716,6 +1716,8 @@ namespace HRM.UI.Controllers.Report
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
byte[] bytes = null;
LetterTemplte ltemplate = new LetterTemplte();
try
{
@ -1730,8 +1732,26 @@ namespace HRM.UI.Controllers.Report
bytes = new rptEmployee().GetAsstOfficeAndAbove(employeeID, payrollTypeId, reportType);
break;
case EnumProfileReportType.Appointment_Letter_Worker:
ltemplate.SetObjectID(FixedLetterTemplte.Worker_Appointment_Letter);
ltemplate.ID = 3;
ltemplate.Description = "Letter Template Worker";
ltemplate.Subject = "Letter Template Worker";
ltemplate.Type = EnumDocType.Desktop_Letter;
ltemplate.TypeID = (int)EnumDocType.Desktop_Letter;
new rptEmployee().Generate(ltemplate, employeeID, payrollTypeId, "C:\\Users\\mashfiq.EASE\\Downloads", "Worker.doc");
break;
case EnumProfileReportType.Appointment_Letter_Staff:
ltemplate.SetObjectID(FixedLetterTemplte.Staff_Appointment_Letter);
ltemplate.ID = 2;
ltemplate.Description = "Letter Template Staff";
ltemplate.Subject = "Letter Template Staff";
ltemplate.Type = EnumDocType.Desktop_Letter;
ltemplate.TypeID = (int)EnumDocType.Desktop_Letter;
new rptEmployee().Generate(ltemplate, employeeID, payrollTypeId, "C:\\Users\\mashfiq.EASE\\Downloads", "Staff.doc");
break;
default:
break;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff