Exemplo n.º 1
0
    private void PopulateInboundInvoices()
    {
        InboundInvoices invoices = InboundInvoices.ForOrganization(CurrentOrganization);

        foreach (InboundInvoice invoice in invoices)
        {
            Documents dox    = invoice.Documents;
            bool      hasDox = (dox.Count > 0 ? true : false);

            if (this._approvalRights.ContainsKey(invoice.BudgetId) ||
                invoice.Budget.OwnerPersonId == Person.NobodyId)
            {
                ApprovableCost cost = new ApprovableCost("I" + invoice.Identity.ToString(CultureInfo.InvariantCulture),
                                                         invoice.Supplier, invoice.BudgetAmountCents, invoice.Budget, invoice.Description,
                                                         "Financial_InvoiceInbound", hasDox, invoice);

                if (invoice.Attested)
                {
                    this._approvedCosts.Add(cost);
                }
                else
                {
                    this._approvableCosts.Add(cost);
                }
            }
        }
    }
Exemplo n.º 2
0
    private void PopulateInboundInvoices()
    {
        InboundInvoices invoices = InboundInvoices.ForOrganization(CurrentOrganization);

        foreach (InboundInvoice invoice in invoices)
        {
            Documents dox    = invoice.Documents;
            bool      hasDox = (dox.Count > 0 ? true : false);

            if (this._attestationRights.ContainsKey(invoice.BudgetId) ||
                invoice.Budget.OwnerPersonId == Person.NobodyId)
            {
                AttestableItem item = new AttestableItem("I" + invoice.Identity.ToString(CultureInfo.InvariantCulture),
                                                         invoice.Supplier, invoice.AmountCents, invoice.Budget, invoice.InvoiceReference,
                                                         "Financial_InvoiceInbound", hasDox, invoice);

                if (invoice.Attested)
                {
                    this._attestedItems.Add(item);
                }
                else
                {
                    this._items.Add(item);
                }
            }
        }
    }
Exemplo n.º 3
0
        private void AddAttestationWarnings(Person person)
        {
            TaskGroup group = new TaskGroup(TaskGroupType.AttestationWarning);

            if (!person.GetAuthority().HasPermission(Permission.CanSeeEconomyTransactions, Organization.PPSEid, 1, Authorization.Flag.AnyGeographyExactOrganization))
            {
                return;
            }

            InboundInvoices invoices = InboundInvoices.ForOrganization(Organization.PPSE);

            DateTime threshold = DateTime.Today.AddDays(10);

            foreach (InboundInvoice invoice in invoices)
            {
                if (invoice.DueDate < threshold && !invoice.Attested)
                {
                    group.Tasks.Add(new TaskAttestationLate(invoice));
                }
            }

            if (group.Tasks.Count > 0)
            {
                this.Add(group);
            }
        }
Exemplo n.º 4
0
    private void PopulateGrid()
    {
        InboundInvoices invoices = InboundInvoices.ForOrganization(this.Organization, true);

        invoices.Reverse();

        this.GridInvoices.DataSource = invoices;
        this.GridInvoices.Rebind();
    }
Exemplo n.º 5
0
        private void PopulateInboundInvoices()
        {
            InboundInvoices invoices = InboundInvoices.ForOrganization(CurrentOrganization, true);

            foreach (InboundInvoice invoice in invoices)
            {
                Documents dox    = invoice.Documents;
                bool      hasDox = (dox.Count > 0 ? true : false);

                AddDocuments(invoice.Documents, "I" + invoice.Identity.ToString(CultureInfo.InvariantCulture),
                             String.Format(Global.Financial_InboundInvoiceSpecificationWithSender + " - ",
                                           invoice.OrganizationSequenceId, invoice.Supplier) + Global.Global_ImageSpecification);
            }
        }
Exemplo n.º 6
0
        private void PopulateInboundInvoices()
        {
            InboundInvoices invoices = InboundInvoices.ForOrganization(this.CurrentOrganization).WhereUnattested;

            foreach (InboundInvoice invoice in invoices)
            {
                Documents dox    = invoice.Documents;
                bool      hasDox = (dox.Count > 0 ? true : false);

                if (_attestationRights.ContainsKey(invoice.BudgetId) || invoice.Budget.OwnerPersonId == Person.NobodyId)
                {
                    AddDocuments(invoice.Documents, "I" + invoice.Identity.ToString(CultureInfo.InvariantCulture), String.Format(Resources.Global.Financial_InboundInvoiceSpecificationWithSender + " - ", invoice.Identity, invoice.Supplier) + Resources.Global.Global_ImageSpecification);
                }
            }
        }
    protected void Page_Load (object sender, EventArgs e)
    {
        // Get invoices and attestation rights

        this._attestationRights = GetAttestationRights();
        this._invoices = InboundInvoices.ForOrganization(this.CurrentOrganization, true);

        _invoices.Sort(SortInvoicesByDueDateReverse);

        // Format as JSON and return

        Response.ContentType = "application/json";
        string json = FormatAsJson();
        Response.Output.WriteLine (json);
        Response.End();
    }
Exemplo n.º 8
0
        private void AddInboundInvoices(Person person, Organization organization)
        {
            TaskGroup group = new TaskGroup(TaskGroupType.AttestInvoices);

            // TODO: Loop over roles, get all open claims for roles where person can attest

            InboundInvoices invoices = InboundInvoices.ForOrganization(organization);

            foreach (InboundInvoice invoice in invoices)
            {
                if (invoice.Budget.OwnerPersonId == person.Identity && !invoice.Attested)
                {
                    group.Tasks.Add(new TaskInboundInvoice(invoice));
                }
            }

            if (group.Tasks.Count > 0)
            {
                Add(group);
            }
        }
Exemplo n.º 9
0
    private void PopulateInvoices(AttestableItems items)
    {
        InboundInvoices openInvoices       = InboundInvoices.ForOrganization(Organization.PPSE);
        InboundInvoices unattestedInvoices = new InboundInvoices();

        foreach (InboundInvoice invoice in openInvoices)
        {
            if (!invoice.Attested && invoice.Open)
            {
                if (attestationRights.ContainsKey(invoice.BudgetId))
                {
                    unattestedInvoices.Add(invoice);
                }
            }
        }

        unattestedInvoices.Sort(SortGridInvoices);

        foreach (InboundInvoice invoice in unattestedInvoices)
        {
            AddAttestableItem(items, invoice);
        }
    }
Exemplo n.º 10
0
    private void PopulateDebugInfo()
    {
        debugLookup = new Dictionary <int, DebugInfoLine>();

        ExpenseClaims   expenseClaims   = ExpenseClaims.FromOrganization(Organization.PPSE);
        InboundInvoices inboundInvoices = InboundInvoices.ForOrganization(Organization.PPSE);
        Salaries        salaries        = Salaries.ForOrganization(Organization.PPSE);
        Payouts         payouts         = Payouts.ForOrganization(Organization.PPSE);

        debugLookup[Organization.PPSE.FinancialAccounts.DebtsExpenseClaims.Identity]   = new DebugInfoLine();
        debugLookup[Organization.PPSE.FinancialAccounts.DebtsInboundInvoices.Identity] = new DebugInfoLine();
        debugLookup[Organization.PPSE.FinancialAccounts.CostsAllocatedFunds.Identity]  = new DebugInfoLine();
        debugLookup[Organization.PPSE.FinancialAccounts.DebtsSalary.Identity]          = new DebugInfoLine();
        debugLookup[Organization.PPSE.FinancialAccounts.DebtsTax.Identity]             = new DebugInfoLine();

        foreach (Payout payout in payouts)
        {
            foreach (ExpenseClaim claim in payout.DependentExpenseClaims)
            {
                debugLookup[Organization.PPSE.FinancialAccounts.DebtsExpenseClaims.Identity].Payouts -= claim.Amount;
            }

            foreach (InboundInvoice invoice in payout.DependentInvoices)
            {
                debugLookup[Organization.PPSE.FinancialAccounts.DebtsInboundInvoices.Identity].Payouts -= (decimal)invoice.Amount;
            }

            foreach (Salary salary in payout.DependentSalariesNet)
            {
                debugLookup[Organization.PPSE.FinancialAccounts.DebtsSalary.Identity].Payouts -= salary.NetSalaryDecimal;
            }

            foreach (Salary salary in payout.DependentSalariesTax)
            {
                debugLookup[Organization.PPSE.FinancialAccounts.DebtsTax.Identity].Payouts -= salary.TaxTotalDecimal;
            }
        }


        foreach (ExpenseClaim claim in expenseClaims)
        {
            if (claim.Open)
            {
                AddExpenseToDebug(claim);
            }
        }

        foreach (InboundInvoice invoice in inboundInvoices)
        {
            AddInboundInvoiceToDebug(invoice);
        }

        foreach (Salary salary in salaries)
        {
            AddSalaryNetToDebug(salary);
            AddSalaryTaxToDebug(salary);
        }

        List <DebugInfoLine> debugInfoLines = new List <DebugInfoLine>();

        foreach (int accountId in debugLookup.Keys)
        {
            debugLookup[accountId].AccountId = accountId;
            debugLookup[accountId].Actual    = FinancialAccount.FromIdentity(accountId).GetDelta(new DateTime(2006, 1, 1), DateTime.Today.AddDays(2)); // two days to account for all possible time zones
        }

        foreach (DebugInfoLine line in debugLookup.Values)
        {
            debugInfoLines.Add(line);
        }

        this.GridDebug.DataSource = debugInfoLines;
    }