/// <summary> /// Loads the Donation Log with the Donations for the selected date /// </summary> private void loadDonationLogList() { lvFoodDonations.Items.Clear(); double totLbs = 0; int totCnt = 0; btnEditDnrTrx.Text = ""; btnEditDnrTrx.Enabled = false; btnDeleteTrx.Text = ""; btnDeleteTrx.Enabled = false; btnShowDnrHist.Text = ""; btnShowDnrHist.Enabled = false; if (dateIndex >= 0) { ListViewItem lvItm; currentlogdate = donationDates[dateIndex]; for (int i = 0; i < clsFoodDonations.RowCount; i++) { clsFoodDonations.setDataRow(i); lvItm = new ListViewItem(); lvItm.Name = clsFoodDonations.TrxID.ToString(); lvItm.Text = (i + 1).ToString(); lvItm.SubItems.Add(clsFoodDonations.TrxDate.ToShortDateString()); lvItm.SubItems.Add(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_Donation, clsFoodDonations.DonationType)); clsDonors.find(clsFoodDonations.DonorID); if (clsDonors.ID != clsFoodDonations.DonorID) { clsDonors.openWhere(""); clsDonors.find(clsFoodDonations.DonorID); } if (clsDonors.ID == clsFoodDonations.DonorID) { lvItm.SubItems.Add(clsDonors.Name); } else { lvItm.SubItems.Add("ID " + clsFoodDonations.DonorID.ToString()); } lvItm.SubItems.Add(String.Format("{0:0,0}", clsFoodDonations.Pounds)); lvItm.SubItems.Add(clsFoodDonations.Notes); lvItm.SubItems.Add(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_FoodClass, clsFoodDonations.FoodClass)); lvItm.SubItems.Add(clsFoodDonations.FoodCode); lvItm.SubItems.Add(clsFoodDonations.DonorID.ToString()); lvItm.SubItems.Add(clsFoodDonations.TrxID.ToString()); lvFoodDonations.Items.Add(lvItm); totCnt++; totLbs += clsFoodDonations.Pounds; } tbTotalCount.Text = CCFBGlobal.formatNumberWithCommas(totCnt); tbTotalLbs.Text = String.Format("{0:0,0}", totLbs); } else { clsFoodDonations.open(0); } }
/// <summary> /// Opens the Edit Donors Form so that a user can select which Donor /// made the donation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBrowse_Click(object sender, EventArgs e) { frmEditDonors.ShowDialog(); donorID = frmEditDonors.SelectedId; if (donorID == 0) { tbDonorID.Text = ""; tbName.Text = ""; } else { clsDonors.find(donorID); tbName.Text = clsDonors.Name; tbDonorID.Text = donorID.ToString(); clsCashDonations.openWhere(" Where DonorID=" + donorID.ToString()); loadDonorLogList(); clsCashDonations.openWhere(" Where TrxDate Between '" + periodStartDate.ToShortDateString() + "' And '" + periodEndDate.ToShortDateString() + "'"); } }
/// <summary> /// Opens the Edit Donors Form so that a user can select which Donor /// made the donation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBrowse_Click(object sender, EventArgs e) { frmEditDonors.ShowDialog(); donorID = frmEditDonors.SelectedId; if (donorID == 0) { tbDonorID.Text = ""; tbName.Text = ""; } else { clsDonors.find(donorID); tbName.Text = clsDonors.Name; tbDonorID.Text = donorID.ToString(); cboFoodCat.SelectedValue = "9"; cboDonationType.SelectedValue = clsDonors.DefaultDonationType.ToString(); clsFoodDonations.openWhere(" Where DonorID=" + donorID.ToString()); loadDonorLogList(); clsFoodDonations.openForDate(dtDonationDate.Value); } }