Skip to content

Instantly share code, notes, and snippets.

@diego-aslz
Last active November 29, 2015 18:03
Show Gist options
  • Select an option

  • Save diego-aslz/dfdf89f430e532f42310 to your computer and use it in GitHub Desktop.

Select an option

Save diego-aslz/dfdf89f430e532f42310 to your computer and use it in GitHub Desktop.
-- Edit Query. Adicionar abaixo de:
-- AND
-- V.DT_CANCELAMENTO IS NULL
-- A seguinte SQL:
AND
DATEADD(-3 HOUR TO DT_EMISSAO) BETWEEN :DT_INICIO
AND DATEADD(1 DAY TO :DT_FIM)
-- Edit Query. Adicionar abaixo de:
-- DT_CANCELAMENTO IS NOT NULL
-- A seguinte SQL:
AND
DATEADD(-3 HOUR TO DT_EMISSAO) BETWEEN :DT_INICIO
AND DATEADD(1 DAY TO :DT_FIM)
// Novo código do botão para Relatório de Fechamento de Vendas
procedure TFVendasCad.Fechamento1Click(Sender: TObject);
begin
inherited;
if FVendasParam = nil then
FVendasParam := TFVendasParam.Create(Application);
FVendasParam.AtivaPagina(0);
if FVendasParam.ShowModal = MrOk then
with DMRelatorio do
begin
QRFechamentoVendas.Close;
QRFechamentoVendas.ParamByName('DT_INICIO').AsDate :=
StrToDate(FVendasParam.ME1DataInicial.Text);
QRFechamentoVendas.ParamByName('DT_FIM').AsDate :=
StrToDate(FVendasParam.ME1DataFinal.Text);
QRFechamentoVendas.Open;
QRFechamentoVendasCanceladas.Close;
QRFechamentoVendasCanceladas.ParamByName('DT_INICIO').AsDate :=
StrToDate(FVendasParam.ME1DataInicial.Text);
QRFechamentoVendasCanceladas.ParamByName('DT_FIM').AsDate :=
StrToDate(FVendasParam.ME1DataFinal.Text);
QRFechamentoVendasCanceladas.Open;
ImprimeFechamentoVendas;
end;
end;
// Clicar no Form -> Eventos -> OnCreate:
procedure TFVendasParam.FormCreate(Sender: TObject);
begin
inherited;
ME1DataInicial.Text := FormatDateTime('DD/MM/YYYY', Now);
ME1DataFinal.Text := ME1DataInicial.Text;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment