Compare commits

...

4 Commits

Author SHA1 Message Date
708151d9c7 20261125-3620 Need a Salary Certificate as Per Agreement 2026-11-25 14:40:53 +06:00
591ccd4b43 20260929-3216 Tax Card Generate for Integration with Ease Taskforce 2026-11-22 15:03:49 +06:00
1b6e6259e9 CLAUDE.md: note NuGet packages under packages/ 2026-11-22 14:28:33 +06:00
662257611d Payslip Generate now also generates Tax Card
The Generate button on Salary Pay Slip Mail Send saves each selected
employee's tax card (CEL-EmpNo_TaxCard_YYYY-YYYY.pdf) next to the payslip,
encrypted with the same password (last 4 digits of mobile, else 0000).
Fiscal year is taken from the salary month (Jul-Dec => YYYY-YYYY+1,
Jan-Jun => YYYY-1-YYYY).

rptIncomeTax: per-employee tax card drawing extracted from
showTaxCardMultiple so preview and PDF share it; new GetTaxCardPdf renders
the EPDoc pages to PDF in memory (no print dialog).
2026-11-22 14:28:33 +06:00
13 changed files with 1190 additions and 112 deletions

1
.gitignore vendored
View File

@ -749,3 +749,4 @@ FodyWeavers.xsd
# Additional files built by Visual Studio # Additional files built by Visual Studio
# End of https://www.toptal.com/developers/gitignore/api/csharp,angular,aspnetcore,visualstudio,visualstudiocode # End of https://www.toptal.com/developers/gitignore/api/csharp,angular,aspnetcore,visualstudio,visualstudiocode
/Scripts

View File

@ -14,7 +14,7 @@ Build from Visual Studio, or with MSBuild from a Developer Command Prompt:
msbuild "CEL Payroll.sln" /p:Configuration=Debug msbuild "CEL Payroll.sln" /p:Configuration=Debug
``` ```
Startup project is `Payroll.UI` (WinExe, entry `Payroll.UI/Payroll.UI/Program.cs` → `frmMain`). Third-party and in-house framework assemblies (`Ease.CoreV35`, `Ease.Controls`, `Ease.Report`, ReportViewer, NPOI, ClosedXML, iTextSharp, etc.) are checked in as binaries under `Library/` and referenced by HintPath, not NuGet. Crystal Reports 10.5 runtime must be installed for `Payroll.Report` to build. Startup project is `Payroll.UI` (WinExe, entry `Payroll.UI/Payroll.UI/Program.cs` → `frmMain`). Third-party and in-house framework assemblies (`Ease.CoreV35`, `Ease.Controls`, `Ease.Report`, ReportViewer, NPOI, ClosedXML, iTextSharp, etc.) are checked in as binaries under `Library/` and referenced by HintPath. The only NuGet packages (Exchange WebServices, ReportViewer 11) come from `Payroll.UI/Payroll.UI/packages.config` and are already committed under `packages/`. Crystal Reports 10.5 runtime must be installed for `Payroll.Report` to build.
## Architecture ## Architecture

View File

@ -1295,6 +1295,7 @@ namespace Payroll.BO
StuffAccountWithoutSalary = 507, StuffAccountWithoutSalary = 507,
SalaryComparisonNew = 508, SalaryComparisonNew = 508,
AuditReport = 509, AuditReport = 509,
SalaryCertificateLastAgreement = 510,
BankForwording = 400, BankForwording = 400,
//PF //PF
PFLedger = 61, PFLedger = 61,

View File

@ -19,6 +19,7 @@ namespace Payroll.Report
ObjectsTemplate<ESBDefinition> _oGratuityParams = null; ObjectsTemplate<ESBDefinition> _oGratuityParams = null;
private DateTime _dSalaryMonth = DateTime.MinValue; private DateTime _dSalaryMonth = DateTime.MinValue;
private DateTime _dMonthEndDate = DateTime.MinValue; private DateTime _dMonthEndDate = DateTime.MinValue;
private fReportViewer _mailViewer = null;
DateTime _fiscalyearStart; DateTime _fiscalyearStart;
DateTime _SalaryMonth; DateTime _SalaryMonth;
public PaySlip() public PaySlip()
@ -3406,7 +3407,8 @@ namespace Payroll.Report
val = Employee.Get(); val = Employee.Get();
List<Designation> source = (List<Designation>)(object)Designation.Get(EnumStatus.Regardless); List<Designation> source = (List<Designation>)(object)Designation.Get(EnumStatus.Regardless);
DataRow dataRow = null; DataRow dataRow = null;
fReportViewer fReportViewer2 = new fReportViewer(); // Reused across calls on the same PaySlip: a new viewer recompiles the RDLC every time.
fReportViewer fReportViewer2 = _mailViewer ?? (_mailViewer = new fReportViewer());
DateTime dateTime = salaryMonth2; DateTime dateTime = salaryMonth2;
ObjectsTemplate<SalaryProcess> val2 = new ObjectsTemplate<SalaryProcess>(); ObjectsTemplate<SalaryProcess> val2 = new ObjectsTemplate<SalaryProcess>();
val2 = SalaryProcess.Get(GlobalFunctions.LastDateOfMonth(dateTime)); val2 = SalaryProcess.Get(GlobalFunctions.LastDateOfMonth(dateTime));

View File

@ -256,7 +256,7 @@ namespace Payroll.Report
m_nYpos = m_nYpos + nLineHeight; m_nYpos = m_nYpos + nLineHeight;
nLineHeight = 0; nLineHeight = 0;
oCaption = m_oDoc.CreateText("Employee ID:", m_nColWidth[1]); oCaption = m_oDoc.CreateText("Employee ID:", m_nColWidth[1] + 1);
oCaption.HAlignment = EPHAlignConstants.EPHAlignLeft; oCaption.HAlignment = EPHAlignConstants.EPHAlignLeft;
if (oCaption.Height > nLineHeight) nLineHeight = oCaption.Height; if (oCaption.Height > nLineHeight) nLineHeight = oCaption.Height;
m_oDoc.CurrentPage.AddText(oCaption, m_nXpos[0], m_nYpos); m_oDoc.CurrentPage.AddText(oCaption, m_nXpos[0], m_nYpos);
@ -535,7 +535,7 @@ namespace Payroll.Report
m_nYpos = m_nYpos + nLineHeight; m_nYpos = m_nYpos + nLineHeight;
nLineHeight = 0; nLineHeight = 0;
oCaption = m_oDoc.CreateText("Employee ID:", m_nColWidth[1]); oCaption = m_oDoc.CreateText("Employee ID:", m_nColWidth[1] + 1);
oCaption.Style.Font.Size = 8; oCaption.Style.Font.Size = 8;
oCaption.HAlignment = EPHAlignConstants.EPHAlignLeft; oCaption.HAlignment = EPHAlignConstants.EPHAlignLeft;
if (oCaption.Height > nLineHeight) nLineHeight = oCaption.Height; if (oCaption.Height > nLineHeight) nLineHeight = oCaption.Height;
@ -1803,74 +1803,169 @@ namespace Payroll.Report
public void showTaxCardMultiple() public void showTaxCardMultiple()
{ {
bool isCurrentYear = false;
DataSet orootDataset = new DataSet();
fReportViewer form = new fReportViewer();
IncomeTax oIncomeTax = new IncomeTax();
_TaxParameterID = _selectedParameter.TaxParameters[0].ID; _TaxParameterID = _selectedParameter.TaxParameters[0].ID;
ObjectsTemplate<TaxParameter> _taxParameters = TaxParameter.Get(); bool isCurrentYear = Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID == _TaxParameterID;
if (Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID == _TaxParameterID)
isCurrentYear = true;
else
isCurrentYear = false;
string sEmpID = _selectedParameter.ReportItem.INSQL; string sEmpID = _selectedParameter.ReportItem.INSQL;
ObjectsTemplate<Employee> oEMployees = Employee.GetEmpsWithDiscontinue(sEmpID); ObjectsTemplate<Employee> oEMployees = Employee.GetEmpsWithDiscontinue(sEmpID);
if (_TaxParameterID == SystemInformation.CurrentSysInfo.TaxParamID) BeginTaxCardDoc(isCurrentYear);
{
//SystemInformation.CurrentSysInfo.TaxParamID
_taxParameter = TaxParameter.Get(SystemInformation.CurrentSysInfo.TaxParamID);
m_oDoc = new EPDoc();
InitDoc();
foreach (Employee oEmp in oEMployees) foreach (Employee oEmp in oEMployees)
{
AddTaxCardPages(oEmp, isCurrentYear);
}
m_oDoc.PreviewDoc();
}
/// <summary>
/// Builds one employee's tax card (same layout as "Tax Card For Multiple Employee")
/// and returns it as PDF bytes, without any print dialog. Returns null if nothing was drawn.
/// </summary>
public byte[] GetTaxCardPdf(Employee oEmp, ID taxParameterID)
{
_TaxParameterID = taxParameterID;
bool isCurrentYear = Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID == _TaxParameterID;
// Setting up an EPDoc (A4 paper) queries the default printer and is slow,
// so one doc is kept per tax year and only its pages are cleared per employee.
if (m_oDoc == null || _pdfDocTaxParamID != taxParameterID.Integer)
{
BeginTaxCardDoc(isCurrentYear);
_pdfDocTaxParamID = taxParameterID.Integer;
}
else
{
m_oDoc.Pages.Clear();
m_nCurPage = 0;
}
AddTaxCardPages(oEmp, isCurrentYear);
return RenderDocToPdf(m_oDoc);
}
private int _pdfDocTaxParamID = -1;
/// <summary>
/// Renders an EPDoc's pages to an image-based A4 PDF in memory, without a printer.
/// EPDoc can only output through a printer (and PrintDoc() always opens a PrintDialog),
/// so each page is drawn with the internal EPPage.Draw(Graphics) that EPDoc's PrintPage handler uses.
/// </summary>
private static byte[] RenderDocToPdf(EPDoc doc)
{
if (doc.Pages.Count == 0)
return null;
System.Reflection.MethodInfo draw = typeof(EPPage).GetMethod("Draw",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance,
null, new Type[] { typeof(Graphics) }, null);
const int dpi = 200;
// InitDoc always lays out A4 portrait: 8.27 x 11.69 inch
int w = 827 * dpi / 100;
int h = 1169 * dpi / 100;
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
using (Bitmap bmp = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb))
{
// 100 dpi + scale: drawing units are 1/100 inch (like a printer page) and
// point-sized fonts convert at 100 px/inch, so text matches the printed preview.
bmp.SetResolution(100, 100);
iTextSharp.text.Document pdf = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
iTextSharp.text.pdf.PdfWriter.GetInstance(pdf, ms);
pdf.Open();
for (int i = 0; i < doc.Pages.Count; i++)
{
using (Graphics g = Graphics.FromImage(bmp))
{
g.Clear(Color.White);
g.PageUnit = GraphicsUnit.Pixel;
g.ScaleTransform(dpi / 100f, dpi / 100f);
draw.Invoke(doc.Pages[i], new object[] { g });
}
iTextSharp.text.Image img = ToRgbImage(bmp);
img.ScaleAbsolute(iTextSharp.text.PageSize.A4.Width, iTextSharp.text.PageSize.A4.Height);
img.SetAbsolutePosition(0, 0);
pdf.NewPage();
pdf.Add(img);
}
pdf.Close();
return ms.ToArray();
}
}
/// <summary>Raw 8-bit RGB image (much faster than PNG encoding; iText flate-compresses it).</summary>
private static iTextSharp.text.Image ToRgbImage(Bitmap bmp)
{
int w = bmp.Width, h = bmp.Height;
System.Drawing.Imaging.BitmapData bd = bmp.LockBits(new Rectangle(0, 0, w, h),
System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
byte[] row = new byte[bd.Stride];
byte[] rgb = new byte[w * h * 3];
try
{
for (int y = 0; y < h; y++)
{
System.Runtime.InteropServices.Marshal.Copy(new IntPtr(bd.Scan0.ToInt64() + (long)y * bd.Stride), row, 0, bd.Stride);
int o = y * w * 3;
for (int i = 0; i < w * 3; i += 3)
{
// bitmap rows are BGR
rgb[o + i] = row[i + 2];
rgb[o + i + 1] = row[i + 1];
rgb[o + i + 2] = row[i];
}
}
}
finally
{
bmp.UnlockBits(bd);
}
return iTextSharp.text.Image.GetInstance(w, h, 3, 8, rgb);
}
private void BeginTaxCardDoc(bool isCurrentYear)
{
_taxParameter = TaxParameter.Get(_TaxParameterID);
_isPrvs = !isCurrentYear;
m_nCurPage = 0;
m_oDoc = new EPDoc();
InitDoc();
}
private void AddTaxCardPages(Employee oEmp, bool isCurrentYear)
{ {
_employee = oEmp; _employee = oEmp;
_incometaxes = IncomeTax.Get(oIncomeTax.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, SystemInformation.CurrentSysInfo.TaxParamID); if (isCurrentYear)
{
IncomeTax oIncomeTax = new IncomeTax();
_incometaxes = IncomeTax.Get(oIncomeTax.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, _TaxParameterID);
//As this method has not been used yet then A Boolean value is used as Parameter //As this method has not been used yet then A Boolean value is used as Parameter
_dSet = PrepareDataset(oEmp.ID, isCurrentYear); _dSet = PrepareDataset(oEmp.ID, isCurrentYear);
AddPage(); AddPage();
PrintBody(); PrintBody();
PrintSlab(); PrintSlab();
return;
} }
}
else
{
ObjectsTemplate<TaxChallan> oTaxChallans = new ObjectsTemplate<TaxChallan>();
_taxParameter = TaxParameter.Get(_TaxParameterID);
m_oDoc = new EPDoc();
InitDoc();
_isPrvs = true;
foreach (Employee oEmp in oEMployees)
{
_employee = oEmp;
//EnumIncomeTaxDataFrom.ProcessedData
//oIncomeTax.GetEnumForSalaryIT(oEmp.ID)
_incometaxes = IncomeTax.Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, _TaxParameterID); _incometaxes = IncomeTax.Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, _TaxParameterID);
//As this method has not been used yet then A Boolean value is used as Parameter //As this method has not been used yet then A Boolean value is used as Parameter
_dSet = PrepareDataset(oEmp.ID, isCurrentYear); _dSet = PrepareDataset(oEmp.ID, isCurrentYear);
PayrollDataSet.PayrollDataSet.TaxChallanDataTable dTChallan = new Payroll.Report.PayrollDataSet.PayrollDataSet.TaxChallanDataTable(); PayrollDataSet.PayrollDataSet.TaxChallanDataTable dTChallan = new Payroll.Report.PayrollDataSet.PayrollDataSet.TaxChallanDataTable();
DataRow dChallan = null; DataRow dChallan = dTChallan.NewRow();
dChallan = dTChallan.NewRow();
oTaxChallans = TaxChallan.Get(oEmp.ID, _TaxParameterID); ObjectsTemplate<TaxChallan> oTaxChallans = TaxChallan.Get(oEmp.ID, _TaxParameterID);
int count = 1; int count = 1;
string sChallanNo = "";// "# 57 dated 06-Sep-2010, # 56/88 dated 05-Oct-2010, # 54 dated 03-Nov-2010, # 58 dated 07-Dec-2010, # 57 dated 06-Jan-2011, # 56 dated 10-Feb-2011, # 58 dated 09-Mar-2011, # 50 dated 13-Apr-2011, # 47 dated 03-May-2011, # 55 dated 09-Jun-2011, # 71/49 dated 21-Jul-2011."; string sChallanNo = "";
if (oTaxChallans != null && oTaxChallans.Count > 0) if (oTaxChallans != null && oTaxChallans.Count > 0)
{ {
foreach (TaxChallan oItem in oTaxChallans) foreach (TaxChallan oItem in oTaxChallans)
{ {
if (count == oTaxChallans.Count) if (count == oTaxChallans.Count)
{ {
sChallanNo += "Challan: " + oItem.ChallanNo + " Date: " + oItem.DepositDate.ToString("dd-MMM-yyyy"); sChallanNo += "Challan: " + oItem.ChallanNo + " Date: " + oItem.DepositDate.ToString("dd-MMM-yyyy");
//sChallanNo += oItem.ChallanNo;
} }
else else
{ {
sChallanNo += "Challan: " + oItem.ChallanNo + " Date: " + oItem.DepositDate.ToString("dd-MMM-yyyy") + ", "; sChallanNo += "Challan: " + oItem.ChallanNo + " Date: " + oItem.DepositDate.ToString("dd-MMM-yyyy") + ", ";
//sChallanNo += oItem.ChallanNo + ",";
count++; count++;
} }
} }
@ -1885,10 +1980,6 @@ namespace Payroll.Report
PrintSlabForTC(); PrintSlabForTC();
} }
}
m_oDoc.PreviewDoc();
}
public void showTaxCardMultiple(ObjectsTemplate<IncomeTax> oincometaxes, Employee oEmp, bool ITStatus) public void showTaxCardMultiple(ObjectsTemplate<IncomeTax> oincometaxes, Employee oEmp, bool ITStatus)
{ {

View File

@ -5154,6 +5154,148 @@ namespace Payroll.Report
form.ShowDlgForSalaryCertificate(_selectedParameter.ReportItem, dtTempSalarySheet, _SalaryMonth, toDate); form.ShowDlgForSalaryCertificate(_selectedParameter.ReportItem, dtTempSalarySheet, _SalaryMonth, toDate);
} }
/// <summary>
/// Salary Certificate as per the last salary agreement (employee life cycle) effective in the selected month.
/// Basic comes from the grade salary assignment in force at the month end; every grade-defined allowance
/// applicable to that grade is calculated from the allowance parameter, the same way the salary process does it.
/// </summary>
public void SalaryCertificateLastAgreement()
{
if (_selectedParameter.FromDate == null)
throw new ServiceException("Please select the month.");
string sEmpID = _selectedParameter.ReportItem.INSQL;
if (string.IsNullOrEmpty(sEmpID))
throw new ServiceException("Please select at least one employee.");
DateTime salaryMonth = GlobalFunctions.LastDateOfMonth(_selectedParameter.FromDate.Value);
DataTable dtCertificate = new DataTable("SalaryCertificateLastAgreement");
dtCertificate.Columns.Add("EmployeeID", typeof(int));
dtCertificate.Columns.Add("EmpNo", typeof(string));
dtCertificate.Columns.Add("EmpName", typeof(string));
dtCertificate.Columns.Add("Salutation", typeof(string));
dtCertificate.Columns.Add("HisHer", typeof(string));
dtCertificate.Columns.Add("Designation", typeof(string));
dtCertificate.Columns.Add("Department", typeof(string));
dtCertificate.Columns.Add("Grade", typeof(string));
dtCertificate.Columns.Add("JoiningDate", typeof(string));
dtCertificate.Columns.Add("EffectDate", typeof(string));
dtCertificate.Columns.Add("SLNo", typeof(int));
dtCertificate.Columns.Add("ItemName", typeof(string));
dtCertificate.Columns.Add("Amount", typeof(double));
dtCertificate.Columns.Add("TakaInWords", typeof(string));
dtCertificate.Columns.Add("HeShe", typeof(string));
dtCertificate.Columns.Add("HisHerCap", typeof(string));
dtCertificate.Columns.Add("NID", typeof(string));
dtCertificate.Columns.Add("Article", typeof(string));
ObjectsTemplate<Employee> employees = Employee.GetByEmpIDs(sEmpID);
ObjectsTemplate<HREmployee> hrEmployees = HREmployee.GetByIds(sEmpID);
ObjectsTemplate<ADParameter> allParameters = ADParameter.Get(EnumStatus.Active);
StringBuilder skipped = new StringBuilder();
foreach (Employee emp in employees.OrderBy(x => x.EmployeeNo))
{
EmployeeGradeSalary gradeSalary = EmployeeGradeSalary.Get(emp.ID, salaryMonth, EnumArrearType.NotPresent);
if (gradeSalary == null)
{
skipped.AppendLine(emp.EmployeeNo + " - " + emp.Name);
continue;
}
// full month value as per agreement, not prorated
gradeSalary.FractionofFromTo = 1;
// item name, amount, position
List<Tuple<string, double, int>> items = new List<Tuple<string, double, int>>();
items.Add(new Tuple<string, double, int>("Basic Salary", GlobalFunctions.Round(gradeSalary.BasicSalary), -1));
if (allParameters != null)
{
List<ADParameter> applicable = ADParameter.GetApplicableParameters(emp, gradeSalary.GradeID, allParameters);
foreach (ADParameter parameter in applicable)
{
if (parameter.EntitleType != EnumEntitleType.Grade) continue;
if (parameter.AllowOrDeductType != EnumAllowOrDeduct.Allowance) continue;
if (parameter.AllowanceDeduction == null) continue;
double amount = GlobalFunctions.Round(parameter.GetGradeDefinedAmount(emp,
gradeSalary.BasicSalary, gradeSalary.GrossSalary, gradeSalary));
if (amount == 0) continue;
int index = items.FindIndex(x => x.Item1 == parameter.AllowanceDeduction.Name);
if (index >= 0)
items[index] = new Tuple<string, double, int>(items[index].Item1, items[index].Item2 + amount, items[index].Item3);
else
items.Add(new Tuple<string, double, int>(parameter.AllowanceDeduction.Name, amount, parameter.AllowanceDeduction.Sequence));
}
}
double total = items.Sum(x => x.Item2);
string takaInWords = Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(total);
Grade grade = Grade.Get(gradeSalary.GradeID);
bool isFemale = emp.Gender == EnumGender.Female;
string designation = emp.Designation != null ? emp.Designation.Name : string.Empty;
string department = emp.Department != null ? emp.Department.Name : string.Empty;
HREmployee hrEmp = hrEmployees == null ? null : hrEmployees.Find(x => x.ID.Integer == emp.ID.Integer);
string nid = hrEmp != null && hrEmp.NationalID != null ? hrEmp.NationalID.Trim() : string.Empty;
string article = designation.Length > 0 && "AEIOUaeiou".IndexOf(designation[0]) >= 0 ? "an" : "a";
// e.g. "1st December, 2023"
Func<DateTime, string> ordinalDate = d =>
{
int day = d.Day;
string suffix = (day % 100 >= 11 && day % 100 <= 13) ? "th"
: day % 10 == 1 ? "st" : day % 10 == 2 ? "nd" : day % 10 == 3 ? "rd" : "th";
return day + suffix + " " + d.ToString("MMMM, yyyy");
};
string joiningDate = ordinalDate(emp.JoiningDate);
int sl = 1;
foreach (Tuple<string, double, int> item in items.OrderBy(x => x.Item3))
{
DataRow row = dtCertificate.NewRow();
row["EmployeeID"] = emp.ID.Integer;
row["EmpNo"] = emp.EmployeeNo;
row["EmpName"] = emp.Name;
row["Salutation"] = isFemale ? "Ms." : "Mr.";
row["HisHer"] = isFemale ? "her" : "his";
row["Designation"] = designation;
row["Department"] = department;
row["Grade"] = grade != null ? grade.Name : string.Empty;
row["JoiningDate"] = joiningDate;
row["HeShe"] = isFemale ? "She" : "He";
row["HisHerCap"] = isFemale ? "Her" : "His";
row["NID"] = nid;
row["Article"] = article;
row["EffectDate"] = ordinalDate(gradeSalary.EffectDate);
row["SLNo"] = sl++;
row["ItemName"] = item.Item1;
row["Amount"] = item.Item2;
row["TakaInWords"] = takaInWords;
dtCertificate.Rows.Add(row);
}
}
if (dtCertificate.Rows.Count == 0)
throw new ServiceException("No salary agreement (grade salary) found on or before "
+ salaryMonth.ToString("MMMM yyyy") + " for the selected employee(s).");
if (skipped.Length > 0)
System.Windows.Forms.MessageBox.Show("No salary agreement found on or before " + salaryMonth.ToString("MMMM yyyy")
+ " for the following employee(s); they are left out:" + Environment.NewLine + skipped.ToString(),
"Salary Certificate", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
DataSet ds = new DataSet();
ds.Tables.Add(dtCertificate);
List<Microsoft.Reporting.WinForms.ReportParameter> parameters = new List<Microsoft.Reporting.WinForms.ReportParameter>();
parameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("SalaryMonth", salaryMonth.ToString("MMMM yyyy")));
fReportViewer form = new fReportViewer();
form.CommonReportView(_selectedParameter.ReportItem, ds, "Payroll.Report.RDLC.SalaryCertificateLastAgreement.rdlc", parameters);
}
internal void PrepareSalarySummaryReport(DateTime dateTime, int deptId) internal void PrepareSalarySummaryReport(DateTime dateTime, int deptId)
{ {
fReportViewer oviewer = new fReportViewer(); fReportViewer oviewer = new fReportViewer();

View File

@ -64,6 +64,9 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\Library\Ease.Printing.dll</HintPath> <HintPath>..\Library\Ease.Printing.dll</HintPath>
</Reference> </Reference>
<Reference Include="itextsharp">
<HintPath>..\Library\itextsharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL"> <Reference Include="Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Report.Viewer.11.0.0.0\lib\net\Microsoft.ReportViewer.WebForms.DLL</HintPath> <HintPath>..\packages\Microsoft.Report.Viewer.11.0.0.0\lib\net\Microsoft.ReportViewer.WebForms.DLL</HintPath>
@ -529,6 +532,7 @@
<EmbeddedResource Include="RDLC\rUserRole.rdlc" /> <EmbeddedResource Include="RDLC\rUserRole.rdlc" />
<EmbeddedResource Include="RDLC\rUsers.rdlc" /> <EmbeddedResource Include="RDLC\rUsers.rdlc" />
<EmbeddedResource Include="RDLC\SalaryCertificate.rdlc" /> <EmbeddedResource Include="RDLC\SalaryCertificate.rdlc" />
<EmbeddedResource Include="RDLC\SalaryCertificateLastAgreement.rdlc" />
<EmbeddedResource Include="RDLC\SalaryReconciliation.rdlc" /> <EmbeddedResource Include="RDLC\SalaryReconciliation.rdlc" />
<EmbeddedResource Include="RDLC\SalaryReconciliationForAllItems.rdlc" /> <EmbeddedResource Include="RDLC\SalaryReconciliationForAllItems.rdlc" />
<EmbeddedResource Include="RDLC\SalaryReconciliationSummary.rdlc" /> <EmbeddedResource Include="RDLC\SalaryReconciliationSummary.rdlc" />

View File

@ -0,0 +1,751 @@
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<Body>
<ReportItems>
<Tablix Name="lstEmployee">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>6.5in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>4.9in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Rectangle Name="rectLetter">
<ReportItems>
<Textbox Name="txtDate">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>="Date: " &amp; Format(Today(), "dd MMMM yyyy")</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<Height>0.25in</Height>
<Width>3in</Width>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="txtTitle">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>SALARY CERTIFICATE</Value>
<Style>
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
<TextDecoration>Underline</TextDecoration>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>0.45in</Top>
<Height>0.35in</Height>
<Width>6.5in</Width>
<ZIndex>1</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="txtConcern">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>TO WHOM IT MAY CONCERN</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>0.85in</Top>
<Height>0.25in</Height>
<Width>6.5in</Width>
<ZIndex>2</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="txtBody">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>="This is to certify that " &amp; Fields!Salutation.Value &amp; " " &amp; Fields!EmpName.Value &amp; " (CEL ID- " &amp; Fields!EmpNo.Value &amp; ") has been working in " &amp; Parameters!CompanyInfo.Value &amp; " since " &amp; Fields!JoiningDate.Value &amp; " as " &amp; Fields!Article.Value &amp; " " &amp; Fields!Designation.Value &amp; "." &amp; IIf(Len(Fields!NID.Value) &gt; 0, " " &amp; Fields!HisHerCap.Value &amp; " NID No. " &amp; Fields!NID.Value &amp; ".", "") &amp; " " &amp; Fields!HeShe.Value &amp; " is a permanent employee of " &amp; Parameters!CompanyInfo.Value &amp; ". Currently, as per " &amp; Fields!HisHer.Value &amp; " last salary agreement effective from " &amp; Fields!EffectDate.Value &amp; ", " &amp; LCase(Fields!HeShe.Value) &amp; " has been drawing salary with the following breakdown:"</Value>
<Style />
</TextRun>
</TextRuns>
<Style>
<TextAlign>Left</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>1.3in</Top>
<Height>0.6in</Height>
<Width>6.5in</Width>
<ZIndex>3</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="tblItems">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>0.6in</Width>
</TablixColumn>
<TablixColumn>
<Width>3.4in</Width>
</TablixColumn>
<TablixColumn>
<Width>1.8in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="hdrSL">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>SL</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<BackgroundColor>Gainsboro</BackgroundColor>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="hdrItem">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Particulars</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<BackgroundColor>Gainsboro</BackgroundColor>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>4pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="hdrAmount">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Amount (Tk.)</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<BackgroundColor>Gainsboro</BackgroundColor>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>4pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="SLNo">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!SLNo.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="ItemName">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!ItemName.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>4pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Amount">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Amount.Value</Value>
<Style>
<Format>#,##0.00</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>4pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="totLabel">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Total Monthly Gross Salary</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>4pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<ColSpan>2</ColSpan>
</CellContents>
</TablixCell>
<TablixCell />
<TablixCell>
<CellContents>
<Textbox Name="totAmount">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!Amount.Value)</Value>
<Style>
<FontWeight>Bold</FontWeight>
<Format>#,##0.00</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>4pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
</TablixMember>
<TablixMember>
<Group Name="grpItemDetails" />
<SortExpressions>
<SortExpression>
<Value>=Fields!SLNo.Value</Value>
</SortExpression>
</SortExpressions>
</TablixMember>
<TablixMember>
<KeepWithGroup>Before</KeepWithGroup>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>SalaryCertificateLastAgreement</DataSetName>
<Top>2.05in</Top>
<Left>0.35in</Left>
<Height>0.75in</Height>
<Width>5.8in</Width>
<ZIndex>4</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
<Textbox Name="txtWords">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>="In Words: " &amp; Fields!TakaInWords.Value</Value>
<Style>
<FontStyle>Italic</FontStyle>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<Top>2.95in</Top>
<Left>0.35in</Left>
<Height>0.25in</Height>
<Width>5.8in</Width>
<ZIndex>5</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="txtClosing">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>="His other deductions are paid by the company."</Value>
<Style />
</TextRun>
</TextRuns>
<Style>
<TextAlign>Left</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>3.4in</Top>
<Height>0.4in</Height>
<Width>6.5in</Width>
<ZIndex>6</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="txtSignature">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Authorized Signature</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>4.55in</Top>
<Height>0.25in</Height>
<Width>2in</Width>
<ZIndex>7</ZIndex>
<Style>
<TopBorder>
<Style>Solid</Style>
</TopBorder>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<KeepTogether>true</KeepTogether>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Rectangle>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<Group Name="grpEmployee">
<GroupExpressions>
<GroupExpression>=Fields!EmployeeID.Value</GroupExpression>
</GroupExpressions>
<PageBreak>
<BreakLocation>Between</BreakLocation>
</PageBreak>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!EmpNo.Value</Value>
</SortExpression>
</SortExpressions>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>SalaryCertificateLastAgreement</DataSetName>
<Top>0.275in</Top>
<Height>4.9in</Height>
<Width>6.5in</Width>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
</ReportItems>
<Height>6.4in</Height>
<Style />
</Body>
<Width>6.5in</Width>
<Page>
<PageHeader>
<Height>1.4875in</Height>
<PrintOnFirstPage>true</PrintOnFirstPage>
<PrintOnLastPage>true</PrintOnLastPage>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</PageHeader>
<PageHeight>11.69in</PageHeight>
<PageWidth>8.27in</PageWidth>
<LeftMargin>0.885in</LeftMargin>
<RightMargin>0.885in</RightMargin>
<TopMargin>0.7in</TopMargin>
<BottomMargin>0.7in</BottomMargin>
<Style />
</Page>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="dsSalaryCertificate">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>4c6f2d9a-7b1e-4a52-9d3f-2e8b1c0a5f61</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="SalaryCertificateLastAgreement">
<Query>
<DataSourceName>dsSalaryCertificate</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="EmployeeID">
<DataField>EmployeeID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="EmpNo">
<DataField>EmpNo</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="EmpName">
<DataField>EmpName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Salutation">
<DataField>Salutation</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="HisHer">
<DataField>HisHer</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="HeShe">
<DataField>HeShe</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="HisHerCap">
<DataField>HisHerCap</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="NID">
<DataField>NID</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Article">
<DataField>Article</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Designation">
<DataField>Designation</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Department">
<DataField>Department</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Grade">
<DataField>Grade</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="JoiningDate">
<DataField>JoiningDate</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="EffectDate">
<DataField>EffectDate</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="SLNo">
<DataField>SLNo</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="ItemName">
<DataField>ItemName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Amount">
<DataField>Amount</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="TakaInWords">
<DataField>TakaInWords</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
</DataSet>
</DataSets>
<ReportParameters>
<ReportParameter Name="Logo">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>Logo</Prompt>
</ReportParameter>
<ReportParameter Name="CompanyInfo">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>CompanyInfo</Prompt>
</ReportParameter>
<ReportParameter Name="SearchCriteria">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>SearchCriteria</Prompt>
</ReportParameter>
<ReportParameter Name="Address">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>Address</Prompt>
</ReportParameter>
<ReportParameter Name="Phone">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>Phone</Prompt>
</ReportParameter>
<ReportParameter Name="SalaryMonth">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>SalaryMonth</Prompt>
</ReportParameter>
</ReportParameters>
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>9b1e3f52-6a4d-4c8e-b2f7-1d5a0e9c3b74</rd:ReportID>
</Report>

View File

@ -2176,6 +2176,8 @@ namespace Payroll.Report
ReportViewer.LocalReport.DataSources.Add(new ReportDataSource(dMain.TableName, dMain)); ReportViewer.LocalReport.DataSources.Add(new ReportDataSource(dMain.TableName, dMain));
// -= first: this viewer may be reused for many payslips (PaySlip.MailReportWithAccountNoMask)
ReportViewer.LocalReport.SubreportProcessing -= new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
ReportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); ReportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
ReportViewer.LocalReport.ReportEmbeddedResource = RDLC; ReportViewer.LocalReport.ReportEmbeddedResource = RDLC;

View File

@ -7,8 +7,8 @@
<section name="InformationForReportTool" type="Ease.SearchTools.Objects.InformationForReportToolConfigHandler, Ease.SearchTools.Objects"/> <section name="InformationForReportTool" type="Ease.SearchTools.Objects.InformationForReportToolConfigHandler, Ease.SearchTools.Objects"/>
</configSections> </configSections>
<dbSettings> <dbSettings>
<!--<connection name="conn" provider="sql" connectionString="server=cel80;Database=CELPayroll;User ID=CELPayroll;password=4B06094270245E4D5B63" sqlSyntax="SQL"/>--> <connection name="conn" provider="sql" connectionString="server=cel80;Database=CELPayroll;User ID=CELPayroll;password=4B06094270245E4D5B63" sqlSyntax="SQL"/>
<connection name="conn" provider="sql" connectionString="server=103.197.204.164,1718;Database=CELPayrol;User ID=DBuser;Password=ceLEa&amp;e2025" sqlSyntax="SQL"/> <!--<connection name="conn" provider="sql" connectionString="server=103.197.204.164,1718;Database=CELPayrol;User ID=DBuser;Password=ceLEa&amp;e2025" sqlSyntax="SQL"/>-->
</dbSettings> </dbSettings>
<appSettings> <appSettings>
<add key="serviceHandler" value="Payroll.Service.dll/conn"/> <add key="serviceHandler" value="Payroll.Service.dll/conn"/>

View File

@ -1205,6 +1205,14 @@
</argument> </argument>
</arguments> </arguments>
</permissioninfo> </permissioninfo>
<permissioninfo key="12.2.25" name="Salary Certificate Last Agreement" isvisible="true" parentkey="12.2" menufor="User">
<formname>Payroll.Report.fReportSearch</formname>
<showfunction>ShowDialog</showfunction>
<arguments>
<argument name="ReportID" value="510">
</argument>
</arguments>
</permissioninfo>
<permissioninfo key="12.2.16" name="Stuff List Without Salary" isvisible="true" parentkey="12.2" menufor="User"> <permissioninfo key="12.2.16" name="Stuff List Without Salary" isvisible="true" parentkey="12.2" menufor="User">
<formname>Payroll.Report.fReportSearch</formname> <formname>Payroll.Report.fReportSearch</formname>
<showfunction>ShowDialog</showfunction> <showfunction>ShowDialog</showfunction>

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("26.10.26.0")] [assembly: AssemblyVersion("26.11.25.0")]
[assembly: AssemblyFileVersion("26.10.26.0")] [assembly: AssemblyFileVersion("26.11.25.0")]

View File

@ -597,53 +597,95 @@ namespace Payroll.UI
return; return;
} }
// Tax card is generated together with the salary payslip (Type 1).
// Fiscal year follows the salary month: Jul-Dec => YYYY-(YYYY+1), Jan-Jun => (YYYY-1)-YYYY.
bool withTaxCard = _Type == 1;
int fyStart = month >= 7 ? year : year - 1;
string fiscalYear = fyStart + "-" + (fyStart + 1);
TaxParameter taxParameter = null;
rptIncomeTax taxReport = null;
List<string> taxSkipped = new List<string>();
if (withTaxCard)
{
taxParameter = FindTaxParameter(fyStart);
if (taxParameter != null)
taxReport = new rptIncomeTax();
}
int count = 0; int count = 0;
int payslipCount = 0;
int taxCardCount = 0;
foreach (SearchEmployee emp in employees) foreach (SearchEmployee emp in employees)
{ {
lblEmployee.Text = $"Generating Payslip : {++count}/{employees.Count}"; lblEmployee.Text = $"Generating : {++count}/{employees.Count}";
lblEmployee.Refresh(); lblEmployee.Refresh();
byte[] pdfBytes = (_Type != 1)
? paySlip.SKFExpencesPaySlip1(dtpfromDate.Value, emp.EmployeeID.Integer.ToString())
: paySlip.MailReportWithAccountNoMask(dtpfromDate.Value, emp.EmployeeID.Integer.ToString());
if (pdfBytes == null)
continue;
// ✅ FILE NAME: ID-Year-Month.pdf
string fileName = string.Format(
"{0}_{1}_{2}.pdf",
"CEL-" + emp.Employee.EmployeeNo,
year,
month.ToString("00")
);
string filePath = Path.Combine(basePath, fileName);
string phoneNo = emp.Employee.MobileNo ?? ""; string phoneNo = emp.Employee.MobileNo ?? "";
string password = phoneNo.Length >= 4 string password = phoneNo.Length >= 4
? phoneNo.Substring(phoneNo.Length - 4) ? phoneNo.Substring(phoneNo.Length - 4)
: phoneNo.PadLeft(4, '0'); : phoneNo.PadLeft(4, '0');
using (MemoryStream ms = new MemoryStream(pdfBytes)) byte[] pdfBytes = (_Type != 1)
using (PdfReader reader = new PdfReader(ms)) ? paySlip.SKFExpencesPaySlip1(dtpfromDate.Value, emp.EmployeeID.Integer.ToString())
using (FileStream fs = new FileStream(filePath, FileMode.Create)) : paySlip.MailReportWithAccountNoMask(dtpfromDate.Value, emp.EmployeeID.Integer.ToString());
if (pdfBytes != null)
{ {
PdfEncryptor.Encrypt( // ✅ FILE NAME: CEL-EmpNo_Year_Month.pdf
reader, string fileName = string.Format(
fs, "{0}_{1}_{2}.pdf",
true, "CEL-" + emp.Employee.EmployeeNo,
password, year,
null, month.ToString("00")
2052
); );
SaveEncryptedPdf(pdfBytes, Path.Combine(basePath, fileName), password);
payslipCount++;
}
if (taxReport != null)
{
try
{
byte[] taxBytes = taxReport.GetTaxCardPdf(emp.Employee, taxParameter.ID);
if (taxBytes == null)
{
taxSkipped.Add(emp.EmployeeNo + " (no tax data)");
}
else
{
// FILE NAME: CEL-EmpNo_TaxCard_FiscalYear.pdf
string taxFileName = string.Format("CEL-{0}_TaxCard_{1}.pdf", emp.Employee.EmployeeNo, fiscalYear);
SaveEncryptedPdf(taxBytes, Path.Combine(basePath, taxFileName), password);
taxCardCount++;
}
}
catch (Exception taxEx)
{
Exception inner = taxEx.InnerException ?? taxEx;
taxSkipped.Add(emp.EmployeeNo + " (" + inner.Message + ")");
}
} }
} }
lblEmployee.Text = string.Empty; lblEmployee.Text = string.Empty;
MessageBox.Show("Payslips generated successfully.", "Payslip", string msg = payslipCount + " payslip(s) generated.";
MessageBoxButtons.OK, MessageBoxIcon.Information); if (withTaxCard)
{
if (taxParameter == null)
msg += "\n\nTax card not generated: no Income Tax Parameter found for fiscal year " + fiscalYear + ".";
else
{
msg += "\n" + taxCardCount + " tax card(s) generated for fiscal year " + fiscalYear + ".";
if (taxSkipped.Count > 0)
msg += "\n\nTax card skipped " + taxSkipped.Count + ":\n"
+ string.Join("\n", taxSkipped.GetRange(0, Math.Min(20, taxSkipped.Count)).ToArray())
+ (taxSkipped.Count > 20 ? "\n..." : "");
}
}
bool warn = withTaxCard && (taxParameter == null || taxSkipped.Count > 0);
MessageBox.Show(msg, "Payslip", MessageBoxButtons.OK,
warn ? MessageBoxIcon.Warning : MessageBoxIcon.Information);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -752,6 +794,40 @@ namespace Payroll.UI
} }
private static void SaveEncryptedPdf(byte[] pdfBytes, string filePath, string password)
{
using (MemoryStream ms = new MemoryStream(pdfBytes))
using (PdfReader reader = new PdfReader(ms))
using (FileStream fs = new FileStream(filePath, FileMode.Create))
{
PdfEncryptor.Encrypt(reader, fs, true, password, null, 2052);
}
}
/// <summary>
/// Income Tax Parameter of the fiscal year starting in July of <paramref name="fyStartYear"/>
/// (e.g. 2026 => 2026-2027). Matched by its fiscal year dates, else by the FiscalYear text.
/// </summary>
private static TaxParameter FindTaxParameter(int fyStartYear)
{
DateTime probe = new DateTime(fyStartYear, 12, 31);
ObjectsTemplate<TaxParameter> all = TaxParameter.Get();
if (all == null) return null;
foreach (TaxParameter p in all)
{
if (p.FiscalyearDatefrom <= probe && probe <= p.FiscalyearDateTo)
return p;
}
string from = fyStartYear.ToString(), to = (fyStartYear + 1).ToString(), toShort = to.Substring(2);
foreach (TaxParameter p in all)
{
string fy = p.FiscalYear ?? "";
if (fy.Contains(from) && (fy.Contains(to) || fy.EndsWith(toShort)))
return p;
}
return null;
}
//private void btnDownload_Click(object sender, EventArgs e) //private void btnDownload_Click(object sender, EventArgs e)
//{ //{
// try // try