This commit is contained in:
@@ -99,6 +99,9 @@ namespace AyaNova.Api.Controllers
|
|||||||
[HttpGet("client")]
|
[HttpGet("client")]
|
||||||
public ActionResult GetClientGlobalBizSettings()
|
public ActionResult GetClientGlobalBizSettings()
|
||||||
{
|
{
|
||||||
|
//## NOTE: these are settings that the Client needs to see for standard operations
|
||||||
|
//NOT the settings that the user changes in the global settings form which is fetched above
|
||||||
|
//so do not include anything here unless the client needs it
|
||||||
if (serverState.IsClosed)
|
if (serverState.IsClosed)
|
||||||
{
|
{
|
||||||
//Exception for SuperUser account to handle licensing issues
|
//Exception for SuperUser account to handle licensing issues
|
||||||
|
|||||||
@@ -328,24 +328,39 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
if (ayaEvent == AyaEvent.Created)
|
if (ayaEvent == AyaEvent.Created)
|
||||||
{
|
{
|
||||||
//find and set effective contract if user didn't set it already
|
//CONTRACT AUTO SET
|
||||||
if (newObj.ContractId == null && newObj.CustomerId != 0)
|
if (newObj.ContractId == null && newObj.CustomerId != 0)
|
||||||
{
|
{
|
||||||
//customer->headoffice
|
//customer->headoffice
|
||||||
var cust = await ct.Customer.AsNoTracking().Where(z => z.Id == newObj.CustomerId).Select(z => new { headofficeId = z.HeadOfficeId, contractId = z.ContractId }).FirstOrDefaultAsync();
|
var cust = await ct.Customer.AsNoTracking().Where(z => z.Id == newObj.CustomerId).Select(z => new { headofficeId = z.HeadOfficeId, contractId = z.ContractId }).FirstOrDefaultAsync();
|
||||||
if(cust.contractId==null && cust.headofficeId!=null){
|
if (cust.contractId == null && cust.headofficeId != null)
|
||||||
var hoContractId=await ct.HeadOffice.AsNoTracking().Where(z => z.Id == cust.headofficeId).Select(z => z.ContractId).FirstOrDefaultAsync();
|
{
|
||||||
if(hoContractId!=null){
|
var hoContractId = await ct.HeadOffice.AsNoTracking().Where(z => z.Id == cust.headofficeId).Select(z => z.ContractId).FirstOrDefaultAsync();
|
||||||
newObj.ContractId=hoContractId;
|
if (hoContractId != null)
|
||||||
}
|
newObj.ContractId = hoContractId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newObj.ContractId = cust.contractId;
|
||||||
|
}
|
||||||
|
|
||||||
|
//RESPONSE TIME / COMPLETE BY AUTO SET
|
||||||
|
//precedence: manuall set -> contract -> global biz setting
|
||||||
|
if (newObj.CompleteByDate != null)
|
||||||
|
{
|
||||||
|
if (newObj.ContractId != null)
|
||||||
|
{
|
||||||
|
await GetCurrentContractFromContractIdAsync(newObj.ContractId);
|
||||||
|
if (mContractInEffect != null && mContractInEffect.ResponseTime != TimeSpan.Zero)
|
||||||
|
newObj.CompleteByDate = DateTime.UtcNow.Add(mContractInEffect.ResponseTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(AyaNova.Util.ServerGlobalBizSettings.WorkOrderCompleteByAge!=TimeSpan.Zero)
|
||||||
|
newObj.CompleteByDate = DateTime.UtcNow.Add(AyaNova.Util.ServerGlobalBizSettings.WorkOrderCompleteByAge);
|
||||||
|
|
||||||
}else{
|
|
||||||
newObj.ContractId=cust.contractId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//set default response time
|
|
||||||
todo: check contract if applied then check global if not
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
@@ -15,12 +16,10 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
internal static bool SearchCaseSensitiveOnly { get; set; }
|
internal static bool SearchCaseSensitiveOnly { get; set; }
|
||||||
internal static bool UseInventory { get; set; }
|
internal static bool UseInventory { get; set; }
|
||||||
//TAX CODE DEFAULTS
|
|
||||||
internal static long? TaxPartPurchaseId { get; set; }
|
internal static long? TaxPartPurchaseId { get; set; }
|
||||||
internal static long? TaxPartSaleId { get; set; }
|
internal static long? TaxPartSaleId { get; set; }
|
||||||
internal static long? TaxRateSaleId { get; set; }
|
internal static long? TaxRateSaleId { get; set; }
|
||||||
|
internal static TimeSpan WorkOrderCompleteByAge { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -47,6 +46,7 @@ namespace AyaNova.Util
|
|||||||
TaxPartPurchaseId = global.TaxPartPurchaseId;
|
TaxPartPurchaseId = global.TaxPartPurchaseId;
|
||||||
TaxPartSaleId = global.TaxPartSaleId;
|
TaxPartSaleId = global.TaxPartSaleId;
|
||||||
TaxRateSaleId = global.TaxRateSaleId;
|
TaxRateSaleId = global.TaxRateSaleId;
|
||||||
|
WorkOrderCompleteByAge=global.WorkOrderCompleteByAge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user