Compare commits

..

No commits in common. "devqc" and "dev_shamim" have entirely different histories.

15 changed files with 363 additions and 2860 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -12,7 +12,7 @@ using ClosedXML.Excel;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using System.Collections; using System.Collections;
//using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml.Spreadsheet;
namespace Payroll.BO namespace Payroll.BO
{ {

View File

@ -49,8 +49,7 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.7.4114.6375, Culture=neutral, PublicKeyToken=0e99375e54769942"> <Reference Include="BouncyCastle.Crypto">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Library\BouncyCastle.Crypto.dll</HintPath> <HintPath>..\Library\BouncyCastle.Crypto.dll</HintPath>
</Reference> </Reference>
<Reference Include="ClosedXML"> <Reference Include="ClosedXML">

View File

@ -3067,11 +3067,7 @@ namespace Payroll.BO
enc = (PgpEncryptedDataList)pgpObjF.NextPgpObject(); enc = (PgpEncryptedDataList)pgpObjF.NextPgpObject();
} }
// Replace the following line: var akp = new Org.BouncyCastle.Crypto.AsymmetricKeyParameter(true);
// var akp = new Org.BouncyCastle.Crypto.AsymmetricKeyParameter(true);
// With the following corrected code:
Org.BouncyCastle.Crypto.AsymmetricKeyParameter akp = new Org.BouncyCastle.Crypto.Parameters.RsaKeyParameters(true, null, null);

View File

@ -3395,286 +3395,6 @@ namespace Payroll.Report
} }
form.ShowDlgForPaySlipOverAllSummary(_selectedParameter.ReportItem, PayslipData); form.ShowDlgForPaySlipOverAllSummary(_selectedParameter.ReportItem, PayslipData);
} }
public byte[] MailReportWithAccountNoMask(DateTime salaryMonth2, string sEmpID2)
{
DataSet dataSet = null;
DataSet dataSet2 = new DataSet();
_oGratuityParams = ESBDefinition.Get();
Employee employee = null;
ObjectsTemplate<Employee> val = new ObjectsTemplate<Employee>();
val = Employee.Get();
List<Designation> source = (List<Designation>)(object)Designation.Get(EnumStatus.Regardless);
DataRow dataRow = null;
fReportViewer fReportViewer2 = new fReportViewer();
DateTime dateTime = salaryMonth2;
ObjectsTemplate<SalaryProcess> val2 = new ObjectsTemplate<SalaryProcess>();
val2 = SalaryProcess.Get(GlobalFunctions.LastDateOfMonth(dateTime));
dataSet = Employee.GetEmpBasicInfoForPSlipNew(sEmpID2, GlobalFunctions.LastDateOfMonth(dateTime));
if (dataSet != null && dataSet.Tables.Count > 0)
{
DataTable dataTable = dataSet.Tables[0];
foreach (DataRow row2 in dataTable.Rows)
{
string text = row2["AccountNo"].ToString().Trim();
if (text.Length >= 6)
{
string text2 = text.Substring(0, 3);
string text3 = text.Substring(text.Length - 3);
row2["AccountNo"] = text2 + "******" + text3;
}
else
{
row2["AccountNo"] = text;
}
}
}
//PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable();
//PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new Payroll.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable();
////bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth));
//DataTable basicInfo = new PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable();
DataSet empPaySlipGrossForOthers = SalaryMonthly.GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(dateTime), sEmpID2);
DataSet empPaySlipDeductForOthers = SalaryMonthly.GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(dateTime), sEmpID2);
PayrollDataSet.PayrollDataSet.PayslipDataTable payslipDataTable = new PayrollDataSet.PayrollDataSet.PayslipDataTable();
PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDataDataTable = new PayrollDataSet.PayrollDataSet.LoanDataDataTable();
DataTable dataTable2 = new PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable();
_dSalaryMonth = GlobalFunctions.LastDateOfMonth(dateTime);
if (val2 != null && ((List<SalaryProcess>)(object)val2).Count > 0 && empPaySlipGrossForOthers.Tables[0].Rows.Count > 0)
{
if (((List<SalaryProcess>)(object)val2)[0].PaymentDate != DateTime.MinValue)
{
_dMonthEndDate = Convert.ToDateTime(((List<SalaryProcess>)(object)val2)[0].PaymentDate);
}
else
{
_dMonthEndDate = DateTime.MinValue;
}
}
foreach (DataRow row3 in empPaySlipGrossForOthers.Tables[0].Rows)
{
double num = Convert.ToDouble(row3["CHANGEDAMOUNT"].ToString());
if (num == 0.0)
{
continue;
}
dataRow = ((Convert.ToInt32(row3["ItemCode"]) != -103) ? GetItem(payslipDataTable, Convert.ToString(row3["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(row3["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(row3["ItemCode"]), Convert.ToInt32(row3["ItemID"])) : GetItem2(payslipDataTable, Convert.ToString(row3["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(row3["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(row3["ItemCode"]), Convert.ToInt32(row3["ItemID"]), row3["Description"].ToString().Trim()));
if (dataRow == null)
{
dataRow = payslipDataTable.NewRow();
dataRow = GrossMerge(dataRow, row3);
payslipDataTable.Rows.Add(dataRow);
}
if (Convert.ToInt32(row3["ItemCode"]) == -103)
{
DataRow item = GetItem2(empPaySlipGrossForOthers.Tables[1], Convert.ToString(row3["EMPLOYEENO"]), EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Over_Time_Hours, Convert.ToInt32(row3["ItemID"]), row3["Description"].ToString().Replace(" hour", "").Trim());
if (item != null && dataRow["Description"].ToString().IndexOf('[') < 0)
{
DataRow dataRow4 = dataRow;
dataRow4["Description"] = dataRow4["Description"]?.ToString() + " [" + Convert.ToDouble(item["CHANGEDAMOUNT"]).ToString("#") + " Hours]";
}
}
if (Convert.ToInt32(row3["ITEMGROUP"]) == 1)
{
if (dataRow["Earning"].ToString() != "" && Convert.ToInt32(row3["ItemCode"]) != -103)
{
dataRow["Earning"] = Convert.ToDouble(dataRow["Earning"]) + Convert.ToDouble(row3["CHANGEDAMOUNT"]);
}
else
{
dataRow["Earning"] = row3["CHANGEDAMOUNT"];
}
}
if (Convert.ToInt32(row3["ITEMGROUP"]) == 3 && Convert.ToInt32(row3["ITEMID"]) == -128)
{
if (dataRow["Earning"].ToString() != "")
{
dataRow["Earning"] = Convert.ToDouble(dataRow["Earning"]) + Convert.ToDouble(row3["CHANGEDAMOUNT"]);
dataRow["Description"] = "Company PF Contribution";
}
else
{
dataRow["Earning"] = Convert.ToDouble(row3["CHANGEDAMOUNT"]);
dataRow["Description"] = "Company PF Contribution";
}
}
else if (Convert.ToInt32(row3["ITEMGROUP"]) == 8)
{
double num2 = Convert.ToDouble(row3["CHANGEDAMOUNT"].ToString());
dataRow["Arrear"] = num2;
}
else if (Convert.ToInt32(row3["ITEMGROUP"]) == 2)
{
dataRow["unAuthLeave"] = row3["CHANGEDAMOUNT"];
}
}
int num3 = 0;
string text4 = "";
DataRow[] array = null;
if (empPaySlipDeductForOthers.Tables[0].Rows.Count > 0)
{
text4 = empPaySlipDeductForOthers.Tables[0].Rows[0]["EMPLOYEENO"].ToString();
array = payslipDataTable.Select(" EmployeeNo='" + empPaySlipDeductForOthers.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'");
}
double num4 = 0.0;
double num5 = 0.0;
string text5 = "";
double num6 = 0.0;
foreach (DataRow odRow in empPaySlipDeductForOthers.Tables[0].Rows)
{
double num7 = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString());
if (num7 == 0.0)
{
continue;
}
dataRow = null;
if (text4 != odRow["EMPLOYEENO"].ToString())
{
array = payslipDataTable.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'");
num3 = 0;
}
if (array.Length <= num3)
{
dataRow = payslipDataTable.NewRow();
dataRow = GrossMerge(dataRow, odRow);
payslipDataTable.Rows.Add(dataRow);
}
else
{
dataRow = array[num3];
}
dataRow["DeducDescription"] = odRow["Description"];
if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3)
{
if (dataRow["DeducDescription"].ToString().ToLower() == "pf contribution")
{
dataRow["DeducAmount"] = Convert.ToDouble(odRow["CHANGEDAMOUNT"]) * 2.0;
}
else
{
dataRow["DeducAmount"] = odRow["CHANGEDAMOUNT"];
}
}
dataRow["DeducDescription"] = odRow["Description"];
if (text5 == "" || text5 != odRow["EMPLOYEENO"].ToString())
{
num6 = 0.0;
num5 = 0.0;
employee = ((List<Employee>)(object)val).Find((Predicate<Employee>)((Employee oEmpItem) => oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim()));
DataRow[] array2 = empPaySlipDeductForOthers.Tables[0].Select(" ItemCode='" + -128 + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'");
if (array2.Length != 0)
{
DataRow dataRow5 = array2[0];
num6 = Convert.ToDouble(dataRow5["CHANGEDAMOUNT"]) * 2.0;
}
if ((ObjectTemplate)(object)employee != (ObjectTemplate)null)
{
num4 = ((((List<ESBDefinition>)(object)_oGratuityParams).Count <= 0 || _oGratuityParams == null) ? 0.0 : GetGratuityAmount(_oGratuityParams, employee, dateTime));
num5 = GetPFAmount(employee, dateTime);
}
}
dataRow["Gratuity"] = num4;
double num8 = 0.0;
if ((ObjectTemplate)(object)employee != (ObjectTemplate)null)
{
num8 = ServiceYears(GlobalFunctions.LastDateOfMonth(dateTime), employee);
}
if (num8 > 5.0)
{
dataRow["PF"] = num5 + num6;
}
else
{
dataRow["PF"] = num5 + num6;
}
num3++;
text4 = odRow["EMPLOYEENO"].ToString();
text5 = odRow["EMPLOYEENO"].ToString();
}
num3 = 0;
DataSet empPaySlipIncomeTaxAmountForOthers = SalaryMonthly.GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(dateTime), sEmpID2);
string text6 = "";
DataRow[] array3 = null;
if (empPaySlipIncomeTaxAmountForOthers.Tables[0].Rows.Count > 0)
{
text6 = empPaySlipIncomeTaxAmountForOthers.Tables[0].Rows[0]["EMPLOYEENO"].ToString();
array3 = payslipDataTable.Select(" EmployeeNo='" + empPaySlipIncomeTaxAmountForOthers.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'");
}
foreach (DataRow row4 in empPaySlipIncomeTaxAmountForOthers.Tables[0].Rows)
{
dataRow = null;
if (text6 != row4["EMPLOYEENO"].ToString())
{
array3 = payslipDataTable.Select(" EmployeeNo='" + row4["EMPLOYEENO"].ToString() + "'");
num3 = 0;
}
if (array3.Length > num3)
{
dataRow = array3[num3];
if (Convert.ToInt32(row4["ITEMGROUP"]) == 5 && Convert.ToInt32(row4["ItemCode"]) == -129)
{
dataRow["IncomTaxAmount"] = row4["CHANGEDAMOUNT"];
}
num3++;
text6 = row4["EMPLOYEENO"].ToString();
}
}
num3 = 0;
DataSet empPaySlipDeductForLR = SalaryMonthly.GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(dateTime), sEmpID2);
string text7 = "";
DataRow[] array4 = null;
if (empPaySlipDeductForLR.Tables[0].Rows.Count > 0)
{
text7 = empPaySlipDeductForLR.Tables[0].Rows[0]["EMPLOYEENO"].ToString();
array4 = payslipDataTable.Select(" EmployeeNo='" + empPaySlipDeductForLR.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'");
}
foreach (DataRow row5 in empPaySlipDeductForLR.Tables[0].Rows)
{
dataRow = null;
if (text7 != row5["EMPLOYEENO"].ToString())
{
array4 = payslipDataTable.Select(" EmployeeNo='" + row5["EMPLOYEENO"].ToString() + "'");
num3 = 0;
}
if (array4.Length > num3)
{
dataRow = array4[num3];
if (Convert.ToInt32(row5["ITEMGROUP"]) == 4 && Convert.ToInt32(row5["ItemCode"]) == -126)
{
dataRow["LoanDescription"] = row5["Description"];
dataRow["LoanAmount"] = row5["CHANGEDAMOUNT"];
}
num3++;
text7 = row5["EMPLOYEENO"].ToString();
}
}
bool boolValue = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic);
foreach (DataRow row in payslipDataTable.Rows)
{
Employee oEmp = ((IEnumerable<Employee>)val).Where((Employee o) => o.EmployeeNo.ToUpper().Trim() == row["EMPLOYEENO"].ToString().ToUpper().Trim()).SingleOrDefault();
if (!((ObjectTemplate)(object)oEmp != (ObjectTemplate)null))
{
continue;
}
if (boolValue)
{
row["Designation"] = oEmp.DescriptionText;
continue;
}
Designation designation = source.Where((Designation o) => ((ObjectTemplate)o).ID == oEmp.DesignationID).SingleOrDefault();
if ((ObjectTemplate)(object)designation != (ObjectTemplate)null)
{
row["Designation"] = designation.Name;
}
}
dataTable2 = dataSet.Tables[0];
dataTable2.TableName = "BasicInfo";
DataSet dataSet3 = new DataSet();
payslipDataTable.TableName = "SalaryMonthlysGross";
dataSet3.Tables.Add(payslipDataTable);
return fReportViewer2.MailNewPaySlip(null, dataTable2, dataSet3, dateTime.ToString("MMMM yyyy"));
}
} }
} }

View File

@ -666,7 +666,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value> BRAC BANK PLC</Value> <Value> IFIC</Value>
<Style> <Style>
<FontSize>11pt</FontSize> <FontSize>11pt</FontSize>
<FontWeight>Normal</FontWeight> <FontWeight>Normal</FontWeight>
@ -713,7 +713,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value> Satmasjid Road Branch</Value> <Value> Dhanmondi Branch</Value>
<Style> <Style>
<FontSize>11pt</FontSize> <FontSize>11pt</FontSize>
<FontWeight>Normal</FontWeight> <FontWeight>Normal</FontWeight>
@ -767,7 +767,7 @@
</Style> </Style>
</TextRun> </TextRun>
<TextRun> <TextRun>
<Value> Gawsia Twin Peak, Holding # 42 &amp; 43,</Value> <Value> Royal Plaza (1st &amp; 2nd Floor) House # 8/A,</Value>
<Style> <Style>
<FontSize>11pt</FontSize> <FontSize>11pt</FontSize>
<FontWeight>Normal</FontWeight> <FontWeight>Normal</FontWeight>
@ -821,7 +821,7 @@
</Style> </Style>
</TextRun> </TextRun>
<TextRun> <TextRun>
<Value>743 Satmasjid Road, Dhaka-1205</Value> <Value>Road # 4, Dhanmondi R/A, Dhaka-1212</Value>
<Style> <Style>
<FontSize>11pt</FontSize> <FontSize>11pt</FontSize>
<FontWeight>Normal</FontWeight> <FontWeight>Normal</FontWeight>
@ -1307,7 +1307,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>="Please arrange to transfer the salary, total amount of " &amp; Format(Sum(Fields!Amount.Value),"###,##") &amp; " (" &amp; Parameters!TakaInWord.Value &amp;") " &amp;"from our SND A/C No: 2076586830001 titled Computer Ease Limited to the credit of Bank Accounts of our Managers as per attached list for the amount shown against each name under advice to each Manager in a closed cover."</Value> <Value>="Please arrange to transfer the salary, total amount of " &amp; Format(Sum(Fields!Amount.Value),"###,##") &amp; " (" &amp; Parameters!TakaInWord.Value &amp;") " &amp;"from our SND A/C No: 1006134523041 titled Computer Ease Limited to the credit of Bank Accounts of our Managers as per attached list for the amount shown against each name under advice to each Manager in a closed cover."</Value>
<Style> <Style>
<FontSize>11pt</FontSize> <FontSize>11pt</FontSize>
<FontWeight>Normal</FontWeight> <FontWeight>Normal</FontWeight>
@ -1332,7 +1332,6 @@
</Style> </Style>
</Textbox> </Textbox>
<ColSpan>7</ColSpan> <ColSpan>7</ColSpan>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell /> <TablixCell />

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,7 @@
<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=;Database=;User ID=;Password=" sqlSyntax="SQL"/>
<!--<connection name="conn" provider="sql" connectionString="server=103.197.204.164,1718;Database=CELPayrol;User ID=Easeuser;Password=EaSeuSeR2025" sqlSyntax="SQL"/>-->
<!--<connection name="conn" provider="sql" connectionString="server=WIN-D48IJC70V70;Database=GPPayroll;integrated security=yes;" sqlSyntax="SQL"/>--> <!--<connection name="conn" provider="sql" connectionString="server=WIN-D48IJC70V70;Database=GPPayroll;integrated security=yes;" sqlSyntax="SQL"/>-->
</dbSettings> </dbSettings>
@ -20,20 +19,7 @@
<add key="GratuityParam" value="Grade"/> <add key="GratuityParam" value="Grade"/>
<add key="GratuityParam" value="Grade"/> <add key="GratuityParam" value="Grade"/>
<!--<add key="FSSLeaveOnlyBasic" value="no"/>--> <!--<add key="FSSLeaveOnlyBasic" value="no"/>-->
<add key="EERS" value="123456"/> <add key="EERS" value="123456"/>
<add key="WebAddress" value="http://www.celimited.com"/>
<add key="EmailServer" value="celimited.com"/>
<add key="FromAddress" value="fkanak@celimited.com"/>
<add key="UserID" value="fkanak@celimited.com"/>
<add key="Password" value="492E2C40010F5C295D6750"/>
<add key="mailGateway" value="SMTP"/>
<add key="SendMethod" value="SMTP"/>
<add key="EnableSSL" value="No"/>
<add key="PortNumber" value="587"/>
<add key="handleAuditTrail" value="No"/>
<!--<add key="EERS" value="123456"/>
<add key="WebAddress" value="http://www.celimited.com"/> <add key="WebAddress" value="http://www.celimited.com"/>
<add key="mailGateway" value="SMTP" /> <add key="mailGateway" value="SMTP" />
<add key="SendMethod" value="SMTP" /> <add key="SendMethod" value="SMTP" />
@ -43,7 +29,7 @@
<add key="Password" value="4823074F2F0506582E704159" /> <add key="Password" value="4823074F2F0506582E704159" />
<add key="EnableSSL" value="No" /> <add key="EnableSSL" value="No" />
<add key="PortNumber" value="25" /> <add key="PortNumber" value="25" />
<add key="handleAuditTrail" value="No"/>--> <add key="handleAuditTrail" value="No"/>
<add key="reportServiceHandler" value="mode=Local;assembly=Ease.SearchTools.Services"/> <add key="reportServiceHandler" value="mode=Local;assembly=Ease.SearchTools.Services"/>
<add key="connectionHandler" value="Data Source=CEL60;database=CEL_Huge;integrated security=yes~Ease.Core.DataAccess.SQL.SqlFactory, Ease.Core, Version=1.0.0, Culture=neutral, PublicKeyToken=null~Ease.Core.DataAccess.SQL.SqlHelper, Ease.Core, Version=1.0.0, Culture=neutral, PublicKeyToken=null"/> <add key="connectionHandler" value="Data Source=CEL60;database=CEL_Huge;integrated security=yes~Ease.Core.DataAccess.SQL.SqlFactory, Ease.Core, Version=1.0.0, Culture=neutral, PublicKeyToken=null~Ease.Core.DataAccess.SQL.SqlHelper, Ease.Core, Version=1.0.0, Culture=neutral, PublicKeyToken=null"/>
<add key="reportConnectionHandler" value="Data Source=CEL60;database=CEL_Huge;integrated security=yes~Ease.Core.DataAccess.SQL.SqlFactory, Ease.Core, Version=1.0.0, Culture=neutral, PublicKeyToken=null~Ease.Core.DataAccess.SQL.SqlHelper, Ease.Core, Version=1.0.0, Culture=neutral, PublicKeyToken=null"/> <add key="reportConnectionHandler" value="Data Source=CEL60;database=CEL_Huge;integrated security=yes~Ease.Core.DataAccess.SQL.SqlFactory, Ease.Core, Version=1.0.0, Culture=neutral, PublicKeyToken=null~Ease.Core.DataAccess.SQL.SqlHelper, Ease.Core, Version=1.0.0, Culture=neutral, PublicKeyToken=null"/>

View File

@ -64,10 +64,6 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.7.4114.6375, Culture=neutral, PublicKeyToken=0e99375e54769942">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Library\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="ClosedXML, Version=0.76.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b, processorArchitecture=MSIL"> <Reference Include="ClosedXML, Version=0.76.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Library\ClosedXML.dll</HintPath> <HintPath>..\..\Library\ClosedXML.dll</HintPath>
@ -117,9 +113,6 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Library\ExtendedRichTextBox.dll</HintPath> <HintPath>..\..\Library\ExtendedRichTextBox.dll</HintPath>
</Reference> </Reference>
<Reference Include="itextsharp">
<HintPath>..\..\Library\itextsharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Exchange.WebServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.Exchange.WebServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Exchange.WebServices.2.2\lib\40\Microsoft.Exchange.WebServices.dll</HintPath> <HintPath>..\..\packages\Microsoft.Exchange.WebServices.2.2\lib\40\Microsoft.Exchange.WebServices.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@ -160,8 +153,6 @@
</Reference> </Reference>
<Reference Include="System.Design" /> <Reference Include="System.Design" />
<Reference Include="System.DirectoryServices" /> <Reference Include="System.DirectoryServices" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Web.Extensions"> <Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
@ -3506,7 +3497,6 @@
<Content Include="Resource\GStat.png" /> <Content Include="Resource\GStat.png" />
<Content Include="Resource\HeadBack.jpg" /> <Content Include="Resource\HeadBack.jpg" />
<Content Include="Resource\Help_48x48.png" /> <Content Include="Resource\Help_48x48.png" />
<Content Include="Resource\home_pano.jpg" />
<Content Include="Resource\Huge.gif" /> <Content Include="Resource\Huge.gif" />
<Content Include="Resource\Huge.ico" /> <Content Include="Resource\Huge.ico" />
<Content Include="Resource\icon_people.jpg" /> <Content Include="Resource\icon_people.jpg" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -32,11 +32,14 @@ namespace Payroll.UI
this.btnSearch = new System.Windows.Forms.Button(); this.btnSearch = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.ctlDesignation = new Payroll.Controls.ctlCustomControl();
this.ctlCostCenter = new Payroll.Controls.ctlCustomControl();
this.lblCostCenters = new System.Windows.Forms.Label(); this.lblCostCenters = new System.Windows.Forms.Label();
this.lblDesignation = new System.Windows.Forms.Label(); this.lblDesignation = new System.Windows.Forms.Label();
this.cboBranch = new System.Windows.Forms.ComboBox(); this.cboBranch = new System.Windows.Forms.ComboBox();
this.cboBank = new System.Windows.Forms.ComboBox(); this.cboBank = new System.Windows.Forms.ComboBox();
this.label19 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label();
this.ctlEmployee = new Payroll.Controls.CustomControls.ctlEmployee();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.dtpfromDate = new System.Windows.Forms.DateTimePicker(); this.dtpfromDate = new System.Windows.Forms.DateTimePicker();
this.lblFromDate = new System.Windows.Forms.Label(); this.lblFromDate = new System.Windows.Forms.Label();
@ -44,36 +47,31 @@ namespace Payroll.UI
this.label22 = new System.Windows.Forms.Label(); this.label22 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label();
this.ctlGrade = new Payroll.Controls.ctlCustomControl();
this.cboGender = new System.Windows.Forms.ComboBox(); this.cboGender = new System.Windows.Forms.ComboBox();
this.ctlLocation = new Payroll.Controls.ctlCustomControl();
this.ctlReligion = new Payroll.Controls.ctlCustomControl();
this.ctlCategory = new Payroll.Controls.ctlCustomControl();
this.label9 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.ctlDepartment = new Payroll.Controls.ctlCustomControl();
this.lblSelected = new System.Windows.Forms.Label(); this.lblSelected = new System.Windows.Forms.Label();
this.lblTotal = new System.Windows.Forms.Label(); this.lblTotal = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label();
this.lsvEmployee = new System.Windows.Forms.ListView(); this.lsvEmployee = new System.Windows.Forms.ListView();
this.colName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.colName = new System.Windows.Forms.ColumnHeader();
this.colEmpNo = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.colEmpNo = new System.Windows.Forms.ColumnHeader();
this.colEmpEmail = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.colEmpEmail = new System.Windows.Forms.ColumnHeader();
this.btnSelectAll = new System.Windows.Forms.Button(); this.btnSelectAll = new System.Windows.Forms.Button();
this.btnCLose = new System.Windows.Forms.Button(); this.btnCLose = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.lblEmployee = new System.Windows.Forms.Label();
this.btnSendMail = new System.Windows.Forms.Button(); this.btnSendMail = new System.Windows.Forms.Button();
this.btnGenerate = new System.Windows.Forms.Button(); this.lblEmployee = new System.Windows.Forms.Label();
this.ctlDesignation = new Payroll.Controls.ctlCustomControl();
this.ctlCostCenter = new Payroll.Controls.ctlCustomControl();
this.ctlEmployee = new Payroll.Controls.CustomControls.ctlEmployee();
this.ctlGrade = new Payroll.Controls.ctlCustomControl();
this.ctlLocation = new Payroll.Controls.ctlCustomControl();
this.ctlReligion = new Payroll.Controls.ctlCustomControl();
this.ctlCategory = new Payroll.Controls.ctlCustomControl();
this.ctlDepartment = new Payroll.Controls.ctlCustomControl();
this.btnDownload = new System.Windows.Forms.Button();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@ -93,7 +91,6 @@ namespace Payroll.UI
// //
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.groupBox1); this.panel1.Controls.Add(this.groupBox1);
this.panel1.Controls.Add(this.lblEmployee);
this.panel1.Controls.Add(this.lblSelected); this.panel1.Controls.Add(this.lblSelected);
this.panel1.Controls.Add(this.lblTotal); this.panel1.Controls.Add(this.lblTotal);
this.panel1.Controls.Add(this.label14); this.panel1.Controls.Add(this.label14);
@ -142,6 +139,42 @@ namespace Payroll.UI
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Search Condition"; this.groupBox1.Text = "Search Condition";
// //
// ctlDesignation
//
this.ctlDesignation.BackColor = System.Drawing.Color.Transparent;
this.ctlDesignation.ChildPropertyName = null;
this.ctlDesignation.ControlType = Payroll.BO.EnumCustomBasicControlType.ListView;
this.ctlDesignation.CustomSearchString = null;
this.ctlDesignation.LastLevel = -1;
this.ctlDesignation.Location = new System.Drawing.Point(101, 221);
this.ctlDesignation.MHTire = 0;
this.ctlDesignation.MultipleSelection = true;
this.ctlDesignation.Name = "ctlDesignation";
this.ctlDesignation.OutputType = Payroll.BO.EnumCustomBasicControl.Designation;
this.ctlDesignation.PickerCaption = "Designation";
this.ctlDesignation.PickerHeadLine = "";
this.ctlDesignation.SelectedIDs = null;
this.ctlDesignation.Size = new System.Drawing.Size(229, 24);
this.ctlDesignation.TabIndex = 46;
//
// ctlCostCenter
//
this.ctlCostCenter.BackColor = System.Drawing.Color.Transparent;
this.ctlCostCenter.ChildPropertyName = "PickerChilds";
this.ctlCostCenter.ControlType = Payroll.BO.EnumCustomBasicControlType.TreeView;
this.ctlCostCenter.CustomSearchString = null;
this.ctlCostCenter.LastLevel = -1;
this.ctlCostCenter.Location = new System.Drawing.Point(402, 221);
this.ctlCostCenter.MHTire = 0;
this.ctlCostCenter.MultipleSelection = true;
this.ctlCostCenter.Name = "ctlCostCenter";
this.ctlCostCenter.OutputType = Payroll.BO.EnumCustomBasicControl.CostCenter;
this.ctlCostCenter.PickerCaption = "Cost-Center";
this.ctlCostCenter.PickerHeadLine = "";
this.ctlCostCenter.SelectedIDs = null;
this.ctlCostCenter.Size = new System.Drawing.Size(211, 24);
this.ctlCostCenter.TabIndex = 45;
//
// lblCostCenters // lblCostCenters
// //
this.lblCostCenters.AutoSize = true; this.lblCostCenters.AutoSize = true;
@ -196,6 +229,16 @@ namespace Payroll.UI
this.label19.TabIndex = 30; this.label19.TabIndex = 30;
this.label19.Text = "Employee"; this.label19.Text = "Employee";
// //
// ctlEmployee
//
this.ctlEmployee.EmployeeNo = "";
this.ctlEmployee.Grades = null;
this.ctlEmployee.Location = new System.Drawing.Point(101, 264);
this.ctlEmployee.Name = "ctlEmployee";
this.ctlEmployee.SelectedEmployee = null;
this.ctlEmployee.Size = new System.Drawing.Size(507, 27);
this.ctlEmployee.TabIndex = 28;
//
// label12 // label12
// //
this.label12.AutoSize = true; this.label12.AutoSize = true;
@ -260,250 +303,6 @@ namespace Payroll.UI
this.label11.TabIndex = 21; this.label11.TabIndex = 21;
this.label11.Text = "_________________________________________________________________________________" + this.label11.Text = "_________________________________________________________________________________" +
"_________________"; "_________________";
//
// cboGender
//
this.cboGender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboGender.FormattingEnabled = true;
this.cboGender.Items.AddRange(new object[] {
"Regardless",
"Male",
"Female"});
this.cboGender.Location = new System.Drawing.Point(101, 192);
this.cboGender.Name = "cboGender";
this.cboGender.Size = new System.Drawing.Size(229, 21);
this.cboGender.TabIndex = 18;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(12, 107);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(49, 13);
this.label9.TabIndex = 10;
this.label9.Text = "Category";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(339, 163);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(48, 13);
this.label8.TabIndex = 9;
this.label8.Text = "Location";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(339, 195);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(36, 13);
this.label6.TabIndex = 7;
this.label6.Text = "Grade";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 195);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(42, 13);
this.label5.TabIndex = 6;
this.label5.Text = "Gender";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 158);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(45, 13);
this.label4.TabIndex = 5;
this.label4.Text = "Religion";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 135);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Department";
//
// lblSelected
//
this.lblSelected.AutoSize = true;
this.lblSelected.Location = new System.Drawing.Point(886, 411);
this.lblSelected.Name = "lblSelected";
this.lblSelected.Size = new System.Drawing.Size(13, 13);
this.lblSelected.TabIndex = 8;
this.lblSelected.Text = "0";
this.lblSelected.Visible = false;
//
// lblTotal
//
this.lblTotal.AutoSize = true;
this.lblTotal.Location = new System.Drawing.Point(786, 411);
this.lblTotal.Name = "lblTotal";
this.lblTotal.Size = new System.Drawing.Size(13, 13);
this.lblTotal.TabIndex = 8;
this.lblTotal.Text = "0";
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(831, 411);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(49, 13);
this.label14.TabIndex = 7;
this.label14.Text = "Selected";
this.label14.Visible = false;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(749, 411);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(31, 13);
this.label13.TabIndex = 7;
this.label13.Text = "Total";
//
// lsvEmployee
//
this.lsvEmployee.CheckBoxes = true;
this.lsvEmployee.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colName,
this.colEmpNo,
this.colEmpEmail});
this.lsvEmployee.FullRowSelect = true;
this.lsvEmployee.GridLines = true;
this.lsvEmployee.HideSelection = false;
this.lsvEmployee.Location = new System.Drawing.Point(661, 3);
this.lsvEmployee.Name = "lsvEmployee";
this.lsvEmployee.Size = new System.Drawing.Size(245, 391);
this.lsvEmployee.TabIndex = 6;
this.lsvEmployee.UseCompatibleStateImageBehavior = false;
this.lsvEmployee.View = System.Windows.Forms.View.Details;
//
// colName
//
this.colName.Text = "Name";
this.colName.Width = 114;
//
// colEmpNo
//
this.colEmpNo.Text = "Emp No";
this.colEmpNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// colEmpEmail
//
this.colEmpEmail.Text = "Email";
this.colEmpEmail.Width = 100;
//
// btnSelectAll
//
this.btnSelectAll.Location = new System.Drawing.Point(664, 404);
this.btnSelectAll.Name = "btnSelectAll";
this.btnSelectAll.Size = new System.Drawing.Size(75, 27);
this.btnSelectAll.TabIndex = 3;
this.btnSelectAll.Text = "&Select All";
this.btnSelectAll.UseVisualStyleBackColor = true;
this.btnSelectAll.Click += new System.EventHandler(this.btnSelectAll_Click);
//
// btnCLose
//
this.btnCLose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCLose.Location = new System.Drawing.Point(815, 14);
this.btnCLose.Name = "btnCLose";
this.btnCLose.Size = new System.Drawing.Size(75, 27);
this.btnCLose.TabIndex = 9;
this.btnCLose.Text = "&Close";
this.btnCLose.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.btnDownload);
this.groupBox3.Controls.Add(this.btnGenerate);
this.groupBox3.Controls.Add(this.btnCLose);
this.groupBox3.Controls.Add(this.btnSendMail);
this.groupBox3.Location = new System.Drawing.Point(9, 457);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(910, 48);
this.groupBox3.TabIndex = 28;
this.groupBox3.TabStop = false;
//
// lblEmployee
//
this.lblEmployee.AutoSize = true;
this.lblEmployee.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblEmployee.Location = new System.Drawing.Point(18, 411);
this.lblEmployee.Name = "lblEmployee";
this.lblEmployee.Size = new System.Drawing.Size(0, 13);
this.lblEmployee.TabIndex = 11;
//
// btnSendMail
//
this.btnSendMail.Location = new System.Drawing.Point(15, 14);
this.btnSendMail.Name = "btnSendMail";
this.btnSendMail.Size = new System.Drawing.Size(75, 27);
this.btnSendMail.TabIndex = 10;
this.btnSendMail.Text = "Send Mail";
this.btnSendMail.UseVisualStyleBackColor = true;
this.btnSendMail.Click += new System.EventHandler(this.btnSendMail_Click);
//
// btnGenerate
//
this.btnGenerate.Location = new System.Drawing.Point(96, 14);
this.btnGenerate.Name = "btnGenerate";
this.btnGenerate.Size = new System.Drawing.Size(75, 27);
this.btnGenerate.TabIndex = 12;
this.btnGenerate.Text = "Generate";
this.btnGenerate.UseVisualStyleBackColor = true;
this.btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click);
//
// ctlDesignation
//
this.ctlDesignation.BackColor = System.Drawing.Color.Transparent;
this.ctlDesignation.ChildPropertyName = null;
this.ctlDesignation.ControlType = Payroll.BO.EnumCustomBasicControlType.ListView;
this.ctlDesignation.CustomSearchString = null;
this.ctlDesignation.LastLevel = -1;
this.ctlDesignation.Location = new System.Drawing.Point(101, 221);
this.ctlDesignation.MHTire = 0;
this.ctlDesignation.MultipleSelection = true;
this.ctlDesignation.Name = "ctlDesignation";
this.ctlDesignation.OutputType = Payroll.BO.EnumCustomBasicControl.Designation;
this.ctlDesignation.PickerCaption = "Designation";
this.ctlDesignation.PickerHeadLine = "";
this.ctlDesignation.SelectedIDs = null;
this.ctlDesignation.Size = new System.Drawing.Size(229, 24);
this.ctlDesignation.TabIndex = 46;
//
// ctlCostCenter
//
this.ctlCostCenter.BackColor = System.Drawing.Color.Transparent;
this.ctlCostCenter.ChildPropertyName = "PickerChilds";
this.ctlCostCenter.ControlType = Payroll.BO.EnumCustomBasicControlType.TreeView;
this.ctlCostCenter.CustomSearchString = null;
this.ctlCostCenter.LastLevel = -1;
this.ctlCostCenter.Location = new System.Drawing.Point(402, 221);
this.ctlCostCenter.MHTire = 0;
this.ctlCostCenter.MultipleSelection = true;
this.ctlCostCenter.Name = "ctlCostCenter";
this.ctlCostCenter.OutputType = Payroll.BO.EnumCustomBasicControl.CostCenter;
this.ctlCostCenter.PickerCaption = "Cost-Center";
this.ctlCostCenter.PickerHeadLine = "";
this.ctlCostCenter.SelectedIDs = null;
this.ctlCostCenter.Size = new System.Drawing.Size(211, 24);
this.ctlCostCenter.TabIndex = 45;
//
// ctlEmployee
//
this.ctlEmployee.EmployeeNo = "";
this.ctlEmployee.Grades = null;
this.ctlEmployee.Location = new System.Drawing.Point(101, 264);
this.ctlEmployee.Name = "ctlEmployee";
this.ctlEmployee.SelectedEmployee = null;
this.ctlEmployee.Size = new System.Drawing.Size(507, 27);
this.ctlEmployee.TabIndex = 28;
// //
// ctlGrade // ctlGrade
// //
@ -523,6 +322,19 @@ namespace Payroll.UI
this.ctlGrade.Size = new System.Drawing.Size(211, 24); this.ctlGrade.Size = new System.Drawing.Size(211, 24);
this.ctlGrade.TabIndex = 19; this.ctlGrade.TabIndex = 19;
// //
// cboGender
//
this.cboGender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboGender.FormattingEnabled = true;
this.cboGender.Items.AddRange(new object[] {
"Regardless",
"Male",
"Female"});
this.cboGender.Location = new System.Drawing.Point(101, 192);
this.cboGender.Name = "cboGender";
this.cboGender.Size = new System.Drawing.Size(229, 21);
this.cboGender.TabIndex = 18;
//
// ctlLocation // ctlLocation
// //
this.ctlLocation.BackColor = System.Drawing.Color.Transparent; this.ctlLocation.BackColor = System.Drawing.Color.Transparent;
@ -577,6 +389,60 @@ namespace Payroll.UI
this.ctlCategory.Size = new System.Drawing.Size(229, 22); this.ctlCategory.Size = new System.Drawing.Size(229, 22);
this.ctlCategory.TabIndex = 11; this.ctlCategory.TabIndex = 11;
// //
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(12, 107);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(49, 13);
this.label9.TabIndex = 10;
this.label9.Text = "Category";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(339, 163);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(48, 13);
this.label8.TabIndex = 9;
this.label8.Text = "Location";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(339, 195);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(36, 13);
this.label6.TabIndex = 7;
this.label6.Text = "Grade";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 195);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(42, 13);
this.label5.TabIndex = 6;
this.label5.Text = "Gender";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 158);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(45, 13);
this.label4.TabIndex = 5;
this.label4.Text = "Religion";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 135);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Department";
//
// ctlDepartment // ctlDepartment
// //
this.ctlDepartment.BackColor = System.Drawing.Color.Transparent; this.ctlDepartment.BackColor = System.Drawing.Color.Transparent;
@ -595,16 +461,124 @@ namespace Payroll.UI
this.ctlDepartment.Size = new System.Drawing.Size(229, 22); this.ctlDepartment.Size = new System.Drawing.Size(229, 22);
this.ctlDepartment.TabIndex = 0; this.ctlDepartment.TabIndex = 0;
// //
// btnDownload // lblSelected
// //
this.btnDownload.Location = new System.Drawing.Point(177, 14); this.lblSelected.AutoSize = true;
this.btnDownload.Name = "btnDownload"; this.lblSelected.Location = new System.Drawing.Point(886, 411);
this.btnDownload.Size = new System.Drawing.Size(75, 27); this.lblSelected.Name = "lblSelected";
this.btnDownload.TabIndex = 13; this.lblSelected.Size = new System.Drawing.Size(13, 13);
this.btnDownload.Text = "Download"; this.lblSelected.TabIndex = 8;
this.btnDownload.UseVisualStyleBackColor = true; this.lblSelected.Text = "0";
this.btnDownload.Visible = false; this.lblSelected.Visible = false;
this.btnDownload.Click += new System.EventHandler(this.btnDownload_Click); //
// lblTotal
//
this.lblTotal.AutoSize = true;
this.lblTotal.Location = new System.Drawing.Point(786, 411);
this.lblTotal.Name = "lblTotal";
this.lblTotal.Size = new System.Drawing.Size(13, 13);
this.lblTotal.TabIndex = 8;
this.lblTotal.Text = "0";
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(831, 411);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(49, 13);
this.label14.TabIndex = 7;
this.label14.Text = "Selected";
this.label14.Visible = false;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(749, 411);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(31, 13);
this.label13.TabIndex = 7;
this.label13.Text = "Total";
//
// lsvEmployee
//
this.lsvEmployee.CheckBoxes = true;
this.lsvEmployee.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colName,
this.colEmpNo,
this.colEmpEmail});
this.lsvEmployee.FullRowSelect = true;
this.lsvEmployee.GridLines = true;
this.lsvEmployee.Location = new System.Drawing.Point(661, 3);
this.lsvEmployee.Name = "lsvEmployee";
this.lsvEmployee.Size = new System.Drawing.Size(245, 391);
this.lsvEmployee.TabIndex = 6;
this.lsvEmployee.UseCompatibleStateImageBehavior = false;
this.lsvEmployee.View = System.Windows.Forms.View.Details;
//
// colName
//
this.colName.Text = "Name";
this.colName.Width = 114;
//
// colEmpNo
//
this.colEmpNo.Text = "Emp No";
this.colEmpNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// colEmpEmail
//
this.colEmpEmail.Text = "Email";
this.colEmpEmail.Width = 100;
//
// btnSelectAll
//
this.btnSelectAll.Location = new System.Drawing.Point(664, 404);
this.btnSelectAll.Name = "btnSelectAll";
this.btnSelectAll.Size = new System.Drawing.Size(75, 27);
this.btnSelectAll.TabIndex = 3;
this.btnSelectAll.Text = "&Select All";
this.btnSelectAll.UseVisualStyleBackColor = true;
this.btnSelectAll.Click += new System.EventHandler(this.btnSelectAll_Click);
//
// btnCLose
//
this.btnCLose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCLose.Location = new System.Drawing.Point(815, 14);
this.btnCLose.Name = "btnCLose";
this.btnCLose.Size = new System.Drawing.Size(75, 27);
this.btnCLose.TabIndex = 9;
this.btnCLose.Text = "&Close";
this.btnCLose.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.lblEmployee);
this.groupBox3.Controls.Add(this.btnCLose);
this.groupBox3.Controls.Add(this.btnSendMail);
this.groupBox3.Location = new System.Drawing.Point(9, 457);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(910, 48);
this.groupBox3.TabIndex = 28;
this.groupBox3.TabStop = false;
//
// btnSendMail
//
this.btnSendMail.Location = new System.Drawing.Point(15, 14);
this.btnSendMail.Name = "btnSendMail";
this.btnSendMail.Size = new System.Drawing.Size(75, 27);
this.btnSendMail.TabIndex = 10;
this.btnSendMail.Text = "Send Mail";
this.btnSendMail.UseVisualStyleBackColor = true;
this.btnSendMail.Click += new System.EventHandler(this.btnSendMail_Click);
//
// lblEmployee
//
this.lblEmployee.AutoSize = true;
this.lblEmployee.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblEmployee.Location = new System.Drawing.Point(125, 21);
this.lblEmployee.Name = "lblEmployee";
this.lblEmployee.Size = new System.Drawing.Size(0, 13);
this.lblEmployee.TabIndex = 11;
// //
// fPayslipSendMail // fPayslipSendMail
// //
@ -627,6 +601,7 @@ namespace Payroll.UI
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -676,7 +651,6 @@ namespace Payroll.UI
private System.Windows.Forms.Button btnSendMail; private System.Windows.Forms.Button btnSendMail;
private System.Windows.Forms.ColumnHeader colEmpEmail; private System.Windows.Forms.ColumnHeader colEmpEmail;
private System.Windows.Forms.Label lblEmployee; private System.Windows.Forms.Label lblEmployee;
private System.Windows.Forms.Button btnGenerate;
private System.Windows.Forms.Button btnDownload;
} }
} }

View File

@ -1,19 +1,19 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.IO; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using Ease.CoreV35.Model; //using Ease.CoreV35.Utility;
using iTextSharp.text.pdf;
using Payroll.BO; using Payroll.BO;
using Ease.CoreV35.Model;
using Payroll.Controls; using Payroll.Controls;
using Payroll.Controls.CustomControls;
using Payroll.Report; using Payroll.Report;
using System.Reflection;
using System.Net.Mail; using System.Net.Mail;
using System.IO.Compression; using System.IO;
namespace Payroll.UI namespace Payroll.UI
{ {
@ -95,241 +95,118 @@ namespace Payroll.UI
} }
return true; return true;
} }
private void PrepareReport() private void PrepareReport()
{ {
MailSender mailSender = new MailSender(); MailSender oMailSender = new MailSender();
_ToSendEmps = new ObjectsTemplate<SearchEmployee>(); _ToSendEmps = new ObjectsTemplate<SearchEmployee>();
lblEmployee.Text = ""; lblEmployee.Text = "";
lblEmployee.Refresh(); lblEmployee.Refresh();
PaySlip paySlip = new PaySlip(); PaySlip _payslip = new PaySlip();
if ((ObjectTemplate)(object)ctlEmployee.SelectedEmployee != (ObjectTemplate)null)
if (ctlEmployee.SelectedEmployee != null)
{ {
((List<SearchEmployee>)(object)_ToSendEmps).Add(ctlEmployee.SelectedEmployee); _ToSendEmps.Add((SearchEmployee)ctlEmployee.SelectedEmployee);
} }
else if (lsvEmployee.CheckedItems.Count > 0) else if (lsvEmployee.CheckedItems.Count > 0)
{ {
int num = 0; int index = 0;
foreach (ListViewItem checkedItem in lsvEmployee.CheckedItems) foreach (ListViewItem item in lsvEmployee.CheckedItems)
{ {
((List<SearchEmployee>)(object)_ToSendEmps).Add((SearchEmployee)lsvEmployee.CheckedItems[num++].Tag); _ToSendEmps.Add((SearchEmployee)lsvEmployee.CheckedItems[index++].Tag);
} }
} }
if (((List<SearchEmployee>)(object)_ToSendEmps).Count <= 0)
if (_ToSendEmps.Count > 0)
{ {
return; string path = string.Empty;
} string filename = string.Empty;
string empty = string.Empty; byte[] filetoSendBytes = null;
string empty2 = string.Empty; int count = 0;
byte[] array = null;
int num2 = 0;
try try
{ {
Cursor = Cursors.WaitCursor; this.Cursor = Cursors.WaitCursor;
EnumSendMail enumSendMail = EnumSendMail.None; EnumSendMail sendMail = EnumSendMail.None;
foreach (SearchEmployee item in (List<SearchEmployee>)(object)_ToSendEmps) foreach (SearchEmployee item in _ToSendEmps)
{ {
if (string.IsNullOrWhiteSpace(item.Employee.MobileNo)) lblEmployee.Text = "Sending Mail :" + (++count).ToString() + "/" + _ToSendEmps.Count;
{
MessageBox.Show($"{item.Employee.Name} ({item.Employee.EmployeeNo}) does not have a phone number. Email sending was skipped.");
continue;
}
Label label = lblEmployee;
int num3 = ++num2;
label.Text = "Sending Mail :" + num3 + "/" + ((List<SearchEmployee>)(object)_ToSendEmps).Count;
lblEmployee.Refresh(); lblEmployee.Refresh();
array = ((_Type != 1) ? paySlip.SKFExpencesPaySlip1(dtpfromDate.Value, item.EmployeeID.Integer.ToString()) : paySlip.MailReportWithAccountNoMask(dtpfromDate.Value, item.EmployeeID.Integer.ToString())); if(_Type==1)
if (array == null) filetoSendBytes = _payslip.MailReport(dtpfromDate.Value, item.EmployeeID.Integer.ToString());
{ else
continue; filetoSendBytes = _payslip.SKFExpencesPaySlip1(dtpfromDate.Value, item.EmployeeID.Integer.ToString());
}
if (!Directory.Exists(Application.StartupPath + "\\Report"))
{
DirectoryInfo directoryInfo = new DirectoryInfo(Application.StartupPath + "\\Report");
directoryInfo.Create();
}
empty = string.Concat(str2: (_Type != 1) ? ("Expense_" + item.EmployeeNo + "-" + dtpfromDate.Value.Month + "-" + dtpfromDate.Value.Year + "_" + DateTime.Now.ToString("hh_mm_ss") + ".pdf") : ("Payslip_" + item.EmployeeNo + "-" + dtpfromDate.Value.Month + "-" + dtpfromDate.Value.Year + "_" + DateTime.Now.ToString("hh_mm_ss") + ".pdf"), str0: Application.StartupPath, str1: "\\Report\\");
using (FileStream fileStream = new FileStream(empty, FileMode.Create))
{
fileStream.Write(array, 0, array.Length);
fileStream.Dispose();
}
//string employeeNo = item.Employee.EmployeeNo; if (filetoSendBytes != null)
//string text = ((employeeNo.Length >= 3) ? employeeNo.Substring(employeeNo.Length - 3) : employeeNo.PadLeft(3, '0')); {
if (!Directory.Exists(Application.StartupPath + @"\Report"))
{
DirectoryInfo dirInfo = new DirectoryInfo(Application.StartupPath + @"\Report");
dirInfo.Create();
}
if (_Type == 1)
filename = "Payslip_"+item.EmployeeNo + "-" + dtpfromDate.Value.Month + "-" + dtpfromDate.Value.Year+"_"+DateTime.Now.ToString("hh_mm_ss") + ".pdf";
else
filename = "Expense_" + item.EmployeeNo + "-" + dtpfromDate.Value.Month + "-" + dtpfromDate.Value.Year + "_" + DateTime.Now.ToString("hh_mm_ss") + ".pdf";
path = Application.StartupPath + @"\Report\" + filename;
//Encrypt PDF with last 4 digit of mobile no using (FileStream fs = new FileStream(path, FileMode.Create))
string phoneNo = item.Employee.MobileNo;
string text = ((phoneNo.Length >= 4) ? phoneNo.Substring(phoneNo.Length - 4) : phoneNo.PadLeft(4, '0'));
using (MemoryStream memoryStream = new MemoryStream(array))
{ {
PdfReader val = new PdfReader((Stream)memoryStream); fs.Write(filetoSendBytes, 0, filetoSendBytes.Length);
try fs.Dispose();
{
// Replace the following line:
//using FileStream fileStream2 = new FileStream(empty, FileMode.Create);
using (FileStream fileStream2 = new FileStream(empty, FileMode.Create))
{
PdfEncryptor.Encrypt(val, (Stream)fileStream2, 2, text, (string)null, 2052);
}
//PdfEncryptor.Encrypt(val, (Stream)fileStream2, 2, text, (string)null, 2052);
}
finally
{
((IDisposable)val)?.Dispose();
}
} }
item.Email = item.Employee.EmailAddress; item.Email = item.Employee.EmailAddress;
enumSendMail = SendMail(item, empty, _Type); sendMail = SendMail(item, path,_Type);
switch (enumSendMail)
switch (sendMail)
{ {
case EnumSendMail.ToMissing: case EnumSendMail.ToMissing:
MessageBox.Show("Employee mail address is missing", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Hand); MessageBox.Show("Employee mail address is missing", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
break; break;
case EnumSendMail.FromMissing: case EnumSendMail.FromMissing:
MessageBox.Show("Missing from address", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Hand); MessageBox.Show("Missing from address", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
break; break;
case EnumSendMail.BodyMissing: case EnumSendMail.BodyMissing:
MessageBox.Show("Missing mail body", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Hand); MessageBox.Show("Missing mail body", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
break; break;
case EnumSendMail.SubjectMissing: case EnumSendMail.SubjectMissing:
MessageBox.Show("Mail subject is missing", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Hand); MessageBox.Show("Mail subject is missing", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
break; break;
case EnumSendMail.ServerNotFound: case EnumSendMail.ServerNotFound:
MessageBox.Show("Server not found", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Hand); MessageBox.Show("Server not found", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
break; break;
case EnumSendMail.SendError: case EnumSendMail.SendError:
MessageBox.Show("Sending Mail Error", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Hand); MessageBox.Show("Sending Mail Error", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
default:
break; break;
} }
} }
if (enumSendMail == EnumSendMail.SuccessFullySend) }
if (sendMail == EnumSendMail.SuccessFullySend)
{ {
lblEmployee.Text = string.Empty; lblEmployee.Text = string.Empty;
lblEmployee.Refresh(); lblEmployee.Refresh();
MessageBox.Show("Mail Sent Successfully", "Payslip", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); MessageBox.Show("Mail Sent Successfully", "Payslip", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
Cursor = Cursors.Default; this.Cursor = Cursors.Default;
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(this, ex.Message, "Error Sending Mail", MessageBoxButtons.OK, MessageBoxIcon.Hand); MessageBox.Show(this, ex.Message, "Error Sending Mail", MessageBoxButtons.OK, MessageBoxIcon.Error);
lblEmployee.Text = string.Empty; lblEmployee.Text = string.Empty;
lblEmployee.Refresh(); lblEmployee.Refresh();
Cursor = Cursors.Default; this.Cursor = Cursors.Default;
}
} }
} }
//private void PrepareReport()
//{
// MailSender oMailSender = new MailSender();
// _ToSendEmps = new ObjectsTemplate<SearchEmployee>();
// lblEmployee.Text = "";
// lblEmployee.Refresh();
// PaySlip _payslip = new PaySlip();
// if (ctlEmployee.SelectedEmployee != null)
// {
// _ToSendEmps.Add((SearchEmployee)ctlEmployee.SelectedEmployee);
// }
// else if (lsvEmployee.CheckedItems.Count > 0)
// {
// int index = 0;
// foreach (ListViewItem item in lsvEmployee.CheckedItems)
// {
// _ToSendEmps.Add((SearchEmployee)lsvEmployee.CheckedItems[index++].Tag);
// }
// }
// if (_ToSendEmps.Count > 0)
// {
// string path = string.Empty;
// string filename = string.Empty;
// byte[] filetoSendBytes = null;
// int count = 0;
// try
// {
// this.Cursor = Cursors.WaitCursor;
// EnumSendMail sendMail = EnumSendMail.None;
// foreach (SearchEmployee item in _ToSendEmps)
// {
// lblEmployee.Text = "Sending Mail :" + (++count).ToString() + "/" + _ToSendEmps.Count;
// lblEmployee.Refresh();
// if(_Type==1)
// filetoSendBytes = _payslip.MailReport(dtpfromDate.Value, item.EmployeeID.Integer.ToString());
// else
// filetoSendBytes = _payslip.SKFExpencesPaySlip1(dtpfromDate.Value, item.EmployeeID.Integer.ToString());
// if (filetoSendBytes != null)
// {
// if (!Directory.Exists(Application.StartupPath + @"\Report"))
// {
// DirectoryInfo dirInfo = new DirectoryInfo(Application.StartupPath + @"\Report");
// dirInfo.Create();
// }
// if (_Type == 1)
// filename = "Payslip_"+item.EmployeeNo + "-" + dtpfromDate.Value.Month + "-" + dtpfromDate.Value.Year+"_"+DateTime.Now.ToString("hh_mm_ss") + ".pdf";
// else
// filename = "Expense_" + item.EmployeeNo + "-" + dtpfromDate.Value.Month + "-" + dtpfromDate.Value.Year + "_" + DateTime.Now.ToString("hh_mm_ss") + ".pdf";
// path = Application.StartupPath + @"\Report\" + filename;
// using (FileStream fs = new FileStream(path, FileMode.Create))
// {
// fs.Write(filetoSendBytes, 0, filetoSendBytes.Length);
// fs.Dispose();
// }
// item.Email = item.Employee.EmailAddress;
// sendMail = SendMail(item, path,_Type);
// switch (sendMail)
// {
// case EnumSendMail.ToMissing:
// MessageBox.Show("Employee mail address is missing", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
// break;
// case EnumSendMail.FromMissing:
// MessageBox.Show("Missing from address", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
// break;
// case EnumSendMail.BodyMissing:
// MessageBox.Show("Missing mail body", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
// break;
// case EnumSendMail.SubjectMissing:
// MessageBox.Show("Mail subject is missing", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
// break;
// case EnumSendMail.ServerNotFound:
// MessageBox.Show("Server not found", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
// break;
// case EnumSendMail.SendError:
// MessageBox.Show("Sending Mail Error", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error);
// break;
// default:
// break;
// }
// }
// }
// if (sendMail == EnumSendMail.SuccessFullySend)
// {
// lblEmployee.Text = string.Empty;
// lblEmployee.Refresh();
// MessageBox.Show("Mail Sent Successfully", "Payslip", MessageBoxButtons.OK, MessageBoxIcon.Information);
// }
// this.Cursor = Cursors.Default;
// }
// catch (Exception ex)
// {
// MessageBox.Show(this, ex.Message, "Error Sending Mail", MessageBoxButtons.OK, MessageBoxIcon.Error);
// lblEmployee.Text = string.Empty;
// lblEmployee.Refresh();
// this.Cursor = Cursors.Default;
// }
// }
//}
private EnumSendMail SendMail(SearchEmployee item, string sPath,int nType) private EnumSendMail SendMail(SearchEmployee item, string sPath,int nType)
{ {
@ -355,8 +232,7 @@ namespace Payroll.UI
sb.AppendLine("Dear " + item.Name + "<br/><br/>"); sb.AppendLine("Dear " + item.Name + "<br/><br/>");
sb.AppendLine("Attached your pay slip of " + dtpfromDate.Value.ToString("MMMM yyyy") + "." + "<br/><br/>"); sb.AppendLine("Attached your pay slip of " + dtpfromDate.Value.ToString("MMMM yyyy") + "." + "<br/><br/>");
sb.AppendLine("If you have any query, please contact :" + "<br/><br/>"); sb.AppendLine("If you have any query, please contact :" + "<br/><br/>");
sb.AppendLine("Md. Showkat Hossain, Mobile-01711679640, email: fkanak@celimited.com" + "<br/><br/>"); sb.AppendLine("Md. Showkat Hossain, Mobile-01711679640, email: fkanak@celimited.com" + "<br/>");
sb.AppendLine("<b>Note:</b><br/><b>***Please use the last four digits of your mobile number, that you have shared with us, as the password to open the pay-slip</b>" + "<br/>");
MS.Body = sb.ToString(); MS.Body = sb.ToString();
} }
//else if (nType == 2) //else if (nType == 2)
@ -486,407 +362,42 @@ namespace Payroll.UI
lblSelected.Text = "0"; lblSelected.Text = "0";
} }
//private void btnSendMail_Click(object sender, EventArgs e)
//{
// DirectoryInfo dirInfo = null;
// try
// {
// dirInfo = new DirectoryInfo(Application.StartupPath + @"\Report");
// if (!Directory.Exists(Application.StartupPath + @"\Report"))
// {
// dirInfo.Create();
// }
// else // For Fail Safe Check. Do not remove this 'else' block
// {
// dirInfo.Delete(true);
// dirInfo.Create();
// }
// if (Validation())
// {
// PrepareReport();
// }
// }
// catch (Exception exp)
// {
// throw new Exception(exp.Message);
// }
// finally
// {
// if (dirInfo != null)
// dirInfo.Delete(true);
// }
//}
private void btnSendMail_Click(object sender, EventArgs e) private void btnSendMail_Click(object sender, EventArgs e)
{ {
DirectoryInfo dirInfo = null; DirectoryInfo dirInfo = null;
string reportPath = Application.StartupPath + @"\Report";
try try
{ {
dirInfo = new DirectoryInfo(reportPath); dirInfo = new DirectoryInfo(Application.StartupPath + @"\Report");
if (!Directory.Exists(Application.StartupPath + @"\Report"))
if (!dirInfo.Exists)
{ {
dirInfo.Create(); dirInfo.Create();
} }
else else // For Fail Safe Check. Do not remove this 'else' block
{ {
// Clean contents, not directory
foreach (FileInfo file in dirInfo.GetFiles()) file.Delete(); dirInfo.Delete(true);
foreach (DirectoryInfo subDir in dirInfo.GetDirectories()) subDir.Delete(true); dirInfo.Create();
} }
if (Validation()) if (Validation())
{ {
PrepareReport(); // <-- Generate PDF and Send Mail PrepareReport();
} }
// IMPORTANT: Delete only after everything is closed
foreach (FileInfo file in dirInfo.GetFiles()) file.Delete();
} }
catch (Exception exp) catch (Exception exp)
{ {
MessageBox.Show(exp.Message); throw new Exception(exp.Message);
}
}
#endregion
private void btnGenerate_Click(object sender, EventArgs e)
{
try
{
using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())
{
folderDialog.Description = "Select folder to generate payslips";
folderDialog.ShowNewFolderButton = true;
if (folderDialog.ShowDialog() != DialogResult.OK)
return;
Cursor = Cursors.WaitCursor;
string basePath = folderDialog.SelectedPath;
int year = dtpfromDate.Value.Year;
int month = dtpfromDate.Value.Month;
PaySlip paySlip = new PaySlip();
List<SearchEmployee> employees = new List<SearchEmployee>();
if ((ObjectTemplate)(object)ctlEmployee.SelectedEmployee != null)
{
employees.Add(ctlEmployee.SelectedEmployee);
}
else if (lsvEmployee.CheckedItems.Count > 0)
{
foreach (ListViewItem item in lsvEmployee.CheckedItems)
{
employees.Add((SearchEmployee)item.Tag);
}
}
if (employees.Count == 0)
{
MessageBox.Show("No employee selected.", "Generate Payslip",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int count = 0;
foreach (SearchEmployee emp in employees)
{
lblEmployee.Text = $"Generating Payslip : {++count}/{employees.Count}";
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 password = phoneNo.Length >= 4
? phoneNo.Substring(phoneNo.Length - 4)
: phoneNo.PadLeft(4, '0');
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
);
}
}
lblEmployee.Text = string.Empty;
MessageBox.Show("Payslips generated successfully.", "Payslip",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error Generating Payslip",
MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
finally finally
{ {
Cursor = Cursors.Default; if (dirInfo != null)
dirInfo.Delete(true);
} }
//try
//{
// Cursor = Cursors.WaitCursor;
// // Salary month/year from date picker
// int year = dtpfromDate.Value.Year;
// int month = dtpfromDate.Value.Month;
// // Base report path
// string basePath = Path.Combine(Application.StartupPath, "PaySlipReport");
// string yearPath = Path.Combine(basePath, year.ToString());
// string monthPath = Path.Combine(yearPath, month.ToString("00"));
// // Create directories if not exists
// Directory.CreateDirectory(monthPath);
// PaySlip paySlip = new PaySlip();
// List<SearchEmployee> employees = new List<SearchEmployee>();
// // Selected employee
// if ((ObjectTemplate)(object)ctlEmployee.SelectedEmployee != null)
// {
// employees.Add(ctlEmployee.SelectedEmployee);
// }
// // Checked employees
// else if (lsvEmployee.CheckedItems.Count > 0)
// {
// foreach (ListViewItem item in lsvEmployee.CheckedItems)
// {
// employees.Add((SearchEmployee)item.Tag);
// }
// }
// if (employees.Count == 0)
// {
// MessageBox.Show("No employee selected.", "Generate Payslip",
// MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
// }
// int count = 0;
// foreach (SearchEmployee emp in employees)
// {
// lblEmployee.Text = $"Generating Payslip : {++count}/{employees.Count}";
// 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;
// string filePath = Path.Combine(
// monthPath,
// emp.Employee.EmployeeNo + ".pdf"
// );
// // Encrypt PDF using last 4 digits of mobile
// string phoneNo = emp.Employee.MobileNo ?? "";
// string password = phoneNo.Length >= 4
// ? phoneNo.Substring(phoneNo.Length - 4)
// : phoneNo.PadLeft(4, '0');
// 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
// );
// }
// }
// lblEmployee.Text = string.Empty;
// MessageBox.Show("Payslips generated successfully.", "Payslip",
// MessageBoxButtons.OK, MessageBoxIcon.Information);
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.Message, "Error Generating Payslip",
// MessageBoxButtons.OK, MessageBoxIcon.Error);
//}
//finally
//{
// Cursor = Cursors.Default;
//}
} }
//private void btnDownload_Click(object sender, EventArgs e) #endregion
//{
// try
// {
// // 1⃣ Select source folder
// using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())
// {
// folderDialog.Description = "Select folder where payslips are stored";
// folderDialog.ShowNewFolderButton = false;
// if (folderDialog.ShowDialog() != DialogResult.OK)
// return;
// string sourceFolder = folderDialog.SelectedPath;
// // 2⃣ Select files from source folder
// using (OpenFileDialog fileDialog = new OpenFileDialog())
// {
// fileDialog.InitialDirectory = sourceFolder;
// fileDialog.Filter = "PDF files (*.pdf)|*.pdf";
// fileDialog.Multiselect = true;
// fileDialog.Title = "Select payslip(s) to download";
// if (fileDialog.ShowDialog() != DialogResult.OK)
// return;
// string[] selectedFiles = fileDialog.FileNames;
// // 3⃣ Select destination folder
// using (FolderBrowserDialog destDialog = new FolderBrowserDialog())
// {
// destDialog.Description = "Select destination folder to download files";
// destDialog.ShowNewFolderButton = true;
// if (destDialog.ShowDialog() != DialogResult.OK)
// return;
// string destFolder = destDialog.SelectedPath;
// // 4⃣ Copy selected files to destination
// foreach (string file in selectedFiles)
// {
// string fileName = Path.GetFileName(file);
// string destPath = Path.Combine(destFolder, fileName);
// // Overwrite if exists
// File.Copy(file, destPath, true);
// }
// MessageBox.Show("Selected files downloaded successfully!",
// "Download Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
// }
// }
// }
// }
// catch (Exception ex)
// {
// MessageBox.Show(ex.Message, "Error Downloading Files",
// MessageBoxButtons.OK, MessageBoxIcon.Error);
// }
//}
private void btnDownload_Click(object sender, EventArgs e)
{
try
{
// 1⃣ Select source folder
using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())
{
folderDialog.Description = "Select folder where payslips are stored";
folderDialog.ShowNewFolderButton = false;
if (folderDialog.ShowDialog() != DialogResult.OK)
return;
string sourceFolder = folderDialog.SelectedPath;
// 2⃣ Select files from source folder
using (OpenFileDialog fileDialog = new OpenFileDialog())
{
fileDialog.InitialDirectory = sourceFolder;
fileDialog.Filter = "PDF files (*.pdf)|*.pdf";
fileDialog.Multiselect = true;
fileDialog.Title = "Select payslip(s) to download";
if (fileDialog.ShowDialog() != DialogResult.OK)
return;
string[] selectedFiles = fileDialog.FileNames;
if (selectedFiles.Length == 0)
{
MessageBox.Show("No files selected.", "Download", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
} }
// 3⃣ Select destination folder for ZIP
using (FolderBrowserDialog destDialog = new FolderBrowserDialog())
{
destDialog.Description = "Select destination folder to save ZIP";
destDialog.ShowNewFolderButton = true;
if (destDialog.ShowDialog() != DialogResult.OK)
return;
string destFolder = destDialog.SelectedPath;
// 4⃣ Create ZIP file
string zipFileName = "SelectedPayslips_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".zip";
string zipFilePath = Path.Combine(destFolder, zipFileName);
if (File.Exists(zipFilePath))
File.Delete(zipFilePath); // overwrite if exists
// 5⃣ Add selected files to ZIP
using (ZipArchive zip = ZipFile.Open(zipFilePath, ZipArchiveMode.Create))
{
foreach (string filePath in selectedFiles)
{
string fileName = Path.GetFileName(filePath);
zip.CreateEntryFromFile(filePath, fileName, CompressionLevel.Optimal);
}
}
MessageBox.Show($"Selected files have been zipped successfully!\n\nSaved as:\n{zipFilePath}",
"Download Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error Downloading Files", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
#endregion #endregion
} }

View File

@ -112,9 +112,9 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
</root> </root>