Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a514c97409 | ||
|
|
77e2411a88 | ||
|
|
5565e923ab | ||
|
|
45d5b658e8 | ||
|
|
f0cbe4a7de | ||
|
|
9ad411af65 |
@@ -1,4 +1,4 @@
|
||||
from brewman.main import init
|
||||
from .main import init
|
||||
|
||||
|
||||
init()
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "11.1.4"
|
||||
__version__ = "11.1.6"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import uuid
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy.orm import Mapped, relationship
|
||||
@@ -18,6 +20,30 @@ class Account(AccountBase):
|
||||
"Product", primaryjoin="Account.id==Product.account_id", back_populates="account"
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
type_id: int,
|
||||
is_starred: bool,
|
||||
is_active: bool,
|
||||
is_reconcilable: bool,
|
||||
cost_centre_id: uuid.UUID,
|
||||
code: int | None = None,
|
||||
id_: uuid.UUID | None = None,
|
||||
is_fixture: bool = False,
|
||||
) -> None:
|
||||
if code is not None:
|
||||
self.code = code
|
||||
self.name = name
|
||||
self.type_id = type_id
|
||||
self.is_starred = is_starred
|
||||
self.is_active = is_active
|
||||
self.is_reconcilable = is_reconcilable
|
||||
self.cost_centre_id = cost_centre_id
|
||||
if id_ is not None:
|
||||
self.id = id_
|
||||
self.is_fixture = is_fixture
|
||||
|
||||
def can_delete(self, advanced_delete: bool) -> tuple[bool, str]:
|
||||
if len(self.products) > 0:
|
||||
return False, "Account has products"
|
||||
|
||||
@@ -70,13 +70,6 @@ class AccountBase:
|
||||
self.id = id_
|
||||
self.is_fixture = is_fixture
|
||||
|
||||
def create(self, db: Session) -> "AccountBase":
|
||||
self.code = db.execute(
|
||||
select(func.coalesce(func.max(AccountBase.code), 0) + 1).where(AccountBase.type_id == self.type_id)
|
||||
).scalar_one()
|
||||
db.add(self)
|
||||
return self
|
||||
|
||||
def can_delete(self, advanced_delete: bool) -> tuple[bool, str]:
|
||||
if self.is_fixture:
|
||||
return False, f"{self.name} is a fixture and cannot be edited or deleted."
|
||||
|
||||
@@ -35,15 +35,14 @@ def save(
|
||||
with SessionFuture() as db:
|
||||
item = Account(
|
||||
name=data.name,
|
||||
code=Account.get_code(data.type_, db),
|
||||
type_id=data.type_,
|
||||
is_starred=data.is_starred,
|
||||
is_active=data.is_active,
|
||||
is_reconcilable=data.is_reconcilable,
|
||||
cost_centre_id=data.cost_centre.id_,
|
||||
)
|
||||
item.code = db.execute(
|
||||
select(func.coalesce(func.max(Account.code), 0) + 1).where(Account.type_id == item.type_id)
|
||||
).scalar_one()
|
||||
|
||||
db.add(item)
|
||||
db.commit()
|
||||
except SQLAlchemyError as e:
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import json
|
||||
import multiprocessing
|
||||
import os
|
||||
|
||||
|
||||
workers_per_core_str = os.getenv("WORKERS_PER_CORE", "1")
|
||||
max_workers_str = os.getenv("MAX_WORKERS")
|
||||
use_max_workers = None
|
||||
if max_workers_str:
|
||||
use_max_workers = int(max_workers_str)
|
||||
web_concurrency_str = os.getenv("WEB_CONCURRENCY", None)
|
||||
|
||||
host = os.getenv("HOST", "0.0.0.0")
|
||||
port = os.getenv("PORT", "9994")
|
||||
bind_env = os.getenv("BIND", None)
|
||||
use_loglevel = os.getenv("LOG_LEVEL", "info")
|
||||
if bind_env:
|
||||
use_bind = bind_env
|
||||
else:
|
||||
use_bind = f"{host}:{port}"
|
||||
|
||||
cores = multiprocessing.cpu_count()
|
||||
workers_per_core = float(workers_per_core_str)
|
||||
default_web_concurrency = workers_per_core * cores
|
||||
if web_concurrency_str:
|
||||
web_concurrency = int(web_concurrency_str)
|
||||
assert web_concurrency > 0
|
||||
else:
|
||||
web_concurrency = max(int(default_web_concurrency), 2)
|
||||
if use_max_workers:
|
||||
web_concurrency = min(web_concurrency, use_max_workers)
|
||||
accesslog_var = os.getenv("ACCESS_LOG", "-")
|
||||
use_accesslog = accesslog_var or None
|
||||
errorlog_var = os.getenv("ERROR_LOG", "-")
|
||||
use_errorlog = errorlog_var or None
|
||||
graceful_timeout_str = os.getenv("GRACEFUL_TIMEOUT", "120")
|
||||
timeout_str = os.getenv("TIMEOUT", "120")
|
||||
keepalive_str = os.getenv("KEEP_ALIVE", "5")
|
||||
|
||||
# Gunicorn config variables
|
||||
loglevel = use_loglevel
|
||||
workers = web_concurrency
|
||||
bind = use_bind
|
||||
errorlog = use_errorlog
|
||||
worker_tmp_dir = "/dev/shm"
|
||||
accesslog = use_accesslog
|
||||
graceful_timeout = int(graceful_timeout_str)
|
||||
timeout = int(timeout_str)
|
||||
keepalive = int(keepalive_str)
|
||||
|
||||
|
||||
# For debugging and testing
|
||||
log_data = {
|
||||
"loglevel": loglevel,
|
||||
"workers": workers,
|
||||
"bind": bind,
|
||||
"graceful_timeout": graceful_timeout,
|
||||
"timeout": timeout,
|
||||
"keepalive": keepalive,
|
||||
"errorlog": errorlog,
|
||||
"accesslog": accesslog,
|
||||
# Additional, non-gunicorn variables
|
||||
"workers_per_core": workers_per_core,
|
||||
"use_max_workers": use_max_workers,
|
||||
"host": host,
|
||||
"port": port,
|
||||
}
|
||||
print(json.dumps(log_data))
|
||||
@@ -0,0 +1,53 @@
|
||||
[loggers]
|
||||
keys=root, gunicorn.error, gunicorn.access
|
||||
|
||||
[handlers]
|
||||
keys=console, error, access
|
||||
|
||||
[formatters]
|
||||
keys=generic, error, access
|
||||
|
||||
[logger_root]
|
||||
level=INFO
|
||||
handlers=console
|
||||
qualname=root
|
||||
|
||||
[logger_gunicorn.error]
|
||||
level=INFO
|
||||
handlers=console
|
||||
qualname=gunicorn.error
|
||||
|
||||
[logger_gunicorn.access]
|
||||
level=INFO
|
||||
handlers=access
|
||||
qualname=gunicorn.access
|
||||
|
||||
[handler_console]
|
||||
class=StreamHandler
|
||||
formatter=generic
|
||||
args=(sys.stdout, )
|
||||
|
||||
[handler_error]
|
||||
class=StreamHandler
|
||||
formatter=error
|
||||
args=(sys.stdout, )
|
||||
|
||||
[handler_access]
|
||||
class=StreamHandler
|
||||
formatter=access
|
||||
args=(sys.stdout, )
|
||||
|
||||
[formatter_generic]
|
||||
format=%(asctime)s [%(name)s %(levelname)s %(process)d] %(message)s
|
||||
datefmt=%Y-%m-%d %H:%M:%S %Z
|
||||
class=logging.Formatter
|
||||
|
||||
[formatter_error]
|
||||
format=%(asctime)s [%(name)s %(levelname)s %(process)d] %(message)s | %(funcName)s() | %(pathname)s L%(lineno)-4d
|
||||
datefmt=%Y-%m-%d %H:%M:%S %Z
|
||||
class=logging.Formatter
|
||||
|
||||
[formatter_access]
|
||||
format=%(asctime)s [%(name)s %(levelname)s %(process)d] %(message)s
|
||||
datefmt=%Y-%m-%d %H:%M:%S %Z
|
||||
class=logging.Formatter
|
||||
@@ -1,27 +1,28 @@
|
||||
[tool.poetry]
|
||||
name = "brewman"
|
||||
version = "11.1.4"
|
||||
version = "11.1.6"
|
||||
description = "Accounting plus inventory management for a restaurant."
|
||||
authors = ["tanshu <git@tanshu.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
uvicorn = {extras = ["standard"], version = "^0.21.1"}
|
||||
fastapi = {extras = ["all"], version = "^0.100.0"}
|
||||
uvicorn = {extras = ["standard"], version = "^0.23.2"}
|
||||
fastapi = {extras = ["all"], version = "^0.101.0"}
|
||||
python-jose = {extras = ["cryptography"], version = "^3.3.0"}
|
||||
passlib = {extras = ["bcrypt"], version = "^1.7.4"}
|
||||
psycopg2-binary = "^2.9.5"
|
||||
SQLAlchemy = "^2.0.7"
|
||||
psycopg2-binary = "^2.9.7"
|
||||
SQLAlchemy = "^2.0.19"
|
||||
python-multipart = "^0.0.6"
|
||||
PyJWT = "^2.8.0"
|
||||
alembic = "^1.11.1"
|
||||
alembic = "^1.11.2"
|
||||
itsdangerous = "^2.1.2"
|
||||
python-dotenv = "^1.0.0"
|
||||
pydantic = {extras = ["dotenv"], version = "^2.0.3"}
|
||||
pydantic = {extras = ["dotenv"], version = "^2.1.1"}
|
||||
starlette = "^0.27.0"
|
||||
pandas = "^2.0.0"
|
||||
arq = "^0.25.0"
|
||||
openpyxl = "^3.1.2"
|
||||
gunicorn = "^21.2.0"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
flake8 = "^6.0.0"
|
||||
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
gunicorn brewman.main:app --worker-class uvicorn.workers.UvicornWorker --config ./gunicorn.conf.py --log-config ./logging.conf
|
||||
@@ -50,4 +50,4 @@ RUN chmod 777 /app/docker-entrypoint.sh \
|
||||
&& ln -s /app/docker-entrypoint.sh /
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["poetry", "run", "python", "-m", "brewman"]
|
||||
CMD ["poetry", "run", "gunicorn", "brewman.main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--config", "/app/gunicorn.conf.py", "--log-config", "/app/logging.conf"]
|
||||
|
||||
@@ -2,15 +2,11 @@ HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/brewman_hinchco
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/brewman_{{ name }}
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=brewman_hinchco
|
||||
SECRET_KEY=7b889cff76532fde8483304cf415243f70df200518ba9aee4d26c0709ad6fbd1
|
||||
MIDDLEWARE_SECRET_KEY=1e36e7f678
|
||||
SECRET_KEY={{ secret_key }}
|
||||
MIDDLEWARE_SECRET_KEY={{ middleware_key }}
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
@@ -1,17 +0,0 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/acc
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=exp
|
||||
SECRET_KEY=c9bee2d38676447c2f7a9ea715446e2fd09f16fbaa5b3f6a6f207ec18993987f
|
||||
MIDDLEWARE_SECRET_KEY=cb71666b9c
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||
@@ -1,17 +0,0 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/exp
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=exp
|
||||
SECRET_KEY=8546a61262dab7c05ccf2e26abe30bc10966904df6dfd29259ea85dd0844a8e7
|
||||
MIDDLEWARE_SECRET_KEY=da6fcd999b
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||
@@ -1,17 +0,0 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/hops
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=exp
|
||||
SECRET_KEY=cfb3be420c4e2b0ed423b2e4e238713d0461e2ba56198138ad6c4d82aef6295c
|
||||
MIDDLEWARE_SECRET_KEY=9c2bdd24be
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||
@@ -1,17 +0,0 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/mhl
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=exp
|
||||
SECRET_KEY=c9fd1b99931feb083f67470170650420b99eb35368d3de186427166c28d32c8b
|
||||
MIDDLEWARE_SECRET_KEY=9183bdcfb0
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||
+5
-5
@@ -5,11 +5,11 @@
|
||||
# - A hostname/ip can be a member of multiple groups
|
||||
|
||||
[brewman]
|
||||
acc ansible_host=beacon var_file=vars/acc.yml
|
||||
exp ansible_host=beacon var_file=vars/exp.yml
|
||||
hops ansible_host=beacon var_file=vars/hops.yml
|
||||
mhl ansible_host=beacon var_file=vars/mhl.yml
|
||||
hinchco ansible_host=beacon var_file=vars/hinchco.yml
|
||||
acc ansible_host=gondor var_file=vars/acc.yml
|
||||
exp ansible_host=gondor var_file=vars/exp.yml
|
||||
hops ansible_host=gondor var_file=vars/hops.yml
|
||||
mhl ansible_host=gondor var_file=vars/mhl.yml
|
||||
hinchco ansible_host=gondor var_file=vars/hinchco.yml
|
||||
|
||||
[all:vars]
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
|
||||
+6
-3
@@ -6,6 +6,7 @@
|
||||
become: true
|
||||
vars_files:
|
||||
- "{{ var_file }}"
|
||||
- vars/default.yml
|
||||
|
||||
tasks:
|
||||
- name: Copy dockerfile
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
- name: Upload the .env file
|
||||
template:
|
||||
src: "{{ env_file }}"
|
||||
src: "files/.env"
|
||||
dest: "/var/lib/{{ host_directory }}/.env"
|
||||
|
||||
- name: Create brewman container
|
||||
@@ -40,8 +41,10 @@
|
||||
state: started
|
||||
restart_policy: "unless-stopped"
|
||||
env_file: "/var/lib/{{ host_directory }}/.env"
|
||||
links:
|
||||
- "postgres:db"
|
||||
etc_hosts:
|
||||
db : "{{ db_host }}"
|
||||
# links:
|
||||
# - "postgres:db"
|
||||
published_ports:
|
||||
- "127.0.0.1:{{ host_port }}:80"
|
||||
volumes:
|
||||
|
||||
+7
-2
@@ -1,6 +1,11 @@
|
||||
---
|
||||
name: acc
|
||||
# host_directory: "brewman-{{ name }}"
|
||||
# db_name: "brewman_{{ name }}"
|
||||
|
||||
http_host: "acc.hopsngrains.com"
|
||||
http_conf: "acc.hopsngrains.com.conf"
|
||||
host_port: "8659"
|
||||
host_directory: "brewman-acc"
|
||||
env_file: "files/.env-acc"
|
||||
|
||||
secret_key: c9bee2d38676447c2f7a9ea715446e2fd09f16fbaa5b3f6a6f207ec18993987f
|
||||
middleware_key: cb71666b9c
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
db_host: 172.26.12.67
|
||||
host_directory: "brewman-{{ name }}"
|
||||
db_name: "brewman_{{ name }}"
|
||||
+7
-2
@@ -1,6 +1,11 @@
|
||||
---
|
||||
name: exp
|
||||
# host_directory: "brewman-{{ name }}"
|
||||
# db_name: "brewman_{{ name }}"
|
||||
|
||||
http_host: "exp.tanshu.com"
|
||||
http_conf: "exp.tanshu.com.conf"
|
||||
host_port: "8656"
|
||||
host_directory: "brewman-exp"
|
||||
env_file: "files/.env-exp"
|
||||
|
||||
secret_key: 8546a61262dab7c05ccf2e26abe30bc10966904df6dfd29259ea85dd0844a8e7
|
||||
middleware_key: da6fcd999b
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
---
|
||||
name: hinchco
|
||||
# host_directory: "brewman-{{ name }}"
|
||||
# db_name: "brewman_{{ name }}"
|
||||
|
||||
http_host: "acc.hinchco.in"
|
||||
http_conf: "acc.hinchco.in.conf"
|
||||
host_port: "8655"
|
||||
host_directory: "brewman-hinchco"
|
||||
env_file: "files/.env-hinchco"
|
||||
|
||||
secret_key: 7b889cff76532fde8483304cf415243f70df200518ba9aee4d26c0709ad6fbd1
|
||||
middleware_key: 1e36e7f678
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
---
|
||||
name: hops
|
||||
# host_directory: "brewman-{{ name }}"
|
||||
# db_name: "brewman_{{ name }}"
|
||||
|
||||
http_host: "hops.hopsngrains.com"
|
||||
http_conf: "hops.hopsngrains.com.conf"
|
||||
host_port: "8658"
|
||||
host_directory: "brewman-hops"
|
||||
env_file: "files/.env-hops"
|
||||
|
||||
secret_key: cfb3be420c4e2b0ed423b2e4e238713d0461e2ba56198138ad6c4d82aef6295c
|
||||
middleware_key: 9c2bdd24be
|
||||
|
||||
+7
-2
@@ -1,6 +1,11 @@
|
||||
---
|
||||
name: mhl
|
||||
# host_directory: "brewman-{{ name }}"
|
||||
# db_name: "brewman_{{ name }}"
|
||||
|
||||
http_host: "mhl.hopsngrains.com"
|
||||
http_conf: "mhl.hopsngrains.com.conf"
|
||||
host_port: "8657"
|
||||
host_directory: "brewman-mhl"
|
||||
env_file: "files/.env-mhl"
|
||||
|
||||
secret_key: c9fd1b99931feb083f67470170650420b99eb35368d3de186427166c28d32c8b
|
||||
middleware_key: 9183bdcfb0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "overlord",
|
||||
"version": "11.1.4",
|
||||
"version": "11.1.6",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
|
||||
@@ -148,8 +148,8 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
if (formValue === undefined) {
|
||||
return;
|
||||
}
|
||||
const grossSalary = +(formValue.grossSalary ?? '0');
|
||||
const daysWorked = +(formValue.daysWorked ?? '0');
|
||||
const grossSalary = Number(formValue.grossSalary);
|
||||
const daysWorked = Number(formValue.daysWorked);
|
||||
const date = this.form.value.date ?? new Date();
|
||||
const daysInMonth = moment(date).daysInMonth();
|
||||
const esi = EmployeeBenefitsComponent.getEsi(grossSalary, daysWorked, daysInMonth);
|
||||
|
||||
@@ -129,8 +129,8 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
const formValue = this.form.value;
|
||||
this.item.name = formValue.name ?? '';
|
||||
this.item.designation = formValue.designation ?? '';
|
||||
this.item.salary = +(formValue.salary ?? '0');
|
||||
this.item.points = +(formValue.points ?? '0');
|
||||
this.item.salary = Number(formValue.salary);
|
||||
this.item.points = Number(formValue.points);
|
||||
this.item.isActive = formValue.isActive ?? true;
|
||||
this.item.costCentre.id = formValue.costCentre ?? '';
|
||||
this.item.joiningDate = moment(formValue.joiningDate).format('DD-MMM-YYYY');
|
||||
|
||||
@@ -62,13 +62,13 @@ export class ProductLedgerDataSource extends DataSource<ProductLedgerItem> {
|
||||
case 'date':
|
||||
return compare(a.date, b.date, isAsc);
|
||||
case 'debitQuantity':
|
||||
return compare(Number(a.debitQuantity ?? '0'), Number(b.debitQuantity ?? '0'), isAsc);
|
||||
return compare(Number(a.debitQuantity), Number(b.debitQuantity), isAsc);
|
||||
case 'debitAmount':
|
||||
return compare(Number(a.debitAmount ?? '0'), Number(b.debitAmount ?? '0'), isAsc);
|
||||
return compare(Number(a.debitAmount), Number(b.debitAmount), isAsc);
|
||||
case 'creditQuantity':
|
||||
return compare(Number(a.creditQuantity ?? '0'), Number(b.creditQuantity ?? '0'), isAsc);
|
||||
return compare(Number(a.creditQuantity), Number(b.creditQuantity), isAsc);
|
||||
case 'creditAmount':
|
||||
return compare(Number(a.creditAmount ?? '0'), Number(b.creditAmount ?? '0'), isAsc);
|
||||
return compare(Number(a.creditAmount), Number(b.creditAmount), isAsc);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -113,12 +113,12 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
|
||||
this.runningAmount = 0;
|
||||
this.info.body.forEach((item) => {
|
||||
if (item.type !== 'Opening Balance') {
|
||||
this.debitAmount += Number(item.debitAmount ?? '0');
|
||||
this.creditQuantity += Number(item.creditQuantity ?? '0');
|
||||
this.creditAmount += Number(item.creditAmount ?? '0');
|
||||
this.debitAmount += Number(item.debitAmount);
|
||||
this.creditQuantity += Number(item.creditQuantity);
|
||||
this.creditAmount += Number(item.creditAmount);
|
||||
}
|
||||
this.runningQuantity += Number(item.debitQuantity ?? '0') - Number(item.creditQuantity ?? '0');
|
||||
this.runningAmount += Number(item.debitAmount ?? '0') - Number(item.creditAmount ?? '0');
|
||||
this.runningQuantity += Number(item.debitQuantity) - Number(item.creditQuantity);
|
||||
this.runningAmount += Number(item.debitAmount) - Number(item.creditAmount);
|
||||
item.runningQuantity = this.runningQuantity;
|
||||
item.runningAmount = this.runningAmount;
|
||||
});
|
||||
|
||||
@@ -113,22 +113,22 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
if (formValue === undefined) {
|
||||
return;
|
||||
}
|
||||
const fraction = +(formValue.fraction ?? '0');
|
||||
const fraction = Number(formValue.fraction);
|
||||
if (fraction < 1) {
|
||||
this.toaster.show('Danger', 'Fraction has to be >= 1');
|
||||
return;
|
||||
}
|
||||
const productYield = +(formValue.productYield ?? '0');
|
||||
const productYield = Number(formValue.productYield);
|
||||
if (productYield < 0 || productYield > 1) {
|
||||
this.toaster.show('Danger', 'Product Yield has to be > 0 and <= 1');
|
||||
return;
|
||||
}
|
||||
const costPrice = +(formValue.costPrice ?? '0');
|
||||
const costPrice = Number(formValue.costPrice);
|
||||
if (costPrice < 0) {
|
||||
this.toaster.show('Danger', 'Price has to be >= 0');
|
||||
return;
|
||||
}
|
||||
const salePrice = +(formValue.salePrice ?? '0');
|
||||
const salePrice = Number(formValue.salePrice);
|
||||
if (salePrice < 0) {
|
||||
this.toaster.show('Danger', 'Sale Price has to be >= 0');
|
||||
return;
|
||||
|
||||
@@ -2,5 +2,5 @@ export const environment = {
|
||||
production: true,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
||||
version: '11.1.4',
|
||||
version: '11.1.6',
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ export const environment = {
|
||||
production: false,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
||||
version: '11.1.4',
|
||||
version: '11.1.6',
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user