Microsoft Great Plains SQL Scripting: repairing lot numbers - highlights for programmer
Below we would like to give you brief excurse to lot number tracking and provide fixing scripts:
Item Lot Number Master table, IV00300. This table gets record when lot is received at the specific date, please familiarize yourself with its primary key to get an idea. Now we should come to the complication of GP business logic, related to the fact, that lot number tracking is optional. This is why lot numbers refer to general table: Inventory Purchase Receipt Work - this table participate in regular logic, when we don't use lot numberingInventory Purchase Receipt Work, IV10200. This table gets record when items arrive to GP via Purchase Receipts, Inventory Adjustments or Inventory transfers (in this case items are simply moved from one IV site to another)We provide you fixing scripts, however you should analyze and try them first in test environment, as your specific case is now known to us and you should be responsible for SQL data repair.
Below please see script repairing missing IV00300 when IV10200 record is present:
insert into IV00300
(
ITEMNMBR,
LOCNCODE,
DATERECD,
DTSEQNUM ,
LOTNUMBR,
QTYRECVD ,
QTYSOLD ,
ATYALLOC,
UNITCOST ,
RCTSEQNM,
VNDRNMBR,
LTNUMSLD,
QTYTYP ,
BIN,
MFGDATE,
EXPNDATE
)
select
a.ITEMNMBR,
a.TRXLOCTN,
a.DATERECD,
1,
e.SERLTNUM,
a.QTYRECVD,
0,
0,
a.UNITCOST,
a.RCTSEQNM,
'',--VNDRNMBR
0,
a.QTYTYPE,
'',
'01/01/1900',
'01/01/1900'
from IV10200 a
join IV30200 b on b.DOCNUMBR=a.RCPTNMBR and DATERECD='MM/DD/YY' and
join IV30400 e on b.DOCNUMBR=e.DOCNUMBR
Second script gives you opposite repair, when IV0200 record is missing:
insert into IV10200
(
ITEMNMBR,
TRXLOCTN,
DATERECD,
RCTSEQNM ,
RCPTSOLD,
QTYRECVD,
QTYSOLD,
QTYCOMTD,
QTYRESERVED ,
FLRPLNDT,
PCHSRCTY,
RCPTNMBR,
VENDORID,
PORDNMBR ,
UNITCOST,
QTYTYPE,
Landed_Cost ,
NEGQTYSOPINV,
VCTNMTHD,
ADJUNITCOST,
QTYONHND
)
select
a.ITEMNMBR,
a.LOCNCODE,
a.DATERECD,
a.RCTSEQNM,
0,
a.QTYRECVD,
a.QTYSOLD,
0,
0,
'01/01/1900',
1,
'',--we do not know RCPTNMBR
'INV TRF',-- as VENDORID
'INV TRF', --as PORDNMBR
a.UNITCOST,
a.QTYTYPE,
0, --as Landed Cost
0, --as NEGQTYSOPINV
3, --as VCTNMTHD
a.UNITCOST, --as ADJUNITCOST
1000000 -- as QTYONHAND - bogus - to try, in any case qty on hand is not important in this table
from IV00300 a
left join IV10200 b on a.ITEMNMBR=b.ITEMNMBR and b.TRXLOCTN=a.LOCNCODE and a.DATERECD=b.DATERECD and a.RCTSEQNM=b.RCTSEQNM and a.QTYTYPE=b.QTYTYPE
where b.ITEMNMBR is null and a.LTNUMSLD=0Source: Free Articles from ArticlesFactory.com
Related Tags: microsoft, for, great, scripting, numbers, programmer, sql, plains, lot, repairing, highlights
Andrew Karasev, Alba Spectrum Group, http://www.albaspectrum.com help@albaspectrum.com 1-866-528-0577, 1-630-961-5918, serving GP client in USA nationwide and Canada. Local service is available in Chicago area: Naperville, Warrenville, Oakbrook, Lisle, Downers Grove, Romeoville, Aurora, Hinsdale, Joliet, Plainfield, Morris, Orland Park, Lombard, Elgin, Crystal Lake, in Houston: Richmond, Sugar Land, Rosenberg, Katy, Galveston. Nationwide service: California, New York, Ontario, Quebec, Florida, Arizona, Iowa, Indiana, Kansas, Wisconsin, Minnesota, Washington, Nevada, Utah, Louisiana, Texas, Illinois Your Article Search Directory : Find in Articles
Recent articles in this category:
- Fix Printer, Keyboard, Speaker and Monitor Cables With Funky Organizers
There are different types of cables that are used when you have a desktop computer at home. Most of - The Growing Trend of Asterisk Phone Systems
Truly, businesses are doing everything they can in the economy and competitive world of today to rem - The Future of Business Intelligence: Innovations in Location Intelligence
In the coming years, many business analysts are predicting that Business Intelligence (BI) will play - Adobe Photoshop Album Starter Edition and What Happened to the Unlock Codes
Adobe has long been known as a star in the digital image editing world and the Adobe Photoshop Album - Choosing the Best Computer For Graphic Design
In the 1980s, desktop publishing came out and graphic designers began to utilize computers for all k - Versatility of Pocket HD Camcorders
In the era of the do-everything handheld gadget, high def camcorders family seems almost passee. The - Contemporary Office Furniture
When considering Contemporary Office Furniture there are a few things that you really should conside - Professional Web Design, Professional Web Designer
There is a lot to consider if you are looking for a Professional Web Design. So let's get to it. Fir - Cell Phone Protection and Safety For Kids
If your like the millions of parents giving your children a cell phone for safety when their away fr - Looking For That Smart Pc Workstation And Desk
Do you need a work area at home. Maybe it is just for doing bills. It may be for a community work ar
Most viewed articles in this category:
- Voip Residential Comparison Guide: Evaluating Packet8, Lingo, And Vonage
Voice over internet protocol [internet telephony] is a rapidly growing technological alternative to - What's The Difference In The Ionic Breeze Quadra?
The Ionic Breeze Quadra is the newer line of ionic breeze units offered by The Sharper Image. These - Selling World of Warcraft Accounts
Everybody knows that WoW is one of the most exciting MMORPGs ever created. This makes selling WoW ac - Film Cameras
Film cameras are simple cameras, which could be used by all easily. People prefer to use film camera - Salesboom SLA-MS Competition
Oh, the irony. Online CRM Services shy away from offering customers a Service Level Agreement. Why t - How To Improve Your Computer Speed Almost Instantly
Probably your computer, even though you bought it last year its no longer that much fast. Like any o - The Mosquito Ringtone - The Tone Adults Can't Hear
Without a doubt, the mosquito ringtone is one of the most popular ringtones ever. Good luck trying - Auto Navigation Systems And Gps Technology While Traveling
If you have managed to do any research on auto navigation systems I'm sure you've come across countl - Do Cheap iPods Really Exist?
If you know anything about music trends, you know that iPods are the hottest portable music device t - Online Mobile Phone Offers: Take 10 Minutes To Save £360 On Your Next Mobile Phone Contract
Cash Is Falling Out Of Your Pocket If you live in the UK, you're probably paying line rental on a m