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
elite cleaning services Mundelein ..Using professional icons in your application or website can bring... Read More
Customer Relationship Management (CRM) is a strategy and processes used... Read More
Hey Guys! Don't raise your eyebrows or fear by hearing... Read More
Microsoft Great Plains is now targeting large and midsize businesses... Read More
This article is the third of a series of articles... Read More
Google Inc. has launched a new software package that allows... Read More
If you feel intimidated when someone tries to teach you... Read More
This is a short article, written in question/answer/FAQ style to... Read More
Microsoft Business Solutions Great Plains and MS CRM (client relation... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
Beginning with Domino version R4 it has integration with the... Read More
The major reason I recommend getting your hands on real... Read More
Blue Cross and Blue Shield of Hawaii (HMSA) found itself... Read More
Remember old good days when your company probably had Great... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
Our hosted solution allow you to run your own search... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More
If you have Microsoft Great Plains and support it for... Read More
Professional services firm cuts costs and improves productivity with integrated... Read More
I have yet to see a business that, sometimes in... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
Looking at all the ads which promise to get rid... Read More
When making a decision to buy any piece of software... Read More
Microsoft Business Solutions Great Plains was historically designed to serve... Read More
Airbnb cleaning service Mundelein ..Domino server is a buffer between the operation system and... Read More
Microsoft Business Solutions Great Plains is written in Great Plains... Read More
All of us know that Microsoft bought former Great Plains... Read More
The most important benefit of XML is its simplicity. Though... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
Microsoft has never released a service pack for Windows98 SE,... Read More
The first thing that you will notice about Linux Red... Read More
If you are in the market for new staffing software,... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
While paper labeling CDs and DVDs may appear to be... Read More
MS CRM is very close to document workflow automation, including... Read More
It's no secret that software companies operate in a very... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
If you company is small or mid-size special products or... Read More
While Ukraine is becoming a new popular IT outsourcing destination,... Read More
Is your PC is slow and wimpy? Then you need... Read More
Our hosted solution allow you to run your own search... Read More
Most people don't use Photoshop to its fullest capabilities. Here... Read More
The vast majority of us will have, at some point,... Read More
For a windows user like me, just can watch with... Read More
Looking at all the ads which promise to get rid... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
In order to meet regulatory and corporate compliance requirements reporting... Read More
Software |