public void VSOP2()//DateTime start, DateTime end, ProgressBar progress) { var vm = DataContext as SendGroupViewModel; excelReport excel = new excelReport(); excel.Init("ВСОП_2.xlsx", string.Format(@"ВСОП_2_{0}_{1}__{2}_{3}.xlsx", vm.OtprDat.Value.ToString("dd.MM.yyyy"), "Новосибирск", vm.City, vm.Persons.Count), otchetDir: otchetDir); int ri = 1; var db = new ProvodnikContext(); var ids = vm.Persons.Select(pp => pp.PersonId).ToList(); var rr = db.Persons.Where(pp => ids.Contains(pp.Id)); foreach (var r in rr)//vm.Persons) { ri++; excel.cell[ri, 1].value2 = ri - 1; excel.cell[ri, 2].value2 = vm.RegOtdelenie; var fio = new StringHelper().ParseFio(r.Fio); excel.cell[ri, 3].value2 = fio[0]; excel.cell[ri, 4].value2 = fio[1]; excel.cell[ri, 5].value2 = fio[2]; excel.cell[ri, 6].value2 = r.BirthDat.HasValue ? r.BirthDat.Value.ToString("dd.MM.yyyy") : ""; excel.cell[ri, 7].value2 = r.UchebCentr; excel.cell[ri, 8].value2 = (r.ExamenDat.HasValue) ? r.ExamenDat.Value.Year.ToString() : (r.UchebEndDat.HasValue ? r.UchebEndDat.Value.Year.ToString() : ""); } excel.setAllBorders(excel.get_Range("A2", "I" + ri)); excel.Finish(); }
public void VSOP3(bool otdelno = false)//DateTime start, DateTime end, ProgressBar progress) { var vm = DataContext as SendGroupViewModel; excelReport excel = new excelReport(); if (!otdelno) { excel.Init("ВСОП_3.xlsx", string.Format(@"ВСОП_3_{0}_{1}__{2}_{3}.xlsx", vm.OtprDat.Value.ToString("dd.MM.yyyy"), "Новосибирск", vm.City, vm.Persons.Count), otchetDir: otchetDir); } else { excel.Init("ВСОП_3.xlsx", string.Format(@"ВСОП_3_{0}_{1}__{2}_{3}.xlsx", vm.OtprDat.Value.ToString("dd.MM.yyyy"), "Новосибирск", vm.City, vm.Persons.Count), true); } int ri = 1; var db = new ProvodnikContext(); var ids = vm.Persons.Select(pp => pp.PersonId).ToList(); var rr = db.Persons.Where(pp => ids.Contains(pp.Id)); ri = 2; excel.cell[ri, 2].value2 = vm.RegOtdelenie; excel.cell[ri, 3].value2 = vm.Persons.Count; excel.cell[ri, 4].value2 = vm.Poezd; excel.cell[ri, 5].value2 = vm.Vagon; excel.cell[ri, 6].value2 = vm.OtprDat.HasValue ? vm.OtprDat.Value.ToString("dd.MM.yyyy") : ""; excel.cell[ri, 7].value2 = vm.PribDat.HasValue ? vm.PribDat.Value.ToString("dd.MM.yyyy") : ""; excel.cell[ri, 8].value2 = vm.PribTime; var main = vm.Persons.FirstOrDefault(pp => pp.IsMain); if (main != null) { excel.cell[ri, 9].value2 = main.Fio; excel.cell[ri, 10].value2 = Helper.FormatPhone(main.Phone); } excel.cell[ri, 11].value2 = vm.Vstrechat?"да":"нет"; excel.cell[ri, 12].value2 = vm.Vokzal; ri = 1; foreach (var r in rr)//vm.Persons) { ri++; excel.cell[ri, 13].value2 = r.Fio; } excel.setAllBorders(excel.get_Range("B2", "M" + ri)); excel.Finish(!otdelno); }
public void F6() //DateTime start, DateTime end, ProgressBar progress) { var vm = DataContext as SendGroupViewModel; excelReport excel = new excelReport(); excel.Init(/*(vm.City== "Москва")?"Ф6_Msk.xlsx":*/ "Ф6_ost.xlsx", $@"Ф6_{vm.OtprDat.Value.ToString("dd.MM.yyyy")}_Новосибирск__{ vm.City}_{vm.Persons.Count}.xlsx", otchetDir: otchetDir//,visible:true ); int ri = 7; var db = new ProvodnikContext(); var ids = vm.Persons.Select(pp => pp.PersonId).ToList(); var rr = db.Persons.Where(pp => ids.Contains(pp.Id)); excel.cell[4, 1].value2 = vm.DepoRod;// new Repository().GetF6Depo(vm.City, vm.Depo); if (vm.Persons.Count > 1) { excel.get_Range("A9", "A" + (8 + vm.Persons.Count - 1)).EntireRow.Select(); excel.myExcel.Selection.Insert(Excel.XlInsertShiftDirection.xlShiftDown, Excel.XlInsertFormatOrigin.xlFormatFromLeftOrAbove); } foreach (var r in rr)//vm.Persons) { ri++; excel.cell[ri, 1].value2 = ri - 7; excel.cell[ri, 2].value2 = r.Fio + Environment.NewLine + (r.BirthDat.HasValue ? r.BirthDat.Value.ToString("dd.MM.yyyy") : "") + Environment.NewLine + r.MestoRozd; excel.cell[ri, 3].value2 = "Проводник" + Environment.NewLine + "пассажирского" + Environment.NewLine + "вагона"; excel.cell[ri, 5].value2 = r.PaspAdres; excel.cell[ri, 6].value2 = r.Grazdanstvo == "КЗ"? "Паспорт гр-на РК:" : "Паспорт гр-на РФ:" + Environment.NewLine + r.PaspSeriya + " " + r.PaspNomer + Environment.NewLine + Helper.FormatSnils(r.Snils); excel.cell[ri, 7].value2 = (!string.IsNullOrWhiteSpace(vm.PeresadSt)) ? $"Новосибирск – {vm.PeresadSt} – {vm.City} – {vm.PeresadSt} – Новосибирск" : $"Новосибирск – {vm.City} – Новосибирск"; excel.cell[ri, 11].value2 = vm.Uvolnenie.HasValue ? vm.Uvolnenie.Value.ToString("dd.MM.yyyy") : ""; } excel.setAllBorders(excel.get_Range("A8", "K" + ri)); excel.Finish(); }
public void VSOP1() //DateTime start, DateTime end, ProgressBar progress) { var vm = DataContext as SendGroupViewModel; excelReport excel = new excelReport(); excel.Init("ВСОП_1.xlsx", string.Format(@"ВСОП_1_{0}_{1}__{2}_{3}.xlsx", vm.OtprDat.Value.ToString("dd.MM.yyyy"), "Новосибирск", vm.City, vm.Persons.Count), otchetDir: otchetDir); int ri = 1; var db = new ProvodnikContext(); var ids = vm.Persons.Select(pp => pp.PersonId).ToList(); var rr = db.Persons.Where(pp => ids.Contains(pp.Id)); foreach (var r in rr)//vm.Persons) { ri++; excel.cell[ri, 1].value2 = vm.RegOtdelenie; excel.cell[ri, 2].value2 = r.Fio; excel.cell[ri, 3].value2 = vm.Depo; excel.cell[ri, 4].value2 = Helper.FormatPhone(r.Phone); excel.cell[ri, 5].value2 = r.VaccineSert; excel.cell[ri, 6].value2 = r.VaccineSertDat?.ToString("dd.MM.yyyy"); excel.cell[ri, 7].value2 = r.UchZavedenie; excel.cell[ri, 8].value2 = r.UchForma; excel.cell[ri, 9].value2 = r.Grazdanstvo; excel.cell[ri, 10].value2 = r.Otryad; excel.cell[ri, 11].value2 = r.UchebCentr; excel.cell[ri, 12].value2 = (r.ExamenDat.HasValue)?r.ExamenDat.Value.Year.ToString() : (r.UchebEndDat.HasValue?r.UchebEndDat.Value.Year.ToString():""); excel.cell[ri, 13].value2 = Helper.FormatPhone(r.RodPhone); excel.cell[ri, 14].value2 = r.RodFio; } excel.setAllBorders(excel.get_Range("A2", "N" + ri)); excel.Finish(); }
public void Napravleniya() //DateTime start, DateTime end, ProgressBar progress) { var vm = DataContext as MedKomZayavkaViewModel; var num = ""; foreach (var n in vm.Name) { if (char.IsDigit(n)) { num += n; } else { break; } } excelReport excel = new excelReport(); excel.Init("Направление мед.xltx", $"Список на мед.комиссию{num}Новосибирское РО_{vm.Depo}.xlsx", false, System.IO.Path.GetTempPath());//,visible:true);//, otchetDir: otchetDir); int ri = 1; var db = new ProvodnikContext(); foreach (var r in vm.Persons) { ri++; excel.cell[ri, 1].value2 = ri - 1; excel.cell[ri, 2].value2 = r.VihodDat?.ToString("dd.MM.yyyy"); excel.cell[ri, 3].value2 = vm.Depo; excel.cell[ri, 4].value2 = "Новосибирское РО"; excel.cell[ri, 5].value2 = r.Fio; excel.cell[ri, 6].value2 = r.BirthDat?.ToString("dd.MM.yyyy"); excel.cell[ri, 7].value2 = vm.BolnicaName; excel.cell[ri, 8].value2 = vm.BolnicaAdres; } excel.setAllBorders(excel.get_Range("A1", "H" + ri)); excel.myExcel.Visible = true; excel.Finish(false); }