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
Mokena prom limo .. Lockport Chicago limo O’HareRapid Application Development (RAD) is a software development methodology. In... Read More
The most important things you can do for your computer... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
Microsoft CRM is CRM answer from Microsoft and attempt to... Read More
In this short FAQ style article we would like to... Read More
To all web designers out there, this article is for... Read More
Beginning with Domino version R4 it has integration with the... Read More
What is 'adware'?Adware is basically software or scripts that are... Read More
What is Software?Software is a set of instruction written to... Read More
Passwords protect your most sensitive personal, financial and business information.... Read More
"Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More
1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More
Microsoft Business Solutions Small Business Manager is Great Plains Dexterity... Read More
SyncUp, a file synchronizer is designed to assist the home... Read More
Well, even if the combination might look very unusual, we... Read More
Crystal Reports is the most flexible tool on the market... Read More
Document Management or Enterprise Information Management is perhaps one of... Read More
Microsoft CRM is now on the scene and it is... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
Here is some free software tools to help you build... Read More
An operating system (abbreviated OS) is essentially the path through... Read More
In this small article we will show you the possible... Read More
Program Flow is what you think it is. How the... Read More
I started using PIP (Picture It Publishing) Platinum 2002 right... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Mokena Chicago limo O'Hare ..Need software to record your voice, streaming audio or musical... Read More
So, why should you use any O/R mapping tool? I... Read More
Great Plains Purchase Order Processing (POP) module makes up one-third... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
In the early days of the personal computer, we're talking... Read More
User interfaces and accessibility are some of the most important... Read More
Looks like Microsoft Great Plains becomes more... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Microsoft Business Solutions Great Plains, Solomon, Navision, Axapta, Microsoft CRM... Read More
Current Microsoft Business Solutions Great Plains has more that 10... Read More
Software development is a risky business.Many software developers are barely... Read More
Here is some free software tools to help you build... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software eEnterprise,... Read More
Introduction To ISDN, Part III: Configuring PPP PAP AuthenticationNow we... Read More
Homeland security, airport security, Internet security ??" these days we???re... Read More
1. What determines the software price? Is it Per Seat... Read More
Imagine something that follows you home and sets itself up... Read More
Anyone who has ever used Microsoft Word knows that it... Read More
Vince Lombardi once said that, "The achievements of an organization... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
IntroductionPHP can be used for a lot of different things,... Read More
TCO (Total Cost Ownership) is the buzzword in... Read More
If your company has regional and worldwide operations, you might... Read More
Software |