Software Information



Articles Main Page | Main Site Home Page





Text Ad's by TextAdPro.com
Make Money For Real doing nothing - 3 ways to profit - EZmatic.com.

ThatsNeato.com - That's Neato!

Home Business Money Making - How to make money on the net.

2coolhair.com - Over 5,000 Hairstyles Pitcures.



Great Plains Customization - Programming Auto-apply in Accounts Receivable


Microsoft Great Plains is one of three Microsoft Business Solutions mid-market ERP products: Great Plains, Solomon, Navision. Considering that Great Plains is now very good candidate for integration with POS application, such as Microsoft Retail Management System or RMS and Client Relation Systems, such as Microsoft CRM - there is common need in Great Plains customizations and integrations, especially on the level of MS SQL Server transact SQL queries and stored procedures.

In this small article we'll show you how to create auto-apply utility, when you integrate huge number of sales transactions and payments. We will be working with RM20101 - Receivables Open File and RM20201 - Receivables Apply Open File.

Let's see SQL code:

declare @curpmtamt numeric(19,5)

declare @curinvamt numeric(19,5)

declare @curpmtnum varchar(20)

declare @curinvnum varchar(20)

declare @curinvtype int

declare @curpmttype int

declare @maxid int

declare @counter int

-- Create a temporary table

create table #temp

(

[ID] int identity(1,1) primary key,

CUSTNMBR varchar(15),

INVNUM varchar(20),

INVTYPE int,

PMTNUM varchar(20),

PMTTYPE int,

INVAMT numeric(19,5),

PMTAMT numeric(19,5),

AMTAPPLIED numeric(19,5)

)

create index IDX_INVNUM on #temp (INVNUM)

create index IDX_PMTNUM on #temp (PMTNUM)

-- Insert unapplied invoices and payments

insert into #temp

(

CUSTNMBR,

INVNUM,

INVTYPE,

PMTNUM,

PMTTYPE,

INVAMT,

PMTAMT,

AMTAPPLIED

)

select

CUSTNMBR = a.CUSTNMBR,

INVNUM = b.DOCNUMBR,

INVTYPE = b.RMDTYPAL,

PMTNUM = a.DOCNUMBR,

PMTTYPE = a.RMDTYPAL,

INVAMT = b.CURTRXAM,

PMTAMT = a.CURTRXAM,

AMTAPPLIED = 0

from RM20101 a

join RM20101 b on (a.CUSTNMBR = b.CUSTNMBR)

join RM00101 c on (a.CUSTNMBR = c.CUSTNMBR)

where

a.RMDTYPAL in (7, 8, 9) and

b.RMDTYPAL in (1, 3) and

a.CURTRXAM 0 and

b.CURTRXAM 0

order by

a.custnmbr,

b.DOCDATE,

a.DOCDATE,

a.DOCNUMBR,

b.DOCNUMBR

-- Iterate through each record

select @maxid = max([ID])

from #temp

select @counter = 1

while @counter = @curpmtamt) and (@curpmtamt>0) and (@curinvamt>0)-- if the invoice amount is greater or the same as the payment amount

begin

select @curinvamt = @curinvamt - @curpmtamt -- invoice amount remaining

-- update with the amount that is applied to the current invoice from

-- the current payment

update #temp

set

AMTAPPLIED = @curpmtamt

where

[ID] = @counter

-- update with amount of invoice remaining

update #temp

set

INVAMT = @curinvamt

where

INVNUM = @curinvnum and

INVTYPE = @curinvtype

-- update with amount of payment remaining

update #temp

set

PMTAMT = 0

where

PMTNUM = @curpmtnum and

PMTTYPE = @curpmttype

end

else if (@curinvamt 0) and (@curinvamt>0)-- if the invoice amount is lesser to the payment amount

begin

select @curpmtamt = @curpmtamt - @curinvamt -- payment amount remaining

-- update with the amount that is applied to the current invoice from

-- the current payment

update #temp

set

AMTAPPLIED = @curinvamt

where

[ID] = @counter

-- update with amount of invoice remaining

update #temp

set

INVAMT = 0

where

INVNUM = @curinvnum and

INVTYPE = @curinvtype

-- update with amount of payment remaining

update #temp

set

PMTAMT = @curpmtamt

where

PMTNUM = @curpmtnum and

PMTTYPE = @curpmttype

end

-- go to the next record

select @counter = @counter + 1

end

-- update the RM Open table with the correct amounts

update

RM20101

set

CURTRXAM = b.INVAMT

from

RM20101 a

join #temp b on (a.DOCNUMBR = b.INVNUM and a.RMDTYPAL = b.INVTYPE)

update

RM20101

set

CURTRXAM = b.PMTAMT

from

RM20101 a

join #temp b on (a.DOCNUMBR = b.PMTNUM and a.RMDTYPAL = b.PMTTYPE)

-- create the RM Apply record or update if records already exist

update

RM20201

set

DATE1 = convert(varchar(10), getdate(), 101),

GLPOSTDT = convert(varchar(10), getdate(), 101),

APPTOAMT = APPTOAMT + a.AMTAPPLIED,

ORAPTOAM = ORAPTOAM + a.AMTAPPLIED,

APFRMAPLYAMT = APFRMAPLYAMT + a.AMTAPPLIED,

ActualApplyToAmount = APFRMAPLYAMT + a.AMTAPPLIED

from

#temp a

join RM20101 b on (b.DOCNUMBR = a.INVNUM and b.RMDTYPAL = a.INVTYPE)

join RM20101 c on (c.DOCNUMBR = a.PMTNUM and c.RMDTYPAL = a.PMTTYPE)

join RM20201 d on (d.APFRDCTY = a.PMTTYPE and

d.APFRDCNM = a.PMTNUM and

d.APTODCTY = a.INVTYPE and

d.APTODCNM = a.INVNUM)

where

a.AMTAPPLIED 0

insert into RM20201

(CUSTNMBR,

DATE1,

GLPOSTDT,

POSTED,

APTODCNM,

APTODCTY,

APTODCDT,

ApplyToGLPostDate,

CURNCYID,

CURRNIDX,

APPTOAMT,

ORAPTOAM,

APFRDCNM,

APFRDCTY,

APFRDCDT,

ApplyFromGLPostDate,

FROMCURR,

APFRMAPLYAMT,

ActualApplyToAmount)

select

CUSTNMBR = a.CUSTNMBR,

DATE1 = convert(varchar(10), getdate(), 101),

GLPOSTDT = convert(varchar(10), getdate(), 101),

POSTED = 1,

APTODCNM = a.INVNUM,

APTODCTY = a.INVTYPE,

APTODCDT = b.DOCDATE,

ApplyToGLPostDate = b.GLPOSTDT,

CURNCYID = b.CURNCYID,

CURRNIDX = '',

APPTOAMT = a.AMTAPPLIED,

ORAPTOAM = a.AMTAPPLIED,

APFRDCNM = a.PMTNUM,

APFRDCTY = a.PMTTYPE,

APFRDCDT = c.DOCDATE,

ApplyFromGLPostDate = c.GLPOSTDT,

FROMCURR = c.CURNCYID,

APFRMAPLYAMT = a.AMTAPPLIED,

ActualApplyToAmount = a.AMTAPPLIED

from

#temp a

join RM20101 b on (b.DOCNUMBR = a.INVNUM and b.RMDTYPAL = a.INVTYPE)

join RM20101 c on (c.DOCNUMBR = a.PMTNUM and c.RMDTYPAL = a.PMTTYPE)

where

a.AMTAPPLIED 0 and

not exists (select 1

from RM20201 d

where d.APFRDCTY = a.PMTTYPE and

d.APFRDCNM = a.PMTNUM and

d.APTODCTY = a.INVTYPE and

d.APTODCNM = a.INVNUM)

drop table #temp

About The Author

Andrew Karasev is Chief Technology Officer in Alba Spectrum Technologies - USA nationwide Great Plains, Microsoft CRM customization company, with offices in Chicago, San Francisco, Los Angeles, San Diego, Phoenix, Houston, Miami, Atlanta, New York, Madrid, Brazil, Moscow ( http://www.albaspectrum.com), you can reach Andrew 1-866-528-0577, he is Dexterity, SQL, C#.Net, Crystal Reports and Microsoft CRM SDK developer; akarasev@albaspectrum.com


MORE RESOURCES:
table border=0 width= valign=top cellpadding=2 cellspacing=7trtd width=80 align=center valign=topfont style=font-size:85%;font-family:arial,sans-serifa href=http://news.google.com/news/url?sa=Tct=us/0i-0fd=Rurl=http://www.canada.com/topics/technology/news/gizmos/story.html%3Fid%3Dacb3b045-9d46-4f3b-aa25-5447dd34d5b6cid=1272030386ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNFLn0y_Dd56Bu_gvePjQXCYoDxKVAimg src=http://news.google.com/news?imgefp=2UkyZbz6Tp0Jimgurl=a123.g.akamai.net/f/123/12465/1d/media.canada.com/reuters/olustech_iptc/2008-10-28t011803z_01_btre49r03ot00_rtroptp_2_tech-us-china-microsoft.jpg%3Fsize%3Dl width=80 height=80 alt= border=1brfont size=-2Canada.com/font/a/font/tdtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/0-0fd=Rurl=http://www.reuters.com/article/technologyNews/idUSTRE4AI7T420081119cid=1272030386ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNEjkLA8UDVflBYLjF0jAJdr3mI7OQMicrosoft: New bsoftware/b not Symantec, McAfee rival/abrfont size=-1font color=#6f6f6fReutersnbsp;-/font nobrNov 19, 2008/nobr/fontbrfont size=-1BOSTON (Reuters) - Microsoft Corp#39;s upcoming security bsoftware/b is not designed to take sales from Symantec Corp and McAfee Inc as it is a stripped-down, b.../b/fontbrfont size=-1a href=http://news.google.com/news/url?sa=Tct=us/0-1fd=Rurl=http://education.zdnet.com/%3Fp%3D1965cid=1272030386ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNHhd10c24dqgzesrOZH_wdB463CGgI really don’t want to use Windows anymore/a font size=-1 color=#6f6f6fnobrZDNet/nobr/font/fontbrfont size=-1a href=http://news.google.com/news/url?sa=Tct=us/0-2fd=Rurl=http://www.allheadlinenews.com/articles/7013120895cid=1272030386ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNHHj7ouiHy-s2CDqtjZCtNuUxF9BwMicrosoft To Stop Paid PC Security Service, Offers Free Anti-Virus b.../b/a font size=-1 color=#6f6f6fnobrAHN/nobr/font/fontbrfont size=-1a href=http://news.google.com/news/url?sa=Tct=us/0-3fd=Rurl=http://www.networkworld.com/news/2008/111808-microsoft-drops-onecare-antivirus.html%3Ft51hbcid=1272030386ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNHLnC9vEfPtCMAgLB73S3uv9DqcswMicrosoft to offer free security bsoftware/b/a font size=-1 color=#6f6f6fnobrNetworkWorld.com/nobr/font/fontbrfont size=-1 class=pa href=http://news.google.com/news/url?sa=Tct=us/0-4fd=Rurl=http://www.bizjournals.com/sanjose/stories/2008/11/17/daily43.htmlcid=1272030386ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNGODQ95AQf1VRGNTlC3ls7uchYjLwnobrBizjournals.com/nobr/anbsp;- a href=http://news.google.com/news/url?sa=Tct=us/0-5fd=Rurl=http://www.internetnews.com/software/article.php/3786246/Microsoft%2BOffers%2BFree%2BSecurity%2BPulls%2BLive%2BOneCare.htmcid=1272030386ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNFMkqZsLB467hmxcq8uAvzKIoj3CAnobrInternetNews.com/nobr/a/fontbr/font class=p size=-1a class=p href=http://news.google.com/news?sourceid=navclientie=ISO-8859-1rls=GGLG,GGLG:2005-22,GGLG:enncl=1272030386hl=ennobrall 286 news articles/nobr/a/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/1-0fd=Rurl=http://www.marketwatch.com/news/story/American-Software-Inc-Invites-You/story.aspx%3Fguid%3D%257B3B268B55-50D6-4DDF-89D4-2D9832A1DC01%257Dcid=1272655668ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNHhsHxdhKOpoMdnyO49Uekr9cifuAAmerican bSoftware/b, Inc. Invites You to Join Its Second Quarter b.../b/abrfont size=-1font color=#6f6f6fMarketWatchnbsp;-/font nobr1 hour ago/nobr/fontbrfont size=-1Headquartered in Atlanta, American bSoftware/b develops, markets and supports one of the industry#39;s most comprehensive offerings of integrated business b.../b/fontbrfont size=-1a href=http://news.google.com/news/url?sa=Tct=us/1-1fd=Rurl=http://www.earthtimes.org/articles/show/american-software-inc-invites-you,631790.shtmlcid=1272655668ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNGC9Lq44u9CUmFAA_DQUPG9Hy8mfgAmerican bSoftware/b, Inc. Invites You to Join Its Second Quarter b.../b/a font size=-1 color=#6f6f6fnobrEarthtimes (press release)/nobr/font/fontbrfont class=p size=-1a class=p href=http://news.google.com/news?sourceid=navclientie=ISO-8859-1rls=GGLG,GGLG:2005-22,GGLG:enncl=1272655668hl=ennobrall 11 news articles/nobr/a/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/2-0fd=Rurl=http://www.marketwatch.com/news/story/New-Edition-Email-Newsletter-Software/story.aspx%3Fguid%3D%257B16B0A5AA-8DCE-46BE-85A2-0F9D0E7D78F8%257Dcid=1272548563ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNGNDDaFndkqf8LfDjaH1t_ROl175wNew Edition of Email Newsletter bSoftware/b Delivers Improved Email b.../b/abrfont size=-1font color=#6f6f6fMarketWatchnbsp;-/font nobr8 hours ago/nobr/fontbrfont size=-1TUCSON, Ariz., Nov 20, 2008 /PRNewswire via COMTEX/ -- Email Marketing Director, the flagship consumer email newsletter bsoftware/b from industry veteran Arial b.../b/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/3-0fd=Rurl=http://www.marketwatch.com/news/story/HighJump-Software-Helps-Customers-Do/story.aspx%3Fguid%3D%257BD8CB0063-F803-44CA-B8BE-7C6379355DBB%257Dcid=1272572768ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNEkqjfUHLlcdWsFXCZ3FfMdOvZjgQHighJump bSoftware/b Helps Customers Do More in Less Time With New b.../b/abrfont size=-1font color=#6f6f6fMarketWatchnbsp;-/font nobr7 hours ago/nobr/fontbrfont size=-1Not only does this capability allow HighJump bSoftware/b customers with international operations to more easily set up new locations, but also simplifies b.../b/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/4-0fd=Rurl=http://www.marketwatch.com/news/story/Intrinsyc-Software-International-Inc-Leading/story.aspx%3Fguid%3D%257B0E88B10F-7273-45B8-9EB5-A0032F73EA4A%257Dcid=1272557160ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNEaB95k7SM_bBPf9eMtuReKx_tqbQIntrinsyc bSoftware/b International, Inc.: Leading Device Maker b.../b/abrfont size=-1font color=#6f6f6fMarketWatchnbsp;-/font nobr8 hours ago/nobr/fontbrfont size=-1Destinator navigation bsoftware/b sets new standards for driver safety, ease-of-use, rich content and user interface customization. b.../b/fontbrfont size=-1a href=http://news.google.com/news/url?sa=Tct=us/4-1fd=Rurl=http://www.trucknews.com/PressReleases/FullStory.asp%3FArticleID2%3D3464174cid=1272557160ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNG_-uI4OH0AItgDhw8RMJ-4foXoGAAbout Intrinsyc bSoftware/b International, Inc./a font size=-1 color=#6f6f6fnobrTruck News/nobr/font/fontbrfont class=p size=-1a class=p href=http://news.google.com/news?sourceid=navclientie=ISO-8859-1rls=GGLG,GGLG:2005-22,GGLG:enncl=1272557160hl=ennobrall 23 news articles/nobr/a/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/5-0fd=Rurl=http://www.marketwatch.com/news/story/Turning-Technologies-TurningPointR-Student-Response/story.aspx%3Fguid%3D%257B60C2B4BD-4CB1-4E3A-8AC2-94BDD95925E7%257Dcid=1272572773ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNEeq-7bjufCGuvwa8569s6uvRyW7ATurning Technologies#39; TurningPoint(R) Student Response bSoftware/b b.../b/abrfont size=-1font color=#6f6f6fMarketWatchnbsp;-/font nobr7 hours ago/nobr/fontbrfont size=-1Turning Technologies, LLC develops interactive response systems utilizing the latest bsoftware/b and hardware tools available and transforms them into state of b.../b/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/6-0fd=Rurl=http://www.marketwatch.com/news/story/DataCore-Software-Promise-Technology-Microsoft/story.aspx%3Fguid%3D%257BA5641E8C-9AA7-492E-A82C-EA28AFD08EFD%257Dcid=1272551140ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNFlpkNv3BYMVFkrcV68yH1YiTKE_wDataCore bSoftware/b, Promise Technology and Microsoft Windows HPC at b.../b/abrfont size=-1font color=#6f6f6fMarketWatchnbsp;-/font nobr8 hours ago/nobr/fontbrfont size=-1DataCore#39;s SANsymphony bsoftware/b addresses larger scale, heterogeneous storage virtualization needs through sophisticated I/O performance acceleration and b.../b/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/7-0fd=Rurl=http://www.marketwatch.com/news/story/Research-Markets-Software-a-Service/story.aspx%3Fguid%3D%257B33EE37B2-F481-4614-BE8A-37C43F597D49%257Dcid=1272605142ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNGp-F6GM_I8YzRJYf-C7ebai5lbmwResearch and Markets: bSoftware/b-as-a-Service in APAC - The Momentum b.../b/abrfont size=-1font color=#6f6f6fMarketWatchnbsp;-/font nobr5 hours ago/nobr/fontbrfont size=-1bSoftware/b as a service (SaaS) has continued to consolidate its hold on the Asia Pacific (APAC) market. This is evidenced by the increasing number of large b.../b/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/8-0fd=Rurl=http://www.marketwatch.com/news/story/New-Accounting-Software-Enhancements-Recommended/story.aspx%3Fguid%3D%257B09ADAED7-C211-4B74-AB5B-68BBC789668F%257Dcid=1272525852ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNEJhLMO2ucTV1zzK_7LNwSssXTNwANew Accounting bSoftware/b Enhancements Recommended and Prioritized b.../b/abrfont size=-1font color=#6f6f6fMarketWatchnbsp;-/font nobr10 hours ago/nobr/fontbrfont size=-1PETALUMA, CA, Nov 20, 2008 (MARKET WIRE via COMTEX) -- This week AccountMate bSoftware/b Corporation shipped out their latest accounting bsoftware/b update, b.../b/font/div/font/td/tr/table

table border=0 width= valign=top cellpadding=2 cellspacing=7trtd valign=top class=jfont style=font-size:85%;font-family:arial,sans-serifbrdiv style=padding-top:0.8em;img alt= height=1 width=1/divdiv class=lha href=http://news.google.com/news/url?sa=Tct=us/9-0fd=Rurl=http://www.forbes.com/feeds/ap/2008/11/20/ap5723001.htmlcid=1272659370ei=lNklSZ-uG4fsgAPHwKWXDwusg=AFQjCNFYYAYrb_z6fa9bzfC8q1moHBec9wCheck Point bSoftware/b shares edge higher/abrfont size=-1font color=#6f6f6fForbes,nbsp;NYnbsp;-/font nobr59 minutes ago/nobr/fontbrfont size=-1AP , 11.20.08, 03:28 PM EST Shares of Check Point bSoftware/b Technologies Ltd. edged higher Thursday, helped by an analyst report predicting the Internet b.../b/font/div/font/td/tr/table

Software - Google News




Articles Home Page | Site Map | Main Site Home Page
GETsonic | TrafficFish | WildThingsDesigns | NeatoDomains.com | Games | Ken J Wagner | iNetcome

© 2008