Skip to content

Commit

Permalink
Merge pull request #42548 from s77rt/qbo-export-out-of-pocket-expense…
Browse files Browse the repository at this point in the history
…-copy

QBO: Add explicit description for each export entity
  • Loading branch information
Hayata Suenaga authored May 24, 2024
2 parents b9da7f7 + 7367815 commit a85c237
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 13 deletions.
7 changes: 6 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1978,11 +1978,16 @@ export default {
exportPreferredExporterNote: 'This can be any workspace admin, but must be a Domain Admin if you set different export accounts for individual company cards in Domain Settings.',
exportPreferredExporterSubNote: 'Once set, the preferred exporter will see reports for export in their account.',
exportOutOfPocketExpensesDescription: 'Set how out-of-pocket expenses export to QuickBooks Online.',
exportCheckDescription: "We'll create a single itemized check for each Expensify report. You can write the check from your bank account of choice (below).",
exportJournalEntryDescription: "We'll create a single itemized journal entry for each Expensify report. You can post the offset entry to your account of choice (below).",
exportVendorBillDescription:
"We'll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we'll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).",
accountsPayable: 'Accounts payable',
account: 'Account',
accountDescription: 'This is your chosen account to post the journal entry offset for each report.',
accountsPayable: 'Accounts payable',
accountsPayableDescription: 'This is your chosen A/P account, against which vendor bills for each report are created.',
bankAccount: 'Bank account',
bankAccountDescription: 'This is your chosen bank account to write checks from.',
optionBelow: 'Choose an option below:',
companyCardsLocationEnabledDescription:
'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations from, this this export option is unavailable.',
Expand Down
6 changes: 6 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1997,18 +1997,24 @@ export default {
exportInvoicesDescription: 'Las facturas se exportarán a esta cuenta en QuickBooks Online.',
exportCompanyCardsDescription: 'Establece cómo se exportan las compras con tarjeta de empresa a QuickBooks Online.',
account: 'Cuenta',
accountDescription: 'Esta es la cuenta elegida para contabilizar la compensación de la entrada de diario de cada informe.',
vendor: 'Proveedor',
defaultVendor: 'Proveedor predeterminado',
defaultVendorDescription: 'Establece un proveedor predeterminado que se aplicará a todas las transacciones con tarjeta de crédito al momento de exportarlas.',
accountsPayable: 'Cuentas por pagar',
accountsPayableDescription: 'Esta es la cuenta de cuentas por pagar elegida, contra la cual se crean las facturas de proveedores para cada informe.',
bankAccount: 'Cuenta bancaria',
bankAccountDescription: 'Esta es la cuenta bancaria elegida para emitir cheques.',
optionBelow: 'Elija una opción a continuación:',
companyCardsLocationEnabledDescription:
'Nota: QuickBooks Online no admite un campo para Ubicaciones como etiquetas en las exportaciones de facturas de proveedores. A medida que importa ubicaciones, esta opción de exportación no está disponible.',
exportPreferredExporterNote:
'Puede ser cualquier administrador del espacio de trabajo, pero debe ser un administrador de dominio si configura diferentes cuentas de exportación para tarjetas de empresa individuales en la configuración del dominio.',
exportPreferredExporterSubNote: 'Una vez configurado, el exportador preferido verá los informes para exportar en tu cuenta.',
exportOutOfPocketExpensesDescription: 'Establezca cómo se exportan los gastos de bolsillo a QuickBooks Online.',
exportCheckDescription: 'Crearemos un único cheque desglosado para cada informe de Expensify. Puedes emitir el cheque desde la cuenta bancaria que elijas (más abajo).',
exportJournalEntryDescription:
'Crearemos una única entrada de diario desglosada para cada informe de Expensify. Puedes enviar la compensación de la entrada de diario a la cuenta que elijas (más abajo).',
exportVendorBillDescription:
'Crearemos una única factura de proveedor detallada para cada informe de Expensify. Si el período de la factura está cerrado, lo publicaremos en el día 1 del siguiente período abierto. Puede agregar la factura del proveedor a la cuenta A/P de tu elección (a continuación).',
outOfPocketTaxEnabledDescription:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,41 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyConne

const {reimbursableExpensesExportDestination, reimbursableExpensesAccount} = policy?.connections?.quickbooksOnline?.config ?? {};

const [title, description] = useMemo(() => {
let titleText: string | undefined;
let descriptionText: string | undefined;
switch (reimbursableExpensesExportDestination) {
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK:
titleText = translate('workspace.qbo.bankAccount');
descriptionText = translate('workspace.qbo.bankAccountDescription');
break;
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY:
titleText = translate('workspace.qbo.account');
descriptionText = translate('workspace.qbo.accountDescription');
break;
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL:
titleText = translate('workspace.qbo.accountsPayable');
descriptionText = translate('workspace.qbo.accountsPayableDescription');
break;
default:
break;
}

return [titleText, descriptionText];
}, [translate, reimbursableExpensesExportDestination]);

const data: CardListItem[] = useMemo(() => {
let accounts: Account[];
switch (reimbursableExpensesExportDestination) {
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK:
accounts = bankAccounts ?? [];
break;
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL:
accounts = accountPayable ?? [];
break;
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY:
accounts = journalEntryAccounts ?? [];
break;
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL:
accounts = accountPayable ?? [];
break;
default:
accounts = [];
}
Expand Down Expand Up @@ -70,9 +93,9 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyConne
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
>
<ScreenWrapper testID={QuickbooksOutOfPocketExpenseAccountSelectPage.displayName}>
<HeaderWithBackButton title={translate('workspace.qbo.accountsPayable')} />
<HeaderWithBackButton title={title} />
<SelectionList
headerContent={<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.accountsPayableDescription')}</Text>}
headerContent={<Text style={[styles.ph5, styles.pb5]}>{description}</Text>}
sections={[{data}]}
ListItem={RadioListItem}
onSelectRow={selectExportAccount}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useMemo} from 'react';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
Expand All @@ -24,6 +24,28 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne
const shouldShowTaxError = isTaxesEnabled && reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY;
const shouldShowLocationError = isLocationEnabled && reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY;
const hasErrors = Boolean(errorFields?.reimbursableExpensesExportDestination) || shouldShowTaxError || shouldShowLocationError;
const [exportHintText, accountDescription] = useMemo(() => {
let hintText: string | undefined;
let description: string | undefined;
switch (reimbursableExpensesExportDestination) {
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK:
hintText = isLocationEnabled ? undefined : translate('workspace.qbo.exportCheckDescription');
description = translate('workspace.qbo.bankAccount');
break;
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY:
hintText = isTaxesEnabled ? undefined : translate('workspace.qbo.exportJournalEntryDescription');
description = translate('workspace.qbo.account');
break;
case CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL:
hintText = isLocationEnabled ? undefined : translate('workspace.qbo.exportVendorBillDescription');
description = translate('workspace.qbo.accountsPayable');
break;
default:
break;
}

return [hintText, description];
}, [translate, reimbursableExpensesExportDestination, isLocationEnabled, isTaxesEnabled]);

return (
<AccessOrNotFoundWrapper
Expand All @@ -46,19 +68,15 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))}
brickRoadIndicator={hasErrors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
shouldShowRightIcon
hintText={
reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL && !isLocationEnabled
? translate('workspace.qbo.exportVendorBillDescription')
: undefined
}
hintText={exportHintText}
/>
</OfflineWithFeedback>
{isLocationEnabled && <Text style={[styles.ph5, styles.mutedNormalTextLabel, styles.pt1]}>{translate('workspace.qbo.outOfPocketLocationEnabledDescription')}</Text>}
{!isLocationEnabled && (
<OfflineWithFeedback pendingAction={pendingFields?.reimbursableExpensesAccount}>
<MenuItemWithTopDescription
title={reimbursableExpensesAccount?.name}
description={translate('workspace.qbo.accountsPayable')}
description={accountDescription}
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))}
brickRoadIndicator={errorFields?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
shouldShowRightIcon
Expand Down

0 comments on commit a85c237

Please sign in to comment.