예제 #1
0
    private void PopulateGrid()
    {
        OutboundInvoices invoices = OutboundInvoices.ForOrganization(this.Organization, true);

        invoices.Reverse();

        this.GridInvoices.DataSource = invoices;
        this.GridInvoices.Rebind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get invoices and attestation rights

        this._invoices = OutboundInvoices.ForOrganization(this.CurrentOrganization, true);

        _invoices.Sort(SortInvoicesByCreatedDateReverse);

        // Format as JSON and return

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

        Response.Output.WriteLine(json);
        Response.End();
    }
예제 #3
0
        private void PopulateOutboundInvoices()
        {
            OutboundInvoices invoices = OutboundInvoices.ForOrganization(CurrentOrganization, true);

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

                if (hasDox)
                {
                    AddDocuments(invoice.Documents, "O" + invoice.Identity.ToString(CultureInfo.InvariantCulture),
                                 String.Format(Global.Financial_OutboundInvoiceSpecificationWithCustomer + " - ",
                                               invoice.OrganizationSequenceId, invoice.CustomerName) + Global.Global_ImageSpecification);
                }
            }
        }
예제 #4
0
        private static DropdownOption[] GetOpenOutboundInvoiceData(FinancialTransaction transaction)
        {
            DateTime txDateTime  = transaction.DateTime;
            Int64    matchAmount = transaction.Rows.AmountCentsTotal;

            DropdownOptions result = new DropdownOptions();

            List <DropdownOption> listExact    = new List <DropdownOption>();
            List <DropdownOption> listTolerant = new List <DropdownOption>();
            List <DropdownOption> listRefMatch = new List <DropdownOption>();

            OutboundInvoices invoices = OutboundInvoices.ForOrganization(transaction.Organization);

            foreach (OutboundInvoice invoice in invoices)
            {
                if (invoice.AmountCents > matchAmount * 95 / 100 &&
                    invoice.AmountCents < matchAmount * 105 / 100)
                {
                    string description = String.Format(Resources.Pages.Ledgers.BalanceTransactions_OutboundInvoiceMatch, invoice.OrganizationSequenceId,
                                                       invoice.CustomerName, invoice.DueDate, invoice.DisplayNativeAmount);

                    if (invoice.HasNativeCurrency)
                    {
                        description += " (" + transaction.Organization.Currency.DisplayCode + " " +
                                       (invoice.AmountCents / 100.0).ToString("N2") + ")";
                    }

                    bool invoiceIdMatch = DescriptionContainsInvoiceReference(invoice.Reference, invoice.TheirReference, transaction.Description);

                    if (invoiceIdMatch)
                    {
                        listRefMatch.Add(new DropdownOption
                        {
                            id     = invoice.Identity.ToString(CultureInfo.InvariantCulture),
                            @group = Resources.Pages.Ledgers.BalanceTransactions_MostProbableMatch,
                            text   = description
                        });
                    }
                    if (invoice.AmountCents == matchAmount)
                    {
                        listExact.Add(new DropdownOption
                        {
                            id     = invoice.Identity.ToString(CultureInfo.InvariantCulture),
                            @group = Resources.Pages.Ledgers.BalanceTransactions_ExactMatches,
                            text   = description
                        });
                    }
                    else
                    {
                        listTolerant.Add(new DropdownOption
                        {
                            id     = invoice.Identity.ToString(CultureInfo.InvariantCulture),
                            @group = Resources.Pages.Ledgers.BalanceTransactions_FivePercentMatches,
                            text   = description
                        });
                    }
                }
            }

            List <DropdownOption> listCombined = new List <DropdownOption>();

            listCombined.AddRange(listRefMatch);
            listCombined.AddRange(listExact);
            listCombined.AddRange(listTolerant);

            return(listCombined.ToArray());
        }
 protected void PopulateOutboundInvoices(int organizationId)
 {
     this.GridOutboundInvoices.DataSource = OutboundInvoices.ForOrganization(Organization.FromIdentity(organizationId));
 }