Accounting Invoice

This commit is contained in:
Sedat Öztürk 2025-12-09 23:45:46 +03:00
parent b9db2a36ed
commit 12b88a0623
12 changed files with 782 additions and 62 deletions

View file

@ -10225,6 +10225,12 @@
"tr": "Faturalar",
"en": "Invoices"
},
{
"resourceName": "Platform",
"key": "App.Accounting.InvoiceItem",
"tr": "Fatura Ürünleri",
"en": "Invoice Items"
},
{
"resourceName": "Platform",
"key": "App.Accounting.Cash",

View file

@ -2243,6 +2243,668 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
}
#endregion
#region Invoice
listFormName = AppCodes.Accounting.Invoice;
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
{
var listForm = await _listFormRepository.InsertAsync(
new ListForm()
{
ListFormType = ListFormTypeEnum.List,
ExportJson = DefaultExportJson,
IsSubForm = false,
ShowNote = true,
LayoutJson = DefaultLayoutJson(),
CultureName = LanguageCodes.En,
ListFormCode = listFormName,
Name = listFormName,
Title = listFormName,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = true,
IsBranch = false,
IsOrganizationUnit = false,
Description = listFormName,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Invoice)),
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = DefaultFilterJson,
SortMode = GridOptions.SortModeSingle,
FilterRowJson = DefaultFilterRowJson,
HeaderFilterJson = DefaultHeaderFilterJson,
SearchPanelJson = DefaultSearchPanelJson,
GroupPanelJson = DefaultGroupPanelJson,
SelectionJson = DefaultSelectionSingleJson,
ColumnOptionJson = DefaultColumnOptionJson,
PermissionJson = DefaultPermissionJson(listFormName),
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Invoice)),
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
PagerOptionJson = DefaultPagerOptionJson,
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
EditingOptionJson = DefaultEditingOptionJson(listFormName, 800, 300, true, true, true, true, false),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
new() {
Order=1, ColCount=2, ColSpan=1, ItemType="group", Items= [
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 2, DataField = "InvoiceTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 3, DataField = "CurrentAccountId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 4, DataField = "StatusId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 5, DataField = "InvoiceNumber", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 6, DataField = "PaymentStatusId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 7, DataField = "InvoiceDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.DateFormat },
new EditingFormItemDto { Order = 8, DataField = "DueDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.DateFormat },
new EditingFormItemDto { Order = 9, DataField = "Currency", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 10, DataField = "Notes", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea, EditorOptions=EditorOptionValues.ShowClearButton },
]}
}),
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() { FieldName = "Currency", FieldDbType = DbType.String, Value = "TRY", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "InvoiceDate", FieldDbType = DbType.Date, Value = "@DATE", CustomValueType = FieldCustomValueTypeEnum.CustomKey },
new() { FieldName = "DueDate", FieldDbType = DbType.Date, Value = "@DATE", CustomValueType = FieldCustomValueTypeEnum.CustomKey },
}),
CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] {
new() {
Hint = "Ödeme Kaydet",
Text ="Ödeme Kaydet",
UrlTarget="_blank",
AuthName = listFormName,
Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id",
IsVisible = true,
VisibleExpression = "(e) => e.row.data.RemainingAmount == 0"
},
new() {
Hint = "Items",
Text ="Items",
UrlTarget="_blank",
AuthName = listFormName,
Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id",
IsVisible = true
},
}),
}, autoSave: true
);
#region Invoice Fields
await _listFormFieldRepository.InsertManyAsync([
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
Visible = false,
IsActive = true,
IsDeleted = false,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "BranchId",
Width = 150,
ListOrderNo = 2,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = LookupQueryValues.BranchValues,
}),
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "InvoiceTypeId",
Width = 150,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.InvoiceType), "Id", "Name"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "CurrentAccountId",
Width = 150,
ListOrderNo = 4,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.CurrentAccount), "Id", "Name"),
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "StatusId",
Width = 150,
ListOrderNo = 5,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.InvoiceStatus), "Id", "Name"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "InvoiceNumber",
Width = 100,
ListOrderNo = 6,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Date,
FieldName = "InvoiceDate",
Width = 100,
ListOrderNo = 7,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.CurrentAccount), "Id", "Name"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Date,
FieldName = "DueDate",
Width = 100,
ListOrderNo = 8,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.CurrentAccount), "Id", "Name"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Currency",
Width = 100,
ListOrderNo = 9,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Currency), "Code", "Name"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "PaymentStatusId",
Width = 150,
ListOrderNo = 10,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.PaymentStatus), "Id", "Name"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Notes",
Width = 200,
ListOrderNo = 11,
Visible = true,
IsActive = true,
IsDeleted = false,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "Subtotal",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 12,
Visible = true,
IsActive = true,
IsDeleted = false,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "TaxAmount",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 13,
Visible = true,
IsActive = true,
IsDeleted = false,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "DiscountAmount",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 14,
Visible = true,
IsActive = true,
IsDeleted = false,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "TotalAmount",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 15,
Visible = true,
IsActive = true,
IsDeleted = false,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "PaidAmount",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 16,
Visible = true,
IsActive = true,
IsDeleted = false,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "RemainingAmount",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 17,
Visible = true,
IsActive = true,
IsDeleted = false,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
], autoSave: true);
#endregion
}
#endregion
#region Invoice Items
listFormName = AppCodes.Accounting.InvoiceItem;
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
{
var listForm = await _listFormRepository.InsertAsync(
new ListForm()
{
ListFormType = ListFormTypeEnum.List,
ExportJson = DefaultExportJson,
IsSubForm = false,
ShowNote = true,
LayoutJson = DefaultLayoutJson(),
CultureName = LanguageCodes.En,
ListFormCode = listFormName,
Name = listFormName,
Title = listFormName,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = true,
IsBranch = false,
IsOrganizationUnit = false,
Description = listFormName,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.InvoiceItem)),
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = DefaultFilterJson,
SortMode = GridOptions.SortModeSingle,
FilterRowJson = DefaultFilterRowJson,
HeaderFilterJson = DefaultHeaderFilterJson,
SearchPanelJson = DefaultSearchPanelJson,
GroupPanelJson = DefaultGroupPanelJson,
SelectionJson = DefaultSelectionSingleJson,
ColumnOptionJson = DefaultColumnOptionJson,
PermissionJson = DefaultPermissionJson(listFormName),
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.InvoiceItem)),
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
PagerOptionJson = DefaultPagerOptionJson,
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 470, true, true, true, true, false),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
new() {
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [
new EditingFormItemDto { Order = 1, DataField = "MaterialId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 2, DataField = "Uom", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 3, DataField = "Quantity", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
new EditingFormItemDto { Order = 4, DataField = "UnitPrice", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
new EditingFormItemDto { Order = 5, DataField = "LineTotal", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
new EditingFormItemDto { Order = 6, DataField = "DiscountRate", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
new EditingFormItemDto { Order = 7, DataField = "DiscountAmount", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
new EditingFormItemDto { Order = 8, DataField = "TaxRate", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
new EditingFormItemDto { Order = 9, DataField = "TaxAmount", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
new EditingFormItemDto { Order = 10, DataField = "NetAmount", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
new EditingFormItemDto { Order = 11, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea },
]}
}),
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() { FieldName = "Uom", FieldDbType = DbType.String, Value = "Adet", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "Quantity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "UnitPrice", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "LineTotal", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "DiscountRate", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "DiscountAmount", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "TaxRate", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "TaxAmount", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "NetAmount", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
}),
}, autoSave: true
);
#region Invoice Item Fields
await _listFormFieldRepository.InsertManyAsync([
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
Visible = false,
IsActive = true,
IsDeleted = false,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "MaterialId",
Width = 250,
ListOrderNo = 2,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Material), "Id", "Name"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Uom",
Width = 100,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Uom), "Name", "Name"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "Quantity",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 4,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "UnitPrice",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 5,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "LineTotal",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 6,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "DiscountRate",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 7,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "DiscountAmount",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 8,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "TaxRate",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 9,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "TaxAmount",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 10,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Decimal,
FieldName = "NetAmount",
Format = "fixedPoint",
Alignment = "right",
Width = 100,
ListOrderNo = 11,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Description",
Width = 500,
ListOrderNo = 12,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
], autoSave: true);
#endregion
}
#endregion
// Invoice ve Invoice Item arasında Sub Forms ilişkisinin kurulması
await utils.CloneFormLayoutAsync(
AppCodes.Accounting.Invoice,
JsonSerializer.Serialize(
new List<dynamic>() {
new {
TabType = ListFormTabTypeEnum.List,
TabTitle = AppCodes.Accounting.InvoiceItem,
Code = AppCodes.Accounting.InvoiceItem,
Relation = new List<dynamic>() {
new {
ParentFieldName = "Id",
DbType = DbType.Guid,
ChildFieldName = "InvoiceId"
},
}
},
}
)
);
}
}

View file

@ -3312,7 +3312,7 @@
"Code": "App.Accounting.Invoice",
"DisplayName": "App.Accounting.Invoice",
"Order": 6,
"Url": "/admin/accounting/invoices",
"Url": "/admin/list/App.Accounting.Invoice",
"Icon": "FcSalesPerformance",
"RequiredPermissionName": "App.Accounting.Invoice",
"IsDisabled": false

View file

@ -13747,6 +13747,69 @@
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Accounting",
"Name": "App.Accounting.InvoiceItem",
"ParentName": null,
"DisplayName": "App.Accounting.InvoiceItem",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Accounting",
"Name": "App.Accounting.InvoiceItem.Create",
"ParentName": "App.Accounting.InvoiceItem",
"DisplayName": "Create",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Accounting",
"Name": "App.Accounting.InvoiceItem.Update",
"ParentName": "App.Accounting.InvoiceItem",
"DisplayName": "Update",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Accounting",
"Name": "App.Accounting.InvoiceItem.Delete",
"ParentName": "App.Accounting.InvoiceItem",
"DisplayName": "Delete",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Accounting",
"Name": "App.Accounting.InvoiceItem.Export",
"ParentName": "App.Accounting.InvoiceItem",
"DisplayName": "Export",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Accounting",
"Name": "App.Accounting.InvoiceItem.Import",
"ParentName": "App.Accounting.InvoiceItem",
"DisplayName": "Import",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Accounting",
"Name": "App.Accounting.InvoiceItem.Note",
"ParentName": "App.Accounting.InvoiceItem",
"DisplayName": "Note",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Accounting",
"Name": "App.Accounting.Cash",

View file

@ -577,6 +577,8 @@ public static class SeedConsts
public const string CheckStatus = Default + ".CheckStatus";
public const string CheckType = Default + ".CheckType";
public const string CheckNote = Default + ".CheckNote";
public const string Invoice = Default + ".Invoice";
public const string InvoiceItem = Default + ".InvoiceItem";
}
public static class Store

View file

@ -10,29 +10,29 @@ public class Invoice : FullAuditedEntity<Guid>, IMultiTenant
public Guid? TenantId { get; set; }
public Guid? BranchId { get; set; }
public string InvoiceNumber { get; set; }
public Guid InvoiceTypeId { get; set; }
public InvoiceType InvoiceType { get; set; }
public Guid CurrentAccountId { get; set; }
public CurrentAccount CurrentAccount { get; set; }
public DateTime InvoiceDate { get; set; }
public DateTime DueDate { get; set; }
public DateTime? DeliveryDate { get; set; }
public decimal Subtotal { get; set; }
public decimal TaxAmount { get; set; }
public decimal DiscountAmount { get; set; }
public decimal TotalAmount { get; set; }
public decimal PaidAmount { get; set; }
public decimal RemainingAmount { get; set; }
public string Currency { get; set; }
public Guid? CurrentAccountId { get; set; }
public CurrentAccount? CurrentAccount { get; set; }
public Guid StatusId { get; set; }
public InvoiceStatus Status { get; set; }
public Guid PaymentStatusId { get; set; }
public string InvoiceNumber { get; set; }
public DateTime InvoiceDate { get; set; } // Fatura Tarihi
public DateTime DueDate { get; set; } // Vade Tarihi
public decimal Subtotal { get; set; } // Ara Toplam
public decimal TaxAmount { get; set; } // Vergi Tutarı
public decimal DiscountAmount { get; set; } // İndirim Tutarı
public decimal TotalAmount { get; set; } // Genel Toplam
public decimal PaidAmount { get; set; } // Ödenen Tutar
public decimal RemainingAmount { get; set; } // Kalan Tutar
public string Currency { get; set; } // Para Birimi
public Guid PaymentStatusId { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public Guid? WaybillId { get; set; }

View file

@ -15,16 +15,16 @@ public class InvoiceItem : FullAuditedEntity<Guid>, IMultiTenant
public Material Material { get; set; }
public string Uom { get; set; }
public decimal Quantity { get; set; } // Miktar
public decimal UnitPrice { get; set; } // Birim Fiyat
public decimal LineTotal { get; set; } // Miktar x Birim Fiyat
public decimal DiscountRate { get; set; } // İndirim Yüzdesi
public decimal DiscountAmount { get; set; } // Hesaplanan indirim tutarı
public decimal TaxRate { get; set; } // Vergi Yüzdesi
public decimal TaxAmount { get; set; } // Hesaplanan vergi tutarı
public decimal NetAmount { get; set; } // Vergi sonrası tutar
public string Description { get; set; }
public decimal Quantity { get; set; }
public decimal UnitPrice { get; set; }
public decimal LineTotal { get; set; }
public decimal DiscountRate { get; set; }
public decimal DiscountAmount { get; set; }
public decimal TaxRate { get; set; }
public decimal TaxAmount { get; set; }
public decimal NetAmount { get; set; }
}

View file

@ -14,8 +14,8 @@ public class Waybill : FullAuditedEntity<Guid>, IMultiTenant
public Guid WaybillTypeId { get; set; }
public WaybillType WaybillType { get; set; }
public Guid CurrentAccountId { get; set; }
public CurrentAccount CurrentAccount { get; set; }
public Guid? CurrentAccountId { get; set; }
public CurrentAccount? CurrentAccount { get; set; }
public DateTime WaybillDate { get; set; }
public DateTime? DeliveryDate { get; set; }

View file

@ -3910,7 +3910,6 @@ public class PlatformDbContext :
b.Property(x => x.WaybillNumber).IsRequired().HasMaxLength(50);
b.Property(x => x.WaybillTypeId).IsRequired();
b.Property(x => x.CurrentAccountId).IsRequired();
b.Property(x => x.WaybillDate).IsRequired();
@ -3934,7 +3933,8 @@ public class PlatformDbContext :
b.HasOne(x => x.CurrentAccount)
.WithMany(ca => ca.Waybills)
.HasForeignKey(x => x.CurrentAccountId)
.OnDelete(DeleteBehavior.Restrict);
.OnDelete(DeleteBehavior.Restrict)
.IsRequired(false);
b.HasOne(x => x.WaybillType)
.WithMany(wt => wt.Waybills)
@ -4015,7 +4015,6 @@ public class PlatformDbContext :
b.Property(x => x.InvoiceNumber).IsRequired().HasMaxLength(50);
b.Property(x => x.InvoiceTypeId).IsRequired();
b.Property(x => x.CurrentAccountId).IsRequired();
b.Property(x => x.InvoiceDate).IsRequired();
b.Property(x => x.DueDate).IsRequired();
@ -4033,7 +4032,8 @@ public class PlatformDbContext :
b.HasOne(x => x.CurrentAccount)
.WithMany(ca => ca.Invoices)
.HasForeignKey(x => x.CurrentAccountId)
.OnDelete(DeleteBehavior.Restrict);
.OnDelete(DeleteBehavior.Restrict)
.IsRequired(false);
b.HasOne(x => x.InvoiceType)
.WithMany(ca => ca.Invoices)
@ -4060,7 +4060,7 @@ public class PlatformDbContext :
b.Property(x => x.MaterialId).IsRequired();
b.Property(x => x.Uom).HasMaxLength(64).IsRequired();
b.Property(x => x.Description).IsRequired().HasMaxLength(500);
b.Property(x => x.Description).HasMaxLength(500);
b.Property(x => x.Quantity).HasDefaultValue(0).HasPrecision(18, 2);
b.Property(x => x.UnitPrice).HasDefaultValue(0).HasPrecision(18, 2);

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Erp.Platform.Migrations
{
[DbContext(typeof(PlatformDbContext))]
[Migration("20251209191500_Initial")]
[Migration("20251209203306_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -5938,7 +5938,7 @@ namespace Erp.Platform.Migrations
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<Guid>("CurrentAccountId")
b.Property<Guid?>("CurrentAccountId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
@ -5949,9 +5949,6 @@ namespace Erp.Platform.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<DateTime?>("DeliveryDate")
.HasColumnType("datetime2");
b.Property<decimal>("DiscountAmount")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
@ -6068,7 +6065,6 @@ namespace Erp.Platform.Migrations
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
@ -15632,7 +15628,7 @@ namespace Erp.Platform.Migrations
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<Guid>("CurrentAccountId")
b.Property<Guid?>("CurrentAccountId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
@ -20118,8 +20114,7 @@ namespace Erp.Platform.Migrations
b.HasOne("Erp.Platform.Entities.CurrentAccount", "CurrentAccount")
.WithMany("Invoices")
.HasForeignKey("CurrentAccountId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("Erp.Platform.Entities.InvoiceType", "InvoiceType")
.WithMany("Invoices")
@ -21363,8 +21358,7 @@ namespace Erp.Platform.Migrations
b.HasOne("Erp.Platform.Entities.CurrentAccount", "CurrentAccount")
.WithMany("Waybills")
.HasForeignKey("CurrentAccountId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("Erp.Platform.Entities.WaybillStatus", "WaybillStatus")
.WithMany("Waybills")

View file

@ -5306,12 +5306,12 @@ namespace Erp.Platform.Migrations
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
InvoiceNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
InvoiceTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CurrentAccountId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CurrentAccountId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
StatusId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
InvoiceNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
InvoiceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
DueDate = table.Column<DateTime>(type: "datetime2", nullable: false),
DeliveryDate = table.Column<DateTime>(type: "datetime2", nullable: true),
Subtotal = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
TaxAmount = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
DiscountAmount = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
@ -5319,7 +5319,6 @@ namespace Erp.Platform.Migrations
PaidAmount = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
RemainingAmount = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
Currency = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
StatusId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PaymentStatusId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
WaybillId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Notes = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
@ -5369,7 +5368,7 @@ namespace Erp.Platform.Migrations
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
WaybillNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
WaybillTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CurrentAccountId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CurrentAccountId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
WaybillDate = table.Column<DateTime>(type: "datetime2", nullable: false),
DeliveryDate = table.Column<DateTime>(type: "datetime2", nullable: true),
Subtotal = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
@ -5426,7 +5425,6 @@ namespace Erp.Platform.Migrations
InvoiceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MaterialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
Quantity = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
UnitPrice = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
LineTotal = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
@ -5435,6 +5433,7 @@ namespace Erp.Platform.Migrations
TaxRate = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
TaxAmount = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
NetAmount = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),

View file

@ -5935,7 +5935,7 @@ namespace Erp.Platform.Migrations
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<Guid>("CurrentAccountId")
b.Property<Guid?>("CurrentAccountId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
@ -5946,9 +5946,6 @@ namespace Erp.Platform.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<DateTime?>("DeliveryDate")
.HasColumnType("datetime2");
b.Property<decimal>("DiscountAmount")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
@ -6065,7 +6062,6 @@ namespace Erp.Platform.Migrations
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
@ -15629,7 +15625,7 @@ namespace Erp.Platform.Migrations
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<Guid>("CurrentAccountId")
b.Property<Guid?>("CurrentAccountId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
@ -20115,8 +20111,7 @@ namespace Erp.Platform.Migrations
b.HasOne("Erp.Platform.Entities.CurrentAccount", "CurrentAccount")
.WithMany("Invoices")
.HasForeignKey("CurrentAccountId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("Erp.Platform.Entities.InvoiceType", "InvoiceType")
.WithMany("Invoices")
@ -21360,8 +21355,7 @@ namespace Erp.Platform.Migrations
b.HasOne("Erp.Platform.Entities.CurrentAccount", "CurrentAccount")
.WithMany("Waybills")
.HasForeignKey("CurrentAccountId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("Erp.Platform.Entities.WaybillStatus", "WaybillStatus")
.WithMany("Waybills")