Expense Examples

Query Expense by Id

Query for expenses by Id.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseById",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      [
        "2",
        "3"
      ]
    ]
  }
]

Query All Expenses

Query for all expenses.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseAll",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": []
  }
]

Query Expense by User

Query for expenses by user.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseByUser",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "2"
      }
    ]
  }
]

Query Expense by Id

Query for expenses by Id and load the expense Receipt.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseById",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      [
        "70"
      ]
    ],
    "Load": [
      {
        "Relationship": "Entries",
        "Load": [
          {
            "Relationship": "ExpenseReceipt"
          }
        ]
      }
    ]
  }
]

Query Expense by Tracking Number

Query for expenses by Tracking Number.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseByTrackingNumber",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      [
        "000002",
        "000003"
      ]
    ]
  }
]

Query Expense by User in Date Range

Query for expenses by user by expense sheet date in date range.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseByUserInDateRange",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "2"
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 10,
        "Day": 1
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 10,
        "Day": 30
      }
    ]
  }
]

Query Expenses in Date Range

Query for expenses by expense sheet date in date range

[
  {
    "Action": "Query",
    "QueryType": "ExpensesInDateRange",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 10,
        "Day": 1
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 10,
        "Day": 30
      }
    ]
  }
]

Query Expense by UDF Equal To Value

Query for expenses with any entries that have a user defined field of a particular value.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseEqualToUDFValue",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      "City",
      "Calgary"
    ]
  }
]

Query Expense by Null UDF Value

Query for expenses with any entries that have a user defined field that is empty.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseNullUDFValue",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      "City"
    ]
  }
]

Query Expense by Arguments

Query for expense sheets with expense entries for the dates specified and not paid. This is a special query that can accept null for any argument, allowing you to define arguments for which the query should not be restricted.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseByArguments",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      null,
      null,
      null,
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 10,
        "Day": 1
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 10,
        "Day": 30
      },
      false,
      []
    ]
  }
]

Query Expense by Arguments

Query for expense sheets for the specific user with expense sheet dates in the range specified, with expense entries for the dates specified, that are not paid, and that have the user defined field value. This is a special multi-argument query that can accept null for any argument, allowing you to define arguments for which the query should not be restricted.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseByArguments",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "2"
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 10,
        "Day": 1
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 10,
        "Day": 30
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 9,
        "Day": 1
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 9,
        "Day": 30
      },
      false,
      [
        "City",
        "Calgary"
      ]
    ]
  }
]

Query Expense By User and Modified Time in UTC

Query for all expense sheets owned by the user that have modified on greater than the provided UTC input

[
  {
    "Action": "Query",
    "QueryType": "ExpenseByUserModifiedSince",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "2"
      },
      {
        "__type": "DateTime",
        "Year": 2010,
        "Month": 10,
        "Day": 1,
        "Hour": 10,
        "Minute": 0,
        "Second": 0
      }
    ]
  }
]

Create Expense

Create a blank expense sheet.

[
  {
    "Action": "Create",
    "Type": "Replicon.Expense.Domain.Expense",
    "Operations": [
      {
        "__operation": "SetProperties",
        "User": {
          "__type": "Replicon.Domain.User",
          "Identity": "2"
        },
        "Description": "created via RepliConnect"
      }
    ]
  }
]

Create Expense with Basic Entry

Create an expense sheet with a single entry with minimum detail.

[
  {
    "Action": "Create",
    "Type": "Replicon.Expense.Domain.Expense",
    "Operations": [
      {
        "__operation": "SetProperties",
        "User": {
          "__type": "Replicon.Domain.User",
          "Identity": "2"
        },
        "Description": "created via RepliConnect with entries"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Entries",
        "Operations": [
          {
            "__operation": "SetProperties",
            "ExpenseType": {
              "__type": "Replicon.Expense.Domain.ExpenseType",
              "Identity": "2"
            },
            "Currency": {
              "__type": "Replicon.Domain.Currency",
              "Identity": "2"
            }
          }
        ]
      }
    ]
  }
]

Create Expense with Basic Entry with Receipt and Image

Create an expense sheet with a single entry with minimum detail but include an expense receipt with image. Below shows the value of the image as //string of base64 encoded byte array of image here // - this would be where you would have a byte[] of the image to upload, base64 encoded to string.

[
  {
    "Action": "Create",
    "Type": "Replicon.Expense.Domain.Expense",
    "Operations": [
      {
        "__operation": "SetProperties",
        "User": {
          "__type": "Replicon.Domain.User",
          "Identity": "2"
        },
        "Description": "created via RepliConnect with entries"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Entries",
        "Operations": [
          {
            "__operation": "SetProperties",
            "ExpenseType": {
              "__type": "Replicon.Expense.Domain.ExpenseType",
              "Identity": "2"
            },
            "Currency": {
              "__type": "Replicon.Domain.Currency",
              "Identity": "2"
            }
          },
          {
            "__operation": "SetExpenseReceipt",
            "Image": {
              "_type": "Image",
              "Value": " //string of base64 encoded byte array of image here //"
            },
            "ContentType": "image/png",
            "FileName": "logo.png"
          }
        ]
      }
    ]
  }
]

Create Expense with Entry for Bucket Project

Create an expense sheet with an entry for a bucket project.

[
  {
    "Action": "Create",
    "Type": "Replicon.Expense.Domain.Expense",
    "Operations": [
      {
        "__operation": "SetProperties",
        "User": {
          "__type": "Replicon.Domain.User",
          "Identity": "2"
        },
        "Description": "created via RepliConnect with entries"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Entries",
        "Operations": [
          {
            "__operation": "SetProperties",
            "ExpenseType": {
              "__type": "Replicon.Expense.Domain.ExpenseType",
              "Identity": "2"
            },
            "Currency": {
              "__type": "Replicon.Domain.Currency",
              "Identity": "2"
            },
            "EntryDate": {
              "__type": "Date",
              "Year": 2010,
              "Month": 10,
              "Day": 10
            },
            "Project": {
              "__type": "Replicon.Project.Domain.Project",
              "Identity": "8"
            },
            "Client": {
              "__type": "Replicon.Project.Domain.Client",
              "Identity": "2"
            }
          }
        ]
      }
    ]
  }
]

Create Expense with Entry for Project

Create an expense sheet with an entry for a cost allocated, single client, or no client project.

[
  {
    "Action": "Create",
    "Type": "Replicon.Expense.Domain.Expense",
    "Operations": [
      {
        "__operation": "SetProperties",
        "User": {
          "__type": "Replicon.Domain.User",
          "Identity": "2"
        },
        "Description": "created via RepliConnect with entries"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Entries",
        "Operations": [
          {
            "__operation": "SetProperties",
            "ExpenseType": {
              "__type": "Replicon.Expense.Domain.ExpenseType",
              "Identity": "2"
            },
            "Currency": {
              "__type": "Replicon.Domain.Currency",
              "Identity": "2"
            },
            "EntryDate": {
              "__type": "Date",
              "Year": 2010,
              "Month": 10,
              "Day": 10
            },
            "Project": {
              "__type": "Replicon.Project.Domain.Project",
              "Identity": "10"
            }
          }
        ]
      }
    ]
  }
]

Create Expense with Entry for Project

Create an expense sheet with an entry for a project, setting reiumbersement currency.

[
  {
    "Action": "Create",
    "Type": "Replicon.Expense.Domain.Expense",
    "Operations": [
      {
        "__operation": "SetProperties",
        "User": {
          "__type": "Replicon.Domain.User",
          "Identity": "2"
        },
        "Description": "created via RepliConnect with entries"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Entries",
        "Operations": [
          {
            "__operation": "SetProperties",
            "ExpenseType": {
              "__type": "Replicon.Expense.Domain.ExpenseType",
              "Identity": "2"
            },
            "Currency": {
              "__type": "Replicon.Domain.Currency",
              "Identity": "2"
            },
            "EntryDate": {
              "__type": "Date",
              "Year": 2010,
              "Month": 10,
              "Day": 10
            },
            "Project": {
              "__type": "Replicon.Project.Domain.Project",
              "Identity": "1"
            }
          }
        ]
      },
      {
        "__operation": "SetProperties",
        "ReimbursementCurrency": {
          "__type": "Replicon.Domain.Currency",
          "Identity": "4"
        }
      }
    ]
  }
]

Create Expense With ExchangeValue Override

Create an expense sheet with an override of the ExchangeValue on entry.

[
  {
    "Action": "Create",
    "Type": "Replicon.Expense.Domain.Expense",
    "Operations": [
      {
        "__operation": "SetProperties",
        "User": {
          "__type": "Replicon.Domain.User",
          "Identity": "2"
        },
        "Description": "created via RepliConnect with entries"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Entries",
        "Operations": [
          {
            "__operation": "SetProperties",
            "ExpenseType": {
              "__type": "Replicon.Expense.Domain.ExpenseType",
              "Identity": "2"
            },
            "Currency": {
              "__type": "Replicon.Domain.Currency",
              "Identity": "2"
            },
            "ExchangeValue": 1.5,
            "EntryDate": {
              "__type": "Date",
              "Year": 2010,
              "Month": 10,
              "Day": 10
            },
            "Project": {
              "__type": "Replicon.Project.Domain.Project",
              "Identity": "1"
            }
          }
        ]
      },
      {
        "__operation": "SetProperties",
        "ReimbursementCurrency": {
          "__type": "Replicon.Domain.Currency",
          "Identity": "4"
        }
      }
    ]
  }
]

Submit Expense

Submit a expense for approval. This operation can be done as part of an edit, but is shown here as a separate query.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Expense.Domain.Expense",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Submit",
        "Comment": "My submit comment"
      }
    ]
  }
]

Unsubmit Expense

Unsubmit a expense.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Expense.Domain.Expense",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Unsubmit"
      }
    ]
  }
]

Approve Expense

Approve a submitted expense.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Expense.Domain.Expense",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Approve",
        "Comment": "I approve of this expense."
      }
    ]
  }
]

Reject Expense

Reject a submitted expense.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Expense.Domain.Expense",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Reject",
        "Comment": "I don't like this expense."
      }
    ]
  }
]

Reopen Expense

Reopen a closed expense.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Expense.Domain.Expense",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Reopen",
        "Comment": "Gotta make a fix."
      }
    ]
  }
]

FilteredHistory relationship in Expense

Filtered Expense approval history is a subset of Expense approval history that does not contain the modifications performed by the expense owner or the substitute of expense owner at any time.

[
  {
    "Action": "Query",
    "QueryType": "ExpenseById",
    "DomainType": "Replicon.Expense.Domain.Expense",
    "Args": [
      [
        "2",
        "3"
      ]
    ],
    "Load": [
      {
        "Relationship": "FilteredHistory"
      }
    ]
  }
]