Thursday, November 10, 2016

Tuesday, November 8, 2016

SQL - View to Determine Table Sizes. Get Table Sizes in SQL.

Original Post
http://stackoverflow.com/questions/7892334/get-size-of-all-tables-in-database

-------------------------------------------------------------------------------------------------------
SELECT        TableName, SchemaName, RowCounts, TotalSpaceKB, UsedSpaceKB, UnusedSpaceKB
FROM            (SELECT        TOP (100) PERCENT t.name AS TableName, s.name AS SchemaName, p.rows AS RowCounts, SUM(a.total_pages) * 8 AS TotalSpaceKB, SUM(a.used_pages) * 8 AS UsedSpaceKB, (SUM(a.total_pages)
                                                    - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
                          FROM            sys.tables AS t INNER JOIN
                                                    sys.indexes AS i ON t.object_id = i.object_id INNER JOIN
                                                    sys.partitions AS p ON i.object_id = p.object_id AND i.index_id = p.index_id INNER JOIN
                                                    sys.allocation_units AS a ON p.partition_id = a.container_id LEFT OUTER JOIN
                                                    sys.schemas AS s ON t.schema_id = s.schema_id
                          WHERE        (t.name NOT LIKE 'dt%') AND (t.is_ms_shipped = 0) AND (i.object_id > 255)
                          GROUP BY t.name, s.name, p.rows
                          ORDER BY TableName) AS Size
ORDER BY UsedSpaceKB desc
--------------------------------------------------------------------------------------------------

Friday, November 4, 2016

Dynamics GP - Manufacturing Account Movement - Accounts Required


  • Minimum Accounts Required for Manufacturing
    • RM Inventory Accounts
    • FG Inventory Accounts
    • FG WIP Material Accounts
    • Mfg Costing>Rounding Difference Account
    • Damages account
    • Overhead Applied accounts
    • Examples include:
      • Labor
        • Admin
        • Line
      • Machine
        • Electricity
        • Maintenance
  • Full Manufacturing Process
    • Create MO
      • Schedule
      • Build Picklist
    • Allocate Raw Materials
    • Issue Raw Materials and other costs
    • Create Finished Goods Receipt
    • Data Entry
    • Close MO
  • Quick MO with Backflush
    • Create MO
    • Save and Build Picklist
      • Automatically Schedule and build picklist
      • Automatically Allocate and Issue Raw Materials (Mfg Setup)
    • Close MO
      • Automatically receive all Finished Goods
      • Automatically Backflush all raw materials and costs
      • Credit RM Inventory Account, Debit FG WIP Material Account
      • Credit FG WIP Material Account, Debit FG Inventory Account

Dynamics NAV - LS Retail - Windows 7 - Error when pressing hotkey - search:crumb=locationC%3A%5CUser%5C...........%5CDesktop


For LS NAV 2017, if the hotkeys do not work, you have to set the rows and columns for the Fixed menu. It has to be a fixed key menu.

Thursday, November 3, 2016

Dynamics GP - Automated Check Links - Automatic Login and Check Links Macro and Login and Reconcile Macro

http://mohdaoud.blogspot.com/2008/10/auto-login-for-microsoft-dynamics-gp_2192.html

Copy the macro into the C:\Program Files (x86)\Microsoft Dynamics\GP2015\ Folder

Create a Batch file with the following line. Schedule the Batch file to be executed using windows scheduler, or system scheduler
-----------------------------------------------------------------
cd C:\Program Files (x86)\Microsoft Dynamics\GP2015\
"C:\Program Files (x86)\Microsoft Dynamics\GP2015\Dynamics.exe" Dynamics.set Loginchecklinks.mac
-----------------------------------------------------------------

Autologin Macro GP2015
-----------------------------
Logging file 'macro.log'
CheckActiveWin dictionary 'default' form Login window Login
MoveTo field 'User ID'
TypeTo field 'User ID' , 'sa'
MoveTo field Password
TypeTo field Password , 'password'
MoveTo field 'OK Button'
ClickHit field 'OK Button'
NewActiveWin dictionary 'default' form 'Switch Company' window 'Switch Company'
ClickHit field '(L) Company Names' item 1 # ''
MoveTo field 'OK Button'
ClickHit field 'OK Button'
CommandExec dictionary 'default' form 'Command_System' command CloseAllWindows
ActivateWindow dictionary 'default' form Toolbar window 'Main_Menu_1'

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

Check Links Macro

-------------------------------
CheckActiveWin dictionary 'default'  form 'SY_Check_Links' window 'Check Links'
NewActiveWin dictionary 'default'  form sheLL window sheLL
  CommandExec dictionary 'default'  form 'Command_System' command 'SY_Check_Links'
ActivateWindow dictionary 'default'  form 'SY_Check_Links' window 'Check Links'
ActivateWindow dictionary 'default'  form 'SY_Check_Links' window 'Check Links'
  MoveTo field 'Insert All Button'
  ClickHit field 'Insert All Button'
  MoveTo field 'File Series' item 1  # 'Financial'
  ClickHit field 'File Series' item 2  # 'Sales'
  MoveTo field 'Insert All Button'
  ClickHit field 'Insert All Button'
  MoveTo field 'File Series' item 2  # 'Sales'
  ClickHit field 'File Series' item 3  # 'Purchasing'
  MoveTo field 'Insert All Button'
  ClickHit field 'Insert All Button'
  MoveTo field 'File Series' item 3  # 'Purchasing'
  ClickHit field 'File Series' item 4  # 'Inventory'
  MoveTo field 'Insert All Button'
  ClickHit field 'Insert All Button'
  MoveTo field 'File Series' item 4  # 'Inventory'
  ClickHit field 'File Series' item 7  # 'System'
  MoveTo field 'Insert All Button'
  ClickHit field 'Insert All Button'
  MoveTo field 'File Series' item 7  # 'System'
  ClickHit field 'File Series' item 8  # 'Company'
  MoveTo field 'Insert All Button'
  ClickHit field 'Insert All Button'
  MoveTo field 'File Series' item 8  # 'Company'
  CommandExec dictionary 'default'  form 'SY_Check_Links' command 'OK Button_w_Check Links_f_SY_Check_Links'
NewActiveWin dictionary 'default'  form 'Report_Destination' window 'Report_Destination'
  MoveTo field 'OK Button'
  ClickHit field 'OK Button'
-------------------------------------------------------

Inventory Reconcile Macro

------------------------------------------------------
NewActiveWin dictionary 'default'  form sheLL window sheLL
  CommandExec dictionary 'default'  form 'Command_Inventory' command 'IV_Reconcile'
ActivateWindow dictionary 'default'  form 'IV_Reconcile' window 'IV_Reconcile'
ActivateWindow dictionary 'default'  form 'IV_Reconcile' window 'IV_Reconcile'
  CommandExec dictionary 'default'  form 'IV_Reconcile' command 'Process Button P_w_IV_Reconcile_f_IV_Reconcile'
NewActiveWin dictionary 'default'  form 'Report_Destination' window 'Report_Destination'
  MoveTo field 'OK Button'
  ClickHit field 'OK Button'
NewActiveWin dictionary 'DEX.DIC'  form 'Report Destination' window 'Report Type'
  MoveTo field '(L) OK'
  ClickHit field '(L) OK'
NewActiveWin dictionary 'default'  form 'Report_Destination' window 'Report_Destination'
NewActiveWin dictionary 'DEX.DIC'  form 'Report Destination' window 'Report Type'
  MoveTo field '(L) OK'
  ClickHit field '(L) OK'
NewActiveWin dictionary 'default'  form 'Report_Destination' window 'Report_Destination'

Dynamics GP Manufacturing - Prevent MO Receipts from posting if there is insufficient Raw Material or component stock

Add This code to the Manufacturing Order Receipt Entry window.
This only works if Inventory Override Adjustments are disabled

------------------------------------------------------------------------------------------------
Private Sub Window_BeforeModalDialog(ByVal DlgType As DialogType, PromptString As String, Control1String As String, Control2String As String, Control3String As String, Answer As DialogCtrl)
   
'View>Immediate to capture exact wording of error prompts
'Debug.Print PromptString
'Debug.Print "Button 1: " & Control1String
'Debug.Print "Button 2: " & Control2String
'Debug.Print "Button 3: " & Control3String
   
   
    Dim ErrMsg
    ErrMsg = "There is insufficient stock of at least one component. Ensure that adequate component stock is available before posting a receipt."
   
    If PromptString = "You haven't backflushed the planned quantity for at least one component.  Do you want to continue?" Then
        MsgBox ErrMsg, vbExclamation
        Answer = dcButton2
    End If
   
    If PromptString = "At least one component has a shortage that has been overridden.  Do you want to continue?" Then
    MsgBox ErrMsg, vbExclamation
    Answer = dcButton2
    End If
   
    If PromptString = "A quantity shortage exists for this item.  Would you like to use the available quantity or cancel?" Then
    MsgBox ErrMsg, vbExclamation
    Answer = dcButton2
    End If
End Sub