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
disinfecting cleaning services Winnetka ..For those who still don't know, Microsoft Publisher helps computer... Read More
Think of this, first we had the HAM Radio, then... Read More
NOTE: Please take time to read on - it may... Read More
Most people don't use Photoshop to its fullest capabilities. Here... Read More
Every day millions of new web documents emerge on the... Read More
Microsoft Retail Management (RMS) and Microsoft Great Plains are retail... Read More
You probably didn't casually invite, or extend a formal attendance... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
What is Tripwire?Tripwire is a form intrusion detection system (IDS)... Read More
I have recently created my first Php program. I wanted... Read More
An operating system (abbreviated OS) is essentially the path through... Read More
While several preventive maintenance software manufacturers offer free trials for... Read More
As you probably know, when Microsoft purchased Great Plains Software... Read More
Some introduction into Great Plains Software products, now Microsoft Business... Read More
While I was in college, if you would have asked... Read More
In this small article we will be looking at the... Read More
Microsoft CRM is CRM answer from Microsoft and attempt to... Read More
Microsoft CRM is winning market share step-by-step from such the... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
The term "document management" and "paperless office" is the subject... Read More
In this small article we will show you the possible... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Viruses and spyware usually show up on your computer one... Read More
DBxtra is a powerful query and reporting tool that hides... Read More
TCO (Total Cost Ownership) is the buzzword in... Read More
last minute cleaning help Highland Park ..Several years ago Microsoft purchased Great Plains Software, then Navision... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
When it comes to screenplay software each screenwriter needs to... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
In our case ? we serve Microsoft Business Solutions ERP... Read More
What is Tripwire?Tripwire is a form intrusion detection system (IDS)... Read More
Handling character strings in Java is supported through two final... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
This article illustrates the best practices to improve the performance... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Microsoft CRM has built-in conversion tool, however you should probably... Read More
Microsoft Business Solutions Small Business Manager is Great Plains Dexterity... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
I completed an experiment recently. I wanted to find out... Read More
In this short FAQ style article we would like to... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
When reading an article where some term is used often,... Read More
An integral part of any quality CRM system is lead... Read More
Microsoft Business Solutions ? Navision is an integrated solution for... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
With any good luck and a good amount of hard... Read More
Beginning with Domino version R4 it has integration with the... Read More
If you use Microsoft Outlook (or similar applications) for e-mailing,... Read More
I provide, here clear explanations and a count of function... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
Software |