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
express cleaning service Arlington Heights ..Since Version 8.0 Microsoft Business Solutions Great Plains & Great... Read More
If you have Microsoft Great Plains and support it... Read More
Features Additionally, Vista will include many other new features.Aero Vista... Read More
So, you've bought a new Macintosh, and now you may... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
I have recently created my first Php program. I wanted... Read More
With many manufacturing shops heading over seas in favor of... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
Microsoft CRM customization techniques are very diversified and based on... Read More
... Read More
Microsoft Business Solutions Great Plains has I'd say end user... Read More
The first topic we are going to discuss... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
Remember nice and prosperous Clinton era? When you implemented innovative... Read More
I love new technology. I am still ready to wait... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
(1) Avoid using the same variable again and again for... Read More
Domino server is a buffer between the operation system and... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
NOTE: Please take time to read on - it may... Read More
Looking at all the ads which promise to get rid... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
Heard about the Quark "killer"?Adobe InDesign CS2. Will it really... Read More
Creating a new markup language.Introduction.General Reuse Markup Langauge, or GRML,... Read More
tidy up service Arlington Heights ..Lotus Notes Domino is very efficient in electronic document workflow... Read More
While several preventive maintenance software manufacturers offer free trials for... Read More
Programming Help for BeginnersWe write programs to instruct computers. When... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More
IntroductionPHP can be used for a lot of different things,... Read More
Assertion facility is added in J2SE 1.4. In order to... Read More
SAP Inc., a global leader in client/server enterprise application software... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Upgrading. Downtime. Maintenance. Hardware obsolescence. Implementation issues. The litany of... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
Microsoft Business Solutions CRM is web-based CRM application, deploying all... Read More
We were recently faced with a decision: either to let... Read More
Using professional icons in your application or website can bring... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
Three highly respected names in Human Resources have joined forces... Read More
Logistics automation is often considered as barcoding extension to Sales... Read More
What is Tripwire?Tripwire is a form intrusion detection system (IDS)... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
Our opinion is based on our Microsoft Business Solutions Great... Read More
Follow the steps below to quickly design, generate, and deploy... Read More
Fleet Maintenance Management is a critical position in any company... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
MicroWorld Technologies, Inc. the leading solutions provider in the area... Read More
What is Snort?Snort is an open source network intrusion detection... Read More
Software |