Selasa, 05 Mei 2015

SCRIPT UNTUK AUTO NUMBER TANGGAL DELPHI 7

 
procedure TForm1.kode;
var x,y, kode, kode_jadi, nol: string;
begin
  x:=''+FormatDateTime('ddmmyyyy',now)+'';
  y:=DateToStr(now);
  nol:='000';
  with ADOQuery1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select*from tb_transaksi where tanggal like'+QuotedStr(y)+' order by id_transaksi');
    Open;
    if recordcount > 0 then
    begin
      Last;
      kode:=fieldByName('id_transaksi').AsString;
      kode_jadi:=RightStr(kode,3);
      kode:=IntToStr(StrToInt(kode_jadi)+1);
      kode_jadi:=x+LeftStr(nol,3-length(kode))+kode;
      edit1.Text:=kode_jadi;
    end

    else
    begin
      edit1.Text:=x+'001';
    end;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
 var      urutan: integer;
     satu,dua,tiga,nopelanggan,nocash,nocredit:string;

     y,d,M : word;
begin

    DecodeDate(DateTimePicker1.Date, y,M,d );
    satu:=IntToStr(y);
    dua:=IntToStr(M);
    tiga:=IntToStr(d);



  urutan:=ADOQuery1.RecordCount+1;
  nopelanggan:=satu+dua+tiga+''+inttostr(urutan);
 // nocash:=satu+'C-'+dua+tiga+'-'+inttostr(urutan);
 // nocredit:=satu+'K-'+dua+tiga+'-'+inttostr(urutan);

  Form1.Edit1.Text:=nopelanggan;
 // Form1.Ekcash.Text:=nocash;
 // Form1.ekcredit.Text:=nocredit;

  Form1.Show;

end;

clickduit.com

Tidak ada komentar:

Posting Komentar