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
professional maid services Deerfield ..Three highly respected names in Human Resources have joined forces... Read More
"Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
All your software is stored on a hard-drive. But how... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
There are two major WYSIWYG(What You See Is What You... Read More
The Internet is reshaping every form of communications medium, and... Read More
Many Webmasters have never bothered to view their website's server... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
It's all about turn times in the eMedia industry! The... Read More
Let us give you - developer some hints in the... Read More
Our hosted solution allow you to run your own search... Read More
We all already got used to computer monitoring both at... Read More
In our case ? we serve Microsoft Business Solutions ERP... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Spyware is software or hardware installed on a computer without... Read More
The cornerstone of successful automated office systems is the ability... Read More
Microsoft Word is one of the most popular office applications... Read More
Finally, you have some time to personalize your desktop with... Read More
If you copy something from a Web site or elsewhere...... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions CRM is web-based CRM application, deploying all... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More
quick home cleaning Lake Forest .."Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More
There is many things more frustrating than surfing a website... Read More
When you double-click a layer in the Layer Palette, you... Read More
Some introduction into Great Plains Software products, now Microsoft Business... Read More
Currently Microsoft Business Solutions is on the way of creating... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
Once a business idea is selected, it is highly recommended... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
Intro This concise article will tell you in plain English... Read More
Designing without tables by using CSS layouts is fast becoming... Read More
First we had the original Google search that evolved into... Read More
Introduction To ISDN, Part III: Configuring PPP PAP AuthenticationNow we... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
Microsoft Business Solutions Great Plains has Project Accounting module where... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
With many manufacturing shops heading over seas in favor of... Read More
All your software is stored on a hard-drive. But how... Read More
Usually workflow & messaging is realized in CRM and then... Read More
Some companies that are in need of fleet management may... Read More
We would like to give you several situations, when you... Read More
Pirated software is on the increase and now accounts for... Read More
The software giants don't do everything and don't always produce... Read More
Now is the time to look at an alternative to... Read More
Document Management or Enterprise Information Management is perhaps one of... Read More
Software |