Ver Mensaje Individual
  #3  
Antiguo 30-05-2011
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Reputación: 20
oscarac Va por buen camino
claro que si
aunque ya lo cambie de otra forma

Código Delphi [-]
procedure TfrmReporteConsumo.btnGrabarClick(Sender: TObject);
var StrSql :WideString;
begin
  StrSql := '';
  if (rgTipoVenta.ItemIndex = 0) and (rgEmpresa.ItemIndex = 0) Then
    begin
        StrSql := 'Select T.empresa, C.TipoConsumo, C.Aux, T.Descl As Trabajador, Sum (C.TOT) As Total  ' +
                ' from ' +
                'tblConsumoC C ' +
                'Left Join tblTrabajador T on C.Aux = T.KOD ' +
                ' Where C.F_DOC Between ' + QuotedStr(FormatDateTime('DD/MM/YYYY', dtFechaIni.Date)) + ' and ' +
                QuotedStr(FormatDateTime('DD/MM/YYYY', dtFechaFin.Date)) + ' and TipoConsumo = ' + QuotedStr('K') +
                iif (edtTrabajador.Text = '', '', ' and C.AUX = ' + QuotedStr(edtTrabajador.text)) +
                ' order by T.Empresa, T.Descl, C.Tdc, C.Doc'
    end;
  if (rgTipoVenta.ItemIndex = 0) and (rgEmpresa.ItemIndex <> 0) Then
    begin
        StrSql := 'Select T.empresa, C.TipoConsumo, C.Aux, T.Descl As Trabajador, Sum (C.TOT) As Total  ' +
                ' from ' +
                'tblConsumoC C ' +
                'Left Join tblTrabajador T on C.Aux = T.KOD ' +
                ' Where C.F_DOC Between ' + QuotedStr(FormatDateTime('DD/MM/YYYY', dtFechaIni.Date)) + ' and ' +
                QuotedStr(FormatDateTime('DD/MM/YYYY', dtFechaFin.Date)) + ' and TipoConsumo = ' + QuotedStr('K') +
                iif (edtTrabajador.Text = '', '', ' and C.AUX = ' + QuotedStr(edtTrabajador.text)) +
                ' and T.Empresa = ' + QuotedStr(IntToStr(rgEmpresa.itemindex)) + ' Order by T.Empresa, T.Descl, C.Tdc, C.Doc'
    end;
  if rgTipoVenta.ItemIndex = 1 Then
    begin
        StrSql := 'Select T.empresa, C.TipoConsumo, C.Aux, T.Descl As Trabajador, Sum (C.TOT) As Total  ' +
                ' from ' +
                'tblConsumoC C ' +
                'Left Join tblTrabajador T on C.Aux = T.KOD ' +
                ' Where C.F_DOC Between ' + QuotedStr(FormatDateTime('DD/MM/YYYY', dtFechaIni.Date)) + ' and ' +
                QuotedStr(FormatDateTime('DD/MM/YYYY', dtFechaFin.Date)) + ' and TipoConsumo = ' + QuotedStr('C') +
                ' Order by T.Empresa, T.Descl, C.Tdc, C.Doc'
    end;
    qryConsumos.SQL.Clear;
    qryConsumos.sql.Add(StrSql);
    qryConsumos.Open;
end;

y ya esta funcionando normal

cosas del orinoco?
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita