Browse Source

Added markup to Customer

Kenric Nugteren 2 days ago
parent
commit
d359f7688f

+ 1 - 1
prs.classes/Entities/Customer/Customer.cs

@@ -121,7 +121,7 @@ namespace Comal.Classes
         public double Balance { get; set; }
 
         [EditorSequence("Accounts", 8)]
-        [CurrencyEditor]
+        [DoubleEditor]
         public double Markup { get; set; }
 
         [NullEditor]

+ 2 - 1
prs.classes/Entities/Employee/EmployeeLink.cs

@@ -42,7 +42,7 @@ namespace Comal.Classes
         [CodeEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
         public string PayrollID { get; set; }
 
-        [CurrencyEditor]
+        [CurrencyEditor(Visible = Visible.Optional)]
         [Security(typeof(CanViewHourlyRates))]
         public double HourlyRate { get; set; }
         
@@ -55,6 +55,7 @@ namespace Comal.Classes
         [NullEditor]
         public DateTime RosterStart { get; set; }
 
+        [TextBoxEditor(Visible = Visible.Optional)]
         public string Email { get; set; }
         
         public LeaveRequestApprovalSetLink LeaveRequestApprovalSet { get; set; }

+ 7 - 7
prs.shared/Utilities/InvoiceUtilities.cs

@@ -116,20 +116,20 @@ public static class InvoiceUtilities
             }
             else
             {
-                var fixedcharge = activity.Charge.FixedCharge;
-                
                 var chargeperiod = !activity.Charge.ChargePeriod.Equals(TimeSpan.Zero)
                     ? activity.Charge.ChargePeriod
                     : TimeSpan.FromHours(1);
                 
                 var rounded = quantity.Ceiling(chargeperiod);
 
-                var multiplier = TimeSpan.FromHours(1).TotalHours / chargeperiod.TotalHours;
-                var rate = activity.Charge.ChargeRate * multiplier;
+                // Rate is charge per hour, so we must divide by the charge period time, to get dollars per hour, rather than dollars per period
+                // $/hr = ($/pd) * (pd/hr) = ($/pd) / (hr/pd)
+                // where $/pd is ChargeRate and hr/pd = chargeperiod.TotalHours
+                var rate = activity.Charge.ChargeRate / chargeperiod.TotalHours;
                 
-                var mincharge = activity.Charge.MinimumCharge;
-
-                charge = Math.Max(fixedcharge + (rounded.TotalHours * rate), mincharge);
+                charge = Math.Max(
+                    activity.Charge.FixedCharge + (rounded.TotalHours * rate),
+                    activity.Charge.MinimumCharge);
             }
 
             if(!timelines.TryGetValue(id, out var timeline))