dev_mashfiq #31

Open
Mashfiq wants to merge 8 commits from dev_mashfiq into devqc
23 changed files with 6999 additions and 93 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,18 @@
<Compile Remove="Attendance\BuyerSetup.cs" />
<Compile Remove="Organogram\OrganisationChart.cs" />
<Compile Remove="Process\NotificationProcess.cs" />
<Compile Remove="TagOutput\MSWord.cs" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Interop.Word">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>7</VersionMinor>
<VersionMajor>8</VersionMajor>
<Guid>00020905-0000-0000-c000-000000000046</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</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,26 +1,24 @@
using Common.BO;
using Ease.Core.Model;
using Payroll.BO;
using System;
using System.Collections;
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 Payroll.BO
namespace HRM.BO
{
public class MSWord
{
private Hashtable _Pair;
private string _OriginalFile;
private string _PreparedFile;
private Microsoft.Office.Interop.Word.Application _wordapp;
private Application _wordapp;
public MSWord()
{
_wordapp = null;
//_wordapp = null;
}
public Hashtable Pair
{
@ -41,7 +39,7 @@ namespace Payroll.BO
_OriginalFile = value;
}
}
public string PreparedFile
{
get
@ -99,24 +97,24 @@ namespace Payroll.BO
throw new Exception("File Not Found : " + "File Path : " + _OriginalFile);
}
}
public void OpenWordApplication()
{
_wordapp = new Microsoft.Office.Interop.Word.Application();
_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);
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
@ -142,12 +140,12 @@ namespace Payroll.BO
public void ReplaceWords(string destFileName, Hashtable tagValueHashTable)
{
object SaveChanges = true;
// if (_wordapp == null) OpenWordApplication();
// if (_wordapp == null) OpenWordApplication();
object Missing = System.Reflection.Missing.Value;
CreateCopy(destFileName);
Microsoft.Office.Interop.Word.Document oDoc=null;
Microsoft.Office.Interop.Word.Document oDoc = null;
try
{
object FileName = _PreparedFile;
@ -157,9 +155,9 @@ namespace Payroll.BO
object IsVisible = true;
object FindText = "";
object ReplaceText = "";
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 = _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();
object FindContinue = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue;
@ -171,9 +169,9 @@ namespace Payroll.BO
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);
ref ReplaceText, ref ReplaceAll, ref Missing, ref Missing, ref Missing, ref Missing);
}
}
catch (Exception ex)
{
@ -181,7 +179,7 @@ namespace Payroll.BO
}
finally
{
if (oDoc != null) _wordapp.Documents.Close(ref SaveChanges, ref Missing, ref Missing);
if (oDoc != null) _wordapp.Documents.Close(ref SaveChanges, ref Missing, ref Missing);
}
}
@ -229,4 +227,4 @@ namespace Payroll.BO
}
}
}
}

View File

@ -85,7 +85,10 @@ namespace HRM.DA
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
return tc.ExecuteReader("SELECT * FROM GRADES where Status=%n order by code", status);
if(status == EnumStatus.Regardless)
return tc.ExecuteReader("SELECT * FROM GRADES order by code");
else
return tc.ExecuteReader("SELECT * FROM GRADES where Status=%n order by code", status);
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status, string sIDs,
string sTargetPropertyName, int payrolltypeid)

View File

@ -120,7 +120,7 @@ namespace HRM.DA
object obj =
tc.ExecuteScalar("Select SALARYPROCESSID from SALARYPROCESS where SALARYMONTH=%d AND PAYROLLTYPEID=%n",
dSMonth, payrollTypeID);
if (obj == DBNull.Value) return false;
if (obj == DBNull.Value || obj == null) return false;
else bShowInDesktop=true;
return bShowInDesktop;
}

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

@ -857,6 +857,9 @@
<TablixColumn>
<Width>0.46875in</Width>
</TablixColumn>
<TablixColumn>
<Width>0.39583in</Width>
</TablixColumn>
<TablixColumn>
<Width>0.35417in</Width>
</TablixColumn>
@ -1198,6 +1201,39 @@
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox100">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(iif(Fields!ExtraAllowance.Value = 1,1,0))</Value>
<Style>
<FontSize>8pt</FontSize>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox100</rd:DefaultName>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<BackgroundColor>=iif(Sum(iif(Fields!AttenType.Value = 1 or Fields!AttenType.Value = 3 or Fields!AttenType.Value = 7 or Fields!AttenType.Value = 11 or Fields!AttenType.Value = 12,1,0))&gt;0,"Yellow","White")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox8">
@ -2457,6 +2493,87 @@
</TablixMember>
</TablixMembers>
</TablixMember>
<TablixMember>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="Textbox98">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontSize>8pt</FontSize>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox98</rd:DefaultName>
<Style>
<Border>
<Style>None</Style>
</Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
<TablixMembers>
<TablixMember>
<TablixHeader>
<Size>0.69792in</Size>
<CellContents>
<Textbox Name="Textbox99">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Extra Allowance</Value>
<Style>
<FontStyle>Normal</FontStyle>
<FontSize>8pt</FontSize>
<FontWeight>Normal</FontWeight>
<TextDecoration>None</TextDecoration>
<Color>#000000</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox99</rd:DefaultName>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<BackgroundColor>Yellow</BackgroundColor>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
</TablixMember>
</TablixMembers>
</TablixMember>
<TablixMember>
<TablixHeader>
<Size>0.25in</Size>
@ -4083,7 +4200,7 @@
<DataSetName>MonthlyKPIDetail</DataSetName>
<Top>0.16021in</Top>
<Height>1.19792in</Height>
<Width>13.95876in</Width>
<Width>14.35459in</Width>
<Style>
<Border>
<Style>None</Style>

View File

@ -1,14 +1,17 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ease.Core.Model;
using Ease.Core.Utility;
using HRM.BO;
using HRM.BO.Configuration;
using HRM.DA;
using HRM.Report.Attendence.AttendenceDataSet;
using Microsoft.Extensions.Configuration;
using Microsoft.Reporting.NETCore;
using NPOI.SS.Formula.Functions;
using NPOI.XSSF.Streaming.Values;
@ -2844,6 +2847,38 @@ namespace HRM.Report
oMonthlyKPIDetail = new EchoTexExceptionReportService().GetMonthlyKPIDetail(dFromDate, dToDate, sEmpID);
#region Extra
oMonthlyKPIDetail.Tables[0].Columns.Add("ExtraAllowance", typeof(double));
if (oMonthlyKPIDetail != null && oMonthlyKPIDetail.Tables.Count > 0)
{
List<DailyAttnProcess> dAttnProcessess = dAttnProcessess = new DailyAttnProcessService().Get(sEmpID, dFromDate, dToDate);
//List<AttnNationalHoliday> oNationalHolidays = AttnNationalHoliday.GetByMonth(dFromDate.FirstDateOfYear(), dFromDate.LastDateOfYear());
List<Shift> oShifts = new ShiftService().Get(EnumStatus.Active, payrollTypeID);
List<Employee> oemps = new EmployeeService().GetByEmpIDs(sEmpID);
List<ADParameter> oAdparameters = new ADParameterService().Get(EnumStatus.Active, EnumAllowOrDeduct.Allowance, payrollTypeID).Where(x => x.AllowDeductID == 4).ToList(); // AllowDeductID = 4 is Extra Allowance in ALLOWANCEDEDUCTION table
List<Grade> ogrades = new GradeService().Get(EnumStatus.Regardless);
foreach (DataRow monthlyRow in oMonthlyKPIDetail.Tables[0].Rows)
{
Employee emp = oemps.Find(x => x.EmployeeNo.ToString() == monthlyRow["IDNo"].ToString());
if (emp == null) continue;
DateTime attnDate = Convert.ToDateTime(monthlyRow["AttnDate"]);
List<DailyAttnProcess> dEmpAttn = dAttnProcessess.FindAll(x => x.EmployeeID == emp.ID && x.AttnDate.Date == attnDate.Date).ToList();
DataTable oDataTable = new rptEcho().GetEmpDailyAttnNewKPI(emp.ID, dEmpAttn, emp, oShifts, oAdparameters, ogrades);
if (oDataTable != null && oDataTable.Rows.Count > 0)
{
monthlyRow["ExtraAllowance"] = oDataTable.Rows[0]["ExtraAllowance"];
}
else
{
monthlyRow["ExtraAllowance"] = 0;
}
}
}
#endregion
DataTable oMnthlyKPIDtlSummary = new AttendenceDataSet.MnthlyKPIDtlSummaryDataTable();
#region Summary Parts
@ -2883,6 +2918,64 @@ namespace HRM.Report
return reportProcessor.AttendanceReportsView(null, oMonthlyKPIDetail, null, RDLC, _parameters, true, payrollTypeID, reportType);
}
public DataTable GetEmpDailyAttnNewKPI(int EmpID, List<DailyAttnProcess> dAttnProcessess, Employee emp, List<Shift> oShifts, List<ADParameter> oADPrams, List<Grade> ogrades)
{
AttendenceDataSet.EmpDailyAttnDataTable dTable = new AttendenceDataSet.EmpDailyAttnDataTable();
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
IConfiguration Configuration = builder.Build();
string sExtraAllowanceHour = Configuration.GetSection("Attendance")["ExtraAllowanceHour"];
double dExtraAllowanceHours = 0;
if (!double.TryParse(sExtraAllowanceHour, out dExtraAllowanceHours))
{
dExtraAllowanceHours = 13.5; // Default if Hour not given
}
DateTime startTime, endTime;
if (!(dAttnProcessess == null || dAttnProcessess.Count <= 0))
{
foreach (DailyAttnProcess dAttnProcess in dAttnProcessess)
{
DataRow Rowbody = dTable.NewRow();
Rowbody["ExtraAllowance"] = 0;
if (oADPrams != null && emp != null)
{
foreach (ADParameter adparam in oADPrams)
{
foreach (ADParameter.ADParameterGrade grn in adparam.ADParameterGrades)
{
//Grade gr = ogrades.GetItem(grn.GradeID);
Grade gr = ogrades.Find(delegate (Grade item) { return item.ID == grn.GradeID; });
if (gr != null && gr.ID == emp.GradeID)
{
if (dAttnProcess.InTime != null && dAttnProcess.InTime != DateTime.MinValue)
{
Shift sft = oShifts.FirstOrDefault(x => x.ID == dAttnProcess.ShiftID);
startTime = dAttnProcess.InTime.Value.Date.Add(sft.InTime.TimeOfDay);
startTime = (DateTime)startTime.AddMinutes(-15) > (DateTime)dAttnProcess.InTime ? (DateTime)startTime.AddMinutes(-15) : (DateTime)dAttnProcess.InTime;
endTime = dAttnProcess.OutTime != null ? (DateTime)dAttnProcess.OutTime : DateTime.MinValue;
if (endTime != DateTime.MinValue)
{
if (endTime.Subtract(startTime).Add(TimeSpan.FromMinutes(1)).TotalHours >= dExtraAllowanceHours)
{
Rowbody["ExtraAllowance"] = 1;// ncount++;
}
}
}
}
}
}
}
dTable.Rows.Add(Rowbody);
}
}
return dTable;
}
#endregion
#endregion

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,9 @@ using HRM.Service;
using HRM.BO.Configuration;
using Microsoft.Extensions.Configuration;
using NPOI.SS.Formula.Functions;
using System.Collections;
using Microsoft.AspNetCore.Http;
using NPOI.HPSF;
namespace HRM.Report
{
@ -2940,7 +2942,27 @@ namespace HRM.Report
.AsEnumerable()
.OrderBy(x => Convert.ToInt32(x["EmployeeID"].ToString()))
.CopyToDataTable();
string photoPath = "";
string basePath = System.Environment.CurrentDirectory + "\\Documents\\EMPPHOTO\\";
string fileNamePattern = "Image-" + employee.EmployeeNo.Trim();
string[] imageExtensions = { ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff" };
string[] matchingFiles = Directory
.GetFiles(basePath, fileNamePattern + ".*") // Check all files matching the pattern
.Where(file => imageExtensions.Contains(Path.GetExtension(file), StringComparer.OrdinalIgnoreCase))
.ToArray();
if (matchingFiles.Length > 0)
{
photoPath = matchingFiles[0];
//Console.WriteLine("Matching image files found:");
//foreach (string file in matchingFiles)
//{
// photoPath = file;
//}
}
foreach (DataRow drBasic in dtEmpBasicInfo.Rows)
{
@ -2959,6 +2981,7 @@ namespace HRM.Report
oRow["MartialStatus"] = (EnumMaritalStatus)Convert.ToInt16(drBasic["MARITALSTATUSID"]);
oRow["Religion"] = drBasic["Religion"];
oRow["Email"] = drBasic["PERSONALEMAIL"];
oRow["EmpPhotograph"] = photoPath;
//Commented for development
//oRow["EmpPhotograph"] = _rImageManager.GetImage(drBasic["PhotoPath"].ToString());
@ -3377,6 +3400,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 +3409,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 +3465,228 @@ namespace HRM.Report
return dEmpInfo;
}
public string Generate(LetterTemplte letterTemplte/*LetterTemplte oLetterTemplate*/, int employeeID, int payrollTypeID, string sFPath, string lFileName)
{
try
{
string pdfFilePath = string.Empty;
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.OriginalFile = System.IO.Path.Combine(System.Environment.CurrentDirectory + "\\Documents\\LetterTempFolder\\" + lFileName);
file.ReplaceWords(sFilePath, table);
file.CloseWordApplication();
//pdfFilePath = System.IO.Path.ChangeExtension(sFilePath, ".pdf");
//ConvertDocToPdf(sFilePath, pdfFilePath);
pdfFilePath = sFilePath;
}
return pdfFilePath;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
public void ConvertDocToPdf(string wordFilePath, string pdfFilePath)
{
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document wordDocument = null;
try
{
// Open the Word document
wordDocument = wordApp.Documents.Open(wordFilePath);
// Save as PDF
wordDocument.SaveAs(pdfFilePath, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF);
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
finally
{
// Clean up
wordDocument?.Close();
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDocument);
wordApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordApp);
}
}
}
}

View File

@ -296,6 +296,18 @@
<None Remove="RDLC\UpCommingEmp.rdlc" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Interop.Word">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>7</VersionMinor>
<VersionMajor>8</VersionMajor>
<Guid>00020905-0000-0000-c000-000000000046</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Attendence\RDLC\DailyAbsent.rdlc" />
<EmbeddedResource Include="Attendence\RDLC\DailyAbsentEcho.rdlc" />

View File

@ -133,4 +133,7 @@ export class ReportServices {
getProfileReportData(param: any): Observable<HttpEvent<any>> {
return this.apiService.httpPost<any>('/Report/getProfileReportData/', param);
}
getGeneratedProfileReportData(param: any) {
return this.apiService.httpDownloadFile('/Report/getGeneratedProfileReport/', param);
}
}

View File

@ -13,7 +13,7 @@ export class ApiService {
public isSSO = false;
public versionDeployement = false;
public versionNumber = `V-${GlobalfunctionExtension.generateVersionNumber(new Date(2025, 0, 9))}-`+"01";
public versionNumber = `V-${GlobalfunctionExtension.generateVersionNumber(new Date(2025, 0, 16))}-`+"01";
public static BASE_URL = '';
public base_url = '';
// public currentLink = '';

View File

@ -24,7 +24,7 @@
<div class="p-col-3">
<kendo-dropdownlist [(ngModel)]="selectedreportType" [data]="reportTypes" [textField]="'text'"
[valueField]="'value'" [defaultItem]="{ text: 'Select Report Type..', value: null }"
style="width:100%;">
style="width:100%;" (valueChange)="onSelectReport($event)">
</kendo-dropdownlist>
</div>
<!-- <div class="p-col-3" align="middle">
@ -46,9 +46,9 @@
</div> -->
</div>
<div class="p-col-12" align="right">
<button kendoButton icon="file-pdf" [primary]="true" (click)="preview('PDF')">Preview</button>
<button kendoButton icon="file-excel" [primary]="true" style="margin-left:5px;"
(click)="preview('EXCEL')">Export</button>
<button kendoButton icon="file-pdf" [primary]="true" (click)="preview('PDF')" *ngIf="isViewable">Preview</button>
<button kendoButton icon="download" [primary]="true" style="margin-left:5px;"
(click)="preview('Download')">Download</button>
</div>
</fieldset>
</div>

View File

@ -45,6 +45,7 @@ import { encodeBase64 } from '@progress/kendo-file-saver';
import { AuthorizedPerson } from 'src/app/adhoc-feature/authorized-persons/authorizedPerson';
import { Employee } from 'src/app/_models/Employee/employee';
import { HrEmployee } from 'src/app/_models/HREmployee/hrEmployee';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-employee-profile-reports',
@ -56,6 +57,7 @@ export class EmployeeProfileReportsComponent implements OnInit {
public showPopUp: boolean = false;
public src: any;
public PDFTitle = '';
public isViewable: boolean = true;
public selectedreportType: EnumProfileReportType;
public reportTypes = Object.keys(EnumProfileReportType)
@ -82,6 +84,7 @@ export class EmployeeProfileReportsComponent implements OnInit {
public router: Router, public loadingPanel: loadingPanelService,
public notificationService: HRMNotificationService,
public apiService: ApiService, public authService: AuthService) {
this.apiService.selectedMenuName = 'Profile Reports';
}
@ -96,43 +99,94 @@ export class EmployeeProfileReportsComponent implements OnInit {
preview(reportType: string) {
debugger;
if (this.selectedEmployee == undefined || this.selectedEmployee == null) {
this.notificationService.showWarning('Please Select and employee!!');
return;
}
if (this.selectedreportType == undefined || this.selectedreportType['value'] == null) {
this.notificationService.showWarning('Please select a report!!');
return;
}
const data = {
reportID: this.selectedreportType['value'],
personID: this.authorizedPerson.id,
employeeID: this.selectedEmployee.employeeID,
reportType: reportType
reportID: this.selectedreportType['value'],
personID: this.authorizedPerson != null ? this.authorizedPerson.id : 0,
employeeID: this.selectedEmployee.employeeID,
reportType: reportType == 'Download' ? 'PDF' : reportType
};
switch (this.selectedreportType['value']) {
case EnumProfileReportType.Print_CV:
this.PDFTitle = this.selectedEmployee.employeeNo + '-' + EnumExtension.getName(EnumProfileReportType, EnumProfileReportType.Print_CV);
break;
case EnumProfileReportType.Appointment_Letter_Officer:
this.PDFTitle = this.selectedEmployee.employeeNo + '-' + EnumExtension.getName(EnumProfileReportType, EnumProfileReportType.Appointment_Letter_Officer);
break;
case EnumProfileReportType.Appointment_Letter_Staff:
this.PDFTitle = this.selectedEmployee.employeeNo + '-' + EnumExtension.getName(EnumProfileReportType, EnumProfileReportType.Appointment_Letter_Staff);
break;
case EnumProfileReportType.Appointment_Letter_Worker:
this.PDFTitle = this.selectedEmployee.employeeNo + '-' + EnumExtension.getName(EnumProfileReportType, EnumProfileReportType.Appointment_Letter_Worker);
break;
}
this.loadingPanel.ShowLoadingPanel = true;
if (reportType === 'PDF')
this.showPopUp = true;
this.reportService.getProfileReportData(data).subscribe(
this.showPopUp = true;
if (this.selectedreportType['value'] == EnumProfileReportType.Print_CV || this.selectedreportType['value'] == EnumProfileReportType.Appointment_Letter_Officer) {
this.reportService.getProfileReportData(data).subscribe(
(resp: any) => {
if (reportType === 'PDF') {
if (reportType === 'PDF') {
this.src = URL.createObjectURL(this.b64toBlob(resp, 'application/pdf', 1024));
var element = <HTMLIFrameElement>(document.getElementById("pdf-viewer-report"));
element.src = this.src;
} else if (reportType === 'EXCEL') {
this.downloadFile(resp);
}
this.src = URL.createObjectURL(this.b64toBlob(resp, 'application/pdf', 1024));
var element = <HTMLIFrameElement>(document.getElementById("pdf-viewer-report"));
element.src = this.src;
} else if (reportType === 'Download') {
this.downloadFile(resp);
}
this.loadingPanel.ShowLoadingPanel = false;
},
(err) => {
this.closeForm();
console.log(err);
this.notificationService.showError(err.error);
this.loadingPanel.ShowLoadingPanel = false;
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
// this.loadGrid();
(err: any) => {
this.closeForm();
// console.log(err);
this.notificationService.showError(err.error);
this.loadingPanel.ShowLoadingPanel = false;
}
);
);
}
else {
this.reportService.getGeneratedProfileReportData(data).subscribe(fileData => {
this.loadingPanel.ShowLoadingPanel = false;
if (reportType == 'PDF') {
var element = <HTMLIFrameElement>(document.getElementById("pdf-viewer-report"));
element.src = URL.createObjectURL(new Blob([fileData], { type: 'application/pdf' }));
// Doc
// var element = <HTMLIFrameElement>document.getElementById("pdf-viewer-report");
// const fileUrl = URL.createObjectURL(new Blob([fileData], { type: 'application/msword' }));
// // Using Google Docs Viewer
// element.src = `https://docs.google.com/gview?url=${encodeURIComponent(fileUrl)}&embedded=true`;
}
if (reportType == 'Download')
this.downloadBlob(new Blob([fileData], { type: 'application/msword' }), 'application/msword', this.PDFTitle);
// this.downloadBlob(new Blob([fileData], { type: 'application/pdf' }), 'application/pdf', this.PDFTitle);
},
(error) => {
this.closeForm();
console.log(error);
this.notificationService.showError(error.error);
this.loadingPanel.ShowLoadingPanel = false;
});
}
}
downloadFile(blobContent) {
let blob = new Blob([this.b64toBlob(blobContent, 'application/data:application/vnd.ms-excel', 1024)], {});
saveAs(blob, this.PDFTitle + '.xls');
//EXCEL
// let blob = new Blob([this.b64toBlob(blobContent, 'application/data:application/vnd.ms-excel', 1024)], {});
// saveAs(blob, this.PDFTitle + '.xls');
//PDF
let blob = new Blob([this.b64toBlob(blobContent, 'application/pdf', 1024)], {});
saveAs(blob, this.PDFTitle + '.pdf');
}
b64toBlob(b64Data, contentType, sliceSize) {
const byteCharacters = atob(b64Data);
@ -154,6 +208,21 @@ export class EmployeeProfileReportsComponent implements OnInit {
return blob;
}
private downloadBlob(data: any, type: string, fileName: string): void {
const blob: Blob = new Blob([data], { type: type });
// const fileName: string = this.workOrderBillReceive.UploadAttachment[0].OriginalFileName;
// const fileName: string = fileName;
const objectUrl: string = URL.createObjectURL(blob);
const a: HTMLAnchorElement = document.createElement('a') as HTMLAnchorElement;
a.href = objectUrl;
a.download = fileName;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(objectUrl);
}
public loadAuthorizedPerson() {
this.employeeService.getAuthorizedPerson().subscribe(
(resp) => {
@ -183,6 +252,16 @@ export class EmployeeProfileReportsComponent implements OnInit {
// }
// );
}
onSelectReport(value: any) {
debugger;
if (this.selectedreportType['value'] != EnumProfileReportType.Appointment_Letter_Staff && this.selectedreportType['value'] != EnumProfileReportType.Appointment_Letter_Worker) {
this.isViewable = true;
} else {
this.isViewable = false;
}
}
}
export enum EnumProfileReportType {

View File

@ -786,8 +786,8 @@ export class ReportViewerComponent implements OnInit {
this.multiselect = true;
this.hiddenFromDate = true;
this.hiddenToDate = true;
this.fromDate = new Date();
this.toDate = new Date();
this.fromDate = GlobalfunctionExtension.getFirstDateofMonth(new Date());
this.toDate = GlobalfunctionExtension.getLastDateOfMonth(new Date());
this.hiddenAllSearch = false;
this.hiddenExport = true;
this.loadCurrentFiscalYear();

View File

@ -20,6 +20,7 @@ using NPOI.SS.Formula.Functions;
using HRM.BO.Report;
using HRM.Report.PayrollDataSet;
using Newtonsoft.Json;
using Microsoft.AspNetCore.StaticFiles;
namespace HRM.UI.Controllers.Report
{
@ -1716,6 +1717,8 @@ namespace HRM.UI.Controllers.Report
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
byte[] bytes = null;
LetterTemplte ltemplate = new LetterTemplte();
try
{
@ -1745,5 +1748,103 @@ namespace HRM.UI.Controllers.Report
return Ok(bytes);
}
[HttpPost("getGeneratedProfileReport")]
public ActionResult getGeneratedProfileReportData(dynamic data)
{
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
EnumProfileReportType reportid = (EnumProfileReportType)items["reportID"].ToObject<int>();
int personID = 0;
int employeeID = 0;
if (items["personID"] != null)
personID = (int)items["personID"].ToObject<int>();
if (items["employeeID"] != null)
employeeID = (int)items["employeeID"].ToObject<int>();
string reportType = (string)items["reportType"].ToObject<string>();
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
byte[] bytes = null;
LetterTemplte ltemplate = new LetterTemplte();
try
{
//string downloadPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads";
string downloadPath = System.Environment.CurrentDirectory + "\\Documents\\LetterTempFolder\\";
string sFilePath = string.Empty, lFileName = string.Empty;
switch (reportid)
{
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;
lFileName = "Worker.doc";
sFilePath = new rptEmployee().Generate(ltemplate, employeeID, payrollTypeId, downloadPath, lFileName);
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;
lFileName = "Staff.doc";
sFilePath = new rptEmployee().Generate(ltemplate, employeeID, payrollTypeId, downloadPath, lFileName);
break;
default:
break;
}
byte[] buffer = new byte[16 * 1024];
buffer = System.IO.File.ReadAllBytes(sFilePath);
string contentType = GetFileType(sFilePath);
//var name = System.IO.Path.ChangeExtension(lFileName, ".pdf");
var name = lFileName;
if (System.IO.File.Exists(sFilePath))
{
System.IO.File.Delete(sFilePath);
}
//if (System.IO.File.Exists(System.IO.Path.ChangeExtension(sFilePath, ".doc")))
//{
// System.IO.File.Delete(System.IO.Path.ChangeExtension(sFilePath, ".doc"));
//}
return File(buffer, contentType, name);
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
return Ok(bytes);
}
[HttpPost]
[Route("get-file-type")]
[AllowAnonymous]
[IgnoreAntiforgeryToken]
[ProducesResponseType(StatusCodes.Status200OK)]
public string GetFileType(string originalFileName)
{
//var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
//string fileName = (string)item["fileName"].ToObject<string>();
string fileName = originalFileName;
string contentType;
new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);
return contentType ?? "application/octet-stream";
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1172,6 +1172,18 @@
<TypeScriptCompile Remove="ClientApp\src\app\_models\Recruitement\InterviewAssessmentKpi.ts" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Interop.Word">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>7</VersionMinor>
<VersionMajor>8</VersionMajor>
<Guid>00020905-0000-0000-c000-000000000046</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="appsettings.json" />
<EmbeddedResource Include="RDLC\CandidateAssesmentDetails.rdlc" />
@ -1232,6 +1244,9 @@
</ItemGroup>
<ItemGroup>
<None Update="RDLC\IDCardPrint.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RDLC\Report177.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

View File

@ -1023,7 +1023,7 @@
<TextRun>
<Value>="‡dvb: "&amp;Parameters!CPhone.Value</Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>
@ -1506,7 +1506,7 @@
<TextRun>
<Value> kZ©vejx</Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>8pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
@ -1597,7 +1597,7 @@
<TextRun>
<Value>1. GB KvW© n¯ÍvšÍi †hvM¨ b‡n |</Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>
@ -1626,7 +1626,7 @@
<TextRun>
<Value>2. GB KvW© nviv‡bv ‡M‡j ev bó n‡j mv‡_</Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>
@ -1655,7 +1655,7 @@
<TextRun>
<Value> mv‡_ KZ©„cÿ‡K AewnZ Ki‡Z n‡e|</Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>
@ -1684,7 +1684,7 @@
<TextRun>
<Value>=" kÖwgK AvBb Gi "+Parameters!Dhara.Value+" aviv ‡gvZv‡eK"</Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>
@ -1713,7 +1713,7 @@
<TextRun>
<Value> bZzb KvW© cÖ`vb Kiv nB‡e| </Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>
@ -1742,7 +1742,7 @@
<TextRun>
<Value> 3. PvKzix Z¨vM Kivi mgq KvW©wU ‡diZ</Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>
@ -2002,7 +2002,7 @@
<TextRun>
<Value> w`‡Z n‡e|</Value>
<Style>
<FontFamily>KarnaphuliMJ</FontFamily>
<FontFamily>sutonnyMJ</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>