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 ..Document Management or Enterprise Information Management is perhaps one of... Read More
Music downloads are off the charts! We're listening to digital... Read More
So, you've bought a new Macintosh, and now you may... Read More
Microsoft Business Solutions offers several ERP applications: Great Plains, Navision,... Read More
The Windows registry is a huge database that ensures normal... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More
XML Server can be a Web Server that stores the... Read More
As seeing large number of implementations ? in our case... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
Anyone who has ever used Microsoft Word knows that it... Read More
In this article you will find some background information about... Read More
Programming Help for BeginnersWe write programs to instruct computers. When... Read More
Have you ever noticed that when you look at your... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
I completed an experiment recently. I wanted to find out... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
Did you ever want to erase everything on your computer?... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
To all web designers out there, this article is for... Read More
We will base our prognosis on our Microsoft Business Solutions... Read More
Microsoft Business Solutions Great Plains is very popular ERP/MRP applications... Read More
The term "document management" and "paperless office" is the subject... Read More
The world of small business accounting software can be a... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
cleaning lady near Wilmette ..I have always had a tendency to focus on the... Read More
Microsoft has never released a service pack for Windows98 SE,... Read More
It could just be me, but my experiences with document... Read More
What is 'adware'?Adware is basically software or scripts that are... Read More
Adobe Photoshop is one of the world's leading graphics editing... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
XML Server can be a Web Server that stores the... Read More
The vast majority of us will have, at some point,... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
Just the thought of a duel-boot scares many people away,... Read More
MSN messenger is a pretty cool invention. I mean I'm... Read More
It's not very often I get excited about a software... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
This is intermediate level SQL scripting article for DB Administrator,... Read More
If you are in the market for new staffing software,... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
Background: For many organizations like ours, the interim target of... Read More
Microsoft CRM is CRM application, maintained and supported by Microsoft... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
Microsoft Business Solutions Great Plains is very generic accounting application... Read More
1. What determines the software price? Is it Per Seat... Read More
The objective for Zandi Digital is to make available clever... Read More
Google Inc. has launched a new software package that allows... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Software |