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
efficient cleaning crew Northbrook ..Running Applications in Compatibility Mode With Windows XP, you can... Read More
In the Clinton era the status quo was simple: you... Read More
Introduction: The creating of a computer program involves a number... Read More
Many Webmasters have never bothered to view their website's server... Read More
Microsoft Word is one of the most popular office applications... Read More
This is a short article, written in question/answer/FAQ style to... Read More
It???s easy to understand why you might be drawn to... Read More
For those who are unclear on the differences between the... Read More
Microsoft Business Solutions Great Plains serves to the wide spectrum... Read More
If you look back to the history, you will see... Read More
IntroductionDuring the early years of our modern computer era, very... Read More
Microsoft Great Plains is now standard mid-market ERP application, serving... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
One of the things we can be as certain of... Read More
Just the thought of a duel-boot scares many people away,... Read More
It's no secret that software companies operate in a very... Read More
Beginning with Domino version R4 it has integration with the... Read More
Former Great Plains Software Dynamics/eEnterprise and currently Microsoft Business Solutions... Read More
Microsoft CRM is now on the scene and it is... Read More
.NET platform does not support multiple inheritance. Do not confuse... Read More
Bill of Lading is required report for Logistics and Freight... Read More
Microsoft Great Plains is becoming more and more popular and... Read More
The intentions of this short tutorial are not to teach... Read More
Every day millions of new web documents emerge on the... Read More
cleaning lady near Wilmette ..Once upon a time not so long ago, there was... Read More
You probably didn't casually invite, or extend a formal attendance... Read More
Microsoft Business Solutions ? Great Plains is designed to meet... Read More
ERP is the acronym of Enterprise Resource Planning. Multi-module ERP... Read More
The most important things you can do for your computer... Read More
We were recently faced with a decision: either to let... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
User interfaces and accessibility are some of the most important... Read More
Program Flow is what you think it is. How the... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
DBxtra is a powerful query and reporting tool that hides... Read More
Microsoft Business Solutions Great Plains is very good fit for... Read More
Microsoft CRM has built-in conversion tool, however you should probably... Read More
Just stress testing one of the latest Linux distributions. Been... Read More
A LOT OF UNWANTED FILES.When you uninstall an item of... Read More
Great Plains Inventory Management (IV) module gives your business a... Read More
... Read More
In our opinion, traditional approach when you select ERP/MRP system... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
.NET platform does not support multiple inheritance. Do not confuse... Read More
All your software is stored on a hard-drive. But how... Read More
As you probably know, when Microsoft purchased Great Plains Software... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
You might think you don't need a firewall... Read More
When reading an article where some term is used often,... Read More
Software |