Skip to content

Commit

Permalink
feat: support split expense grouping for Netsuite (#1079)
Browse files Browse the repository at this point in the history
* feat: support split expense grouping for Netsuite

* refactor: remove comment

(cherry picked from commit 92dc51b)
  • Loading branch information
JustARatherRidiculouslyLongUsername committed Nov 26, 2024
1 parent 5aacc1a commit 6bd776d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/app/core/models/db/expense-group-setting.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type ExpenseGroupSettingPost = {
reimbursable_export_date_type: ExportDateType | null;
corporate_credit_card_expense_group_fields?: string[] | null;
ccc_export_date_type: ExportDateType | null;
split_expense_grouping: SplitExpenseGrouping;
};

export interface ExpenseGroupSetting extends ExpenseGroupSettingPost {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ExportModuleRule, ExportSettingModel, ExportSettingValidatorRule } from
import { SelectFormOption } from "../../common/select-form-option.model";
import { DefaultDestinationAttribute } from "../../db/destination-attribute.model";
import { ExpenseGroupSettingGet, ExpenseGroupSettingPost } from "../../db/expense-group-setting.model";
import { CCCExpenseState, EmployeeFieldMapping, ExpenseGroupingFieldOption, ExpenseState, ExportDateType, FyleField, NameInJournalEntry, NetSuiteCorporateCreditCardExpensesObject, NetsuiteReimbursableExpensesObject } from "../../enum/enum.model";
import { CCCExpenseState, EmployeeFieldMapping, ExpenseGroupingFieldOption, ExpenseState, ExportDateType, FyleField, NameInJournalEntry, NetSuiteCorporateCreditCardExpensesObject, NetsuiteReimbursableExpensesObject, SplitExpenseGrouping } from "../../enum/enum.model";
import { brandingConfig, brandingContent, brandingFeatureConfig } from "src/app/branding/branding-config";
import { ExportSettingFormOption } from "../../intacct/intacct-configuration/export-settings.model";

Expand Down Expand Up @@ -237,7 +237,7 @@ export class NetSuiteExportSettingModel extends ExportSettingModel {
static getValidators(): [ExportSettingValidatorRule, ExportModuleRule[]] {
const exportSettingValidatorRule: ExportSettingValidatorRule = {
reimbursableExpense: ['reimbursableExportType', 'reimbursableExportGroup', 'reimbursableExportDate', 'expenseState'],
creditCardExpense: ['creditCardExportType', 'creditCardExportGroup', 'creditCardExportDate', 'cccExpenseState']
creditCardExpense: ['creditCardExportType', 'creditCardExportGroup', 'creditCardExportDate', 'cccExpenseState', 'splitExpenseGrouping']
};

const exportModuleRule: ExportModuleRule[] = [
Expand Down Expand Up @@ -286,7 +286,8 @@ export class NetSuiteExportSettingModel extends ExportSettingModel {
accountsPayable: new FormControl(exportSettings?.general_mappings?.accounts_payable?.id ? exportSettings.general_mappings.accounts_payable : null),
defaultCreditCardVendor: new FormControl(exportSettings?.general_mappings?.default_ccc_vendor?.id ? exportSettings.general_mappings.default_ccc_vendor : null),
nameInJournalEntry: new FormControl(exportSettings?.configuration?.name_in_journal_entry ? exportSettings?.configuration.name_in_journal_entry : this.getNameInJournalOptions()[0].value),
searchOption: new FormControl('')
searchOption: new FormControl(''),
splitExpenseGrouping: new FormControl(exportSettings?.expense_group_settings?.split_expense_grouping)
});
}

Expand All @@ -306,7 +307,8 @@ export class NetSuiteExportSettingModel extends ExportSettingModel {
reimbursable_expense_group_fields: exportSettingsForm.get('reimbursableExportGroup')?.value ? [exportSettingsForm.get('reimbursableExportGroup')?.value] : null,
reimbursable_export_date_type: exportSettingsForm.get('reimbursableExportDate')?.value,
corporate_credit_card_expense_group_fields: exportSettingsForm.get('creditCardExportGroup')?.value ? [exportSettingsForm.get('creditCardExportGroup')?.value] : null,
ccc_export_date_type: exportSettingsForm.get('creditCardExportDate')?.value
ccc_export_date_type: exportSettingsForm.get('creditCardExportDate')?.value,
split_expense_grouping: exportSettingsForm.get('splitExpenseGrouping')?.value ? exportSettingsForm.get('splitExpenseGrouping')?.value : SplitExpenseGrouping.MULTIPLE_LINE_ITEM
},
configuration: {
reimbursable_expenses_object: exportSettingsForm.get('reimbursableExportType')?.value ? exportSettingsForm.get('reimbursableExportType')?.value : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,20 @@
[formControllerName]="'creditCardExportDate'">
</app-configuration-select-field>
</div>

<div *ngIf="brandingFeatureConfig.featureFlags.exportSettings.splitExpenseGrouping && exportSettingForm.get('creditCardExportType')?.value === NetSuiteCorporateCreditCardExpensesObject.CREDIT_CARD_CHARGE" class="tw-mt-16-px tw-bg-white tw-border tw-border-solid tw-border-border-tertiary tw-rounded-12-px">
<app-configuration-select-field
[form]="exportSettingForm"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'split expense grouping'"
[label]="'How should the split expenses be grouped?'"
[subLabel]="'Choose how expenses should be grouped for split expenses'"
[options]="splitExpenseGroupingOptions"
[iconPath]="'question-square-outline'"
[placeholder]="'Select the split expense grouping type'"
[formControllerName]="'splitExpenseGrouping'">
</app-configuration-select-field>
</div>
</div>
</div>
<app-configuration-step-footer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export class NetsuiteExportSettingsComponent implements OnInit {

nameInJournalOptions = NetSuiteExportSettingModel.getNameInJournalOptions();

readonly splitExpenseGroupingOptions = NetSuiteExportSettingModel.getSplitExpenseGroupingOptions();

showNameInJournalOption: boolean;

exportSettingForm: FormGroup;
Expand Down

0 comments on commit 6bd776d

Please sign in to comment.