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
weekly home cleaning Highland Park ..Considering whether or not your software company should hire a... Read More
This is the tutorial where we really get into programming.... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
Hi, Guys,I believe a lot of programmers are trying to... Read More
Domino server is a buffer between the operation system and... Read More
The most important things you can do for your computer... Read More
Before being able to choose a secure Internet communication system,... Read More
When it comes to running an office, the SOHO entrepreneur... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
First we had the original Google search that evolved into... Read More
Just when you thought you were Web savvy, one more... Read More
Not all of us have the luxury of working both... Read More
In our case ? we serve Microsoft Business Solutions ERP... Read More
A UNIX Shell is in simplest terms, a command line... Read More
The stakes are high when considering security, privacy, and savings,... Read More
If you are to buy a HelpDesk & Asset Management... Read More
Linux essentials:It's free for download but you have to pay... Read More
If you have been using the Internet for any amount... Read More
Microsoft Business Solutions Great Plains version 8.5, 8.0, 7.5, Great... Read More
Icons are used everywhere; right from software applications, to internet... Read More
Our hosted solution allow you to run your own search... Read More
Manufacturing in the USA is far away down from mid... Read More
Combining Microsoft Business Solutions Great Plains ERP with non-Microsoft Business... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
ERP is the acronym of Enterprise Resource Planning. Multi-module ERP... Read More
whole house cleaning Park Ridge ..A few months back I really got sick of my... Read More
Pirated software is on the increase and now accounts for... Read More
Microsoft CRM is new player on the CRM software... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
This article is for advanced Microsoft CRM SDK C# developers.... Read More
For those who still don't know, Microsoft Publisher helps computer... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions Great Plains fits to majority of horizontal... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Business Solutions is emerging as very attractive vendor for... Read More
You probably didn't casually invite, or extend a formal attendance... Read More
Microsoft Business Solutions Great Plains serves to the wide spectrum... Read More
Lotus Notes Domino is very efficient in electronic document workflow... Read More
While I was in college, if you would have asked... Read More
Although we don't know whether Microsoft ever envisioned such a... Read More
Features Additionally, Vista will include many other new features.Aero Vista... Read More
According to a survey conducted by InfoTrends/CAP Ventures entitled "Content-Centric... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Innovative Maintenance Systems (IMS) is one company that offers solutions... Read More
In a previous article, I wrote about OpenOffice... Read More
Remember back in the days where screensavers were the coolest... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
COMMAND LINE FUNCTIONA powerful command line script processor has been... Read More
Software |