private void btnDisplay_ItemClick(object sender, ItemClickEventArgs e) { try { if (Vendor.EditValue == null) { MessageBox.Show("You must Choose Vendor", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } DataTable dt = VendorManager.GetVendorStatement(Vendor.EditValue.ToString(), null, null, out Vendor_Debit, out Vendor_Credit); VendorStatementGrid.DataSource = dt; VendorStatementGrid.DataMember = dt.TableName; VendorDebit.Caption = Vendor_Debit.ToString(); VendorCredit.Caption = Vendor_Credit.ToString(); VendorBalance.Caption = (Vendor_Debit - Vendor_Credit).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPeriodDisplay_ItemClick(object sender, ItemClickEventArgs e) { try { if (Vendor.EditValue == null) { MessageBox.Show("You must Choose Vendor", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else if (DateFrom.EditValue == null) { MessageBox.Show("You must Choose From Date", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else if (DateTo.EditValue == null) { MessageBox.Show("You must Choose To Date", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else if ((DateTime)DateFrom.EditValue > (DateTime)DateTo.EditValue) { MessageBox.Show("From Date must be Less than Or Equal To Date", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } DataTable dt = VendorManager.GetVendorStatement(Vendor.EditValue.ToString(), (DateTime)DateFrom.EditValue, (DateTime)DateTo.EditValue, out Vendor_Debit, out Vendor_Credit); VendorStatementGrid.DataSource = dt; VendorStatementGrid.DataMember = dt.TableName; VendorDebit.Caption = Vendor_Debit.ToString(); VendorCredit.Caption = Vendor_Credit.ToString(); VendorBalance.Caption = (Vendor_Debit - Vendor_Credit).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }