/// <summary> /// Function to check party balance with reference /// </summary> /// <returns></returns> public int PartyBalanceCheckWithReference() { int inF1 = 0; decimal decPartyBalanceAmount = 0; decimal decGrandTotal = 0; try { bool isRef = false; AccountLedgerSP spAccountLedger = new AccountLedgerSP(); PartyBalanceSP spPartyBalance = new PartyBalanceSP(); isRef = spAccountLedger.PartyBalanceAgainstReferenceCheck(strVoucherNo, decPurchaseInvoiceVoucherTypeId); if (isRef) { decPartyBalanceAmount = spPartyBalance.PartyBalanceAmountViewByVoucherNoVoucherTypeIdAndReferenceType (strVoucherNo, decPurchaseInvoiceVoucherTypeId, "Against"); decGrandTotal = Convert.ToDecimal(txtGrandTotal.Text); if (decGrandTotal >= decPartyBalanceAmount) { inF1 = 1; } else { inF1 = 0; Messages.InformationMessage("There is a payment voucher against this invoice so grand total should not be less than " + decPartyBalanceAmount); } } else { inF1 = 1; } } catch (Exception ex) { MessageBox.Show("PI36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return inF1; }