Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Access required is change access to financials

            PageAccessRequired = new Access(CurrentOrganization, AccessAspect.Financials, AccessType.Write);

            // Get all payable items

            Payouts prototypePayouts = Payouts.Construct(CurrentOrganization);
            Payouts previousPayouts  = Payouts.ForOrganization(CurrentOrganization); // gets all currently open payouts - enabled for undoing

            // Format as JSON and return

            string prototypes = FormatPrototypesAsJson(prototypePayouts);
            string previous   = FormatPreviousAsJson(previousPayouts);

            string elements = (prototypes.Length > 0 && previous.Length > 0
                ? prototypes + "," + previous // if both have elements, add a comma between them
                : prototypes + previous);     // one or both strings are empty, so no comma

            Response.ContentType = "application/json";
            string json = "{\"rows\":[" + elements + "]}";

            Response.Output.WriteLine(json);
            Response.End();
        }
Example #2
0
        private void AddPayouts(Person person, Organization organization)
        {
            TaskGroup group        = new TaskGroup(TaskGroupType.Payout);
            TaskGroup groupUrgent  = new TaskGroup(TaskGroupType.PayoutUrgently);
            TaskGroup groupOverdue = new TaskGroup(TaskGroupType.PayoutOverdue);

            if (
                !person.GetAuthority()
                .HasPermission(Permission.CanPayOutMoney, organization.Identity, 1,
                               Authorization.Flag.AnyGeographyExactOrganization))
            {
                return;
            }

            Payouts payouts = Payouts.Construct(organization);

            foreach (Payout payout in payouts)
            {
                group.Tasks.Add(new TaskPayout(payout));

                if (payout.DependentInvoices.Count > 0)
                {
                    if (payout.ExpectedTransactionDate < DateTime.Today)
                    {
                        groupOverdue.Tasks.Add(new TaskPayout(payout));
                    }
                    else if (payout.ExpectedTransactionDate < DateTime.Today.AddDays(7))
                    {
                        groupUrgent.Tasks.Add(new TaskPayout(payout));
                    }
                }
            }

            if (group.Tasks.Count > 0)
            {
                Add(group);
            }

            if (groupUrgent.Tasks.Count > 0)
            {
                Add(groupUrgent);
            }

            if (groupOverdue.Tasks.Count > 0)
            {
                Add(groupOverdue);
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Access required is change access to financials

            PageAccessRequired = new Access(CurrentOrganization, AccessAspect.Financials, AccessType.Write);

            // Get all payable items

            Payouts payouts = Payouts.Construct(CurrentOrganization);

            // Format as JSON and return

            Response.ContentType = "application/json";
            string json = FormatAsJson(payouts);

            Response.Output.WriteLine(json);
            Response.End();
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Access required is change access to financials

            PageAccessRequired = new Access(CurrentOrganization, AccessAspect.Financials, AccessType.Write);

            // Get all payable items

            Payouts prototypePayouts = Payouts.Construct(CurrentOrganization);
            Payouts previousPayouts  = Payouts.ForOrganization(CurrentOrganization); // gets all currently open payouts - enabled for undoing

            // Format as JSON and return

            string elements = FormatPrototypesAsJson(prototypePayouts);

            Response.ContentType = "application/json";
            string json = "{\"rows\":[" + elements + "]}";

            Response.Output.WriteLine(json);
            Response.End();
        }
    private void PopulateGrid()
    {
        Payouts payouts = Payouts.Construct(Organization.PPSEid);

        this.GridPayouts.DataSource = payouts;
    }
Example #6
0
        private void AddPayouts(Person person, Organization organization)
        {
            if (!person.HasAccess(new Access(organization, AccessAspect.Financials, AccessType.Write)))
            {
                return; // do not add this if can't pay out
            }

            DashboardTodo todoNormal  = new DashboardTodo();
            DashboardTodo todoUrgent  = new DashboardTodo();
            DashboardTodo todoOverdue = new DashboardTodo();

            todoNormal.Url          =
                todoUrgent.Url      =
                    todoOverdue.Url = "/Pages/v5/Financial/PayOutMoney.aspx";

            todoNormal.Icon          =
                todoUrgent.Icon      =
                    todoOverdue.Icon = "/Images/PageIcons/iconshock-money-envelope-16px.png";

            int payoutCount        = 0;
            int urgentPayoutCount  = 0;
            int overduePayoutCount = 0;

            Payouts payouts = Payouts.Construct(organization);

            foreach (Payout payout in payouts)
            {
                payoutCount++;

                if (payout.DependentInvoices.Count > 0)
                {
                    if (payout.ExpectedTransactionDate < DateTime.Today)
                    {
                        overduePayoutCount++;
                    }
                    else if (payout.ExpectedTransactionDate < DateTime.Today.AddDays(7))
                    {
                        urgentPayoutCount++;
                    }
                }
            }

            if (payoutCount > 0)
            {
                todoNormal.Description = payoutCount > 1
                                             ? String.Format(App_GlobalResources.Logic_Swarm_DashboardTodos.Payout_Many,
                                                             payoutCount)
                                             : App_GlobalResources.Logic_Swarm_DashboardTodos.Payout_One;
                this.Add(todoNormal);
            }

            if (overduePayoutCount > 0)
            {
                todoOverdue.Description = overduePayoutCount > 1
                                             ? String.Format(App_GlobalResources.Logic_Swarm_DashboardTodos.Payout_Overdue_Many,
                                                             payoutCount)
                                             : App_GlobalResources.Logic_Swarm_DashboardTodos.Payout_Overdue_One;
                todoOverdue.Urgency = TodoUrgency.Red;
                this.Add(todoOverdue);
            }

            if (urgentPayoutCount > 0)
            {
                todoUrgent.Description = overduePayoutCount > 1
                                             ? String.Format(App_GlobalResources.Logic_Swarm_DashboardTodos.Payout_Urgent_Many,
                                                             payoutCount)
                                             : App_GlobalResources.Logic_Swarm_DashboardTodos.Payout_Urgent_One;
                todoUrgent.Urgency = TodoUrgency.Yellow;
                this.Add(todoUrgent);
            }
        }