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 our small article we'll consider Microsoft Business Solutions Great... Read More
Looks like Microsoft Great Plains becomes more and more... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Microsoft Great Plains serves the wide spectrum of horizontal markets.... Read More
So, why should you use any O/R mapping tool? I... Read More
It is now common thing when large corporation selects mid-market... Read More
Pirated software is on the increase and now accounts for... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
Microsoft Great Plains is now targeting large and midsize businesses... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
This article illustrates the best practices to improve the performance... Read More
When you double-click a layer in the Layer Palette, you... Read More
Hi, Guys,I believe a lot of programmers are trying to... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
I have always had a tendency to focus on the... Read More
Are you lost in the mess of documents that get... Read More
If you are software developer or database administrator - we... Read More
The objective for Zandi Digital is to make available clever... Read More
Features Additionally, Vista will include many other new features.Aero Vista... Read More
Microsoft Outlook is one of the most widely used software... Read More
Microsoft Business Solutions Navision serves both European and American megamarkets.... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
We'll give you non formal view, based on our consulting... Read More
Fortunately one of the most common reasons cited for the... Read More
house cleaning company Bannockburn ..If your company has regional and worldwide operations, you might... Read More
Bar charts, bar graphs, and any other chart or graph... Read More
We live in a post-industrial age where information is the... Read More
Customer Relationship Management (CRM) is a strategy and processes used... Read More
Microsoft-Outlook is a pretty amazing program. So much more than... Read More
For a long time now Microsoft's Internet Explorer has ruled... Read More
C/SIDE (Client/Server Integrated Development Environment) - The core of... Read More
An operating system (abbreviated OS) is essentially the path through... Read More
Professional services firm cuts costs and improves productivity with integrated... Read More
We all already got used to computer monitoring both at... Read More
There are certain pluses and minuses in both cases and... Read More
Fortunately one of the most common reasons cited for the... Read More
Follow the steps below to quickly design, generate, and deploy... Read More
Many Webmasters have never bothered to view their website's server... Read More
If you feel intimidated when someone tries to teach you... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
The COSMIC FP (function point) software quality metric, is no... Read More
Words we choose to describe things and phenomena often show... Read More
With the advent of 'Service Pack 2' for Windows XP... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
Finally, you have some time to personalize your desktop with... Read More
There are two approaches for application integration:? Programmer's approach ?... Read More
Microsoft Great Plains is one of the Microsoft Business Solutions... Read More
Anyone who has ever used Microsoft Word knows that it... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
Software |