Переглянути джерело

Added comments to the InvoiceUtilities calculations

Kenric Nugteren 2 тижнів тому
батько
коміт
32d52cb7c1
1 змінених файлів з 5 додано та 2 видалено
  1. 5 2
      prs.shared/Utilities/InvoiceUtilities.cs

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

@@ -123,6 +123,8 @@ public static class InvoiceUtilities
                 
                 // Here we adjust the period, essentially; should this update the actual 'quantity' we are using for this line?
                 // It seems no, but just checking.
+
+                // Yes, round up actual quantity.
                 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,10 +222,12 @@ public static class InvoiceUtilities
                 InvoiceMaterialCalculation.CostCentre => item.Product.CostCentre.Description,
                 _ => "Materials"
             };
+
+            // Quantity only to be used for the actual invoice line quantity if in Detailed version.
             
             var quantity = item.Charge.OverrideQuantity
                 ? item.Charge.Quantity
-                : item.Qty; // Should this be 'Cost' instead? Also, this will give negative cost for transfer outs and issues. Doesn't seem right.
+                : item.Qty; // Should this be 'Cost' instead? Also, this will give negative cost for transfer outs and issues. Doesn't seem right. If InvoiceOnIssue, make it negative.
             
             var product = 
                 products.GetValueOrDefault((invoice.CustomerLink.ID, item.Product.ID))?.FirstOrDefault()
@@ -237,7 +241,6 @@ 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,