private void btnReport_Click(object sender, EventArgs e) { if (chkAllDiv.Checked) { DataSet dsEmpGangsReport = new DataSet(); dsEmpGangsReport = objempCurrentStatus.ListEmployeeStatusChangeLog("%", Convert.ToDateTime(DateTime.Now.Date.ToShortDateString())); dsEmpGangsReport.WriteXml("EmployeeStatusChangeLog.xml"); EmployeeStatusChangeLogRPT objReport = new EmployeeStatusChangeLogRPT(); objReport.SetDataSource(dsEmpGangsReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Company", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { DataSet dsEmpGangsReport = new DataSet(); dsEmpGangsReport = objempCurrentStatus.ListEmployeeStatusChangeLog(cmbDivision.SelectedValue.ToString()); dsEmpGangsReport.WriteXml("EmployeeStatusChangeLog.xml"); EmployeeStatusChangeLogRPT objReport = new EmployeeStatusChangeLogRPT(); objReport.SetDataSource(dsEmpGangsReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Company", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } }
private void btnPRIErrors_Click(object sender, EventArgs e) { DataTable dsDivisionReport = new DataTable(); //dsDivisionReport = myEmployeeDeduction.GetMonthPRINorms(cmbDivision.SelectedValue.ToString(), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).AddMonths(1).AddDays(-1)).Tables[0]; dsDivisionReport = ProMWages.GetOkgPRI1(new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).AddMonths(1).AddDays(-1), cmbDivision.SelectedValue.ToString(), cmbCropType.Text).Tables[0]; if (dsDivisionReport.Rows.Count > 0) { dsDivisionReport.WriteXml("MonthPRIOkgErrors.xml"); PRIOkgErrorsRPT objReport = new PRIOkgErrorsRPT(); objReport.SetDataSource(dsDivisionReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", EstDiv.ListEstates().Rows[0][0].ToString()); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Division", cmbDivision.SelectedValue.ToString()); objReport.SetParameterValue("Period", new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).ToShortDateString() + " To " + new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).AddMonths(1).AddDays(-1).ToShortDateString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No Data To Preview."); } }
private void btnPrint_Click(object sender, EventArgs e) { String strDivision = "%"; DataTable dsDivisionReport = new DataTable(); //dsDivisionReport = myEmployeeDeduction.GetMonthPRINorms(cmbDivision.SelectedValue.ToString(), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).AddMonths(1).AddDays(-1)).Tables[0]; dsDivisionReport = DHarvest.GetSundryAreaCovered(dateTimePicker1.Value.Date, cmbDivision.SelectedValue.ToString()).Tables[0]; if (dsDivisionReport.Rows.Count > 0) { dsDivisionReport.WriteXml("SundryAreaCovered.xml"); SundryAreaCoveredRPT objReport = new SundryAreaCoveredRPT(); objReport.SetDataSource(dsDivisionReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", myDivi.ListEstates().Rows[0][0].ToString()); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Division", cmbDivision.SelectedValue.ToString()); objReport.SetParameterValue("Period", dateTimePicker1.Value.Date.ToShortDateString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No Data To Preview."); } }
private void btnCheckErrors_Click(object sender, EventArgs e) { DataTable dtEmpDetails = new DataTable("EmployeeTable"); DataTable dtErrorsRpt = new DataTable("ErrorTable"); DataSet dsErrorRpt = new DataSet("ErrorTable"); //dsDuplicateEPFNo = myReport2.GetDuplicateEPFNos(); Boolean boolSuccess = true; //strPayrollDuplicates = myReport2.GetDuplicateEPFNosPayroll(); //Error Report DataSet dsDivisionReport = new DataSet(); //dtEmpDetails = empMaster.ListEmployeesDetails("%"); dtEmpDetails = empMaster.ListEmployeesDetails("%"); dsErrorRpt.Tables.Add(ValidateEmpMasterDetails(dtEmpDetails, true)); //Report if (dsErrorRpt.Tables[0].Rows.Count > 0) { dsErrorRpt.WriteXml("EformErrors.xml"); EformErrorsReportRPT objReport = new EformErrorsReportRPT(); objReport.SetDataSource(dsErrorRpt); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString()); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("EFROM Employee Master Data Errors Not Found...!"); } }
private void btnAboveToChange_Click(object sender, EventArgs e) { if (chkAllDiv.Checked) { DataSet dsEmpGangsReport = new DataSet(); dsEmpGangsReport.Tables.Add(objempCurrentStatus.getListOfEmployeesAboveToChangeStatus(EstDivBlock.getEstateId(), "%", "Active", Convert.ToInt32(dtInactiveDuration.Rows[0][0].ToString()), true)); //dsEmpGangsReport = objempCurrentStatus.ListEmployeeStatusChangeLog("%", Convert.ToDateTime(DateTime.Now.Date.ToShortDateString())); if (dsEmpGangsReport.Tables[0].Rows.Count > 0) { dsEmpGangsReport.WriteXml("EmployeesAboveToChange.xml"); EmployeesAboveToInactiveRPT objReport = new EmployeesAboveToInactiveRPT(); objReport.SetDataSource(dsEmpGangsReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Company", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No Data To Preview"); } } else { DataSet dsEmpGangsReport = new DataSet(); dsEmpGangsReport.Tables.Add(objempCurrentStatus.getListOfEmployeesAboveToChangeStatus(EstDivBlock.getEstateId(), cmbDivision.SelectedValue.ToString(), "Active", Convert.ToInt32(dtInactiveDuration.Rows[0][0].ToString()), true)); //dsEmpGangsReport = objempCurrentStatus.ListEmployeeStatusChangeLog("%", Convert.ToDateTime(DateTime.Now.Date.ToShortDateString())); if (dsEmpGangsReport.Tables[0].Rows.Count > 0) { dsEmpGangsReport.WriteXml("EmployeesAboveToChange.xml"); EmployeesAboveToInactiveRPT objReport = new EmployeesAboveToInactiveRPT(); objReport.SetDataSource(dsEmpGangsReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Company", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No Data To Preview"); } } }
private void btnEVEMC_Click(object sender, EventArgs e) { DataSet dsReport = new DataSet(); dsReport = myReport2.GetEVEMC(cmbYear.Text.PadLeft(4, '0') + cmbMonth.SelectedValue.ToString().PadLeft(2, '0')); dsReport.WriteXml("EVEMC.xml"); EPF_EVEMC_RPT objReport = new EPF_EVEMC_RPT(); objReport.SetDataSource(dsReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); }
private void btnFieldSettings_Click(object sender, EventArgs e) { DataSet dsFixedParameterReport = new DataSet(); dsFixedParameterReport = objListing.getFieldSettings(); dsFixedParameterReport.WriteXml("FieldSettingsListing.xml"); FieldSettingsListingRPT objReport = new FieldSettingsListingRPT(); objReport.SetDataSource(dsFixedParameterReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", myDiv.ListEstates().Rows[0][0].ToString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); }
private void btnMasterAudit_Click(object sender, EventArgs e) { DataSet dsDivisionReport = new DataSet(); dsDivisionReport = myReports.getMasterFileAudit(dtpFromDate.Value.Date, dtpToDate.Value.Date); dsDivisionReport.WriteXml("MasterFileAudit.xml"); MasterFileAuditRPT objReport = new MasterFileAuditRPT(); objReport.SetDataSource(dsDivisionReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", myEstate.ListEstates().Rows[0][0].ToString()); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); }
private void button1_Click(object sender, EventArgs e) { DataSet dsConfirmations = new DataSet(); dsConfirmations = myEntries.GetConfirmationDetails(dtDate.Value.Date); dsConfirmations.WriteXml("EntryConfirmations.xml"); EntryConfirmationRpt objReport = new EntryConfirmationRpt(); objReport.SetDataSource(dsConfirmations); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Date", dtDate.Value.Date.Month); objReport.SetParameterValue("Division", "Division : " + cmbDivision.Text); objReport.SetParameterValue("Year", dtDate.Value.Date.Year); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); }
private void btnDisplay_Click(object sender, EventArgs e) { String strDivisionID = cmbDivision.SelectedValue.ToString(); String strStatus = cmbStatus.SelectedValue.ToString(); DataSet dsEmployeeReport = new DataSet(); if (chkAll.Checked) { dsEmployeeReport = objListing.getEmployeeDetails(strStatus.ToString()); dsEmployeeReport.WriteXml("EmployeeDetails.xml"); } else { dsEmployeeReport = objListing.getEmployeeDetails(strDivisionID.ToString(), strStatus.ToString()); dsEmployeeReport.WriteXml("EmployeeDetails.xml"); } if (dsEmployeeReport.Tables[0].Rows.Count > 0) { EmployeeReport objReport = new EmployeeReport(); objReport.SetDataSource(dsEmployeeReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", FTSPayRollBL.User.StrEstate); if (chkAll.Checked) { objReport.SetParameterValue("Division", ""); } else { objReport.SetParameterValue("Division", "DivisionID : " + strDivisionID.ToString()); } objReport.SetParameterValue("Status", "Employee Status : " + strStatus.ToString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No Data to Preview..!"); } }
private void button1_Click(object sender, EventArgs e) { DataTable dsDivisionReport = new DataTable(); dsDivisionReport = ClsFieldSettings.GetFieldSettings().Tables[0]; if (dsDivisionReport.Rows.Count > 0) { dsDivisionReport.WriteXml("FiledSettings.xml"); FieldSettingsRPT objReport = new FieldSettingsRPT(); objReport.SetDataSource(dsDivisionReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString()); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No Data To Preview."); } }
private void btnNormUpdateLog_Click(object sender, EventArgs e) { String strTextToSearch = ""; if (String.IsNullOrEmpty(txtFieldIDToSearch.Text)) { strTextToSearch = ""; } else { strTextToSearch = txtFieldIDToSearch.Text; } DataTable dsDivisionReport = new DataTable(); //dsDivisionReport = myEmployeeDeduction.GetMonthPRINorms(cmbDivision.SelectedValue.ToString(), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).AddMonths(1).AddDays(-1)).Tables[0]; dsDivisionReport = DivNorm.GetFieldNormUpdateLog(Convert.ToDateTime(dateTimePicker1.Value.Date.ToShortDateString()), cmbDivision.SelectedValue.ToString(), cmbCropType.Text, strTextToSearch).Tables[0]; if (dsDivisionReport.Rows.Count > 0) { dsDivisionReport.WriteXml("MonthPRINormUpdateLog.xml"); FieldWiseNormUpdateLogRPT objReport = new FieldWiseNormUpdateLogRPT(); objReport.SetDataSource(dsDivisionReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", EstDiv.ListEstates().Rows[0][0].ToString()); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Division", cmbDivision.SelectedValue.ToString()); objReport.SetParameterValue("Period", dateTimePicker1.Value.Date.ToShortDateString()); objReport.SetParameterValue("UserId", FTSPayRollBL.User.StrUserName); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No Data To Preview."); } }
private void btnDisplay_Click(object sender, EventArgs e) { String StrAllDiv = ""; String StrAllUnion = ""; if (chkAllDiv.Checked) { StrAllDiv = "%"; } else { StrAllDiv = cmbDivision.SelectedValue.ToString(); } if (chkAllUnion.Checked) { StrAllUnion = "%"; } else { StrAllUnion = cmbNewUnion.SelectedValue.ToString(); } DataSet dsEmpUnionReport = new DataSet(); dsEmpUnionReport = objListing.getEmployeeUnions(StrAllDiv, StrAllUnion); dsEmpUnionReport.WriteXml("EmployeeUnionList.xml"); EmpUnionReport objReport = new EmpUnionReport(); objReport.SetDataSource(dsEmpUnionReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Estate", myDiv.ListEstates().Rows[0][0].ToString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); }
private void btnAutoProcess_Click(object sender, EventArgs e) { String strMessageText = ""; String strStatus = ""; Boolean boolOk = true; DataTable dtDivisions = EstDivBlock.ListEstateDivisions(); DataTable dtEmployees; foreach (DataRow drow in dtDivisions.Rows) { //Active to Inactive dtEmployees = objempCurrentStatus.getListOfEmployeesAboveToChangeStatus(EstDivBlock.getEstateId(), drow[0].ToString(), "Active", Convert.ToInt32(dtInactiveDuration.Rows[0][0].ToString()), true); if (dtEmployees.Rows.Count > 0) { foreach (DataRow drowEmp in dtEmployees.Rows) { try { objempCurrentStatus.DtTxDate = DateTime.Now.Date; objempCurrentStatus.StrEmpEstate = EstDivBlock.getEstateId(); objempCurrentStatus.StrEmpDivision = drow[0].ToString(); objempCurrentStatus.StrEmpNo = drowEmp[2].ToString(); objempCurrentStatus.StrCurrentStatus = "Active"; objempCurrentStatus.StrNewStatus = "Inactive"; objempCurrentStatus.StrReason = "AbsentToWork"; objempCurrentStatus.StrChangedMethod = "ByAutoProcess"; objempCurrentStatus.StrUserID = User.StrUserName; objempCurrentStatus.DtLastWorkedDate = Convert.ToDateTime(drowEmp[7].ToString()); objempCurrentStatus.DecLastWorkRate = Convert.ToDecimal(drowEmp[9].ToString()); strStatus = objempCurrentStatus.EmployeeStatusChange(); } catch (Exception ex) { MessageBox.Show("Error On Status Change, " + ex.Message); boolOk = false; } } if (boolOk) { strMessageText += drow[1].ToString() + " Employees Status Changed From Active To Inactive Successfully.\r\n"; } else { strMessageText += drow[1].ToString() + " Employees Status Changed From Active To Inactive Complted With Errors.\r\n"; } } } if (strMessageText.Length > 0) { MessageBox.Show(strMessageText); } //Terminate employees foreach (DataRow drow in dtDivisions.Rows) { //Inactive to Terminate dtEmployees = objempCurrentStatus.getListOfEmployeesAboveToChangeStatus(EstDivBlock.getEstateId(), drow[0].ToString(), "Terminate", Convert.ToInt32(dtInactiveDuration.Rows[0][0].ToString()), false); if (dtEmployees.Rows.Count > 0) { foreach (DataRow drowEmp in dtEmployees.Rows) { try { objempCurrentStatus.DtTxDate = DateTime.Now.Date; objempCurrentStatus.StrEmpEstate = EstDivBlock.getEstateId(); objempCurrentStatus.StrEmpDivision = drow[0].ToString(); objempCurrentStatus.StrEmpNo = drowEmp[2].ToString(); objempCurrentStatus.StrCurrentStatus = "Inactive"; objempCurrentStatus.StrNewStatus = "Terminated"; objempCurrentStatus.StrReason = "AbsentToWork"; objempCurrentStatus.StrChangedMethod = "ByAutoProcess"; objempCurrentStatus.StrUserID = User.StrUserName; objempCurrentStatus.DtLastWorkedDate = Convert.ToDateTime(drowEmp[7].ToString()); objempCurrentStatus.DecLastWorkRate = Convert.ToDecimal(drowEmp[9].ToString()); strStatus = objempCurrentStatus.EmployeeStatusChange(); } catch (Exception ex) { MessageBox.Show("Error On Status Change, " + ex.Message); boolOk = false; } } if (boolOk) { strMessageText += drow[1].ToString() + " Employees Status Changed From Active To Inactive Successfully.\r\n"; } else { strMessageText += drow[1].ToString() + " Employees Status Changed From Active To Inactive Complted With Errors.\r\n"; } } } if (strMessageText.Length > 0) { MessageBox.Show(strMessageText); } //------------------------------------- DataSet dsEmpGangsReport = new DataSet(); dsEmpGangsReport = objempCurrentStatus.ListEmployeeStatusChangeLog("%", Convert.ToDateTime(DateTime.Now.Date.ToShortDateString())); if (dsEmpGangsReport.Tables[0].Rows.Count > 0) { dsEmpGangsReport.WriteXml("EmployeeStatusChangeLog.xml"); EmployeeStatusChangeLogRPT objReport = new EmployeeStatusChangeLogRPT(); objReport.SetDataSource(dsEmpGangsReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Company", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } }
private void button1_Click(object sender, EventArgs e) { DataSet dsDuplicateEPFNo = new DataSet(); DataSet dsErroEmployerNo = new DataSet(); DataTable dtEmpDetails = new DataTable("EmployeeTable"); DataTable dtErrorsRpt = new DataTable("ErrorTable"); DataSet dsErrorRpt = new DataSet("ErrorTable"); //dsDuplicateEPFNo = myReport2.GetDuplicateEPFNos(); //dsErroEmployerNo = myReport2.GetErrorEmployerNosInEmployeeMaster(); Boolean boolSuccess = true; String strDupEntries = ""; String strErrorEmployerNo = ""; String strPayrollDuplicates = ""; String strCheckrollDuplicates = ""; String strEarningsEmployerErrors = ""; //strPayrollDuplicates = myReport2.GetDuplicateEPFNosPayroll(); strCheckrollDuplicates = myReport2.GetDuplicateEPFNosCheckroll(); strEarningsEmployerErrors = myReport2.GetEmpEarningsWithoutEmployerNo(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())); //Error Report DataSet dsDivisionReport = new DataSet(); //dtEmpDetails = empMaster.ListEmployeesDetails("%"); dtEmpDetails = empMaster.ListEmployeesDetailsForEform("%", Convert.ToInt32(cmbYear.SelectedValue.ToString()), Convert.ToInt32(cmbMonth.SelectedValue.ToString())); dsErrorRpt.Tables.Add(ValidateEmpMasterDetails(dtEmpDetails, false)); //Report if (dsErrorRpt.Tables[0].Rows.Count > 0) { MessageBox.Show("There Are Employee Master Data Errors"); dsErrorRpt.WriteXml("EformErrors.xml"); EformErrorsReportRPT objReport = new EformErrorsReportRPT(); objReport.SetDataSource(dsErrorRpt); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString()); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { if (strEarningsEmployerErrors.Length > 0) { MessageBox.Show("Employer Numbers Of Following Employees Are Wrong, Please Correct Them And Re-generate \n" + strEarningsEmployerErrors, "Invalid Entries", MessageBoxButtons.OK); boolSuccess = false; } //else if (strPayrollDuplicates.Length > 0) //{ // MessageBox.Show("Found Following Duplicate EPF Number(s) in Staff Payroll, Please Correct Them And Re-generate \n" + strPayrollDuplicates, "Invalid Entries", MessageBoxButtons.OK); //} else if (strCheckrollDuplicates.Length > 0) { MessageBox.Show("Found Following Duplicate EPF Number(s) in Checkroll, Please Correct Them And Re-generate \n" + strCheckrollDuplicates, "Invalid Entries", MessageBoxButtons.OK); boolSuccess = false; } //else if (dsDuplicateEPFNo.Tables[0].Rows.Count > 0) //{ // foreach (DataRow dtr in dsDuplicateEPFNo.Tables[0].Rows) // { // strDupEntries += "\n\n" +"Employer NO: "+ dtr[0].ToString() + " " +"EPF NO: "+ dtr[1].ToString(); // } // MessageBox.Show("Found Following Duplicate EPF Number(s), Please Correct Them And Re-generate "+strDupEntries,"Invalid Entries",MessageBoxButtons.OK); //} //else if (dsErroEmployerNo.Tables[0].Rows.Count > 0) //{ // foreach (DataRow dtr1 in dsErroEmployerNo.Tables[0].Rows) // { // strErrorEmployerNo += "\n\n" + "Employer NO: " + dtr1[0].ToString() + " " + "DivisionID: " + dtr1[1].ToString() + " " + "EmpNo: " + dtr1[2].ToString() + " " + "EPFNO: " + dtr1[3].ToString(); // } // //MessageBox.Show("Found Following Wrong Employer Number(s), Please Correct Them And Re-generate " + strErrorEmployerNo, "Invalid Entries", MessageBoxButtons.OK); // if(strErrorEmployerNo.Length>100) // MessageBox.Show("Found Following Wrong Employer Number(s), Please Correct Them And Re-generate " + strErrorEmployerNo.Substring(0, 100)); // else // MessageBox.Show("Found Following Wrong Employer Number(s), Please Correct Them And Re-generate " + strErrorEmployerNo); // boolSuccess = false; //} else if (dtEmpDetails.Rows.Count > 0) { //employee details } if (!boolSuccess) { MessageBox.Show("Create Failed"); } else { String strContributionPeriod = cmbYear.Text.PadLeft(4, '0') + cmbMonth.SelectedValue.ToString().PadLeft(2, '0'); DataSet dsEVEMC = new DataSet(); try { //wRITE INTO THE EVEMC FILE String DesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\EForms\"; String dirPath = DesktopPath; String SDirectory = cmbYear.Text.PadLeft(4, '0') + cmbMonth.SelectedValue.ToString().PadLeft(2, '0') + FTSPayRollBL.User.StrEstate.ToString(); String filePath = ""; String fileName = ""; // Create a reference to a directory. DirectoryInfo di = new DirectoryInfo(dirPath); DirectoryInfo SubDirectory = new DirectoryInfo(SDirectory); DirectoryInfo SubDi = new DirectoryInfo(dirPath + SDirectory); // Create the directory only if it does not already exist. if (di.Exists == false) { } else if (SubDi.Exists == false) { SubDi.Create(); } //else //{ // MessageBox.Show("Already Generated.\r\n If you want to Re-Generate \r\nPlease Delete The EForms Folder On Desktop And Re-Generate. "); //} if (SubDi.Exists == false) { di.Create(); DirectoryInfo dis = di.CreateSubdirectory(SDirectory); fileName = "EVEMC"; filePath = dirPath + "\\" + SDirectory + "\\" + fileName + ".TXT"; if (File.Exists(filePath)) { MessageBox.Show("Already Created"); //if (MessageBox.Show("Already Created, Do You Want To Replace", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) //{ //} } else { dsEVEMC = myReport2.GetEPF_EVEMC_Data(strContributionPeriod); MessageBox.Show("EVEMC & EVEMP Files Generated Successfully!."); foreach (DataRow dr2 in dsEVEMC.Tables[1].Rows) { if (dr2.ItemArray[1].ToString() == "4543") { MessageBox.Show("error"); } DataSet dsMC = new DataSet(); dsMC = myReport2.getEmployerWiseEVEMC(dr2.ItemArray[2].ToString(), dr2.ItemArray[1].ToString()); filePath = dirPath + "\\" + SDirectory + "\\" + fileName + dr2.ItemArray[1].ToString() + ".TXT"; if (File.Exists(filePath)) { MessageBox.Show(fileName + "Already Created"); //if (MessageBox.Show("Already Created, Do You Want To Replace", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) //{ //} } else { foreach (DataRow dr3 in dsMC.Tables[0].Rows) { String strLine = ""; //strLine = dr3.ItemArray[0].ToString().PadLeft(1, ' ') + dr3.ItemArray[1].ToString().PadLeft(6, '0') + dr3.ItemArray[2].ToString().PadLeft(6, '0') + dr3.ItemArray[3].ToString().PadLeft(2, '0') + Convert.ToDecimal(dr3.ItemArray[4].ToString()).ToString("F2").PadLeft(12, '0') + dr3.ItemArray[5].ToString().PadLeft(5, '0') + dr3.ItemArray[6].ToString().PadLeft(1, ' ') + "70831150000010054204".PadRight(20, ' ') + dr3.ItemArray[8].ToString().PadLeft(10, ' ') + dr3.ItemArray[9].ToString().PadLeft(2, '0'); //strLine = dr3.ItemArray[0].ToString().PadRight(20, ' ') + dr3.ItemArray[1].ToString().PadRight(40, ' ') + dr3.ItemArray[2].ToString().PadRight(20, ' ') + dr3.ItemArray[3].ToString().PadLeft(6, '0') + Convert.ToDecimal(dr3[4].ToString()).ToString("F2").PadLeft(10, '0') + Convert.ToDecimal(dr3.ItemArray[5].ToString()).ToString("F2").PadLeft(10, '0') + Convert.ToDecimal(dr3.ItemArray[6].ToString()).ToString("F2").PadLeft(10, '0') + Convert.ToDecimal(dr3.ItemArray[7].ToString()).ToString("F2").PadLeft(10, '0') + dr3.ItemArray[8].ToString().PadLeft(1, 'E') + dr3.ItemArray[9].ToString().PadLeft(1, ' ') + dr3.ItemArray[10].ToString().PadLeft(6, '0') + dr3.ItemArray[11].ToString().PadLeft(6, ' ') + dr3.ItemArray[12].ToString().PadLeft(2, '0') + dr3.ItemArray[13].ToString().PadLeft(5, '0') + dr3.ItemArray[14].ToString().PadLeft(3, '0') + dr3.ItemArray[15].ToString().PadLeft(2, '0'); if (FTSPayRollBL.Company.getCompanyCode().ToUpper().Equals("BPL")) { strLine = dr3.ItemArray[0].ToString().PadRight(20, ' ') + dr3.ItemArray[1].ToString().PadRight(40, ' ') + dr3.ItemArray[2].ToString().PadRight(20, ' ') + dr3.ItemArray[3].ToString().PadLeft(6, '0') + Convert.ToDecimal(dr3[4].ToString()).ToString("F2").PadLeft(10, '0') + Convert.ToDecimal(dr3.ItemArray[5].ToString()).ToString("F2").PadLeft(10, '0') + Convert.ToDecimal(dr3.ItemArray[6].ToString()).ToString("F2").PadLeft(10, '0') + Convert.ToDecimal(dr3.ItemArray[7].ToString()).ToString("F2").PadLeft(12, '0') + dr3.ItemArray[8].ToString().PadLeft(1, 'E') + dr3.ItemArray[9].ToString().PadRight(1, ' ') + dr3.ItemArray[10].ToString().PadLeft(6, '0') + dr3.ItemArray[11].ToString().PadLeft(6, ' ') + dr3.ItemArray[12].ToString().PadLeft(2, ' ') + Convert.ToDecimal(dr3.ItemArray[13].ToString()).ToString().PadLeft(5, '0') + dr3.ItemArray[14].ToString().PadLeft(3, ' '); } else { strLine = dr3.ItemArray[0].ToString().PadRight(20, ' ') + dr3.ItemArray[1].ToString().PadRight(40, ' ') + dr3.ItemArray[2].ToString().PadRight(20, ' ') + dr3.ItemArray[3].ToString().PadLeft(6, ' ') + Convert.ToDecimal(dr3[4].ToString()).ToString("F2").PadLeft(10, ' ') + Convert.ToDecimal(dr3.ItemArray[5].ToString()).ToString("F2").PadLeft(10, ' ') + Convert.ToDecimal(dr3.ItemArray[6].ToString()).ToString("F2").PadLeft(10, ' ') + Convert.ToDecimal(dr3.ItemArray[7].ToString()).ToString("F2").PadLeft(12, ' ') + dr3.ItemArray[8].ToString().PadLeft(1, 'E') + dr3.ItemArray[9].ToString().PadRight(2, ' ') + dr3.ItemArray[10].ToString().PadLeft(5, '0') + dr3.ItemArray[11].ToString().PadLeft(6, ' ') + dr3.ItemArray[12].ToString().PadLeft(2, ' ') + Convert.ToDecimal(dr3.ItemArray[13].ToString()).ToString().PadLeft(5, ' ') + dr3.ItemArray[14].ToString().PadLeft(3, ' '); } try { using (System.IO.StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine(strLine); } } catch (Exception ex) { MessageBox.Show("Error, " + ex.Message); } } } } //WRITE ON EVEMP filePath = ""; fileName = ""; fileName = "EVEMP"; filePath = dirPath + "\\" + SDirectory + "\\" + fileName + ".TXT"; if (File.Exists(filePath)) { MessageBox.Show(fileName + "Alredy Created"); //if (MessageBox.Show("Already Created, Do You Want To Replace", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) //{ //} } else { foreach (DataRow dr1 in dsEVEMC.Tables[1].Rows) { String strLine = ""; strLine = dr1.ItemArray[0].ToString().PadLeft(1, ' ') + dr1.ItemArray[1].ToString().PadLeft(6, ' ') + dr1.ItemArray[2].ToString().PadLeft(6, '0') + dr1.ItemArray[3].ToString().PadLeft(2, '0') + Convert.ToDecimal(dr1.ItemArray[4].ToString()).ToString("F2").PadLeft(12, '0') + dr1.ItemArray[5].ToString().PadLeft(5, '0') + dr1.ItemArray[6].ToString().PadLeft(1, ' ') + "70831150000010054204".PadRight(20, ' ') + dr1.ItemArray[8].ToString().PadLeft(10, ' ') + dr1.ItemArray[9].ToString().PadLeft(2, '0'); try { using (System.IO.StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine(strLine); } } catch (Exception ex) { MessageBox.Show("Error, " + ex.Message); } } } } // MessageBox.Show("EVEMC & EVEMP Files Generated Successfully!."); } else { MessageBox.Show("Already Generated.\r\n If you want to Re-Generate \r\nPlease Delete The EForms Folder On Desktop And Re-Generate. "); } } catch { } } } }