Prvi commit
This commit is contained in:
80
EveryThing/Models/Invoice/InvoiceItem.cs
Normal file
80
EveryThing/Models/Invoice/InvoiceItem.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static EveryThing.Models.Invoice.Invoice;
|
||||
|
||||
namespace EveryThing.Models.Invoice
|
||||
{
|
||||
public class InvoiceItem
|
||||
{
|
||||
public enum InvoiceItemState
|
||||
{
|
||||
[Display(Name = "Novo")]
|
||||
New = 0,
|
||||
[Display(Name = "Potrjeno")]
|
||||
Confirmed = 10,
|
||||
[Display(Name = "Zaprto")]
|
||||
Closed = 50
|
||||
}
|
||||
|
||||
[Key]
|
||||
public int IdInvoiceItem { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey("Invoice")]
|
||||
public int IdInvoiceFk { get; set; }
|
||||
|
||||
[ForeignKey("ProjectPartItem")]
|
||||
public int? IdProjectPartItem { get; set; }
|
||||
|
||||
[ForeignKey("Item")]
|
||||
[Display(Name = "Artikel")]
|
||||
public int? IdItemFk { get; set; }
|
||||
|
||||
[ForeignKey("InvoiceItemJoin")]
|
||||
[Display(Name = "Pozicija")]
|
||||
public int? IdInvoiceItemJoinFk { get; set; }
|
||||
|
||||
[Display(Name = "Opis pozicije")]
|
||||
public string ItemDescription { get; set; }
|
||||
|
||||
[Display(Name = "Opomba")]
|
||||
public string Note { get; set; }
|
||||
|
||||
[Display(Name = "Količina")]
|
||||
[DisplayFormat(DataFormatString = "{0:#,###,##0.00}", ApplyFormatInEditMode = true)]
|
||||
public double Quantity { get; set; }
|
||||
|
||||
[Display(Name = "Cena")]
|
||||
[DisplayFormat(DataFormatString = "{0:#,###,##0.00}", ApplyFormatInEditMode = true)]
|
||||
public double Price { get; set; }
|
||||
|
||||
[Display(Name = "Rabat")]
|
||||
[DisplayFormat(DataFormatString = "{0:#,###,##0.00}", ApplyFormatInEditMode = true)]
|
||||
public double Discount { get; set; }
|
||||
|
||||
[Display(Name = "DDV")]
|
||||
public double Tax { get; set; }
|
||||
|
||||
[Required]
|
||||
[Display(Name = "Status")]
|
||||
public InvoiceItemState State { get; set; } = InvoiceItemState.New;
|
||||
|
||||
[NotMapped]
|
||||
[Display(Name = "Skupaj")]
|
||||
[DisplayFormat(DataFormatString = "{0:#,###,##0.00}", ApplyFormatInEditMode = true)]
|
||||
public double TotalValue => Math.Round((Price * (100 - Discount) / 100) * Quantity, 2);
|
||||
|
||||
// ForeignKey
|
||||
public Invoice Invoice { get; set; }
|
||||
|
||||
public Project.ProjectPartItem ProjectPartItem { get; set; }
|
||||
|
||||
public CodeTable.CodeTableItem Item { get; set; }
|
||||
/// <summary>
|
||||
/// Povezana pozicija fakture, npr ko se iz dob naredi racun
|
||||
/// </summary>
|
||||
public InvoiceItem InvoiceItemJoin { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user