{"id":642,"date":"2013-10-13T11:04:06","date_gmt":"2013-10-13T02:04:06","guid":{"rendered":"http:\/\/www.sambuichi.jp\/?p=642"},"modified":"2014-07-25T16:51:49","modified_gmt":"2014-07-25T07:51:49","slug":"xbrl-gl%e9%96%b2%e8%a6%a7%e3%82%b5%e3%83%bc%e3%83%93%e3%82%b9%e8%a9%a6%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/www.sambuichi.jp\/?p=642&lang=en","title":{"rendered":"XBRL GL Instance Viewing Service [Prototype](1\/3)"},"content":{"rendered":"<p>Views: 174<\/p><h1>XBRL GL Instance Viewing Service<\/h1>\n<p>These are prototype services for viewing XBRL GL instance documents generated by accounting softwares.<br \/>\n(You can find source programs at the <a href=\"https:\/\/github.com\/sunbridge\/xbrlgl\">GitHub<\/a>\u00a0site..)<\/p>\n<p>1. iphix sample(XBRL 2.1)<br \/>\n<a href=\"http:\/\/www.sambuichi.jp\/xbrlgl\/index.html\" target=\"_blank\">http:\/\/www.sambuichi.jp\/xbrlgl\/index.html<\/a><br \/>\nOriginal file location <a href=\"http:\/\/gl.iphix.net\/files.htm\" target=\"_blank\">http:\/\/gl.iphix.net\/files.htm<\/a><\/p>\n<p>2. PCA (XBRL 2.0a)<br \/>\n2.1 View of \u00a0document structure \u00a0of XBRL GL instance for each entry<br \/>\n<a href=\"http:\/\/www.sambuichi.jp\/xbrlgl\/pca.html\" target=\"_blank\">http:\/\/www.sambuichi.jp\/xbrlgl\/pca.html<\/a><br \/>\n2.2 View of journal entry by entered slip<br \/>\n<a href=\"http:\/\/www.sambuichi.jp\/xbrlgl\/journal_entry.html\" target=\"_blank\">http:\/\/www.sambuichi.jp\/xbrlgl\/journal_entry.html<\/a><br \/>\n2.3 View of summary by month and\/or chart of accounts. These documents are stored in database.<br \/>\n<a href=\"http:\/\/www.sambuichi.jp\/xbrlgl\/list.html\" target=\"_blank\">http:\/\/www.sambuichi.jp\/xbrlgl\/list.html<\/a><br \/>\n<!--more--><\/p>\n<h1>Programming TIPS: jQuery&#8217;s XML function<\/h1>\n<p>We processed XBRL files\u00a0with\u00a0HTML5, CSS3, jQuery, javascript in samples\u00a01. 2. 2.1. 2.2 .<br \/>\nXBRL GL instance documents are XML documents. We can use jQuery&#8217;s XML function.<br \/>\nXBRL GL instance documents are stored in a database at Amazon Web Service.<br \/>\nWhen you click a button, the next function load selected file with load_xmlfile().<\/p>\n<p><span class=\"small\">[javascript] glLoad function<\/span><\/p>\n<div class=\"codex\">\n<pre><code>function glLoad() {\r\n    var glSelectList = $('select#glselect');\r\n    var url = $('option:selected', glSelectList).val();\r\n    load_xmlfile(url);\r\n}\r\n<\/code><\/pre>\n<\/div>\n<p>load_xmlfile(url) reads XBRL GL instance document stored at the location defied by URL then process this document to generate page.<\/p>\n<p><span class=\"small\">[javascript] load_xmlfile function<\/span><\/p>\n<div class=\"codex\">\n<pre><code>function load_xmlfile(url) {\r\n    $.ajax({\r\n        url : url,\r\n        type : 'GET',\r\n        dataType : 'text',\r\n        timeout : 1000,\r\n        error : fnc_xmlerr, \/\/call \"fnc_xmlerr\" on failure\r\n        success : fnc_xml   \/\/call \"fnc_xml\" on success\r\n    });\r\n};<\/code><\/pre>\n<\/div>\n<p>When program consumed XBRL GL instance normally, this document is passed to fnc_xml(xml) function as an argument xml. XML function of jQuery can process this as a XML document.<br \/>\nWith fundamental knowledge of XBRL GL taxonomy, program was coded by an author. This version can only process a standard taxonomy. In case of extending taxonomy, you need special coding for handling extended items and\/or special error condition based on extended taxonomy.<br \/>\nXBRL GL instance document is \u00a0also a xml document, $(xml).find(&#8220;\u3000condition\u3000&#8221;) can find any items within a document.<br \/>\nFirstly, we lookup XBRL GL&#8217;s &lt;gl-cor:accountingEntries&gt;item.<\/p>\n<p><span class=\"small\">[javascript] Repeating process for loook up accountingEntries, entryHeader, entryDetail structure<\/span><\/p>\n<div class=\"codex\">\n<pre><code>\/\/ accountingEntries\r\n$accountingEntries = $(xml).find(\"gl-cor\\:accountingEntries\");\r\n\/\/ entryHeader\r\n$entryHeaders = $accountingEntries.find(\"gl-cor\\:entryHeader\");\r\n$entryHeaders.each(function(num, header) {\r\n    \/\/ entryDetail\r\n    $entryDetails = $(header).find(\"gl-cor\\:entryDetail\");\r\n    $entryDetails.each(function(line, detail) {\r\n        $account = $(detail).find(\"gl-cor\\:account\");\r\n        $accountMainDescription = $account.find(\"gl-cor\\:accountMainDescription\");\r\n        $accountSub = $account.find(\"gl-cor\\:accountSub\");\r\n        $accountSubDescription = $accountSub.find(\"gl-cor\\:accountSubDescription\");\r\n        $accountSubType = $accountSub.find(\"gl-cor\\:accountSubType\");\r\n        $amount = $(detail).find(\"gl-cor\\:amount\");\r\n        $debitCreditCode = $(detail).find(\"gl-cor\\:debitCreditCode\");\r\n        $postingDate = $(detail).find(\"gl-cor\\:postingDate\");\r\n        $detailComment = $(detail).find(\"gl-cor\\:detailComment\");\r\n    }    \r\n}<\/code><\/pre>\n<\/div>\n<p><span class=\"small\">[html] &lt;div&gt; element for defining a dynamic &lt;table&gt;<\/span><\/p>\n<div class=\"codex\">\n<pre><code>&lt;div id=\"trace\"&gt;&lt;\/div&gt;\r\n<\/code><\/pre>\n<\/div>\n<p><span class=\"small\">[javascript]\u3000Repeating process for generate &lt;table&gt; contents<\/span><\/p>\n<div class=\"codex\">\n<pre><code>$entryHeaders.each(function(num, header) {\r\n  \/\/ entryDetail\r\n  \/\/ Define &lt;table&gt;\r\n  $tableDetail = $('&lt;table class=\"detail\" width=\"97%\" border=\"1\" cellpadding=\"5\"&gt;&lt;\/table&gt;');\r\n  $(\"#trace\").append($tableDetail);\r\n  \/\/ Look up entryDetail items and store contents in variables\r\n  $entryDetails = $(header).find(\"gl-cor\\:entryDetail\");\r\n  $entryDetails.each(function(line, detail) {\r\n        \u2026 \u2026\r\n      if ($debitCreditCode.text()=='debit') {\r\n        $tableDetail.append($(\"&lt;tr\/&gt;\")\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text($postingDate.text()))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text($accountMainDescription.text()))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text($accountSubDescription.text()+\"(\"+$accountSubType.text()+\")\"))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text(\"\"))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text(\"\"))\r\n          .append($('&lt;td align=\"right\"&gt;&lt;\/td&gt;').text(addFigure($amount.text())))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text(\"\"))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text($detailComment.text()))\r\n        );\r\n      }\r\n      else if ($debitCreditCode.text()=='credit') {\r\n        $tableDetail.append($(\"&lt;tr\/&gt;\")\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text($postingDate.text()))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text(\"\"))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text(\"\"))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text($accountMainDescription.text()))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text($accountSubDescription.text()+\"(\"+$accountSubType.text()+\")\"))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text(\"\"))\r\n          .append($('&lt;td align=\"right\"&gt;&lt;\/td&gt;').text(addFigure($amount.text())))\r\n          .append($('&lt;td&gt;&lt;\/td&gt;').text($detailComment.text()))\r\n        );\r\n      }\r\n    }\r\n  }\r\n}<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Views: 174XBRL GL Instance Viewing Service These are prototype services for viewing XBRL GL instance documents [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":532,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/posts\/642"}],"collection":[{"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=642"}],"version-history":[{"count":2,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/posts\/642\/revisions"}],"predecessor-version":[{"id":674,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/posts\/642\/revisions\/674"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/media\/532"}],"wp:attachment":[{"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}