private void viewDetails() { try { try { dgvDetailList.DataSource = loJournalEntryDetail.getJournalEntryDetails("ViewAll", dgvList.CurrentRow.Cells[0].Value.ToString()); } catch { dgvDetailList.DataSource = null; } try { dgvDetailReceipt.DataSource = loCashReceiptDetail.getCashReceiptDetails(dgvList.CurrentRow.Cells[0].Value.ToString()); } catch { dgvDetailReceipt.DataSource = null; } } catch (Exception ex) { throw ex; } }
private void CashReceiptVoucherUI_Load(object sender, EventArgs e) { try { this.BackColor = Color.FromArgb(int.Parse(GlobalVariables.FormBackColor)); txtFinancialYear.Text = GlobalVariables.CurrentFinancialYear; cboCustomer.DataSource = loCustomer.getAllData("ViewAll", "", ""); cboCustomer.DisplayMember = "Name"; cboCustomer.ValueMember = "Id"; cboCustomer.SelectedIndex = -1; if (lOperation == GlobalVariables.Operation.Edit) { foreach (DataRow _dr in loJournalEntry.getAllData("", "", lJournalEntryId, "").Rows) { txtFinancialYear.Text = _dr["F.Y."].ToString(); dtpDatePrepared.Value = GlobalFunctions.ConvertToDate(_dr["Date Prepared"].ToString()); txtExplanation.Text = _dr["Explanation"].ToString(); txtTotalDebit.Text = string.Format("{0:n}", decimal.Parse(_dr["Total Debit"].ToString())); txtTotalCredit.Text = string.Format("{0:n}", decimal.Parse(_dr["Total Credit"].ToString())); txtReference.Text = _dr["Reference"].ToString(); try { cboCustomer.SelectedValue = _dr["CustomerId"].ToString(); } catch { cboCustomer.SelectedIndex = -1; } txtRemarks.Text = _dr["Remarks"].ToString(); //get journal entry foreach (DataRow _drDetails in loJournalEntryDetail.getJournalEntryDetails("", lJournalEntryId).Rows) { int i = dgvDetail.Rows.Add(); dgvDetail.Rows[i].Cells["Id"].Value = _drDetails["Id"].ToString(); dgvDetail.Rows[i].Cells["AccountId"].Value = _drDetails["AccountId"].ToString(); dgvDetail.Rows[i].Cells["AccountCode"].Value = _drDetails["Account Code"].ToString(); dgvDetail.Rows[i].Cells["AccountTitle"].Value = _drDetails["Account Title"].ToString(); dgvDetail.Rows[i].Cells["Debit"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Debit"].ToString())); dgvDetail.Rows[i].Cells["Credit"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Credit"].ToString())); dgvDetail.Rows[i].Cells["Subsidiary"].Value = _drDetails["Subsidiary"].ToString(); dgvDetail.Rows[i].Cells["SubsidiaryId"].Value = _drDetails["SubsidiaryId"].ToString(); dgvDetail.Rows[i].Cells["Description"].Value = _drDetails["Subsidiary Description"].ToString(); dgvDetail.Rows[i].Cells["Remarks"].Value = _drDetails["Remarks"].ToString(); dgvDetail.Rows[i].Cells["Status"].Value = "Saved"; } //get payment receipt foreach (DataRow _drDetails in loCashReceiptDetail.getCashReceiptDetails(lJournalEntryId).Rows) { int i = dgvDetailPaymentReceipt.Rows.Add(); dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptId"].Value = _drDetails["Id"].ToString(); dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptSOId"].Value = _drDetails["S.O. Id"].ToString(); dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptAmountDue"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Amount Due"].ToString())); dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptPaymentAmount"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Payment Amount"].ToString())); dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptBalance"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Balance"].ToString())); dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptRemarks"].Value = _drDetails["Remarks"].ToString(); dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptStatus"].Value = "Saved"; } computeTotal(); } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "CashReceiptVoucherUI_Load"); em.ShowDialog(); return; } }