Ver Mensaje Individual
  #16  
Antiguo 02-11-2008
lKinGl lKinGl is offline
Miembro
 
Registrado: ago 2007
Posts: 333
Reputación: 17
lKinGl Va por buen camino
Salu2 ya resolvi mi problema, gracias a los que ayudaron en algo...

publico el código para que a alguien mas le sirva, uno nunca sabe ....

Código Delphi [-]
procedure TForm44.BitBtn1Click(Sender: TObject);
var
mes,ano:String;
begin

if ComboBox1.Text='Seleccione Mes' then
  begin
    Application.MessageBox('Disculpe, debe seleccionar un Mes','');
    exit;
  end;

if ComboBox2.Text='Seleccione Año' then
  begin
    Application.MessageBox('Disculpe, debe seleccionar un Año','');
    exit;
  end;

Form1.Table11.First;
  With Form1.Table11 do
    Begin
      While not Eof do
        begin
            // si el grupo es 6 ó 6
          if (FieldValues['nogrupo']=5) or (FieldValues['nogrupo']=6) then
            begin
              //si consigue unico en la tabla14
              if form1.Table14.Locate('unico',FieldValues['unico'],[]) then
                begin
                  //no pasa nada
                end
                else
                begin
                //de lo contrario graba el registro
                  With form1.Table14 do
                    Begin
                      Insert;
                      FieldValues['unico']:=form1.Table11.FieldValues['unico'];
                      FieldValues['Fecha']:=form1.Table11.FieldValues['Fecha'];
                      FieldValues['Grupo']:=Form1.Table11.FieldValues['Grupo'];
                      FieldValues['Des_cu']:=Form1.Table11.FieldValues['des_cu'];
                      FieldValues['debe']:=Form1.Table11.FieldValues['debe'];
                      Post;
                    end;
                end;
            end;
          Next;
        end;
    End;

mes:=IntToStr(ComboBox1.ItemIndex+1);
ano:=ComboBox2.Text;
edit1.Text:='01'+'/'+mes+'/'+ano;

with Form45.Query1 do begin
   Close;
   SQL.Text := 'Select Fecha,grupo,des_cu,debe,haber '+
             'from costosygastos.db '+
             'where Extract(month from fecha) = '+IntToStr(MonthOf(StrToDate(Edit1.Text)))+
             ' and Extract(year from fecha) = '+IntToStr(YearOf(StrToDate(Edit1.Text)));
   Open;
end;
form45.QRLabel1.Caption:='Costos y Gastos de '+ComboBox1.Text+' de '+ComboBox2.Text;
form45.QuickRep1.Preview;
exit;
end;

Saludos amigos
__________________
Las cosas o son, o no son...
Responder Con Cita