mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat: adjustments.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { add, sumBy, subtract } from 'lodash';
|
||||
|
||||
export const calculate = ({ type, quantity_on_hand }, operator) => {
|
||||
const qty = parseInt(quantity_on_hand);
|
||||
const quantity = parseInt(operator);
|
||||
|
||||
if (type == 'decrement') {
|
||||
return subtract(qty, quantity);
|
||||
} else {
|
||||
return add(qty, quantity);
|
||||
}
|
||||
};
|
||||
|
||||
// function calculate(qty, operator) {
|
||||
// return operator > 0
|
||||
// ? calculate(qty + 1, operator - 1)
|
||||
// : operator < 0
|
||||
// ? calculate(qty - 1, operator + 1)
|
||||
// : qty;
|
||||
// }
|
||||
Reference in New Issue
Block a user