This commit is contained in:
@@ -110,6 +110,9 @@ namespace AyaNova.Api.Controllers
|
|||||||
//Actual global settings:
|
//Actual global settings:
|
||||||
SearchCaseSensitiveOnly = AyaNova.Util.ServerGlobalBizSettings.SearchCaseSensitiveOnly,
|
SearchCaseSensitiveOnly = AyaNova.Util.ServerGlobalBizSettings.SearchCaseSensitiveOnly,
|
||||||
UseInventory = AyaNova.Util.ServerGlobalBizSettings.UseInventory,
|
UseInventory = AyaNova.Util.ServerGlobalBizSettings.UseInventory,
|
||||||
|
DefaultTaxPartSaleId = AyaNova.Util.ServerGlobalBizSettings.TaxPartSaleId,
|
||||||
|
DefaultTaxPartPurchaseId = AyaNova.Util.ServerGlobalBizSettings.TaxPartPurchaseId,
|
||||||
|
DefaultTaxRateSaleId = AyaNova.Util.ServerGlobalBizSettings.TaxRateSaleId,
|
||||||
//used to drive UI in case of unlicensed or attention required
|
//used to drive UI in case of unlicensed or attention required
|
||||||
LicenseStatus = AyaNova.Core.License.ActiveKey.Status,
|
LicenseStatus = AyaNova.Core.License.ActiveKey.Status,
|
||||||
MaintenanceExpired = AyaNova.Core.License.ActiveKey.MaintenanceExpired,
|
MaintenanceExpired = AyaNova.Core.License.ActiveKey.MaintenanceExpired,
|
||||||
|
|||||||
@@ -225,18 +225,39 @@ namespace AyaNova.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//VALIDATION
|
//VALIDATION
|
||||||
//
|
//
|
||||||
|
|
||||||
private async Task ValidateAsync(TaxCode proposedObj, TaxCode currentObj)
|
private async Task ValidateAsync(TaxCode proposedObj, TaxCode currentObj)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
bool isGlobalDefault = (!isNew
|
||||||
|
&& ServerGlobalBizSettings.TaxPartPurchaseId == proposedObj.Id
|
||||||
|
|| ServerGlobalBizSettings.TaxPartSaleId == proposedObj.Id
|
||||||
|
|| ServerGlobalBizSettings.TaxRateSaleId == proposedObj.Id);
|
||||||
|
|
||||||
|
|
||||||
|
if (!isNew
|
||||||
|
&& proposedObj.Name != currentObj.Name
|
||||||
|
|| proposedObj.TaxA != currentObj.TaxA
|
||||||
|
|| proposedObj.TaxB != currentObj.TaxB
|
||||||
|
|| proposedObj.TaxOnTax != currentObj.TaxOnTax)
|
||||||
|
{
|
||||||
|
//MIGRATE_OUTSTANDING - check workorder records once wo is coded here for this tax code in use
|
||||||
|
|
||||||
|
if (await ct.PurchaseOrderItem.AnyAsync(x => x.PurchaseTaxCodeId == proposedObj.Id))
|
||||||
|
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("PurchaseOrder"));
|
||||||
|
|
||||||
|
if (isGlobalDefault)
|
||||||
|
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("AdministrationGlobalSettings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Active not changeable for global default
|
||||||
|
if (isGlobalDefault && proposedObj.Active == false)
|
||||||
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Active", await Translate("TaxCodeDefault"));
|
||||||
|
|
||||||
//Name required
|
//Name required
|
||||||
if (string.IsNullOrWhiteSpace(proposedObj.Name))
|
if (string.IsNullOrWhiteSpace(proposedObj.Name))
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//If name is otherwise OK, check that name is unique
|
//If name is otherwise OK, check that name is unique
|
||||||
if (!PropertyHasErrors("Name"))
|
if (!PropertyHasErrors("Name"))
|
||||||
{
|
{
|
||||||
@@ -247,10 +268,6 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//MIGRATE_OUTSTANDING - Biz rule needs porting
|
|
||||||
//BrokenRules.Assert("DefaultMustBeActive", "TaxCode.Error.Default","Active",value==false && AyaBizUtils.GlobalSettings.TaxCodeIsADefault(this.mID));
|
|
||||||
|
|
||||||
|
|
||||||
//Any form customizations to validate?
|
//Any form customizations to validate?
|
||||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(x => x.FormKey == AyaType.TaxCode.ToString());
|
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(x => x.FormKey == AyaType.TaxCode.ToString());
|
||||||
if (FormCustomization != null)
|
if (FormCustomization != null)
|
||||||
@@ -263,7 +280,6 @@ namespace AyaNova.Biz
|
|||||||
//validate custom fields
|
//validate custom fields
|
||||||
CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ValidateCanDeleteAsync(TaxCode inObj)
|
private async Task ValidateCanDeleteAsync(TaxCode inObj)
|
||||||
@@ -272,6 +288,11 @@ namespace AyaNova.Biz
|
|||||||
//FOREIGN KEY CHECKS
|
//FOREIGN KEY CHECKS
|
||||||
if (await ct.PurchaseOrderItem.AnyAsync(m => m.PurchaseTaxCodeId == inObj.Id))
|
if (await ct.PurchaseOrderItem.AnyAsync(m => m.PurchaseTaxCodeId == inObj.Id))
|
||||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("PurchaseOrder"));
|
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("PurchaseOrder"));
|
||||||
|
|
||||||
|
if (ServerGlobalBizSettings.TaxPartPurchaseId == inObj.Id
|
||||||
|
|| ServerGlobalBizSettings.TaxPartSaleId == inObj.Id
|
||||||
|
|| ServerGlobalBizSettings.TaxRateSaleId == inObj.Id)
|
||||||
|
AddError(ApiErrorCode.INVALID_OPERATION, "generalerror", await Translate("TaxCodeDefault"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ namespace AyaNova.Models
|
|||||||
public bool SearchCaseSensitiveOnly { get; set; }
|
public bool SearchCaseSensitiveOnly { get; set; }
|
||||||
public bool UseInventory { get; set; }
|
public bool UseInventory { get; set; }
|
||||||
|
|
||||||
|
//TAX CODE DEFAULTS
|
||||||
|
public long? TaxPartPurchaseId {get;set;}
|
||||||
|
public long? TaxPartSaleId {get;set;}
|
||||||
|
public long? TaxRateSaleId {get;set;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public GlobalBizSettings()
|
public GlobalBizSettings()
|
||||||
|
|||||||
@@ -760,7 +760,7 @@
|
|||||||
"PurchaseOrderReceiptItemPurchaseOrderReceiptID": "Einkaufsauftragseingang",
|
"PurchaseOrderReceiptItemPurchaseOrderReceiptID": "Einkaufsauftragseingang",
|
||||||
"PurchaseOrderReceiptItemQuantityReceived": "Empfangene Menge",
|
"PurchaseOrderReceiptItemQuantityReceived": "Empfangene Menge",
|
||||||
"PurchaseOrderReceiptItemQuantityReceivedErrorInvalid": "Der Eintrag muss gleich oder kleiner dem ausstehenden Betrag vom Einkaufsauftrag oder positiv sein",
|
"PurchaseOrderReceiptItemQuantityReceivedErrorInvalid": "Der Eintrag muss gleich oder kleiner dem ausstehenden Betrag vom Einkaufsauftrag oder positiv sein",
|
||||||
"PurchaseOrderReceiptItemReceiptCost": "Ist-Kosten",
|
"PurchaseOrderReceiptItemReceiptCost": "Erhaltene Kosten",
|
||||||
"PurchaseOrderReceiptItemReferenceNumber": "Referenz",
|
"PurchaseOrderReceiptItemReferenceNumber": "Referenz",
|
||||||
"PurchaseOrderReceiptItemWarehouseID": "Teilelager",
|
"PurchaseOrderReceiptItemWarehouseID": "Teilelager",
|
||||||
"PurchaseOrderReceiptItemWorkOrderNumber": "Arbeitsauftragsnummer",
|
"PurchaseOrderReceiptItemWorkOrderNumber": "Arbeitsauftragsnummer",
|
||||||
|
|||||||
@@ -760,7 +760,7 @@
|
|||||||
"PurchaseOrderReceiptItemPurchaseOrderReceiptID": "Purchase Order Receipt",
|
"PurchaseOrderReceiptItemPurchaseOrderReceiptID": "Purchase Order Receipt",
|
||||||
"PurchaseOrderReceiptItemQuantityReceived": "Quantity Received",
|
"PurchaseOrderReceiptItemQuantityReceived": "Quantity Received",
|
||||||
"PurchaseOrderReceiptItemQuantityReceivedErrorInvalid": "Entry must be equal or less than outstanding amount from purchase order and non-negative",
|
"PurchaseOrderReceiptItemQuantityReceivedErrorInvalid": "Entry must be equal or less than outstanding amount from purchase order and non-negative",
|
||||||
"PurchaseOrderReceiptItemReceiptCost": "Actual Cost",
|
"PurchaseOrderReceiptItemReceiptCost": "Received Cost",
|
||||||
"PurchaseOrderReceiptItemReferenceNumber": "Reference",
|
"PurchaseOrderReceiptItemReferenceNumber": "Reference",
|
||||||
"PurchaseOrderReceiptItemWarehouseID": "Part Warehouse",
|
"PurchaseOrderReceiptItemWarehouseID": "Part Warehouse",
|
||||||
"PurchaseOrderReceiptItemWorkOrderNumber": "WorkOrder #",
|
"PurchaseOrderReceiptItemWorkOrderNumber": "WorkOrder #",
|
||||||
|
|||||||
@@ -759,7 +759,7 @@
|
|||||||
"PurchaseOrderReceiptItemPurchaseOrderReceiptID": "Recibo orden de compra",
|
"PurchaseOrderReceiptItemPurchaseOrderReceiptID": "Recibo orden de compra",
|
||||||
"PurchaseOrderReceiptItemQuantityReceived": "Cantidad recibida",
|
"PurchaseOrderReceiptItemQuantityReceived": "Cantidad recibida",
|
||||||
"PurchaseOrderReceiptItemQuantityReceivedErrorInvalid": "La entrada debe ser igual o inferior a la cantidad restante de la orden de compra y no negativa",
|
"PurchaseOrderReceiptItemQuantityReceivedErrorInvalid": "La entrada debe ser igual o inferior a la cantidad restante de la orden de compra y no negativa",
|
||||||
"PurchaseOrderReceiptItemReceiptCost": "Coste real",
|
"PurchaseOrderReceiptItemReceiptCost": "Costo recibido",
|
||||||
"PurchaseOrderReceiptItemReferenceNumber": "Referencia",
|
"PurchaseOrderReceiptItemReferenceNumber": "Referencia",
|
||||||
"PurchaseOrderReceiptItemWarehouseID": "Almacén de la pieza",
|
"PurchaseOrderReceiptItemWarehouseID": "Almacén de la pieza",
|
||||||
"PurchaseOrderReceiptItemWorkOrderNumber": "Núm. pedido",
|
"PurchaseOrderReceiptItemWorkOrderNumber": "Núm. pedido",
|
||||||
|
|||||||
@@ -760,7 +760,7 @@
|
|||||||
"PurchaseOrderReceiptItemPurchaseOrderReceiptID": "Reçu de bon de commande",
|
"PurchaseOrderReceiptItemPurchaseOrderReceiptID": "Reçu de bon de commande",
|
||||||
"PurchaseOrderReceiptItemQuantityReceived": "Quantité réceptionnée",
|
"PurchaseOrderReceiptItemQuantityReceived": "Quantité réceptionnée",
|
||||||
"PurchaseOrderReceiptItemQuantityReceivedErrorInvalid": "Cette entrée doit être positive et égale ou inférieure à l'encours du bon de commande",
|
"PurchaseOrderReceiptItemQuantityReceivedErrorInvalid": "Cette entrée doit être positive et égale ou inférieure à l'encours du bon de commande",
|
||||||
"PurchaseOrderReceiptItemReceiptCost": "Coût réel",
|
"PurchaseOrderReceiptItemReceiptCost": "Coût reçu",
|
||||||
"PurchaseOrderReceiptItemReferenceNumber": "Référence",
|
"PurchaseOrderReceiptItemReferenceNumber": "Référence",
|
||||||
"PurchaseOrderReceiptItemWarehouseID": "Magasin de pièces",
|
"PurchaseOrderReceiptItemWarehouseID": "Magasin de pièces",
|
||||||
"PurchaseOrderReceiptItemWorkOrderNumber": "Bon de travail n° ",
|
"PurchaseOrderReceiptItemWorkOrderNumber": "Bon de travail n° ",
|
||||||
|
|||||||
@@ -236,8 +236,11 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
//create global biz settings table
|
//create global biz settings table
|
||||||
await ExecQueryAsync("CREATE TABLE aglobalbizsettings (id INTEGER NOT NULL PRIMARY KEY, "
|
await ExecQueryAsync("CREATE TABLE aglobalbizsettings (id INTEGER NOT NULL PRIMARY KEY, "
|
||||||
+ "searchcasesensitiveonly BOOL default false, "
|
+ "searchcasesensitiveonly BOOL DEFAULT FALSE, "
|
||||||
+ "useinventory BOOL default true "
|
+ "useinventory BOOL DEFAULT TRUE, "
|
||||||
|
+ "taxpartpurchaseid BIGINT, "
|
||||||
|
+ "taxpartsaleid BIGINT, "
|
||||||
|
+ "taxratesaleid BIGINT "
|
||||||
+ ")");
|
+ ")");
|
||||||
|
|
||||||
//create global ops BACKUP settings table
|
//create global ops BACKUP settings table
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
@@ -18,9 +14,14 @@ 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? TaxPartSaleId { get; set; }
|
||||||
|
internal static long? TaxRateSaleId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Populate and / or create the settings
|
/// Populate and / or create the settings
|
||||||
@@ -43,6 +44,9 @@ namespace AyaNova.Util
|
|||||||
//We have the object, now copy the static values here
|
//We have the object, now copy the static values here
|
||||||
SearchCaseSensitiveOnly = global.SearchCaseSensitiveOnly;
|
SearchCaseSensitiveOnly = global.SearchCaseSensitiveOnly;
|
||||||
UseInventory = global.UseInventory;
|
UseInventory = global.UseInventory;
|
||||||
|
TaxPartPurchaseId = global.TaxPartPurchaseId;
|
||||||
|
TaxPartSaleId = global.TaxPartSaleId;
|
||||||
|
TaxRateSaleId = global.TaxRateSaleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user