<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>_bind_names</string> </key>
            <value>
              <object>
                <klass>
                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>_asgns</string> </key>
                        <value>
                          <dictionary>
                            <item>
                                <key> <string>name_container</string> </key>
                                <value> <string>container</string> </value>
                            </item>
                            <item>
                                <key> <string>name_context</string> </key>
                                <value> <string>context</string> </value>
                            </item>
                            <item>
                                <key> <string>name_m_self</string> </key>
                                <value> <string>script</string> </value>
                            </item>
                            <item>
                                <key> <string>name_subpath</string> </key>
                                <value> <string>traverse_subpath</string> </value>
                            </item>
                          </dictionary>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>_body</string> </key>
            <value> <string>portal = context.getPortalObject()\n
portal_simulation = context.portal_simulation\n
\n
gap_root = context.portal_categories.gap.jp.afbe\n
\n
portal_type = context.getPortalAccountingMovementTypeList()\n
\n
request = context.REQUEST\n
\n
at_date = request[\'at_date\'].latestTime()\n
simulation_state = request["simulation_state"]\n
section_uid = context.Base_getSectionUidListForSectionCategory(request["section_category"], request["section_category_strict"])\n
\n
def getGapCategoryValueList(gap_path_list):\n
  result = []\n
  for gap_path in gap_path_list:\n
    category = gap_root.restrictedTraverse(gap_path)\n
    subcategory_list = category.getCategoryChildValueList(include_if_child=0)\n
    if not subcategory_list:\n
      result.append(category)\n
    else:\n
      for subcategory in subcategory_list:\n
        result.append(subcategory)\n
  return result\n
\n
def getInventory(node_category_value):\n
  return portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=simulation_state, function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, portal_type=portal_type, node_category=node_category_value.getRelativeUrl())\n
\n
data_dict = {}\n
\n
data_dict[\'asset_list\'] = asset_list = []\n
data_dict[\'liability_list\'] = liability_list = []\n
data_dict[\'equity_list\'] = equity_list = []\n
data_dict[\'company_name\'] = portal.portal_categories.restrictedTraverse(request["section_category"]).getTranslatedTitle()\n
data_dict[\'date\'] = \'%d-%d-%d\' % (at_date.year(), at_date.month(), at_date.day())\n
\n
def addItem(list_, section_title=\'\', group_title=\'\', title=\'\', amount=None):\n
  list_.append({\'section_title\':section_title, \'group_title\':group_title, \'title\':title, \'amount\':amount})\n
\n
def addGapCategoryItem(list_, gap_path_list):\n
  total_amount = 0\n
  for category in getGapCategoryValueList(gap_path_list):\n
    amount = getInventory(category)\n
    addItem(list_, \'\', \'\', category.getTitle(), amount)\n
    total_amount += amount\n
  addItem(list_, title=\'Total\', amount=total_amount)\n
  return total_amount\n
\n
\n
\n
########################\n
#  Assets\n
########################\n
current_asset_total_amount = 0\n
fixed_asset_total_amount = 0\n
deferred_asset_total_amount = 0\n
\n
addItem(asset_list, \'Current Assets\')\n
current_asset_total_amount += addGapCategoryItem(asset_list, (\'5/53\', \'5/51\', \'4/41\', \'4/49\', \'5/50/503\', \'3\', \'4/44/441/4412\', \'4/44/443\'))\n
\n
addItem(asset_list)\n
\n
addItem(asset_list, \'Fixed Assets\')\n
\n
addItem(asset_list, group_title=\'Tangible Fixed Assets\')\n
fixed_asset_total_amount += addGapCategoryItem(asset_list, (\'2/21\', \'2/28\'))\n
\n
addItem(asset_list, group_title=\'Intangible Fixed Assets\')\n
fixed_asset_total_amount += addGapCategoryItem(asset_list, (\'2/20/205\', \'2/20/207/2071\'))\n
\n
addItem(asset_list, group_title=\'Investments and Other Assets\')\n
fixed_asset_total_amount += addGapCategoryItem(asset_list, (\'2/27/271\',\'2/20/208/2081\'))\n
\n
addItem(asset_list, title=\'Total\', amount=fixed_asset_total_amount)\n
\n
addItem(asset_list)\n
\n
addItem(asset_list, \'Deferred Assets\')\n
deferred_asset_total_amount += addGapCategoryItem(asset_list, (\'2/20/201\',))\n
\n
addItem(asset_list)\n
\n
addItem(asset_list, title=\'Total\', amount=current_asset_total_amount + fixed_asset_total_amount + deferred_asset_total_amount)\n
\n
\n
\n
########################\n
#  Liabilities\n
########################\n
liability_total_amount = 0\n
\n
addItem(liability_list, \'Current Liabilities\')\n
liability_total_amount += addGapCategoryItem(liability_list, (\'4/40\', \'4/46/461\', \'4/44/443/4431\', \'4/44/441/4412/44121\', \'4/44/441/4411/44112\', \'4/42/422\'))\n
\n
addItem(liability_list, \'Fixed Liabilities\')\n
liability_total_amount += addGapCategoryItem(liability_list, (\'5/50/505\', \'2/27/272\', \'4/42/423\', \'2/20/207/2072\', \'2/20/208/2082\'))\n
\n
addItem(liability_list)\n
\n
addItem(liability_list, title=\'Total\', amount=liability_total_amount)\n
\n
\n
\n
########################\n
#  Equity\n
########################\n
addGapCategoryItem(equity_list, (\'1/10\', \'1/11\', \'1/12\', \'1/13\'))\n
\n
return data_dict\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string></string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>AccountingTransactionModule_getJapaneseBalanceSheetDataDict</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
