Microsoft Great Plains: Interest Calculation Example ? Stored Procedure for Crystal Report

This is intermediate level SQL scripting article for DB Administrator, Programmer, IT Specialist

Our and Microsoft Business Solutions goal here is to educate database administrator, programmer, software developer to enable them support Microsoft Great Plains for their companies. In our opinion self support is the goal of Microsoft to facilitate implementation of its products: Great Plains, Navision, Solomon, Microsoft CRM. You can do it for your company, appealing to Microsoft Business Solutions Techknowledge database. This will allow you to avoid expensive consultant visits onsite. You only need the help from professional when you plan on complex customization, interface or integration, then you can appeal to somebody who specializes in these tasks and can do inexpensive nation-wide remote support for you.

Let's look at interest calculation techniques.

Imagine that you are financing institution and have multiple customers in two companies, where you need to predict interest. The following procedure will do the job:

CREATE PROCEDURE AST_Interest_Calculation

@Company1 varchar(10), --Great Plains SQL database ID

@Company2 varchar(10),

@Accountfrom varchar(60),

@Accountto varchar(60),

@Datefrom datetime,

@Dateto datetime--,

as

declare @char39 char --for single quote mark

declare @SDatefrom as varchar(50)

declare @SDateto as varchar(50)

select @SDatefrom = cast(@Datefrom as varchar(50))

select @SDateto = cast(@Dateto as varchar(50))

select @char39=char(39)

if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AST_INTEREST_TABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

CREATE TABLE [dbo].[AST_INTEREST_TABLE] (

[YEAR] [int] NULL ,

[MONTH] [int] NULL ,

[COMPANYID] [varchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

[ACTNUMST] [char] (129) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

[BEGINDATE] [varchar] (19) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

[ENDDATE] [varchar] (19) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

[YEARDEGBALANCE] [numeric](19, 5) NULL ,

[BEGBALANCE] [numeric](38, 5) NULL ,

[ENDBALANCE] [numeric](38, 5) NULL ,

[INTERESTONBALANCE] [numeric](38, 6) NULL ,

[INTERESONTRANSACTIONS] [numeric](38, 8) NULL ,

[INTEREST] [numeric](38, 6) NULL ) ON [PRIMARY]

exec("

delete AST_INTEREST_TABLE where [YEAR] = year("+ @char39 + @Datefrom + @char39 +") and [MONTH]=month("+ @char39 + @Datefrom + @char39 +")

insert into AST_INTEREST_TABLE

select

year(X.BEGINDATE) as [YEAR],

month(X.BEGINDATE) as [MONTH],

X.COMPANYID,

X.ACTNUMST,

X.BEGINDATE as BEGINDATE,

X.ENDDATE as ENDDATE,

X.YEARBEGBALANCE as YEARDEGBALANCE,

X.YEARBEGBALANCE+X.BEGBALANCE as BEGBALANCE,

X.YEARBEGBALANCE+X.ENDBALANCE as ENDBALANCE,

X.INTERESTONBALANCE as INTERESTONBALANCE,

X.INTERESTONTRANSACTIONS as INTERESONTRANSACTIONS,

X.INTERESTONBALANCE+X.INTERESTONTRANSACTIONS as INTEREST

--into AST_INTEREST_TABLE

from

(

select

"+ @char39+ @Company1 + @char39+" as COMPANYID,

a.ACTNUMST,

"+ @char39 + @Datefrom + @char39 +" as BEGINDATE,

"+ @char39 + @Dateto + @char39 +" as ENDDATE,

case when

b.PERDBLNC is null then 0

else b.PERDBLNC

end as YEARBEGBALANCE,

sum

(

case

when (c.DEBITAMT-c.CRDTAMNT is not null and c.TRXDATE ="+ @char39 + @SDatefrom + @char39 +" and c.TRXDATE =year("+ @char39 + @Datefrom + @char39 +")

where

a.ACTNUMST>="+@char39+@Accountfrom+@char39 +"

and a.ACTNUMST="+ @char39 + @SDatefrom + @char39 +" and c.TRXDATE =year("+ @char39 + @Datefrom + @char39 +")

where

a.ACTNUMST>="+@char39+@Accountfrom+@char39 +"

and a.ACTNUMST

move out cleaning service Glencoe ..
In The News:

Anonymous researcher has scraped public Spotify accounts of politicians and celebrities, highlighting major privacy risks in default platform settings.
AI chatbot toys marketed as screen-free playmates could undermine children's empathy and critical thinking skills, according to pediatric specialists.
TransUnion confirms a major data breach affecting 4.4 million U.S. consumers after hackers exploited third-party Salesforce apps to steal personal info.
Scammers use fake DocuSign emails claiming Apple Pay charges to steal personal information using fraudulent phone numbers and fake receipts.
Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
Farmers Insurance confirms data breach affecting over 1.1 million customers nationwide, exposing customer info including addresses.
The iconic Mary Kay pink Cadillac goes electric with the Cadillac Optiq, available only to the company's top 1% of sales force performers.
Cybercriminals abuse trusted Intel driver to gain kernel access and shut down Windows Defender, enabling undetected malware deployment since July 2025.
Using email aliases for online shopping and subscriptions can protect your privacy by preventing companies from linking your activity across websites.
New research shows AI overlap does not equal job replacement, with knowledge-based roles seeing most integration while physical jobs remain least affected.
Scammers target seniors who avoid social media by exploiting public records like obituaries and real estate filings to steal personal information and money
Recovery team in Italy use AI-enabled drones to detect missing hiker's red helmet, leading to successful recovery after months of ground searches
Google Salesforce system breach exposes business data while scammers use incident to target users with fake security calls and phishing attempts.
Google announces Pixel 10 lineup with Tensor G5 chip and Gemini Nano AI, introducing Magic Cue, Pro Res Zoom up to 100x and satellite emergency support features.
C San Diego study reveals 86% of school safety companies monitor students 24/7 on personal devices, raising privacy concerns.
Users can now add their favorite outlets' coverage to the Top Stories section of Google search results by utilizing the 'preferred sources' feature. With just a few clicks, you can add Fox News.
Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
Interstellar object 3I/ATLAS shows an unexpected frontal glow that Harvard's Avi Loeb says cannot be explained by sunlight reflection or standard cometary outgassing.
Receiving order confirmations for purchases you never made could mean your email address is being exploited in fraud operations targeting multiple retailers.
First wireless brain implant works with Apple's official protocol, enabling hands-free control of iPhones, iPads and Vision Pro through thought alone.
Data brokers sell personal details that scammers use to target retirement funds through fake financial advisor calls and convincing phishing attempts
Ten innovative tech solutions from gait sensors to smart pill dispensers help adults 65+ track fall risks and prevent injuries before they happen.
Meta AI internal documents revealed chatbots were allowed to flirt with children and engage in romantic conversations until the company was exposed by Reuters.
ChatGPT will avoid giving direct mental health advice under new OpenAI rules following instances where the AI model provided harmful or misleading responses.
Your phone tracks you in more ways than that little GPS icon suggests. Here’s how to find and clear hidden location logs on iPhone and Android.

Microsoft eCommerce Web-development: Great Plains eConnect .Net ? Highlights for Programmer

In our small article we'll consider Microsoft Business Solutions Great... Read More

Microsoft Great Plains Reporting ? Overview for Developer

Looks like Microsoft Great Plains becomes more and more... Read More

Hubris - Definition: Microsofts Passport

Before September of 1995, Microsoft ignored the Internet because their... Read More

Microsoft Great Plains Oil & Gas ? Implementation & Customization Highlights

Microsoft Great Plains serves the wide spectrum of horizontal markets.... Read More

Five Reasons for Using an O/R Mapping Tool

So, why should you use any O/R mapping tool? I... Read More

Microsoft Great Plains Payroll Module Customization Scenarios

It is now common thing when large corporation selects mid-market... Read More

Software Piracy - Global Increase

Pirated software is on the increase and now accounts for... Read More

Microsoft Great Plains Integration Manager ? Working With Text File

Microsoft Business Solutions main middle market ERP application - Microsoft... Read More

Microsoft Great Plains Implementation for Midsize & Large Corporation: Lockbox Processing

Microsoft Great Plains is now targeting large and midsize businesses... Read More

Partitioning, Formatting and Reinstalling in Windows 98

Formatting and reinstalling windows 98 is very easy if you... Read More

Performance Tuning of a Daffodil DB / One$DB -JDBC Application

This article illustrates the best practices to improve the performance... Read More

The Secret of the Layer Styles Dialogue

When you double-click a layer in the Layer Palette, you... Read More

Microsoft C# vs. VB.Net

Hi, Guys,I believe a lot of programmers are trying to... Read More

It?s Back!! WordPerfect?s Amazing Comeback

Have you noticed WordPerfect is gearing up for a comeback... Read More

The Religion And Philosophy Of Small Internet Business

I have always had a tendency to focus on the... Read More

Does your Company have Documentum?

Are you lost in the mess of documents that get... Read More

Crystal Reports For Microsoft RMS ? Overview For Developer/Report Designer

If you are software developer or database administrator - we... Read More

The Bluebird Project

The objective for Zandi Digital is to make available clever... Read More

Screenshots Vista Windows

Features Additionally, Vista will include many other new features.Aero Vista... Read More

Outlook... Not Just for Email! Using Your Outlook Calendar

Microsoft Outlook is one of the most widely used software... Read More

Microsoft Navision Integration with Microsoft RMS - Overview for IT Specialist

Microsoft Business Solutions Navision serves both European and American megamarkets.... Read More

Microsoft Great Plains RW: Report Writer

Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More

10 Things You Can Do With Photoshop CS2 That You Couldnt Do Before Now

Is Photoshop CS2 worth the upgrade? You bet it is!... Read More

Great Plains Sales Order Processing and Invoicing Modules ? Tips For Consultants

We'll give you non formal view, based on our consulting... Read More

How To Create A Data Capture Procedure Checklist For Your Small Business CRM Software

Fortunately one of the most common reasons cited for the... Read More

house cleaning company Bannockburn ..