Essa é uma revisão anterior do documento!
Formatador de Relatório - ReportBuilder (Resumo do guia do desenvolvedor)
TUTORIAL DE RELATÓRIOS - Master / Detail - Relatório detalhado - Calculando os totalizadores
1. Select the vrItemTotal variable in the detail band.
2. Select the Events tab of the Object Inspector.
3. Double-click on the OnCalc event. An event handler shell will be generated in your Delphi form.
4. Add the following code to this event handler:
1. Selecione a variável vrItemTotal na faixa de detalhes.
2. Selecione a guia Eventos do Object Inspector.
3. Dê um clique duplo sobre o evento OnCalc. Um shell manipulador de eventos será gerado em seu formulário de Delphi.
4. Adicione o seguinte código para este manipulador de eventos:
Value := plItem['Qty']*plPart['ListPrice'];
Note: This event handler retrieves the quantity and list price of the item and returns the total amount via the Value parameter. The result will become the value of the variable component. The OnCalc event will fire once for each item record.
5. Return to the Report Designer and select the vrOrderTotal variable in the group footer band.
Nota: Este manipulador de eventos recupera o preço quantidade e lista do item e retorna o valor total por meio do parâmetro Value. O resultado será o valor da componente variável. O evento OnCalc irá disparar uma vez para cada registro de item.
5. Retorne ao Report Designer e selecione a variável vrOrderTotal na banda de rodapé de grupo.
6. Code the OnCalc event:
Value := Value + vrItemTotal.Value;
Note: This event handler retrieves the current total for the item and adds it to the running total for the order. This OnCalc event will also fire once for each item record.
7. Return to the Report Designer, right-click over the vrOrderTotal variable, and select the Timing… menu option.
8. Select 'GroupEnd' from the Reset On dropdown list. Select 'Group0: OrderNo' from the Group drop-down list.
Note: The Timing dialog allows you to control when the OnCalc event will fire and when the variable value will be reset. For this total, we want to calculate the value each time a record is traversed and we want to reset the value after the group footer has completed printing.
9. Select Project | Compile rbMDDProj. Fix any compilation problems.
Nota: Este manipulador de eventos recupera a corrente total para o item e adiciona à execução total para a ordem. Este evento OnCalc também irá disparar uma vez para cada registro de item.
7. Volte para o Report Designer, clique com botão direito sobre a variável vrOrderTotal, e selecionar o tempo … opção de menu.
8. Selecione “GroupEnd 'do reset na lista suspensa. Selecione 'Group0: OrderNo' da lista drop-down Group.
Nota: O diálogo sincronismo permite que você controle quando o evento OnCalc dispara e quando o valor da variável será reposto. Para Desse total, queremos calcular o valor de cada vez que um registro é atravessado e queremos redefinir o valor após o rodapé de grupo tenha concluído a impressão.
9. Selecione Projeto | Compilar rbMDDProj. Corrigir quaisquer problemas de compilação.
10. Select File | Save from the Delphi main menu.