4 Commits

Author SHA1 Message Date
492b80e116 Version Bump v10.5.5 2022-07-24 18:25:09 +05:30
4b97c4228a Fix: FormArrays were not getting cleared and were basically fucking the whole thing up.
Fix: EmployeeAttendance was borking because the inital employee was null.
2022-07-24 18:25:02 +05:30
c7bc379032 Version Bump v10.5.4 2022-07-24 06:45:03 +05:30
49b1ac61cf Fix: At times the report would fail with numbers not in multiples of .01 2022-07-24 06:44:11 +05:30
16 changed files with 35 additions and 28 deletions

View File

@ -1 +1 @@
__version__ = "10.5.3"
__version__ = "10.5.5"

View File

@ -112,7 +112,7 @@ def build_report(
schemas.CashFlowItem(
name=account_type.name,
url=["/", "cash-flow", str(account_type.id)],
amount=amount * -1,
amount=round(amount * -1, 2),
)
)
@ -144,14 +144,14 @@ def build_report(
schemas.CashFlowItem(
name="Net increase in cash and cash equivalents",
url=[],
amount=total_amount,
amount=round(total_amount, 2),
),
schemas.CashFlowItem(
name="Cash and cash equivalents at beginning of period",
url=[],
amount=opening,
amount=round(opening, 2),
),
schemas.CashFlowItem(name="Cash and cash equivalents at end of period", url=[], amount=closing),
schemas.CashFlowItem(name="Cash and cash equivalents at end of period", url=[], amount=round(closing, 2)),
],
)
@ -188,8 +188,8 @@ def build_report_id(
schemas.CashFlowItem(
name=account.name,
url=["/", "ledger", str(account.id)],
amount=amount * -1,
amount=round(amount * -1, 2),
)
)
return cf, [schemas.CashFlowItem(name="total", url=[], amount=total_amount)]
return cf, [schemas.CashFlowItem(name="total", url=[], amount=round(total_amount, 2))]

View File

@ -2,7 +2,7 @@ from datetime import date, datetime
from decimal import Decimal
from typing import List, Optional, Union
from pydantic import Field, validator
from pydantic import validator
from pydantic.main import BaseModel
from . import to_camel
@ -11,7 +11,7 @@ from . import to_camel
class CashFlowItem(BaseModel):
name: str
url: Optional[List[str]]
amount: Decimal = Field(multiple_of=0.01)
amount: Decimal
class Config:
anystr_strip_whitespace = True

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "brewman"
version = "10.5.3"
version = "10.5.5"
description = "Accounting plus inventory management for a restaurant."
authors = ["tanshu <git@tanshu.com>"]

View File

@ -1,6 +1,6 @@
{
"name": "overlord",
"version": "10.5.3",
"version": "10.5.5",
"scripts": {
"ng": "ng",
"start": "ng serve",

View File

@ -57,7 +57,7 @@ export class AttendanceComponent implements OnInit {
this.info = data.info;
this.attendanceTypes = data.attendanceTypes;
this.form.controls.date.setValue(moment(this.info.date, 'DD-MMM-YYYY').toDate());
this.form.controls.attendances.reset();
this.form.controls.attendances.clear();
this.info.body.forEach((x) =>
this.form.controls.attendances.push(
new FormGroup({

View File

@ -81,6 +81,7 @@ export class ClosingStockComponent implements OnInit {
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(),
costCentre: this.info.costCentre.id,
});
this.form.controls.stocks.clear();
this.info.items.forEach((x) =>
this.form.controls.stocks.push(
new FormGroup({

View File

@ -79,8 +79,8 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
this.attendanceTypes = data.attendanceTypes;
this.form.controls.startDate.setValue(moment(this.info.startDate, 'DD-MMM-YYYY').toDate());
this.form.controls.finishDate.setValue(moment(this.info.finishDate, 'DD-MMM-YYYY').toDate());
this.form.controls.employee.setValue(this.info.employee.name);
this.form.controls.attendances.reset();
this.form.controls.employee.setValue(this.info.employee?.name ?? '');
this.form.controls.attendances.clear();
this.info.body.forEach((x) =>
this.form.controls.attendances.push(
new FormGroup({
@ -120,12 +120,14 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
const formValue = this.form.value;
this.info.startDate = moment(formValue.startDate).format('DD-MMM-YYYY');
this.info.finishDate = moment(formValue.finishDate).format('DD-MMM-YYYY');
this.router.navigate(['/employee-attendance', this.info.employee.id], {
queryParams: {
startDate: this.info.startDate,
finishDate: this.info.finishDate,
},
});
if (this.info.employee) {
this.router.navigate(['/employee-attendance', this.info.employee.id], {
queryParams: {
startDate: this.info.startDate,
finishDate: this.info.finishDate,
},
});
}
}
save() {

View File

@ -1,6 +1,6 @@
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { Observable, of as observableOf } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
@ -35,6 +35,9 @@ export class EmployeeAttendanceService {
}
save(employeeAttendance: EmployeeAttendance): Observable<EmployeeAttendance> {
if (!employeeAttendance.employee) {
return observableOf(new EmployeeAttendance());
}
const { id } = employeeAttendance.employee;
return this.http
.post<EmployeeAttendance>(`${url}/${id}`, employeeAttendance)

View File

@ -5,13 +5,12 @@ import { EmployeeAttendanceItem } from './employee-attendance-item';
export class EmployeeAttendance {
startDate: string;
finishDate: string;
employee: Employee;
employee?: Employee;
body: EmployeeAttendanceItem[];
public constructor(init?: Partial<EmployeeAttendance>) {
this.startDate = '';
this.finishDate = '';
this.employee = new Employee();
this.body = [];
Object.assign(this, init);
}

View File

@ -77,6 +77,7 @@ export class IncentiveComponent implements OnInit {
loadVoucher(voucher: Voucher) {
this.voucher = voucher;
this.form.controls.date.setValue(moment(this.voucher.date, 'DD-MMM-YYYY').toDate());
this.form.controls.incentives.clear();
this.voucher.incentives.forEach((x) =>
this.form.controls.incentives.push(
new FormGroup({

View File

@ -45,7 +45,7 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
this.item = data.item;
this.form.controls.name.setValue(this.item.name);
this.form.controls.permissions.reset();
this.form.controls.permissions.clear();
this.item.permissions.forEach((x) =>
this.form.controls.permissions.push(
new FormGroup({

View File

@ -111,7 +111,7 @@ export class SettingsComponent implements OnInit {
showLockInformation(info: LockInfo[]) {
this.lockInformation = info;
this.lockInfoForm.controls.accountTypes.reset();
this.lockInfoForm.controls.accountTypes.clear();
this.accountTypes.forEach((x) =>
this.lockInfoForm.controls.accountTypes.push(
new FormGroup({
@ -119,7 +119,7 @@ export class SettingsComponent implements OnInit {
}),
),
);
this.lockInfoForm.controls.voucherTypes.reset();
this.lockInfoForm.controls.voucherTypes.clear();
this.voucherTypes.forEach((x) =>
this.lockInfoForm.controls.voucherTypes.push(
new FormGroup({

View File

@ -58,6 +58,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
this.form.controls.name.setValue(item.name);
this.form.controls.password.setValue(null);
this.form.controls.lockedOut.setValue(item.lockedOut);
this.form.controls.roles.clear();
this.item.roles.forEach((x) =>
this.form.controls.roles.push(
new FormGroup({

View File

@ -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: '10.5.3',
version: '10.5.5',
};

View File

@ -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: '10.5.3',
version: '10.5.5',
};
/*