protected void Page_PreRender(object sender, EventArgs e) { if (!Page.IsPostBack) { view = loadData(info, db, Repeater); } lblTotalSize.Text = ((double)(EInboxAttachment.GetTotalSize(dbConn, user.UserID) / 1000.0 / 1000.0)).ToString("0.000") + "MB"; }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(EEmpPersonalInfo.db, Repeater, "ItemSelect"); if (list.Count > 0) { HROne.Reports.Payroll.PaymentSummaryListProcess reportProcess; if (Payroll_PeriodSelectionList1.SelectedPayrollStatus.Equals("T")) { reportProcess = new HROne.Reports.Payroll.PaymentSummaryListProcess(dbConn, ci, list, HROne.Reports.Payroll.PaymentSummaryListProcess.ReportType.TrialRun, Payroll_PeriodSelectionList1.GetTrialRunPayPeriodList(), null); } else { reportProcess = new HROne.Reports.Payroll.PaymentSummaryListProcess(dbConn, ci, list, HROne.Reports.Payroll.PaymentSummaryListProcess.ReportType.History, null, Payroll_PeriodSelectionList1.GetPayBatchList()); } if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenericExcelReportTaskFactory reportTask = new HROne.TaskService.GenericExcelReportTaskFactory(dbConn, user, lblReportHeader.Text, reportProcess, "PaymentList"); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { System.IO.FileInfo excelFile = reportProcess.GenerateExcelReport(); WebUtils.TransmitFile(Response, excelFile.FullName, "PaymentList_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } } // const string PAYMENTCODE_PREFIX = "[Payment] "; // string exportFileName = System.IO.Path.GetTempFileName(); // System.IO.File.Delete(exportFileName); // exportFileName += ".xls"; // //System.IO.File.Copy(Server.MapPath("~/template/HistoryList_Template.xls"), exportFileName, true); // HROne.Export.ExcelExport export = new HROne.Export.ExcelExport(exportFileName); // DataSet dataSet = new DataSet(); //export.GetDataSet(); // DataTable dataTable = new DataTable("Payroll$"); // dataSet.Tables.Add(dataTable); // dataTable.Columns.Add("Company", typeof(string)); // DBFilter hierarchyLevelFilter = new DBFilter(); // Hashtable hierarchyLevelHashTable = new Hashtable(); // hierarchyLevelFilter.add("HLevelSeqNo", true); // ArrayList hierarchyLevelList = EHierarchyLevel.db.select(dbConn, hierarchyLevelFilter); // foreach (EHierarchyLevel hlevel in hierarchyLevelList) // { // dataTable.Columns.Add(hlevel.HLevelDesc, typeof(string)); // hierarchyLevelHashTable.Add(hlevel.HLevelID, hlevel); // } // dataTable.Columns.Add("Payroll Group", typeof(string)); // dataTable.Columns.Add("Position", typeof(string)); // dataTable.Columns.Add("EmpNo", typeof(string)); // dataTable.Columns.Add("English Name", typeof(string)); // dataTable.Columns.Add("Chinese Name", typeof(string)); // dataTable.Columns.Add("HKID", typeof(string)); // dataTable.Columns.Add("From", typeof(DateTime)); // dataTable.Columns.Add("To", typeof(DateTime)); // int firstSummaryColumnPos = dataTable.Columns.Count; // dataTable.Columns.Add("Net Payment", typeof(double)); // dataTable.Columns.Add("Relevant Income", typeof(double)); // dataTable.Columns.Add("Non-Relevant Income", typeof(double)); // dataTable.Columns.Add("Wages Payable for Min Wages", typeof(double)); // dataTable.Columns.Add("Total Hours Worked", typeof(double)); // dataTable.Columns.Add("Min Wages Required", typeof(double)); // dataTable.Columns.Add("Employer Mandatory Contribution", typeof(double)); //// dataTable.Columns.Add("Employee Mandatory Contribution", typeof(double)); // dataTable.Columns.Add("Employer Voluntary Contribution", typeof(double)); //// dataTable.Columns.Add("Employee Voluntary Contribution", typeof(double)); // dataTable.Columns.Add("Employer P-Fund Contribution", typeof(double)); //// dataTable.Columns.Add("Employee P-Fund Contribution", typeof(double)); // dataTable.Columns.Add("Total Employer Contribution", typeof(double)); // dataTable.Columns.Add("Total Employee Contribution", typeof(double)); // dataTable.Columns.Add("Total Taxable Payment", typeof(double)); // dataTable.Columns.Add("Total Non-Taxable Payment", typeof(double)); // int firstDetailColumnPos = dataTable.Columns.Count; // foreach (EEmpPersonalInfo empInfo in list) // { // EEmpPersonalInfo.db.select(dbConn, empInfo); // DBFilter empPayrollFilterForPayrollPeriod = new DBFilter(); // empPayrollFilterForPayrollPeriod.add(new Match("ep.EmpID", empInfo.EmpID)); // empPayrollFilterForPayrollPeriod.add(Payroll_PeriodSelectionList1.GetEmpPayrollDBTerm()); // DBFilter payPeriodFilter = new DBFilter(); // payPeriodFilter.add(new IN("PayPeriodID", "SELECT PayPeriodID from " + EEmpPayroll.db.dbclass.tableName + " ep", empPayrollFilterForPayrollPeriod)); // ArrayList payPeriodList = EPayrollPeriod.db.select(dbConn, payPeriodFilter); // foreach (EPayrollPeriod payPeriod in payPeriodList) // { // if (EPayrollPeriod.db.select(dbConn, payPeriod)) // { // EPayrollGroup payrollGroup = new EPayrollGroup(); // payrollGroup.PayGroupID = payPeriod.PayGroupID; // EPayrollGroup.db.select(dbConn, payrollGroup); // DataRow row = dataTable.NewRow(); // row["EmpNo"] = empInfo.EmpNo; // row["English Name"] = empInfo.EmpEngFullName; // row["Chinese Name"] = empInfo.EmpChiFullName; // row["HKID"] = empInfo.EmpHKID; // row["From"] = payPeriod.PayPeriodFr; // row["To"] = payPeriod.PayPeriodTo; // row["Payroll Group"] = payrollGroup.PayGroupDesc; // DBFilter empPosFilter = new DBFilter(); // EEmpPositionInfo empPos = AppUtils.GetLastPositionInfo(dbConn, payPeriod.PayPeriodTo, empInfo.EmpID); // if (empPos != null) // { // ECompany company = new ECompany(); // company.CompanyID = empPos.CompanyID; // if (ECompany.db.select(dbConn, company)) // row["Company"] = company.CompanyCode; // DBFilter empHierarchyFilter = new DBFilter(); // empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID)); // ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter); // foreach (EEmpHierarchy empHierarchy in empHierarchyList) // { // EHierarchyLevel hierarchyLevel = (EHierarchyLevel)hierarchyLevelHashTable[empHierarchy.HLevelID]; // if (hierarchyLevel != null) // { // EHierarchyElement hierarchyElement = new EHierarchyElement(); // hierarchyElement.HElementID = empHierarchy.HElementID; // if (EHierarchyElement.db.select(dbConn, hierarchyElement)) // row[hierarchyLevel.HLevelDesc] = hierarchyElement.HElementDesc; // } // } // EPosition position = new EPosition(); // position.PositionID = empPos.PositionID; // if (EPosition.db.select(dbConn, position)) // row["Position"] = position.PositionDesc; // } // double netAmount = 0, releventIncome = 0, nonRelevantIncome = 0, taxableAmount = 0, nonTaxableAmount = 0; // double mcER = 0, mcEE = 0; // double vcER = 0, vcEE = 0; // double pFundER = 0, pFundEE = 0; // DBFilter empPayrollFilterForPaymentRecord = new DBFilter(empPayrollFilterForPayrollPeriod); // empPayrollFilterForPaymentRecord.add(new Match("PayPeriodID", payPeriod.PayPeriodID)); // DBFilter paymentRecordFilter = new DBFilter(); // paymentRecordFilter.add(new IN("EmpPayrollID", "Select EmpPayrollID from " + EEmpPayroll.db.dbclass.tableName + " ep ", empPayrollFilterForPaymentRecord)); // paymentRecordFilter.add(new Match("PayRecStatus", "A")); // ArrayList paymentRecords = EPaymentRecord.db.select(dbConn, paymentRecordFilter); // foreach (EPaymentRecord paymentRecord in paymentRecords) // { // EPaymentCode payCode = new EPaymentCode(); // payCode.PaymentCodeID = paymentRecord.PaymentCodeID; // EPaymentCode.db.select(dbConn, payCode); // // Always Use Payment Code Description for grouping payment code with same description // string fieldName = PAYMENTCODE_PREFIX + payCode.PaymentCodeDesc; // if (dataTable.Columns[fieldName] == null) // dataTable.Columns.Add(new DataColumn(fieldName, typeof(double))); // if (row[fieldName] == null || row[fieldName] == DBNull.Value) // row[fieldName] = 0; // row[fieldName] = (double)row[fieldName] + paymentRecord.PayRecActAmount; // netAmount += paymentRecord.PayRecActAmount; // if (payCode.PaymentCodeIsMPF) // releventIncome += paymentRecord.PayRecActAmount; // else // nonRelevantIncome += paymentRecord.PayRecActAmount; // DBFilter taxPaymentMapFilter = new DBFilter(); // taxPaymentMapFilter.add(new Match("PaymentCodeID", paymentRecord.PaymentCodeID)); // if (ETaxPaymentMap.db.count(dbConn, taxPaymentMapFilter) > 0) // taxableAmount += paymentRecord.PayRecActAmount; // else // nonTaxableAmount += paymentRecord.PayRecActAmount; // } // row["Net Payment"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(netAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // row["Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(releventIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // row["Non-Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(nonRelevantIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // row["Wages Payable for Min Wages"] = PayrollProcess.GetTotalWagesWithoutRestDayPayment(dbConn, empInfo.EmpID, payPeriod.PayPeriodFr, payPeriod.PayPeriodTo, null); // row["Total Hours Worked"] = PayrollProcess.GetTotalEmpPayrollWorkingHours(dbConn, empInfo.EmpID, payPeriod.PayPeriodID); // row["Min Wages Required"] = (double)row["Total Hours Worked"] * PayrollProcess.GetMinimumWages(dbConn, empInfo.EmpID, payPeriod.PayPeriodTo); // row["Total Taxable Payment"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(taxableAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // row["Total Non-Taxable Payment"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(nonTaxableAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // DBFilter mpfRecordFilter = new DBFilter(); // mpfRecordFilter.add(new IN("EmpPayrollID", "Select EmpPayrollID from " + EEmpPayroll.db.dbclass.tableName + " ep ", empPayrollFilterForPaymentRecord)); // ArrayList mpfRecords = EMPFRecord.db.select(dbConn, mpfRecordFilter); // foreach (EMPFRecord mpfRecord in mpfRecords) // { // vcER += mpfRecord.MPFRecActVCER; // mcER += +mpfRecord.MPFRecActMCER; // vcEE += mpfRecord.MPFRecActVCEE; // mcEE += mpfRecord.MPFRecActMCEE; // } // ArrayList orsoRecords = EORSORecord.db.select(dbConn, mpfRecordFilter); // foreach (EORSORecord orsoRecord in orsoRecords) // { // pFundER += orsoRecord.ORSORecActER; // pFundEE += orsoRecord.ORSORecActEE; // } // row["Employer Mandatory Contribution"] = mcER; // // row["Employee Mandatory Contribution"] = mcEE; // row["Employer Voluntary Contribution"] = vcER; // // row["Employee Voluntary Contribution"] = vcEE; // row["Employer P-Fund Contribution"] = pFundER; // // row["Employee P-Fund Contribution"] = pFundEE; // row["Total Employer Contribution"] = mcER + vcER + pFundER; // row["Total Employee Contribution"] = mcEE + vcEE + pFundEE; // dataTable.Rows.Add(row); // } // } // } // DBFilter paymentCodeFilter = new DBFilter(); // paymentCodeFilter.add("PaymentCodeDisplaySeqNo", false); // paymentCodeFilter.add("PaymentCode", false); // ArrayList paymentCodeList = EPaymentCode.db.select(dbConn, paymentCodeFilter); // foreach (EPaymentCode paymentCode in paymentCodeList) // { // if (dataTable.Columns.Contains(PAYMENTCODE_PREFIX + paymentCode.PaymentCodeDesc)) // { // DataColumn paymentColumn = dataTable.Columns[PAYMENTCODE_PREFIX + paymentCode.PaymentCodeDesc]; // paymentColumn.SetOrdinal(firstDetailColumnPos); // if (!dataTable.Columns.Contains(paymentCode.PaymentCodeDesc)) // paymentColumn.ColumnName = paymentCode.PaymentCodeDesc; // else // { // System.Diagnostics.Debug.Write("System reserved payment column is used"); // } // } // } // for (int i = 0; i < firstDetailColumnPos; i++) // dataTable.Columns[i].ColumnName = HROne.Common.WebUtility.GetLocalizedString(dataTable.Columns[i].ColumnName); // for (int i = firstSummaryColumnPos; i < firstDetailColumnPos; i++) // dataTable.Columns[firstSummaryColumnPos].SetOrdinal(dataTable.Columns.Count - 1); // export.Update(dataSet); // WebUtils.TransmitFile(Response, exportFileName, "PaymentList_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); // return; } else { errors.addError("Employee not selected"); } }
protected void btnGenerateFile_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); int taxFormID; if (!int.TryParse(TaxFormID.SelectedValue, out taxFormID)) { errors.addError("Year Return is not selected"); } else if (taxFormID <= 0) { errors.addError("Year Return is not selected"); } string taxFileFormat = TaxFileFormat.SelectedValue; if (taxFileFormat == "") { errors.addError("File Format is not selected"); } //if (errors.isEmpty()) //{ // // skip converting content to big5. // // It should be done inside HROne.Taxation.TaxationGeneration.GenerateTaxationFileData function // System.Text.Encoding big5 = HROne.Taxation.TaxationGeneration.GetTaxationFileEncoding(); // //Encoding utf8 = System.Text.Encoding.GetEncoding("utf-8"); // string taxFileData = HROne.Taxation.TaxationGeneration.GenerateTaxationFileData(dbConn, taxFormID); // //byte[] taxFileByteArray = utf8.GetBytes(taxFileData); // //byte[] taxFileByteArrayBig5 = System.Text.Encoding.Convert(utf8, big5, taxFileByteArray); // byte[] taxFileByteArrayBig5 = big5.GetBytes(taxFileData); // char[] taxFileCharArrayBig5 = big5.GetChars(taxFileByteArrayBig5); // Response.Clear(); // Response.ContentEncoding = big5; // Response.AddHeader("Content-Type", "text/plain"); // Response.AddHeader("Content-Disposition", "attachment;filename=TaxationFile" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".txt"); // Response.AppendHeader("Content-Length", taxFileByteArrayBig5.Length.ToString()); // Response.Expires = -1; // Response.Write(taxFileCharArrayBig5, 0, taxFileCharArrayBig5.Length); // Response.End(); //} if (errors.isEmpty() && Response.IsClientConnected) { ESystemParameter.setParameter(dbConn, TAXATION_NAME_OF_SIGNATURE, txtNameOfSignature.Text); HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.TaxationDiskTaskFactory reportTask = new HROne.TaskService.TaxationDiskTaskFactory(dbConn, user, lblReportHeader.Text + " ( " + TaxFormID.SelectedItem.Text + " ) " + TaxFileFormat.SelectedItem.Text, taxFormID, txtNameOfSignature.Text, taxFileFormat); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { HROne.Taxation.TaxationDiskProcess process = new HROne.Taxation.TaxationDiskProcess(dbConn, taxFormID); if (taxFileFormat.Equals("TEXT", StringComparison.CurrentCultureIgnoreCase)) { string outputFileName = "TaxationFile_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".txt"; WebUtils.TransmitFile(Response, process.GenerateToFile(), outputFileName, true); } else if (taxFileFormat.Equals("XML", StringComparison.CurrentCultureIgnoreCase)) { // generate taxation file in XML format string outputFileName = "TaxationFile_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xml"; WebUtils.TransmitFile(Response, process.GenerateToXML(), outputFileName, true); } } } }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ArrayList empList = new ArrayList(); foreach (RepeaterItem i in empRepeater.Items) { CheckBox cb = (CheckBox)i.FindControl("ItemSelect"); if (cb.Checked) { EEmpPersonalInfo o = (EEmpPersonalInfo)EEmpPersonalInfo.db.createObject(); WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb); empList.Add(o); } } string strEmpList = string.Empty; string strPayBatchList = string.Empty; string strPayPeriodRequest = string.Empty; DateTime dtPayPeriodFr = new DateTime(); DateTime dtPayPeriodTo = new DateTime(); if (empList.Count > 0) { foreach (EEmpPersonalInfo o in empList) { if (strEmpList == string.Empty) { strEmpList = ((EEmpPersonalInfo)o).EmpID.ToString(); } else { strEmpList += "_" + ((EEmpPersonalInfo)o).EmpID.ToString(); } } if (DateTime.TryParse(PayPeriodFr.Value, out dtPayPeriodFr) && DateTime.TryParse(PayPeriodTo.Value, out dtPayPeriodTo)) { strPayPeriodRequest = "&PayPeriodFr=" + dtPayPeriodFr.Ticks + "&PayPeriodTo=" + dtPayPeriodTo.Ticks; } else { errors.addError("Invalid Date Format"); } // errors.addError("Complete"); //Response.Write("<script>alert('Completed'); </script>"); } else { errors.addError("Employee or Payroll Batch not selected"); } if (errors.isEmpty()) { GenericMPFFile mpfFileProcess = getMPFFileObject(); if (mpfFileProcess == null) { errors.addError("Generate MPF File is not available for that MPF Scheme"); return; } if (mpfFileProcess is HSBCMPFGatewayFileEncrypted) { string keyFolderPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BankKey"); string keyPath = string.Empty; string HSBCKeyFileName = "HSBC.pub"; string HangSengKeyFileName = "HASE.pub"; string password = "******"; int intMPFPlanID = 0; if (int.TryParse(MPFPlanID.SelectedValue, out intMPFPlanID)) { EMPFPlan mpfPlan = new EMPFPlan(); mpfPlan.MPFPlanID = intMPFPlanID; if (EMPFPlan.db.select(dbConn, mpfPlan)) { EMPFScheme mpfScheme = new EMPFScheme(); mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID; if (EMPFScheme.db.select(dbConn, mpfScheme)) { if (mpfScheme.MPFSchemeTrusteeCode.Equals("HSBC")) { keyPath = System.IO.Path.Combine(keyFolderPath, HSBCKeyFileName); if (Application["MasterDBConfig"] != null) { DatabaseConnection masterDBConn = ((DatabaseConfig)Application["MasterDBConfig"]).CreateDatabaseConnectionObject(); string HSBCKeyPath = HROne.SaaS.Entities.ESystemParameter.getParameter(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HSBC_PATH); string HSBCPassword = HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HSBC_PASSWORD); if (!string.IsNullOrEmpty(HSBCKeyPath) && !string.IsNullOrEmpty(HSBCPassword)) { keyPath = HSBCKeyPath; password = HSBCPassword; } } } else if (mpfScheme.MPFSchemeTrusteeCode.Equals("HangSeng")) { keyPath = System.IO.Path.Combine(keyFolderPath, HangSengKeyFileName); if (Application["MasterDBConfig"] != null) { DatabaseConnection masterDBConn = ((DatabaseConfig)Application["MasterDBConfig"]).CreateDatabaseConnectionObject(); string HASEKeyPath = HROne.SaaS.Entities.ESystemParameter.getParameter(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HASE_PATH); string HASEPassword = HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HASE_PASSWORD); if (!string.IsNullOrEmpty(HASEKeyPath) && !string.IsNullOrEmpty(HASEPassword)) { keyPath = HASEKeyPath; password = HASEPassword; } } } } } } HSBCMPFGatewayFileEncrypted mpfFileEncrypted = (HSBCMPFGatewayFileEncrypted)mpfFileProcess; mpfFileEncrypted.publicKeyFile = keyPath; mpfFileEncrypted.publicKeyPassword = password; } HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenerateMPFContributionFileTaskFactory reportTask = new HROne.TaskService.GenerateMPFContributionFileTaskFactory(dbConn, user, lblReportHeader.Text, mpfFileProcess, empList, int.Parse(MPFPlanID.SelectedValue), dtPayPeriodFr, dtPayPeriodTo, ci); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { try { mpfFileProcess.LoadMPFFileDetail(empList, int.Parse(MPFPlanID.SelectedValue), dtPayPeriodFr, dtPayPeriodTo); FileInfo mpfFileInfo = mpfFileProcess.GenerateMPFFile(); string mpfFilename = mpfFileProcess.ActualMPFFileName(); WebUtils.TransmitFile(Response, mpfFileInfo.FullName, mpfFilename, true); } catch (Exception ex) { errors.addError(ex.Message); } } } // emploadData(empInfo, EEmpPayroll.db, empRepeater); }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(EPayrollGroup.db, Page.Master); DateTime dtPeriodFrom = new DateTime(); DateTime dtPeriodTo = new DateTime(); int intHierarchyLevelID = 0; int m_companyID = int.Parse(CompanyID.SelectedValue); //if (!string.IsNullOrEmpty(PayPeriodFr.Value)) if (!DateTime.TryParse(PayPeriodFr.Value, out dtPeriodFrom)) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_FORMAT); return; } //if (!string.IsNullOrEmpty(PayPeriodTo.Value)) if (!DateTime.TryParse(PayPeriodTo.Value, out dtPeriodTo)) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_FORMAT); return; } if ((dtPeriodTo.Year * 12 + dtPeriodTo.Month) - (dtPeriodFrom.Year * 12 + dtPeriodFrom.Month) >= 36) { errors.addError("Payroll period exceed maximum (36 months)"); return; } if (!int.TryParse(HLevelID.SelectedValue, out intHierarchyLevelID)) { errors.addError("Invalid Hierarchy Level"); return; } // Start 0000185, KuangWei, 2015-05-05 ArrayList empList = WebUtils.SelectedRepeaterItemToBaseObjectList(db, Repeater, "ItemSelect"); if (empList.Count <= 0) { errors.addError("No Employees are selected"); return; } HROne.Reports.Payroll.PayrollAllocationReport_Detail_Process reportProcess = new HROne.Reports.Payroll.PayrollAllocationReport_Detail_Process(dbConn, ci, dtPeriodFrom, dtPeriodTo, intHierarchyLevelID, chkShowIndividuals.Checked, WebUtils.GetCurUser(Session), m_companyID, empList); // End 0000185, KuangWei, 2015-05-05 if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenericExcelReportTaskFactory reportTask = new HROne.TaskService.GenericExcelReportTaskFactory(dbConn, user, lblReportHeader.Text, reportProcess, "PFundContributionSummary"); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { System.IO.FileInfo excelFile = reportProcess.GenerateExcelReport(); WebUtils.TransmitFile(Response, excelFile.FullName, "PFundContributionSummary_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } } }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(EPayrollGroup.db, Page.Master); DateTime dtPeriodFrom = new DateTime(); DateTime dtPeriodTo = new DateTime(); int intHierarchyLevelID = 0; if (!string.IsNullOrEmpty(PayPeriodFr.Value)) { if (!DateTime.TryParse(PayPeriodFr.Value, out dtPeriodFrom)) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_FORMAT); return; } } if (!string.IsNullOrEmpty(PayPeriodTo.Value)) { if (!DateTime.TryParse(PayPeriodTo.Value, out dtPeriodTo)) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_FORMAT); return; } } if (!int.TryParse(HLevelID.SelectedValue, out intHierarchyLevelID)) { errors.addError("Invalid Hierarchy Level"); } // Start 0000185, KuangWei, 2015-05-05 ArrayList empList = WebUtils.SelectedRepeaterItemToBaseObjectList(db, Repeater, "ItemSelect"); if (empList.Count <= 0) { errors.addError("No Employees selected"); } if (errors.isEmpty()) { HROne.Reports.Payroll.PaymentAllocationListProcess reportProcess = new HROne.Reports.Payroll.PaymentAllocationListProcess(dbConn, ci, dtPeriodFrom, dtPeriodTo, intHierarchyLevelID, WebUtils.GetCurUser(Session), empList); // End 0000185, KuangWei, 2015-05-05 if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenericExcelReportTaskFactory reportTask = new HROne.TaskService.GenericExcelReportTaskFactory(dbConn, user, lblReportHeader.Text, reportProcess, "PaymentAllocationList"); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { System.IO.FileInfo excelFile = reportProcess.GenerateExcelReport(); WebUtils.TransmitFile(Response, excelFile.FullName, "PaymentAllocationList_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } } } //{ // string hierarchyLevelName = string.Empty; // DataSet dataSet = new DataSet(); // DataTable empInfoTable = new DataTable("EmpInfo"); // DataTable payrollTable = new DataTable("Payment"); // dataSet.Tables.Add(empInfoTable); // dataSet.Tables.Add(payrollTable); // payrollTable.Columns.Add("EmpPayrollID", typeof(string)); // int firstDetailColumnPos = payrollTable.Columns.Count; // empInfoTable.Columns.Add("EmployeeID", typeof(string)); // empInfoTable.Columns.Add("EmpPayrollID", typeof(int)); // empInfoTable.Columns.Add("EnglishName", typeof(string)); // empInfoTable.Columns.Add("Alias", typeof(string)); // empInfoTable.Columns.Add("Company", typeof(string)); // DBFilter hierarchyLevelFilter = new DBFilter(); // Hashtable hierarchyLevelHashTable = new Hashtable(); // hierarchyLevelFilter.add("HLevelSeqNo", true); // ArrayList hierarchyLevelList = EHierarchyLevel.db.select(dbConn, hierarchyLevelFilter); // foreach (EHierarchyLevel hlevel in hierarchyLevelList) // { // if (hlevel.HLevelID.Equals(intHierarchyLevelID)) // hierarchyLevelName = hlevel.HLevelDesc; // empInfoTable.Columns.Add(hlevel.HLevelDesc, typeof(string)); // hierarchyLevelHashTable.Add(hlevel.HLevelID, hlevel); // } // empInfoTable.Columns.Add("Payroll Group", typeof(string)); // empInfoTable.Columns.Add("Date Join", typeof(DateTime)); // empInfoTable.Columns.Add("Date Left", typeof(DateTime)); // empInfoTable.Columns.Add("Net Payable", typeof(double)); // empInfoTable.Columns.Add("MCEE", typeof(double)); // empInfoTable.Columns.Add("MCER", typeof(double)); // empInfoTable.Columns.Add("VCEE", typeof(double)); // empInfoTable.Columns.Add("VCER", typeof(double)); // empInfoTable.Columns.Add("PFundEE", typeof(double)); // empInfoTable.Columns.Add("PFundER", typeof(double)); // DBFilter payPeriodFilter = new DBFilter(); // if (!dtPeriodFrom.Ticks.Equals(0)) // payPeriodFilter.add(new Match("PayPeriodTo", ">=", dtPeriodFrom)); // if (!dtPeriodTo.Ticks.Equals(0)) // payPeriodFilter.add(new Match("PayPeriodTo", "<=", dtPeriodTo)); // ArrayList payPeriodList = EPayrollPeriod.db.select(dbConn, payPeriodFilter); // if (payPeriodList.Count > 0) // { // // reset period // dtPeriodFrom = new DateTime(); // dtPeriodTo = new DateTime(); // } // foreach (EPayrollPeriod payPeriod in payPeriodList) // { // if (dtPeriodFrom > payPeriod.PayPeriodFr || dtPeriodFrom.Ticks.Equals(0)) // dtPeriodFrom = payPeriod.PayPeriodFr; // if (dtPeriodTo < payPeriod.PayPeriodTo || dtPeriodTo.Ticks.Equals(0)) // dtPeriodTo = payPeriod.PayPeriodTo; // DBFilter empPayrollFilter = new DBFilter(); // empPayrollFilter.add(new Match("PayPeriodID", payPeriod.PayPeriodID)); // ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter); // foreach (EEmpPayroll empPayroll in empPayrollList) // { // EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); // empInfo.EmpID = empPayroll.EmpID; // EEmpPersonalInfo.db.select(dbConn, empInfo); // DataRow row = empInfoTable.NewRow(); // DataRow paymentRow = payrollTable.NewRow(); // row["EmployeeID"] = empInfo.EmpNo; // row["EmpPayrollID"] = empPayroll.EmpPayrollID; // paymentRow["EmpPayrollID"] = empPayroll.EmpPayrollID; // row["EnglishName"] = empInfo.EmpEngFullName; // row["Alias"] = empInfo.EmpAlias; // row["Date Join"] = empInfo.EmpDateOfJoin; // DBFilter empTerminationFilter = new DBFilter(); // empTerminationFilter.add(new Match("EmpID", empInfo.EmpID)); // ArrayList empTerminationList = EEmpTermination.db.select(dbConn, empTerminationFilter); // if (empTerminationList.Count > 0) // row["Date Left"] = ((EEmpTermination)empTerminationList[0]).EmpTermLastDate; // DBFilter empPosFilter = new DBFilter(); // EEmpPositionInfo empPos = AppUtils.GetLastPositionInfo(dbConn, payPeriod.PayPeriodTo, empInfo.EmpID); // if (empPos != null) // { // ECompany company = new ECompany(); // company.CompanyID = empPos.CompanyID; // if (ECompany.db.select(dbConn, company)) // row["Company"] = company.CompanyName; // EPayrollGroup payrollGroup = new EPayrollGroup(); // payrollGroup.PayGroupID = empPos.PayGroupID; // if (EPayrollGroup.db.select(dbConn, payrollGroup)) // row["Payroll Group"] = payrollGroup.PayGroupDesc; // DBFilter empHierarchyFilter = new DBFilter(); // empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID)); // ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter); // foreach (EEmpHierarchy empHierarchy in empHierarchyList) // { // EHierarchyLevel hierarchyLevel = (EHierarchyLevel)hierarchyLevelHashTable[empHierarchy.HLevelID]; // if (hierarchyLevel != null) // { // EHierarchyElement hierarchyElement = new EHierarchyElement(); // hierarchyElement.HElementID = empHierarchy.HElementID; // if (EHierarchyElement.db.select(dbConn, hierarchyElement)) // row[hierarchyLevel.HLevelDesc] = hierarchyElement.HElementDesc; // } // } // } // double netAmount = 0, releventIncome = 0, nonRelevantIncome = 0, MCEE = 0, MCER = 0, VCEE=0, VCER=0, PFUNDEE = 0, PFUNDER = 0; // DBFilter paymentRecordFilter = new DBFilter(); // paymentRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID)); // paymentRecordFilter.add(new Match("PayRecStatus", "A")); // ArrayList paymentRecords = EPaymentRecord.db.select(dbConn, paymentRecordFilter); // foreach (EPaymentRecord paymentRecord in paymentRecords) // { // EPaymentCode payCode = new EPaymentCode(); // payCode.PaymentCodeID = paymentRecord.PaymentCodeID; // EPaymentCode.db.select(dbConn, payCode); // string fieldName = payCode.PaymentCodeDesc; // if (payrollTable.Columns[fieldName] == null) // payrollTable.Columns.Add(new DataColumn(fieldName, typeof(double))); // if (paymentRow[fieldName] == null || paymentRow[fieldName] == DBNull.Value) // paymentRow[fieldName] = 0; // paymentRow[fieldName] = (double)paymentRow[fieldName] + paymentRecord.PayRecActAmount; // netAmount += paymentRecord.PayRecActAmount; // if (payCode.PaymentCodeIsMPF) // releventIncome += paymentRecord.PayRecActAmount; // else // nonRelevantIncome += paymentRecord.PayRecActAmount; // } // row["Net Payable"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(netAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // //row["Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(releventIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // //row["Non-Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(nonRelevantIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // DBFilter mpfRecordFilter = new DBFilter(); // mpfRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID)); // ArrayList mpfRecords = EMPFRecord.db.select(dbConn, mpfRecordFilter); // foreach (EMPFRecord mpfRecord in mpfRecords) // { // VCER += mpfRecord.MPFRecActVCER; // MCER += mpfRecord.MPFRecActMCER; // VCEE += mpfRecord.MPFRecActVCEE; // MCEE += mpfRecord.MPFRecActMCEE; // } // row["MCEE"] = MCEE; // row["VCEE"] = VCEE; // row["MCER"] = MCER; // row["VCER"] = VCER; // ArrayList orsoRecords = EORSORecord.db.select(dbConn, mpfRecordFilter); // foreach (EORSORecord orsoRecord in orsoRecords) // { // PFUNDER += orsoRecord.ORSORecActER; // PFUNDEE += orsoRecord.ORSORecActEE; // } // row["PFundEE"] = PFUNDEE; // row["PFundER"] = PFUNDER; // empInfoTable.Rows.Add(row); // payrollTable.Rows.Add(paymentRow); // } // } // DBFilter paymentCodeFilter = new DBFilter(); // paymentCodeFilter.add("PaymentCodeDisplaySeqNo", false); // paymentCodeFilter.add("PaymentCode", false); // ArrayList paymentCodeList = EPaymentCode.db.select(dbConn, paymentCodeFilter); // foreach (EPaymentCode paymentCode in paymentCodeList) // { // if (payrollTable.Columns.Contains(paymentCode.PaymentCodeDesc)) // payrollTable.Columns[paymentCode.PaymentCodeDesc].SetOrdinal(firstDetailColumnPos); // } // GenerateReport(dataSet, dtPeriodFrom, dtPeriodTo, hierarchyLevelName); // return; //} }
private void GenerateEmployeeExcel(ArrayList employeeList, ArrayList functionList) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); HROne.Import.EmployeeInformationExportProcess reportProcess = new HROne.Import.EmployeeInformationExportProcess(dbConn, ci, employeeList, functionList, IncludedEmployeeNameHierarchy.Checked, DisplayCodeOnly.Checked, ShowInternalID.Checked); if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenericExcelReportTaskFactory reportTask = new HROne.TaskService.GenericExcelReportTaskFactory(dbConn, user, lblReportHeader.Text, reportProcess, "EmployeeExport"); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { System.IO.FileInfo excelFile = reportProcess.GenerateExcelReport(); WebUtils.TransmitFile(Response, excelFile.FullName, "EmployeeExport_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } } //DataSet excelDataSet= new DataSet(); //foreach (string functionCode in functionList) //{ // if (functionCode.Equals("PER001")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpPersonalInfoProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER002")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpBankAccountProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER003")) // { // excelDataSet.Tables.Add(HROne.Import.ImportEmpSpouseProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpDependantProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // } // if (functionCode.Equals("PER004")) // { // excelDataSet.Tables.Add(HROne.Import.ImportEmpQualificationProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpSkillProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // } // if (functionCode.Equals("PER005")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpPlaceOfResidenceProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER006")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpContractTermsProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER007")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpPositionInfoProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER007_1")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpRecurringPaymentProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER008")) // { // excelDataSet.Tables.Add(HROne.Import.ImportEmpMPFPlanProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpAVCPlanProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpORSOPlanProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // } // if (functionCode.Equals("PER009")) // excelDataSet.Tables.Add(HROne.Import.ImportLeaveApplicationProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER011")) // { // excelDataSet.Tables.Add(HROne.Import.ImportEmpTerminationProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpFinalPaymentProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // } // if (functionCode.Equals("PER012")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpCostCenterProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER013")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpPermitProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER015")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpEmergencyContactProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER016")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpWorkExpProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER017")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpWorkInjuryRecordProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); //} //string exportFileName = System.IO.Path.GetTempFileName(); //System.IO.File.Delete(exportFileName); //exportFileName += ".xls"; //HROne.Export.ExcelExport excelExport = new HROne.Export.ExcelExport(exportFileName); //excelExport.Update(excelDataSet); //WebUtils.TransmitFile(Response, exportFileName, "EmployeeExport_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); //return; }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); string functionList = string.Empty; foreach (ListItem item in FunctionID.Items) { if (item.Selected) { if (item.Value.Equals(string.Empty)) { functionList = string.Empty; break; } else { if (string.IsNullOrEmpty(functionList)) { functionList = item.Value; } else { functionList += "," + item.Value; } } } } string userList = string.Empty; foreach (ListItem item in UserID.Items) { if (item.Selected) { if (item.Value.Equals(string.Empty)) { userList = null; break; } else { if (string.IsNullOrEmpty(userList)) { userList = item.Value; } else { userList += "," + item.Value; } } } } DateTime dtPeriodFr, dtPeriodTo; if (!DateTime.TryParse(CreateDateFrom.Value, out dtPeriodFr)) { dtPeriodFr = new DateTime(); } if (!DateTime.TryParse(CreateDateTo.Value, out dtPeriodTo)) { dtPeriodTo = new DateTime(); } HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.Lib.AuditTrailReportProcess process = new HROne.Lib.AuditTrailReportProcess(dbConn, null, functionList, userList, dtPeriodFr, dtPeriodTo, EmpNo.Text.Trim(), chkShowHeaderOnly.Checked, chkShowKeyIDOnly.Checked, chkDoNotConvertID.Checked, chkShowWithoutDataUpdate.Checked); HROne.TaskService.AuditTrailTaskFactory task = new HROne.TaskService.AuditTrailTaskFactory(dbConn, user, lblReportHeader.Text, process); AppUtils.reportTaskQueueService.AddTask(task); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/download"; //Fixed download problem on https Response.AddHeader("Content-Disposition", "attachment;filename=AuditTrail_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".txt"); Response.Expires = -1; HROne.Lib.AuditTrailReportProcess process = new HROne.Lib.AuditTrailReportProcess(dbConn, Response.Output, functionList, userList, dtPeriodFr, dtPeriodTo, EmpNo.Text.Trim(), chkShowHeaderOnly.Checked, chkShowKeyIDOnly.Checked, chkDoNotConvertID.Checked, chkShowWithoutDataUpdate.Checked); process.Updated += new EventHandler(OnProcessUpdated); process.GenerateToFile(); Response.End(); } }
protected void Page_PreRender(object sender, EventArgs e) { HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls); lblDefault_MAX_MONTHLY_LSPSP_AMOUNT.Text = DEFAULT_MAX_MONTHLY_LSPSP_AMOUNT.ToString(); lblDefault_MAX_TOTAL_LSPSP_AMOUNT.Text = DEFAULT_MAX_TOTAL_LSPSP_AMOUNT.ToString(); HROne.ProductVersion.Database database = new HROne.ProductVersion.Database(dbConn); SYSTEM_APP_VERSION.Text = ProductVersion.CURRENT_PROGRAM_VERSION; SYSTEM_DB_VERSION.Text = HROne.ProductVersion.Database.CURRENT_DB_VERSION; RUNNING_DB_VERSION.Text = database.RunningDatabaseVersion(); PRODUCT_TYPE.Text = productLicense.ProductType.ToString(); MAX_COMPANY.Text = productLicense.NumOfCompanies.ToString(); MAX_USERS.Text = productLicense.NumOfUsers.ToString(); if (productLicense.MaxInboxSizeMB.Equals(uint.MaxValue)) { MAX_INBOX_SIZE_MB.Text = HROne.Common.WebUtility.GetLocalizedString("Unlimited"); } else { MAX_INBOX_SIZE_MB.Text = productLicense.MaxInboxSizeMB.ToString(); } if (productLicense.NumOfEmployees.Equals(uint.MaxValue)) { MAX_EMPLOYEES.Text = HROne.Common.WebUtility.GetLocalizedString("Unlimited"); } else { MAX_EMPLOYEES.Text = productLicense.NumOfEmployees.ToString(); } lblActiveUser.Text = WebUtils.TotalActiveUser(dbConn, 0).ToString(); lblActiveCompany.Text = WebUtils.TotalActiveCompany(dbConn, 0).ToString(); lblActiveEmployee.Text = WebUtils.TotalActiveEmployee(dbConn, 0).ToString(); lblTotalInboxSize.Text = ((double)EInboxAttachment.GetTotalSize(dbConn, 0) / 1000.0 / 1000.0).ToString("0.000"); if (!productLicense.IsValidAuthorizationCode()) { TrialPeriodPanel.Visible = true; TRIAL_PERIOD_TO.Text = productLicense.LastTrialDate.ToString("yyyy-MM-dd"); } else { TrialPeriodPanel.Visible = false; } if (!Page.IsPostBack) { WebUtils.AddLanguageOptionstoDropDownList(cbxPARAM_CODE_DEFAULT_LANGUAGE); WebUtils.AddLanguageOptionstoDropDownList(cbxPARAM_CODE_ESS_DEFAULT_LANGUAGE); cbxPARAM_CODE_DEFAULT_LANGUAGE.SelectedValue = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DEFAULT_LANGUAGE); cbxPARAM_CODE_ESS_DEFAULT_LANGUAGE.SelectedValue = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_DEFAULT_LANGUAGE); cbxPARAM_CODE_DEFAULT_RECORDS_PER_PAGE.SelectedValue = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DEFAULT_RECORDS_PER_PAGE); txtPARAM_CODE_DB_TITLE.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DB_TITLE); txtPARAM_CODE_DOCUMENT_UPLOAD_FOLDER.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DOCUMENT_UPLOAD_FOLDER); if (string.IsNullOrEmpty(txtPARAM_CODE_DOCUMENT_UPLOAD_FOLDER.Text)) { txtPARAM_CODE_DOCUMENT_UPLOAD_FOLDER.Text = HROne.CommonLib.FileIOProcess.DefaultUploadFolder(); } txtPARAM_CODE_LOGIN_MAX_FAIL_COUNT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_LOGIN_MAX_FAIL_COUNT); txtPARAM_CODE_SESSION_TIMEOUT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SESSION_TIMEOUT); chkPARAM_CODE_HKID_CHECKDIGIT_AUTO_GENERATE.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_HKID_CHECKDIGIT_AUTO_GENERATE).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false; // Start 0000044, Miranda, 2014-05-09 chkPARAM_CODE_EMP_NO_AUTO_GENERATE.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_NO_AUTO_GENERATE).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false; txtPARAM_CODE_EMP_NO_FORMAT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_NO_FORMAT); // End 0000044, Miranda, 2014-05-09 cbxPARAM_CODE_USE_ORSO.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_USE_ORSO).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false; txtPARAM_CODE_PAYROLL_MAX_MONTHLY_LSPSP_AMOUNT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAYROLL_MAX_MONTHLY_LSPSP_AMOUNT); txtPARAM_CODE_PAYROLL_MAX_TOTAL_LSPSP_AMOUNT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAYROLL_MAX_TOTAL_LSPSP_AMOUNT); cbxPARAM_CODE_PAY_SLIP_HIDE_LEAVE_BALANCE.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAY_SLIP_HIDE_LEAVE_BALANCE).Equals("Y", StringComparison.CurrentCultureIgnoreCase); cbxPARAM_CODE_PAY_SLIP_HIDE_MINIMUM_WAGE_INFO.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAY_SLIP_HIDE_MINIMUM_WAGE_INFO).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false; txtPARAM_CODE_MPF_FILE_BOCI_ENCRYPT_PATH.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_MPF_FILE_BOCI_ENCRYPT_PATH); ddbPARAM_CODE_REPORT_CHINESE_FONT.SelectedValue = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_REPORT_CHINESE_FONT); chkPARAM_CODE_TAXATION_USE_CHINESE_NAME.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_TAXATION_USE_CHINESE_NAME).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false; txtPARAM_CODE_SMTP_SERVER_NAME.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_SERVER_NAME); txtPARAM_CODE_SMTP_PORT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_PORT); chkPARAM_CODE_SMTP_ENABLE_SSL.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_ENABLE_SSL).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false; txtPARAM_CODE_SMTP_USERNAME.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_USERNAME); txtPARAM_CODE_SMTP_PASSWORD.Attributes.Add("value", PASSWORD_NO_CHANGE_KEYWORD);//ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_PASSWORD); txtPARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS); chkPARAM_CODE_ESS_FUNCTION_CHANGE_EE_INFO.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_CHANGE_EE_INFO).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_CANCEL_LEAVE_APPLICATION.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_CANCEL_LEAVE_APPLICATION).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_LEAVE_HISTORY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_HISTORY).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_ENQUIRY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_ENQUIRY).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_REPORT.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION_LIST.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION_LIST).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_ROSTER_TABLE.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ROSTER_TABLE).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_PRINT_PAYSLIP.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_PRINT_PAYSLIP).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_PRINT_TAXREPORT.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_PRINT_TAXREPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_OVERALL_PAYMENT_SUMMARY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OVERALL_PAYMENT_SUMMARY).Equals("Y", StringComparison.CurrentCultureIgnoreCase); // Start 0000060, Miranda, 2014-07-22 if (ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM)) { chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OT_CLAIMS).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY).Equals("Y", StringComparison.CurrentCultureIgnoreCase); } // End 0000060, Miranda, 2014-07-22 // Start 0000112, Miranda, 2014-12-10 if (ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_LATE_WAIVE)) { chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LATE_WAIVE).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY).Equals("Y", StringComparison.CurrentCultureIgnoreCase); } // End 0000112, Miranda, 2014-12-10 // Start 0000057, KuangWei, 2014-07-08 chkPARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST).Equals("Y", StringComparison.CurrentCultureIgnoreCase); // End 0000057, KuangWei, 2014-07-08 // Start 0000076, Miranda, 2014-08-21 chkPARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_REPORT.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase); // End 0000076, Miranda, 2014-08-21 txtPARAM_CODE_ESS_LEAVE_MEDICIAL_CERT_ALERT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_LEAVE_MEDICIAL_CERT_ALERT); wdpPARAM_CODE_ESS_PAYSLIP_START_DATE.Value = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_PAYSLIP_START_DATE); chkPARAM_CODE_ESS_PAYSLIP_AUTO_RELEASE.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_PAYSLIP_AUTO_RELEASE).Equals("Y", StringComparison.CurrentCultureIgnoreCase); wdpPARAM_CODE_ESS_LEAVE_HISTORY_START_DATE.Value = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_LEAVE_HISTORY_START_DATE); // Start 0000060, Miranda, 2014-07-22 //wdpPARAM_CODE_ESS_DEF_EOT_EXPIRY_DATE.Value = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_DEF_EOT_EXPIRY_DATE); string essDefEotExpiry = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_DEF_EOT_EXPIRY); txtPARAM_CODE_ESS_DEF_EOT_EXPIRY.Text = string.IsNullOrEmpty(essDefEotExpiry) ? "1" : essDefEotExpiry; WebUtils.AddYearMonthDayOptionstoDropDownList(cbxPARAM_CODE_ESS_DEF_EOT_EXPIRY_TYPE); string essDefEotExpiryType = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_DEF_EOT_EXPIRY_TYPE); cbxPARAM_CODE_ESS_DEF_EOT_EXPIRY_TYPE.SelectedValue = string.IsNullOrEmpty(essDefEotExpiryType) ? "M" : essDefEotExpiryType;// "M" means Month // End 0000060, Miranda, 2014-07-22 chkPARAM_CODE_EMP_LIST_SHOW_COMPANY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_COMPANY).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_EMP_LIST_SHOW_H1.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H1).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_EMP_LIST_SHOW_H2.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H2).Equals("Y", StringComparison.CurrentCultureIgnoreCase); chkPARAM_CODE_EMP_LIST_SHOW_H3.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H3).Equals("Y", StringComparison.CurrentCultureIgnoreCase); } if (productLicense.IsESS) { PanelESSSection.Visible = true; } else { PanelESSSection.Visible = false; } if (productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.HROne) { DBTitleRow.Visible = true; BOCIEncryptPathSettingRow.Visible = true; DocumentUploadPathSettingRow.Visible = true; //ORSOSettingRow.Visible = true; PanelSMTPSection.Visible = true; } else { DBTitleRow.Visible = false; BOCIEncryptPathSettingRow.Visible = false; DocumentUploadPathSettingRow.Visible = false; //ORSOSettingRow.Visible = false; PanelSMTPSection.Visible = false; } eot_row.Visible = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM); this.chkPARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_TIMECARD_RECORD); this.lblEnabledTimeCardRecord.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD.Enabled; this.chkPARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_ATTENDANCE_TIMEENTRY_LIST); this.lblEnabledAttendanceTimeEntryList.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST.Enabled; this.chkPARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_MONTHLY_ATTENDANCE_REPORT); this.lblEnabledMonthlyAttendanceReport.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT.Enabled; this.chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM); this.chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM); this.lblEnabledOTClaims.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS.Enabled; this.lblEnabledOTClaimsHistory.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY.Enabled; // Start 000112, Ricky So, 2014/12/18 this.chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_LATE_WAIVE); this.chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_LATE_WAIVE); this.lblEnabledLateWaive.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE.Enabled; this.lblEnabledLateWaiveHistory.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY.Enabled; // End 000112, Ricky So, 2014/12/18 }