diff --git a/brewman/routers/account.py b/brewman/routers/account.py index aff83a5c..26aa8eb4 100644 --- a/brewman/routers/account.py +++ b/brewman/routers/account.py @@ -1,4 +1,3 @@ -import traceback import uuid from typing import List, Optional from datetime import datetime @@ -49,9 +48,7 @@ def save( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.put("/{id_}", response_model=schemas.Account) @@ -84,9 +81,7 @@ def update( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.delete("/{id}") diff --git a/brewman/routers/attendance.py b/brewman/routers/attendance.py index f1f94bfe..ea90093b 100644 --- a/brewman/routers/attendance.py +++ b/brewman/routers/attendance.py @@ -1,4 +1,3 @@ -import traceback from datetime import datetime, date, timedelta from fastapi import APIRouter, HTTPException, status, Depends, Security, Request @@ -107,9 +106,7 @@ def save( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def date_range(start: date, stop: date, step=timedelta(days=1), inclusive=False): diff --git a/brewman/routers/auth/client.py b/brewman/routers/auth/client.py index ad009bff..c5658913 100644 --- a/brewman/routers/auth/client.py +++ b/brewman/routers/auth/client.py @@ -1,4 +1,3 @@ -import traceback import uuid from fastapi import APIRouter, HTTPException, status, Depends, Security @@ -46,9 +45,7 @@ def update( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.delete("/{id_}") @@ -68,9 +65,7 @@ def delete( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("/list") diff --git a/brewman/routers/auth/role.py b/brewman/routers/auth/role.py index e8c152aa..46c663e0 100644 --- a/brewman/routers/auth/role.py +++ b/brewman/routers/auth/role.py @@ -1,4 +1,3 @@ -import traceback import uuid from typing import List, Optional @@ -41,9 +40,7 @@ def save( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.put("/{id_}", response_model=schemas.Role) @@ -66,9 +63,7 @@ def update( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def add_permissions(role: Role, permissions: List[schemas.PermissionItem], db): @@ -97,9 +92,7 @@ def delete( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("") diff --git a/brewman/routers/auth/user.py b/brewman/routers/auth/user.py index 89d8f37b..9082a01c 100644 --- a/brewman/routers/auth/user.py +++ b/brewman/routers/auth/user.py @@ -1,4 +1,3 @@ -import traceback import uuid from typing import List, Optional @@ -41,9 +40,7 @@ def save( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("/me", response_model=schemas.User) @@ -75,9 +72,7 @@ def update_me( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.put("/{id_}", response_model=schemas.User) @@ -103,9 +98,7 @@ def update( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def add_roles(user: User, roles: List[schemas.RoleItem], db: Session): @@ -134,9 +127,7 @@ def delete( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("") diff --git a/brewman/routers/cost_centre.py b/brewman/routers/cost_centre.py index 27d5603d..5d4a32ab 100644 --- a/brewman/routers/cost_centre.py +++ b/brewman/routers/cost_centre.py @@ -1,4 +1,3 @@ -import traceback import uuid from typing import List, Optional @@ -42,9 +41,7 @@ def save( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.put("/{id_}", response_model=schemas.CostCentre) @@ -70,9 +67,8 @@ def update( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise + @router.delete("/{id_}") @@ -96,9 +92,7 @@ def delete( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("") diff --git a/brewman/routers/employee.py b/brewman/routers/employee.py index 2113593d..61aabaa4 100644 --- a/brewman/routers/employee.py +++ b/brewman/routers/employee.py @@ -1,4 +1,3 @@ -import traceback import uuid from sqlalchemy import desc @@ -51,9 +50,7 @@ def save( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.put("/{id_}", response_model=schemas.Employee) @@ -87,9 +84,7 @@ def update( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.delete("/{id_}") diff --git a/brewman/routers/employee_benefit.py b/brewman/routers/employee_benefit.py index 2057f310..b1aef138 100644 --- a/brewman/routers/employee_benefit.py +++ b/brewman/routers/employee_benefit.py @@ -1,4 +1,3 @@ -import traceback import uuid from math import ceil from typing import List @@ -75,9 +74,7 @@ def save_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def save(data: schema_in.EmployeeBenefitIn, date_: date, user: UserToken, db: Session) -> Voucher: @@ -163,9 +160,7 @@ def update_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def update(id_: uuid.UUID, data: schema_in.EmployeeBenefitIn, user: UserToken, db: Session) -> Voucher: @@ -222,9 +217,7 @@ def get_id( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("", response_model=output.Voucher) diff --git a/brewman/routers/incentive.py b/brewman/routers/incentive.py index 913dc8ff..7ac5e18d 100644 --- a/brewman/routers/incentive.py +++ b/brewman/routers/incentive.py @@ -1,4 +1,3 @@ -import traceback import uuid from decimal import Decimal from typing import List, Optional @@ -73,9 +72,7 @@ def save_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def save(data: schema_in.IncentiveIn, user: UserToken, db: Session) -> Voucher: @@ -138,9 +135,7 @@ def update_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def update(id_: uuid.UUID, data: schema_in.IncentiveIn, user: UserToken, db: Session) -> Voucher: @@ -185,9 +180,7 @@ def get_id( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("", response_model=output.Voucher) diff --git a/brewman/routers/issue.py b/brewman/routers/issue.py index 3ad075db..927edbe2 100644 --- a/brewman/routers/issue.py +++ b/brewman/routers/issue.py @@ -1,4 +1,3 @@ -import traceback import uuid from datetime import datetime from decimal import Decimal @@ -69,9 +68,7 @@ def save_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def save(data: schema_in.IssueIn, user: UserToken, db: Session) -> (Voucher, Optional[bool]): @@ -176,9 +173,7 @@ def update_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def update(id_: uuid.UUID, data: schema_in.IssueIn, user: UserToken, db: Session) -> (Voucher, Optional[bool]): @@ -306,9 +301,7 @@ def get_id( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("", response_model=output.Voucher) diff --git a/brewman/routers/journal.py b/brewman/routers/journal.py index 131e7505..f8fba246 100644 --- a/brewman/routers/journal.py +++ b/brewman/routers/journal.py @@ -1,4 +1,3 @@ -import traceback import uuid from typing import List from datetime import datetime @@ -65,6 +64,7 @@ def save_route( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e), ) except Exception: + db.rollback() raise @@ -111,9 +111,7 @@ def update_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def update(id_: uuid.UUID, data: schema_in.JournalIn, user: UserToken, db: Session) -> Voucher: @@ -174,9 +172,7 @@ def get_id( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("", response_model=output.Voucher) diff --git a/brewman/routers/product.py b/brewman/routers/product.py index 7d5cadbf..df9063ac 100644 --- a/brewman/routers/product.py +++ b/brewman/routers/product.py @@ -1,4 +1,3 @@ -import traceback import uuid from typing import Optional @@ -54,9 +53,7 @@ def save( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.put("/{id_}", response_model=schemas.Product) @@ -93,9 +90,7 @@ def update( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.delete("/{id_}") diff --git a/brewman/routers/product_group.py b/brewman/routers/product_group.py index 3a2f5b0e..1bb9af5e 100644 --- a/brewman/routers/product_group.py +++ b/brewman/routers/product_group.py @@ -1,4 +1,3 @@ -import traceback import uuid from typing import List, Optional @@ -42,9 +41,7 @@ def save( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.put("/{id_}", response_model=schemas.ProductGroup) @@ -70,9 +67,7 @@ def update( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.delete("/{id_}") @@ -96,9 +91,7 @@ def delete( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("") diff --git a/brewman/routers/purchase.py b/brewman/routers/purchase.py index 4bbb87dc..23aad4ca 100644 --- a/brewman/routers/purchase.py +++ b/brewman/routers/purchase.py @@ -1,4 +1,3 @@ -import traceback import uuid from decimal import Decimal from typing import List @@ -69,9 +68,7 @@ def save_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def save(data: schema_in.PurchaseIn, user: UserToken, db: Session) -> Voucher: @@ -158,9 +155,7 @@ def update_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def update(id_: uuid.UUID, data: schema_in.PurchaseIn, user: UserToken, db: Session) -> Voucher: @@ -301,9 +296,7 @@ def get_id( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("", response_model=output.Voucher) diff --git a/brewman/routers/purchase_return.py b/brewman/routers/purchase_return.py index fb9028c5..19dd3a45 100644 --- a/brewman/routers/purchase_return.py +++ b/brewman/routers/purchase_return.py @@ -1,4 +1,3 @@ -import traceback import uuid from decimal import Decimal from typing import List @@ -68,9 +67,7 @@ def save_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def save(data: schema_in.PurchaseIn, user: UserToken, db: Session) -> Voucher: @@ -154,9 +151,7 @@ def update_route( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def update(id_: uuid.UUID, data: schema_in.PurchaseIn, user: UserToken, db: Session) -> Voucher: @@ -248,9 +243,7 @@ def get_id( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise @router.get("", response_model=output.Voucher) diff --git a/brewman/routers/voucher.py b/brewman/routers/voucher.py index 4570c631..2f1c34bd 100644 --- a/brewman/routers/voucher.py +++ b/brewman/routers/voucher.py @@ -1,4 +1,3 @@ -import traceback import uuid from typing import Optional from datetime import datetime, date @@ -67,9 +66,7 @@ def post_voucher( ) except Exception: db.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(), - ) + raise def check_delete_permissions(voucher: Voucher, user: UserToken): diff --git a/overlord/package.json b/overlord/package.json index 0ab26798..e1c3eae3 100644 --- a/overlord/package.json +++ b/overlord/package.json @@ -1,6 +1,6 @@ { "name": "overlord", - "version": "0.0.0", + "version": "7.0.0", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/overlord/src/app/daybook/daybook.component.html b/overlord/src/app/daybook/daybook.component.html index c5ff9d2f..b2a7309f 100644 --- a/overlord/src/app/daybook/daybook.component.html +++ b/overlord/src/app/daybook/daybook.component.html @@ -66,8 +66,8 @@ - + - + diff --git a/overlord/src/app/ledger/ledger.component.ts b/overlord/src/app/ledger/ledger.component.ts index 7a81d3d9..1a30a33f 100644 --- a/overlord/src/app/ledger/ledger.component.ts +++ b/overlord/src/app/ledger/ledger.component.ts @@ -104,16 +104,6 @@ export class LedgerComponent implements OnInit, AfterViewInit { this.selectedRowId = id; } - getRowClass(id: string, posted: boolean): string { - if (this.selectedRowId === id) { - return 'selected'; - } else if (!posted) { - return 'unposted'; - } else { - return ''; - } - } - show() { const info = this.getInfo(); this.router.navigate(['ledger', info.account.id], { diff --git a/overlord/src/app/payment/payment.component.ts b/overlord/src/app/payment/payment.component.ts index d5bd228f..45e795ad 100644 --- a/overlord/src/app/payment/payment.component.ts +++ b/overlord/src/app/payment/payment.component.ts @@ -141,7 +141,8 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy { rowAmount(amount: string = ''): number { try { - return math.eval(amount.trim().replace(',', '')); + amount = amount.replace(new RegExp('(₹[\s]*)|(,)|(\s)', 'g'), ''); + return math.eval(amount); } catch { return 0; } diff --git a/overlord/src/app/receipt/receipt.component.ts b/overlord/src/app/receipt/receipt.component.ts index 481b1a3e..68223e21 100644 --- a/overlord/src/app/receipt/receipt.component.ts +++ b/overlord/src/app/receipt/receipt.component.ts @@ -140,7 +140,8 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy { rowAmount(amount: string = ''): number { try { - return math.eval(amount.trim().replace(',', '')); + amount = amount.replace(new RegExp('(₹[\s]*)|(,)|(\s)', 'g'), ''); + return math.eval(amount); } catch { return 0; } diff --git a/overlord/src/app/shared/accounting.pipe.ts b/overlord/src/app/shared/accounting.pipe.ts index 33136c47..88758f36 100644 --- a/overlord/src/app/shared/accounting.pipe.ts +++ b/overlord/src/app/shared/accounting.pipe.ts @@ -13,7 +13,7 @@ export class AccountingPipe implements PipeTransform { if (value === null) { return ''; } - const amount = +(value.replace(new RegExp('(₹ )|(,)', 'g'), '')); + const amount = +(value.replace(new RegExp('(₹[\s]*)|(,)', 'g'), '')); return value.replace('-', '') + ((amount < 0) ? '\u00A0Cr' : '\u00A0Dr'); } diff --git a/setup.py b/setup.py index c9409248..645c3a40 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open(os.path.join(here, 'requirements.txt'), "r") as r: requires = r.read().splitlines() setup(name='brewman', - version='6.0', + version='7.0', description='brewman', long_description=README + '\n\n' + CHANGES, classifiers=[