mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
feat(Sales & Purchases ): add currency in header & entries.
This commit is contained in:
@@ -8,23 +8,17 @@ import VendorCreditNoteFormHeaderFields from './VendorCreditNoteFormHeaderFields
|
||||
import { getEntriesTotal } from 'containers/Entries/utils';
|
||||
import { PageFormBigNumber } from 'components';
|
||||
|
||||
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
/**
|
||||
* Vendor Credit note header.
|
||||
*/
|
||||
function VendorCreditNoteFormHeader({
|
||||
// #withCurrentOrganization
|
||||
organization: { base_currency },
|
||||
}) {
|
||||
const { values } = useFormikContext();
|
||||
function VendorCreditNoteFormHeader() {
|
||||
const { values:{entries ,currency_code} } = useFormikContext();
|
||||
|
||||
// Calculate the total amount.
|
||||
const totalAmount = React.useMemo(
|
||||
() => getEntriesTotal(values.entries),
|
||||
[values.entries],
|
||||
() => getEntriesTotal(entries),
|
||||
[entries],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -33,10 +27,10 @@ function VendorCreditNoteFormHeader({
|
||||
<PageFormBigNumber
|
||||
label={intl.get('vendor_credits.label.amount_to_credit')}
|
||||
amount={totalAmount}
|
||||
currencyCode={base_currency}
|
||||
currencyCode={currency_code}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withCurrentOrganization())(VendorCreditNoteFormHeader);
|
||||
export default VendorCreditNoteFormHeader;
|
||||
|
||||
@@ -108,6 +108,7 @@ function VendorCreditNoteFormHeaderFields({
|
||||
onContactSelected={(contact) => {
|
||||
form.setFieldValue('vendor_id', contact.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', contact?.currency_code);
|
||||
setSelectVendor(contact);
|
||||
}}
|
||||
popoverFill={true}
|
||||
|
||||
Reference in New Issue
Block a user