{"id":21615,"date":"2022-04-11T13:59:46","date_gmt":"2022-04-11T11:59:46","guid":{"rendered":"https:\/\/help.openbee.com\/open-bee-smart-capture\/administrator-guide\/accounting\/gateway\/accounting-import-bdd-sql\/formatting-sql-queries\/"},"modified":"2024-05-20T14:43:35","modified_gmt":"2024-05-20T12:43:35","slug":"formatting-sql-queries","status":"publish","type":"page","link":"https:\/\/help.openbee.com\/en\/open-bee-smart-capture\/administrator-guide\/accounting\/gateway\/accounting-import-bdd-sql\/formatting-sql-queries\/","title":{"rendered":"Formatting SQL queries"},"content":{"rendered":"<div id=\"main-content\" class=\"wiki-content group\">\n<p>For each of the accounting data in Smart Capture, the order, number, and attributes expected for each SQL query result are as follows.<\/p>\n<p><strong>EXPENSE ACCOUNT<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Account Number<\/th>\n<th class=\"confluenceTh\">Entitled<\/th>\n<th class=\"confluenceTh\">Analytics allowed (0 or false, 1 or true)<\/th>\n<th class=\"confluenceTh\" colspan=\"1\"><span style=\"color: #808080;\"><em>Additional Information&#8230; (see notes) <\/em><\/span><\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>ACCOUNTS PAYABLE<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Account Number<\/th>\n<th class=\"confluenceTh\">Entitled<\/th>\n<th class=\"confluenceTh\">Third-party number<\/th>\n<th class=\"confluenceTh\" colspan=\"1\"><span style=\"color: #808080;\"><em>Discount Rate (Optional \/ Required if using additional information)<\/em><\/span><\/th>\n<th class=\"confluenceTh\" colspan=\"1\"><span style=\"color: #808080;\"><em>Additional Information&#8230; (see notes)<\/em><\/span><\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong><br \/>\nCUSTOMER ACCOUNT<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Account Number<\/th>\n<th class=\"confluenceTh\">Entitled<\/th>\n<th class=\"confluenceTh\">Third-party number<\/th>\n<th class=\"confluenceTh\" colspan=\"1\"><em><span style=\"color: #808080;\">Discount Rate (Optional \/ Required if using additional information)<\/span><\/em><\/th>\n<th class=\"confluenceTh\" colspan=\"1\"><span style=\"color: #808080;\"><em>Additional Information&#8230; (see notes)<\/em><\/span><\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>VAT ACCOUNT<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Account Number<\/th>\n<th class=\"confluenceTh\">Entitled<\/th>\n<th class=\"confluenceTh\"><span style=\"color: #808080;\"><em>VAT Rate (Optional \/ Mandatory if using additional information)<\/em><\/span><\/th>\n<th class=\"confluenceTh\" colspan=\"1\"><span style=\"color: #808080;\"><em>Additional Information&#8230; (see notes)<\/em><\/span><\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><em> <\/em><\/p>\n<p><strong>EXERCISE<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Start Date<\/th>\n<th class=\"confluenceTh\">End Date<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>NEWSPAPER<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Type (0 for buy, 1 for sell)<\/th>\n<th class=\"confluenceTh\">Name<\/th>\n<th class=\"confluenceTh\">Code<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>ANALYTICAL PLAN<\/strong> <strong>(IN THE CASE OF ANALYTICAL BREAKDOWN BY PLAN)<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Analytical Plan Number<\/th>\n<th class=\"confluenceTh\">Title of the plan<\/th>\n<th class=\"confluenceTh\">Section Number<\/th>\n<th class=\"confluenceTh\">Section Title<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>ANALYTICAL BREAKDOWN GRID (IN THE CASE OF ANALYTICAL BREAKDOWN BY PLAN)<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Title of the grid<\/th>\n<th class=\"confluenceTh\">Analytical Plan Number<\/th>\n<th class=\"confluenceTh\">Section Number<\/th>\n<th class=\"confluenceTh\">Type of distribution (0 = Percentage, 1 = Balancing; 2 = Amount)<\/th>\n<th class=\"confluenceTh\" colspan=\"1\">Distribution Value<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>GRID ASSOCIATED WITH AN ACCOUNT (IN THE CASE OF ANALYTICAL BREAKDOWN BY PLAN)<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Associated Account Number<\/th>\n<th class=\"confluenceTh\">Analytical Plan Number<\/th>\n<th class=\"confluenceTh\">Title of the plan<\/th>\n<th class=\"confluenceTh\">Section Number<\/th>\n<th class=\"confluenceTh\" colspan=\"1\">Section Title<\/th>\n<th class=\"confluenceTh\" colspan=\"1\">Type of distribution (0 = Percentage, 1 = Balancing; 2 = Amount)<\/th>\n<th class=\"confluenceTh\" colspan=\"1\">Distribution Value<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>ANALYTICAL PLAN<\/strong> <strong>(IN THE CASE OF ANALYTICAL BREAKDOWN BY SECTIONS)<\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\" colspan=\"1\">Group<\/th>\n<th class=\"confluenceTh\">Section Number<\/th>\n<th class=\"confluenceTh\">Section Title<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong><br \/>\nANALYTICAL BREAKDOWN GRID (IN THE CASE OF SECTIONAL ANALYTICAL BREAKDOWN) <\/strong><\/p>\n<div class=\"table-wrap\">\n<table class=\"confluenceTable\">\n<tbody>\n<tr>\n<th class=\"confluenceTh\">Title of the grid<\/th>\n<th class=\"confluenceTh\">Type of distribution (0 = Percentage, 1 = Balancing; 2 = Amount)<\/th>\n<th class=\"confluenceTh\">Distribution Value<\/th>\n<th class=\"confluenceTh\">Code Sections &#8230;<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"aui-message hint shadowed information-macro\">\n<div class=\"message-content\">\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<\/div>\n<\/div>\n<div class=\"aui-message hint shadowed information-macro\">\n<div class=\"message-content\">\n<p class=\"title\">Remarks<\/p>\n<div class=\"message-content\">\n<p>Additional information is available from version 3.4.0<\/p>\n<p>Any information that follows the columns indicated as mandatory (Black column) is considered as additional information<br \/>\nIn order for this information to be recorded correctly, the column of the Bee&#8217;s Smart Capture must have a specific name that will be used as a key to find it in the Open Bee Smart Capture software.<\/p>\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<div class=\"code panel pdl\" style=\"border-width: 1px;\">\n<div class=\"codeContent panelContent pdl\">\n<pre class=\"theme: Confluence; brush: java; gutter: false\" style=\"font-size: 12px;\">SELECT NumCompte, libelleCompte, 1, profilTVA AS PROFIL_TVA, 'Autre infos' AS SUP_INFO\nFROM PlanCp\n\n<\/pre>\n<\/div>\n<\/div>\n<p>Their information, except in special cases (see paragraph below), is stored on the account and can be found on the <a class=\"external-link\" href=\"https:\/\/help.openbee.com\/en\/open-bee-smart-capture\/administrator-guide\/accounting\/account-management\/\" rel=\"nofollow\">account management<\/a> page.<\/p>\n<p><strong><u>Populate the third-party record via a SQL query<\/u><\/strong><\/p>\n<p>It is possible to populate the third-party sheet when importing the third-party plan.<br \/>\nTo 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<p>ex. &#8220;testcapture@<a class=\"external-link\" href=\"http:\/\/gmail.com\/\" rel=\"nofollow\">gmail.com<\/a>&#8221; AS MAIL_INDEX<\/p>\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<ul>\n<li>The imported value is not empty<\/li>\n<li>The value already present in the business partner card is empty<\/li>\n<\/ul>\n<p>If you want to force the addition or modification of a value, simply name your additional information: [ID_INDEX]_FORCE<\/p>\n<p>e.g. &#8220;testcapture@gmail.com&#8221; AS MAIL_INDEX_FORCE<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>For each of the accounting data in Smart Capture, the order, number, and attributes expected for each SQL query result are as follows. 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 additional [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":21610,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"templates\/ob-help-products.php","meta":{"footnotes":""},"class_list":["post-21615","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21615","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\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/comments?post=21615"}],"version-history":[{"count":1,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21615\/revisions"}],"predecessor-version":[{"id":22296,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21615\/revisions\/22296"}],"up":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21610"}],"wp:attachment":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/media?parent=21615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}