public int PartyBalanceCheckWithReference() { int inF1 = 0; decimal decPartyBalanceAmount = 0; decimal decGrandTotal = 0; try { bool isRef = false; AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); isRef = bllAccountLedger.PartyBalanceAgainstReferenceCheck(strVoucherNo, DecSalesInvoiceVoucherTypeId); if (isRef) { decPartyBalanceAmount = BllPartyBalance.PartyBalanceAmountViewForSalesInvoice(strVoucherNo, DecSalesInvoiceVoucherTypeId, "Against"); decGrandTotal = Convert.ToDecimal(txtGrandTotal.Text); if (decGrandTotal >= decPartyBalanceAmount) { inF1 = 1; } else { inF1 = 0; Messages.InformationMessage("There is a Receipt voucher against this invoice so grand total should not be less than " + decPartyBalanceAmount); } } else { inF1 = 1; } } catch (Exception ex) { MessageBox.Show("SI36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return inF1; }