Ver Mensaje Individual
  #3  
Antiguo 20-03-2009
Tauro78 Tauro78 is offline
Miembro
 
Registrado: sep 2006
Posts: 88
Reputación: 18
Tauro78 Va por buen camino
ok, aqui te pongo el codigo,

Código Delphi [-]
 
procedure TfrmEmpresasAltas.cxButton1Click(Sender: TObject);
begin
if (Trim(Edit1.Text) = EmptyStr) or (cxDateEdit1.Text = '') or (cxDateEdit2.Text = '') or (cxDateEdit3.Text = '')
    then
   begin
     MessageDlg('Se deben completar todos los campos.', MtInformation, [MbOK], 0);
     Exit;
   end
     else
       begin
        with DMTablas.SPExiste_Empresa do
          begin
            Close;
            ParamByName('@SP_NOMBRE').AsString := UpperCase(Edit1.Text);
            ExecProc;
            if ParamByName('@RESULTADO').AsInteger = 1 then
              begin
                MessageDlg('Ya existe una empresa con ese nombre.', MtInformation, [MbOK], 0);
                Close;
                Exit;
              end
                else
                  begin
                    try
                      DMTablas.SPAlta_Empresa.Close;
                      DMTablas.SPAlta_Empresa.ParamByName('@NOMBRE').AsString := UpperCase(Edit1.Text);
                      DMTablas.SPAlta_Empresa.ParamByName('@FECHA_VTO_DGI').AsDateTime := cxDateEdit1.Date;
                      DMTablas.SPAlta_Empresa.ParamByName('@FECHA_VTO_BPS').AsDateTime := cxDateEdit2.Date;
                      DMTablas.SPAlta_Empresa.ParamByName('@FECHA_VTO_PL_TRABAJO').AsDateTime := cxDateEdit3.Date;
                      DMTablas.SPAlta_Empresa.ExecProc;
                    except
                      raise;
                    end;
                      DMTablas.SPAlta_Empresa.Close;
                      Edit1.Text := '';              
                      cxDateEdit1.Text := '';    
                      cxDateEdit2.Text := '';
                      cxDateEdit3.Text := '';
                  end;
          end;
       end;
end;
Responder Con Cita