Compare commits

...

8 Commits

Author SHA1 Message Date
Ahmed Bouhuolia
5df454dd30 chore: bump packages version to v0.10.2 2023-10-02 23:29:21 +02:00
Ahmed Bouhuolia
07628ddc37 fix(server): add missing method in ItemEntry model. 2023-10-02 23:27:19 +02:00
Ahmed Bouhuolia
69afa07e3b fix(webapp): Disable tax rates from item entries editor table on services do not support tax rates 2023-10-02 23:27:05 +02:00
Ahmed Bouhuolia
b1a043f699 chore(server): add package-lock.json file 2023-09-27 19:16:02 +02:00
Ahmed Bouhuolia
9eaff0785b chore: update CHANGELOG.md file 2023-09-25 17:14:07 +02:00
Ahmed Bouhuolia
b3a97ed5d5 chore: dump packages versions 2023-09-25 15:34:10 +02:00
Ahmed Bouhuolia
1aaa65edd2 Merge pull request #242 from bigcapitalhq/abouhuolia/big-62-running-tenants-dbs-migration-on-migration-docker-container
fix: Running tenants migration on docker migration container
2023-09-25 15:31:54 +02:00
Ahmed Bouhuolia
efebf424d1 fix: running tenants migration on docker migration container 2023-09-25 15:31:09 +02:00
17 changed files with 13767 additions and 29 deletions

View File

@@ -2,6 +2,20 @@
All notable changes to Bigcapital server-side will be in this file.
# [0.10.1] - 25-09-2023
* Fix: Running tenants migration on Docker migration container by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/242
# [0.10.0] - 24-09-2023
* Added: Tax rates service by @abouolia @elforjani13 in https://github.com/bigcapitalhq/bigcapital/pull/204
* Added: Sales Tax Liability Summary report by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/204
* Added: Tax rates tracking with sale invoices by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/204
* fix(webapp): Table headers sticky for all reports. by @elforjani13 in https://github.com/bigcapitalhq/bigcapital/pull/240
* chore(deps): bump word-wrap from 1.2.3 to 1.2.4 by @dependabot in https://github.com/bigcapitalhq/bigcapital/pull/200
* chore(deps): bump word-wrap from 1.2.3 to 1.2.4 in /packages/webapp by @dependabot in https://github.com/bigcapitalhq/bigcapital/pull/199
* chore(deps): bump mongoose from 5.13.15 to 5.13.20 by @dependabot in https://github.com/bigcapitalhq/bigcapital/pull/197
# [0.9.12] - 29-08-2023
* Refactor: split the services to multiple service classes. (by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/202)

View File

@@ -15,8 +15,8 @@ services:
- ./data/logs/nginx/:/var/log/nginx
- ./docker/certbot/certs/:/var/certs
ports:
- "${PUBLIC_PROXY_PORT:-80}:80"
- "${PUBLIC_PROXY_SSL_PORT:-443}:443"
- '${PUBLIC_PROXY_PORT:-80}:80'
- '${PUBLIC_PROXY_SSL_PORT:-443}:443'
tty: true
depends_on:
- server
@@ -71,7 +71,7 @@ services:
# Authentication
- JWT_SECRET=${JWT_SECRET}
# MongoDB
# MongoDB
- MONGODB_DATABASE_URL=mongodb://mongo/bigcapital
# Application
@@ -92,11 +92,14 @@ services:
context: ./
dockerfile: docker/migration/Dockerfile
environment:
# Database
- DB_HOST=mysql
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_CHARSET=${DB_CHARSET}
- SYSTEM_DB_NAME=${SYSTEM_DB_NAME}
# Tenants databases
- TENANT_DB_NAME_PERFIX=${TENANT_DB_NAME_PERFIX}
depends_on:
- mysql
@@ -136,7 +139,7 @@ services:
build:
context: ./docker/redis
expose:
- "6379"
- '6379'
volumes:
- redis:/data

View File

@@ -34,5 +34,7 @@ WORKDIR /app/packages/server
RUN git clone https://github.com/vishnubob/wait-for-it.git
# Once we listen the mysql port run the migration task.
CMD ["./wait-for-it/wait-for-it.sh", "mysql:3306", "--", "node", "./build/commands.js", "system:migrate:latest"]
ADD docker/migration/start.sh /
RUN chmod +x /start.sh
CMD ["/start.sh"]

View File

@@ -0,0 +1,5 @@
# Migrate the master system database.
./wait-for-it/wait-for-it.sh mysql:3306 -- node ./build/commands.js system:migrate:latest
# Migrate all tenants.
./wait-for-it/wait-for-it.sh mysql:3306 -- node ./build/commands.js tenants:migrate:latest

13663
packages/server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@bigcapital/server",
"version": "0.9.5",
"version": "0.10.2",
"description": "",
"main": "src/server.ts",
"scripts": {

View File

@@ -99,6 +99,13 @@ export default class ItemEntry extends TenantModel {
: getExlusiveTaxAmount(this.amount, this.taxRate);
}
static calcAmount(itemEntry) {
const { discount, quantity, rate } = itemEntry;
const total = quantity * rate;
return discount ? total - total * discount * 0.01 : total;
}
/**
* Item entry relations.
*/

View File

@@ -1,6 +1,6 @@
{
"name": "@bigcapital/webapp",
"version": "0.9.6",
"version": "0.10.2",
"private": true,
"dependencies": {
"@blueprintjs-formik/core": "^0.3.4",

View File

@@ -17,11 +17,21 @@ import {
useItemEntriesTableContext,
} from './ItemEntriesTableProvider';
import { useUncontrolled } from '@/hooks/useUncontrolled';
import { ItemEntry } from '@/interfaces/ItemEntries';
interface ItemsEntriesTableProps {
initialValue?: ItemEntry;
value?: ItemEntry[];
onChange?: (entries: ItemEntry[]) => void;
taxRates?: any[];
minLinesNumber?: number;
enableTaxRates?: boolean;
}
/**
* Items entries table.
*/
function ItemsEntriesTable(props) {
function ItemsEntriesTable(props: ItemsEntriesTableProps) {
const { value, initialValue, onChange } = props;
const [localValue, handleChange] = useUncontrolled({
@@ -119,8 +129,11 @@ ItemsEntriesTable.defaultProps = {
discount: '',
},
initialEntries: [],
taxRates: [],
items: [],
linesNumber: 1,
minLinesNumber: 1,
enableTaxRates: true,
};
export default ItemsEntriesTable;

View File

@@ -92,7 +92,7 @@ const LandedCostHeaderCell = () => {
*/
export function useEditableItemsEntriesColumns() {
const { featureCan } = useFeatureCan();
const { landedCost } = useItemEntriesTableContext();
const { landedCost, enableTaxRates } = useItemEntriesTableContext();
const isProjectsFeatureEnabled = featureCan(Features.Projects);
@@ -132,13 +132,17 @@ export function useEditableItemsEntriesColumns() {
width: 70,
align: Align.Right,
},
{
Header: 'Tax rate',
accessor: 'tax_rate_id',
Cell: TaxRatesSuggestInputCell,
disableSortBy: true,
width: 110,
},
...(enableTaxRates
? [
{
Header: 'Tax rate',
accessor: 'tax_rate_id',
Cell: TaxRatesSuggestInputCell,
disableSortBy: true,
width: 110,
},
]
: []),
{
Header: intl.get('discount'),
accessor: 'discount',

View File

@@ -27,8 +27,8 @@ export default function BillFormBody({ defaultBill }) {
meta: { error, touched },
}) => (
<ItemsEntriesTable
entries={value}
onUpdateData={(entries) => {
value={value}
onChange={(entries) => {
setFieldValue('entries', entries);
}}
items={items}
@@ -37,6 +37,7 @@ export default function BillFormBody({ defaultBill }) {
currencyCode={values.currency_code}
itemType={ITEM_TYPE.PURCHASABLE}
landedCost={true}
enableTaxRates={false}
/>
)}
</FastField>

View File

@@ -22,14 +22,15 @@ export default function VendorCreditNoteItemsEntriesEditor() {
meta: { error, touched },
}) => (
<ItemsEntriesTable
entries={value}
onUpdateData={(entries) => {
value={value}
onChange={(entries) => {
setFieldValue('entries', entries);
}}
items={items}
errors={error}
linesNumber={4}
currencyCode={values.currency_code}
enableTaxRates={false}
/>
)}
</FastField>

View File

@@ -26,14 +26,15 @@ export default function CreditNoteItemsEntriesEditorField() {
meta: { error, touched },
}) => (
<ItemsEntriesTable
entries={value}
onUpdateData={(entries) => {
value={value}
onChange={(entries) => {
setFieldValue('entries', entries);
}}
items={items}
errors={error}
linesNumber={4}
currencyCode={values.currency_code}
enableTaxRates={false}
/>
)}
</FastField>

View File

@@ -26,14 +26,15 @@ export default function EstimateFormItemsEntriesField() {
meta: { error, touched },
}) => (
<ItemsEntriesTable
entries={value}
onUpdateData={(entries) => {
value={value}
onChange={(entries) => {
setFieldValue('entries', entries);
}}
items={items}
errors={error}
linesNumber={4}
currencyCode={values.currency_code}
enableTaxRates={false}
/>
)}
</FastField>

View File

@@ -31,6 +31,15 @@ export const defaultEstimateEntry = {
amount: '',
};
const defaultEstimateEntryReq = {
index: 0,
item_id: '',
rate: '',
discount: '',
quantity: '',
description: '',
};
export const defaultEstimate = {
customer_id: '',
estimate_date: moment(new Date()).format('YYYY-MM-DD'),
@@ -148,7 +157,9 @@ export const transfromsFormValuesToRequest = (values) => {
...(values.estimate_number_manually && {
estimate_number: values.estimate_number,
}),
entries: entries.map((entry) => ({ ...omit(entry, ['amount']) })),
entries: entries.map((entry) => ({
...transformToForm(entry, defaultEstimateEntryReq),
})),
};
};

View File

@@ -19,14 +19,15 @@ export default function ReceiptItemsEntriesEditor({ defaultReceipt }) {
meta: { error, touched },
}) => (
<ItemsEntriesTable
entries={value}
onUpdateData={(entries) => {
value={value}
onChange={(entries) => {
setFieldValue('entries', entries);
}}
items={items}
errors={error}
linesNumber={4}
currencyCode={values.currency_code}
enableTaxRates={false}
/>
)}
</FastField>

View File

@@ -32,6 +32,15 @@ export const defaultReceiptEntry = {
amount: '',
};
const defaultReceiptEntryReq = {
index: 0,
item_id: '',
rate: '',
discount: '',
quantity: '',
description: '',
};
export const defaultReceipt = {
customer_id: '',
deposit_account_id: '',
@@ -140,7 +149,9 @@ export const transformFormValuesToRequest = (values) => {
...(values.receipt_number_manually && {
receipt_number: values.receipt_number,
}),
entries: entries.map((entry) => ({ ...omit(entry, ['amount']) })),
entries: entries.map((entry) => ({
...transformToForm(entry, defaultReceiptEntryReq),
})),
closed: false,
};
};