How to correctly perform drilldowns?
The extensibility projects can contain code to drilldown in most of the ERP entities or in some documents and explorations. In order to do so, it is necessary to know the internal codes used by the ERP to instance the screen and load the desired information. These codes are made of several elements, the module the screen belongs, the maintenance itself, the document identifier, etc. The method to execute a drilldown is the DrilDownLista, available in the public interface of the platform (StdPlatBS100.StdBSInterfPub). This interface is available in any CustomClass, CustomForm or when subscribing the interface events: PSO.DrillDownLista. The following list represents the most important and most used codes, associated to the module. (*) More information below. Simply reference the Assembly ConstantesPrimavera100 in your project to easily find in constants all the codes Audit. The following table shows a few examples. Next, we shoe some examples of how to use the codes to open maintenances, documents and explorations in the different modules. This method can be placed in a shared class to show any ERP maintenance, and it is only necessary to specify the previously mentioned codes. Knowing the maintenance codes, the event code and the module/application they belong to, we can invoke the method. In the following example, the Param1 receives the maintenance code and the Param2 receives the key for the record to be loaded. NOTE: In the maintenances, the first parameter must always be the first maintenance code. (*) In the following examples, the maintenance code is not specified, considering that the event code already specifies the maintenance to be shown. In this case, the parameters only refer to the record key that can, in some cases, be composed. The previously shown method can be used to present these documents, and it is only necessary to specify the correct parameters. To edit a logistic document, such as the Sales (VND), Purchases (CMP), Internal (INT), Inventory (INV), Current Account (CCT) and Treasury (TES) document, besides being necessary to specify the event code that executes the drilldown (GCP_EditarDocumento) it is also necessary to specify all the key parameters to edit a document of this type, respecting this order: Module, Branch, Document Type, Series and Document Number. The following example shows how to edit the FA 2019/1 document of the Sales module. There is, however, another way to edit these documents without specifying all the parameters, using only the document identifier (field Id of the corresponding document header table). With this option, the event to specify is the GCP_EditarDocumentoId and the only parameters that you should move are the Module and the Identifier. The following example shows how to edit an accounting document in which the only parameter to specify is the document identifier (field Id of the table CabecMovCBL) using drilldown. It is also possible to drilldown for ERP explorations. However, due to the screens' specificities, it is necessary to handle them individually, depending on the case. The main feature, common to all exploration drilldowns, is the name of the first parameter that must be "Exploracao". As to the remaining parameters, a few explorations require specific parameters (name and value) to load the information. The following examples show how to drilldown in some explorations. This exploration requires the parameters Entity Type and Entity. This exploration also requires the parameters Entity Type and Entity. This exploration uses the parameters Account, Start and Final Date, and the "Dates" (the last two) are not mandatory. You can see more drilldown examples in this GitHub repository.Name Application /Module Event Audit (ex: maintenance) Parameters Items BAS GCP_MOSTRAMANUTENCAO mnuTabArtigo Item code Clients BAS GCP_MOSTRAMANUTENCAO mnuTabClientes Client code Sales cycle CRM CRM_MOSTRAMANUTENCAO mnuTabCabecCicloVenda Cycle code Activities CRM CRM_MOSTRAMANUTENCAO mnuTabActividades Activity identifier Work logs GPR GPR_MOSTRAMANUTENCAO DiariosTrabalho Log code Accounts plan CBL CBL_PlanoContas n/a Fiscal year; Account (*) STP processes STP evtDD_STP_Processos n/a Process key (*) Sales document VND GCP_EditarDocumento n/a Document key (*) Purchase document CMP GCP_EditarDocumento n/a Document key (*) Accounting document CBL CBL_EditaDocumentoID n/a Document key (*) CC statements CCT GCP_MOSTRAEXPLORACAO mnuExpCCExtracto Entity type; Entity CC open items CCT GCP_MOSTRAEXPLORACAO mnuExpCCPendentesGrelha Entity type; Entity Bank statement TES GCP_MOSTRAEXPLORACAO mnuExpExtractoBancario Account; Start Dt; End Dt Audit Constant mnuTabArtigo ConstantesPrimavera100.Audit.TAB_ARTIGOS mnuTabClientes ConstantesPrimavera100.Audit.TAB_CLIENTES mnuTabCabecCicloVenda ConstantesPrimavera100.Audit.TAB_CICLO_VENDAS mnuTabActividades ConstantesPrimavera100.Audit.TAB_ACTIVIDADES mnuExpCCExtracto ConstantesPrimavera100.Audit.EXP_CC_EXTRACTO mnuExpCCPendentesGrelha ConstantesPrimavera100.Audit.EXP_CC_PENDENTES_GRELHA mnuExpExtractoBancario ConstantesPrimavera100.Audit.DOC_EXTRACTO Maintenances
void ExecutaDrillDown(string Aplicacao, string Evento, string Param1, string Param2 = ", string Param3 = ", string Param4 = ", string Param5 = ")
{
StdBESqlCampoDrillDown campoDrillDown = new StdBESqlCampoDrillDown
{
ModuloNotificado = Aplicacao,
Tipo = StdBESqlTipos.EnumTipoDrillDownListas.tddlEventoAplicacao,
Evento = Evento
};
StdBEValoresStr param = new StdBEValoresStr();
param.InsereNovo("Param1", Param1);
if (!string.IsNullOrWhiteSpace(Param2))
param.InsereNovo("Param2", Param2);
if (!string.IsNullOrWhiteSpace(Param3))
param.InsereNovo("Param3", Param3);
if (!string.IsNullOrWhiteSpace(Param4))
param.InsereNovo("Param4", Param4);
if (!string.IsNullOrWhiteSpace(Param5))
param.InsereNovo("Param5", Param5);
PSO.DrillDownLista(campoDrillDown, param);
}
Clients (BAS)
ExecutaDrillDown("BAS", "GCP_MOSTRAMANUTENCAO", "mnuTabClientes", "SOFRIO");
Suppliers(BAS)
ExecutaDrillDown("BAS", "GCP_MOSTRAMANUTENCAO", "mnuTabFornecedores", "F0001");
Items (BAS)
ExecutaDrillDown("BAS", "GCP_MOSTRAMANUTENCAO", "mnuTabArtigo", "A0001");
Contacts (CRM)
ExecutaDrillDown("CRM", "CRM_MOSTRAMANUTENCAO", "mnuTabCabecCicloVenda", "CV_HW");
Activities (CRM)
ExecutaDrillDown("CRM", "CRM_MOSTRAMANUTENCAO", "mnuTabPlanoActividades", "A29DF423-4D63-4A29-B42C-6DB70546CB7A");
Work logs (GPR)
ExecutaDrillDown("GPR", "GPR_MOSTRAMANUTENCAO", "DiariosTrabalho", "20");
Charts of accounts (CBL)
ExecutaDrillDown("CBL", "CBL_PlanoContas", 2019, "21111001");
Processes (STP)
ExecutaDrillDown("STP", "evtDD_STP_Processos", "PRC/000/2018/1");
Logistic documents
ExecutaDrillDown("VND", "GCP_EditarDocumento", "V", "000", "FA", "2019", "1");
ExecutaDrillDown("VND", "GCP_EditarDocumentoId", "V", "BCB54D22-739A-40C0-878F-ECFBE6EDC369");
Accounting documents
Accounting Document (CBL)
ExecutaDrillDown("CBL", "CBL_EditaDocumentoID", "47F38B48-9201-11DC-B190-0020E024149C");
Explorations
public void ExecutaDrillDownExploracaoCCT(string Exploracao, string TipoEntidade, string Entidade)
{
StdBESql100.StdBESqlCampoDrillDown objCampoDrillDown = new StdBESql100.StdBESqlCampoDrillDown
{
ModuloNotificado = "CCT",
Tipo = StdBESql100.StdBESqlTipos.EnumTipoDrillDownListas.tddlEventoAplicacao,
Evento = "GCP_MOSTRAEXPLORACAO"
};
StdBE100.StdBEValoresStr objParam = new StdBE100.StdBEValoresStr();
objParam.InsereNovo("Exploracao", Exploracao);
objParam.InsereNovo("TipoEntidade", TipoEntidade);
objParam.InsereNovo("Entidade", Entidade);
PSO.DrillDownLista(objCampoDrillDown, objParam);
objCampoDrillDown = null;
objParam = null;
}
Current account statements (CCT)
ExecutaDrillDownExploracaoCCT("mnuExpCCExtracto", "C", "SOFRIO");
Open Items (CCT)
ExecutaDrillDownExploracaoCCT("mnuExpCCPendentesGrelha", "C", "SOFRIO");
Bank statements (TES)
public void ExecutaDrillDownExploracaoTES(string Exploracao, string Conta, string DataInicial, string DataFinal)
{
StdBESql100.StdBESqlCampoDrillDown objCampoDrillDown = new StdBESql100.StdBESqlCampoDrillDown
{
ModuloNotificado = "TES",
Tipo = StdBESql100.StdBESqlTipos.EnumTipoDrillDownListas.tddlEventoAplicacao,
Evento = "GCP_MOSTRAEXPLORACAO"
};
StdBE100.StdBEValoresStr objParam = new StdBE100.StdBEValoresStr();
objParam.InsereNovo("Exploracao", Exploracao);
objParam.InsereNovo("Conta", Conta);
objParam.InsereNovo("DataInicial", DataInicial);
objParam.InsereNovo("DataFinal", DataFinal);
PSO.DrillDownLista(objCampoDrillDown, objParam);
objCampoDrillDown = null;
objParam = null;
}
ExecutaDrillDownExploracaoTES("mnuExpExtractoBancario", "CXREC", "1/1/2018", "31/12/2018");
login para deixar a sua opinião.