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
|
|
|
|
|
|
|
|
|
|
|


In the early days of the personal computer, we're talking... Read More
Do you remember that frustrating feeling when you find an... Read More
Manufacturing in the USA is far away down from mid... Read More
We would like to give you several situations, when you... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
Well, even if the combination might look very unusual, we... Read More
Not all of us have the luxury of working both... Read More
Anyone who has ever used Microsoft Word knows that it... Read More
2005 ? Back to the Future.What does the future hold?... Read More
Microsoft Business Solutions Small Business Manager is Great Plains Dexterity... Read More
In this short FAQ style article we would like to... Read More
Ok... Where to start?Well, I guess I will start at... Read More
Looks like Microsoft Great Plains becomes more and more... Read More
The first thing that you will notice about Linux Red... Read More
Bar charts, bar graphs, and any other chart or graph... Read More
MicroWorld Technologies, Inc. the leading solutions provider in the area... Read More
Cyberspace has opened up a new frontier with exciting possibilities... Read More
Following tips help you to learn a software in lesser... Read More
While I was in college, if you would have asked... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
Google Inc. has launched a new software package that allows... Read More
Several years ago Microsoft purchased Great Plains Software, then Navision... Read More
This article is the first of a series of articles... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
Trying to figure out a stream in banning one email... Read More
Remember nice and prosperous Clinton era? When you implemented innovative... Read More
A few months back I really got sick of my... Read More
Java has come along a long way. Many would agree... Read More
Customer Relationship Management or CRM is a combination of enterprise... Read More
I've been active in the Cisco Certification track for four... Read More
When Great Plains Software introduced the first graphical accounting application... Read More
While Ukraine is becoming a new popular IT outsourcing destination,... Read More


Our hosted solution allow you to run your own search... Read More
Let's say that you have a software project that's under... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
When you own a small business, time is money. And... Read More
Program Flow is what you think it is. How the... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
How many steps does it take you to locate and... Read More
Assertion facility is added in J2SE 1.4. In order to... Read More
Great Plains Software Dynamics, Dynamics C/S+, eEnterprise were written on... Read More
I completed an experiment recently. I wanted to find out... Read More
Fundraising software lets you connect with donors in a way... Read More
Research bears that less than 70 percent of development projects... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
Looks like Microsoft Great Plains becomes more... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
If you have Microsoft Great Plains and support it for... Read More
Make-or-Break Factors in Success and ProfitabilityFor quick printers, estimating can... Read More
I've been active in the Cisco Certification track for four... Read More
What is Interactive Mapping?Interactive mapping is a visual display medium... Read More
In part III of this ISDN primer, we learned that... Read More
Microsoft Great Plains and Microsoft CRM become more and more... Read More
Spyware and malware are large problems for Internet users today... Read More
Microsoft Business Solutions Great Plains is very popular ERP/MRP applications... Read More
Around the same time Microsoft made its move with .Net... Read More
The adware and spyware definitions list is very long. But... Read More
Current Microsoft Business Solutions Great Plains has more that 10... Read More
Shareware has been fighting the stigma of being misunderstood for... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
In the previous ISDN article, we looked at how and... Read More
When it comes to screenplay software each screenwriter needs to... Read More
Currently Microsoft Business Solutions is on the way of creating... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
We were recently faced with a decision: either to let... Read More
Software |