Control - Repository initialisation.
This commit is contained in:
@@ -70,9 +70,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmInternals internals;
|
||||
private List<TypeCodeDesc> transactionTypes_Full = new List<TypeCodeDesc>();
|
||||
private SbmInstanceConfig instanceConfig;
|
||||
private SbmAccountsDfn accountsDfn;
|
||||
private AccountsInterfaceDfn dfnSageInt = new AccountsInterfaceDfn();
|
||||
private AccountsInterfaceDfn dfnQBooksInt = new AccountsInterfaceDfn();
|
||||
private bool createTransaction_PurchaseOrder, createTransaction_SalesQuote, createTransaction_SalesOrder, createTrans_SalesInvoice;
|
||||
@@ -91,6 +91,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (internals != null) internals.Dispose(); internals = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +103,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
public SbmVersion AppVersion { get; }
|
||||
public SbmVersion ConsoleVersion { get; }
|
||||
public SbmInstanceConfig InstanceConfig { get { if (instanceConfig == null) instanceConfig = SbmGlobals.Application.GetInstanceConfig(SessionContext); return instanceConfig; } }
|
||||
private SbmInternals Internals { get { if (internals == null) internals = new SbmInternals(UserContext); return internals; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C r e a t e C o n s o l e
|
||||
@@ -178,16 +180,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
{
|
||||
if (InstanceConfig.AllowApplicationOption(option, false))
|
||||
return true;
|
||||
if (accountsDfn == null) accountsDfn = new SbmAccountsDfn(UserContext);
|
||||
return accountsDfn.IsUsingSageInterface() && accountsDfn.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Customer) && !accountsDfn.UseLocalCustomerPricing();
|
||||
return Internals.AccountsDfn.IsUsingSageInterface() && Internals.AccountsDfn.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Customer) && !Internals.AccountsDfn.UseLocalCustomerPricing();
|
||||
}
|
||||
case Sbm.ConfigOption.SupplierPriceSet:
|
||||
case Sbm.ConfigOption.SupplierDiscount:
|
||||
{
|
||||
if (InstanceConfig.AllowApplicationOption(option, false))
|
||||
return true;
|
||||
SbmAccountsDfn account = null;
|
||||
return account.IsUsingSageInterface() && account.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Supplier) && !account.UseLocalSupplierPricing();
|
||||
return Internals.AccountsDfn.IsUsingSageInterface() && Internals.AccountsDfn.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Supplier) && !Internals.AccountsDfn.UseLocalSupplierPricing();
|
||||
}
|
||||
}
|
||||
return InstanceConfig.AllowApplicationOption(option, false);
|
||||
@@ -502,37 +502,36 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
dfnQBooksInt.ClearConfig();
|
||||
dfnQBooksInt.AffiliateId_Owner = UserContext.OrganisationAffiliateId;
|
||||
// Identify the interfaces.
|
||||
SbmAccountsDfn accountsDfn = new SbmAccountsDfn(UserContext);
|
||||
dfnSageInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.SageLine50);
|
||||
dfnQBooksInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.QuickBooks);
|
||||
dfnSageInt.InterfaceId = Internals.AccountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.SageLine50);
|
||||
dfnQBooksInt.InterfaceId = Internals.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);
|
||||
dfnSageInt.importPurchaseOrder = Internals.AccountsDfn.GetSageImportOption(Sage.ItemType.PurchaseOrder);
|
||||
dfnSageInt.importSalesOrder = Internals.AccountsDfn.GetSageImportOption(Sage.ItemType.SalesOrder);
|
||||
dfnSageInt.importProductInvoice = Internals.AccountsDfn.GetSageImportOption(Sage.ItemType.Invoice_Product);
|
||||
dfnSageInt.importServiceInvoice = Internals.AccountsDfn.GetSageImportOption(Sage.ItemType.Invoice_Service);
|
||||
dfnSageInt.importSalesOrderInvoice = Internals.AccountsDfn.GetSageImportOption(Sage.ItemType.Invoice_SalesOrder);
|
||||
dfnSageInt.exportPurchaseOrder = Internals.AccountsDfn.GetSageExportOption(Sage.ItemType.PurchaseOrder);
|
||||
dfnSageInt.exportSalesOrder = Internals.AccountsDfn.GetSageExportOption(Sage.ItemType.SalesOrder);
|
||||
dfnSageInt.exportProductInvoice = Internals.AccountsDfn.GetSageExportOption(Sage.ItemType.Invoice_Product);
|
||||
dfnSageInt.exportServiceInvoice = Internals.AccountsDfn.GetSageExportOption(Sage.ItemType.Invoice_Service);
|
||||
dfnSageInt.exportSalesOrder = Internals.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.importPurchaseOrder = Internals.AccountsDfn.GetQuickBooksImportOption(Qbk.EntityType.PurchaseOrder);
|
||||
dfnQBooksInt.importSalesOrder = Internals.AccountsDfn.GetQuickBooksImportOption(Qbk.EntityType.SalesOrder);
|
||||
dfnQBooksInt.importProductInvoice = Internals.AccountsDfn.GetQuickBooksImportOption(Qbk.EntityType.Invoice_Product);
|
||||
dfnQBooksInt.importServiceInvoice = Internals.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.exportPurchaseOrder = Internals.AccountsDfn.GetQuickBooksExportOption(Qbk.EntityType.PurchaseOrder);
|
||||
dfnQBooksInt.exportSalesOrder = Internals.AccountsDfn.GetQuickBooksExportOption(Qbk.EntityType.SalesOrder);
|
||||
dfnQBooksInt.exportProductInvoice = Internals.AccountsDfn.GetQuickBooksExportOption(Qbk.EntityType.Invoice_Product);
|
||||
dfnQBooksInt.exportServiceInvoice = Internals.AccountsDfn.GetQuickBooksExportOption(Qbk.EntityType.Invoice_Service);
|
||||
dfnQBooksInt.bexport_SalesOrderInvoice = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user