public void PtichatTashlumim() { int chodesh, shana, sherutPrice = 0, oneTimePrice = 0; chodesh = dtpKnisa.Value.Month; shana = dtpKnisa.Value.Year; if (chbsherut.Checked == true) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { if (checkedListBox1.GetItemChecked(i)) { DataRow Drow = new sherutimTable().Find(Convert.ToInt32(sh.AsDataView()[i].Row.ItemArray[0])); if (Drow["sugSherut"].ToString() == "קבוע") { sherutPrice += Convert.ToInt32(Drow["mechirChodshi"]); } else { oneTimePrice += Convert.ToInt32(Drow["mechirChodshi"]); } } } } for (int i = 0; i < hascara.MeshechZmanHachoze; i++) { tashlum = new tashlumLehascara(); tashlum.MisTashlum = tashlumim.GetNewKey(); tashlum.MisHascara = hascara.MisHascara; tashlum.SachTashlumChodshi = ch.MechirHascaraChodshi + sherutPrice; if (i == 0) { tashlum.SachTashlumChodshi += oneTimePrice; } tashlum.Chodesh = chodesh; tashlum.Shana = shana; chodesh = chodesh + 1; if (chodesh == 12) { chodesh = 1; shana = shana + 1; } tashlum.Add(); } }
public void PtichatTashlumim() { int chodesh, shana; chodesh = dtpKnisa.Value.Month; shana = dtpKnisa.Value.Year; for (int i = 0; i < hascara.MeshechZmanHachoze; i++) { tashlum = new tashlumLehascara(); tashlum.MisTashlum = tashlumim.GetNewKey(); tashlum.MisHascara = hascara.MisHascara; tashlum.SachTashlumChodshi = ch.MechirHascaraChodshi; tashlum.Chodesh = chodesh; tashlum.Shana = shana; chodesh = chodesh + 1; if (chodesh == 12) { chodesh = 1; shana = shana + 1; } tashlum.Add(); } }