Thursday, November 24, 2016

Dynamics GP HITB Reset Tool

https://mbs.microsoft.com/customersource/northamerica/GP/downloads/service-packs/MDGP10_HITB


http://mahmoudsaadi.blogspot.com/2014/04/hitb-essentials-series-hitb-reset-tool.html


  • Get an Inventory Offset Account to post the GL-Subledger variances to
  • Run the SQL script to create the objects
  • Copy the cnk file into the GP folder and launch GP
  • Launch GP>Tools>Utilities>Inventory>HITB Reset Tool

Wednesday, November 23, 2016

LS Retail - NAV - Change Line color/font based on infocode subcode

C99001565 POS Dataset Utility
Add the following code to assign a skin or font to an array number. Call on the array value if your infocode subcode is found on the pos line.

SETJOURNALMODE

  COL0 := 14;
  COL1 := 15;

INITJOURNALMENULINES

JournalLineFonts[COL0] := '#SL_COL0';
JournalLineFonts[COL1] := '#SL_COL1';


JournalLineButtonSkins[COL0] := '#SL_COL0';
JournalLineButtonSkins[COL1] := '#SL_COL1';

GETJOURNALLINECOLOR


    InfCd.RESET;
    InfCd.SETFILTER("Receipt No.","Receipt No.");
    InfCd.SETRANGE("Line No.","Line No.");
    IF InfCd.FIND('-') THEN BEGIN
      IF InfCd.Information = '10' THEN BEGIN
          CurrColor := COL0;
        EXIT;
      END;
      IF InfCd.Information = '20' THEN BEGIN
          CurrColor := COL1;
        EXIT;
      END;
     END;

Monday, November 21, 2016

Dynamics GP 2010 - Restore Copy of Live Over Test database

BACKUP DATABASE [TWO] TO  DISK = N'F:\DBS\TWO_temp.bak' WITH NOFORMAT, INIT,  NAME = N'TWO-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO



Use Master
Alter Database TEST
SET SINGLE_USER With ROLLBACK IMMEDIATE

RESTORE DATABASE [TEST] FROM  DISK = N'F:\DBS\TWO_temp.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
GO

USE TEST

if exists (select 1 from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'SY00100') begin
  declare @Statement varchar(850)
  select @Statement = 'declare @cStatement varchar(255)
declare G_cursor CURSOR for
select case when UPPER(a.COLUMN_NAME) in (''COMPANYID'',''CMPANYID'')
  then ''update ''+a.TABLE_NAME+'' set ''+a.COLUMN_NAME+'' = ''+ cast(b.CMPANYID as char(3))
  else ''update ''+a.TABLE_NAME+'' set ''+a.COLUMN_NAME+'' = ''''''+ db_name()+'''''''' end
from INFORMATION_SCHEMA.COLUMNS a, '+rtrim(DBNAME)+'.dbo.SY01500 b
  where UPPER(a.COLUMN_NAME) in (''COMPANYID'',''CMPANYID'',''INTERID'',''DB_NAME'',''DBNAME'')
    and b.INTERID = db_name() and COLUMN_DEFAULT is not null
 and rtrim(a.TABLE_NAME)+''-''+rtrim(a.COLUMN_NAME) <> ''SY00100-DBNAME''
  order by a.TABLE_NAME
set nocount on
OPEN G_cursor
FETCH NEXT FROM G_cursor INTO @cStatement
WHILE (@@FETCH_STATUS <> -1)
begin
  exec (@cStatement)
  FETCH NEXT FROM G_cursor INTO @cStatement
end
close G_cursor
DEALLOCATE G_cursor
set nocount off'
  from SY00100
  exec (@Statement)
end
else begin
  declare @cStatement varchar(255)
  declare G_cursor CURSOR for
  select case when UPPER(a.COLUMN_NAME) in ('COMPANYID','CMPANYID')
    then 'update '+a.TABLE_NAME+' set '+a.COLUMN_NAME+' = '+ cast(b.CMPANYID as char(3))
    else 'update '+a.TABLE_NAME+' set '+a.COLUMN_NAME+' = '''+ db_name()+'''' end
  from INFORMATION_SCHEMA.COLUMNS a, DYNAMICS.dbo.SY01500 b
    where UPPER(a.COLUMN_NAME) in ('COMPANYID','CMPANYID','INTERID','DB_NAME','DBNAME')
      and b.INTERID = db_name() and COLUMN_DEFAULT is not null
    order by a.TABLE_NAME
  set nocount on
  OPEN G_cursor
  FETCH NEXT FROM G_cursor INTO @cStatement
  WHILE (@@FETCH_STATUS <> -1)
  begin
    exec (@cStatement)
    FETCH NEXT FROM G_cursor INTO @cStatement
  end
  close G_cursor
  DEALLOCATE G_cursor
  set nocount off
end

sp_changedbowner 'DYNSA'

Friday, November 18, 2016

Wednesday, November 16, 2016

Dynamics NAV CAL - How to use Special Character ' in text string outputs

4 single quotes will turn into 1 single quote

Example

Message('''' + MyWord + '''');

will display  'MyWord'

Dynamics GP - Macro REM or Comment a line

You can just use the ' character at the beginning of lines to stop them from running

Also include this line at the beginning to suppress all error messages

logging file 'macro.log'

Monday, November 14, 2016

Dynamics GP - Customer Phone number does not print on SOP Invoice


  • In the Customer address card drill into the address itself
  • In the area for "Ship To", Print Phone/Fax Number
  • select "Phone1"



Or use this script to set all customer addresses to "Phone1"

  • update rm00102 set print_phone_numbergb = 1


  • Neither of the above options will update existing SOP documents.
  • After making the change on the address card, you must navigate to the sales document, reselect the ship to address id, and roll down the address changes for it to pick up the new address option.