cloud-ide-model-schema
Version:
Pachage for schema management of Cloud IDEsys LMS
316 lines (315 loc) • 9.77 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CAccFinancialConfig = void 0;
var mongoose_1 = require("mongoose");
/* SCHEMA START */
var acc_financial_config = new mongoose_1.Schema({
// Entity reference - each entity can have its own financial configuration
accfincfg_entity_id_syen: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "core_system_entity",
required: true,
comment: "Entity/Organization this configuration belongs to"
},
// CURRENCY CONFIGURATION
accfincfg_default_currency_id_sycr: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "core_iso_currency",
comment: "Default currency for the entity"
},
accfincfg_currency_display_format: {
type: String,
enum: ["symbol_before", "symbol_after", "code_before", "code_after"],
default: "symbol_before",
comment: "How currency should be displayed (e.g., $100, 100$, USD 100, 100 USD)"
},
accfincfg_currency_decimal_places: {
type: Number,
default: 2,
min: 0,
max: 4,
comment: "Number of decimal places for currency display"
},
accfincfg_currency_thousand_separator: {
type: String,
default: ",",
maxlength: 1,
comment: "Thousand separator (e.g., comma, period, space)"
},
accfincfg_currency_decimal_separator: {
type: String,
default: ".",
maxlength: 1,
comment: "Decimal separator (e.g., period, comma)"
},
accfincfg_show_currency_symbol: {
type: Boolean,
default: true,
comment: "Whether to show currency symbol in displays"
},
accfincfg_show_currency_code: {
type: Boolean,
default: false,
comment: "Whether to show currency code (USD, EUR, etc.)"
},
// FINANCIAL YEAR CONFIGURATION
accfincfg_financial_year_start_month: {
type: Number,
min: 1,
max: 12,
default: 4,
comment: "Month when financial year starts (1=January, 4=April, etc.)"
},
accfincfg_financial_year_start_day: {
type: Number,
min: 1,
max: 31,
default: 1,
comment: "Day of month when financial year starts"
},
accfincfg_financial_year_naming: {
type: String,
enum: ["calendar_year", "fiscal_year", "academic_year"],
default: "fiscal_year",
comment: "How financial year is named"
},
accfincfg_is_self_financial_year: {
type: Boolean,
default: true,
comment: "If true, entity has its own financial year. If false, follows parent entity's financial year."
},
// TAX CONFIGURATION
accfincfg_default_tax_percentage: {
type: Number,
default: 0,
min: 0,
max: 100,
comment: "Default tax percentage applied to transactions"
},
accfincfg_tax_inclusive_pricing: {
type: Boolean,
default: false,
comment: "Whether prices include tax by default"
},
accfincfg_show_tax_breakdown: {
type: Boolean,
default: true,
comment: "Whether to show tax breakdown in invoices/receipts"
},
accfincfg_tax_calculation_method: {
type: String,
enum: ["percentage", "fixed_amount", "tiered"],
default: "percentage",
comment: "Method for calculating tax"
},
// PAYMENT CONFIGURATION
accfincfg_allowed_payment_methods: {
type: [String],
default: ["cash", "bank_transfer", "cheque", "online"],
comment: "List of allowed payment methods"
},
accfincfg_default_payment_method: {
type: String,
default: "cash",
comment: "Default payment method"
},
accfincfg_require_payment_reference: {
type: Boolean,
default: false,
comment: "Whether payment reference is required"
},
accfincfg_auto_generate_receipt: {
type: Boolean,
default: true,
comment: "Automatically generate receipt after payment"
},
// INVOICE/RECEIPT CONFIGURATION
accfincfg_invoice_prefix: {
type: String,
maxlength: 10,
default: "INV",
comment: "Prefix for invoice numbers (e.g., INV, BILL)"
},
accfincfg_receipt_prefix: {
type: String,
maxlength: 10,
default: "RCP",
comment: "Prefix for receipt numbers (e.g., RCP, REC)"
},
accfincfg_invoice_number_format: {
type: String,
enum: ["sequential", "year_sequential", "date_sequential"],
default: "year_sequential",
comment: "Format for invoice numbering"
},
accfincfg_receipt_number_format: {
type: String,
enum: ["sequential", "year_sequential", "date_sequential"],
default: "year_sequential",
comment: "Format for receipt numbering"
},
accfincfg_invoice_footer_text: {
type: String,
maxlength: 500,
comment: "Footer text to display on invoices"
},
accfincfg_receipt_footer_text: {
type: String,
maxlength: 500,
comment: "Footer text to display on receipts"
},
accfincfg_show_terms_conditions: {
type: Boolean,
default: true,
comment: "Whether to show terms and conditions on invoices"
},
accfincfg_terms_conditions_text: {
type: String,
maxlength: 1000,
comment: "Terms and conditions text for invoices"
},
// ROUNDING CONFIGURATION
accfincfg_rounding_method: {
type: String,
enum: ["round", "floor", "ceiling", "none"],
default: "round",
comment: "Method for rounding amounts"
},
accfincfg_rounding_precision: {
type: Number,
default: 2,
min: 0,
max: 4,
comment: "Precision for rounding (decimal places)"
},
// DISCOUNT CONFIGURATION
accfincfg_allow_discounts: {
type: Boolean,
default: true,
comment: "Whether discounts are allowed"
},
accfincfg_max_discount_percentage: {
type: Number,
default: 100,
min: 0,
max: 100,
comment: "Maximum discount percentage allowed"
},
accfincfg_require_discount_approval: {
type: Boolean,
default: false,
comment: "Whether discount requires approval"
},
accfincfg_discount_approval_threshold: {
type: Number,
default: 0,
comment: "Discount percentage threshold requiring approval"
},
// LATE FEE CONFIGURATION
accfincfg_late_fee_enabled: {
type: Boolean,
default: false,
comment: "Whether late fees are enabled"
},
accfincfg_late_fee_calculation_method: {
type: String,
enum: ["fixed_amount", "percentage", "daily_rate"],
default: "percentage",
comment: "Method for calculating late fees"
},
accfincfg_late_fee_percentage: {
type: Number,
default: 0,
min: 0,
max: 100,
comment: "Late fee percentage (if percentage method)"
},
accfincfg_late_fee_fixed_amount: {
type: Number,
default: 0,
min: 0,
comment: "Fixed late fee amount (if fixed method)"
},
accfincfg_late_fee_grace_period_days: {
type: Number,
default: 0,
min: 0,
comment: "Grace period in days before late fee applies"
},
// REFUND CONFIGURATION
accfincfg_allow_refunds: {
type: Boolean,
default: true,
comment: "Whether refunds are allowed"
},
accfincfg_refund_approval_required: {
type: Boolean,
default: true,
comment: "Whether refunds require approval"
},
accfincfg_max_refund_percentage: {
type: Number,
default: 100,
min: 0,
max: 100,
comment: "Maximum refund percentage allowed"
},
// BANKING CONFIGURATION
accfincfg_bank_account_number: {
type: String,
maxlength: 50,
comment: "Default bank account number for payments"
},
accfincfg_bank_name: {
type: String,
maxlength: 100,
comment: "Default bank name"
},
accfincfg_bank_ifsc_code: {
type: String,
maxlength: 20,
comment: "Bank IFSC/SWIFT code"
},
accfincfg_bank_branch: {
type: String,
maxlength: 100,
comment: "Bank branch name"
},
// ADDITIONAL CONFIGURATION (Flexible JSON)
accfincfg_additional_config: {
type: Object,
default: {},
comment: "Additional flexible configuration (JSON structure)"
},
// METADATA
accfincfg_created_by_user: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst",
comment: "User who created this configuration"
},
accfincfg_updated_by_user: {
type: mongoose_1.default.Schema.Types.ObjectId,
ref: "auth_user_mst",
comment: "User who last updated this configuration"
},
accfincfg_isactive: {
type: Boolean,
default: true,
required: true,
comment: "Configuration active status"
},
accfincfg_notes: {
type: String,
maxlength: 1000,
trim: true,
comment: "Additional notes about this configuration"
}
}, {
collection: 'acc_financial_config',
timestamps: true
});
// Indexes for performance
acc_financial_config.index({ accfincfg_entity_id_syen: 1 }, { unique: true });
acc_financial_config.index({ accfincfg_isactive: 1 });
var CAccFinancialConfig = mongoose_1.default.model("acc_financial_config", acc_financial_config);
exports.CAccFinancialConfig = CAccFinancialConfig;