From 291cca6d5a46c34164d655c1bb12d80596cad4d6 Mon Sep 17 00:00:00 2001 From: Ishan Pranav Date: Sun, 18 Aug 2024 20:16:34 -0700 Subject: [PATCH] Breaking change to Other Income/Expense accounts --- src/Liber.Forms/Accounts/AccountDialog.cs | 2 +- .../Accounts/AccountDialog.es.resx | 132 ++++++++++++++++++ src/Liber.Forms/Accounts/AccountDialog.resx | 1 + src/Liber.Forms/Accounts/AccountForm.cs | 6 +- src/Liber.Forms/Reports/Xsl/XslReport.cs | 5 + src/Liber/AccountType.cs | 25 ++-- src/Liber/LocalizedResources.es-ES.resx | 6 + src/Liber/LocalizedResources.es.resx | 11 +- src/Liber/LocalizedResources.resx | 11 +- 9 files changed, 183 insertions(+), 16 deletions(-) create mode 100644 src/Liber.Forms/Accounts/AccountDialog.es.resx diff --git a/src/Liber.Forms/Accounts/AccountDialog.cs b/src/Liber.Forms/Accounts/AccountDialog.cs index 35f5e06..7852e36 100644 --- a/src/Liber.Forms/Accounts/AccountDialog.cs +++ b/src/Liber.Forms/Accounts/AccountDialog.cs @@ -21,7 +21,7 @@ public AccountDialog(EditableAccountView value) _listView.BeginUpdate(); - foreach (AccountType type in Enum.GetValues()) + foreach (AccountType type in AccountTypeExtensions.GetSortedValues()) { _listView.Groups.Add(type.ToString(), type.Humanize()); } diff --git a/src/Liber.Forms/Accounts/AccountDialog.es.resx b/src/Liber.Forms/Accounts/AccountDialog.es.resx new file mode 100644 index 0000000..b973edd --- /dev/null +++ b/src/Liber.Forms/Accounts/AccountDialog.es.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cuenta + + + &Cancelar + + + Nombre + + + Número + + \ No newline at end of file diff --git a/src/Liber.Forms/Accounts/AccountDialog.resx b/src/Liber.Forms/Accounts/AccountDialog.resx index d545226..724b660 100644 --- a/src/Liber.Forms/Accounts/AccountDialog.resx +++ b/src/Liber.Forms/Accounts/AccountDialog.resx @@ -161,6 +161,7 @@ O&K + @Invariant System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/src/Liber.Forms/Accounts/AccountForm.cs b/src/Liber.Forms/Accounts/AccountForm.cs index b9a9e79..c87d3b8 100644 --- a/src/Liber.Forms/Accounts/AccountForm.cs +++ b/src/Liber.Forms/Accounts/AccountForm.cs @@ -18,13 +18,9 @@ protected AccountForm(Company company) new ComponentResourceManager(GetType()).ApplyResources(this, "$this"); - AccountType[] types = Enum.GetValues(); - - Array.Sort(types, (x, y) => Math.Abs((short)x) - Math.Abs((short)y)); - Company = company; DialogResult = DialogResult.Cancel; - typeComboBox.DataSource = types; + typeComboBox.DataSource = AccountTypeExtensions.GetSortedValues(); taxTypeComboBox.DataSource = Enum.GetValues(); numberNumericUpDown.Maximum = decimal.MaxValue; } diff --git a/src/Liber.Forms/Reports/Xsl/XslReport.cs b/src/Liber.Forms/Reports/Xsl/XslReport.cs index 29da830..f0e8088 100644 --- a/src/Liber.Forms/Reports/Xsl/XslReport.cs +++ b/src/Liber.Forms/Reports/Xsl/XslReport.cs @@ -309,6 +309,11 @@ private void WriteTransactionXml(XmlWriter writer, Transaction value) private void WriteLineXml(XmlWriter writer, Line value) { + if (value.AccountId != Account.Id) + { + return; + } + writer.WriteStartElement("line"); writer.WriteElementString("account", Company.Accounts[value.AccountId].Name); writer.WriteElementString("debit", XmlConvert.ToString(value.Debit)); diff --git a/src/Liber/AccountType.cs b/src/Liber/AccountType.cs index 761859e..d8dc407 100644 --- a/src/Liber/AccountType.cs +++ b/src/Liber/AccountType.cs @@ -96,23 +96,32 @@ public enum AccountType : short [Name("EXP")] Expense = 6000, - /// - /// Specifies an income tax expense. This account type records taxes. - /// - [LocalizedDescription(nameof(IncomeTaxExpense))] - [Name("INC")] - IncomeTaxExpense = 7000, - /// /// Specifies an other income or expense account. This account is used for realized capital gains and losses and extraordinary income and expenses. /// [LocalizedDescription(nameof(OtherIncomeExpense))] [Name("EXEXP", "EXINC")] - OtherIncomeExpense = -9000 + OtherIncomeExpense = -6900, + + /// + /// Specifies an income tax expense. This account type records taxes. + /// + [LocalizedDescription(nameof(IncomeTaxExpense))] + [Name("INC")] + IncomeTaxExpense = 7000 } public static class AccountTypeExtensions { + public static AccountType[] GetSortedValues() + { + AccountType[] types = Enum.GetValues(); + + Array.Sort(types, (x, y) => Math.Abs((short)x) - Math.Abs((short)y)); + + return types; + } + public static bool IsAsset(this AccountType value) { switch (value) diff --git a/src/Liber/LocalizedResources.es-ES.resx b/src/Liber/LocalizedResources.es-ES.resx index 42a94e7..1c45bd9 100644 --- a/src/Liber/LocalizedResources.es-ES.resx +++ b/src/Liber/LocalizedResources.es-ES.resx @@ -117,6 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Determina la cuenta incluida en el informe. Los elementos de datos 'Cuenta' y 'Cuentas' son mutuamente excluyentes. + + + Determina las cuentas incluidas en el informe. Los elementos de datos 'Cuenta' y 'Cuentas' son mutuamente excluyentes. + Especifica el título del informe. diff --git a/src/Liber/LocalizedResources.es.resx b/src/Liber/LocalizedResources.es.resx index 27acc22..7662d9f 100644 --- a/src/Liber/LocalizedResources.es.resx +++ b/src/Liber/LocalizedResources.es.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Cuenta + Cuentas @@ -171,6 +174,9 @@ Tipo + + Fuente de datos + Fuente de datos @@ -201,6 +207,9 @@ Diseño + + Determina la cuenta incluida en el reporte. Los elementos de datos 'Cuenta' y 'Cuentas' son mutuamente excluyentes. + Cuenta por pagar @@ -208,7 +217,7 @@ Cuenta por cobrar - Determina las cuentas incluidas en el documento. + Determina las cuentas incluidas en el reporte. Los elementos de datos 'Cuenta' y 'Cuentas' son mutuamente excluyentes. Anualmente diff --git a/src/Liber/LocalizedResources.resx b/src/Liber/LocalizedResources.resx index 0097ede..183dfa8 100644 --- a/src/Liber/LocalizedResources.resx +++ b/src/Liber/LocalizedResources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Account + Accounts @@ -174,6 +177,9 @@ Type + + Data Source + Data Source @@ -204,6 +210,9 @@ Design + + Determines the account used in the report. The 'Account' and 'Accounts' fields are mutually exclusive. + Account Payable @@ -211,7 +220,7 @@ Account Receivable - Determines the accounts included in the report. + Determines the accounts included in the report. The 'Account' and 'Accounts' fields are mutually exclusive. Annually