TCInsight
From TurboCASH Wiki
Contents |
TCInsight
Introducion
The Core TurboCASH code is hundreds of thousands of lines long. Its a carreer move to get into compiling and developing it. For historical reasons it still includes a number of Commercial components. So compiling it is an expensive process. What we offer with TCInsight is a much cheaper and less time consumming entry point. As long as you have Delphi 7 and have installed some extra Open Source components, you can easily compile an make TurboCAHS Plugins.
Bug List
Inno Setup
Does it actually CHECK to see if the Delphi Directory is Correct?
Yes It will ask you to point to your delphi 7 directory and then check for Delphi 7, If not it will fail the plugin registration which can be run from the Start -> Programs -> TC Plugin Template at a later stage.
IMPORTANT - You must register the plugin template successfully.
Project Jedi Download
Components are predesigned VCL or components that we use in developing a project. In an ideal world we would write everything from scratch and have it exactly as we would like. This would make the project unnessesarily large and unwieldy. The Open Source concept of "Upstreaming" is more than just using someone else's component. Whoever we choose as our component developer effectively becomes part of the TurboCASH project, even if it is just in the virtual sense. That is why we pick out component suppliers very carefully.
When we began TurboCASH (1998), we did not have Open Source in mind, now we are religious about keeping it as pure Open Source as possible. Delphi and Windows keep us awake at night, but everything else should be Open Source. TCInsight tries to keep this rule.
The Jedi Project is a library of Open Source components that are available for downlaod from Sourceforge.
http://sourceforge.net/projects/jvcl
The Plugin Framework
The idea behind the Plugin framework is to give a new developer a simple entry path to the TurboCASH Project, a simple project that he or she can download and compile. This template serves as both a "Hello World" project and as a Template on which to build any Plugin. Once a new developer has cut his or her teeth on a simple app. of this nature, he or she will be ready to take on bigger projects.
The Plugin framework spec. Things the framework must know - this is a 10000 foot view.
1. The current language
2. The current set of books
3. The current environment variable eg: Default printer, user logged on, etc. We should read these into a commonobject.
We should have a simple Option, Help - About, that diplays this data.
4. Have common logos througout the app. Look and feel stays the same. This needs to be defined. All logos should be put into a directory \Bin\logos. This means that anyone can actually change the logo look of the progam or load their plugin logos in there as they wish to.
5. We must have dynamic menus so that the programmer can add his application to TC seamlessly in the space where it belongs, eg: an invoicing plugin should be under invoicing and not only under plugins. If the programmer does not want to use our framework, then he must fight for space under the plugins.
6. If we write this in different languages, we do not need a toolkit for TC - simply use the framework for your specific language.(think about it). We will have to get other programmers to participate. I can help with C++ and PHP. but the sky is the limit. First we will do this template from Delphi. PHP and Lazarus to follow. Every programmer will write his own data to his own database and do GL processing through the toolkit Sylvain and I are working on, but lets not get ahead of ourselves and start the inherited framework first.
7. The plugin must pick up the themes from TurboCASH's Current set of books. Each plugin must have the same Icon structure as in the main program or as a batch - POS screen - Invoice screen
8. We should create a reserved message area for each registered developer on the project, eg: each developer gets 1000 lines in the Language file. This means that we only have to translate once. We should introduce the concept of "Comments " /* into the language file so that we can state what the range of comments belongs to.
9. The template must compile with no commercial components other than Delphi.
10. It should include a sample of Reportman to introduce the developer to the Reportman banded report writer concept.
11. It should have its own help system, and should link into our online help system.
12. Our current plugins should be constructed to inherit from the Template, so that the next step for a new developer is to move onto an existing plugin.
13. The template should include an InnoSetup script for installing the plugin.
Method
The way i think we should do it is by creating base forms and data modules that the plugin programmer inherits from. All the variables will be exposed in the base form as properties so that the programmer references the parent only.
In a nutshell, the programmer will install our empty project to a shared repository. As soon as he inherits from it he can start programming. Where he writes his data to is his concern.
Installing the template
1. Run the Setup.exe (Not Yet Published). It will register a project template TC Insight under the projects Tab
2. To Start a project you must click File->New->Other->Projects TC Insight. It will ask you to save your new project to a directory of your choice.
3. After it has created your new project Click File->Save Project as "Your New Project Name.dpr" - This is important as it will compile your project under this name, by default it will also be your plugin's name.
Using the template
The template comes with an example page to demonstrate the different forms that are available. This page should be removed from your project once you start writing your own plug-in.
The different template forms are MainDB,MainDBMen,MainDBOutLook,dmMain. We suggest you use these template forms because it is allready setup to use your dmMain datamodule and has the translation override procedure declared, However you can inherit from any of the base forms, just remember to declare and override the SetLanguageDesc as it is an abstract call in the main base class DBTmpl.
All the template forms already know your current set of books, Language and the theme you are using.
MainDB Is a general purpose form.
MainDBMen is a menu type form with a image toolbar. To use the toolbar, double click the toolbar. An editor will open. Simply drag a button to the toolbar to insert or drag a button from the toolbar to remove it.We have tried to cater for all the TC Buttons.
If there isn't a button in the list you can simply add a button and associate an image with it from the imagetoolbar imagelist.
MainDBOutLook is an outlook type form. To use the outlook bar Simply right click the outlook bar and click on the outlook bar editor to add pages and buttons.
dmMain is a datamodule that we suggest you use for all your data access.
Posting data to TurboCASH
The template can also post data back to the TurboCASH database.
Use the TMPTCASH3 alias If you are going to use paradox tables.
TMPTCASH3 is a temporary alias created for the life of your plugin pointing to your current set of books.
The TCASH3 alias points to your TCash3 root directory.
Calling Precedence for sending data to TurboCASH
Generic
ImportTaxTypes(TaxTypeData : TDataSet,TaxAccount : String)
ImportContacts(ContactData : TDataSet)
Supplier
GroupInsert(GroupType : integer,GroupData : TDataSet); SupplierGROUP1
GroupInsert(GroupType : integer,GroupData : TDataSet); SupplierGROUP2
ImportSuppliers(SupplierData :TDataSet);
Customers
GroupInsert(GroupType : integer,GroupData : TDataSet); // repodes
GroupInsert(GroupType : integer,GroupData : TDataSet); CustomerGROUP1
GroupInsert(GroupType : integer,GroupData : TDataSet); CustomerGROUP21
ImportCustomers(CustomerData : TDataset)
Stock
ImportUnits(DataSet);
GroupInsert(GroupType : integer,GroupData : TDataSet); StockGROUP1
GroupInsert(GroupType : integer,GroupData : TDataSet); StockGROUP2
ImportStock(StockData : TDataSet)
Documents
GroupInsert(GroupType : integer,GroupData : TDataSet); DOCUMENTGROUP1
GroupInsert(GroupType : integer,GroupData : TDataSet); DOCUMENTGROUP2
ImportDocument(DocHeadData,DocLinData : TDataSet; ProcessTax : boolean)
Gl Accounts
ImportGLAccount(AccountData : TDataset);
Batches
ImportBatch(BatchTypeId : Integer; GLData :TDataset);
To use any of these calls simply use any dataset derived from tdataset and pass it to the call.
Import Tax Types
ImportTaxTypes(TaxTypeData : TDataSet,TaxAccount : String)
If the import fails read the ImportErrors Stringlist.
Supply the TaxTypeData parameter with the following fields
TAXTYP INTEGER, DESCR string(15), TAXPERC Numeric/Float
Supply the TaxAccount parameter with the base taxaccount.
The default = '950'
Import Contacts
ImportContacts(ContactData : TDataSet)
If the import fails read the ImportErrors Stringlist.
Supply the ContactData with The following Fields
RESOURCEID integer ?? FIRSTNAME string(50) LASTNAME STRING(50) BIRTHDATE TIMESTAMP ANNIVERSARY TIMESTAMP GENDER STRING(1) TITLE string(50) COMPANY STRING(50) JOB_POSITION STRING (30) ADDRESS STRING(100) CITY STRING(50) STATE STRING(25) ZIP STRING(10) COUNTRY STRING(25) NOTE STRING(255) PHONE1 STRING(25) - Phone 1 PHONE2 STRING(25) - Phone 2 PHONE3 STRING(25) - Fax PHONE4 STRING(25) PHONE5 STRING(25) PHONETYPE1 INTEGER ?? PHONETYPE2 INTEGER ?? PHONETYPE3 INTEGER ?? PHONETYPE4 INTEGER ?? PHONETYPE5 INTEGER ?? CATEGORY INTEGER ?? EMAIL STRING(100) CUSTOM1 STRING(100) CUSTOM2 STRING(100) CUSTOM3 STRING(100) CUSTOM4 STRING(100) USERFIELD0 STRING(100) USERFIELD1 STRING(100) USERFIELD2 STRING(100) USERFIELD3 STRING(100) USERFIELD4 STRING(100) USERFIELD5 STRING(100) USERFIELD6 STRING(100) USERFIELD7 STRING(100) USERFIELD8 STRING(100) USERFIELD9 STRING(100) DSYSDATE TIMESTAMP
Import Groups
ImportGroups(GroupType : integer,GroupData : TDataSet)
If the import fails read the ImportErrors Stringlist.
Supply the GroupType parameter the following group types.
General Legder group1 = 20 General Ledger group2 = 21 Customer/Debtor group1 = 22 Customer/Debtor group2 = 23 Supplier/Creditor group1 = 24 Supplier/Creditor group2 = 25 Stock/inventory group1 = 26 Stock/inventory group2 = 27 Document Group1 = 28 Document Group2 = 29 Rep/SalesmanGroup = 31
Supply the GroupData with the following Fields.
DESCR string(30)
MAINFINCAT Integer We only have 5 financial categories in TC. You have to map your financial categories to the turbocash categories. ALL ASSETS : MAINFINCAT = 69. ALL CAPTIAL : MAINFINCAT = 67. ALL EXPENSES : MAINFINCAT = 66. ALL INCOME : MAINFINCAT = 68. ALL LIABILITIES : MAINFINCAT = 65. This only applies to Account groups
Import Suppliers
ImportSuppliers(SupplierData :TDataSet)
If the import fails read the ImportErrors Stringlist.
Supply the SupplierData with The following Fields
SUPPID string(6) - IMPORTANT The Supplier Id Cannot be longer than 6 characters SUPPNAME string(35) SUPPGRPDESC2 String(30) - Supplier Group1 description Not the group ID SUPPGRPDESC1 String(30) - Supplier Group2 description Not the group ID CONTACT string(50) FAX string(20) E_MAIL String(50) TEL String(20) CELL string(20) ADDR1 String(30) ADDR2 String(30) ADDR3 String(30) PCODE String(8) DELADD1 String(30) DELADD2 String(30) DELADD3 String(30) CREDLIM NUMERIC/FLOAT OPENITEMIND String (1) - 'O' = Open Item, Any Other Char = Balance brought Forward DISCOUNT NUMERIC/FLOAT
Import Customers
ImportCustomers(CustomerData : TDataset)
If the import fails read the ImportErrors Stringlist.
Supply the CustomerData with The following Fields
CUSTID String(6) - IMPORTANT The Customer Id cannot be longer than 6 characters, CUSTNAME string(35) CUSTGRPDDESC1 STRING(30) - Customer Group1 description Not the group ID CUSTGRPDDESC2 STRING(30) - Customer Group2 description Not the group ID CONTACT string(50) FAX string(20) EMAIL String(50) TEL String(20) CELL string(20) ADDR1 String(30) ADDR2 String(30) ADDR3 String(30) ACODE String(8) DELADD1 String(30) DELADD2 String(30) DELADD3 String(30) DELCODE String(8) CREDLIM NUMERIC/float DISCOUNT NUMERIC/Float CHARGEAMOUNT NUMERIC/Float OPENITEMIND String (1) - 'O' = Open Item, Any Other Char = Balance brought Forward HOLDIND String(1) - 'O' = Open, Any Other Char = On Hold VATNUMBER String(15) SALESMANDESC String(30)
Import Stock
ImportStock(StockData : TDataSet)
If the import fails read the ImportErrors Stringlist.
Supply the StockData with The following Fields
OPENINGAVECOST NUMERIC/FLOAT ?? QTYONHAND NUMERIC/FLOAT ?? OPENINGQTY NUMERIC/FLOAT ?? INVQTYONHAND NUMERIC/FLOAT ?? STOCKCODE STRING(15), DESCRIPTION STRING(35), COST NUMERIC/FLOAT, AVGCOST NUMERIC/FLOAT, SELL1 NUMERIC/FLOAT, SELL2 NUMERIC/FLOAT, SELL3 NUMERIC/FLOAT, MINSTOCK NUMERIC/FLOAT UNITSDESC STRING(8), STKCATDESC1 STRING(30) - Stock Group1 description Not the group ID STKCATDESC2 STRING(30) - Stock Group2 description Not the group ID BARCODENUM STRING(25) COSTACCOUNTMAIN STRING(3) - Cost of sales main GL account eg '100' COSTACCOUNTSUB STRING(3) - Cost of sales sub GL account eg '000' SALESACCOUNTMAIN STRING(3) - Sales main GL account eg '100' SALESACCOUNTSUB STRING(3) - Sales sub GL account eg '000' STOCKACCOUNTMAIN STRING(3) - Stock control main account eg '750' STOCKACCOUNTSUB STRING(3) - Stock control sub account eg '000' INPUTTAXMAIN STRING(3) - Input tax main account eg '950' INPUTTAXSUB STRING(3) - Input tax sub account eg '001' OUTPUTTAXMAIN STRING(3) - Output tax main account eg '950' OUTPUTTAXSUB STRING(3) - Output tax sub account eg '001' APPLYINVOICEDISCOUNT STRING(1)- 'T' = True Anything Else = False
Import Documents
ImportDocument(DocHeadData,DocLinData : TDataSet; ProcessTax : boolean)
DocHeadData should have one record only.
DocLinData must have all the lines corresponding to the DocHeadData
Orders and Quotes does not get handled at all.
This Function will return true if the document update was sucessful. It gives you the opportunity to update your document as posted if the document update was successful.
Check ImportErrors if it fails.
Supply the DocHeadData with The following Fields
ACCOUNTTYPE Integer - 1 = Debtor , 2 = Creditor ACCOUNT Integer - account number of your debtor/creditor DOCNUM String(15) DOCTYPE Integer - 10 = Invoice ,11 = Credits, 12 = Purchase, 13 = Goods Returned DOCDATE DateTime ?? ALLOCATEDDATE DateTime ?? ORDNUM string (15) PRINTED string(1) - 'P' = Printed , Anything else = Not Printed EXCLUSIVE string(1)- 'E' = EXclusive, Anything else = Inclusive DOCDISC Float PAYMENTTYPEID Integer ?? PAYMENTGROUPID Integer ?? ADDR1 String(35) ADDR1 String(35) ADDR1 String(35) PCODE String(35) DELADDR1 String(35) DELADDR2 String(35) DELADDR3 String(35) DELCODE String(35) SALESMANDESC STRING(30) DOCGROUPDESC1 string(30) - Document Group1 description Not the group ID DOCGROUPDESC2 string(30) - Document Group2 description Not the group ID NETTDOCAMOUNT float TAXAMOUNT Float DOCAMOUNT Float
Supply the DocLinData with The following Fields
LINEID Integer - 1 = Docline1, 2 = Docline2 etc. STOCKCODE String(15) STOCKDESC string(35) QTYORDERED Float QTYSHIPPED Float SELLINGPRICE Float EXCLUSIVEAMT Float ITEMDISCOUNT Float TAXAMOUNT Float INCLUSIVEAMT Float
The ProcessTax Parameter is a boolean type
True = Process Tax on the document False = Do not process Tax on the document
Import GL Accounts
ImportGLAccount(AccountData : TDataset);
If the import fails read the ImportErrors Stringlist.
Supply the AccountData with the following Fields
ACCOUNTCODE string(6) Account Code no hyphens 950001 eg
DESCRIPTION string(35) Account description
ACCGROUPDESC1 STRING(30) Description of the Account Group 1. Check Your Groups Table
ACCGROUPDESC2 STRING(30) Description of the Account Group 2. Check Your Groups Table
ISSUBACCOUNTS CHAR(1) 1 T = true, all else false. Are there SubAccounts for this Account?
Remember to include the main account If there
are SubAccounts. Do Not Just The SubAccounts
EG Account 935001 Points to a SubAccount. The
main account should be 935000(MUST BE In YOUR DATA SET)
if you are supplying The main account in the same dataset
remember to do it before any of the SubAccounts
get processed
ISINCOMEEXPENSE CHAR(1) T = TRUE , all Else false.
Import Batch
ImportBatch(BatchTypeId : Integer; BatchData :TDataset);
If the import fails read the ImportErrors Stringlist.
Batch processing from the template is a contra per line batch. It is easier
to follow should you need to reconcile.
It works very simply - supply the batch processor with a predefined
dataset.
Every row in the dataset will produce the debit and the credit entry.
It is self balancing, You do not have to balance the batch manually.
All you need to do in TurboCASH is update the batch.
eg. Input-> Update ledger(F3)->Batches -> update.
The ImportBatch is a boolean funtion.
If the import fails read the ImportErrors To determine the problem.
Supply the BatchData with The following Fields
do not add hyphens eg acount 010-000 = 010000
MAINACCOUNT String(6) This Is the main account you are processing to
TAXACCOUNT String(6) if this is empty no tax will be procesessed
if you want tax to be processed supply the tax account to be used.
CONTRAACCOUNT String(6) This will create the contra account entry.
REFERENCE String(15) Any reference to the batch. eg July Data Correction.Keep the reference the
same throughout the batch it is easier to trace.
DESCRIPTION String(35) Description pertaining to the current import line. eg Fix Sales account.
MAINACCOUNTTYPE Integer What type is your main account 0 = GL, 1 = Customers, 2 = Suppliers.
CONTRAACCOUNTTYPE AsInteger What type is your contra account0 = GL, 1 = Customers, 2 = Suppliers.
BATCHLINEAMOUNT Float This is the amount excluding Tax
IMPORTTYPE String 'C' =Credit everyting else a debit This relates to the main account.
TRANSDATE DateTime Date of the batch line It might not be the current date.
The BatchTypeId Parameter is an Inteeger type
check field WBatchTypeID in BatTypes.db of your set of books to use the correct batch