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
![]() |
|
![]() |
|
![]() |
|
![]() |
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Did you ever give a thought to the number of... Read More
Bill of Lading is required report for Logistics and Freight... Read More
Should one use Windows Update?This topic has good and valid... Read More
You would like to protect your documents, wouldn't you? Reasons... Read More
The major reason I recommend getting your hands on real... Read More
We would like to give you pluses and minuses of... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
Microsoft CRM is CRM answer from Microsoft and attempt to... Read More
Microsoft SQL Server is the leader for inexpensive and middle... Read More
The intentions of this short tutorial are not to teach... Read More
Microsoft Business Solutions Great Plains as new ERP for multinational... Read More
While several preventive maintenance software manufacturers offer free trials for... Read More
.NET platform does not support multiple inheritance. Do not confuse... Read More
How do you run a program on a remote server... Read More
Remember old good days when your company probably had Great... Read More
The title of "software engineer" has got to be among... Read More
Writing software manuals is boring, isn't it? We often think:... Read More
Several software companies design programs for preventive maintenance. Most of... Read More
When Windows fails to boot it is normally caused by... Read More
Not every software testing project can or should be automated.... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
Microsoft Business Solutions Great Plains is very generic accounting application... Read More
Crystal Reports is the most flexible tool on the market... Read More
Viruses and spyware usually show up on your computer one... Read More
Let's first look at your ERP system selection (without Retail... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
Microsoft Great Plains serves the wide spectrum of horizontal markets.... Read More
Creating a new markup language.Introduction.General Reuse Markup Langauge, or GRML,... Read More
While I was in college, if you would have asked... Read More
Before September 1995, Microsoft Windows was an MS-DOS program. DOS... Read More
This tutorial covers OLAP solutions used by Data warehouses and... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
In this small article we will show you the possible... Read More
If you have Great Plains Dynamics/eEnterprise (version 6.0 or earlier)... Read More
eStore Advantage allows front-office applications to communicate with back-office business... Read More
Microsoft Business Solutions Great Plains version 8.5, 8.0, 7.5, Great... Read More
Accounts payable is just one area of office management where... Read More
Microsoft Client Relation Management system (Microsoft CRM) and Microsoft RMS... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
Shareware is software that you can try before you buy;... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
Before September 1995, Microsoft Windows was an MS-DOS program. DOS... Read More
Need help making sense of algebra? Have algebra lectures in... Read More
When you own a small business, time is money. And... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
For a long time now Microsoft's Internet Explorer has ruled... Read More
Configuring PPP PAP AuthenticationNow we know how the ISDN link... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More
Microsoft Word is one of the most popular office applications... Read More
Finally, you have some time to personalize your desktop with... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions. If... Read More
Google Inc. has launched a new software package that allows... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
While Ukraine is becoming a new popular IT outsourcing destination,... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
User interfaces and accessibility are some of the most important... Read More
Microsoft Great Plains may be recommended for international freight forwarding... Read More
The Windows registry is a huge database that ensures normal... Read More
A UNIX Shell is in simplest terms, a command line... Read More
There are certain pluses and minuses in both cases and... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
Software |