Thursday, November 12, 2009
10 Tanaman Obat
Monday, November 9, 2009
Friday, November 6, 2009
Creating Bar Chart in Navision
The bar charts in Navision are based on three generic bar chart subforms:
- Form 630 Bar Chart 12x1 Subform (Show 12 columns of 1 value)
- Form 631 Bar Chart 6x2 Subform (Show 6 columns of 2 compared values)
- Form 632 Bar Chart 4x3 Subform (Show 4 columns of 3 compared values)
Thursday, November 5, 2009
How to call Store Procedure from Navision
1. Create Store Procedure in SQL
CREATE PROCEDURE SP_Test @SName as Varchar(20) OUTPUT
AS
SELECT [CRONUS International Ltd_$Salesperson_Purchaser].Name as Nama from
[CRONUS International Ltd_$Salesperson_Purchaser] where
[CRONUS International Ltd_$Salesperson_Purchaser].Code = @SName
GO
2. Call Store Procedure from Navision
Variables:
ADOConnection : 'Microsoft ActiveX Data Objects 2.8 Library'.Connection
ADOCommand : 'Microsoft ActiveX Data Objects 2.8 Library'.Command
ADOParameter : 'Microsoft ActiveX Data Objects 2.8 Library'.Parameter
ADORecSet : 'Microsoft ActiveX Data Objects 2.8 Library'.Recordset
VarActiveConnection : Variant
IF ISCLEAR(ADOConnection) THEN
CREATE(ADOConnection);
ADOConnection.ConnectionString:=
'Driver={SQL Server};'
+ 'Server='+'cronus'+';'
+ 'Database='+'cronus'+';'
+ 'Uid='+'sa'+';'
+ 'Pwd='+'sa'+';';
ADOConnection.Open;
IF ISCLEAR(ADOCommand) THEN
CREATE(ADOCommand);
VarActiveConnection := ADOConnection;
ADOCommand.ActiveConnection := VarActiveConnection;
// CommandType property
ADOCommand.CommandText := 'SP_Test';
ADOCommand.CommandType := 4;
ADOCommand.CommandTimeout := 0;
//CreateParameter method
ADOParameter:=ADOCommand.CreateParameter('@SalesCode', 200, 1, 30,'AH');
ADOCommand.Parameters.Append(ADOParameter);
ADOCommand.Execute;
IF ISCLEAR(ADORecSet) THEN
CREATE(ADORecSet);
ADORecSet.ActiveConnection := VarActiveConnection;
ADORecSet.Open(ADOCommand);
WHILE NOT ADORecSet.EOF DO BEGIN
MESSAGE(FORMAT(ADORecSet.Fields.Item('Nama').Value));
ADORecSet.MoveNext;
END;
ADOConnection.Close;
CLEAR(ADOConnection);
Wednesday, November 4, 2009
How to create Treeview layout in Navision
The important thing that in table must has : No, Name, Type(Heading, Begin-Total, Posting, End-Total, Total), Indentation, and Totaling field.
For Creating treeview form from the table, we just follow the logic from Chart of Account Overview form. I think it's quite simple to do that. First, we create 7 functions :
- InitTempTable (send parameter(Yes/No) to CopyCountryToTemp function)
- ExpandAll (to expand all)
- CopyCountryToTemp (Insert table data to temporary table)
- GetEndTotal (get Totaling data from "End-Total" to "Begin-Tota"
- HasChildren (Check whether has children or not)
- IsExpanded (Check whether has already expanded or not)
- ToggleExpandCollapse (toggle for expand and collapse)
How to create chart in Excel without using ChartWizard Object
//Excel Objet
//Walkthrough
Excel : 'Microsoft Excel 12.0 Object Library'.Application
Book : 'Microsoft Excel 12.0 Object Library'.Workbook
Range: 'Microsoft Excel 12.0 Object Library'.Range
Sheet : 'Microsoft Excel 12.0 Object Library'.Worksheet
Chart : 'Microsoft Excel 12.0 Object Library'.Chart
ChartObject : 'Microsoft Excel 12.0 Object Library'.ChartObject
ChartObjects : 'Microsoft Excel 12.0 Object Library'.ChartObjects
Series : 'Microsoft Excel 12.0 Object Library'.Series
SeriesCollection : 'Microsoft Excel 12.0 Object Library'.SeriesCollection
Axis : 'Microsoft Excel 12.0 Object Library'.Axis
IF NOT CREATE(Excel) THEN
CREATE(Excel);
Excel.Visible(FALSE);
Book := Excel.Workbooks.Add(-4167);
Sheet := Excel.ActiveSheet;
Sheet.Name := 'SHEET NAME';
//Sample Data
Sheet.Range('A2').Value := 'FY2008';
Sheet.Range('A3').Value := 'FY2009';
Sheet.Range('B1').Value := 'Sales Sept';
Sheet.Range('C1').Value := 'YTD Sept';
Sheet.Range('D1').Value := 'YTD Budget';
Sheet.Range('E1').Value := 'Collection';
Sheet.Range('F1').Value := 'COGS';
Sheet.Range('G1').Value := 'Gross Profit';
Sheet.Range('B2').Value := 119903.32;
Sheet.Range('C2').Value := 1284487.9;
Sheet.Range('D2').Value := 0;
Sheet.Range('E2').Value := 1281430.5;
Sheet.Range('F2').Value := 600345.81;
Sheet.Range('G2').Value := 684142.05;
Sheet.Range('B3').Value := 88616.06;
Sheet.Range('C3').Value := 875341.22;
Sheet.Range('D3').Value := 1094876;
Sheet.Range('E3').Value := 878037.17;
Sheet.Range('F3').Value := 456889.95;
Sheet.Range('G3').Value := 418451.27;
Range:=Sheet.Range('A1:G3');
Range.Columns.AutoFit;
//Create Chart Object
ChartObjects := Sheet.ChartObjects;
ChartObject := ChartObjects.Add(Excel.CentimetersToPoints(1),
Excel.CentimetersToPoints(2),
Excel.CentimetersToPoints(18),
Excel.CentimetersToPoints(10));
Chart := ChartObject.Chart;
Chart.SetSourceData(Range,2);
Chart.HasTitle := TRUE;
Chart.ChartTitle.Text := 'Sales Performances';
//Set Title on X-Axis
Axis := Chart.Axes(1);
Axis.HasTitle(TRUE);
Axis.AxisTitle.Text := 'Year to Date';
//Set Title on Y-Axis
Axis := Chart.Axes(2);
Axis.HasTitle(TRUE);
Axis.AxisTitle.Text := '$S';
//Set Series
Series := Chart.SeriesCollection(1);
Series.ChartType := 51;
Series := Chart.SeriesCollection(2);
Series.ChartType := 51;
Series := Chart.SeriesCollection(3);
Series.ChartType := 51;
Series := Chart.SeriesCollection(4);
Series.ChartType := 65;
Series := Chart.SeriesCollection(5);
Series.ChartType := 65;
Series := Chart.SeriesCollection(6);
Series.ChartType := 65;
Excel.Visible(TRUE);
Excel.UserControl(TRUE);
CLEAR(Excel);
The Result:
Tuesday, November 3, 2009
How to change Caption field on Runtime in Navision?
On CaptionClass property put :
1,5,, + txtYourCaption (or you can put a function to set the caption)
First parameter : 1 for Dimension, 2 for VAT
Second parameter :
1 --> Global Dimension (Code Caption)
2 --> Shortcut Dimension (Code Caption)
3 --> Global Dimension (Filter Caption)
4 --> Shortcut Dimension (Filter Caption)
5 --> Dimension Code (Code Caption)
6 --> Dimension Code (Filter Caption)
Third parameter : Dimension code you want. If this dimension is blank, it will show fourth parameter on the caption.
Fourth parameter : The value you want to show as caption
Formula :
Optional parameter 1 (3rd parameter) + dimension caption + Optional parameter 2 (4th parameter)
Note : Dont forget to put Currform.Updatecontrols to reload captions
Monday, November 2, 2009
Bos bikin kesalahan, Siapa yang tanggung?
Pada satu hari, si majikan bilang ama babi, “ Malam ini kita akan adain pesta, pergi siapkan biscuit untuk acara malam ini”
Si babi dengan serius bikin biscuit, dengan sepenuh hati. Namun ga lama kemudian, si majikan masuk ke dapur dan bertanya ama si Babi, “ Kenapa apinya kecil begitu?? Kecil begitu kapan matangnya??” Si Babi bilang ke majikan, “ Kalo apinya terlalu besar, nanti biskuitnya gosong”. Si majikan bilang ke babi, “ Kamu ini otak babi, kamu ngerti apa? Lakukan saja apa yang aku perintahkan!”
Akhirnya biskuitnya gosong seperti perkiraan si Babi... Lalu si babi bertanya ke majikan, “apa yg harus kita lakukan sekarang?”
Kata majikan, “Kalo gitu, kita ganti menu jadi steak babi saja”
Moral of the story:
“Bos selamanya tidak pernah salah, kalo ada salah pun Anda yang menanggung”
Bos
Setiap pagi babi itu mengikuti ayam jantan berkokok untuk membangunkan majikannya.
Dia belajar kaya kucing untuk menangkap tikus yang suka merusak.
Binatang2 yang laen bertanya ama si Babi, kenapa dia begitu "kaypo", ikut campur dalam banyak hal.
Tetapi satu hari, si Majikan datang dan babi tersebut ditangkapnya dan mau dipersiapkan untuk disembelih. Tetapi babi itu rasa2nya tidak percaya. Dan babi itupun akhirnya bertanya kepada majikannya, " Aku begitu banyak kemampuan, dan sudah banyak membantumu dalam banyak hal, kenapa Engkau mau menyembelihku?"
Majikan tersebut cuma menjawab, " Ga ada alasan khusus, aku cuma pengen makan steak babi"
Moral of the Story: Majikan hanya melihat dari apa yang seharusnya anda lakukan, bukan dari apa yang bisa Anda lakukan. (Kalo bos lagi mau “sembelih” orang, kapan aja bisa dan siapa aja bisa jadi “korban”. Jadi cukup lakukan apa saja yang seharusnya Anda lakukan, karena semua itu bisa jadi ga dihargai bos)