Saturday, 19 November 2011

How to launch a bill of materials or manufacturing form from sage 200 2011.




     Using tK_Form As TrialKittingForm = DirectCast(Sage.Manufacturing.Application.Instance.FormLauncher.Fetch(GetType(TrialKittingForm)), TrialKittingForm)

      

                     Sage.Manufacturing.Application.Instance.FormLauncher.ShowDialog(tK_Form, Me)

       End Using


Wednesday, 19 October 2011

FilterText property example on a Sage 200 business object

This example show how to use the filter text property on a sage 200 business object.

Private Function GetPOPQtyBreakCostPrice(oStockItem As Sage.Accounting.Stock.StockItem, quantity As Decimal) As Decimal

Dim oSupplier = CType(Me._AmendableForm.BoundObjects(0), Sage.Accounting.POP.POPOrderReturnLine).POPOrderReturn.Supplier

Using oPOPQTYBreakPrices As New SCITSupplierStockQtyBreaks

oPOPQTYBreakPrices.Query.Filters.Add(New Sage.ObjectStore.Filter(SCITSupplierStockQtyBreak.FIELD_STOCKITEMDBKEY, CInt(oStockItem.PrimaryKey.Value)))

oPOPQTYBreakPrices.Query.Filters.Add(New Sage.ObjectStore.Filter(SCITSupplierStockQtyBreak.FIELD_SUPPLIERDBKEY, CInt(oSupplier.PrimaryKey.Value)))

'Dim oFilterFromQty As New Sage.ObjectStore.Filter(quantity, Sage.Common.Data.FilterOperator.GreaterThanOrEqual, SCITSupplierStockQtyBreak.FIELD_FROMQUANTITY)

'oFilterFromQty.BoundParameter = False

'oPOPQTYBreakPrices.Query.Filters.Add(oFilterFromQty)

'Dim oFilterToQty As New Sage.ObjectStore.Filter(quantity, Sage.Common.Data.FilterOperator.GreaterThanOrEqual, SCITSupplierStockQtyBreak.FIELD_TOQUANTITY)

'oFilterFromQty.BoundParameter = False

'oPOPQTYBreakPrices.Query.Filters.Add(oFilterToQty)

Try

oPOPQTYBreakPrices.Query.FilterText = String.Format("{0} >= FromQuantity and {0} <= ToQuantity", quantity)

' Dim oCmd = oPOPQTYBreakPrices.

oPOPQTYBreakPrices.Find()

If oPOPQTYBreakPrices.First Is Nothing Then

Return 0D

Else

Return oPOPQTYBreakPrices.First.CostPrice

End If

Catch ex As Exception

Return 0

End Try



End Using

End Function

InFilter example when using Sage 200 object store builder

This example show how to use the infilter object on a sage 200 business object.

IfDisplayUnassignedUnitsOnly Then

Dim oListUnitPK As New List(Of Object)

Using oTenancyies As New SCIT.DHT.Accounting.SCITTenancies

For Each oTenancy As SCIT.DHT.Accounting.SCITTenancy In oTenancyies

oListUnitPK.Add(CInt(oTenancy.Unit.PrimaryKey.Value))

Next

End Using

Dim NotInFilter As Sage.ObjectStore.InFilter

NotInFilter = Sage.ObjectStore.InFilter.CreateNew(SCIT.DHT.Accounting.SCITUnit.FIELD_SCITUNIT, Sage.Common.Expressions.InOperator.NotIn, oListUnitPK.ToArray)

Units.Query.Filters.Add(NotInFilter)

End If

If Units.Query.Filters.Count > 0 Then

Units.Find()

End If

Thursday, 6 October 2011

Check Index Fragmentation on SQL server


USE CRM

GO

SELECT
a.index_id, name, avg_fragmentation_in_percent

FROM sys.dm_db_index_physical_stats (DB_ID(), NULL,

NULL, NULL, NULL) AS a

JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id;

GO

Friday, 25 March 2011

SQL Query to find where the custome Dot net Dll's are Stored In Sage CRM

SELECT  Parm_id, Parm_CreatedBy, Parm_CreatedDate, Parm_UpdatedBy, Parm_UpdatedDate, Parm_TimeStamp, Parm_Deleted, Parm_Name, Parm_Value, Parm_Component
FROM Custom_SysParams WHERE (Parm_Name = 'Dotnetdlldirectory')

Friday, 4 March 2011

Stop the solution appearing twice on the CRM system menu.

UPDATE Custom_Tabs Set Tabs_Caption = N'SolutionDELETE' Where Tabs_TabId <>


(SELECT MIN (Tabs_TabId) FROM Custom_Tabs WHERE tabs_Deleted is null AND

( Tabs_Entity = N'find' and Tabs_DeviceID is null and Tabs_InButtonGroup is null and

COALESCE(Tabs_Action, N'') <> N'newaccount' and Tabs_Caption = N'Solution'))

AND tabs_Deleted is null AND ( Tabs_Entity = N'find' and Tabs_DeviceID is null and

Tabs_InButtonGroup is null and COALESCE(Tabs_Action, N'') <> N'newaccount' and Tabs_Caption = N'Solution')

Wednesday, 9 February 2011

Adding new fonts to CRM

'Although editing this is not technically supported, go to C:\Program Files\Sage\CRM\CRMINSTALL\WWWRoot\Fckeditor\ fckconfig.js and add the fonts as follows:



FCKConfig.EnableMoreFontColors = false ;

FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ;



FCKConfig.FontFormats = 'p;h1;h2;h3;h4;h5;h6;pre;address;div' ;

FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana;Webdings;Impact ;

FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ;



This will only work though if the end user also has that font installed on their machine which is why this list only has default fonts.'

Friday, 28 January 2011

Getting port number of a running application

There are a couple of applications that may fail to start and complaint because its port is being used by a different application. This is a quick and dirty way of knowing which application is responsible for tying up a port on a Windows box.






Open up a command prompt:



1.Start
Run
type cmd
Enter

2.Type netstat -aon
findstr “[port number]“

3.Take note of the numbers on the last line. This is the PID or Process ID.

4.Type tasklist
findstr “[PID]“ and this will return the application corresponding to that PID.

5.Once PID is determined, you can now kill it in Task Manager or kill it typing tskill at the command prompt.





For example:



1.I type netstat -aon
findstr “8080″ at command prompt (I’m on a proxy by the way)

2.I see that the PID is 3624

3.I type tasklist
findstr “3624″ to find what PID 3624 is and it points to msnmsgr.exe which is MSN/Live Messenger.

4.I can now kill MSN Messenger from Task Manager or type tskill 3624