Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…y-App into audit/app-startup/use-only-required-locales
  • Loading branch information
hurali97 committed Apr 8, 2024
2 parents 9a6f88f + 1371acf commit 3f6b18c
Show file tree
Hide file tree
Showing 14 changed files with 251 additions and 100 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001046013
versionName "1.4.60-13"
versionCode 1001046100
versionName "1.4.61-0"
resConfigs "en", "es"
}

Expand Down
55 changes: 0 additions & 55 deletions docs/articles/expensify-classic/reports/Expense-Rules.md

This file was deleted.

63 changes: 63 additions & 0 deletions docs/articles/expensify-classic/workspaces/Currency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Report Currency
description: Understanding expense and report currency
---

# Overview
As a workspace admin, you can choose a default currency for your employees' expense reports, and we’ll automatically convert any expenses into that currency.

Here are a few essential things to remember:

- Currency settings for a workspace apply to all expenses under that workspace. If you need different default currencies for certain employees, creating separate workspaces and configuring the currency settings is best.
- As an admin, the currency settings you establish in the workspace will take precedence over any currency settings individual users may have in their accounts.
- Currency is a workspace-level setting, meaning the currency you set will determine the currency for all expenses submitted on that workspace.

# How to select the currency on a workspace

## As an admin on a group workspace

1. Sign into your Expensify web account
2. Go to **Settings > Workspaces > Group > _[Workspace Name]_> Reports > Report Basics**
3. Adjust the **Report Output Currency**

## On an individual workspace

1. Sign into your Expensify web account
2. Go to **Settings > Workspaces > Individual >_[Workspace Name]_> Reports > Report Basics**
3. Adjust the **Report Output Currency**

Please note the currency setting on an individual workspace is overridden when you submit a report on a group workspace.

# Deep Dive

## Conversion Rates

Using data from Open Exchange Rates, Expensify takes the average rate on the day the expense occurred to convert an expense from one currency to another. The conversion rate can vary depending on when the expense happened since the rate is determined after the market closes on that specific date.

If the markets aren’t open on the day the expense takes place (i.e., on a Saturday), Expensify will use the daily average rate from the last available market day before the purchase took place.

When an expense is logged for a future date, possibly to anticipate a purchase that has yet to occur, we'll use the most recent available data. This means the report's value may change up to the day of that expense.

## Managing expenses for employees in several different countries

Suppose you have employees scattered across the globe who submit expense reports in various currencies. The best way to manage those expenses is to create separate group workspaces for each location or region where your employees are based.

Then, set the default currency for that workspace to match the currency in which the employees are reimbursed.

For example, if you have employees in the US, France, Japan, and India, you’d want to create four separate workspaces, add the employees to each, and then set the corresponding currency for each workspace.

{% include faq-begin.md %}

## I have expenses in several different currencies. How will this show up on a report?

If you're traveling to foreign countries during a reporting period and making purchases in various currencies, each expense is imported with the currency of the purchase.

On your expense report, Expensify will automatically convert each expense to the default currency set for the group workspace.

## How does the currency of an expense impact the conversion rate?

Expenses entered in a foreign currency are automatically converted to the default currency on your workspace. The conversion uses the day’s average trading rate pulled from [Open Exchange Rates](https://openexchangerates.org/).

If you want to bypass the exchange rate conversion, you can manually enter an expense in your default currency instead.

{% include faq-end.md %}
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.60</string>
<string>1.4.61</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.60.13</string>
<string>1.4.61.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.60</string>
<string>1.4.61</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.60.13</string>
<string>1.4.61.0</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleShortVersionString</key>
<string>1.4.60</string>
<string>1.4.61</string>
<key>CFBundleVersion</key>
<string>1.4.60.13</string>
<string>1.4.61.0</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.60-13",
"version": "1.4.61-0",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
18 changes: 16 additions & 2 deletions src/libs/NextStepUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function buildNextStep(

const {policyID = '', ownerAccountID = -1, managerID = -1} = report;
const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`] ?? ({} as Policy);
const {submitsTo, harvesting, isPreventSelfApprovalEnabled, preventSelfApproval, autoReportingFrequency, autoReportingOffset} = policy;
const {submitsTo, harvesting, preventSelfApproval, autoReportingFrequency, autoReportingOffset} = policy;
const isOwner = currentUserAccountID === ownerAccountID;
const isManager = currentUserAccountID === managerID;
const isSelfApproval = currentUserAccountID === submitsTo;
Expand Down Expand Up @@ -172,7 +172,7 @@ function buildNextStep(
}

// Prevented self submitting
if ((isPreventSelfApprovalEnabled ?? preventSelfApproval) && isSelfApproval) {
if (preventSelfApproval && isSelfApproval) {
optimisticNextStep.message = [
{
text: "Oops! Looks like you're submitting to ",
Expand Down Expand Up @@ -255,6 +255,20 @@ function buildNextStep(
break;
}

// Generates an optimistic nextStep once a report has been closed for example in the case of Submit and Close approval flow
case CONST.REPORT.STATUS_NUM.CLOSED:
optimisticNextStep = {
type,
title: 'Finished!',
message: [
{
text: 'No further action required!',
},
],
};

break;

// Generates an optimistic nextStep once a report has been approved
case CONST.REPORT.STATUS_NUM.APPROVED:
// Self review
Expand Down
39 changes: 19 additions & 20 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4743,8 +4743,8 @@ function submitReport(expenseReport: OnyxTypes.Report) {
const parentReport = ReportUtils.getReport(expenseReport.parentReportID);
const policy = getPolicy(expenseReport.policyID);
const isCurrentUserManager = currentUserPersonalDetails.accountID === expenseReport.managerID;
const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, CONST.REPORT.STATUS_NUM.SUBMITTED);
const isSubmitAndClosePolicy = PolicyUtils.isSubmitAndClose(policy);
const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, isSubmitAndClosePolicy ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.SUBMITTED);

const optimisticData: OnyxUpdate[] = !isSubmitAndClosePolicy
? [
Expand All @@ -4769,11 +4769,6 @@ function submitReport(expenseReport: OnyxTypes.Report) {
statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED,
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`,
value: optimisticNextStep,
},
]
: [
{
Expand All @@ -4787,6 +4782,12 @@ function submitReport(expenseReport: OnyxTypes.Report) {
},
];

optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`,
value: optimisticNextStep,
});

if (parentReport?.reportID) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -4822,24 +4823,22 @@ function submitReport(expenseReport: OnyxTypes.Report) {
stateNum: CONST.REPORT.STATE_NUM.OPEN,
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`,
value: currentNextStep,
},
];
if (!isSubmitAndClosePolicy) {
failureData.push(
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`,
value: {
[optimisticSubmittedReportAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.other'),
},
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`,
value: {
[optimisticSubmittedReportAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.other'),
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`,
value: currentNextStep,
},
);
});
}

if (parentReport?.reportID) {
Expand Down
15 changes: 15 additions & 0 deletions src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1951,6 +1951,11 @@ function createDraftInitialWorkspace(policyOwnerEmail = '', policyName = '', pol
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
customUnits,
makeMeAdmin,
autoReporting: true,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
harvesting: {
enabled: true,
},
},
},
{
Expand Down Expand Up @@ -2009,6 +2014,11 @@ function createWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policyName
isPolicyExpenseChatEnabled: true,
outputCurrency,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
autoReporting: true,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
harvesting: {
enabled: true,
},
customUnits,
areCategoriesEnabled: true,
areTagsEnabled: false,
Expand Down Expand Up @@ -2497,6 +2507,11 @@ function createWorkspaceFromIOUPayment(iouReport: Report | EmptyObject): string
// Setting the currency to USD as we can only add the VBBA for this policy currency right now
outputCurrency: CONST.CURRENCY.USD,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
autoReporting: true,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
harvesting: {
enabled: true,
},
customUnits,
areCategoriesEnabled: true,
areTagsEnabled: false,
Expand Down
3 changes: 0 additions & 3 deletions src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,6 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback<
enabled: boolean;
};

/** @deprecated Whether the scheduled submit is enabled */
isPreventSelfApprovalEnabled?: boolean;

/** Whether the self approval or submitting is enabled */
preventSelfApproval?: boolean;

Expand Down
Loading

0 comments on commit 3f6b18c

Please sign in to comment.