public esn_list shrinklist(bool bezsotr) { esn_list rez = new esn_list(); int i, j; bool find; for (i = 0; i < this.Count; i++) { find = false; for (j = 0; j < rez.Count; j++) { if ((this[i].month_ == rez[j].month_) && (this[i].sotr_id == rez[j].sotr_id || bezsotr)) { foreach (string s in this[i].Keys) { rez[j][s] = rez[j][s] + this[i][s]; } find = true; } } if (!find) { Esn_Class ecl = new Esn_Class(); ecl.id = 0; ecl.sotr_id = this[i].sotr_id; ecl.dts_id = this[i].dts_id; ecl.org_id = this[i].org_id; ecl.tipsotr = this[i].tipsotr; ecl.squadid = this[i].squadid; ecl.year_ = this[i].year_; ecl.month_ = this[i].month_; ecl.tag = this[i].tag; ecl.schet = this[i].schet; ecl.def_prov = this[i].def_prov; ecl.prov921 = this[i].prov921; ecl.prov922 = this[i].prov922; ecl.prov923 = this[i].prov923; ecl.prov901 = this[i].prov901; ecl.prov911 = this[i].prov911; ecl.prov903 = this[i].prov903; ecl.prov904 = this[i].prov904; ecl.prov924 = this[i].prov924; ecl.sprrash_id = this[i].sprrash_id; //Плавающие поля foreach (string s in this[i].Keys) { ecl.Add(s, this[i][s]); } rez.Add(ecl); find = true; } } return(rez); }
public static void rasesnone(int god, int mes, int sotr_id, esn_list aresn, esn_list aresnpred) { //Определить дату рождения //Определить вычет по матпомощи //суммируем в 1 //Ограничение //Расчет как 1 //дозаполняем строки если есть null //Месячные суммы и распределение //Подгонка //Сохранение }
public esn_list getone(int sotr) { esn_list rez = new esn_list(); int i; for (i = 0; i < this.Count; i++) { if (sotr == this[i].sotr_id) { rez.Add(this[i].getcopy()); } ; } ; return(rez); }
public static void rasesnall(int god, int mes, int org_id) { List <Int32> sotrlist = new List <Int32>(); using (FbConnection fbBD = new FbConnection(FBDB.GetConnFBstring())) { fbBD.Open(); using (FbCommand sqlreq = new FbCommand("select sotrid from sumnu where god_v=@g and mes_v<=@m group by sotrid ", fbBD)) { sqlreq.Parameters.AddWithValue("@g", Convert.ToString(god)); sqlreq.Parameters.AddWithValue("@m", Convert.ToString(mes)); FbDataReader r = sqlreq.ExecuteReader(); sotrlist.Clear(); while (r.Read()) { sotrlist.Add(r.GetInt32(0)); } ; }; fbBD.Close(); }; esn_list aresn = new esn_list(); esn_list aresnpred = new esn_list(); aresnpred.get_esn(212, new DateTime(god, mes, 1), new DateTime(god, mes, 31), true, true, false); aresn.build_esn(212, god, mes); int i; for (i = 0; i < sotrlist.Count; i++) { esn_list aresn1 = aresn.getone(sotrlist[i]); esn_list aresnpred1 = aresnpred.getone(sotrlist[i]); rasesnone(god, mes, sotrlist[i], aresn1, aresnpred1); } ; }
public void frmMain_refrgrd(bool naritog) { esn_list aresn0 = new esn_list(); aresn0.get_esn(212, Convert.ToDateTime("01/01/2013"), Convert.ToDateTime("31/12/2013"), naritog, true, false); esn_list aresn = aresn0.getone(aresn0[10].sotr_id); esn_list arorg = aresn.shrinklist(true); int i, j; for (i = 1; i < 13; i++) { bool bfind = true; for (j = 0; j < arorg.Count; j++) { if (arorg[j].month_ == i) { bfind = false; } ; } ; if (bfind) { Esn_Class ecl = new Esn_Class(); ecl.year_ = 2013; ecl.month_ = i; ecl.Add("all_sum", 0); ecl.Add("dmppf", 0); ecl.Add("dnepf", 0); ecl.Add("dbazapf", 0); ecl.Add("dpf3", 0); ecl.Add("dpf1", 0); ecl.Add("dpf2", 0); arorg.Add(ecl); } ; } arorg.Sort(delegate(Esn_Class ecl1, Esn_Class ecl2) { return(ecl1.month_.CompareTo(ecl2.month_)); }); stg.RowCount = 12; stg.Columns[0].HeaderText = "ID"; stg.Columns[1].HeaderText = @"sotrid"; stg.Columns[2].HeaderText = @"god"; stg.Columns[3].HeaderText = @"mes"; stg.Columns[4].HeaderText = @"all"; stg.Columns[5].HeaderText = @"mp"; stg.Columns[6].HeaderText = @"ne"; stg.Columns[7].HeaderText = @"baza"; stg.Columns[8].HeaderText = @"pfstr"; stg.Columns[9].HeaderText = @"pfnak"; stg.Columns[10].HeaderText = @"pfprev"; for (i = 0; i < 12; i++) { stg.Rows[i].Cells[0].Value = Convert.ToString(0); stg.Rows[i].Cells[1].Value = Convert.ToString(0); stg.Rows[i].Cells[2].Value = Convert.ToString(arorg[i].year_); stg.Rows[i].Cells[3].Value = Convert.ToString(arorg[i].month_); stg.Rows[i].Cells[4].Value = Convert.ToString(arorg[i].getstrvalue("all_sum")); stg.Rows[i].Cells[5].Value = Convert.ToString(arorg[i].getstrvalue("dmppf")); stg.Rows[i].Cells[6].Value = Convert.ToString(arorg[i].getstrvalue("dnepf")); stg.Rows[i].Cells[7].Value = Convert.ToString(arorg[i].getstrvalue("dbazapf")); stg.Rows[i].Cells[8].Value = Convert.ToString(arorg[i].getstrvalue("dpf2")); stg.Rows[i].Cells[9].Value = Convert.ToString(arorg[i].getstrvalue("dpf3")); stg.Rows[i].Cells[10].Value = Convert.ToString(arorg[i].getstrvalue("dpf1")); } }