Monday, March 19, 2012

Dynamics GP Report Writer - Images on Reports

1) Edit your picture to fit within the requirements here. Keep the pixels in multiples of 50 eg. 100x150 or
250 x 300, 900x300 otherwise the pictures will come out blurry. Large images will be auto-resized by GP, and will look better than small images.

https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb$en-us$854470

2) Open report writer, go to your report, open layout. Select your image from inside editor. Copy.
Paste your picture in report writer. Name it.

3) If you need to use this picture for other reports, on the main toolbar, click the little image icon (third on bottom left) then click in your report, then choose the image name you created before, then click "ok".

Saturday, March 10, 2012

How to make and schedule a Batch file to make backup copies of a folder, and log it.

Create a batch file like this
---------------------------------------------------------------------------------------


Echo.  >>c:\somelogfile.txt
Echo.=================== >>c:\somelogfile.txt
echo.%Date% >>c:\somelogfile.txt
echo.%Time% >>c:\somelogfile.txt

rem out this line if you want to log every single file in the logfile
@echo off


xcopy C:\Copythisfolder /c /s /r /y /i C:\Tothisfolder


------------------------------------------------------------------

Download System Scheduler from
http://www.splinterware.com/download/index.htm


Schedule to run batch file every night

Create your own Barcodes

Install the 3 of 9 font here. It supports all characters, digits and upper case letters
http://dl.dropbox.com/u/45910856/BARCOD39.TTF

To get the scanners to scan properly, you must use * before and after any data you are barcoding.

For Example, to create a simple barcode in Excel for 34567
Open Excel, Enter  *34567* and switch it to 3 of 9 font
You can now scan this barcode with any standard scanner.

Dynamics GP - Free any records locked by users

Use this script for all errors pertaining to locks / shares

Ensure all users log out of GP, then run
------------------------------------------------------------------------------

DELETE FROM [DYNAMICS].[dbo].[ACTIVITY]
DELETE FROM [DYNAMICS].[dbo].[SY00800]
DELETE FROM [DYNAMICS].[dbo].[SY00801]
DELETE FROM [tempdb].[dbo].[DEX_LOCK]
DELETE FROM [tempdb].[dbo].[DEX_SESSION]

------------------------------------------------------------------------------
If it says a batch is stuck / being edited, and there is no one else in the system


UPDATE SY00500 SET MKDTOPST=0, BCHSTTUS=0 where BACHNUMB='XXX'



If you can't get everyone to log off, you can use this script which removes activity locks for anyone who isn't currently logged in.

---------------------------------------------------------------------------------------------------------------------

-- Dexterity Sessions Table
delete S
-- select * 
from tempdb..DEX_SESSION S
where not exists (
 select * from DYNAMICS..ACTIVITY A 
 where S.session_id = A.SQLSESID)


-- Dexterity Locks Table
delete L
-- select *
from tempdb..DEX_LOCK L
where not exists (
 select * from DYNAMICS..ACTIVITY A 
 where L.session_id = A.SQLSESID)


-- Batch_Headers table in each company
exec sp_MSforeachdb
' use [?]
if exists ( select INTERID from DYNAMICS..SY01500 D where INTERID = ''?'' )
begin 
 update S set BCHSTTUS = 0, MKDTOPST = 0, USERID = ''''
 -- select *
 from SY00500  S
 where BCHSTTUS in (1,2,3,4,5,6)
 and not exists (
  select * from DYNAMICS..ACTIVITY A 
  JOIN DYNAMICS..SY01500 C ON C.CMPNYNAM = A.CMPNYNAM
  where S.USERID = A.USERID and C.INTERID = db_name()) 
 and exists (
  select * from DYNAMICS..SY00800 B 
  where not exists (
   select * from DYNAMICS..ACTIVITY A 
   where B.USERID = A.USERID and B.CMPNYNAM = A.CMPNYNAM)
  and S.BCHSOURC = B.BCHSOURC and S.BACHNUMB = B.BACHNUMB)
 print ''''
 print ''('' + ltrim(str(@@ROWCOUNT)) + '' row(s) affected) - Database '' + db_name()
end
'


-- SY_Batch_Activity_MSTR table
delete  B 
-- select * 
from DYNAMICS..SY00800 B
where not exists (
 select * from DYNAMICS..ACTIVITY A 
 where B.USERID = A.USERID and B.CMPNYNAM = A.CMPNYNAM)


-- SY_ResourceActivity table
delete  R 
-- select * 
from DYNAMICS..SY00801 R
where not exists (
 select * from DYNAMICS..ACTIVITY A 
 JOIN DYNAMICS..SY01500 C ON C.CMPNYNAM = A.CMPNYNAM
 where R.USERID = A.USERID and R.CMPANYID = C.CMPANYID) 


--------------------------------------------------------------------------------------------------------------------------------

Thursday, March 8, 2012

SQL execute command line and return results to a table

DECLARE
@CMD CHAR(200),

SELECT @CMD = 'DIR c:\'

INSERT INTO HILOCSV
EXEC MASTER.DBO.XP_CMDSHELL @CMD

EOne Smartpost does not post every night

The nightly date change prompt prevents smartpost from posting.

Disable the date change prompt.

Add the following line above the "[Install]" section of the Dex.ini file.

SuppressChangeDateDialog=TRUE

The prompt will not appear, and the date will never change in GP.