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
Airbnb cleaning service Glenview ..I love new technology. I am still ready to wait... Read More
Microsoft Great Plains, former Great Plains Software Dynamics / eEnterprise... Read More
Vince Lombardi once said that, "The achievements of an organization... Read More
MS CRM is very close to document workflow automation, including... Read More
If there still are few unprotected computers left, I haven't... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
The purpose of Project Management Software is to provide an... Read More
If you have Microsoft Great Plains and support it... Read More
In our small article we'll consider Microsoft Business Solutions Great... Read More
So let's begin crunching down these 300 images using Adobe... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
The stakes are high when considering security, privacy, and savings,... Read More
Need software to record your voice, streaming audio or musical... Read More
What is IRC?IRC is Internet Relay Chat. It is a... Read More
Document Management or Enterprise Information Management is perhaps one of... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
In part III of this ISDN primer, we learned that... Read More
Google Inc. has launched a new software package that allows... Read More
In linux, one of great commands for finding out information... Read More
ERP Consulting industry is on the way to serve clients... Read More
Let us give you - developer some hints in the... Read More
We all already got used to computer monitoring both at... Read More
A wiki is an editable text-based website. But you don't... Read More
Microsoft Business Solutions Great Plains might be considered as ERP... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
efficient cleaning crew Highland Park ..This short paper will expand on two key reasons to... Read More
Microsoft Great Plains could be tuned and setup to fit... Read More
The Windows registry is a huge database that ensures normal... Read More
I started using PIP (Picture It Publishing) Platinum 2002 right... Read More
When you buy a computer, it most likely comes with... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Trying to figure out a stream in banning one email... Read More
The first topic we are going to discuss... Read More
Research bears that less than 70 percent of development projects... Read More
Microsoft Great Plains, designed back in 1990th as database transferable... Read More
With this small article we are continuing Microsoft Business Solutions... Read More
What is Groupware?Have you ever had to manage document collaboration... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software eEnterprise,... Read More
If you have been using the Internet for any amount... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More
Microsoft Business Solutions is emerging as very attractive vendor for... Read More
Having from five to ten and more favorite screensavers is... Read More
Microsoft Great Plains as ERP and Microsoft CRM as... Read More
Before being able to choose a secure Internet communication system,... Read More
If you look back to the history, you will see... Read More
This tutorial covers OLAP solutions used by Data warehouses and... Read More
Although we don't know whether Microsoft ever envisioned such a... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Here is some free software tools to help you build... Read More
Software |