Added PurchaseInvoice Related Tables
This commit is contained in:
parent
a3ffe1d3d6
commit
a6177adb43
@ -14,6 +14,7 @@ using Marco.Pms.Model.Master;
|
||||
using Marco.Pms.Model.OrganizationModel;
|
||||
using Marco.Pms.Model.PaymentGetway;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Marco.Pms.Model.PurchaseInvoice;
|
||||
using Marco.Pms.Model.Roles;
|
||||
using Marco.Pms.Model.ServiceProject;
|
||||
using Marco.Pms.Model.TenantModels;
|
||||
@ -238,6 +239,15 @@ namespace Marco.Pms.DataAccess.Data
|
||||
|
||||
#endregion
|
||||
|
||||
#region ======================================================= Purchase Invoice =======================================================
|
||||
public DbSet<PurchaseInvoiceDetails> PurchaseInvoiceDetails { get; set; }
|
||||
public DbSet<DeliveryChallanDetails> DeliveryChallanDetails { get; set; }
|
||||
public DbSet<PurchaseInvoiceAttachment> PurchaseInvoiceAttachments { get; set; }
|
||||
public DbSet<PurchaseInvoicePayment> PurchaseInvoicePayments { get; set; }
|
||||
public DbSet<PurchaseInvoiceStatus> PurchaseInvoiceStatus { get; set; }
|
||||
public DbSet<InvoiceAttachmentType> InvoiceAttachmentTypes { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -554,8 +564,84 @@ namespace Marco.Pms.DataAccess.Data
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
modelBuilder.Entity<InvoiceAttachmentType>().HasData(
|
||||
new InvoiceAttachmentType
|
||||
{
|
||||
Id = Guid.Parse("ca294108-a586-4207-88c8-163b24305ddc"),
|
||||
Name = "Delivery Challan",
|
||||
Description = "A delivery challan is a formal document accompanying a shipment of goods that lists the items included and serves as proof of delivery upon receipt."
|
||||
},
|
||||
new InvoiceAttachmentType
|
||||
{
|
||||
Id = Guid.Parse("150ddd9b-4b8d-44ac-bae0-2e553c0f069a"),
|
||||
Name = "E Way Bill",
|
||||
Description = "An E-Way Bill (Electronic Way Bill) is a mandatory digital document generated on the GST portal to evidence and track the movement of goods valued over ₹50,000."
|
||||
},
|
||||
new InvoiceAttachmentType
|
||||
{
|
||||
Id = Guid.Parse("3ca08288-0a74-4850-9948-0783aa975b84"),
|
||||
Name = "Tax Invoice",
|
||||
Description = "A Tax Invoice is a mandatory legal document issued by a GST-registered supplier for taxable goods or services, enabling the buyer to claim Input Tax Credit (ITC)."
|
||||
},
|
||||
new InvoiceAttachmentType
|
||||
{
|
||||
Id = Guid.Parse("1fa20cff-b0ee-468e-9ea6-72d5aa144a3f"),
|
||||
Name = "E-Invoice",
|
||||
Description = "An E-Invoice (Electronic Invoice) is a system where B2B invoices are electronically authenticated by the GST Network (GSTN) to generate a unique Invoice Reference Number (IRN) and QR code."
|
||||
}
|
||||
);
|
||||
|
||||
modelBuilder.Entity<PurchaseInvoiceStatus>().HasData(
|
||||
new PurchaseInvoiceStatus
|
||||
{
|
||||
Id = Guid.Parse("8a5ef25e-3c9e-45de-add9-6b1c1df54381"),
|
||||
Name = "Draft",
|
||||
DisplayName = "Draft",
|
||||
Description = "Draft Status in a Purchase Invoice indicates a preliminary, unfinalized document that is saved for review but has not yet been posted to the general ledger or affected your accounts/inventory.",
|
||||
Color = "#8592a3"
|
||||
},
|
||||
new PurchaseInvoiceStatus
|
||||
{
|
||||
Id = Guid.Parse("16b10201-1651-465c-b2fd-236bdef86f95"),
|
||||
Name = "Review Pending",
|
||||
DisplayName = "Submit for Review",
|
||||
Description = "Review Pending status in a Purchase Invoice indicates that the invoice has been submitted for validation but requires approval from an authorized person (like a manager or auditor) before it can be posted to the ledger or paid.",
|
||||
Color = "#696cff"
|
||||
},
|
||||
new PurchaseInvoiceStatus
|
||||
{
|
||||
Id = Guid.Parse("a05f5f4a-bd9d-4028-af42-48ee0caa3e40"),
|
||||
Name = "Rejected by Reviewer",
|
||||
DisplayName = "Reject",
|
||||
Description = "Rejected by Reviewer status indicates that the invoice failed the approval process due to errors, discrepancies, or policy violations and has been returned to the initiator or vendor for correction.",
|
||||
Color = "#ff3e1d"
|
||||
},
|
||||
new PurchaseInvoiceStatus
|
||||
{
|
||||
Id = Guid.Parse("60027a54-3c23-4619-9f4e-6c20549b50a6"),
|
||||
Name = "Approval Pending",
|
||||
DisplayName = "Mark as Reviewed",
|
||||
Description = "Approval Pending status in a Purchase Invoice indicates that the document has passed initial verification (matching and coding) and is now awaiting final financial authorization from a designated budget holder or signatory.",
|
||||
Color = "#03c3ec"
|
||||
},
|
||||
new PurchaseInvoiceStatus
|
||||
{
|
||||
Id = Guid.Parse("58de9cef-811f-46a4-814d-0069b64d98a9"),
|
||||
Name = "Rejected by Approver",
|
||||
DisplayName = "Reject",
|
||||
Description = "Rejected by Approver status in a Purchase Invoice indicates that the document successfully passed initial verification but was ultimately denied by the final authorizing signatory (such as a Manager or CFO) due to budget or validity concerns.",
|
||||
Color = "#ff3e1d"
|
||||
},
|
||||
new PurchaseInvoiceStatus
|
||||
{
|
||||
Id = Guid.Parse("5b393371-dbcf-4a28-88a8-f406fa34e0d0"),
|
||||
Name = "Approved",
|
||||
DisplayName = "Mark as Approved",
|
||||
Description = "Approved status indicates that the invoice has successfully cleared all necessary verification and authorization levels and is formally accepted by the company as a valid debt.",
|
||||
Color = "#71dd37"
|
||||
}
|
||||
);
|
||||
}
|
||||
private static void ManageApplicationStructure(ModelBuilder modelBuilder)
|
||||
{
|
||||
// Configure ApplicationRole to Tenant relationship (if Tenant exists)
|
||||
|
||||
9385
Marco.Pms.DataAccess/Migrations/20251125130508_Added_PurchaseInvoice_Related_Tables.Designer.cs
generated
Normal file
9385
Marco.Pms.DataAccess/Migrations/20251125130508_Added_PurchaseInvoice_Related_Tables.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,423 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_PurchaseInvoice_Related_Tables : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AdvancePaymentTransactions_Projects_ProjectId",
|
||||
table: "AdvancePaymentTransactions");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AdvancePaymentTransactions_ProjectId",
|
||||
table: "AdvancePaymentTransactions");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InvoiceAttachmentTypes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InvoiceAttachmentTypes", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PurchaseInvoiceDetails",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
UIDPrefix = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UIDPostfix = table.Column<int>(type: "int", nullable: false),
|
||||
Title = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProjectId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OrganizationId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
BillingAddress = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ShippingAddress = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PurchaseOrderNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PurchaseOrderDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
SupplierId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ProformaInvoiceNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProformaInvoiceDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
ProformaInvoiceAmount = table.Column<double>(type: "double", nullable: true),
|
||||
InvoiceNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
InvoiceDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
EWayBillNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
EWayBillDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
InvoiceReferenceNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AcknowledgmentNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AcknowledgmentDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
BaseAmount = table.Column<double>(type: "double", nullable: false),
|
||||
TaxAmount = table.Column<double>(type: "double", nullable: false),
|
||||
TransportCharges = table.Column<double>(type: "double", nullable: true),
|
||||
TotalAmount = table.Column<double>(type: "double", nullable: false),
|
||||
PaymentDueDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PurchaseInvoiceDetails", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceDetails_Employees_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceDetails_Employees_UpdatedById",
|
||||
column: x => x.UpdatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceDetails_Organizations_OrganizationId",
|
||||
column: x => x.OrganizationId,
|
||||
principalTable: "Organizations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceDetails_Organizations_SupplierId",
|
||||
column: x => x.SupplierId,
|
||||
principalTable: "Organizations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceDetails_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PurchaseInvoiceStatus",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DisplayName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Color = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PurchaseInvoiceStatus", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PurchaseInvoiceAttachments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PurchaseInvoiceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
UploadedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UploadedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PurchaseInvoiceAttachments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceAttachments_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceAttachments_Employees_UploadedById",
|
||||
column: x => x.UploadedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceAttachments_PurchaseInvoiceDetails_PurchaseIn~",
|
||||
column: x => x.PurchaseInvoiceId,
|
||||
principalTable: "PurchaseInvoiceDetails",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoiceAttachments_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PurchaseInvoicePayments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
InvoiceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PaymentReceivedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
TransactionId = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Amount = table.Column<double>(type: "double", nullable: false),
|
||||
Comment = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
PaymentAdjustmentHeadId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PurchaseInvoicePayments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoicePayments_Employees_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoicePayments_PaymentAdjustmentHeads_PaymentAdjust~",
|
||||
column: x => x.PaymentAdjustmentHeadId,
|
||||
principalTable: "PaymentAdjustmentHeads",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoicePayments_PurchaseInvoiceDetails_InvoiceId",
|
||||
column: x => x.InvoiceId,
|
||||
principalTable: "PurchaseInvoiceDetails",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PurchaseInvoicePayments_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DeliveryChallanDetails",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
DeliveryChallanNumber = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DeliveryChallanDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PurchaseInvoiceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
AttachmentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DeliveryChallanDetails", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DeliveryChallanDetails_Employees_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DeliveryChallanDetails_PurchaseInvoiceAttachments_Attachment~",
|
||||
column: x => x.AttachmentId,
|
||||
principalTable: "PurchaseInvoiceAttachments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DeliveryChallanDetails_PurchaseInvoiceDetails_PurchaseInvoic~",
|
||||
column: x => x.PurchaseInvoiceId,
|
||||
principalTable: "PurchaseInvoiceDetails",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DeliveryChallanDetails_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "InvoiceAttachmentTypes",
|
||||
columns: new[] { "Id", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("150ddd9b-4b8d-44ac-bae0-2e553c0f069a"), "An E-Way Bill (Electronic Way Bill) is a mandatory digital document generated on the GST portal to evidence and track the movement of goods valued over ₹50,000.", "E Way Bill" },
|
||||
{ new Guid("1fa20cff-b0ee-468e-9ea6-72d5aa144a3f"), "An E-Invoice (Electronic Invoice) is a system where B2B invoices are electronically authenticated by the GST Network (GSTN) to generate a unique Invoice Reference Number (IRN) and QR code.", "E-Invoice" },
|
||||
{ new Guid("3ca08288-0a74-4850-9948-0783aa975b84"), "A Tax Invoice is a mandatory legal document issued by a GST-registered supplier for taxable goods or services, enabling the buyer to claim Input Tax Credit (ITC).", "Tax Invoice" },
|
||||
{ new Guid("ca294108-a586-4207-88c8-163b24305ddc"), "A delivery challan is a formal document accompanying a shipment of goods that lists the items included and serves as proof of delivery upon receipt.", "Delivery Challan" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "PurchaseInvoiceStatus",
|
||||
columns: new[] { "Id", "Color", "Description", "DisplayName", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("16b10201-1651-465c-b2fd-236bdef86f95"), "#696cff", "Review Pending status in a Purchase Invoice indicates that the invoice has been submitted for validation but requires approval from an authorized person (like a manager or auditor) before it can be posted to the ledger or paid.", "Submit for Review", "Review Pending" },
|
||||
{ new Guid("58de9cef-811f-46a4-814d-0069b64d98a9"), "#ff3e1d", "Rejected by Approver status in a Purchase Invoice indicates that the document successfully passed initial verification but was ultimately denied by the final authorizing signatory (such as a Manager or CFO) due to budget or validity concerns.", "Reject", "Rejected by Approver" },
|
||||
{ new Guid("5b393371-dbcf-4a28-88a8-f406fa34e0d0"), "#71dd37", "Approved status indicates that the invoice has successfully cleared all necessary verification and authorization levels and is formally accepted by the company as a valid debt.", "Mark as Approved", "Approved" },
|
||||
{ new Guid("60027a54-3c23-4619-9f4e-6c20549b50a6"), "#03c3ec", "Approval Pending status in a Purchase Invoice indicates that the document has passed initial verification (matching and coding) and is now awaiting final financial authorization from a designated budget holder or signatory.", "Mark as Reviewed", "Approval Pending" },
|
||||
{ new Guid("8a5ef25e-3c9e-45de-add9-6b1c1df54381"), "#8592a3", "Draft Status in a Purchase Invoice indicates a preliminary, unfinalized document that is saved for review but has not yet been posted to the general ledger or affected your accounts/inventory.", "Draft", "Draft" },
|
||||
{ new Guid("a05f5f4a-bd9d-4028-af42-48ee0caa3e40"), "#ff3e1d", "Rejected by Reviewer status indicates that the invoice failed the approval process due to errors, discrepancies, or policy violations and has been returned to the initiator or vendor for correction.", "Reject", "Rejected by Reviewer" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeliveryChallanDetails_AttachmentId",
|
||||
table: "DeliveryChallanDetails",
|
||||
column: "AttachmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeliveryChallanDetails_CreatedById",
|
||||
table: "DeliveryChallanDetails",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeliveryChallanDetails_PurchaseInvoiceId",
|
||||
table: "DeliveryChallanDetails",
|
||||
column: "PurchaseInvoiceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DeliveryChallanDetails_TenantId",
|
||||
table: "DeliveryChallanDetails",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceAttachments_DocumentId",
|
||||
table: "PurchaseInvoiceAttachments",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceAttachments_PurchaseInvoiceId",
|
||||
table: "PurchaseInvoiceAttachments",
|
||||
column: "PurchaseInvoiceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceAttachments_TenantId",
|
||||
table: "PurchaseInvoiceAttachments",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceAttachments_UploadedById",
|
||||
table: "PurchaseInvoiceAttachments",
|
||||
column: "UploadedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceDetails_CreatedById",
|
||||
table: "PurchaseInvoiceDetails",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceDetails_OrganizationId",
|
||||
table: "PurchaseInvoiceDetails",
|
||||
column: "OrganizationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceDetails_SupplierId",
|
||||
table: "PurchaseInvoiceDetails",
|
||||
column: "SupplierId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceDetails_TenantId",
|
||||
table: "PurchaseInvoiceDetails",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoiceDetails_UpdatedById",
|
||||
table: "PurchaseInvoiceDetails",
|
||||
column: "UpdatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoicePayments_CreatedById",
|
||||
table: "PurchaseInvoicePayments",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoicePayments_InvoiceId",
|
||||
table: "PurchaseInvoicePayments",
|
||||
column: "InvoiceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoicePayments_PaymentAdjustmentHeadId",
|
||||
table: "PurchaseInvoicePayments",
|
||||
column: "PaymentAdjustmentHeadId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PurchaseInvoicePayments_TenantId",
|
||||
table: "PurchaseInvoicePayments",
|
||||
column: "TenantId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "DeliveryChallanDetails");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "InvoiceAttachmentTypes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PurchaseInvoicePayments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PurchaseInvoiceStatus");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PurchaseInvoiceAttachments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PurchaseInvoiceDetails");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AdvancePaymentTransactions_ProjectId",
|
||||
table: "AdvancePaymentTransactions",
|
||||
column: "ProjectId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AdvancePaymentTransactions_Projects_ProjectId",
|
||||
table: "AdvancePaymentTransactions",
|
||||
column: "ProjectId",
|
||||
principalTable: "Projects",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2141,8 +2141,6 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
|
||||
b.HasIndex("EmployeeId");
|
||||
|
||||
b.HasIndex("ProjectId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("AdvancePaymentTransactions");
|
||||
@ -4964,6 +4962,380 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
b.ToTable("WorkItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.DeliveryChallanDetails", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("AttachmentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("CreatedById")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("DeliveryChallanDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DeliveryChallanNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("PurchaseInvoiceId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("TenantId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AttachmentId");
|
||||
|
||||
b.HasIndex("CreatedById");
|
||||
|
||||
b.HasIndex("PurchaseInvoiceId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("DeliveryChallanDetails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.InvoiceAttachmentType", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("InvoiceAttachmentTypes");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("ca294108-a586-4207-88c8-163b24305ddc"),
|
||||
Description = "A delivery challan is a formal document accompanying a shipment of goods that lists the items included and serves as proof of delivery upon receipt.",
|
||||
Name = "Delivery Challan"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("150ddd9b-4b8d-44ac-bae0-2e553c0f069a"),
|
||||
Description = "An E-Way Bill (Electronic Way Bill) is a mandatory digital document generated on the GST portal to evidence and track the movement of goods valued over ₹50,000.",
|
||||
Name = "E Way Bill"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("3ca08288-0a74-4850-9948-0783aa975b84"),
|
||||
Description = "A Tax Invoice is a mandatory legal document issued by a GST-registered supplier for taxable goods or services, enabling the buyer to claim Input Tax Credit (ITC).",
|
||||
Name = "Tax Invoice"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("1fa20cff-b0ee-468e-9ea6-72d5aa144a3f"),
|
||||
Description = "An E-Invoice (Electronic Invoice) is a system where B2B invoices are electronically authenticated by the GST Network (GSTN) to generate a unique Invoice Reference Number (IRN) and QR code.",
|
||||
Name = "E-Invoice"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceAttachment", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("PurchaseInvoiceId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("TenantId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("UploadedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("UploadedById")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("PurchaseInvoiceId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.HasIndex("UploadedById");
|
||||
|
||||
b.ToTable("PurchaseInvoiceAttachments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceDetails", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime?>("AcknowledgmentDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("AcknowledgmentNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<double>("BaseAmount")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("BillingAddress")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("CreatedById")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime?>("EWayBillDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("EWayBillNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime?>("InvoiceDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("InvoiceNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("InvoiceReferenceNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("PaymentDueDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double?>("ProformaInvoiceAmount")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<DateTime?>("ProformaInvoiceDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("ProformaInvoiceNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("ProjectId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime?>("PurchaseOrderDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PurchaseOrderNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ShippingAddress")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("SupplierId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<double>("TaxAmount")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<Guid>("TenantId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<double>("TotalAmount")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double?>("TransportCharges")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<int>("UIDPostfix")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("UIDPrefix")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime?>("UpdatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid?>("UpdatedById")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedById");
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.HasIndex("UpdatedById");
|
||||
|
||||
b.ToTable("PurchaseInvoiceDetails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoicePayment", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("CreatedById")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("InvoiceId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<Guid>("PaymentAdjustmentHeadId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("PaymentReceivedDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("TenantId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("TransactionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedById");
|
||||
|
||||
b.HasIndex("InvoiceId");
|
||||
|
||||
b.HasIndex("PaymentAdjustmentHeadId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("PurchaseInvoicePayments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceStatus", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DisplayName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PurchaseInvoiceStatus");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("8a5ef25e-3c9e-45de-add9-6b1c1df54381"),
|
||||
Color = "#8592a3",
|
||||
Description = "Draft Status in a Purchase Invoice indicates a preliminary, unfinalized document that is saved for review but has not yet been posted to the general ledger or affected your accounts/inventory.",
|
||||
DisplayName = "Draft",
|
||||
Name = "Draft"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("16b10201-1651-465c-b2fd-236bdef86f95"),
|
||||
Color = "#696cff",
|
||||
Description = "Review Pending status in a Purchase Invoice indicates that the invoice has been submitted for validation but requires approval from an authorized person (like a manager or auditor) before it can be posted to the ledger or paid.",
|
||||
DisplayName = "Submit for Review",
|
||||
Name = "Review Pending"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("a05f5f4a-bd9d-4028-af42-48ee0caa3e40"),
|
||||
Color = "#ff3e1d",
|
||||
Description = "Rejected by Reviewer status indicates that the invoice failed the approval process due to errors, discrepancies, or policy violations and has been returned to the initiator or vendor for correction.",
|
||||
DisplayName = "Reject",
|
||||
Name = "Rejected by Reviewer"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("60027a54-3c23-4619-9f4e-6c20549b50a6"),
|
||||
Color = "#03c3ec",
|
||||
Description = "Approval Pending status in a Purchase Invoice indicates that the document has passed initial verification (matching and coding) and is now awaiting final financial authorization from a designated budget holder or signatory.",
|
||||
DisplayName = "Mark as Reviewed",
|
||||
Name = "Approval Pending"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("58de9cef-811f-46a4-814d-0069b64d98a9"),
|
||||
Color = "#ff3e1d",
|
||||
Description = "Rejected by Approver status in a Purchase Invoice indicates that the document successfully passed initial verification but was ultimately denied by the final authorizing signatory (such as a Manager or CFO) due to budget or validity concerns.",
|
||||
DisplayName = "Reject",
|
||||
Name = "Rejected by Approver"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("5b393371-dbcf-4a28-88a8-f406fa34e0d0"),
|
||||
Color = "#71dd37",
|
||||
Description = "Approved status indicates that the invoice has successfully cleared all necessary verification and authorization levels and is formally accepted by the company as a valid debt.",
|
||||
DisplayName = "Mark as Approved",
|
||||
Name = "Approved"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@ -7245,10 +7617,6 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.Projects.Project", "Project")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProjectId");
|
||||
|
||||
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
@ -7259,8 +7627,6 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
|
||||
b.Navigation("Employee");
|
||||
|
||||
b.Navigation("Project");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
@ -8190,6 +8556,152 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
b.Navigation("WorkCategoryMaster");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.DeliveryChallanDetails", b =>
|
||||
{
|
||||
b.HasOne("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceAttachment", "Attachment")
|
||||
.WithMany()
|
||||
.HasForeignKey("AttachmentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceDetails", "PurchaseInvoice")
|
||||
.WithMany()
|
||||
.HasForeignKey("PurchaseInvoiceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Attachment");
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
b.Navigation("PurchaseInvoice");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceAttachment", b =>
|
||||
{
|
||||
b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceDetails", "PurchaseInvoice")
|
||||
.WithMany()
|
||||
.HasForeignKey("PurchaseInvoiceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.Employees.Employee", "UploadedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UploadedById")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("PurchaseInvoice");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
|
||||
b.Navigation("UploadedBy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceDetails", b =>
|
||||
{
|
||||
b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.OrganizationModel.Organization", "Organization")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.OrganizationModel.Organization", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("UpdatedById");
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
b.Navigation("Organization");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
|
||||
b.Navigation("UpdatedBy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoicePayment", b =>
|
||||
{
|
||||
b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedById")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.PurchaseInvoice.PurchaseInvoiceDetails", "Invoice")
|
||||
.WithMany()
|
||||
.HasForeignKey("InvoiceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.Collection.PaymentAdjustmentHead", "PaymentAdjustmentHead")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentAdjustmentHeadId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
b.Navigation("Invoice");
|
||||
|
||||
b.Navigation("PaymentAdjustmentHead");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b =>
|
||||
{
|
||||
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", null)
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
@ -13,10 +12,6 @@ namespace Marco.Pms.Model.Expenses
|
||||
public int FinanceUIdPostfix { get; set; }
|
||||
public string Title { get; set; } = default!;
|
||||
public Guid? ProjectId { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
[ForeignKey("ProjectId")]
|
||||
public Project? Project { get; set; }
|
||||
public Guid EmployeeId { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
|
||||
75
Marco.Pms.Model/PurchaseInvoice/DeliveryChallanDetails.cs
Normal file
75
Marco.Pms.Model/PurchaseInvoice/DeliveryChallanDetails.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.PurchaseInvoice
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a detail of a delivery challan in the Purchase Invoice system.
|
||||
/// This class inherits from the TenantRelation class and adds specific properties related to a delivery challan.
|
||||
/// </summary>
|
||||
public class DeliveryChallanDetails : TenantRelation
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier for the delivery challan.
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the delivery challan number.
|
||||
/// </summary>
|
||||
public string DeliveryChallanNumber { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date of the delivery challan.
|
||||
/// </summary>
|
||||
public DateTime DeliveryChallanDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description of the delivery challan.
|
||||
/// </summary>
|
||||
public string Description { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the associated PurchaseInvoice.
|
||||
/// </summary>
|
||||
public Guid PurchaseInvoiceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the associated PurchaseInvoice.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("PurchaseInvoiceId")]
|
||||
public PurchaseInvoiceDetails? PurchaseInvoice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the associated Attachment.
|
||||
/// </summary>
|
||||
public Guid AttachmentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the associated Attachment.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("AttachmentId")]
|
||||
public PurchaseInvoiceAttachment? Attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time the record was created.
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the user who created the record.
|
||||
/// </summary>
|
||||
public Guid CreatedById { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user who created the record.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("CreatedById")]
|
||||
public Employee? CreatedBy { get; set; }
|
||||
}
|
||||
}
|
||||
9
Marco.Pms.Model/PurchaseInvoice/InvoiceAttachmentType.cs
Normal file
9
Marco.Pms.Model/PurchaseInvoice/InvoiceAttachmentType.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Marco.Pms.Model.PurchaseInvoice
|
||||
{
|
||||
public class InvoiceAttachmentType
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = default!;
|
||||
public string Description { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
61
Marco.Pms.Model/PurchaseInvoice/PurchaseInvoiceAttachment.cs
Normal file
61
Marco.Pms.Model/PurchaseInvoice/PurchaseInvoiceAttachment.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using Marco.Pms.Model.DocumentManager;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.PurchaseInvoice
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an attachment for a purchase invoice.
|
||||
/// </summary>
|
||||
public class PurchaseInvoiceAttachment : TenantRelation
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier for the attachment.
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier for the purchase invoice.
|
||||
/// </summary>
|
||||
public Guid PurchaseInvoiceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the purchase invoice associated with the attachment.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("PurchaseInvoiceId")]
|
||||
public PurchaseInvoiceDetails? PurchaseInvoice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier for the document.
|
||||
/// </summary>
|
||||
public Guid DocumentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the document associated with the attachment.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("DocumentId")]
|
||||
public Document? Document { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time when the attachment was uploaded.
|
||||
/// </summary>
|
||||
public DateTime UploadedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the employee who uploaded the attachment.
|
||||
/// </summary>
|
||||
public Guid UploadedById { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the employee who uploaded the attachment.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("UploadedById")]
|
||||
public Employee? UploadedBy { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
205
Marco.Pms.Model/PurchaseInvoice/PurchaseInvoiceDetails.cs
Normal file
205
Marco.Pms.Model/PurchaseInvoice/PurchaseInvoiceDetails.cs
Normal file
@ -0,0 +1,205 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.OrganizationModel;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.PurchaseInvoice
|
||||
{
|
||||
/// <summary>
|
||||
/// The PurchaseInvoiceDetails class represents a detail in a purchase invoice.
|
||||
/// It contains information about the detail such as its unique identifier, title, description, billing and shipping addresses,
|
||||
/// purchase order number and date, supplier information, proforma invoice details, invoice details, e-way bill details,
|
||||
/// invoice reference number, acknowledgment number and date, base amount, tax amount, transport charges, total amount, and payment due date.
|
||||
/// </summary>
|
||||
public class PurchaseInvoiceDetails : TenantRelation
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the detail.
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the prefix of the unique identifier for the detail.
|
||||
/// </summary>
|
||||
public string UIDPrefix { get; set; } = default!; // PUR/MMYY/
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the postfix of the unique identifier for the detail.
|
||||
/// </summary>
|
||||
public int UIDPostfix { get; set; } // 00001
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the detail.
|
||||
/// </summary>
|
||||
public string Title { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description of the detail.
|
||||
/// </summary>
|
||||
public string Description { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the related project.
|
||||
/// </summary>
|
||||
public Guid ProjectId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the organization related to the detail.
|
||||
/// </summary>
|
||||
public Guid OrganizationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the related organization.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("OrganizationId")]
|
||||
public Organization? Organization { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the billing address of the detail.
|
||||
/// </summary>
|
||||
public string BillingAddress { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the shipping address of the detail.
|
||||
/// </summary>
|
||||
public string ShippingAddress { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the purchase order number of the detail.
|
||||
/// </summary>
|
||||
public string? PurchaseOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the purchase order date of the detail.
|
||||
/// </summary>
|
||||
public DateTime? PurchaseOrderDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the supplier related to the detail.
|
||||
/// </summary>
|
||||
public Guid SupplierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the related supplier.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("SupplierId")]
|
||||
public Organization? Supplier { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the proforma invoice number of the detail.
|
||||
/// </summary>
|
||||
public string? ProformaInvoiceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the proforma invoice date of the detail.
|
||||
/// </summary>
|
||||
public DateTime? ProformaInvoiceDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the proforma invoice amount of the detail.
|
||||
/// </summary>
|
||||
public double? ProformaInvoiceAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the invoice number of the detail.
|
||||
/// </summary>
|
||||
public string? InvoiceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the invoice date of the detail.
|
||||
/// </summary>
|
||||
public DateTime? InvoiceDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the e-way bill number of the detail.
|
||||
/// </summary>
|
||||
public string? EWayBillNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the e-way bill date of the detail.
|
||||
/// </summary>
|
||||
public DateTime? EWayBillDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the invoice reference number of the detail.
|
||||
/// </summary>
|
||||
public string? InvoiceReferenceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the acknowledgment number of the detail.
|
||||
/// </summary>
|
||||
public string? AcknowledgmentNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the acknowledgment date of the detail.
|
||||
/// </summary>
|
||||
public DateTime? AcknowledgmentDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the base amount of the detail.
|
||||
/// </summary>
|
||||
public double BaseAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tax amount of the detail.
|
||||
/// </summary>
|
||||
public double TaxAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the transport charges of the detail.
|
||||
/// </summary>
|
||||
public double? TransportCharges { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the total amount of the detail.
|
||||
/// </summary>
|
||||
public double TotalAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The payment due date of the detail.
|
||||
/// </summary>
|
||||
public DateTime PaymentDueDate { get; set; } // Defaults to 40 days from the invoice date
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the detail is active.
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the user who created the detail.
|
||||
/// </summary>
|
||||
public Guid CreatedById { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user who created the detail.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("CreatedById")]
|
||||
public Employee? CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time when the detail was created.
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the user who last updated the detail.
|
||||
/// </summary>
|
||||
public Guid? UpdatedById { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user who last updated the detail.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("UpdatedById")]
|
||||
public Employee? UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time when the detail was last updated.
|
||||
/// </summary>
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
89
Marco.Pms.Model/PurchaseInvoice/PurchaseInvoicePayment.cs
Normal file
89
Marco.Pms.Model/PurchaseInvoice/PurchaseInvoicePayment.cs
Normal file
@ -0,0 +1,89 @@
|
||||
using Marco.Pms.Model.Collection;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.PurchaseInvoice
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a payment made against a purchase invoice.
|
||||
/// It is a subclass of TenantRelation, indicating that it is a relation between a tenant and the Marco PMS system.
|
||||
/// </summary>
|
||||
public class PurchaseInvoicePayment : TenantRelation
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the payment.
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the associated purchase invoice.
|
||||
/// </summary>
|
||||
public Guid InvoiceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the associated purchase invoice.
|
||||
/// This is a navigation property that allows access to the associated PurchaseInvoiceDetails object.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("InvoiceId")]
|
||||
public PurchaseInvoiceDetails? Invoice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date the payment was received.
|
||||
/// </summary>
|
||||
public DateTime PaymentReceivedDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the transaction ID of the payment.
|
||||
/// </summary>
|
||||
public string TransactionId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the amount of the payment.
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a comment about the payment.
|
||||
/// </summary>
|
||||
public string Comment { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the payment is active.
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the payment adjustment head.
|
||||
/// </summary>
|
||||
public Guid PaymentAdjustmentHeadId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the associated payment adjustment head.
|
||||
/// This is a navigation property that allows access to the associated PaymentAdjustmentHead object.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("PaymentAdjustmentHeadId")]
|
||||
public PaymentAdjustmentHead? PaymentAdjustmentHead { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time the record was created.
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the user who created the record.
|
||||
/// </summary>
|
||||
public Guid CreatedById { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user who created the record.
|
||||
/// This is a navigation property that allows access to the associated Employee object.
|
||||
/// </summary>
|
||||
[ValidateNever]
|
||||
[ForeignKey("CreatedById")]
|
||||
public Employee? CreatedBy { get; set; }
|
||||
}
|
||||
}
|
||||
11
Marco.Pms.Model/PurchaseInvoice/PurchaseInvoiceStatus.cs
Normal file
11
Marco.Pms.Model/PurchaseInvoice/PurchaseInvoiceStatus.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Marco.Pms.Model.PurchaseInvoice
|
||||
{
|
||||
public class PurchaseInvoiceStatus
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = default!;
|
||||
public string DisplayName { get; set; } = default!;
|
||||
public string Color { get; set; } = default!;
|
||||
public string Description { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@ -3644,7 +3644,6 @@ namespace Marco.Pms.Services.Service
|
||||
{
|
||||
// Fetch advance payment transactions for specified employee, including related navigation properties
|
||||
var transactions = await _context.AdvancePaymentTransactions
|
||||
.Include(apt => apt.Project)
|
||||
.Include(apt => apt.Employee).ThenInclude(e => e!.JobRole)
|
||||
.Include(apt => apt.CreatedBy).ThenInclude(e => e!.JobRole)
|
||||
.Where(apt => apt.EmployeeId == employeeId && apt.TenantId == tenantId && apt.IsActive)
|
||||
@ -3658,11 +3657,31 @@ namespace Marco.Pms.Services.Service
|
||||
return ApiResponse<object>.ErrorResponse("No advance payment transactions found.", null, 404);
|
||||
}
|
||||
|
||||
var projectIds = transactions.Select(pr => pr.ProjectId).ToList();
|
||||
|
||||
var infraProjectTask = Task.Run(async () =>
|
||||
{
|
||||
await using var context = await _dbContextFactory.CreateDbContextAsync();
|
||||
return await context.Projects.Where(p => projectIds.Contains(p.Id) && p.TenantId == tenantId).Select(p => _mapper.Map<BasicProjectVM>(p)).ToListAsync();
|
||||
});
|
||||
|
||||
var serviceProjectTask = Task.Run(async () =>
|
||||
{
|
||||
await using var context = await _dbContextFactory.CreateDbContextAsync();
|
||||
return await context.ServiceProjects.Where(sp => projectIds.Contains(sp.Id) && sp.TenantId == tenantId).Select(sp => _mapper.Map<BasicProjectVM>(sp)).ToListAsync();
|
||||
});
|
||||
|
||||
await Task.WhenAll(infraProjectTask, serviceProjectTask);
|
||||
|
||||
var projects = infraProjectTask.Result;
|
||||
projects.AddRange(serviceProjectTask.Result);
|
||||
|
||||
// Map transactions to view model with formatted FinanceUId
|
||||
var response = transactions.Select(transaction =>
|
||||
{
|
||||
var result = _mapper.Map<AdvancePaymentTransactionVM>(transaction);
|
||||
result.FinanceUId = $"{transaction.FinanceUIdPrefix}/{transaction.FinanceUIdPostfix:D5}";
|
||||
result.Project = projects.Where(p => p.Id == transaction.ProjectId).Select(p => _mapper.Map<BasicProjectVM>(p)).FirstOrDefault();
|
||||
return result;
|
||||
}).ToList();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user