1040 lines
43 KiB
C#
1040 lines
43 KiB
C#
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
|
using Sarand.BusinessMgr.Net.Standard.Base.Procs;
|
|
using Sarand.Net.Standard.Accounts.QuickBooks.App;
|
|
using Sarand.Net.Standard.Accounts.Sage.App;
|
|
using Sarand.Net.Standard.Base.App;
|
|
using Sarand.Net.Standard.Base.Bus;
|
|
using Sarand.Net.Standard.Base.Core;
|
|
using Sarand.Net.Standard.Base.Interfaces;
|
|
using Sarand.Net.Standard.Base.ItemOptions;
|
|
using Sarand.Net.Standard.Base.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
|
{
|
|
//=======================================================================
|
|
public class SbmConfigConsole : SacsDisposable
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Interface definition.
|
|
public class InterfaceDfn
|
|
{
|
|
public InterfaceDfn()
|
|
{
|
|
}
|
|
public SysId InterfaceId { get; } = new SysId();
|
|
public String Context { get; } = "";
|
|
public SaInterfaceCategory InterfaceCategory { get; } = SaInterfaceCategory.Unknown;
|
|
public short InterfaceType { get; }
|
|
public String Code { get; } = "";
|
|
public String Caption { get; } = "";
|
|
public bool Active { get; }
|
|
}
|
|
// Sage/Quickbooks interface definition.
|
|
public class AccountsInterfaceDfn
|
|
{
|
|
public SysId AffiliateId_Owner { get; set; } = new SysId(); // Owner for Sage Interface definition.
|
|
public SysId InterfaceId { get; set; } = new SysId();
|
|
public bool importPurchaseOrder, importSalesOrder, importProductInvoice, importServiceInvoice, importSalesOrderInvoice;
|
|
public bool exportPurchaseOrder, exportSalesOrder, exportProductInvoice, exportServiceInvoice, bexport_SalesOrderInvoice;
|
|
public AccountsInterfaceDfn()
|
|
{
|
|
Reset();
|
|
}
|
|
public void Reset()
|
|
{
|
|
AffiliateId_Owner = new SysId();
|
|
InterfaceId = new SysId();
|
|
ClearConfig();
|
|
}
|
|
public void ClearConfig()
|
|
{
|
|
importPurchaseOrder = false;
|
|
importSalesOrder = false;
|
|
importProductInvoice = false;
|
|
importServiceInvoice = false;
|
|
importSalesOrderInvoice = false;
|
|
exportPurchaseOrder = false;
|
|
exportSalesOrder = false;
|
|
exportProductInvoice = false;
|
|
exportServiceInvoice = false;
|
|
bexport_SalesOrderInvoice = false;
|
|
}
|
|
};
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private List<TypeCodeDesc> transactionTypes_Full = new List<TypeCodeDesc>();
|
|
private SbmAccountsDfn accountsDfn;
|
|
private AccountsInterfaceDfn dfnSageInt = new AccountsInterfaceDfn();
|
|
private AccountsInterfaceDfn dfnQBooksInt = new AccountsInterfaceDfn();
|
|
private bool createTransaction_PurchaseOrder, createTransaction_SalesQuote, createTransaction_SalesOrder, createTrans_SalesInvoice;
|
|
private bool productionControl;
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
protected SbmConfigConsole(Sbm.ConfigConsole configConsole, SbmVersion consoleVersion, SbmSessionContext sessionContext)
|
|
{
|
|
ConfigConsole = configConsole;
|
|
AppVersion = new SbmVersion("BusinessMgr", Sbm.Version, SbmSystem.AssemblyBuildAt);
|
|
ConsoleVersion = consoleVersion;
|
|
SessionContext = sessionContext;
|
|
}
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing)
|
|
{
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public Sbm.ConfigConsole ConfigConsole { get; }
|
|
public SbmSessionContext SessionContext { get; }
|
|
public SbmVersion AppVersion { get; }
|
|
public SbmVersion ConsoleVersion { get; }
|
|
|
|
//-------------------------------------------------------------------
|
|
// C r e a t e C o n s o l e
|
|
//-------------------------------------------------------------------
|
|
public static SbmConfigConsole CreateConsole(SbmSessionContext sessionContext)
|
|
{
|
|
String fn = "SbmConfigConsole.CreateConsole";
|
|
SaLogger.Warn(fn + ".CreateConsole Creating default configuration console.");
|
|
// Default console.
|
|
SbmVersion consoleVersion = new SbmVersion("Standard", Sbm.Version, SbmSystem.AssemblyBuildAt);
|
|
return new SbmConfigConsole(Sbm.ConfigConsole.Generic, consoleVersion, sessionContext);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Utilities.
|
|
|
|
//-------------------------------------------------------------------
|
|
// A p p l i c a t i o n
|
|
//-------------------------------------------------------------------
|
|
// Application Customisation.
|
|
public virtual String GetApplicationCaption(Sbm.CaptionType captionType)
|
|
{
|
|
return "BusinessMgr";
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Additional menu options.
|
|
public virtual List<CodeDesc> GetAdditionalMenuOptions(Sbm.MenuSection menuSection)
|
|
{
|
|
return new List<CodeDesc>();
|
|
}
|
|
|
|
public virtual bool DoAdditionalMenuOption(Sbm.MenuSection menuSection, String str)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Console view.
|
|
public virtual SbmConsoleViewDfn GetConsoleViewDfn()
|
|
{
|
|
return new SbmConsoleViewDfn();
|
|
}
|
|
public virtual bool InitialiseConsoleView()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Application Configuration. - AllowOption.
|
|
public virtual bool AllowOption(SbmUserContext userContext, Sbm.ConfigOption option)
|
|
{
|
|
switch (option)
|
|
{
|
|
// Application.
|
|
case Sbm.ConfigOption.SystemMenu:
|
|
return SacsSystem.DebugMode;
|
|
case Sbm.ConfigOption.AllowConsoleView:
|
|
case Sbm.ConfigOption.AllowOrganisationUpdate:
|
|
case Sbm.ConfigOption.AllowContacts:
|
|
case Sbm.ConfigOption.AllowProcesses:
|
|
case Sbm.ConfigOption.AllowCommodities:
|
|
case Sbm.ConfigOption.AllowTransactions:
|
|
case Sbm.ConfigOption.DiaryView:
|
|
case Sbm.ConfigOption.AllowRequirementUpdateInline:
|
|
return true;
|
|
// Commodities.
|
|
case Sbm.ConfigOption.CommodityPartialCodeFilter:
|
|
//return true;
|
|
return userContext.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.Commodity_PartialCodeFilter);
|
|
// Order Pricing.
|
|
case Sbm.ConfigOption.CustomerPriceSet:
|
|
case Sbm.ConfigOption.CustomerDiscount:
|
|
{
|
|
if (accountsDfn == null) accountsDfn = new SbmAccountsDfn(userContext);
|
|
return accountsDfn.IsUsingSageInterface() && accountsDfn.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Customer) && !accountsDfn.UseLocalCustomerPricing();
|
|
}
|
|
case Sbm.ConfigOption.SupplierPriceSet:
|
|
case Sbm.ConfigOption.SupplierDiscount:
|
|
{
|
|
SbmAccountsDfn account = null;
|
|
return account.IsUsingSageInterface() && account.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Supplier) && !account.UseLocalSupplierPricing();
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Application events.
|
|
public virtual void OnOpenDatabase()
|
|
{
|
|
String fn = GetType().Name + ".OnOpenDatabase";
|
|
SaLogger.Trace(fn);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// O r g a n i s a t i o n
|
|
//-------------------------------------------------------------------
|
|
// Allows validation of organisation name is required. Default: true.
|
|
public virtual bool OwnerIsValid()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Organisation Options.
|
|
public virtual List<SaItemOptionDfn> GetAdditionalOrganisationOptions()
|
|
{
|
|
return new List<SaItemOptionDfn>();
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// C o d e T y p e s
|
|
//-------------------------------------------------------------------
|
|
// Application Code Types.
|
|
public virtual List<CodeDesc> GetDefaultCodesOfType(Sbm.ApplCodeType type)
|
|
{
|
|
List<CodeDesc> codes = new List<CodeDesc>();
|
|
switch (type)
|
|
{
|
|
case Sbm.ApplCodeType.ContactTitle:
|
|
codes.Add("Mr", "Mr");
|
|
codes.Add("Mrs", "Mrs");
|
|
codes.Add("Ms", "Ms");
|
|
codes.Add("Miss", "Miss");
|
|
codes.Add("Mx", "Mx");
|
|
codes.Add("Dr", "Dr");
|
|
break;
|
|
case Sbm.ApplCodeType.VehicleCategory:
|
|
/*
|
|
codes.Add("10", "Mini");
|
|
codes.Add("11", "Economy");
|
|
codes.Add("12", "Compact");
|
|
codes.Add("20", "Hatchback");
|
|
codes.Add("21", "Saloon");
|
|
codes.Add("22", "Estate");
|
|
codes.Add("30", "Executive");
|
|
codes.Add("50", "Intermediate");
|
|
codes.Add("51", "Standard");
|
|
codes.Add("52", "Full Size");
|
|
*/
|
|
break;
|
|
case Sbm.ApplCodeType.VehicleMake:
|
|
/*
|
|
codes.Add("ACUR", "Acura");
|
|
codes.Add("ALFA", "Alfa Romeo");
|
|
codes.Add("ASTO", "Aston Martin");
|
|
codes.Add("AUDI", "Audi");
|
|
codes.Add("BMW", "BMW");
|
|
codes.Add("BENT", "Bentley");
|
|
codes.Add("BUIC", "Buick");
|
|
codes.Add("CADI", "Cadillac");
|
|
codes.Add("CATE", "Caterham");
|
|
codes.Add("CHEV", "Chevrolet");
|
|
codes.Add("CHRY", "Chrysler");
|
|
codes.Add("CITR", "Citroen");
|
|
codes.Add("DAEW", "Daewoo");
|
|
codes.Add("DAF", "DAF");
|
|
codes.Add("DAIH", "Daihatsu");
|
|
codes.Add("DODG", "Dodge");
|
|
codes.Add("FERR", "Ferrari");
|
|
codes.Add("FIAT", "Fiat");
|
|
codes.Add("FORD", "Ford");
|
|
codes.Add("GENE", "General Motors");
|
|
codes.Add("GEO", "Geo");
|
|
codes.Add("GIBB", "Gibbs");
|
|
codes.Add("HOND", "Honda");
|
|
codes.Add("HYUN", "Hyundai");
|
|
codes.Add("INFI", "Infiniti");
|
|
codes.Add("ISUZ", "Isuzu");
|
|
codes.Add("JAGU", "Jaguar");
|
|
codes.Add("JEEP", "Jeep");
|
|
codes.Add("JENS", "Jensen");
|
|
codes.Add("KIA", "Kia");
|
|
codes.Add("LDV", "LDV");
|
|
codes.Add("LAND", "Land Rover");
|
|
codes.Add("LEXU", "Lexus");
|
|
codes.Add("LINC", "Lincoln");
|
|
codes.Add("LOTU", "Lotus");
|
|
codes.Add("MG R", "MG Rover");
|
|
codes.Add("MAZD", "Mazda");
|
|
codes.Add("MERB", "Mercedes");
|
|
codes.Add("MERC", "Mercury");
|
|
codes.Add("MINI", "Mini");
|
|
codes.Add("MITS", "Mitsubishi");
|
|
codes.Add("MORG", "Morgan");
|
|
codes.Add("NISS", "Nissan");
|
|
codes.Add("OLDS", "Oldsmobile");
|
|
codes.Add("OPEL", "Opel");
|
|
codes.Add("PEUG", "Peugeot");
|
|
codes.Add("PLYM", "Plymouth");
|
|
codes.Add("PONT", "Pontiac");
|
|
codes.Add("PORS", "Porsche");
|
|
codes.Add("RENA", "Renault");
|
|
codes.Add("ROLL", "Rolls Royce");
|
|
codes.Add("ROVE", "Rover");
|
|
codes.Add("SAAB", "Saab");
|
|
codes.Add("SATU", "Saturn");
|
|
codes.Add("SEAT", "Seat");
|
|
codes.Add("SKOD", "Skoda");
|
|
codes.Add("SMAR", "Smart");
|
|
codes.Add("SMIT", "Smith Electric Vehicles");
|
|
codes.Add("SSAN", "SsangYong (Syuk Cars)");
|
|
codes.Add("SUBA", "Subaru");
|
|
codes.Add("SUZU", "Suzuki");
|
|
codes.Add("TVR", "TVR");
|
|
codes.Add("TATA", "Tata");
|
|
codes.Add("TOYO", "Toyota");
|
|
codes.Add("VAUX", "Vauxhall");
|
|
codes.Add("VOLK", "Volkswagen");
|
|
codes.Add("VOLV", "Volvo");
|
|
*/
|
|
break;
|
|
case Sbm.ApplCodeType.VehicleServiceHistory:
|
|
/*
|
|
codes.Add("FMDSH", "Full main dealer service history");
|
|
codes.Add("FSH", "Full service history");
|
|
*/
|
|
break;
|
|
case Sbm.ApplCodeType.VehicleInsurance:
|
|
break;
|
|
}
|
|
return codes;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// I t e m s
|
|
//-------------------------------------------------------------------
|
|
// Item Data Interface.
|
|
public virtual bool CanUpdateItemData(SbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool DoUpdateItemData(SbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool CanRemoveItemData(SbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Update Log.
|
|
public virtual bool IsColumnChangeLogged(SbmUserContext userContext, SbmDbDfn.ColumnIdx column)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Item Events.
|
|
public virtual bool OnItemEvent(Sbm.ItemEvent itemEvent, Sbm.ItemType itemType, SysId id)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// A l l o w T y p e s
|
|
//-------------------------------------------------------------------
|
|
// Supported Data Item Types.
|
|
// Supported affiliate types (all allowed by default).
|
|
public virtual bool AllowAffiliateType(SbmUserContext userContext, Sbm.AffiliateType type)
|
|
{
|
|
return true;
|
|
}
|
|
// Supported Association types (all allowed by default).
|
|
public virtual bool AllowAssociationType(SbmUserContext userContext, Sbm.AssociationType type)
|
|
{
|
|
return true;
|
|
}
|
|
// Supported Transaction types.
|
|
public virtual bool AllowTransactionType(SbmUserContext userContext, Sbm.TransactionType type)
|
|
{
|
|
switch (type)
|
|
{
|
|
// Transaction types that are allowed.
|
|
case Sbm.TransactionType.SalesQuote:
|
|
case Sbm.TransactionType.SalesOrder:
|
|
//case Sbm.TransactionType.PurchaseOrder:
|
|
return true;
|
|
|
|
// Proforma types are only allowed if ther counterparts cannot be created.
|
|
case Sbm.TransactionType.ProformaPurchaseOrder:
|
|
return (AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder) && !CanCreateTransactionLocally(userContext, Sbm.TransactionType.PurchaseOrder));
|
|
case Sbm.TransactionType.ProformaSalesOrder:
|
|
return (AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder) && !CanCreateTransactionLocally(userContext, Sbm.TransactionType.SalesOrder));
|
|
case Sbm.TransactionType.ProformaSalesInvoice:
|
|
return (AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice) && !CanCreateTransactionLocally(userContext, Sbm.TransactionType.SalesInvoice));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// D a t a O p t i o n s
|
|
//-------------------------------------------------------------------
|
|
// Application Configuration. - Display and caption for data attributes.
|
|
public virtual bool DisplayAttribute(SbmUserContext userContext, SbmDbDfn.ColumnIdx column)
|
|
{
|
|
switch (column)
|
|
{
|
|
// Fields that are tied to other columns for the purposes of controlling their display.
|
|
case SbmDbDfn.ColumnIdx.Commodity_UomIdWeight:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Weight);
|
|
case SbmDbDfn.ColumnIdx.Commodity_UomIdLength:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Length);
|
|
case SbmDbDfn.ColumnIdx.Commodity_UomIdVolume:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Volume);
|
|
case SbmDbDfn.ColumnIdx.Commodity_UomIdDensity:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Density);
|
|
case SbmDbDfn.ColumnIdx.Commodity_UomIdBox:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_BoxQuantity);
|
|
case SbmDbDfn.ColumnIdx.Commodity_UomIdTimeProd:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_TimeProd);
|
|
case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdMaterial:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_MaterialCost);
|
|
case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdExWorks:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_ExWorksCost);
|
|
case SbmDbDfn.ColumnIdx.Commodity_CommodityIdSalesProj:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonthlyProp:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth01:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth02:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth03:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth04:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth05:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth06:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth07:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth08:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth09:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth10:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth11:
|
|
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth12:
|
|
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_SalesProjAnnual);
|
|
default: // Sep-08: Session profile should be able to handle all fields now (rather than just those that are controled)
|
|
return userContext.GetOwnerOption_ShowField(column);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Alternative data value captions.
|
|
public virtual String GetAttributeCaption(SbmUserContext userContext, SbmDbDfn.ColumnIdx column, string Default)
|
|
{
|
|
String Caption = "";
|
|
if (column != SbmDbDfn.ColumnIdx.Unknown)
|
|
{
|
|
Caption = userContext.GetOwnerOption_FieldLabel(column, Default);
|
|
}
|
|
if (StringUtil.IsEmpty(Caption)) Caption = Default;
|
|
return Caption;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// T r a n s a c t i o n O p t i o n s
|
|
//-------------------------------------------------------------------
|
|
// Job Tracking Options.
|
|
public virtual String GetDefaultQuoteDescIntro(SbmUserContext userContext)
|
|
{
|
|
return "";
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Transaction Maintenance Dialogs.
|
|
/*
|
|
public SapDlgUpdateTransaction GetCreateTransactionDlg (SbmUserContext userContext, SysId id, Sbm.TransactionType type)
|
|
{
|
|
return null;
|
|
}
|
|
public SapDlgUpdateTransaction GetUpdateTransactionDlg (SbmUserContext userContext, Sbm.TransactionType type, bool readOnly)
|
|
{
|
|
return null;
|
|
}
|
|
*/
|
|
|
|
//-------------------------------------------------------------------
|
|
// Create Transaction.
|
|
public virtual bool CanCreateTransactionLocally(SbmUserContext userContext, Sbm.TransactionType type)
|
|
{
|
|
if (!AllowTransactionType(userContext, type)) return false;
|
|
// Refresh options.
|
|
if (dfnSageInt.AffiliateId_Owner != userContext.Organisation.AffiliateId || dfnQBooksInt.AffiliateId_Owner != userContext.Organisation.AffiliateId)
|
|
{
|
|
// Reset the accounts interface configurations.
|
|
dfnSageInt.ClearConfig();
|
|
dfnSageInt.AffiliateId_Owner = userContext.Organisation.AffiliateId;
|
|
dfnQBooksInt.ClearConfig();
|
|
dfnQBooksInt.AffiliateId_Owner = userContext.Organisation.AffiliateId;
|
|
// Identify the interfaces.
|
|
SbmAccountsDfn accountsDfn = new SbmAccountsDfn(userContext);
|
|
dfnSageInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.SageLine50);
|
|
dfnQBooksInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.QuickBooks);
|
|
|
|
// Sales and purchase orders/invoices can only be created locally if they are not imported from one of these interfaces.
|
|
if (SysId.IsValid(dfnSageInt.InterfaceId))
|
|
{
|
|
// Interpret interface options.
|
|
dfnSageInt.importPurchaseOrder = accountsDfn.GetSageImportOption(Sage.ItemType.PurchaseOrder);
|
|
dfnSageInt.importSalesOrder = accountsDfn.GetSageImportOption(Sage.ItemType.SalesOrder);
|
|
dfnSageInt.importProductInvoice = accountsDfn.GetSageImportOption(Sage.ItemType.Invoice_Product);
|
|
dfnSageInt.importServiceInvoice = accountsDfn.GetSageImportOption(Sage.ItemType.Invoice_Service);
|
|
dfnSageInt.importSalesOrderInvoice = accountsDfn.GetSageImportOption(Sage.ItemType.Invoice_SalesOrder);
|
|
dfnSageInt.exportPurchaseOrder = accountsDfn.GetSageExportOption(Sage.ItemType.PurchaseOrder);
|
|
dfnSageInt.exportSalesOrder = accountsDfn.GetSageExportOption(Sage.ItemType.SalesOrder);
|
|
dfnSageInt.exportProductInvoice = accountsDfn.GetSageExportOption(Sage.ItemType.Invoice_Product);
|
|
dfnSageInt.exportServiceInvoice = accountsDfn.GetSageExportOption(Sage.ItemType.Invoice_Service);
|
|
dfnSageInt.exportSalesOrder = accountsDfn.GetSageExportOption(Sage.ItemType.Invoice_SalesOrder);
|
|
}
|
|
if (SysId.IsValid(dfnQBooksInt.InterfaceId))
|
|
{
|
|
// Interpret interface options.
|
|
dfnQBooksInt.importPurchaseOrder = accountsDfn.GetQuickBooksImportOption(Qbk.EntityType.PurchaseOrder);
|
|
dfnQBooksInt.importSalesOrder = accountsDfn.GetQuickBooksImportOption(Qbk.EntityType.SalesOrder);
|
|
dfnQBooksInt.importProductInvoice = accountsDfn.GetQuickBooksImportOption(Qbk.EntityType.Invoice_Product);
|
|
dfnQBooksInt.importServiceInvoice = accountsDfn.GetQuickBooksImportOption(Qbk.EntityType.Invoice_Service);
|
|
dfnQBooksInt.importSalesOrderInvoice = false;
|
|
dfnQBooksInt.exportPurchaseOrder = accountsDfn.GetQuickBooksExportOption(Qbk.EntityType.PurchaseOrder);
|
|
dfnQBooksInt.exportSalesOrder = accountsDfn.GetQuickBooksExportOption(Qbk.EntityType.SalesOrder);
|
|
dfnQBooksInt.exportProductInvoice = accountsDfn.GetQuickBooksExportOption(Qbk.EntityType.Invoice_Product);
|
|
dfnQBooksInt.exportServiceInvoice = accountsDfn.GetQuickBooksExportOption(Qbk.EntityType.Invoice_Service);
|
|
dfnQBooksInt.bexport_SalesOrderInvoice = false;
|
|
}
|
|
|
|
// Transaction types cannot be created locally if they are either imported from or exported to Sage.
|
|
// In the case of exports, it is the 'proforma' equivalent that can be created for export.
|
|
createTransaction_PurchaseOrder = true;
|
|
createTransaction_SalesQuote = true;
|
|
createTransaction_SalesOrder = true;
|
|
createTrans_SalesInvoice = true;
|
|
if (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = (!dfnSageInt.importPurchaseOrder && !dfnSageInt.exportPurchaseOrder);
|
|
if (createTransaction_SalesOrder) createTransaction_SalesOrder = (!dfnSageInt.importSalesOrder && !dfnSageInt.exportSalesOrder);
|
|
if (createTrans_SalesInvoice) createTrans_SalesInvoice = (!dfnSageInt.importProductInvoice && !dfnSageInt.exportProductInvoice && !dfnSageInt.importServiceInvoice && !dfnSageInt.exportServiceInvoice && !dfnSageInt.importSalesOrderInvoice && !dfnSageInt.bexport_SalesOrderInvoice);
|
|
if (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = (!dfnQBooksInt.importPurchaseOrder && !dfnQBooksInt.exportPurchaseOrder);
|
|
if (createTransaction_SalesOrder) createTransaction_SalesOrder = (!dfnQBooksInt.importSalesOrder && !dfnQBooksInt.exportSalesOrder);
|
|
if (createTrans_SalesInvoice) createTrans_SalesInvoice = (!dfnQBooksInt.importProductInvoice && !dfnQBooksInt.exportProductInvoice && !dfnQBooksInt.importServiceInvoice && !dfnQBooksInt.exportServiceInvoice && !dfnQBooksInt.importSalesOrderInvoice && !dfnQBooksInt.bexport_SalesOrderInvoice);
|
|
|
|
// Sales quotes are also imported from Sage Sales Orders.
|
|
createTransaction_SalesQuote = createTransaction_SalesOrder;
|
|
}
|
|
switch (type)
|
|
{
|
|
case Sbm.TransactionType.SalesQuote:
|
|
return createTransaction_SalesQuote;
|
|
case Sbm.TransactionType.SalesOrder:
|
|
return createTransaction_SalesOrder;
|
|
case Sbm.TransactionType.SalesInvoice:
|
|
return createTrans_SalesInvoice;
|
|
case Sbm.TransactionType.PurchaseOrder:
|
|
return createTransaction_PurchaseOrder;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Transaction Creation options.
|
|
public enum AssignTransRefMethod
|
|
{
|
|
System, Manual, Option
|
|
}
|
|
public virtual AssignTransRefMethod TransactionAssignRefMethod(SbmUserContext userContext, Sbm.TransactionType transTypes)
|
|
{
|
|
return AssignTransRefMethod.System;
|
|
}
|
|
public enum AssignTransRefSource
|
|
{
|
|
ByOwnerType, ByType
|
|
}
|
|
public virtual AssignTransRefSource TransactionAssignRefSource(SbmUserContext userContext, Sbm.TransactionType transTypes)
|
|
{
|
|
return AssignTransRefSource.ByOwnerType;
|
|
}
|
|
|
|
// By default all types of transaction have their own Id sequence.
|
|
// Override this method to allow different types of transaction to share Id sequence.
|
|
public virtual Sbm.TransactionType GetTransactionTypeForNextId(SbmUserContext userContext, Sbm.TransactionType transTypes)
|
|
{
|
|
return transTypes;
|
|
}
|
|
|
|
// NextId key value.
|
|
public virtual String GetTransactionNextIdKey(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType eType)
|
|
{
|
|
idAssoc = new SysId();
|
|
Sbm.TransactionType transTypes = GetTransactionTypeForNextId(userContext, eType);
|
|
switch (TransactionAssignRefSource(userContext, eType))
|
|
{
|
|
case AssignTransRefSource.ByOwnerType:
|
|
// Next Id depends on both the transaction type and owner.
|
|
return (String)"TransRef:" + transTypes.ToString() + ":" + AffiliateId_Owner.ToString();
|
|
default:
|
|
// Next Id only depends on the transaction type.
|
|
return "TransRef:" + transTypes.ToString();
|
|
}
|
|
}
|
|
|
|
// Set the minimum Id for transactions of the specified type.
|
|
public virtual bool SetMinTransactionId(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long iId)
|
|
{
|
|
bool set = false;
|
|
if (SbmGlobals.Application.GetDatabase(SessionContext) != null)
|
|
{
|
|
String nextIdKey = GetTransactionNextIdKey(userContext, AffiliateId_Owner, idAssoc, transTypes);
|
|
// ToDo set = SbmGlobals.Database.SetMinNextId(nextIdKey, iId, false);
|
|
}
|
|
return set;
|
|
}
|
|
|
|
// The implementation in this class will generate simple numeric values for the owner
|
|
// and global options that can be formatted (eg. to fixed length) by overwridden versions.
|
|
public virtual String GetTransactionCreateRef
|
|
(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
|
{
|
|
String Ref = "";
|
|
if (SbmGlobals.Application.GetDatabase(SessionContext) != null)
|
|
{
|
|
String NextIdKey = GetTransactionNextIdKey(userContext, AffiliateId_Owner, idAssoc, transTypes);
|
|
// ToDo long iRefNext = SbmGlobals.Database.GetNextId(NextIdKey, false);
|
|
// Ref = FormatTransactionCreateRef(AffiliateId_Owner, idAssoc, transTypes, iRefNext);
|
|
}
|
|
return Ref;
|
|
}
|
|
|
|
public virtual String FormatTransactionCreateRef
|
|
(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt)
|
|
{
|
|
String Ref = "";
|
|
if (RefInt > 0)
|
|
{
|
|
// Retrieve and validate the sequence padding length.
|
|
int SeqLen = Math.Max(1, Math.Min(8, GetTransactionRefSeqLength(userContext, AffiliateId_Owner, idAssoc, transTypes)));
|
|
// Pad the sequence number.
|
|
//Ref = String(RefInt, SeqLen);
|
|
// Add the reference prefix (max 5 chars)
|
|
String prefix = GetTransactionRefPrefix(AffiliateId_Owner, idAssoc, transTypes);
|
|
Ref = prefix.Left(5) + Ref;
|
|
}
|
|
return Ref;
|
|
}
|
|
|
|
public virtual int GetTransactionRefSeqLength(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
|
{
|
|
return 5;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
/// <summary>Transaction reference prefix by type</summary>
|
|
public virtual String GetTransactionRefPrefix(SysId id, SysId idAssoc, Sbm.TransactionType transactionType)
|
|
{
|
|
return "";
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Raise Transaction.
|
|
public virtual bool CanRaiseTransaction(SbmUserContext userContext, Sbm.TransactionType typeFrom, Sbm.TransactionType typeTo)
|
|
{
|
|
if (!AllowTransactionType(userContext, typeFrom) || !AllowTransactionType(userContext, typeTo)) return false;
|
|
if (!CanCreateTransactionLocally(userContext, typeTo)) return false;
|
|
if (typeFrom == Sbm.TransactionType.Project)
|
|
{
|
|
// Can raise another project from a project.
|
|
switch (typeTo)
|
|
{
|
|
case Sbm.TransactionType.Project:
|
|
return CanCreateTransactionLocally(userContext, typeTo);
|
|
}
|
|
}
|
|
else if (typeFrom == Sbm.TransactionType.SalesLead)
|
|
{
|
|
// Can raise sales quote or order from a lead.
|
|
switch (typeTo)
|
|
{
|
|
case Sbm.TransactionType.SalesQuote:
|
|
case Sbm.TransactionType.ProformaSalesOrder:
|
|
case Sbm.TransactionType.SalesOrder:
|
|
return CanCreateTransactionLocally(userContext, typeTo);
|
|
}
|
|
}
|
|
else if (typeFrom == Sbm.TransactionType.SalesQuote)
|
|
{
|
|
// Can raise sales lead or order from a sales quote.
|
|
switch (typeTo)
|
|
{
|
|
case Sbm.TransactionType.SalesLead:
|
|
case Sbm.TransactionType.SalesQuote:
|
|
case Sbm.TransactionType.ProformaSalesOrder:
|
|
case Sbm.TransactionType.SalesOrder:
|
|
case Sbm.TransactionType.ProformaSalesInvoice:
|
|
case Sbm.TransactionType.SalesInvoice:
|
|
return CanCreateTransactionLocally(userContext, typeTo);
|
|
}
|
|
}
|
|
else if (typeFrom == Sbm.TransactionType.SalesOrder || typeFrom == Sbm.TransactionType.ProformaSalesOrder)
|
|
{
|
|
// Can raise almost anything from a sales order.
|
|
switch (typeTo)
|
|
{
|
|
case Sbm.TransactionType.SalesLead:
|
|
case Sbm.TransactionType.SalesQuote:
|
|
case Sbm.TransactionType.ProformaSalesOrder:
|
|
case Sbm.TransactionType.SalesOrder:
|
|
case Sbm.TransactionType.SalesDispatch:
|
|
case Sbm.TransactionType.ProformaSalesInvoice:
|
|
case Sbm.TransactionType.SalesInvoice:
|
|
// Can also raise purchase quote or order from sales order:
|
|
case Sbm.TransactionType.PurchaseQuote:
|
|
case Sbm.TransactionType.ProformaPurchaseOrder:
|
|
case Sbm.TransactionType.PurchaseOrder:
|
|
return CanCreateTransactionLocally(userContext, typeTo);
|
|
}
|
|
}
|
|
else if (typeFrom == Sbm.TransactionType.SalesDispatch)
|
|
{
|
|
// Can raise a sales invoice from a dispatch note.
|
|
switch (typeTo)
|
|
{
|
|
case Sbm.TransactionType.ProformaSalesInvoice:
|
|
case Sbm.TransactionType.SalesInvoice:
|
|
return CanCreateTransactionLocally(userContext, typeTo);
|
|
}
|
|
}
|
|
else if (typeFrom == Sbm.TransactionType.PurchaseQuote)
|
|
{
|
|
// Can raise a purchase order from purchase quote.
|
|
switch (typeTo)
|
|
{
|
|
case Sbm.TransactionType.PurchaseQuote:
|
|
case Sbm.TransactionType.ProformaPurchaseOrder:
|
|
case Sbm.TransactionType.PurchaseOrder:
|
|
return CanCreateTransactionLocally(userContext, typeTo);
|
|
}
|
|
}
|
|
else if (typeFrom == Sbm.TransactionType.PurchaseOrder || typeFrom == Sbm.TransactionType.ProformaPurchaseOrder)
|
|
{
|
|
// Can raise a sales order or purchase quote from a purchase order.
|
|
switch (typeTo)
|
|
{
|
|
case Sbm.TransactionType.SalesQuote:
|
|
case Sbm.TransactionType.ProformaSalesOrder:
|
|
case Sbm.TransactionType.SalesOrder:
|
|
case Sbm.TransactionType.PurchaseQuote:
|
|
case Sbm.TransactionType.ProformaPurchaseOrder:
|
|
case Sbm.TransactionType.PurchaseOrder:
|
|
return CanCreateTransactionLocally(userContext, typeTo);
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseFrom(SbmUserContext userContext, Sbm.TransactionType typeFrom)
|
|
{
|
|
// Build the list of transaction types that are allowed to be raised from the specified type.
|
|
List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>();
|
|
if (transactionTypes_Full.Count == 0) transactionTypes_Full = SbmSystem.GetCodesOfType(userContext, Sbm.SystemCode.TransactionType);
|
|
foreach (TypeCodeDesc transTypeTo in transactionTypes_Full)
|
|
{
|
|
//if ((Sbm.TransactionType)typeTo.iType == typeFrom) continue;
|
|
if (CanRaiseTransaction(userContext, typeFrom, (Sbm.TransactionType)transTypeTo.Type))
|
|
transTypes.Add(transTypeTo);
|
|
}
|
|
return transTypes;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseTo(SbmUserContext userContext, Sbm.TransactionType typeTo)
|
|
{
|
|
// Build the list of transaction types that are allowed to be raised to the specified type.
|
|
List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>();
|
|
if (transactionTypes_Full.Count == 0) transactionTypes_Full = SbmSystem.GetCodesOfType(userContext, Sbm.SystemCode.TransactionType);
|
|
//transTypes_Full.GotoStart();
|
|
foreach (TypeCodeDesc transTypeTo in transactionTypes_Full)
|
|
{
|
|
//TypeCodeDesc & typeTo = transTypes_Full.Index();
|
|
if ((Sbm.TransactionType)transTypeTo.Type == typeTo) continue;
|
|
if (CanRaiseTransaction(userContext, (Sbm.TransactionType)transTypeTo.Type, typeTo))
|
|
transTypes.Add(transTypeTo);
|
|
}
|
|
return transTypes;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Prepare Requirements Transaction. - Prepare copied list of requirements, eg. when raising from another transaction.
|
|
public virtual bool PrepareCopiedRequirements(SbmUserContext userContext, SbmTransaction transSource, List<SbmRequirement> requireList, Sbm.TransactionType type)
|
|
{
|
|
type = new Sbm.TransactionType();
|
|
//transSource; requireList; type;
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Remove Transaction.- By default, not allowed if transaction has requirements.
|
|
public virtual bool CanRemoveTransactionWithRequirements(SbmUserContext userContext, SbmTransaction transaction, int requirementCount)
|
|
{
|
|
if (transaction == null || !SysId.IsValid(transaction.Id)) return false;
|
|
return (requirementCount < 1);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Tax Effective Date. - TransTypes that should use the 'In Progress' date as tax point as opposed to the 'Raised' date.
|
|
public virtual bool UseInProgressTaxDateAsTaxPoint(SbmUserContext userContext, Sbm.TransactionType transactionType)
|
|
{
|
|
switch (transactionType)
|
|
{
|
|
case Sbm.TransactionType.ProformaSalesOrder:
|
|
case Sbm.TransactionType.SalesDispatch:
|
|
case Sbm.TransactionType.ProformaPurchaseOrder:
|
|
case Sbm.TransactionType.PurchaseDelivery:
|
|
case Sbm.TransactionType.ProformaSalesInvoice:
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// R e q u i r e m e n t O p t i o n s
|
|
//-------------------------------------------------------------------
|
|
// Requirement Actions.
|
|
public virtual bool SearchCommodityOnCreateRequirement(SbmUserContext userContext, Sbm.TransactionType transactionType)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Requirement Costing.
|
|
public virtual SbmRequirementCostingConfig GetRequirementCostingConfig(SbmUserContext userContext)
|
|
{
|
|
SbmRequirementCostingConfig cfgRequirementCosting = new SbmRequirementCostingConfig();
|
|
return cfgRequirementCosting;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// C o m m o d i t y O p t i o n s
|
|
//-------------------------------------------------------------------
|
|
// Commodity Management.
|
|
public virtual Sbm.CommodityType GetCommodityTypeDefault(SbmUserContext userContext, Sbm.OrgOption_CommodityType commodityType)
|
|
{
|
|
// Default = 'Stock'.
|
|
return Sbm.CommodityType.Stock;
|
|
}
|
|
|
|
// Clean-up imported data (default no action).
|
|
public virtual bool CleanupImportedCommodity(SbmUserContext userContext, SbmCommodity commodity)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Stock Control
|
|
public virtual SbmStockControlConfig GetStockControlConfig(SbmUserContext userContext)
|
|
{
|
|
SbmStockControlConfig cfgStockControl = new SbmStockControlConfig();
|
|
return cfgStockControl;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// R e p o r t i n g
|
|
//-------------------------------------------------------------------
|
|
// Available reports (over and above standard).
|
|
public virtual List<SbmReport_Base> GetReports(SbmUserContext userContext, Sbm.View view)
|
|
{
|
|
return new List<SbmReport_Base>();
|
|
}
|
|
public virtual bool ItemHasDiaryReports(SbmUserContext userContext/*SaItemId &*/)
|
|
{
|
|
return false;
|
|
}
|
|
/*
|
|
public virtual List<SbmReport_Base> GetDiaryReports(SbmUserContext userContext, SaDiaryReport_Params &)
|
|
{
|
|
return null;
|
|
}
|
|
public virtual List<SbmReport_Base> GetDiaryReportsForItem(SbmUserContext userContext, ItemId itemId)
|
|
{
|
|
return null;
|
|
}
|
|
*/
|
|
|
|
//-------------------------------------------------------------------
|
|
// P r o c e s s e s
|
|
//-------------------------------------------------------------------
|
|
/// <summary>Processing parameters.</summary>
|
|
public enum ProcessParam
|
|
{
|
|
/// <summary>Dispatch Note report horizontal lines [Bool]</summary>
|
|
RptDispatchNoteHorizontalLines = 110,
|
|
/// <summary>Sales Invoice report horizontal lines [Bool]</summary>
|
|
RptSalesInvoiceHorizontalLines = 111,
|
|
}
|
|
public virtual DataValue GetDefaultProcessParam(SbmUserContext userContext, ProcessParam prm)
|
|
{
|
|
switch (prm)
|
|
{
|
|
case ProcessParam.RptDispatchNoteHorizontalLines:
|
|
case ProcessParam.RptSalesInvoiceHorizontalLines:
|
|
return new DataValue(false);
|
|
}
|
|
return new DataValue();
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Automated processes.
|
|
public virtual bool PerformProcess(SbmUserContext userContext, Sbm.ProcessType type)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// Available data import/export processes (over and above standard).
|
|
public virtual List<ISbmProcess_DataImport> GetImportProcesses(SbmUserContext userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
|
{
|
|
return new List<ISbmProcess_DataImport>();
|
|
}
|
|
|
|
public virtual List<ISbmProcess_DataExport> GetExportProcesses(SbmUserContext userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
|
{
|
|
return new List<ISbmProcess_DataExport>();
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data export Enhancements. eg. for export to accounts.
|
|
public class DataExportItemDetails
|
|
{
|
|
internal DataExportItemDetails(String itemCode, String itemDesc, String itemText)
|
|
{
|
|
ItemCode = itemCode;
|
|
ItemDesc = itemDesc;
|
|
ItemText = itemText;
|
|
}
|
|
public String ItemCode { get; }
|
|
public String ItemDesc { get; }
|
|
public String ItemText { get; }
|
|
};
|
|
public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(SbmUserContext userContext, SbmRequirement requirement)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// I n t e r f a c e O p t i o n s
|
|
//-------------------------------------------------------------------
|
|
public virtual bool AllowInterfaces(SbmUserContext userContext)
|
|
{
|
|
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Website)) return true;
|
|
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Accounts)) return true;
|
|
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.System)) return true;
|
|
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.File)) return true;
|
|
return false;
|
|
}
|
|
|
|
public virtual bool AllowInterfaceCategory(SbmUserContext userContext, SaInterfaceCategory interfaceCategory)
|
|
{
|
|
// By default, only website and file interfaces are allowed.
|
|
switch (interfaceCategory)
|
|
{
|
|
case SaInterfaceCategory.Website:
|
|
case SaInterfaceCategory.File:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public virtual bool AllowInterface(SbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
|
{
|
|
if (!AllowInterfaceCategory(userContext, interfaceCategory)) return false;
|
|
switch (interfaceCategory)
|
|
{
|
|
case SaInterfaceCategory.Website:
|
|
if (interfaceType == (short)Sbm.InterfaceType_Website.WebStore) return true;
|
|
if (interfaceType == (short)Sbm.InterfaceType_Website.JoomlaVirtueMart)
|
|
//return (SbmGlobals.Application.GetPropertyValue("Interface", "JoomlaVirtueMart").EqualsCI("Allow"));
|
|
return false;
|
|
break;
|
|
// Sbm.InterfaceType_Website.MiMoWeb - Only allowed by derived console.
|
|
case SaInterfaceCategory.Accounts:
|
|
if (interfaceType == (short)Sbm.InterfaceType_Accounts.SageLine50) return true;
|
|
// eSapInterfaceType_Accounts_QuickBooks - Only allowed by derived console.
|
|
break;
|
|
case SaInterfaceCategory.System:
|
|
if (interfaceType == (short)Sbm.InterfaceType_System.MSOutlook)
|
|
//return SbmGlobals.Application.GetPropertyValue("Interface", "MSOutlook").EqualsCI("Allow");
|
|
return false;
|
|
if (interfaceType == (short)Sbm.InterfaceType_System.PostcodeAnywhere)
|
|
//return SbmGlobals.Application.GetPropertyValue("Interface", "PostcodeAnywhere").EqualsCI("Allow");
|
|
return false;
|
|
if (interfaceType == (short)Sbm.InterfaceType_System.Bac)
|
|
//return SbmGlobals.Application.GetPropertyValue("Interface", "BacSystem").EqualsCI("Allow");
|
|
return false;
|
|
if (interfaceType == (short)Sbm.InterfaceType_System.Pvh)
|
|
//return SbmGlobals.Application.GetPropertyValue("Interface", "PracticalVanHireSystem").EqualsCI("Allow");
|
|
return false;
|
|
// Sbm.InterfaceType_System.Cap - Only allowed by derived console.
|
|
// Sbm.InterfaceType_System.Hpi - Only allowed by derived console.
|
|
break;
|
|
case SaInterfaceCategory.File:
|
|
if (AllowOption(userContext, Sbm.ConfigOption.AllowTransactions))
|
|
{
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.TransactionImport) return true;
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.TransactionExport) return true;
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesQuote) return AllowTransactionType(userContext, Sbm.TransactionType.SalesQuote);
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesOrder) return (AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesOrder) || AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder));
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesDispatch) return AllowTransactionType(userContext, Sbm.TransactionType.SalesDispatch);
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesInvoice) return (AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesInvoice) || AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice));
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_PurchaseOrder) return (AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder) || AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder));
|
|
}
|
|
if (AllowOption(userContext, Sbm.ConfigOption.AllowContacts))
|
|
{
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.AffiliateImport) return true;
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.AffiliateExport) return true;
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.AssociationImport) return true;
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.AssociationExport) return true;
|
|
}
|
|
if (AllowOption(userContext, Sbm.ConfigOption.AllowCommodities))
|
|
{
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.CommodityImport) return true;
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.CommodityExport) return true;
|
|
}
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.VehicleImport) return AllowOption(userContext, Sbm.ConfigOption.AllowVehicles);
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.LeasewayInvoice)
|
|
//return SbmGlobals.Application.GetPropertyValue("Interface", "LeasewayInvoice").EqualsCI("Allow");
|
|
return false;
|
|
break;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Interface options.
|
|
public virtual List<SaItemOption> GetDefaultInterfaceOptions(InterfaceDfn interfaceDfn)
|
|
{
|
|
List<SaItemOption> options = new List<SaItemOption>();
|
|
//if (SbmGlobals.System != null) options = SbmGlobals.System.GetDefaultInterfaceOptions(interfaceDfn);
|
|
return options;
|
|
}
|
|
|
|
public virtual bool ProcessInterface(SaInterface saInterface)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
|
|
}
|