Last code for sprint Red-5
This commit is contained in:
+15
-2
@@ -8,6 +8,7 @@ using Swarmops.Database;
|
||||
using Swarmops.Logic.Communications;
|
||||
using Swarmops.Logic.Communications.Transmission;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Utility;
|
||||
using Swarmops.Utility.BotCode;
|
||||
@@ -470,9 +471,9 @@ namespace Swarmops.Backend
|
||||
|
||||
if (SwarmDb.DbVersion < SwarmDb.DbVersionExpected)
|
||||
{
|
||||
BotLog.Write (1, "MainCycle", "Entering DbUpgrade");
|
||||
BotLog.Write (1, "OneHour", "Entering DbUpgrade");
|
||||
DatabaseMaintenance.UpgradeSchemata();
|
||||
BotLog.Write (1, "MainCycle", "Exited DbUpgrade");
|
||||
BotLog.Write (1, "OneHour", "Exited DbUpgrade");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -483,6 +484,18 @@ namespace Swarmops.Backend
|
||||
|
||||
try
|
||||
{
|
||||
BotLog.Write(1, "OneHour", "Entering Automatch");
|
||||
Organizations organizations = Organizations.GetAll();
|
||||
foreach (Organization organization in organizations)
|
||||
{
|
||||
if (organization.IsEconomyEnabled)
|
||||
{
|
||||
BotLog.Write(1, "OneHour", "Automatching org #" + organization.Identity.ToString(CultureInfo.InvariantCulture));
|
||||
Payouts.AutomatchAgainstUnbalancedTransactions(organization);
|
||||
}
|
||||
}
|
||||
BotLog.Write(1, "OneHour", "Exited Automatch");
|
||||
|
||||
/*TestTrace("Running PaymentGroupMapper.Run()...");
|
||||
PaymentGroupMapper.Run();
|
||||
TestTrace(" done.\r\n");*/
|
||||
|
||||
@@ -85,6 +85,11 @@ namespace Swarmops.Logic.Financial
|
||||
}
|
||||
}
|
||||
|
||||
public Organization Organization
|
||||
{
|
||||
get { return Organization.FromIdentity (base.OrganizationId); }
|
||||
}
|
||||
|
||||
public Documents Documents
|
||||
{
|
||||
get { return Documents.ForObject (this); }
|
||||
|
||||
@@ -648,4 +648,16 @@
|
||||
<value>Options</value>
|
||||
<comment>For various page-specific checkboxes etc</comment>
|
||||
</data>
|
||||
<data name="Global_LoadingPlaceholder" xml:space="preserve">
|
||||
<value>[...loading...]</value>
|
||||
</data>
|
||||
<data name="Global_LoadingPlaceholderShort" xml:space="preserve">
|
||||
<value>[...]</value>
|
||||
</data>
|
||||
<data name="Global_NoMatch" xml:space="preserve">
|
||||
<value>(no match)</value>
|
||||
</data>
|
||||
<data name="Global_Working" xml:space="preserve">
|
||||
<value>Working...</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -129,9 +129,6 @@
|
||||
<data name="BalanceSheet_AccountName" xml:space="preserve">
|
||||
<value>Account</value>
|
||||
</data>
|
||||
<data name="BalanceSheet_Assets" xml:space="preserve">
|
||||
<value>Assets</value>
|
||||
</data>
|
||||
<data name="BalanceSheet_ContentHeader" xml:space="preserve">
|
||||
<value>Balance Sheet for {0},</value>
|
||||
<comment>{0} is the organization name. The year follows immediately, so keep ending comma.</comment>
|
||||
@@ -139,9 +136,6 @@
|
||||
<data name="BalanceSheet_Current" xml:space="preserve">
|
||||
<value>Current</value>
|
||||
</data>
|
||||
<data name="BalanceSheet_Debt" xml:space="preserve">
|
||||
<value>Liabilities</value>
|
||||
</data>
|
||||
<data name="BalanceSheet_DownloadFileName" xml:space="preserve">
|
||||
<value>BalanceSheet</value>
|
||||
<comment>Must ONLY contain A-Z, a-z characters - nothing accented!</comment>
|
||||
@@ -179,16 +173,10 @@
|
||||
<value>P&L for {0} for</value>
|
||||
<comment>The {0} is the organization name. The year number follows this string.</comment>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Costs" xml:space="preserve">
|
||||
<value>Expenses</value>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_DownloadFileName" xml:space="preserve">
|
||||
<value>ProfitLoss</value>
|
||||
<comment>Must ONLY contain A-Z, a-z characters - nothing accented!</comment>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Income" xml:space="preserve">
|
||||
<value>Revenue</value>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Info" xml:space="preserve">
|
||||
<value>The P&L is an overview of income and expenditures, which are grouped by budgets or cost/income type. The sum of all income and expenditure is the yearly result. You may also want to look at the <a href="BalanceSheet.aspx">balance sheet</a> which is the overview of assets and debts.</value>
|
||||
</data>
|
||||
@@ -198,18 +186,6 @@
|
||||
<data name="ProfitLossStatement_PageTitle" xml:space="preserve">
|
||||
<value>Profit & Loss Statement</value>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Q1" xml:space="preserve">
|
||||
<value>Q1</value>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Q2" xml:space="preserve">
|
||||
<value>Q2</value>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Q3" xml:space="preserve">
|
||||
<value>Q3</value>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Q4" xml:space="preserve">
|
||||
<value>Q4</value>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Results" xml:space="preserve">
|
||||
<value>Results</value>
|
||||
<comment>Footer on P&L statement</comment>
|
||||
@@ -694,7 +670,7 @@
|
||||
<value>Some auto-imported financial transactions can't be automatically matched to the ongoing accounting. This is where you manually match such transactions to "balance" them (if a transaction only has one part completed, like the money sent to the organization with no record of what the money is for, the transaction is said to be "unbalanced").</value>
|
||||
</data>
|
||||
<data name="BalanceTransactions_ModalHeader" xml:space="preserve">
|
||||
<value>Balancing/Matching Transaction #<span id="spanModalTransactionId">67890</span></value>
|
||||
<value>Balancing/Matching Transaction #<span id="spanModalTransactionId">67890</span> From <span id="spanModalTransactionDate">yyyy-mmm-dd</span></value>
|
||||
<comment>The span text is replaced runtime.</comment>
|
||||
</data>
|
||||
<data name="BalanceTransactions_PageTitle" xml:space="preserve">
|
||||
@@ -752,4 +728,8 @@
|
||||
<value>Amount Within 10% Tolerance</value>
|
||||
<comment>Header in selection list. Capitalize as customary for culture.</comment>
|
||||
</data>
|
||||
<data name="BalanceTransaction_PayoutMatch" xml:space="preserve">
|
||||
<value>Payout #{0:N0}, expected {1:yyyy-MMM-dd}, for {2}: {3} {4:N2}</value>
|
||||
<comment>0 is the payout Id, 1 is the date (do culturally edit format if called for), 2 is the recipient name, and 3 4 is the currency and amount</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -59,46 +59,46 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string"/>
|
||||
<xsd:attribute name="type" type="xsd:string"/>
|
||||
<xsd:attribute name="mimetype" type="xsd:string"/>
|
||||
<xsd:attribute ref="xml:space"/>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string"/>
|
||||
<xsd:attribute name="name" type="xsd:string"/>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
|
||||
<xsd:attribute ref="xml:space"/>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
@@ -268,9 +268,6 @@
|
||||
<data name="UploadBankFiles_DownloadInstructions_BankgiroSEFile" xml:space="preserve">
|
||||
<value>Olika banker har olika sätt att få BGMAX-filen. På SEB går du till <strong>betalningar</strong> och <strong>filkommunikation</strong> för att se en lista över filer att hämta. Andra banker har andra metoder. I vilket fall, så ladda upp dem här.</value>
|
||||
</data>
|
||||
|
||||
|
||||
|
||||
<data name="UploadBankFiles_ErrorBalance" xml:space="preserve">
|
||||
<value><p>Filen innehöll {0:N0} transaktioner. <strong>{1:N0} transaktioner</strong> har importerats till kontot <em>{2}</em>. ({3:N0} transaktioner var dubbletter.)</p><p><strong>Men bankens saldo stämmer inte med bokföringen i Swarmops.</strong> Detta beror oftast på saknade transaktioner. Ladda upp ett kontoutdrag över med ett större tidsintervall så att Swarmops får alla transaktioner.</p><p>Swarmops bokföring konto är för närvarande <strong>inte i synk</strong> med bankens.</p></value>
|
||||
<comment>Displayed when import successful, but end balance out of sync. Assumes plural along all pasted numbers.</comment>
|
||||
@@ -495,7 +492,6 @@
|
||||
<data name="InspectLedgers_PageTitle" xml:space="preserve">
|
||||
<value>Granska bokföring</value>
|
||||
</data>
|
||||
|
||||
<data name="InspectLedgers_InboundBalance" xml:space="preserve">
|
||||
<value>Ingående balans</value>
|
||||
</data>
|
||||
@@ -505,7 +501,6 @@
|
||||
<data name="InspectLedgers_Info" xml:space="preserve">
|
||||
<value>Detta är den underliggande bokföringens huvudbok för organisationens finanser. Du kan studera bokföringen i detalj, t.ex. för revision. <span id="SpanInfoProfitLossAccount" style="display:none"> <strong>Du tittar just nu på ett resultat konto, så tecknen är omvända - inkomst är negativ och kostnad positivt</strong> på grund av hur venetiansk dubbel bokföring fungerar.</span></value>
|
||||
</data>
|
||||
|
||||
<data name="InspectLedgers_NoTransactions" xml:space="preserve">
|
||||
<value>Det finns inga transaktioner i det här kontot för den valda tidsperioden.</value>
|
||||
</data>
|
||||
@@ -682,7 +677,7 @@
|
||||
<value>Några automatimporterade finansiella transaktioner kunde inte matchas automatiskt mot den löpande redovisningen. Det är här som du manuellt matchar transaktionerna att "balansera" (om en transaktion bara har ena sidan redovisad, till exempel utbetalda pengar från organisationen utan motsvarande post vad pengarna gick till, så sägs transaktionen vara "obalanserad").</value>
|
||||
</data>
|
||||
<data name="BalanceTransactions_ModalHeader" xml:space="preserve">
|
||||
<value>Balanserar/matchar transaktionen #<span id="spanModalTransactionId">67890</span></value>
|
||||
<value>Balanserar/matchar transaktionen #<span id="spanModalTransactionId">67890</span> från <span id="spanModalTransactionDate">67890</span></value>
|
||||
<comment>The span text is replaced runtime.</comment>
|
||||
</data>
|
||||
<data name="BalanceTransactions_PageTitle" xml:space="preserve">
|
||||
@@ -740,4 +735,4 @@
|
||||
<value>Belopp inom 10% tolerans</value>
|
||||
<comment>Header in selection list. Capitalize as customary for culture.</comment>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -1,14 +1,13 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DropDown.ascx.cs" Inherits="Swarmops.Frontend.Controls.v5.Base.DropDown" %>
|
||||
<%@ Import Namespace="System.Threading" %>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#<%=this.DropControl.ClientID %>').combobox({
|
||||
$('#<%=this.ClientID %>_DropDown').combobox({
|
||||
editable: false,
|
||||
height: 32,
|
||||
panelWidth: 300,
|
||||
panelAlign: '<%= Thread.CurrentThread.CurrentCulture.TextInfo.IsRightToLeft? "right": "left" %>',
|
||||
width: 300<%
|
||||
panelWidth: 300<%
|
||||
if (!String.IsNullOrEmpty(this.OnClientChange))
|
||||
{
|
||||
Response.Write(",\r\nonChange: function(newVal, oldVal) { " + this.OnClientChange + "(oldVal, newVal); }");
|
||||
@@ -16,18 +15,17 @@
|
||||
|
||||
%>
|
||||
});
|
||||
$('#<%=this.DropControl.ClientID %>').combobox('setValue', '<%=this.DropControl.SelectedValue%>');
|
||||
|
||||
$('#<%=this.DropControl.ClientID %> + span.combo > input.combo-text').click(function () {
|
||||
$('#<%=this.DropControl.ClientID %> + span.combo > span > span.combo-arrow').click();
|
||||
$('#<%=this.ClientID %>_DropDown + span.combo > input.combo-text').click(function () {
|
||||
$('#<%=this.ClientID %>_DropDown + span.combo > span > span.combo-arrow').click();
|
||||
});
|
||||
|
||||
$('#<%=this.DropControl.ClientID %> + span.combo > input.combo-text').keydown(function (e) {
|
||||
$('#<%=this.ClientID %>_DropDown + span.combo > input.combo-text').keydown(function (e) {
|
||||
switch (e.which) {
|
||||
case 40: // down
|
||||
var panel = $('#<%=this.DropControl.ClientID %>').combo('panel');
|
||||
var panel = $('#<%=this.ClientID %>_DropDown').combo('panel');
|
||||
if (!panel.is(':visible')) {
|
||||
$('#<%=this.DropControl.ClientID %> + span.combo > span > span.combo-arrow').click();
|
||||
$('#<%=this.ClientID %>_DropDown + span.combo > span > span.combo-arrow').click();
|
||||
panel.focus();
|
||||
}
|
||||
break;
|
||||
@@ -37,7 +35,50 @@
|
||||
e.preventDefault(); // prevent the default action (scroll / move caret)
|
||||
});
|
||||
});
|
||||
|
||||
function <%=this.ClientID %>_DropDown_val(newValue) {
|
||||
if (newValue === undefined) {
|
||||
// getter
|
||||
return $('#<%=this.ClientID %>_DropDown').combobox('getValue');
|
||||
} else {
|
||||
// setter
|
||||
$('#<%=this.ClientID %>_DropDown').combobox('setValue', newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function <%=this.ClientID %>_DropDown_text(newText) {
|
||||
if (newText === undefined) {
|
||||
// getter
|
||||
return $('#<%=this.ClientID %>_DropDown').combobox('getText');
|
||||
} else {
|
||||
// setter
|
||||
$('#<%=this.ClientID %>_DropDown').combobox('setText', newText);
|
||||
}
|
||||
}
|
||||
|
||||
function <%=this.ClientID %>_DropDown_loadUrl(url) {
|
||||
$('#<%=this.ClientID %>_DropDown').combobox('reload', url);
|
||||
}
|
||||
|
||||
function <%=this.ClientID %>_DropDown_loadJson(jsonData) {
|
||||
$('#<%=this.ClientID %>_DropDown').combobox({
|
||||
data: $.parseJSON(jsonData),
|
||||
valueField: 'id',
|
||||
textField: 'text',
|
||||
groupField: 'group'
|
||||
});
|
||||
}
|
||||
|
||||
function <%=this.ClientID %>_DropDown_loadData(jsData) {
|
||||
$('#<%=this.ClientID %>_DropDown').combobox({
|
||||
data: jsData,
|
||||
valueField: 'id',
|
||||
textField: 'text',
|
||||
groupField: 'group'
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<asp:DropDownList ID="DropControl" runat="server" />
|
||||
<span id="<%=this.ClientID %>_SpanDrop"><select class="easyui-combo" url="<%=this.DataUrl %>" name="DropDown" id="<%=this.ClientID %>_DropDown" valueField="value" textField="text" groupField="group" animate="true" style="width:324px"></select></span>
|
||||
|
||||
@@ -5,22 +5,14 @@ namespace Swarmops.Frontend.Controls.v5.Base
|
||||
{
|
||||
public partial class DropDown : ControlV5Base
|
||||
{
|
||||
public ListItemCollection Items
|
||||
{
|
||||
get { return this.DropControl.Items; }
|
||||
}
|
||||
|
||||
public string SelectedValue
|
||||
{
|
||||
get { return this.DropControl.SelectedValue; }
|
||||
set { this.DropControl.SelectedValue = value; }
|
||||
}
|
||||
|
||||
public string OnClientChange { get; set; }
|
||||
public string DataUrl { get; set; }
|
||||
|
||||
public string ClientControlID
|
||||
{
|
||||
get { return this.DropControl.ClientID; }
|
||||
get { return this.ClientID + "_DropDown"; }
|
||||
}
|
||||
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
|
||||
@@ -51,6 +51,18 @@
|
||||
});
|
||||
});
|
||||
|
||||
function <%=this.ClientID %>_val(newValue) {
|
||||
if (newValue === undefined) {
|
||||
// getter
|
||||
return $('#<%=this.ClientID %>_DropBudgets').combotree('getValue');
|
||||
} else {
|
||||
// setter
|
||||
$('#<%=this.ClientID %>_DropBudgets').combotree('setValue', newValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<span id="<%=this.ClientID %>_SpanBudgets"><select class="easyui-combotree" url="<%=this.DataUrl %>" name="DropBudgets" id="<%=this.ClientID %>_DropBudgets" animate="true" style="width:324px"></select></span>
|
||||
@@ -31,23 +31,67 @@
|
||||
|
||||
function onFixTransaction(newTransactionId) {
|
||||
transactionId = newTransactionId;
|
||||
SwarmopsJS.formatInteger(transactionId, function(result) { $('span#spanModalTransactionId').text(result); });
|
||||
$('span#spanModalTransactionId').text("<%=Resources.Global.Global_LoadingPlaceholder%>");
|
||||
SwarmopsJS.formatInteger(transactionId, function (result) { $('span#spanModalTransactionId').text(result); });
|
||||
$('input:radio[name="TxOptions"]').prop('checked', false);
|
||||
$('div.radioOption').hide();
|
||||
<%= this.DialogTx.ClientID %>_open();
|
||||
|
||||
$('#spanTransactionUnbalancedBy').text('[...]');
|
||||
$('#<%=this.DropOpenPayouts.ClientID%>')
|
||||
$('span#spanModalTransactionDate').text('[...]');
|
||||
<%=this.DropOpenPayouts.ClientControlID%>_loadData([{ id: 0, text: "<%=Resources.Global.Global_LoadingPlaceholder%>" }]);
|
||||
<%=this.DropOpenPayouts.ClientControlID%>_val('0');
|
||||
|
||||
SwarmopsJS.ajaxCall(
|
||||
"/Pages/v5/Ledgers/BalanceTransactions.aspx/GetTransactionMatchability",
|
||||
{ transactionId: transactionId },
|
||||
function(data) {
|
||||
console.log(data);
|
||||
$('#spanTransactionUnbalancedBy').text(data.DifferingAmount);
|
||||
$('span#spanModalTransactionDate').text(data.TransactionDate);
|
||||
|
||||
if (data.OpenPayoutData.length > 0) {
|
||||
<%=this.DropOpenPayouts.ClientControlID%>_loadData(data.OpenPayoutData);
|
||||
<%=this.DropOpenPayouts.ClientControlID%>_text("<%=Resources.Global.Global_SelectOne%>");
|
||||
} else {
|
||||
<%=this.DropOpenPayouts.ClientControlID%>_loadData({});
|
||||
<%=this.DropOpenPayouts.ClientControlID%>_text("<%=Resources.Global.Global_NoMatch%>");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function onBalanceTransaction() {
|
||||
var accountId = <%=this.DropBudgetBalance.ClientID%>_val();
|
||||
|
||||
if (accountId > 0) {
|
||||
<%= this.DialogTx.ClientID %>_close();
|
||||
|
||||
SwarmopsJS.ajaxCall(
|
||||
"/Pages/v5/Ledgers/BalanceTransactions.aspx/BalanceTransactionManually",
|
||||
{ transactionId: transactionId, accountId: accountId },
|
||||
function () {
|
||||
$('#gridTransactions').datagrid('reload');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function onMatchOpenPayout() {
|
||||
var payoutId = <%=this.DropOpenPayouts.ClientControlID%>_val();
|
||||
|
||||
if (payoutId > 0) {
|
||||
<%= this.DialogTx.ClientID %>_close();
|
||||
SwarmopsJS.ajaxCall(
|
||||
"/Pages/v5/Ledgers/BalanceTransactions.aspx/MatchTransactionOpenPayout",
|
||||
{ transactionId: transactionId, payoutId: payoutId },
|
||||
function () {
|
||||
$('#gridTransactions').datagrid('reload');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
@@ -101,7 +145,7 @@
|
||||
<div id="radioOptionBalance" class="radioOption">
|
||||
<div class="entryFields">
|
||||
<Swarmops5:ComboBudgets ID="DropBudgetBalance" runat="server" ListType="All" />​<br/>
|
||||
<input type="button" value='<asp:Literal ID="LiteralButtonBalance" runat="server" Text="BalanceXYZ" />' class="buttonAccentColor" id="buttonExecuteBalance"/>
|
||||
<input type="button" value='<asp:Literal ID="LiteralButtonBalance" runat="server" Text="BalanceXYZ" />' class="buttonAccentColor" onclick="onBalanceTransaction(); return false;" id="buttonExecuteBalance"/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
<asp:Label runat="server" ID="LabelDescribeBalance" Text="Balance the difference against XYZ" />
|
||||
@@ -112,7 +156,7 @@
|
||||
<div id="radioOptionPayout" class="radioOption">
|
||||
<div class="entryFields">
|
||||
<Swarmops5:DropDown ID="DropOpenPayouts" runat="server" ListType="All" />​<br/>
|
||||
<input type="button" value='<asp:Literal ID="LiteralButtonPayout" runat="server" Text="MatchXYZ" />' class="buttonAccentColor" id="button1"/>
|
||||
<input type="button" value='<asp:Literal ID="LiteralButtonPayout" runat="server" Text="MatchXYZ" />' class="buttonAccentColor" onclick="onMatchOpenPayout(); return false;" id="buttonExecutePayout"/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
<asp:Label runat="server" ID="LabelDescribePayout" Text="Match to payout XYZ" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
@@ -48,12 +49,26 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class TransactionMatchabilityData
|
||||
{
|
||||
public string TransactionDate { get; set; }
|
||||
public string DifferingAmount { get; set; }
|
||||
public string OpenPayoutDropDownJsonData { get; set; }
|
||||
public DropdownOption[] OpenPayoutData { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class DropdownOption
|
||||
{
|
||||
// Fields are lowercase for immediate usability in JavaScript without conversion.
|
||||
// ReSharper disable InconsistentNaming
|
||||
public string id;
|
||||
public string text;
|
||||
public string group;
|
||||
// ReSharper restore InconsistentNaming
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static TransactionMatchabilityData GetTransactionMatchability (int transactionId)
|
||||
{
|
||||
@@ -74,11 +89,104 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
TransactionMatchabilityData result = new TransactionMatchabilityData();
|
||||
|
||||
result.TransactionDate = transaction.DateTime.ToString ("yyyy-MMM-dd HH:mm");
|
||||
result.DifferingAmount = String.Format ("{0} {1:+#,#.00;−#,#.00;0}",
|
||||
// this is a UNICODE MINUS (U+2212), not the hyphen on the keyboard
|
||||
authData.CurrentOrganization.Currency.DisplayCode, transaction.Rows.AmountCentsTotal/100.0);
|
||||
|
||||
result.OpenPayoutData = GetOpenPayoutData (transaction);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static DropdownOption[] GetOpenPayoutData(FinancialTransaction transaction)
|
||||
{
|
||||
DateTime transactionDateTime = transaction.DateTime;
|
||||
Int64 matchAmount = transaction.Rows.AmountCentsTotal;
|
||||
|
||||
List<DropdownOption> result = new List<DropdownOption>();
|
||||
|
||||
Payouts openPayouts = Payouts.ForOrganization (transaction.Organization);
|
||||
|
||||
foreach (Payout payout in openPayouts)
|
||||
{
|
||||
if (payout.AmountCents == -matchAmount)
|
||||
{
|
||||
string description = String.Format (Resources.Pages.Ledgers.BalanceTransaction_PayoutMatch, payout.Identity,
|
||||
payout.ExpectedTransactionDate, payout.Recipient, payout.Organization.Currency.DisplayCode, payout.AmountCents / 100.0);
|
||||
|
||||
result.Add(new DropdownOption
|
||||
{
|
||||
id = payout.Identity.ToString(CultureInfo.InvariantCulture),
|
||||
@group = Resources.Pages.Ledgers.BalanceTransactions_ExactMatches,
|
||||
text = description
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static void BalanceTransactionManually(int transactionId, int accountId)
|
||||
{
|
||||
if (transactionId == 0 || accountId == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
if (
|
||||
!authData.CurrentUser.HasAccess(new Access(authData.CurrentOrganization,
|
||||
AccessAspect.BookkeepingDetails)))
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
FinancialTransaction transaction = FinancialTransaction.FromIdentity(transactionId);
|
||||
FinancialAccount account = FinancialAccount.FromIdentity(accountId);
|
||||
if (transaction.OrganizationId != authData.CurrentOrganization.Identity || account.OrganizationId != authData.CurrentOrganization.Identity)
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
transaction.AddRow (account, -transaction.Rows.AmountCentsTotal, authData.CurrentUser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static void MatchTransactionOpenPayout (int transactionId, int payoutId)
|
||||
{
|
||||
if (transactionId == 0 || payoutId == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
if (
|
||||
!authData.CurrentUser.HasAccess(new Access(authData.CurrentOrganization,
|
||||
AccessAspect.BookkeepingDetails)))
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
FinancialTransaction transaction = FinancialTransaction.FromIdentity(transactionId);
|
||||
Payout payout = Payout.FromIdentity (payoutId);
|
||||
if (transaction.OrganizationId != authData.CurrentOrganization.Identity || payout.OrganizationId != authData.CurrentOrganization.Identity)
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
if (transaction.Rows.AmountCentsTotal != -payout.AmountCents)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
payout.BindToTransactionAndClose (transaction, authData.CurrentUser);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,10 +45,10 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
{
|
||||
Dictionary<string, string> localizeMap = new Dictionary<string, string>();
|
||||
|
||||
localizeMap["%ASSET_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.BalanceSheet_Assets;
|
||||
localizeMap["%DEBT_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.BalanceSheet_Debt;
|
||||
localizeMap["%INCOME_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.ProfitLossStatement_Income;
|
||||
localizeMap["%COST_ACCOUNTGROUP%"] = Resources.Pages.Ledgers.ProfitLossStatement_Costs;
|
||||
localizeMap["%ASSET_ACCOUNTGROUP%"] = Resources.Global.Financial_Asset;
|
||||
localizeMap["%DEBT_ACCOUNTGROUP%"] = Resources.Global.Financial_Debt;
|
||||
localizeMap["%INCOME_ACCOUNTGROUP%"] = Resources.Global.Financial_Income;
|
||||
localizeMap["%COST_ACCOUNTGROUP%"] = Resources.Global.Financial_Cost;
|
||||
|
||||
foreach (YearlyReportLine line in lines)
|
||||
{
|
||||
|
||||
@@ -43,10 +43,10 @@ public partial class Pages_v5_Ledgers_Json_ProfitLossData : DataV5Base
|
||||
{
|
||||
Dictionary<string, string> localizeMap = new Dictionary<string, string>();
|
||||
|
||||
localizeMap["%ASSET_ACCOUNTGROUP%"] = Ledgers.BalanceSheet_Assets;
|
||||
localizeMap["%DEBT_ACCOUNTGROUP%"] = Ledgers.BalanceSheet_Debt;
|
||||
localizeMap["%INCOME_ACCOUNTGROUP%"] = Ledgers.ProfitLossStatement_Income;
|
||||
localizeMap["%COST_ACCOUNTGROUP%"] = Ledgers.ProfitLossStatement_Costs;
|
||||
localizeMap["%ASSET_ACCOUNTGROUP%"] = Resources.Global.Financial_Asset;
|
||||
localizeMap["%DEBT_ACCOUNTGROUP%"] = Resources.Global.Financial_Debt;
|
||||
localizeMap["%INCOME_ACCOUNTGROUP%"] = Resources.Global.Financial_Income;
|
||||
localizeMap["%COST_ACCOUNTGROUP%"] = Resources.Global.Financial_Cost;
|
||||
|
||||
foreach (YearlyReportLine line in lines)
|
||||
{
|
||||
|
||||
@@ -73,6 +73,16 @@ select.comboperson+span>input:focus
|
||||
font-weight: lighter;
|
||||
}
|
||||
|
||||
.combo-panel > .combobox-group {
|
||||
font-size: 14px;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
body.rtl .combo-panel > .combobox-group {
|
||||
padding-left: 3px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
.combo-panel > .combobox-item-selected {
|
||||
font-weight: 400;
|
||||
border-top: 1px solid #c8d9ff;
|
||||
|
||||
Reference in New Issue
Block a user