3.0.0.7 Transactions

This commit is contained in:
Andy Howard
2025-02-17 17:44:30 +00:00
parent 797ad08e5d
commit fa01e0799a
87 changed files with 1865 additions and 549 deletions
@@ -7,6 +7,7 @@ using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.ReferenceData;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Base;
using Sarand.Net.Standard.Dbas.Data;
@@ -68,6 +69,41 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
return detailsAreReadOnly;
}
//-------------------------------------------------------------------
public override bool RefreshTransactionTotals(SbmTransaction transaction, IEnumerable<SbmRequirement> requirements)
{
ClearErrorState();
if (transaction == null) return SetErrorState(Msg_ItemNotSpecified);
if (requirements == null) requirements = new List<SbmRequirement>();
// Total weight.
decimal totalWeight = requirements.GetTotalWeight(Internals.GetDefaultUnitOfMeasureByCategory(SaUomCategory.Weight)?.Id);
transaction.Weight = totalWeight;
// Set the allocation status:
transaction.ClearAllocationStatus();
if (requirements.IsFullAllocation()) transaction.FullAllocation = true;
else if (requirements.IsPartialAllocation()) transaction.PartialAllocation = true;
// Calculate the totals from the list of requirements:
decimal totalAmountNet = 0.0m, totalAmountTax = 0.0m, totalAmountTot = 0.0m, totalTimeEst = 0.0m, totalTimeAct = 0.0m;
requirements.CalculateTotals(ref totalAmountNet, ref totalAmountTax, ref totalAmountTot, ref totalTimeEst, ref totalTimeAct);
// Include delivery amounts:
totalAmountNet += transaction.DeliveryAmountNet;
totalAmountTax += transaction.DeliveryAmountTax;
totalAmountTot += transaction.DeliveryAmountTot;
// Store amounts:
transaction.AmountNet = totalAmountNet;
transaction.AmountTax = totalAmountTax;
transaction.AmountTot = totalAmountTot;
transaction.TimeEst = totalTimeEst;
transaction.TimeAct = totalTimeAct;
return OK;
}
//-------------------------------------------------------------------
// Labour Cost.
public override decimal GetTransCostLabourRateHourDefault()