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
house refresh service Lincolnshire ..Customer Relationship Management (CRM) is a strategy and processes used... Read More
I love new technology. I am still ready to wait... Read More
How do you run a program on a remote server... Read More
If your company has regional and worldwide operations, you might... Read More
We'll give you non formal view, based on our consulting... Read More
You might think you don't need a firewall... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
For those who still don't know, Microsoft Publisher helps computer... Read More
Ok... Where to start?Well, I guess I will start at... Read More
While several preventive maintenance software manufacturers offer free trials for... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
One of the main reasons business owners and entrepreneurs use... Read More
Sales are all about leverage, because there is only so... Read More
Great Plains Integration Manager scripting and translation - overview for... Read More
The research in the field of Natural Language Processing usually... Read More
An integral part of any quality CRM system is lead... Read More
Trying to figure out a stream in banning one email... Read More
Small can be beautiful! Working with Knoppix for the past... Read More
Traditionally we were considering functionally rich systems, such as SAP,... Read More
This is intermediate level SQL scripting article for DB Administrator,... Read More
A few months back I really got sick of my... Read More
MSN messenger is a pretty cool invention. I mean I'm... Read More
At the end of XX century, in the late 1990th... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
If you look back to the history, you will see... Read More
licensed cleaning services Lake Forest ..DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
Not every software testing project can or should be automated.... Read More
Microsoft Word is one of the most popular office applications... Read More
The stakes are high when considering security, privacy, and savings,... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
Do you want to get quality software at a reasonable... Read More
The most important benefit of XML is its simplicity. Though... Read More
It's no secret that software companies operate in a very... Read More
Hey Guys! Don't raise your eyebrows or fear by hearing... Read More
Microsoft Business Solutions Great Plains version 8.5, 8.0, 7.5, Great... Read More
Small can be beautiful! Working with Knoppix for the past... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
There are so many different programs that clutter up your... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
The first thing that you will notice about Linux Red... Read More
When Windows fails to boot it is normally caused by... Read More
What is Snort?Snort is an open source network intrusion detection... Read More
Most computer users use spreadsheets software such as Microsoft Excel... Read More
We were recently faced with a decision: either to let... Read More
Adobe Photoshop is one of the world's leading graphics editing... Read More
In our opinion, traditional approach when you select ERP/MRP system... Read More
#5 All your hardware components like Printers, PCs etc come... Read More
Almost all new and major brand of PCs come with... Read More
If you feel intimidated when someone tries to teach you... Read More
In the previous ISDN article, we looked at how and... Read More
Software |