pas di running ada eror 'Empty SQL Statement' (Delphi7&Interbase)


procedure TForm3.Edit3Change(Sender: TObject);
begin

if (image1.Visible = true) and (image4.Visible=true) and (image7.Visible= true) and (image2.Visible = false) and (image5.Visible=false) and (image8.Visible= false) and (image3.Visible = false) and (image6.Visible=false) and (image9.Visible= false) and(edit3.Text='a') then
begin
image1.Visible := false;
image4.Visible := false;
image7.Visible := false;
image2.Visible := false;
image5.Visible := false;
image8.Visible := false;
image3.Visible := true;
image6.Visible := true;
image9.Visible := true;
combobox1.ItemIndex:=1;
edit3.Clear;
end;
if (image1.Visible = false) and (image4.Visible=false) and (image7.Visible= false) and (image2.Visible = false) and (image5.Visible=false) and (image8.Visible= false) and (image3.Visible = true) and (image6.Visible=true) and (image9.Visible= true) and(edit3.Text='a') then
begin
image1.Visible := false;
image4.Visible := false;
image7.Visible := false;
image2.Visible := true;
image5.Visible := true;
image8.Visible := true;
image3.Visible := false;
image6.Visible := false;
image9.Visible := false;
edit3.Clear;
end;
if (image1.Visible = false) and (image4.Visible=false) and (image7.Visible= false) and (image2.Visible =true) and (image5.Visible=true) and (image8.Visible= true) and (image3.Visible = false) and (image6.Visible=false) and (image9.Visible= false) and(edit3.Text='a') then
begin
image1.Visible := true;
image4.Visible := true;
image7.Visible := true;
image2.Visible := false;
image5.Visible := false;
image8.Visible := false;
image3.Visible := false;
image6.Visible := false;
image9.Visible := false;
edit3.Clear;
end;
if (image1.Visible = true) and (image4.Visible=true) and (image7.Visible= true) and (image2.Visible = false) and (image5.Visible=false) and (image8.Visible= false) and (image3.Visible = false) and (image6.Visible=false) and (image9.Visible= false) and(edit3.Text='e') then
begin
image1.Visible := false;
image4.Visible := false;
image7.Visible := false;
image2.Visible := true;
image5.Visible := true;
image8.Visible := true;
image3.Visible := false;
image6.Visible := false;
image9.Visible := false;
edit3.Clear;
end;
if (image1.Visible = false) and (image4.Visible=false) and (image7.Visible= false) and (image2.Visible =true) and (image5.Visible=true) and (image8.Visible= true) and (image3.Visible = false) and (image6.Visible=false) and (image9.Visible= false) and(edit3.Text='e') then
begin
image1.Visible := false;
image4.Visible := false;
image7.Visible := false;
image2.Visible := false;
image5.Visible := false;
image8.Visible := false;
image3.Visible := true;
image6.Visible := true;
image9.Visible := true;
edit3.Clear;
end;
if (image1.Visible = false) and (image4.Visible=false) and (image7.Visible= false) and (image2.Visible = false) and (image5.Visible=false) and (image8.Visible= false) and (image3.Visible = true) and (image6.Visible=true) and (image9.Visible= true) and(edit3.Text='e') then
begin
image1.Visible := true;
image4.Visible := true;
image7.Visible := true;
image2.Visible := false;
image5.Visible := false;
image8.Visible := false;
image3.Visible := false;
image6.Visible := false;
image9.Visible := false;
edit3.Clear;
end;

if (image1.Visible = true) and (image4.Visible = true) and (image7.Visible = true) and (image2.Visible = false) and (image5.Visible = false) and (image8.Visible = false) and (image3.Visible = false) and (image6.Visible = false) and (image9.Visible = false)   then
begin
  if edit3.Text='b' then
    begin
    with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)'+ 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(Edit5.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit9.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
    end;
  if edit3.Text='c' then
    begin
    with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)' + 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(edit6.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit10.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
    end;
  if edit3.Text = 'd' then
    begin
      with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)' + 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(edit7.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit11.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
    end;
end;

if (image1.Visible=false) and (image4.Visible=false) and (image7.Visible=false) and (image2.Visible=true) and (image5.Visible=true) and (image8.Visible=true) and (image3.Visible=false) and (image6.Visible=false) and (image9.Visible=false) then
begin
if edit3.Text='b' then
    begin
    with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)'+ 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(Edit5.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit9.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
    end;
  if edit3.Text='c' then
    begin
    with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)' + 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(Edit6.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit10.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
    end;
  if edit3.Text = 'd' then
    begin
      with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)' + 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(Edit7.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit11.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
end;

if (image1.Visible=false) and (image4.Visible=false) and (image7.Visible=false) and (image2.Visible=false) and (image5.Visible=false) and (image8.Visible=false) and (image3.Visible=true) and (image6.Visible=true) and (image9.Visible=true) then
begin
if edit3.Text='b' then
    begin
    with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)'+ 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(edit5.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit9.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
    end;
  if edit3.Text='c' then
    begin
    with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)' + 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(edit6.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit10.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
    end;
  if edit3.Text = 'd' then
    begin
      with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Insert Into PEMESANAN(NOPEMESANAN,NAMAMENU,HARGAMENU)' + 'Values(:np,:nm,:hm)');
      Prepare;
      ParamByName('np').AsString := Trim(Edit2.Text);
      ParamByName('nm').AsString := Trim(edit7.Text);
      ParamByName('hm').AsFloat := StrToFloat(edit11.Text);
      ExecSql;
      end;
      edit3.Clear;
      tampil;
end;

if edit3.Text ='f' then
begin
edit3.Clear;
end;

if edit3.Text ='g' then
begin
  with dm.qdata do
  begin
  Close;
  Sql.Clear;
  Sql.Add('Select NOPEMESANAN From PEMESANAN');
  Open;
  if Fields[0].IsNull then
    begin
    edit1.Text:= '000001';
    end
    else
      begin
      with dm.qdata do
        begin
        Close;
        Sql.Clear;
        Sql.Add('Select Max(NOPEMESANAN) From PEMESANAN');
        Open;
        edit1.Text:=FormatFloat('000000',strtofloat(Fields[0].value+1));
        end;
      end;
  end;
with dm.qproses do
  begin
  CLose;
  Sql.Clear;
  Sql.Add('Insert Into PEMESANANDETAIL(TANGGAL,NOPEMESANAN,MEMBER)Value(;tg,;np,;mbr)');
  Prepare;
  ParamByName('tg').AsDate := strtodate(edit8.Text);
  ParamByName('np').AsString := edit1.Text;
  ParamByName('mbr').AsString := edit2.Text;
  ExecSql;
  end;
  edit3.Clear;
  tampil;
  dm.trtoko.Commit;
  frxReport1.ShowProgress:=false;
  frxReport1.PrintOptions.ShowDialog:=false;
  frxReport1.Print;
  edit2.Clear;
  edit2.SetFocus;

  end;
end;
end;
end;

procedure TForm3.FormActivate(Sender: TObject);
begin
edit2.SetFocus;
image1.Visible := true;
image2.Visible := false;
image3.Visible := false;
image4.Visible := true;
image5.Visible := false;
image6.Visible := false;
image7.Visible := true;
image8.Visible := false;
image9.Visible := false;
edit8.Text := DateToStr(Date);
tampil;
end;

procedure TForm3.FormShow(Sender: TObject);
begin
with dm.qdata do
  begin
  Close;
  Sql.Clear;
  Sql.Add('Select NOPEMESANAN From PEMESANAN');
  Open;
  if Fields[0].IsNull then
    begin
    edit1.Text:='000001';
    end
   else
    begin
    with dm.qdata do
      begin
      Close;
      Sql.Clear;
      Sql.Add('Select Max(NOPEMESANAN) From PEMESANAN');
      Open;
      Edit1.Text:= FormatFloat('000000',strtofloat(Fields[0].Value+1));
      end;
    end;
  end;
  Edit8.Text:= DatetoStr(Date);

ComboBox1.Clear;
ComboBox2.Clear;
ComboBox3.Clear;
with dm.qproses do
  begin
  Close;
  Sql.Clear;
  Sql.Add('Select Distinct KODEMENU From MENUMAKAN');
  Open;
  while not Eof do
    begin
    ComboBox1.Items.Add(Trim(Fields[0].AsString));
    ComboBox2.Items.Add(Trim(Fields[0].AsString));
    ComboBox3.Items.Add(Trim(Fields[0].AsString));
    Next;
    end;
  end;
  with dm.qproses do
    begin
    Close;
    Sql.Clear;
    Sql.Add('Select NAMAMENU, HARGAMENU From PEMESANAN');
    Sql.Add('Where NOPEMESANAN =:np');
    Open;
   end;

end;

procedure TForm3.ComboBox1Change(Sender: TObject);
begin
if combobox1.Text <> Trim('') then
  begin
    with dm.qdata do
    begin
    CLose;
    Sql.Clear;
    Sql.Add('Select NAMAMENU,HARGAMENU From MENUMAKAN');
    Sql.Add('Where KODEMENU =:km');
    Prepare;
    ParamByName('km').AsString := Combobox1.Text;
    Open;
    edit5.Text := Trim(Fields[0].Value);
    edit9.Text := FloatToStr(Fields[1].AsFloat);
    //edit9.Text := StrToFLoat(Trim(Fields[1].Value));

    end;
  end;
 tampil;
end;

procedure TForm3.ComboBox2Change(Sender: TObject);
begin
if combobox1.Text <> Trim('') then
  begin
    with dm.qdata do
    begin
    CLose;
    Sql.Clear;
    Sql.Add('Select NAMAMENU,HARGAMENU From MENUMAKAN');
    Sql.Add('Where KODEMENU =:km');
    Prepare;
    ParamByName('km').AsString := Combobox2.Text;
    Open;
    edit6.Text := Trim(Fields[0].Value);
    edit10.Text := FloatToStr(Fields[1].AsFloat);
    //edit10.Text := strtofloat(Trim(Fields[1].Value));

    end;
  end;
  tampil;
end;

procedure TForm3.ComboBox3Change(Sender: TObject);
begin
if combobox1.Text <> Trim('') then
  begin
    with dm.qdata do
    begin
    CLose;
    Sql.Clear;
    Sql.Add('Select NAMAMENU, HARGAMENU From MENUMAKAN');
    Sql.Add('Where KODEMENU =:km');
    Prepare;
    ParamByName('km').AsString := Combobox3.Text;
    Open;
    edit7.Text := Trim(Fields[0].Value);
    edit11.Text := FloatToStr(Fields[1].AsFloat);
    //edit11.Text := strtofloat(Trim(Fields[1].Value));
    end;
  end;
  tampil;
end;

procedure TForm3.jumlahtotal;
begin
with dm.qdata do
  begin
  CLose;
  Sql.Clear;
  Sql.Add('Select Sum(HARGAMENU) As TOTALPEMESANAN From PEMESANAN');
  Sql.Add('Where PEMESANAN.NOPEMESANAN =:np');
  Prepare;
  ParamByName('np').AsString := Trim(edit1.text);
  Open;
  Edit4.text := FloatToStr(Fields[0].asFloat);
  end;
end;

procedure TForm3.tampilitem;
begin
with dm.qdata do
  begin
  Close;
  Sql.Clear;
  Sql.Add('Select PEMESANAN.NOPEMESANAN,MENUMAKAN.NAMAMENU, MENUMAKAN.HARGAMENU, TOTALPEMESANAN From PEMESANAN');
  Sql.Add('Inner Join MENUMAKAN on MENUMAKAN.KODEMENU = PEMESANAN.KODEMENU');
  Sql.Add('Where PEMESANAN.NOPEMESANAN =:np');
  Prepare;
  ParamByName('np').AsString := Trim(edit1.Text);
  Open;
  end;
end;

Procedure TForm3.tampil;
begin
jumlahtotal;
tampilitem;
end;

end.

avatar andyandy
@andyandy

1 Kontribusi 0 Poin

Dipost 6 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban