adding fixed_assets and asset_depreciation

This commit is contained in:
fadlydev
2025-01-08 21:46:51 +07:00
parent 535db1928a
commit 8828a0230e
3 changed files with 201 additions and 0 deletions

View 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;
}

View 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;
}

View File

@ -48,7 +48,9 @@ import { CreditApplicationStatus } from "./types/credit";
import { CreditApplicationForm } from "./entity/credit_application_forms";
import { Application } from "./entity/application";
import { AssetClassification } from "./entity/asset_classification"
import { FixedAssetClassification } from "./entity/fixed_assets_classification";
import { Employee } from "./entity/employee";
import { AssetDepreciation } from "./entity/asset_depreciation";
export {
User, //
UserRole,
@ -96,6 +98,8 @@ export {
Supplier,
AssetCategory,
AssetClassification,
FixedAssetClassification,
AssetDepreciation,
Employee,
Ledger,
CreditCompany,