public ActionResult PersonalIncomeTaxExportExcel(string filter) { DataTable dt = new DataTable("Grid"); dt.Columns.AddRange(new DataColumn[11] { new DataColumn(AppRes.TaxNo), new DataColumn(AppRes.HR_FromDate), new DataColumn(AppRes.HR_ToDate), new DataColumn(AppRes.IncomeFrom), new DataColumn(AppRes.IncomeComes), new DataColumn(AppRes.ProgressiveLevel), new DataColumn(AppRes.C_CurrencyID), new DataColumn(AppRes.C_Vat), new DataColumn(AppRes.Promotion_Status), new DataColumn(AppRes.TitleCountry), new DataColumn(AppRes.CustNote), }); dt.Columns[0].DataType = typeof(int); dt.Columns[1].DataType = typeof(DateTime); dt.Columns[2].DataType = typeof(DateTime); dt.Columns[3].DataType = typeof(double); dt.Columns[4].DataType = typeof(double); dt.Columns[5].DataType = typeof(double); dt.Columns[6].DataType = typeof(string); dt.Columns[7].DataType = typeof(double); dt.Columns[8].DataType = typeof(string); dt.Columns[9].DataType = typeof(string); dt.Columns[10].DataType = typeof(string); var db = new PersonalIncomeTax_DAL(); int total = 0; int LanguageCode = Global.CurrentUser.CurrentLanguageID; var lstData = db.PersonalIncomeTax_GetList(1, 5000, filter, LanguageCode, out total); foreach (var item in lstData) { dt.Rows.Add(item.TaxNo, item.StartDate, item.EndDate, item.FromAmount, item.ToAmount, item.ProgressiveTax, item.CurrencyName, item.RateTax, item.StatusName, item.CountryName, item.Note); } var wb = new XLWorkbook(); wb.Worksheets.Add(dt); byte[] data = null; using (var stream = new MemoryStream()) { wb.SaveAs(stream); data = stream.ToArray(); } return(File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "PersonalIncomeTax.xlsx")); }
public ActionResult PersonalIncomeTax_Delete(int ID) { var db = new PersonalIncomeTax_DAL(); var result = db.PersonalIncomeTax_Delete(ID); if (result.IsSuccess == true) { result.Message = AppRes.MS_Update_success; } else { result.Message = AppRes.MS_Update_error; } return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult TableServerSideGetData(int pageIndex, int pageSize, string filter = "") { var db = new PersonalIncomeTax_DAL(); int total = 0; int languageCode = Global.CurrentLanguage; var result = db.PersonalIncomeTax_GetList(pageIndex, pageSize, filter, languageCode, out total); var lstTotal = new TableColumnsTotalModel(); lstTotal.Total1 = "15"; lstTotal.Total2 = "25"; lstTotal.Total3 = "35"; return(Content(JsonConvert.SerializeObject(new { employees = result, totalCount = total, lstTotal = lstTotal }))); }