-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* search/getbyid routes * build rel self links, tests * lookup page * allow search by supplier id * Note page * wip * get all the data we need to print the credit note * remove un-needed AuthorisedAction * render debit note * delete temp file * typo * allow cancelling notes * add new line to eof * fix param name
- Loading branch information
1 parent
610fde2
commit 1e46e45
Showing
40 changed files
with
984 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 41 additions & 13 deletions
54
src/Facade/ResourceBuilders/PlCreditDebitNoteResourceBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,66 @@ | ||
namespace Linn.Purchasing.Facade.ResourceBuilders | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
using Linn.Common.Facade; | ||
using Linn.Common.Resources; | ||
using Linn.Purchasing.Domain.LinnApps.PurchaseOrders; | ||
using Linn.Purchasing.Resources; | ||
|
||
public class PlCreditDebitNoteResourceBuilder : IBuilder<PlCreditDebitNote> | ||
{ | ||
public PlCreditDebitNoteResource Build(PlCreditDebitNote note, IEnumerable<string> claims) | ||
{ | ||
return new PlCreditDebitNoteResource | ||
public PlCreditDebitNoteResource Build(PlCreditDebitNote note, IEnumerable<string> claims) | ||
{ | ||
return new PlCreditDebitNoteResource | ||
{ | ||
OrderQty = note.OrderQty, | ||
PartNumber = note.PartNumber, | ||
DateClosed = note.DateClosed?.ToString("o"), | ||
SupplierId = note.SupplierId, | ||
SupplierId = note.Supplier.SupplierId, | ||
ClosedBy = note.ClosedBy, | ||
NetTotal = note.NetTotal, | ||
NoteNumber = note.NoteNumber, | ||
OriginalOrderNumber = note.OriginalOrderNumber, | ||
OriginalOrderNumber = note.PurchaseOrder?.OrderNumber, | ||
ReturnsOrderNumber = note.ReturnsOrderNumber, | ||
ReturnsOrderLine = note.ReturnsOrderLine, | ||
Notes = note.Notes, | ||
SupplierName = note.Supplier?.Name, | ||
DateCreated = note.DateCreated.ToShortDateString() | ||
DateCreated = note.DateCreated.ToString("o"), | ||
NoteType = note.NoteType, | ||
SupplierFullAddress = note.Supplier.OrderFullAddress?.AddressString, | ||
OrderUnitOfMeasure = note.OrderUnitOfMeasure, | ||
OrderUnitPrice = note.OrderUnitPrice, | ||
Total = note.Total, | ||
VatTotal = note.VatTotal, | ||
SuppliersDesignation = note.SuppliersDesignation, | ||
OrderContactName = note.PurchaseOrder?.OrderContactName, | ||
SupplierAddress = note.Supplier.OrderFullAddress?.AddressString, | ||
Currency = note.Currency?.Name, | ||
OrderDetails = note.PurchaseOrder?.Details | ||
?.Select(d => new PurchaseOrderDetailResource | ||
{ | ||
Line = d.Line, | ||
PartNumber = d.Part?.PartNumber, | ||
PartDescription = d.Part?.Description | ||
}), | ||
VatRate = note.VatRate, | ||
Cancelled = note.CancelledBy.HasValue, | ||
Links = this.BuildLinks(note, claims).ToArray() | ||
}; | ||
} | ||
} | ||
|
||
public string GetLocation(PlCreditDebitNote p) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
public string GetLocation(PlCreditDebitNote p) | ||
{ | ||
return $"/purchasing/pl-credit-debit-notes/{p.NoteNumber}"; | ||
} | ||
|
||
object IBuilder<PlCreditDebitNote>.Build(PlCreditDebitNote entity, IEnumerable<string> claims) | ||
=> this.Build(entity, claims); | ||
|
||
object IBuilder<PlCreditDebitNote>.Build(PlCreditDebitNote entity, IEnumerable<string> claims) => this.Build(entity, claims); | ||
private IEnumerable<LinkResource> BuildLinks(PlCreditDebitNote model, IEnumerable<string> claims) | ||
{ | ||
yield return new LinkResource { Rel = "self", Href = this.GetLocation(model) }; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.