Done upto reconcile
Pending: stock movement trial balance unposted
This commit is contained in:
parent
85d05392b8
commit
2b2430c5b2
brewman
main.py
routers/reports
overlord/src/app
cash-flow
daybook
net-transactions
purchase-entries
purchases
@ -18,7 +18,20 @@ from .routers import (
|
||||
login,
|
||||
)
|
||||
from .routers.auth import client, user, role
|
||||
from .routers.reports import ledger, balance_sheet, profit_loss, closing_stock
|
||||
from .routers.reports import (
|
||||
ledger,
|
||||
balance_sheet,
|
||||
profit_loss,
|
||||
closing_stock,
|
||||
cash_flow,
|
||||
daybook,
|
||||
net_transactions,
|
||||
product_ledger,
|
||||
purchase_entries,
|
||||
purchases,
|
||||
raw_material_cost,
|
||||
reconcile,
|
||||
)
|
||||
from .db.base_class import Base
|
||||
from .config import Settings as settings
|
||||
from .db.session import engine
|
||||
@ -60,10 +73,19 @@ app.include_router(recipe.router, prefix="/api/recipes", tags=["products"])
|
||||
app.include_router(client.router, prefix="/api/clients", tags=["clients"])
|
||||
app.include_router(role.router, prefix="/api/roles", tags=["users"])
|
||||
app.include_router(user.router, prefix="/api/users", tags=["users"])
|
||||
|
||||
app.include_router(ledger.router, prefix="/api/ledger", tags=["reports"])
|
||||
app.include_router(balance_sheet.router, prefix="/api/balance-sheet", tags=["reports"])
|
||||
app.include_router(profit_loss.router, prefix="/api/profit-loss", tags=["reports"])
|
||||
app.include_router(closing_stock.router, prefix="/api/closing-stock", tags=["reports"])
|
||||
app.include_router(cash_flow.router, prefix="/api/cash-flow", tags=["reports"])
|
||||
app.include_router(daybook.router, prefix="/api/daybook", tags=["reports"])
|
||||
app.include_router(net_transactions.router, prefix="/api/net-transactions", tags=["reports"])
|
||||
app.include_router(product_ledger.router, prefix="/api/product-ledger", tags=["reports"])
|
||||
app.include_router(purchase_entries.router, prefix="/api/purchase-entries", tags=["reports"])
|
||||
app.include_router(purchases.router, prefix="/api/purchases", tags=["reports"])
|
||||
app.include_router(raw_material_cost.router, prefix="/api/raw-material-cost", tags=["reports"])
|
||||
app.include_router(reconcile.router, prefix="/api/reconcile", tags=["reports"])
|
||||
|
||||
|
||||
def init():
|
||||
|
@ -1,8 +1,13 @@
|
||||
import datetime
|
||||
|
||||
from fastapi import APIRouter, Depends, Security, Request
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.orm.util import aliased
|
||||
from sqlalchemy.sql.expression import func, desc
|
||||
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
from brewman.models.master import AccountBase, AccountType
|
||||
from brewman.models.voucher import Voucher, Journal, VoucherType
|
||||
from brewman.routers.services.session import (
|
||||
@ -11,57 +16,75 @@ from brewman.routers.services.session import (
|
||||
session_period_finish,
|
||||
)
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/cash-flow") # "Cash Flow"
|
||||
def report_blank(request):
|
||||
# Dependency
|
||||
def get_db() -> Session:
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("")
|
||||
def report_blank(
|
||||
request: Request,
|
||||
user: UserToken = Security(get_user, scopes=["cash-flow"]),
|
||||
):
|
||||
return {
|
||||
"startDate": session_period_start(request),
|
||||
"finishDate": session_period_finish(request),
|
||||
"startDate": session_period_start(request.session),
|
||||
"finishDate": session_period_finish(request.session),
|
||||
"body": [],
|
||||
"footer": {},
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/cash-flow", request_param=["s", "f"], permission="Cash Flow")
|
||||
def report_data(request):
|
||||
start_date = request.GET["s"]
|
||||
finish_date = request.GET["f"]
|
||||
body, footer = build_report(start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
@router.get("/data")
|
||||
def report_data(
|
||||
request: Request,
|
||||
s: str = None,
|
||||
f: str = None,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["cash-flow"]),
|
||||
):
|
||||
body, footer = build_report(s, f, db)
|
||||
session_period_set(s, f, request.session)
|
||||
return {
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
"startDate": s,
|
||||
"finishDate": f,
|
||||
"body": body,
|
||||
"footer": footer,
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/cash-flow/{id}", request_param=["s", "f"], permission="Cash Flow")
|
||||
def get_cash_flow_id(request):
|
||||
id_ = request.matchdict["id"]
|
||||
start_date = request.GET["s"]
|
||||
finish_date = request.GET["f"]
|
||||
details, footer = build_report_id(int(id_), start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
@router.get("/{id_}")
|
||||
def report_id(
|
||||
id_: int,
|
||||
request: Request,
|
||||
s: str = None,
|
||||
f: str = None,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["cash-flow"]),
|
||||
):
|
||||
details, footer = build_report_id(id_, s, f, db)
|
||||
session_period_set(s, f, request.session)
|
||||
return {
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
"startDate": s,
|
||||
"finishDate": f,
|
||||
"body": {"details": details},
|
||||
"footer": footer,
|
||||
}
|
||||
|
||||
|
||||
def build_report(start_date, finish_date, request):
|
||||
def build_report(start_date, finish_date, db):
|
||||
sub_voucher = aliased(Voucher)
|
||||
sub_journal = aliased(Journal)
|
||||
sub_account = aliased(AccountBase)
|
||||
|
||||
sub_query = (
|
||||
request.dbsession.query(sub_voucher.id)
|
||||
db.query(sub_voucher.id)
|
||||
.join(sub_journal, sub_voucher.journals)
|
||||
.join(sub_account, sub_journal.account)
|
||||
.filter(sub_account.type == AccountType.by_name("Cash").id)
|
||||
@ -71,7 +94,7 @@ def build_report(start_date, finish_date, request):
|
||||
)
|
||||
|
||||
query = (
|
||||
request.dbsession.query(AccountBase.type, func.sum(Journal.signed_amount))
|
||||
db.query(AccountBase.type, func.sum(Journal.signed_amount))
|
||||
.join(Journal, Voucher.journals)
|
||||
.join(AccountBase, Journal.account)
|
||||
.filter(Voucher.id.in_(sub_query))
|
||||
@ -89,17 +112,13 @@ def build_report(start_date, finish_date, request):
|
||||
cf[lt.cash_flow_classification.lower()].append(
|
||||
{
|
||||
"name": lt.name,
|
||||
"url": request.route_url(
|
||||
"cash_flow_id",
|
||||
id=str(lt.id),
|
||||
_query={"startDate": start_date, "finishDate": finish_date},
|
||||
),
|
||||
"url": "", # request.route_url("cash_flow_id", id=str(lt.id), _query={"startDate": start_date, "finishDate": finish_date},),
|
||||
"amount": amount * -1,
|
||||
}
|
||||
)
|
||||
|
||||
opening = (
|
||||
request.dbsession.query(func.sum(Journal.amount * Journal.debit))
|
||||
db.query(func.sum(Journal.amount * Journal.debit))
|
||||
.join(Journal.voucher)
|
||||
.join(Journal.account)
|
||||
.filter(Voucher.date < start_date)
|
||||
@ -109,7 +128,7 @@ def build_report(start_date, finish_date, request):
|
||||
)
|
||||
|
||||
closing = (
|
||||
request.dbsession.query(func.sum(Journal.amount * Journal.debit))
|
||||
db.query(func.sum(Journal.amount * Journal.debit))
|
||||
.join(Journal.voucher)
|
||||
.join(Journal.account)
|
||||
.filter(Voucher.date <= finish_date)
|
||||
@ -134,14 +153,14 @@ def build_report(start_date, finish_date, request):
|
||||
)
|
||||
|
||||
|
||||
def build_report_id(account_type, start_date, finish_date, request):
|
||||
def build_report_id(account_type, start_date, finish_date, db):
|
||||
details = []
|
||||
sub_voucher = aliased(Voucher)
|
||||
sub_journal = aliased(Journal)
|
||||
sub_account = aliased(AccountBase)
|
||||
|
||||
sub_query = (
|
||||
request.dbsession.query(sub_voucher.id)
|
||||
db.query(sub_voucher.id)
|
||||
.join(sub_journal, sub_voucher.journals)
|
||||
.join(sub_account, sub_journal.account)
|
||||
.filter(sub_account.type == AccountType.by_name("Cash").id)
|
||||
@ -151,7 +170,7 @@ def build_report_id(account_type, start_date, finish_date, request):
|
||||
)
|
||||
|
||||
query = (
|
||||
request.dbsession.query(AccountBase, func.sum(Journal.signed_amount))
|
||||
db.query(AccountBase, func.sum(Journal.signed_amount))
|
||||
.join(Journal, Voucher.journals)
|
||||
.join(AccountBase, Journal.account)
|
||||
.filter(Voucher.id.in_(sub_query))
|
||||
@ -167,11 +186,7 @@ def build_report_id(account_type, start_date, finish_date, request):
|
||||
details.append(
|
||||
{
|
||||
"name": account.name,
|
||||
"url": request.route_url(
|
||||
"ledger_id",
|
||||
id=account.id,
|
||||
_query={"startDate": start_date, "finishDate": finish_date},
|
||||
),
|
||||
"url": "", # request.route_url("ledger_id", id=account.id, _query={"startDate": start_date, "finishDate": finish_date},),
|
||||
"amount": amount * -1,
|
||||
}
|
||||
)
|
||||
|
@ -1,43 +1,60 @@
|
||||
import datetime
|
||||
|
||||
from sqlalchemy.orm import joinedload_all
|
||||
from fastapi import APIRouter, Depends, Security, Request
|
||||
from sqlalchemy.orm import joinedload_all, Session
|
||||
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
from brewman.models.voucher import Voucher, Journal, VoucherType
|
||||
from brewman.routers.services.session import (
|
||||
session_period_set,
|
||||
session_period_start,
|
||||
session_period_finish,
|
||||
)
|
||||
from brewman.routers.services.voucher import get_edit_url
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/daybook") # "Daybook"
|
||||
def report_blank(request):
|
||||
# Dependency
|
||||
def get_db() -> Session:
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("")
|
||||
def report_blank(
|
||||
request: Request,
|
||||
user: UserToken = Security(get_user, scopes=["daybook"]),
|
||||
):
|
||||
return {
|
||||
"startDate": session_period_start(request),
|
||||
"finishDate": session_period_finish(request),
|
||||
"startDate": session_period_start(request.session),
|
||||
"finishDate": session_period_finish(request.session),
|
||||
"body": [],
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/daybook", request_param=["s", "f"], permission="Daybook")
|
||||
def report_data(request):
|
||||
start_date = request.GET["s"]
|
||||
finish_date = request.GET["f"]
|
||||
body = build_report(start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
return {"startDate": start_date, "finishDate": finish_date, "body": body}
|
||||
@router.get("/{start}/{finish}")
|
||||
def report_data(
|
||||
start: str,
|
||||
finish: str,
|
||||
request: Request,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["daybook"]),
|
||||
):
|
||||
body = build_report(start, finish, db)
|
||||
session_period_set(start, finish, request.session)
|
||||
return {"startDate": start, "finishDate": finish, "body": body}
|
||||
|
||||
|
||||
def build_report(start_date, finish_date, request):
|
||||
def build_report(start_date, finish_date, db):
|
||||
body = []
|
||||
|
||||
query = (
|
||||
request.dbsession.query(Voucher)
|
||||
db.query(Voucher)
|
||||
.options(joinedload_all(Voucher.journals, Journal.account, innerjoin=True))
|
||||
.filter(Voucher.date >= datetime.datetime.strptime(start_date, "%d-%b-%Y"))
|
||||
.filter(Voucher.date <= datetime.datetime.strptime(finish_date, "%d-%b-%Y"))
|
||||
@ -66,7 +83,7 @@ def build_report(start_date, finish_date, request):
|
||||
{
|
||||
"id": voucher.id,
|
||||
"date": voucher.date.strftime("%d-%b-%Y"),
|
||||
"url": get_edit_url(voucher, request),
|
||||
"url": "", # get_edit_url(voucher, request),
|
||||
"type": VoucherType.by_id(voucher.type).name,
|
||||
"narration": voucher.narration,
|
||||
"posted": voucher.posted,
|
||||
|
@ -51,7 +51,6 @@ def show_data(
|
||||
user: UserToken = Security(get_user, scopes=["ledger"]),
|
||||
):
|
||||
account = db.query(AccountBase).filter(AccountBase.id == id_).first()
|
||||
|
||||
start_date = s if s is not None else session_period_start(request.session)
|
||||
finish_date = f if f is not None else session_period_finish(request.session)
|
||||
body = build_report(account.id, start_date, finish_date, db)
|
||||
|
@ -1,8 +1,13 @@
|
||||
import datetime
|
||||
|
||||
from fastapi import APIRouter, Depends, Security, Request
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.sql.expression import func, desc
|
||||
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
from brewman.models.master import AccountBase
|
||||
|
||||
from brewman.models.voucher import Voucher, Journal, VoucherType
|
||||
from brewman.routers.services.session import (
|
||||
session_period_set,
|
||||
@ -10,33 +15,47 @@ from brewman.routers.services.session import (
|
||||
session_period_finish,
|
||||
)
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/net-transactions") # "Net Transactions"
|
||||
def show_blank(request):
|
||||
# Dependency
|
||||
def get_db() -> Session:
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("")
|
||||
def show_blank(
|
||||
request: Request,
|
||||
user: UserToken = Security(get_user, scopes=["net-transactions"]),
|
||||
):
|
||||
return {
|
||||
"startDate": session_period_start(request),
|
||||
"finishDate": session_period_finish(request),
|
||||
"startDate": session_period_start(request.session),
|
||||
"finishDate": session_period_finish(request.session),
|
||||
"body": [],
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/net-transactions", request_param=["s", "f"], permission="Net Transactions")
|
||||
def show_data(request):
|
||||
start_date = request.GET["s"]
|
||||
finish_date = request.GET["f"]
|
||||
session_period_set(start_date, finish_date, request)
|
||||
@router.get("/{start}/{finish}")
|
||||
def show_data(
|
||||
start: str,
|
||||
finish: str,
|
||||
request: Request,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["net-transactions"]),
|
||||
):
|
||||
session_period_set(start, finish, request.session)
|
||||
return {
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
"body": build_report(start_date, finish_date, request.dbsession),
|
||||
"startDate": start,
|
||||
"finishDate": finish,
|
||||
"body": build_report(start, finish, db),
|
||||
}
|
||||
|
||||
|
||||
def build_report(start_date, finish_date, dbsession):
|
||||
def build_report(start_date, finish_date, db):
|
||||
if not isinstance(start_date, datetime.datetime):
|
||||
start_date = datetime.datetime.strptime(start_date, "%d-%b-%Y")
|
||||
if not isinstance(finish_date, datetime.datetime):
|
||||
@ -44,7 +63,7 @@ def build_report(start_date, finish_date, dbsession):
|
||||
|
||||
amount_sum = func.sum(Journal.amount * Journal.debit).label("amount")
|
||||
query = (
|
||||
dbsession.query(AccountBase, amount_sum)
|
||||
db.query(AccountBase, amount_sum)
|
||||
.join(Journal.voucher)
|
||||
.join(Journal.account)
|
||||
.filter(Voucher.date >= start_date)
|
||||
|
@ -1,43 +1,60 @@
|
||||
import datetime
|
||||
import uuid
|
||||
|
||||
from sqlalchemy.orm import joinedload
|
||||
from fastapi import APIRouter, Depends, Security, Request
|
||||
from sqlalchemy.orm import joinedload, Session
|
||||
from sqlalchemy.sql.expression import func
|
||||
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
from brewman.models.master import Product, CostCentre
|
||||
from brewman.models.validation_exception import ValidationError
|
||||
from brewman.models.voucher import Voucher, Journal, VoucherType, Inventory
|
||||
from brewman.routers import to_uuid
|
||||
from brewman.routers.services.session import (
|
||||
session_period_set,
|
||||
session_period_start,
|
||||
session_period_finish,
|
||||
)
|
||||
from brewman.routers.services.voucher import get_edit_url
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/product-ledger") # "Product Ledger"
|
||||
def show_blank(request):
|
||||
# Dependency
|
||||
def get_db() -> Session:
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("")
|
||||
def show_blank(
|
||||
request: Request,
|
||||
user: UserToken = Security(get_user, scopes=["product-ledger"]),
|
||||
):
|
||||
return {
|
||||
"startDate": session_period_start(request),
|
||||
"finishDate": session_period_finish(request),
|
||||
"startDate": session_period_start(request.session),
|
||||
"finishDate": session_period_finish(request.session),
|
||||
"product": None,
|
||||
"body": [],
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/product-ledger/{id}") # "Product Ledger"
|
||||
def show_data(request):
|
||||
id_ = to_uuid(request.matchdict["id"])
|
||||
if id_ is None:
|
||||
raise ValidationError("Invalid Product")
|
||||
product = request.dbsession.query(Product).filter(Product.id == id_).first()
|
||||
start_date = request.GET.get("s", session_period_start(request))
|
||||
finish_date = request.GET.get("f", session_period_finish(request))
|
||||
body = build_report(product.id, start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
@router.get("/{id}")
|
||||
def show_data(
|
||||
id_: uuid.UUID,
|
||||
request: Request,
|
||||
s: str = None,
|
||||
f: str = None,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["product-ledger"]),
|
||||
):
|
||||
product = db.query(Product).filter(Product.id == id_).first()
|
||||
start_date = s if s is not None else session_period_start(request.session)
|
||||
finish_date = f if f is not None else session_period_finish(request.session)
|
||||
body = build_report(product.id, start_date, finish_date, db)
|
||||
session_period_set(start_date, finish_date, request.session)
|
||||
return {
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
@ -46,15 +63,15 @@ def show_data(request):
|
||||
}
|
||||
|
||||
|
||||
def build_report(product_id, start_date, finish_date, request):
|
||||
def build_report(product_id, start_date, finish_date, db):
|
||||
body = []
|
||||
running_total_q, running_total_a, opening = opening_balance(
|
||||
product_id, start_date, request.dbsession
|
||||
product_id, start_date, db
|
||||
)
|
||||
body.append(opening)
|
||||
|
||||
query = (
|
||||
request.dbsession.query(Voucher, Inventory, Journal)
|
||||
db.query(Voucher, Inventory, Journal)
|
||||
.options(
|
||||
joinedload(Journal.account, innerjoin=True),
|
||||
joinedload(Journal.cost_centre, innerjoin=True),
|
||||
@ -90,7 +107,7 @@ def build_report(product_id, start_date, finish_date, request):
|
||||
"id": row.Voucher.id,
|
||||
"date": row.Voucher.date.strftime("%d-%b-%Y"),
|
||||
"name": name,
|
||||
"url": get_edit_url(row.Voucher, request),
|
||||
"url": "", # get_edit_url(row.Voucher, request),
|
||||
"type": VoucherType.by_id(row.Voucher.type).name,
|
||||
"narration": row.Voucher.narration,
|
||||
"posted": row.Voucher.posted
|
||||
@ -107,9 +124,9 @@ def build_report(product_id, start_date, finish_date, request):
|
||||
return body
|
||||
|
||||
|
||||
def opening_balance(product_id, start_date, dbsession):
|
||||
def opening_balance(product_id, start_date, db):
|
||||
quantity, amount = (
|
||||
dbsession.query(
|
||||
db.query(
|
||||
func.sum(Inventory.quantity * Journal.debit),
|
||||
func.sum(Inventory.amount * Journal.debit),
|
||||
)
|
||||
|
@ -7,7 +7,6 @@ from sqlalchemy.sql.expression import func, desc
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
|
||||
from brewman.models.master import AccountType, AccountBase
|
||||
from brewman.models.voucher import Voucher, Journal, VoucherType
|
||||
from brewman.routers.reports.closing_stock import get_opening_stock, get_closing_stock
|
||||
|
@ -1,42 +1,61 @@
|
||||
import datetime
|
||||
|
||||
from fastapi import APIRouter, Depends, Security, Request
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
from brewman.models.voucher import Voucher, VoucherType
|
||||
from brewman.routers.services.session import (
|
||||
session_period_set,
|
||||
session_period_start,
|
||||
session_period_finish,
|
||||
)
|
||||
from brewman.routers.services.voucher import get_edit_url
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/purchase-entries") # "Purchase Entries"
|
||||
def report_blank(request):
|
||||
# Dependency
|
||||
def get_db() -> Session:
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("")
|
||||
def report_blank(
|
||||
request: Request,
|
||||
user: UserToken = Security(get_user, scopes=["purchase-entries"]),
|
||||
):
|
||||
return {
|
||||
"startDate": session_period_start(request),
|
||||
"finishDate": session_period_finish(request),
|
||||
"startDate": session_period_start(request.session),
|
||||
"finishDate": session_period_finish(request.session),
|
||||
"body": [],
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/purchase-entries", request_param=["s", "f"], permission="Purchase Entries")
|
||||
def report_data(request):
|
||||
start_date = request.GET["s"]
|
||||
finish_date = request.GET["f"]
|
||||
body = build_report(start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
return {"startDate": start_date, "finishDate": finish_date, "body": body}
|
||||
@router.get("/{start}/{finish}")
|
||||
def report_data(
|
||||
start: str,
|
||||
finish: str,
|
||||
request: Request,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["net-transactions"]),
|
||||
):
|
||||
body = build_report(start, finish, db)
|
||||
session_period_set(start, finish, request.session)
|
||||
return {"startDate": start, "finishDate": finish, "body": body}
|
||||
|
||||
|
||||
def build_report(start_date, finish_date, request):
|
||||
def build_report(start_date, finish_date, db):
|
||||
start_date = datetime.datetime.strptime(start_date, "%d-%b-%Y")
|
||||
finish_date = datetime.datetime.strptime(finish_date, "%d-%b-%Y")
|
||||
body = []
|
||||
query = (
|
||||
request.dbsession.query(Voucher)
|
||||
db.query(Voucher)
|
||||
.filter(Voucher.date >= start_date)
|
||||
.filter(Voucher.date <= finish_date)
|
||||
.filter(Voucher.type == VoucherType.by_name("Purchase").id)
|
||||
@ -51,7 +70,7 @@ def build_report(start_date, finish_date, request):
|
||||
row = {
|
||||
"date": voucher.date.strftime("%d-%b-%Y"),
|
||||
"supplier": journal.account.name,
|
||||
"url": get_edit_url(voucher, request),
|
||||
"url": "", # get_edit_url(voucher, request),
|
||||
"products": [],
|
||||
"product": item.product.full_name,
|
||||
"quantity": item.quantity,
|
||||
|
@ -1,7 +1,13 @@
|
||||
import datetime
|
||||
|
||||
from fastapi import APIRouter, Depends, Security, Request
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.sql.expression import func, desc
|
||||
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
|
||||
from brewman.models.master import CostCentre, Product
|
||||
from brewman.models.voucher import Voucher, Journal, Inventory, VoucherType
|
||||
from brewman.routers.services.session import (
|
||||
@ -10,43 +16,57 @@ from brewman.routers.services.session import (
|
||||
session_period_finish,
|
||||
)
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/purchases") # "Purchases"
|
||||
def report_blank(request):
|
||||
# Dependency
|
||||
def get_db() -> Session:
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("/api/purchases")
|
||||
def report_blank(
|
||||
request: Request,
|
||||
user: UserToken = Security(get_user, scopes=["purchases"]),
|
||||
):
|
||||
return {
|
||||
"startDate": session_period_start(request),
|
||||
"finishDate": session_period_finish(request),
|
||||
"startDate": session_period_start(request.session),
|
||||
"finishDate": session_period_finish(request.session),
|
||||
"body": [],
|
||||
"footer": {},
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/purchases", request_param=["s", "f"], permission="Purchases")
|
||||
def report_data(request):
|
||||
start_date = request.GET["s"]
|
||||
finish_date = request.GET["f"]
|
||||
body, footer = build_report(start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
@router.get("/{start}/{finish}")
|
||||
def report_data(
|
||||
start: str,
|
||||
finish: str,
|
||||
request: Request,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["purchases"]),
|
||||
):
|
||||
body, footer = build_report(start, finish, db)
|
||||
session_period_set(start, finish, request.session)
|
||||
return {
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
"startDate": start,
|
||||
"finishDate": finish,
|
||||
"body": body,
|
||||
"footer": footer,
|
||||
}
|
||||
|
||||
|
||||
def build_report(start_date, finish_date, request):
|
||||
def build_report(start_date, finish_date, db):
|
||||
body = []
|
||||
quantity_sum = func.sum(Journal.debit * Inventory.quantity).label("quantity")
|
||||
amount_sum = func.sum(
|
||||
Journal.debit * Inventory.quantity * Inventory.rate * (1 + Inventory.tax)
|
||||
).label("amount")
|
||||
query = (
|
||||
request.dbsession.query(Product, quantity_sum, amount_sum)
|
||||
db.query(Product, quantity_sum, amount_sum)
|
||||
.join(Product.inventories)
|
||||
.join(Inventory.voucher)
|
||||
.join(Voucher.journals)
|
||||
@ -68,11 +88,7 @@ def build_report(start_date, finish_date, request):
|
||||
"quantity": quantity,
|
||||
"rate": rate,
|
||||
"amount": amount,
|
||||
"url": request.route_url(
|
||||
"product_ledger_id",
|
||||
id=product.id,
|
||||
_query={"startDate": start_date, "finishDate": finish_date},
|
||||
),
|
||||
"url": "", # request.route_url("product_ledger_id", id=product.id, _query={"startDate": start_date, "finishDate": finish_date},),
|
||||
}
|
||||
body.append(row)
|
||||
return body, {"name": "Total", "amount": total_amount}
|
||||
|
@ -1,8 +1,13 @@
|
||||
import datetime
|
||||
import uuid
|
||||
|
||||
from fastapi import APIRouter, Depends, Security, Request
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.sql.expression import func, case
|
||||
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
from brewman.models.master import AccountBase, CostCentre, Product, ProductGroup
|
||||
from brewman.models.voucher import Voucher, Journal, Inventory
|
||||
from brewman.routers.services.session import (
|
||||
@ -11,51 +16,69 @@ from brewman.routers.services.session import (
|
||||
session_period_finish,
|
||||
)
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/raw-material-cost") # "Raw Material Cost"
|
||||
def report_blank(request):
|
||||
# Dependency
|
||||
def get_db() -> Session:
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("")
|
||||
def report_blank(
|
||||
request: Request,
|
||||
user: UserToken = Security(get_user, scopes=["raw-material-cost"]),
|
||||
):
|
||||
return {
|
||||
"startDate": session_period_start(request),
|
||||
"finishDate": session_period_finish(request),
|
||||
"startDate": session_period_start(request.session),
|
||||
"finishDate": session_period_finish(request.session),
|
||||
"body": [],
|
||||
"footer": {},
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/raw-material-cost", request_param=["s", "f"], permission="Raw Material Cost")
|
||||
def report_data(request):
|
||||
start_date = request.GET["s"]
|
||||
finish_date = request.GET["f"]
|
||||
body, footer = build_report(start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
@router.get("/data")
|
||||
def report_data(
|
||||
request: Request,
|
||||
s: str = None,
|
||||
f: str = None,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["raw-material-cost"]),
|
||||
):
|
||||
body, footer = build_report(s, f, db)
|
||||
session_period_set(s, f, request.session)
|
||||
return {
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
"startDate": s,
|
||||
"finishDate": f,
|
||||
"body": body,
|
||||
"footer": footer,
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/raw-material-cost/{id}", request_param=["s", "f"], permission="Raw Material Cost")
|
||||
def report_id(request):
|
||||
id_ = request.matchdict["id"]
|
||||
start_date = request.GET["s"]
|
||||
finish_date = request.GET["f"]
|
||||
body = build_report_id(uuid.UUID(id_), start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
@router.get("/{id_}")
|
||||
def report_id(
|
||||
id_: uuid.UUID,
|
||||
request: Request,
|
||||
s: str = None,
|
||||
f: str = None,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["raw-material-cost"]),
|
||||
):
|
||||
body = build_report_id(id_, s, f, db)
|
||||
session_period_set(s, f, request.session)
|
||||
return {
|
||||
"id": id_,
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
"startDate": s,
|
||||
"finishDate": f,
|
||||
"body": body,
|
||||
}
|
||||
|
||||
|
||||
def build_report(start_date, finish_date, request):
|
||||
def build_report(start_date, finish_date, db):
|
||||
body = []
|
||||
sum_issue = func.sum(
|
||||
case([(AccountBase.type == 2, Journal.signed_amount)], else_=0)
|
||||
@ -65,7 +88,7 @@ def build_report(start_date, finish_date, request):
|
||||
).label("sale")
|
||||
|
||||
query = (
|
||||
request.dbsession.query(CostCentre, sum_issue, sum_sale)
|
||||
db.query(CostCentre, sum_issue, sum_sale)
|
||||
.join(CostCentre.journals)
|
||||
.join(Journal.voucher)
|
||||
.join(Journal.account)
|
||||
@ -90,11 +113,7 @@ def build_report(start_date, finish_date, request):
|
||||
"issue": issue,
|
||||
"sale": sale,
|
||||
"rmc": rmc,
|
||||
"url": request.route_url(
|
||||
"raw_material_cost_id",
|
||||
id=str(cost_centre.id),
|
||||
_query={"startDate": start_date, "finishDate": finish_date},
|
||||
),
|
||||
"url": "", # request.route_url("raw_material_cost_id",id=str(cost_centre.id),_query={"startDate": start_date, "finishDate": finish_date},),
|
||||
}
|
||||
)
|
||||
|
||||
@ -102,13 +121,13 @@ def build_report(start_date, finish_date, request):
|
||||
return body, {"name": "Total", "issue": issues, "sale": sales, "rmc": rmc}
|
||||
|
||||
|
||||
def build_report_id(cost_centre_id, start_date, finish_date, request):
|
||||
def build_report_id(cost_centre_id, start_date, finish_date, db):
|
||||
sum_quantity = func.sum(Inventory.quantity * Journal.debit).label("quantity")
|
||||
sum_net = func.sum(Inventory.rate * Inventory.quantity * Journal.debit).label("net")
|
||||
sum_gross = func.sum(Inventory.amount * Journal.debit).label("gross")
|
||||
|
||||
query = (
|
||||
request.dbsession.query(Product, sum_quantity, sum_net, sum_gross)
|
||||
db.query(Product, sum_quantity, sum_net, sum_gross)
|
||||
.join(Product.inventories)
|
||||
.join(Inventory.voucher)
|
||||
.join(Voucher.journals)
|
||||
|
@ -1,8 +1,14 @@
|
||||
import datetime
|
||||
import uuid
|
||||
from sqlalchemy.orm import joinedload_all
|
||||
|
||||
|
||||
from fastapi import APIRouter, Depends, Security, Request
|
||||
from sqlalchemy.orm import joinedload_all, Session
|
||||
from sqlalchemy.sql.expression import func, or_, and_
|
||||
|
||||
from ...schemas.auth import UserToken
|
||||
from ...core.security import get_current_active_user as get_user
|
||||
from ...db.session import SessionLocal
|
||||
from brewman.models.master import AccountBase
|
||||
from brewman.models.voucher import Voucher, Journal, VoucherType
|
||||
from brewman.routers.services.session import (
|
||||
@ -10,34 +16,46 @@ from brewman.routers.services.session import (
|
||||
session_period_start,
|
||||
session_period_finish,
|
||||
)
|
||||
from brewman.routers.services.voucher import get_edit_url
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/reconcile") # "Reconcile"
|
||||
def show_blank(request):
|
||||
# Dependency
|
||||
def get_db() -> Session:
|
||||
try:
|
||||
db = SessionLocal()
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("")
|
||||
def show_blank(
|
||||
request: Request,
|
||||
user: UserToken = Security(get_user, scopes=["reconcile"]),
|
||||
):
|
||||
return {
|
||||
"startDate": session_period_start(request),
|
||||
"finishDate": session_period_finish(request),
|
||||
"startDate": session_period_start(request.session),
|
||||
"finishDate": session_period_finish(request.session),
|
||||
"account": None,
|
||||
"body": [],
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/reconcile/{id}") # "Reconcile"
|
||||
def show_data(request):
|
||||
account = (
|
||||
request.dbsession.query(AccountBase)
|
||||
.filter(AccountBase.id == uuid.UUID(request.matchdict["id"]))
|
||||
.first()
|
||||
)
|
||||
start_date = request.GET.get("s", session_period_start(request))
|
||||
finish_date = request.GET.get("f", session_period_finish(request))
|
||||
body = build_report(account.id, start_date, finish_date, request)
|
||||
session_period_set(start_date, finish_date, request)
|
||||
@router.get("/{id_}")
|
||||
def show_data(
|
||||
id_: uuid.UUID,
|
||||
request: Request,
|
||||
s: str = None,
|
||||
f: str = None,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["reconcile"]),
|
||||
):
|
||||
account = db.query(AccountBase).filter(AccountBase.id == id_).first()
|
||||
start_date = s if s is not None else session_period_start(request.session)
|
||||
finish_date = f if f is not None else session_period_finish(request.session)
|
||||
body = build_report(account.id, start_date, finish_date, db)
|
||||
session_period_set(start_date, finish_date, request.session)
|
||||
return {
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
@ -46,12 +64,12 @@ def show_data(request):
|
||||
}
|
||||
|
||||
|
||||
def build_report(account_id, start_date, finish_date, request):
|
||||
opening = opening_balance(account_id, start_date, request.dbsession)
|
||||
def build_report(account_id, start_date, finish_date, db):
|
||||
opening = opening_balance(account_id, start_date, db)
|
||||
body = [opening]
|
||||
|
||||
query = (
|
||||
request.dbsession.query(Voucher)
|
||||
db.query(Voucher)
|
||||
.options(joinedload_all(Voucher.journals, Journal.account, innerjoin=True))
|
||||
.filter(Voucher.journals.any(Journal.account_id == account_id))
|
||||
.filter(
|
||||
@ -95,7 +113,7 @@ def build_report(account_id, start_date, finish_date, request):
|
||||
"id": voucher.id,
|
||||
"date": voucher.date.strftime("%d-%b-%Y"),
|
||||
"name": name,
|
||||
"url": get_edit_url(voucher, request),
|
||||
"url": "", # get_edit_url(voucher, request),
|
||||
"type": VoucherType.by_id(voucher.type).name,
|
||||
"narration": voucher.narration,
|
||||
"debit": debit,
|
||||
@ -107,9 +125,9 @@ def build_report(account_id, start_date, finish_date, request):
|
||||
return body
|
||||
|
||||
|
||||
def opening_balance(account_id, start_date, dbsession):
|
||||
def opening_balance(account_id, start_date, db):
|
||||
opening = (
|
||||
dbsession.query(func.sum(Journal.amount * Journal.debit))
|
||||
db.query(func.sum(Journal.amount * Journal.debit))
|
||||
.join(Journal.voucher)
|
||||
.filter(
|
||||
Voucher.reconcile_date < datetime.datetime.strptime(start_date, "%d-%b-%Y")
|
||||
@ -140,33 +158,37 @@ def opening_balance(account_id, start_date, dbsession):
|
||||
}
|
||||
|
||||
|
||||
@router.post("/api/reconcile/{id}") # "Reconcile"
|
||||
def save(request):
|
||||
account = (
|
||||
request.dbsession.query(AccountBase)
|
||||
.filter(AccountBase.id == uuid.UUID(request.matchdict["id"]))
|
||||
.first()
|
||||
)
|
||||
start_date = request.GET.get("s", session_period_start(request))
|
||||
finish_date = request.GET.get("f", session_period_finish(request))
|
||||
for item in request.json_body["body"]:
|
||||
if "id" not in item or item["id"] is None:
|
||||
continue
|
||||
|
||||
voucher = (
|
||||
request.dbsession.query(Voucher)
|
||||
.filter(Voucher.id == uuid.UUID(item["id"]))
|
||||
.first()
|
||||
)
|
||||
is_reconciled = item["isReconciled"]
|
||||
reconcile_date = datetime.datetime.strptime(item["reconcileDate"], "%d-%b-%Y")
|
||||
voucher.is_reconciled = is_reconciled
|
||||
voucher.reconcile_date = reconcile_date
|
||||
transaction.commit()
|
||||
body = build_report(account.id, start_date, finish_date, request)
|
||||
return {
|
||||
"startDate": start_date,
|
||||
"finishDate": finish_date,
|
||||
"account": {"id": account.id, "name": account.name},
|
||||
"body": body
|
||||
}
|
||||
@router.post("/{id_}")
|
||||
def save(
|
||||
id_: uuid.UUID,
|
||||
request: Request,
|
||||
s: str = None,
|
||||
f: str = None,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["reconcile"]),
|
||||
):
|
||||
account = db.query(AccountBase).filter(AccountBase.id == id_).first()
|
||||
start_date = s if s is not None else session_period_start(request.session)
|
||||
finish_date = f if f is not None else session_period_finish(request.session)
|
||||
raise Exception("not fixed")
|
||||
# for item in request.json_body["body"]:
|
||||
# if "id" not in item or item["id"] is None:
|
||||
# continue
|
||||
#
|
||||
# voucher = (
|
||||
# request.dbsession.query(Voucher)
|
||||
# .filter(Voucher.id == uuid.UUID(item["id"]))
|
||||
# .first()
|
||||
# )
|
||||
# is_reconciled = item["isReconciled"]
|
||||
# reconcile_date = datetime.datetime.strptime(item["reconcileDate"], "%d-%b-%Y")
|
||||
# voucher.is_reconciled = is_reconciled
|
||||
# voucher.reconcile_date = reconcile_date
|
||||
# transaction.commit()
|
||||
# body = build_report(account.id, start_date, finish_date, request)
|
||||
# return {
|
||||
# "startDate": start_date,
|
||||
# "finishDate": finish_date,
|
||||
# "account": {"id": account.id, "name": account.name},
|
||||
# "body": body
|
||||
# }
|
||||
|
@ -21,7 +21,6 @@ export class CashFlowService {
|
||||
}
|
||||
|
||||
list(id: string, startDate: string, finishDate: string): Observable<CashFlow> {
|
||||
const listUrl = (id === null) ? url : `${url}/${id}`;
|
||||
const options = {params: new HttpParams()};
|
||||
if (startDate !== null) {
|
||||
options.params = options.params.set('s', startDate);
|
||||
@ -29,6 +28,7 @@ export class CashFlowService {
|
||||
if (finishDate !== null) {
|
||||
options.params = options.params.set('f', finishDate);
|
||||
}
|
||||
const listUrl = (id === null) ? ( (startDate || finishDate) ? `${url}/data` : url) : `${url}/${id}`;
|
||||
return <Observable<CashFlow>>this.http.get<CashFlow>(listUrl, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
|
@ -21,14 +21,9 @@ export class DaybookService {
|
||||
}
|
||||
|
||||
list(startDate: string, finishDate): Observable<Daybook> {
|
||||
const options = {params: new HttpParams()};
|
||||
if (startDate !== null) {
|
||||
options.params = options.params.set('s', startDate);
|
||||
}
|
||||
if (finishDate !== null) {
|
||||
options.params = options.params.set('f', finishDate);
|
||||
}
|
||||
return <Observable<Daybook>>this.http.get<Daybook>(url, options)
|
||||
startDate = startDate ? `/${startDate}` : '';
|
||||
finishDate = finishDate ? `/${finishDate}` : '';
|
||||
return <Observable<Daybook>>this.http.get<Daybook>(`${url}${startDate}${finishDate}`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
|
@ -21,14 +21,9 @@ export class NetTransactionsService {
|
||||
}
|
||||
|
||||
list(startDate: string, finishDate): Observable<NetTransactions> {
|
||||
const options = {params: new HttpParams()};
|
||||
if (startDate !== null) {
|
||||
options.params = options.params.set('s', startDate);
|
||||
}
|
||||
if (finishDate !== null) {
|
||||
options.params = options.params.set('f', finishDate);
|
||||
}
|
||||
return <Observable<NetTransactions>>this.http.get<NetTransactions>(url, options)
|
||||
startDate = startDate ? `/${startDate}` : '';
|
||||
finishDate = finishDate ? `/${finishDate}` : '';
|
||||
return <Observable<NetTransactions>>this.http.get<NetTransactions>(`${url}${startDate}${finishDate}`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
|
@ -21,14 +21,9 @@ export class PurchaseEntriesService {
|
||||
}
|
||||
|
||||
list(startDate: string, finishDate): Observable<PurchaseEntries> {
|
||||
const options = {params: new HttpParams()};
|
||||
if (startDate !== null) {
|
||||
options.params = options.params.set('s', startDate);
|
||||
}
|
||||
if (finishDate !== null) {
|
||||
options.params = options.params.set('f', finishDate);
|
||||
}
|
||||
return <Observable<PurchaseEntries>>this.http.get<PurchaseEntries>(url, options)
|
||||
startDate = startDate ? `/${startDate}` : '';
|
||||
finishDate = finishDate ? `/${finishDate}` : '';
|
||||
return <Observable<PurchaseEntries>>this.http.get<PurchaseEntries>(`${url}${startDate}${finishDate}`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
|
@ -21,14 +21,9 @@ export class PurchasesService {
|
||||
}
|
||||
|
||||
list(startDate: string, finishDate): Observable<Purchases> {
|
||||
const options = {params: new HttpParams()};
|
||||
if (startDate !== null) {
|
||||
options.params = options.params.set('s', startDate);
|
||||
}
|
||||
if (finishDate !== null) {
|
||||
options.params = options.params.set('f', finishDate);
|
||||
}
|
||||
return <Observable<Purchases>>this.http.get<Purchases>(url, options)
|
||||
startDate = startDate ? `/${startDate}` : '';
|
||||
finishDate = finishDate ? `/${finishDate}` : '';
|
||||
return <Observable<Purchases>>this.http.get<Purchases>(`${url}${startDate}${finishDate}`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user