adding fixed_assets and asset_depreciation
This commit is contained in:
84
src/entity/asset_depreciation.ts
Normal file
84
src/entity/asset_depreciation.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
Index,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
import { User } from './users';
|
||||||
|
import { FixedAssetClassification } from './fixed_assets_classification';
|
||||||
|
|
||||||
|
@Entity('asset_depreciation')
|
||||||
|
export class AssetDepreciation {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => FixedAssetClassification, (asset) => asset.id, { nullable: false })
|
||||||
|
@JoinColumn({ name: 'asset_id' })
|
||||||
|
asset: FixedAssetClassification;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
asset_id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'date',
|
||||||
|
})
|
||||||
|
depreciation_date: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 12,
|
||||||
|
scale: 2,
|
||||||
|
})
|
||||||
|
depreciation_amount: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'text',
|
||||||
|
})
|
||||||
|
remarks: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, (user) => user.id, { nullable: true })
|
||||||
|
@JoinColumn({ name: 'created_by' })
|
||||||
|
createdBy: User;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, (user) => user.id, { nullable: true })
|
||||||
|
@JoinColumn({ name: 'updated_by' })
|
||||||
|
updatedBy: User;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
113
src/entity/fixed_assets_classification.ts
Normal file
113
src/entity/fixed_assets_classification.ts
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
Index,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
import { User } from './users';
|
||||||
|
|
||||||
|
@Entity('fixed_assets')
|
||||||
|
export class FixedAssetClassification {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 128,
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 255,
|
||||||
|
})
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
|
unique: true,
|
||||||
|
})
|
||||||
|
asset_code: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 12,
|
||||||
|
scale: 2,
|
||||||
|
})
|
||||||
|
acquisition_cost: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'date',
|
||||||
|
})
|
||||||
|
acquisition_date: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'date',
|
||||||
|
})
|
||||||
|
depreciation_start_date: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 5,
|
||||||
|
scale: 2,
|
||||||
|
})
|
||||||
|
depreciation_rate: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
category_id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, (user) => user.id, { nullable: true })
|
||||||
|
@JoinColumn({ name: 'created_by' })
|
||||||
|
createdBy: User;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, (user) => user.id, { nullable: true })
|
||||||
|
@JoinColumn({ name: 'updated_by' })
|
||||||
|
updatedBy: User;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
|
})
|
||||||
|
status: Status;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
@ -48,7 +48,9 @@ import { CreditApplicationStatus } from "./types/credit";
|
|||||||
import { CreditApplicationForm } from "./entity/credit_application_forms";
|
import { CreditApplicationForm } from "./entity/credit_application_forms";
|
||||||
import { Application } from "./entity/application";
|
import { Application } from "./entity/application";
|
||||||
import { AssetClassification } from "./entity/asset_classification"
|
import { AssetClassification } from "./entity/asset_classification"
|
||||||
|
import { FixedAssetClassification } from "./entity/fixed_assets_classification";
|
||||||
import { Employee } from "./entity/employee";
|
import { Employee } from "./entity/employee";
|
||||||
|
import { AssetDepreciation } from "./entity/asset_depreciation";
|
||||||
export {
|
export {
|
||||||
User, //
|
User, //
|
||||||
UserRole,
|
UserRole,
|
||||||
@ -96,6 +98,8 @@ export {
|
|||||||
Supplier,
|
Supplier,
|
||||||
AssetCategory,
|
AssetCategory,
|
||||||
AssetClassification,
|
AssetClassification,
|
||||||
|
FixedAssetClassification,
|
||||||
|
AssetDepreciation,
|
||||||
Employee,
|
Employee,
|
||||||
Ledger,
|
Ledger,
|
||||||
CreditCompany,
|
CreditCompany,
|
||||||
|
|||||||
Reference in New Issue
Block a user