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

cheapest limo Akin .. Lockport Chicago limo O’Hare
In The News:

Tech expert Kurt “CyberGuy" Knutsson says using outdated computers and software leaves them vulnerable to security risks and malware.
Tech expert Kurt “CyberGuy" Knutsson reveals how WalkON enhances walking and jogging with sensors and artificial tendons.
Old-fashioned check fraud is back in style, quintupling over the past year. Here are a few low-tech, practical means of protecting yourself.
Tech expert Kurt “CyberGuy" Knutsson discusses how 600,000-plus records, including checks and property data, were left exposed online by an information service provider.
That weird text from a friend may actually be from a hacker. Kurt “CyberGuy" Knutsson tells you what signs to look out for.
Scammers can wreak havoc on your life just by having your phone number. Kurt "CyberGuy" Knutsson addresses how to avoid becoming a victim.
PongBot is an artificial intelligence-powered tennis robot and a smart training partner available to play 24 hours a day, seven days a week.
Kurt "CyberGuy" Knutsson explains how to update your iPhone to add Apple Intelligence, which he says can transform your interactions with your phone.
University scientists have trained a robotic surgical system to do work with the skill of human doctors, possibly transforming the future of surgeries.
As more companies implement artificial intelligence for daily tasks, some industry leaders are working to push back against certain aspects of the technology.
Tech expert Kurt “CyberGuy" Knutsson says the Batagaika crater in Siberia expands 35 million cubic feet yearly due to thawing.
While fewer than 30% of farmers reportedly use emerging technologies like artificial intelligence, experts believe AI could help producers and farmers make food quicker and more efficiently.
Amazon becomes a prime target of scammers during the holiday shopping season trying to steal Social Security numbers, bank information and Amazon credentials.
Spammers have found a way to target Spotify playlists and podcasts to push pirated software, cheat codes for games and spam links and malware sites.
Sharing information online like your vacation plans and relationship status can make you a target for scammers; here's what to avoid posting to keep yourself safe.
Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
Kurt "CyberGuy" Knutsson explores six sneaky holiday season gift card tricks, providing tips on how to outsmart scammers trying to rip you off.
Apple Watch's Translate app gives you your own personal interpreter, allowing you to have live two-way conversations in up to 20 different languages.
With kids facing a seemingly increasing amount of threats from creeps on the internet, here's how you can respectfully ask people not to post photos of your children on social media.
Tech expert Kurt “CyberGuy" Knutsson reveals how to regain your Facebook access if you get hacked or locked out.
Kurt “CyberGuy" Knutsson explains how to safeguard retirement accounts from cyber threats with a VPN: encryption, anonymity, secure access.
I’m going to Europe soon, and planning my trip was a breeze. Yes, really! AI did a big chunk of the work for me — and it can help you plan your next getaway, too.
Tech expert Kurt “CyberGuy" Knutsson says North Korean hackers hide malware in macOS apps, bypassing Mac security checks.
Kurt “CyberGuy" Knutsson reveals how iPhone’s new Automatic Mic Mode adjusts settings for optimal call quality automatically.
Jeff Hancock, an expert on AI and misinformation, has been accused of fabricating an expert declaration by citing a study that was allegedly made up by AI.

Five Tips For A Great Software Demo

Whether you need to close a sale, gather end-user feedback,... Read More

Collaboration Software: Index of Collaboration Software Technologies

Collaboration SoftwareCollaboration Software, also known as group collaboration software or... Read More

DVD Burning Tips

CD and DVD replication is a process that works by... Read More

ERP System of the Future: Database, Business Logic and Interface

We will base our prognosis on our Microsoft Business Solutions... Read More

Know Linux

Linux essentials:It's free for download but you have to pay... Read More

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

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

10 Things You Could be Using Photoshop For, But Probably Arent

Most people don't use Photoshop to its fullest capabilities. Here... Read More

Microsoft Great Plains IV: Inventory Management

Great Plains Inventory Management (IV) module gives your business a... Read More

Microsoft Great Plains Partner Selection: Overview

Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More

Kick-Ass Performance For Your PC? Its Easy

Is your PC is slow and wimpy? Then you need... Read More

ERP for Large Corporation ? New Selling Strategy

Our opinion is based on our Microsoft Business Solutions Great... Read More

Free Software for Newbies and Web Developers

Here is some free software tools to help you build... Read More

Software Upgrades Arent Always the Best Move

When my daughter was getting into AOL instant messaging (AIM)... Read More

Microsoft Small Business Manager eCommerce ? Overview

Microsoft Business Solutions Small Business Manager is scaled down Great... Read More

Groove Network. Are you in it?

If you are in a business that passes documents around... Read More

Fundraising Software ? How Can That Help Me?

Fundraising software lets you connect with donors in a way... Read More

Microsoft Great Plains Customization Recovery & Upgrade for Large Corporation

At the end of XX century, in the late 1990th... Read More

Windows x: Basic Windows ?Security? Issues

Language development computer: Computer-based method for aiding language development seems... Read More

Microsoft Great Plains Inventory Control ? Overview For Consultant

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

Great Plains Dexterity ? Microsoft Great Plains Customization Overview

Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More

Lotus Domino: Reports and Connectors ? Crystal Reports, XML, ODBC/JDBC, OLE

Lotus Notes Domino is very efficient in electronic document workflow... Read More

Intro to UNIX Shells

A UNIX Shell is in simplest terms, a command line... Read More

A Case Study on Selecting Contract Management Software

Professional services firm cuts costs and improves productivity with integrated... Read More

Instant Messenger Clients

If you have been using the Internet for any amount... Read More

Microsoft RMS ? Great Plains Integration ? Overview For IT Specialist

Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More

Aledo wedding limo ..