public static bool AddUnpostedVoucher(AccountingTransactionTempDto voucherEntryDto)
        {
            try
            {
                var newVoucherNo = AccountingDataProvider.GetLastVoucherNo();

                var entity = new tAccountingTransactionTemp
                {
                    CompanyId = voucherEntryDto.CompanyId,
                    CreditAccount = voucherEntryDto.CreditAccount,
                    DebitAccount = voucherEntryDto.DebitAccount,
                    AccountingYearId = voucherEntryDto.AccountingYearId,
                    VoucherNo = newVoucherNo,
                    Currency = voucherEntryDto.CurrencyCode,
                    LineId = voucherEntryDto.LineId,
                    Total = voucherEntryDto.Total,
                    UserId = voucherEntryDto.UserId,
                    ValueTotal = voucherEntryDto.ValueTotal,
                    VoucherDate = voucherEntryDto.VoucherDate,

                };
                var result = AccountingDataProvider.AddUnpostedVoucher(entity);

                if (result == 1)
                {
                    AccountingDataProvider.DeleteLastVoucherInformation(new tLastVoucherInformation
                                                                            {LastVoucherNo = newVoucherNo});
                    AccountingDataProvider.AddLastVoucherInformation(new tLastVoucherInformation
                                                                         {LastVoucherNo = newVoucherNo + 1});
                    return true;
                }
                return false;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
        public static int UpdateUnpostedVoucher(tAccountingTransactionTemp transaction)
        {
            int rowsAdded;

            using (IDbConnection connection = DbConnectionHelper.GetConnection())
            {
                var query = SqlQueryHelper.GetUpdateQuery<tAccountingTransactionTemp>();

                rowsAdded = connection.Execute(query, transaction);
            }

            return rowsAdded;
        }
        public static bool UpdateUnpostedVoucher(AccountingTransactionTempDto voucherEntryDto)
        {
            try
            {
                var entity = new tAccountingTransactionTemp
                {
                    CompanyId = voucherEntryDto.CompanyId,
                    CreditAccount = voucherEntryDto.CreditAccount,
                    DebitAccount = voucherEntryDto.DebitAccount,
                    AccountingYearId = voucherEntryDto.AccountingYearId,
                    VoucherNo = voucherEntryDto.VoucherNo,
                    Currency = voucherEntryDto.CurrencyCode,
                    LineId = voucherEntryDto.LineId,
                    Total = voucherEntryDto.Total,
                    UserId = voucherEntryDto.UserId,
                    ValueTotal = voucherEntryDto.ValueTotal,
                    VoucherDate = voucherEntryDto.VoucherDate,

                };

                var result = AccountingDataProvider.UpdateUnpostedVoucher(entity);

                if (result == 1)
                {
                    return true;
                }
                return false;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }