Salary Sheet With LWP Added

This commit is contained in:
Shahadat Hossain 2026-11-09 17:00:10 +06:00
parent af24bc0b4a
commit 0d9ef931bb
3 changed files with 92 additions and 3 deletions

View File

@ -1248,6 +1248,7 @@ namespace Payroll.BO
Memorandum = 52, Memorandum = 52,
SalarySMS = 53, SalarySMS = 53,
SalarySheetSummary = 54, SalarySheetSummary = 54,
SalarySheetSummaryWithLWP = 541,
SalarySheetArrear = 57, SalarySheetArrear = 57,
SalaryBankSummary = 55, SalaryBankSummary = 55,
SalaryByMonthAndYear = 111111, SalaryByMonthAndYear = 111111,

View File

@ -931,14 +931,53 @@ namespace Payroll.Report
return null; return null;
} }
public void ShowReport() public void ShowReport()
{
ShowSalarySheet(false);
}
/// <summary>
/// Salary Sheet with LWP (ReportID 541): items are shown at full amount and the
/// unauthorized leave (LWP) deduction is shown as a separate deduction column.
/// </summary>
public void ShowReportWithLWP()
{
ShowSalarySheet(true);
}
private void ShowSalarySheet(bool withLWP)
{ {
fReportViewer form = new fReportViewer(); fReportViewer form = new fReportViewer();
_SalaryMonth = _selectedParameter.FromDate.Value; _SalaryMonth = _selectedParameter.FromDate.Value;
ID nReportID = _selectedParameter.ReportItem.ReportID; // Signatures/authorization are shared with the normal Salary Sheet (54)
ID nReportID = withLWP ? ID.FromInteger((int)EnumReportType.SalarySheetSummary) : _selectedParameter.ReportItem.ReportID;
string sEmpID = _selectedParameter.ReportItem.INSQL; string sEmpID = _selectedParameter.ReportItem.INSQL;
DataRow oDR = null; DataRow oDR = null;
DataSet oSalarySheets = null; DataSet oSalarySheets = null;
oSalarySheets = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID); oSalarySheets = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// One "LWP" row per employee = sum of all unauthorized leave deductions
DataTable dtLWP = oSalarySheets.Tables["UnAuthorizedLeave"].Clone();
dtLWP.Columns["Description"].ReadOnly = false;
if (withLWP)
{
foreach (DataRow src in oSalarySheets.Tables["UnAuthorizedLeave"].Rows)
{
DataRow lwp = GetItem3(dtLWP, src["EMPLOYEENO"].ToString());
if (lwp == null)
{
lwp = dtLWP.NewRow();
lwp.ItemArray = src.ItemArray;
lwp["ITEMCODE"] = 0;
lwp["ITEMID"] = 0;
lwp["Description"] = "LWP";
dtLWP.Rows.Add(lwp);
}
else
{
lwp["Amount"] = Convert.ToDouble(lwp["Amount"]) + Convert.ToDouble(src["Amount"]);
}
}
}
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable(); PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" }; List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
@ -1056,6 +1095,12 @@ namespace Payroll.Report
} }
seq++;
foreach (DataRow dr in dtLWP.Rows)
{
dr["SequenceNo"] = seq;
}
seq++; seq++;
foreach (DataRow dr in oSalarySheets.Tables["TotalDeduction"].Rows) foreach (DataRow dr in oSalarySheets.Tables["TotalDeduction"].Rows)
{ {
@ -1083,7 +1128,8 @@ namespace Payroll.Report
oDR = dTSalarySheet.NewRow(); oDR = dTSalarySheet.NewRow();
this.CopyNonMngtForGross(oDR, source); this.CopyNonMngtForGross(oDR, source);
if (source["ITEMGROUP"].ToString() == "1") // With LWP the items stay at full amount; LWP is shown as a separate deduction
if (!withLWP && source["ITEMGROUP"].ToString() == "1")
{ {
DataRow dr = this.GetItem2(oSalarySheets.Tables["UnAuthorizedLeave"], source["EMPLOYEENO"].ToString(), EnumSalaryGroup.UnauthLeave, (EnumSalaryItemCode)Convert.ToInt16(source["ITEMCODE"]), Convert.ToInt16(source["ITEMID"])); DataRow dr = this.GetItem2(oSalarySheets.Tables["UnAuthorizedLeave"], source["EMPLOYEENO"].ToString(), EnumSalaryGroup.UnauthLeave, (EnumSalaryItemCode)Convert.ToInt16(source["ITEMCODE"]), Convert.ToInt16(source["ITEMID"]));
if (dr != null) if (dr != null)
@ -1106,6 +1152,15 @@ namespace Payroll.Report
{ {
oDR["Amount"] = Convert.ToDouble(dr2["Amount"]) + Convert.ToDouble(dr["Amount"]); oDR["Amount"] = Convert.ToDouble(dr2["Amount"]) + Convert.ToDouble(dr["Amount"]);
} }
if (withLWP && dr2 != null)
{
// Gross before LWP = Net Pay + Total Deduction + LWP
DataRow drLWP = this.GetItem3(dtLWP, source["EMPLOYEENO"].ToString());
double nGross = Convert.ToDouble(dr2["Amount"]);
if (dr != null) nGross += Convert.ToDouble(dr["Amount"]);
if (drLWP != null) nGross += Convert.ToDouble(drLWP["Amount"]);
oDR["Amount"] = nGross;
}
dTSalarySheet.Rows.Add(oDR); dTSalarySheet.Rows.Add(oDR);
} }
@ -1116,10 +1171,35 @@ namespace Payroll.Report
dTSalarySheet.Rows.Add(oDR); dTSalarySheet.Rows.Add(oDR);
} }
foreach (DataRow source in dtLWP.Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyNonMngtForDeduct(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows) foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
{ {
oDR = dTSalarySheet.NewRow(); oDR = dTSalarySheet.NewRow();
this.CopyNonManagement(oDR, source); this.CopyNonManagement(oDR, source);
if (withLWP)
{
DataRow drLWP = this.GetItem3(dtLWP, source["EMPLOYEENO"].ToString());
if (drLWP != null)
oDR["Amount"] = Convert.ToDouble(oDR["Amount"]) + Convert.ToDouble(drLWP["Amount"]);
}
dTSalarySheet.Rows.Add(oDR);
}
// Employee with LWP but no regular deduction has no Total Deduction row
foreach (DataRow source in dtLWP.Rows)
{
if (this.GetItem3(oSalarySheets.Tables["TotalDeduction"], source["EMPLOYEENO"].ToString()) != null) continue;
oDR = dTSalarySheet.NewRow();
this.CopyNonManagement(oDR, source);
oDR["Description"] = "Total Deduction";
oDR["SequenceNo"] = oSalarySheets.Tables["TotalDeduction"].Rows.Count > 0
? oSalarySheets.Tables["TotalDeduction"].Rows[0]["SequenceNo"] : Convert.ToInt32(source["SequenceNo"]) + 1;
dTSalarySheet.Rows.Add(oDR); dTSalarySheet.Rows.Add(oDR);
} }

View File

@ -1101,6 +1101,14 @@
</argument> </argument>
</arguments> </arguments>
</permissioninfo> </permissioninfo>
<permissioninfo key="12.2.24" name="Salary Sheet with LWP" isvisible="true" parentkey="12.2" menufor="User">
<formname>Payroll.Report.fReportSearch</formname>
<showfunction>ShowDlg</showfunction>
<arguments>
<argument name="ReportID" value="541">
</argument>
</arguments>
</permissioninfo>
<PermissionInfo Key = "12.2.5" Name= "Payroll Register For All" IsVisible="true" ParentKey="12.2" MenuFor="User"> <PermissionInfo Key = "12.2.5" Name= "Payroll Register For All" IsVisible="true" ParentKey="12.2" MenuFor="User">
<FormName>frmPayRollRegisterForAll</FormName> <FormName>frmPayRollRegisterForAll</FormName>