(→Delphi) |
(→Delphi) |
||
Line 115: | Line 115: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
====Example-ST_Item==== | |||
<syntaxhighlight lang="delphi"> | |||
procedure TfmMain.dxbb_ST_ItemClick(Sender: TObject); | |||
var lMain, lDtl, lBizObj, lBizApp : Variant; | |||
i : integer; | |||
lTime : TDateTime; | |||
s : string; | |||
begin | |||
lTime := Now; | |||
lBizApp := CreateOleObject('SQLAcc.BizApp'); | |||
lBizObj := lBizApp.BizObjects.Find('ST_ITEM'); | |||
lMain := lBizObj.DataSets.Find('MainDataSet'); | |||
lDtl := lBizObj.DataSets.Find('cdsUOM'); | |||
s := self.Caption; | |||
for i := 1 to 2 do begin | |||
self.Caption := s + ' - ' + IntToStr(i); | |||
lBizObj.New; | |||
lMain.FindField('Code').value := 'Test-'+ IntToStr(i); | |||
lMain.FindField('Description').value := 'Testing - '+ IntToStr(i); | |||
lDtl.Edit; //For 1st UOM | |||
lDtl.FindField('UOM').value := 'PCS'; | |||
lDtl.FindField('Rate').AsFloat := 1; | |||
lDtl.FindField('RefCost').AsFloat := 10.20; | |||
lDtl.FindField('RefPrice').AsFloat := 25.00; | |||
lDtl.Post; | |||
lDtl.Append; //For 2nd UOM | |||
lDtl.FindField('UOM').value := 'CTN'; | |||
lDtl.FindField('Rate').AsFloat := 12; | |||
lDtl.FindField('RefCost').AsFloat := 102.00; | |||
lDtl.FindField('RefPrice').AsFloat := 240.00; | |||
lDtl.Post; | |||
lBizObj.Save; | |||
end; | |||
self.Caption := s; | |||
lTime := Now - lTime; | |||
MessageDlg(Format('[Elapsed Time: %s ]',[FormatDateTime ('hh:nn:ss:zzz', lTime)]), | |||
mtInformation, [mbOk], 0); | |||
end; | |||
</syntaxhighlight> | |||
==See also== | ==See also== |
Revision as of 08:21, 9 October 2015
Introduction
This is the "Bridge" direct live linking between External Program with SQL Accounting
Pros
- Can Live or Batch Update.
- Can do action such as New, Edit & Delete.
- About 95% of modules is covered.
- Can direct Retrieve/Get Information From Connected Database.
- Support GST.
- Free of Charge for End User. (Freeware)
Cons
- Must had SQL Accounting installed & running.
- Must self do checking else error prompt will unable to “capture”.
- Only supported in IE for JScript
Documentation
Linking Flow
Steps
- Install sqlaccounting
- Create Sample Data
- Login (username & password is Admin)
- Double click the SQLSDK.chm file
- Click Application Object | Business Objects
- Click the word "here"
- Click Yes
- In the list Look for (example)
- - AR_IV -> Customer Invoice
- - AR_CN -> Customer Credit Note
- - AP_PI -> Supplier Invoice
- - SL_ID -> Sales Invoice
- - ST_AJ -> Stock Adjustment
Problems
With CHM File
A. Problem with opening CHM Help files?
- Right click the chm file & select Properties
- At General tab Click Unblock button.
- Click Apply | Ok.
B. Still can't open CHM file?
- Login SQL Accounting
- Click Tools | Options
- Click Register & follow wizard
- Exit SQL Accounting
- Login SQL Accounting
- Run CHM File
With Compiler
If you compiler had error may try add the esfw10.dll file under the SQL Accounting\bin folder
Extra Notes
Login Database Profile
- Can use the "Common.Agent.RO" Report Objects to get the Profile info.
- Then use the cdsProfile Dataset
- - CompanyName Field
- - Remark Field
- Refer to "How to retrieve data from Customer Invoice Listing Report?" on chm
- - Can by pass the Steps 5 Spool Parameters
Example External Program
- http://www.estream.com.my/document/SQLLink/Accountinglink-VBDotNet.zip (Using VB.Net)
- http://www.estream.com.my/document/SQLLink/Customer_RO-VBScipt.zip (Using VB Script)
- http://www.estream.com.my/document/SQLLink/AR_PM-JScript.zip (Using JScript)
Delphi
Example-AR_PM
procedure TfmMain.dxbb_ARPMClick(Sender: TObject);
var lMain, lKO, lBizApp, lBizObj, lDocKey, V : Variant;
i : integer;
begin
lBizApp := CreateOleObject('SQLAcc.BizApp');
try
lBizObj := lBizApp.BizObjects.Find('AR_PM');
lMain := lBizObj.DataSets.Find('MainDataSet');
lKO := lBizObj.DataSets.Find('cdsKnockOff');
lBizObj.New;
lMain.FindField('DOCKEY').Value := -1;
lMain.FindField('DocNo').Value := '--PM Test--';
lMain.FindField('CODE').Value := '300-A0001';
lMain.FindField('DocDate').Value := '28 Aug 2016';
lMain.FindField('PostDate').Value := '28 Aug 2016';
lMain.FindField('Description').Value := 'Payment for A/c';
lMain.FindField('PaymentMethod').Value := '320-000';
lMain.FindField('DocAmt').AsFloat := 1060;
lMain.FindField('Cancelled').Value := 'F';
lMain.FindField('CHANGED').Value := 'F';
V := lBizApp.CreateOleVariantArray(2);
V.SetItem(0, 'IV'); //Document Type is either is IV or DN for Sales & PI or SD for Purchase
V.SetItem(1, '--IV Test--'); //Document Number
if lKO.Locate('DocType;DocNo', V.AsOleVariant, False, False) then
begin
lKO.Edit;
lKO.FindField('KOAmt').value := 500;
lKO.FindField('KnockOff').AsString := 'T';
lKO.Post;
end;
lBizObj.Save;
MessageDlg('AR_PM-DocNo : ''--PM Test--'' Posted...', mtInformation, [mbOK],0);
finally
lBizObj.Close;
end;
end;
Example-ST_Item
procedure TfmMain.dxbb_ST_ItemClick(Sender: TObject);
var lMain, lDtl, lBizObj, lBizApp : Variant;
i : integer;
lTime : TDateTime;
s : string;
begin
lTime := Now;
lBizApp := CreateOleObject('SQLAcc.BizApp');
lBizObj := lBizApp.BizObjects.Find('ST_ITEM');
lMain := lBizObj.DataSets.Find('MainDataSet');
lDtl := lBizObj.DataSets.Find('cdsUOM');
s := self.Caption;
for i := 1 to 2 do begin
self.Caption := s + ' - ' + IntToStr(i);
lBizObj.New;
lMain.FindField('Code').value := 'Test-'+ IntToStr(i);
lMain.FindField('Description').value := 'Testing - '+ IntToStr(i);
lDtl.Edit; //For 1st UOM
lDtl.FindField('UOM').value := 'PCS';
lDtl.FindField('Rate').AsFloat := 1;
lDtl.FindField('RefCost').AsFloat := 10.20;
lDtl.FindField('RefPrice').AsFloat := 25.00;
lDtl.Post;
lDtl.Append; //For 2nd UOM
lDtl.FindField('UOM').value := 'CTN';
lDtl.FindField('Rate').AsFloat := 12;
lDtl.FindField('RefCost').AsFloat := 102.00;
lDtl.FindField('RefPrice').AsFloat := 240.00;
lDtl.Post;
lBizObj.Save;
end;
self.Caption := s;
lTime := Now - lTime;
MessageDlg(Format('[Elapsed Time: %s ]',[FormatDateTime ('hh:nn:ss:zzz', lTime)]),
mtInformation, [mbOk], 0);
end;