{"id":21024,"date":"2022-04-11T13:55:46","date_gmt":"2022-04-11T11:55:46","guid":{"rendered":"https:\/\/help.openbee.com\/open-bee-scan-capture\/administrators-guide\/accounting\/setting-up-the-accounting-import\/accounting-import-bdd\/formatting-sql-queries\/"},"modified":"2026-05-13T09:40:00","modified_gmt":"2026-05-13T07:40:00","slug":"formatting-sql-queries","status":"publish","type":"page","link":"https:\/\/help.openbee.com\/en\/open-bee-scan-capture\/administrators-guide\/accounting\/setting-up-the-accounting-import\/accounting-import-bdd\/formatting-sql-queries\/","title":{"rendered":"Formatting SQL queries"},"content":{"rendered":"\n<p>For each of the accounting data in Open Bee\u2122 Scan Capture, here is the order, number, and attributes expected for each SQL query result.<\/p>\n\n<p><strong>EXPENSE ACCOUNT<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table class=\"has-black-color has-text-color\"><tbody><tr><th>Account Number<\/th><th>Entitled<\/th><th>Analytics allowed (0 or false, 1 or true)<\/th><th><em>Additional Information&#8230; (see notes)<\/em><\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>ACCOUNTS PAYABLE<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Account Number<\/th><th>Entitled<\/th><th>Third-party number<\/th><th><em>Discount Rate (Optional \/ Required if using additional information)<\/em><\/th><th><em>Additional Information&#8230; (see notes)<\/em><\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong><br\/>CUSTOMER ACCOUNT<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Account Number<\/th><th>Entitled<\/th><th>Third-party number<\/th><th><em>Discount Rate (Optional \/ Required if using additional information)<\/em><\/th><th><em>Additional Information&#8230; (see notes)<\/em><\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>VAT ACCOUNT (Up to 4.8.1)<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Account Number<\/th><th>Entitled<\/th><th><em>VAT Rate (Optional \/ Mandatory if using additional information)<\/em><\/th><th><em>Additional Information&#8230; (see notes)<\/em><\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>VAT ACCOUNT (Since 4.8.2)<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Account Number<\/th><th>Entitled<\/th><th><em>VAT Rate (Optional \/ Mandatory if using additional information)<\/em><\/th><th><em>(Optional) Analytics allowed (0 or false, 1 or true)<\/em><\/th><th><em>Additional Information&#8230; (see notes)<\/em><\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>EXERCISE<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Start Date<\/th><th>End Date<\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>NEWSPAPER<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Type (0 for buy, 1 for sell)<\/th><th>Name<\/th><th>Code<\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>ANALYTICAL PLAN<\/strong> <strong>(IN THE CASE OF ANALYTICAL BREAKDOWN BY PLAN)<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Analytical Plan Number<\/th><th>Title of the plan<\/th><th>Section Number<\/th><th>Section Title<\/th><th><em>Mandatory plan (Optional &#8211; Available in 4.1.0 &#8211; possible values 1,true, 0, false)<\/em><\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>ANALYTICAL BREAKDOWN GRID (IN THE CASE OF ANALYTICAL BREAKDOWN BY PLAN)<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Title of the grid<\/th><th>Analytical Plan Number<\/th><th>Section Number<\/th><th>Type of distribution (0 = Percentage, 1 = Balancing; 2 = Amount)<\/th><th>Distribution Value<\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>GRID ASSOCIATED WITH AN ACCOUNT (IN THE CASE OF ANALYTICAL BREAKDOWN BY PLAN)<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Associated Account Number<\/th><th>Analytical Plan Number<\/th><th>Title of the plan<\/th><th>Section Number<\/th><th>Section Title<\/th><th>Type of distribution (0 = Percentage, 1 = Balancing; 2 = Amount)<\/th><th>Distribution Value<\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong>ANALYTICAL PLAN<\/strong> <strong>(IN THE CASE OF ANALYTICAL BREAKDOWN BY SECTIONS)<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Group<\/th><th>Section Number<\/th><th>Section Title<\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p><strong><br\/>ANALYTICAL BREAKDOWN GRID (IN THE CASE OF SECTIONAL ANALYTICAL BREAKDOWN)<\/strong><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Title of the grid<\/th><th>Type of distribution (0 = Percentage, 1 = Balancing; 2 = Amount)<\/th><th>Distribution Value<\/th><th>Code Sections &#8230;<\/th><\/tr><\/tbody><\/table><\/figure>\n\n<p>In the case of a section breakdown grid, the <strong>&#8220;Section Code&#8221;<\/strong> column must be named with the name of the group, defined in the analytic plan query. It is possible to use as many <strong>&#8220;Code Sections&#8221;<\/strong> columns as groups.<\/p>\n\n<h2 class=\"wp-block-heading\">Remarks<\/h2>\n\n<p>Any information in italics after the mandatory columns is considered to be additional information<br\/>In order for this information to be recorded correctly, the column of the Bee Scan Capture must have a specific name that will be used as a key to find it in the Open Bee\u2122 Scan Capture software.<\/p>\n\n<p><em>In SQL, naming a column in a SELECT is done by adding the <strong>AS<\/strong> keyword behind the column&#8217;s value. Example for Expense Account:<\/em><\/p>\n\n<pre class=\"wp-block-code\"><code>SELECT NumCompte, libelleCompte, 1, profilTVA AS PROFIL_TVA, 'Autre infos' AS SUP_INFO\nFROM PlanCp<\/code><\/pre>\n\n<p>Their information, except in special cases (see paragraph below), is stored on the account and can be found on the <a href=\"https:\/\/help.openbee.com\/en\/open-bee-scan-capture\/administrators-guide\/accounting\/account-management\/\">account management<\/a> page.<\/p>\n\n<p><strong><u>Populate the third-party record via a SQL query<\/u><\/strong><\/p>\n\n<p>Since version 3.6.0 of Open Bee\u2122 Scan Capture, it is possible to feed the third-party sheet when importing the third-party plan.<br\/>To do this, simply use the additional information provided in the request. Indeed, an additional piece of information named with the ID of an index of the third-party record will have the effect of populating it when the third party is created or modified in Open Bee\u2122 Scan Capture.<\/p>\n\n<p>ex. &#8220;testcapture@gmail.com&#8221; AS MAIL_INDEX<\/p>\n\n<p>By default, the value of an additional piece of information corresponding to a third-party index will only populate the third-party record if:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>The imported value is not empty<\/li>\n\n\n\n<li>The value already present in the business partner card is empty<\/li>\n<\/ul>\n\n<p>If you want to force the addition or modification of a value, simply name your additional information: [ID_INDEX]_FORCE<\/p>\n\n<p>e.g. &#8220;testcapture@gmail.com&#8221; AS MAIL_INDEX_FORCE<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For each of the accounting data in Open Bee\u2122 Scan Capture, here is the order, number, and attributes expected for each SQL query result. EXPENSE ACCOUNT Account Number Entitled Analytics allowed (0 or false, 1 or true) Additional Information&#8230; (see notes) ACCOUNTS PAYABLE Account Number Entitled Third-party number Discount Rate (Optional \/ Required if using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":21018,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-21024","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21024","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/comments?post=21024"}],"version-history":[{"count":2,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21024\/revisions"}],"predecessor-version":[{"id":24137,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21024\/revisions\/24137"}],"up":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21018"}],"wp:attachment":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/media?parent=21024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}