Преглед на файлове

Little tweaks to project invoicing

Kenric Nugteren преди 2 седмици
родител
ревизия
cb89ff06fa
променени са 1 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 6 2
      prs.shared/Utilities/InvoiceUtilities.cs

+ 6 - 2
prs.shared/Utilities/InvoiceUtilities.cs

@@ -74,6 +74,7 @@ public static class InvoiceUtilities
                     .Add(x => x.ActivityLink.ID)
                     .Add(x => x.ActivityLink.Description)
                     .Add(x => x.Date)
+                    .Add(x => x.Title)
                     .Add(x => x.Description)
                     .Add(x => x.Charge.OverrideCharge)
                     .Add(x => x.Charge.Charge)
@@ -96,7 +97,7 @@ public static class InvoiceUtilities
 
             var description = timesummary switch
             {
-                InvoiceTimeCalculation.Detailed => string.Format("{0:dd MMM yy} - {1}", assignment.Date, assignment.Description),
+                InvoiceTimeCalculation.Detailed => $"{assignment.Date:dd MMM yy} - {assignment.Title}: {assignment.Description}",
                 InvoiceTimeCalculation.Activity => assignment.ActivityLink.Description,
                 _ => "Labour"
             };
@@ -120,6 +121,8 @@ public static class InvoiceUtilities
                     ? activity.Charge.ChargePeriod
                     : TimeSpan.FromHours(1);
                 
+                // Here we adjust the period, essentially; should this update the actual 'quantity' we are using for this line?
+                // It seems no, but just checking.
                 var rounded = quantity.Ceiling(chargeperiod);
 
                 // Rate is charge per hour, so we must divide by the charge period time, to get dollars per hour, rather than dollars per period
@@ -220,7 +223,7 @@ public static class InvoiceUtilities
             
             var quantity = item.Charge.OverrideQuantity
                 ? item.Charge.Quantity
-                : item.Qty;
+                : item.Qty; // Should this be 'Cost' instead? Also, this will give negative cost for transfer outs and issues. Doesn't seem right.
             
             var product = 
                 products.GetValueOrDefault((invoice.CustomerLink.ID, item.Product.ID))?.FirstOrDefault()
@@ -234,6 +237,7 @@ public static class InvoiceUtilities
             }
             else
             {
+                // Or perhaps should this be multiplying 'Cost' here?
                 charge = quantity * (product.Charge.PriceType switch
                 {
                     ProductPriceType.CostPlus => 1 + product.Charge.Markup / 100,