Merge Ralf Habacker's add-opening-balance-accounts into maint.

This commit is contained in:
John Ralls
2020-11-16 09:27:29 -08:00
75 changed files with 747 additions and 10 deletions

View File

@@ -1422,6 +1422,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Retained Earnings</act:name>

View File

@@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -783,6 +783,12 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1396,6 +1396,12 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -684,5 +684,11 @@
</act:commodity>
<act:description>Åbningssaldi</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -964,5 +964,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -964,5 +964,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -739,5 +739,11 @@
</act:commodity>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -843,6 +843,12 @@
</act:commodity>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1192,6 +1192,12 @@
</act:commodity>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">320d3cf62b418db6281c3cd8ec2e95c7</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1269,6 +1269,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:code>9000</act:code>
<act:parent type="new">26c3f10c1c7621661c1b813d6141280d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>9008 Saldenvorträge Debitoren</act:name>

View File

@@ -15678,6 +15678,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:code>9000</act:code>
<act:parent type="new">e57d948c9a884e179bd090118b9212f8</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Saldenvorträge Debitoren</act:name>

View File

@@ -14305,6 +14305,12 @@ Den Bereich habe ich mit „9999“ bezeichet, damit er unterhalb der regulären
</slot>
</act:slots>
<act:parent type="guid">ffca2686cb9963bea1089b796763dda0</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>9001-9007 Saldenvorträge, Sachkonten</act:name>

View File

@@ -786,5 +786,11 @@
</act:commodity>
<act:description>Αρχικά υπόλοιπα</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1420,6 +1420,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Retained Earnings</act:name>

View File

@@ -149,6 +149,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -781,5 +781,11 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1393,5 +1393,11 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -398,6 +398,12 @@
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:parent type="new">c0b1160d2dd6b3059acc5083348b282f</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Grants</act:name>

View File

@@ -1137,6 +1137,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">599b08659324698f0177ce3dbb513e5f</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Reserves and Surplus</act:name>

View File

@@ -753,5 +753,11 @@
</act:commodity>
<act:description>Balances de apertura</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -830,5 +830,11 @@
</act:commodity>
<act:description>Balances de apertura</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -397,6 +397,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">7081f24a5685d4dfcb8f143f0b7ee31d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1378,6 +1378,12 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>100</act:commodity-scu>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Gains enregistrés</act:name>

View File

@@ -750,5 +750,11 @@
</act:commodity>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1378,6 +1378,12 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>100</act:commodity-scu>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Gains enregistrés</act:name>

View File

@@ -750,5 +750,11 @@
</act:commodity>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1378,6 +1378,12 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>100</act:commodity-scu>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Gains enregistrés</act:name>

View File

@@ -750,5 +750,11 @@
</act:commodity>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>יתרת פתיחה</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Početni saldo</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -800,6 +800,12 @@
</act:commodity>
<act:description>Početni saldo</act:description>
<act:parent type="new">73f3a388cebe42a3bc40ab8db179d32d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1378,6 +1378,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Nyitóegyenlegek</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Céltartalékok</act:name>

View File

@@ -139,5 +139,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Nyitóegyenlegek</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -728,5 +728,11 @@
</act:commodity>
<act:description>Nyitóegyenlegek</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -144,5 +144,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Bilanci d'apertura</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -747,5 +747,11 @@
</act:commodity>
<act:description>Bilanci d'apertura</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1414,6 +1414,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>開始残高</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>内部留保</act:name>

View File

@@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>開始残高</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -775,5 +775,11 @@
</act:commodity>
<act:description>開始残高</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1390,5 +1390,11 @@
</act:commodity>
<act:description>開始残高</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -129,5 +129,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Sākuma bilance</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -736,5 +736,11 @@
</act:commodity>
<act:description>Kontu sākuma bilances</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1354,5 +1354,11 @@
</act:commodity>
<act:description>Sākuma bilances</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -739,5 +739,11 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1319,5 +1319,11 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Beginsaldi</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1387,5 +1387,11 @@
</act:commodity>
<act:description>Openingsbalans</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1414,6 +1414,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Bilanse otwarcia</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Zyski zatrzymane</act:name>

View File

@@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Bilanse otwarcia</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -775,5 +775,11 @@
</act:commodity>
<act:description>Bilanse otwarcia</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1387,5 +1387,11 @@
</act:commodity>
<act:description>Bilanse otwarcia</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -728,5 +728,11 @@
</act:commodity>
<act:description>Saldos Iniciais</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -746,5 +746,11 @@
</act:commodity>
<act:description>Saldos iniciais</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -843,6 +843,12 @@
</act:commodity>
<act:description>Остаток средств на начало периода</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -3835,6 +3835,12 @@
</slot>
</act:slots>
<act:parent type="new">cfd3ff3dffa577973d3c1c5def43e568</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Ödenmemiş Sermaye(-)</act:name>
@@ -3871,6 +3877,12 @@
</slot>
</act:slots>
<act:parent type="new">cfd3ff3dffa577973d3c1c5def43e568</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Sermaye Düzeltmesi Olumsuz Farkları(-)</act:name>

View File

@@ -1414,6 +1414,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>期初余额</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>留存收益</act:name>

View File

@@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>期初余额</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -775,5 +775,11 @@
</act:commodity>
<act:description>期初余额</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -1387,5 +1387,11 @@
</act:commodity>
<act:description>期初余额</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@@ -106,6 +106,7 @@ typedef struct _AccountWindow
GtkTreeView * parent_tree;
GtkWidget * parent_scroll;
GtkWidget * opening_balance_button;
GtkWidget * opening_balance_edit;
GtkWidget * opening_balance_date_edit;
GtkWidget * opening_balance_page;
@@ -205,6 +206,37 @@ gnc_account_commodity_from_type (AccountWindow * aw, gboolean update)
aw->commodity_mode = new_mode;
}
static void
gnc_account_opening_balance_button_update (AccountWindow *aw, gnc_commodity *commodity)
{
Account *account = aw_get_account (aw);
Account *ob_account = gnc_account_lookup_by_opening_balance (gnc_book_get_root_account (aw->book), commodity);
gboolean has_splits = xaccAccountCountSplits (account, FALSE) > 0;
if (xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
{
gtk_widget_set_sensitive (aw->opening_balance_button, FALSE);
return;
}
/* The opening balance flag can be edited, if the associated feature is enabled and
* there is no opening balance account or we are editing the only opening balance account
* and it has no splits assigned.
*/
if (!gnc_using_equity_type_opening_balance_account (gnc_get_current_book()))
return;
switch(aw->dialog_type)
{
case EDIT_ACCOUNT:
gtk_widget_set_sensitive (aw->opening_balance_button, (ob_account == NULL || ob_account == account) && has_splits == 0);
break;
case NEW_ACCOUNT:
gtk_widget_set_sensitive (aw->opening_balance_button, ob_account == NULL);
break;
}
}
/* Copy the account values to the GUI widgets */
static void
gnc_account_to_ui(AccountWindow *aw)
@@ -268,6 +300,12 @@ gnc_account_to_ui(AccountWindow *aw)
gtk_text_buffer_set_text (aw->notes_text_buffer, string, strlen(string));
gnc_account_opening_balance_button_update (aw, commodity);
flag = xaccAccountGetIsOpeningBalance (account);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->opening_balance_button),
flag);
flag = xaccAccountGetTaxRelated (account);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->tax_related_button),
flag);
@@ -434,6 +472,11 @@ gnc_ui_to_account(AccountWindow *aw)
if (null_strcmp (string, old_string) != 0)
xaccAccountSetNotes (account, string);
flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->opening_balance_button));
if (xaccAccountGetIsOpeningBalance (account) != flag)
xaccAccountSetIsOpeningBalance (account, flag);
flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->tax_related_button));
if (xaccAccountGetTaxRelated (account) != flag)
@@ -856,6 +899,9 @@ gnc_common_ok (AccountWindow *aw)
return FALSE;
}
/* update opening balance account */
gnc_find_or_create_equity_account (root, EQUITY_OPENING_BALANCE, commodity);
LEAVE("passed");
return TRUE;
}
@@ -1271,11 +1317,33 @@ commodity_changed_cb (GNCGeneralSelect *gsl, gpointer data)
AccountWindow *aw = data;
gnc_commodity *currency;
GtkTreeSelection *selection;
Account *account = aw_get_account (aw);
currency = (gnc_commodity *) gnc_general_select_get_selected (gsl);
if (!currency)
return;
if (xaccAccountGetIsOpeningBalance (account))
{
Account *ob_account = gnc_account_lookup_by_opening_balance (gnc_book_get_root_account (aw->book), currency);
if (ob_account != account)
{
gchar *dialog_msg = _("An account with opening balance already exists for the desired currency.");
gchar *dialog_title = _("Cannot change currency");
GtkWidget *dialog = gtk_message_dialog_new (gnc_ui_get_main_window (NULL),
0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
"%s", dialog_title);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
"%s", dialog_msg);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
gnc_general_select_set_selected (gsl, xaccAccountGetCommodity (account));
return;
}
}
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (aw->opening_balance_edit),
gnc_commodity_get_fraction (currency));
gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (aw->opening_balance_edit),
@@ -1283,6 +1351,7 @@ commodity_changed_cb (GNCGeneralSelect *gsl, gpointer data)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (aw->transfer_tree));
gtk_tree_selection_unselect_all (selection);
gnc_account_opening_balance_button_update (aw, currency);
}
static gboolean
@@ -1420,6 +1489,7 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (gnc_account_parent_changed_cb), aw);
aw->opening_balance_button = GTK_WIDGET(gtk_builder_get_object (builder, "opening_balance_button"));
aw->tax_related_button = GTK_WIDGET(gtk_builder_get_object (builder, "tax_related_button"));
aw->placeholder_button = GTK_WIDGET(gtk_builder_get_object (builder, "placeholder_button"));
aw->hidden_button = GTK_WIDGET(gtk_builder_get_object (builder, "hidden_button"));

View File

@@ -420,6 +420,7 @@ gnc_tree_model_account_get_column_type (GtkTreeModel *tree_model, int index)
case GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN:
case GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER:
case GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE:
return G_TYPE_BOOLEAN;
default:
@@ -956,6 +957,11 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
g_value_set_boolean (value, xaccAccountGetPlaceholder (account));
break;
case GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE:
g_value_init (value, G_TYPE_BOOLEAN);
g_value_set_boolean (value, xaccAccountGetIsOpeningBalance (account));
break;
default:
g_assert_not_reached ();
break;

View File

@@ -81,8 +81,9 @@ typedef enum
GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT,
GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN,
GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
/* internal hidden columns */
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,

View File

@@ -494,6 +494,29 @@ sort_by_placeholder (GtkTreeModel *f_model,
return xaccAccountOrder(account_a, account_b);
}
static gint
sort_by_opening_balance (GtkTreeModel *f_model,
GtkTreeIter *f_iter_a,
GtkTreeIter *f_iter_b,
gpointer user_data)
{
const Account *account_a, *account_b;
gboolean flag_a, flag_b;
/* Find the accounts */
sort_cb_setup (f_model, f_iter_a, f_iter_b, &account_a, &account_b);
/* Get the opening balance flags. */
flag_a = xaccAccountGetIsOpeningBalance (account_a);
flag_b = xaccAccountGetIsOpeningBalance (account_b);
if (flag_a > flag_b)
return -1;
else if (flag_a < flag_b)
return 1;
return xaccAccountOrder(account_a, account_b);
}
static gint
sort_by_xxx_period_value (GtkTreeModel *f_model,
GtkTreeIter *f_iter_a,
@@ -970,6 +993,14 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
sort_by_placeholder,
gnc_tree_view_account_placeholder_toggled);
gnc_tree_view_add_toggle_column(view, _("Opening Balance"),
C_("Column header for 'Opening Balance'", "O"),
"opening-balance",
GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_opening_balance,
NULL);
/* Add function to each column that optionally sets a background color for accounts */
col_list = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
for (node = col_list; node; node = node->next)

View File

@@ -1423,13 +1423,6 @@ on_finish (GtkAssistant *gtkassistant,
ENTER (" ");
com = gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT(data->currency_selector));
if (data->our_account_tree)
{
gnc_account_foreach_descendant (data->our_account_tree,
(AccountCb)starting_balance_helper,
data);
}
// delete before we suspend GUI events, and then muck with the model,
// because the model doesn't seem to handle this correctly.
if (data->initial_category)
@@ -1452,6 +1445,13 @@ on_finish (GtkAssistant *gtkassistant,
gnc_resume_gui_refresh ();
if (data->our_account_tree)
{
gnc_account_foreach_descendant (data->our_account_tree,
(AccountCb)starting_balance_helper,
data);
}
if (when_completed)
{
(*when_completed)();

View File

@@ -1669,6 +1669,11 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
gnc_account_n_children (account)))
{
do_delete_account (account, NULL, NULL, NULL);
/* update opening balance account */
gnc_find_or_create_equity_account (gnc_account_get_root(account),
EQUITY_OPENING_BALANCE,
xaccAccountGetCommodity (account));
return;
}
@@ -1703,8 +1708,15 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
adopt.subtrans.new_account,
adopt.subacct.new_account,
adopt.delete_res) == GTK_RESPONSE_ACCEPT)
{
do_delete_account (account, adopt.subacct.new_account,
adopt.subtrans.new_account, adopt.trans.new_account);
/* update opening balance account */
gnc_find_or_create_equity_account (gnc_account_get_root(account),
EQUITY_OPENING_BALANCE,
xaccAccountGetCommodity (account));
}
}
static int

View File

@@ -1504,6 +1504,23 @@
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="opening_balance_button">
<property name="label" translatable="yes">Opening balance</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">This account holds opening balance transactions. Only one account per commodity can hold opening balance transactions.</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">11</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>

View File

@@ -195,6 +195,15 @@ gnc_reverse_budget_balance (const Account *account, gboolean unreversed)
return FALSE;
}
gboolean gnc_using_equity_type_opening_balance_account (QofBook* book)
{
return gnc_features_check_used (book, GNC_FEATURE_EQUITY_TYPE_OPENING_BALANCE);
}
void gnc_set_use_equity_type_opening_balance_account (QofBook* book)
{
gnc_features_set_used (book, GNC_FEATURE_EQUITY_TYPE_OPENING_BALANCE);
}
gchar *
gnc_get_default_directory (const gchar *section)
@@ -955,17 +964,27 @@ gnc_find_or_create_equity_account (Account *root,
gnc_commodity *currency)
{
Account *parent;
Account *account;
Account *account = NULL;
gboolean name_exists;
gboolean base_name_exists;
const char *base_name;
char *name;
gboolean use_eq_op_feature;
g_return_val_if_fail (equity_type >= 0, NULL);
g_return_val_if_fail (equity_type < NUM_EQUITY_TYPES, NULL);
g_return_val_if_fail (currency != NULL, NULL);
g_return_val_if_fail (root != NULL, NULL);
use_eq_op_feature = equity_type == EQUITY_OPENING_BALANCE && gnc_using_equity_type_opening_balance_account (gnc_get_current_book ());
if (use_eq_op_feature)
{
account = gnc_account_lookup_by_opening_balance (root, currency);
if (account)
return account;
}
base_name = equity_base_name (equity_type);
account = gnc_account_lookup_by_name(root, base_name);
@@ -985,7 +1004,11 @@ gnc_find_or_create_equity_account (Account *root,
if (account &&
gnc_commodity_equiv (currency, xaccAccountGetCommodity (account)))
{
if (use_eq_op_feature)
xaccAccountSetIsOpeningBalance (account, TRUE);
return account;
}
name = g_strconcat (base_name, " - ",
gnc_commodity_get_mnemonic (currency), NULL);
@@ -997,7 +1020,11 @@ gnc_find_or_create_equity_account (Account *root,
if (account &&
gnc_commodity_equiv (currency, xaccAccountGetCommodity (account)))
{
if (use_eq_op_feature)
xaccAccountSetIsOpeningBalance (account, TRUE);
return account;
}
/* Couldn't find one, so create it */
if (name_exists && base_name_exists)
@@ -1027,6 +1054,9 @@ gnc_find_or_create_equity_account (Account *root,
xaccAccountSetType (account, ACCT_TYPE_EQUITY);
xaccAccountSetCommodity (account, currency);
if (use_eq_op_feature)
xaccAccountSetIsOpeningBalance (account, TRUE);
xaccAccountBeginEdit (parent);
gnc_account_append_child (parent, account);
xaccAccountCommitEdit (parent);

View File

@@ -56,6 +56,11 @@ gboolean gnc_using_unreversed_budgets (QofBook* book);
* don't match, return FALSE. */
gboolean gnc_reverse_budget_balance (const Account *account, gboolean unreversed);
/* Backward compatibility *******************************************
* Return that book's support opening balance accounts by equity type slot */
void gnc_set_use_equity_type_opening_balance_account (QofBook* book);
gboolean gnc_using_equity_type_opening_balance_account (QofBook* book);
/* Default directory sections ***************************************/
#define GNC_PREFS_GROUP_OPEN_SAVE "dialogs.open-save"
#define GNC_PREFS_GROUP_EXPORT "dialogs.export-accounts"

View File

@@ -116,6 +116,7 @@ enum
PROP_LOT_NEXT_ID, /* KVP */
PROP_ONLINE_ACCOUNT, /* KVP */
PROP_IS_OPENING_BALANCE, /* KVP */
PROP_OFX_INCOME_ACCOUNT, /* KVP */
PROP_AB_ACCOUNT_ID, /* KVP */
PROP_AB_ACCOUNT_UID, /* KVP */
@@ -467,6 +468,9 @@ gnc_account_get_property (GObject *object,
case PROP_AUTO_INTEREST:
g_value_set_boolean (value, xaccAccountGetAutoInterest (account));
break;
case PROP_IS_OPENING_BALANCE:
g_value_set_boolean(value, xaccAccountGetIsOpeningBalance(account));
break;
case PROP_PLACEHOLDER:
g_value_set_boolean(value, xaccAccountGetPlaceholder(account));
break;
@@ -595,6 +599,9 @@ gnc_account_set_property (GObject *object,
case PROP_AUTO_INTEREST:
xaccAccountSetAutoInterest (account, g_value_get_boolean (value));
break;
case PROP_IS_OPENING_BALANCE:
xaccAccountSetIsOpeningBalance (account, g_value_get_boolean (value));
break;
case PROP_PLACEHOLDER:
xaccAccountSetPlaceholder(account, g_value_get_boolean(value));
break;
@@ -940,6 +947,15 @@ gnc_account_class_init (AccountClass *klass)
FALSE,
static_cast<GParamFlags>(G_PARAM_READWRITE)));
g_object_class_install_property
(gobject_class,
PROP_IS_OPENING_BALANCE,
g_param_spec_boolean ("opening-balance",
"Opening Balance",
"Whether the account holds opening balances",
FALSE,
static_cast<GParamFlags>(G_PARAM_READWRITE)));
g_object_class_install_property
(gobject_class,
PROP_TAX_CODE,
@@ -3018,6 +3034,21 @@ gnc_account_lookup_by_code (const Account *parent, const char * code)
return NULL;
}
static gpointer
is_opening_balance_account (Account* account, gpointer data)
{
gnc_commodity* commodity = GNC_COMMODITY(data);
if (xaccAccountGetIsOpeningBalance(account) && gnc_commodity_equiv(commodity, xaccAccountGetCommodity(account)))
return account;
return nullptr;
}
Account*
gnc_account_lookup_by_opening_balance (Account* account, gnc_commodity* commodity)
{
return (Account *)gnc_account_foreach_descendant_until (account, is_opening_balance_account, commodity);
}
/********************************************************************\
* Fetch an account, given its full name *
\********************************************************************/
@@ -4128,6 +4159,22 @@ xaccAccountSetPlaceholder (Account *acc, gboolean val)
set_boolean_key(acc, {"placeholder"}, val);
}
gboolean
xaccAccountGetIsOpeningBalance (const Account *acc)
{
if (GET_PRIVATE(acc)->type != ACCT_TYPE_EQUITY)
return false;
return g_strcmp0(get_kvp_string_tag(acc, "equity-type"), "opening-balance") == 0;
}
void
xaccAccountSetIsOpeningBalance (Account *acc, gboolean val)
{
if (GET_PRIVATE(acc)->type != ACCT_TYPE_EQUITY)
return;
set_kvp_string_tag(acc, "equity-type", val ? "opening-balance" : "");
}
GNCPlaceholderType
xaccAccountGetDescendantPlaceholder (const Account *acc)
{
@@ -6034,6 +6081,11 @@ gboolean xaccAccountRegister (void)
(QofAccessFunc) xaccAccountGetTaxRelated,
(QofSetterFunc) xaccAccountSetTaxRelated
},
{
ACCOUNT_OPENING_BALANCE_, QOF_TYPE_BOOLEAN,
(QofAccessFunc) xaccAccountGetIsOpeningBalance,
(QofSetterFunc) xaccAccountSetIsOpeningBalance
},
{
ACCOUNT_SCU, QOF_TYPE_INT32,
(QofAccessFunc) xaccAccountGetCommoditySCU,

View File

@@ -930,6 +930,14 @@ Account *gnc_account_lookup_by_full_name (const Account *any_account,
Account *gnc_account_lookup_by_code (const Account *parent,
const char *code);
/** Find the opening balance account for the currency.
*
* @param account The account of which the sought-for account is a descendant.
* @param commodity The commodity in which the account should be denominated
* @return The descendant account of EQUITY_TYPE_OPENING_BALANCE or NULL if one doesn't exist.
*/
Account *gnc_account_lookup_by_opening_balance (Account *account, gnc_commodity *commodity);
/** @} */
/* ------------------ */
@@ -1191,6 +1199,22 @@ gboolean xaccAccountGetPlaceholder (const Account *account);
* @param val The new state for the account's "placeholder" flag. */
void xaccAccountSetPlaceholder (Account *account, gboolean val);
/** Get the "opening-balance" flag for an account. If this flag is set
* then the account is used for opening balance transactions.
*
* @param account The account whose flag should be retrieved.
*
* @return The current state of the account's "opening-balance" flag. */
gboolean xaccAccountGetIsOpeningBalance (const Account *account);
/** Set the "opening-balance" flag for an account. If this flag is set
* then the account is used for opening balance transactions.
*
* @param account The account whose flag should be set.
*
* @param val The new state for the account's "opening-balance" flag. */
void xaccAccountSetIsOpeningBalance (Account *account, gboolean val);
/** Returns PLACEHOLDER_NONE if account is NULL or neither account nor
* any descendant of account is a placeholder. If account is a
* placeholder, returns PLACEHOLDER_THIS. Otherwise, if any
@@ -1568,6 +1592,7 @@ const char * dxaccAccountGetQuoteTZ (const Account *account);
#define ACCOUNT_NOTES_ "notes"
#define ACCOUNT_BALANCE_ "balance"
#define ACCOUNT_NOCLOSING_ "noclosing"
#define ACCOUNT_OPENING_BALANCE_ "opening-balance"
#define ACCOUNT_CLEARED_ "cleared"
#define ACCOUNT_RECONCILED_ "reconciled"
#define ACCOUNT_PRESENT_ "present"

View File

@@ -51,6 +51,7 @@ static gncFeature known_features[] =
{ GNC_FEATURE_REG_SORT_FILTER, "Store the register sort and filter settings in .gcm metadata file (requires at least GnuCash 3.3)"},
{ GNC_FEATURE_BUDGET_UNREVERSED, "Store budget amounts unreversed (i.e. natural) signs (requires at least Gnucash 3.8)"},
{ GNC_FEATURE_BUDGET_SHOW_EXTRA_ACCOUNT_COLS, "Show extra account columns in the Budget View (requires at least Gnucash 3.8)"},
{ GNC_FEATURE_EQUITY_TYPE_OPENING_BALANCE, GNC_FEATURE_EQUITY_TYPE_OPENING_BALANCE " (requires at least Gnucash 4.3)" },
{ NULL },
};

View File

@@ -55,6 +55,7 @@ extern "C" {
#define GNC_FEATURE_REG_SORT_FILTER "Register sort and filter settings stored in .gcm file"
#define GNC_FEATURE_BUDGET_UNREVERSED "Use natural signs in budget amounts"
#define GNC_FEATURE_BUDGET_SHOW_EXTRA_ACCOUNT_COLS "Show extra account columns in the Budget View"
#define GNC_FEATURE_EQUITY_TYPE_OPENING_BALANCE "Use a dedicated opening balance account identified by an 'equity-type' slot"
/** @} */

View File

@@ -546,7 +546,7 @@ test_gnc_account_create_and_destroy (void)
GNCAccountType type;
gnc_commodity *commo;
gint commo_scu, mark;
gboolean non_std_scu, sort_dirty, bal_dirty, tax_rel, hide, hold;
gboolean non_std_scu, sort_dirty, bal_dirty, opening_balance, tax_rel, hide, hold;
gint64 copy_num;
gnc_numeric *start_bal, *start_clr_bal, *start_rec_bal;
gnc_numeric *end_bal, *end_clr_bal, *end_rec_bal;
@@ -571,6 +571,7 @@ test_gnc_account_create_and_destroy (void)
"end-balance", &end_bal,
"end-cleared-balance", &end_clr_bal,
"end-reconciled-balance", &end_rec_bal,
"opening-balance", &opening_balance,
"policy", &pol,
"acct-mark", &mark,
"tax-related", &tax_rel,
@@ -599,6 +600,7 @@ test_gnc_account_create_and_destroy (void)
g_assert (gnc_numeric_zero_p (*start_bal));
g_assert (gnc_numeric_zero_p (*start_clr_bal));
g_assert (gnc_numeric_zero_p (*start_rec_bal));
g_assert (!opening_balance);
g_assert (pol == xaccGetFIFOPolicy ());
g_assert (!mark);
g_assert (!tax_rel);

118
util/add-opening-balances Executable file
View File

@@ -0,0 +1,118 @@
#!/bin/sh
#
# Find opening balance accounts by translations and add slot with key 'opening-balance' to make them translation independent
#
# @author Ralf Habacker <ralf.habacker@freenet.de>
#
r=$(realpath $0)
r=$(dirname $r)
r=$(dirname $r)
# debug
#grep -rn -A1 '"Opening Balances"' $r/po | grep msgstr > translation-of-opening-balance-with-files.txt
#grep -rnf translation-of-opening-balance.txt $r/data/accounts > all-opening-balances-accounts.txt
if test -z "$1" || test "$1" == "--collect"; then
# collect all translations for 'Opening Balances'
grep -rn -A1 '"Opening Balances"' $r/po | grep msgstr | gawk '{ $1=""; print $0}' | sed 's,^ ,,g;s,",,g' | grep -v "^$" | sed 's,^,<act:name>,g;s,$,.*</act:name>,g' > translation-of-opening-balance.txt
# collect all translations for 'Opening Balances' with optional last character
grep -rn -A1 '"Opening Balances"' $r/po | grep msgstr | gawk '{ $1=""; print $0}' | sed 's,^ ,,g;s,",,g' | grep -v "^$" | sed 's,^,<act:name>,g;s,$,*</act:name>,g' >> translation-of-opening-balance.txt
# add custom strings
cat << EOF >> translation-of-opening-balance.txt
<act:name>Openingsbalans</act:name>
<act:name>9000 Saldenvortrag Sachkonten</act:name>
<act:name>9000 Saldenvorträge Sachkonten</act:name>
<act:name>Saldenvorträge Sachkonten</act:name>
EOF
fi
# collect all files that contains a translation for 'Opening Balances'
for i in $(grep -rnf translation-of-opening-balance.txt $r/data/accounts | sed 's,:[ ]*,:,g;s, ,#,g'); do
#echo $i
file=$(echo $i | sed 's,:.*$,,g')
pattern=$(echo $i | sed 's,^.*:<,<,g;s,#, ,g')
#echo "searching for $pattern in $file"
# add equity-type slot
gawk '
BEGIN {
found = 0;
slotadded = 0;
slotpresent = 0;
patternfound = 0;
}
# search for account name
$0 ~ PATTERN {
slotadded = 0
slotpresent = 0
patternfound = 1
replace = 1
#print "<!-- replace -->"
}
# opening-balance slot is already available
replace && $1 == "<slot:key>equity-type</slot:key>" {
slotkeypresent = 1
}
slotkeypresent && $1 == "<slot:value type=\"string\">opening-balance</slot:value>" {
replace = 0
slotpresent = 1
}
#exclude parent named like opening balance account
replace && $1 == "<slot:key>placeholder</slot:key>" {
replace = 0
}
# add new slots tag
replace && $1 == "</gnc:account>" {
if (slotkeypresent) {
print FILE ": slot equity-type already present with different value, could not tag '" PATTERN "' as opening balance account" > /dev/stderr
} else {
print " <act:slots>"
print " <slot>"
print " <slot:key>equity-type</slot:key>"
print " <slot:value type=\"string\">opening-balance</slot:value>"
print " </slot>"
print " </act:slots>"
slotadded = 1
replace = 0
}
}
{
print $0;
}
END {
if (!patternfound)
print FILE ": opening balance account not found with pattern " PATTERN > /dev/stderr
#if (!slotpresent && !slotadded)
#print FILE " opening balance account not found with pattern " PATTERN > /dev/stderr
}
' "PATTERN=$pattern" $file > $file.new
mv $file.new $file
done
oba=""
nooba=""
for i in $(find $r/data/accounts -name '*.gnucash-xea'); do
o=$(grep -Hn "opening-balance" $i)
if test -z "$o"; then
nooba="$nooba\n$i"
else
oba="$oba\n$i"
fi
done
echo "------------------------------------------------------------"
echo -e "The following files do not have an account with slot key 'opening-balance'"
echo -e $nooba
echo
echo "------------------------------------------------------------"
echo -e "The following files have an account with slot key 'opening-balance'"
echo -e $oba