Recent Posts

Jumat, 14 Desember 2012

NOMOR OTOMATIS


procedure Tfo_list_peminjam.init_otomatis;
var n,x,t : integer;
    d,m : Word;
    h : real;
    s,i,p,c : string;
    b : boolean;
function testing(a,b : Integer):string;
begin
  //Result := testing(a);
  while Length(Result)<b do Result := '0'+Result;
end;
begin
  n := 1;
  //m := YearOf(Date);
  //d := MonthOf(date);
  s := testing(d,2);
  i := testing(n,4)+IntToStr(m)+s;
  With dm_pinjam.qu_pinjam do
  begin
    close;
    sql.Clear;
    sql.Add('select * from tb_pinjam');
    sql.Add('order by urut desc');
    Open;
    if dm_pinjam.qu_pinjam.RecordCount > 0 then
    begin
    First;
    c := copy(dm_pinjam.qu_pinjamurut.Value,1,5);
    dm_pinjam.qu_pinjam.Append;
    t := StrToInt(c)+1;
    c := FormatFloat('00000',t);
    p := c;
    ed_kode_pinjam.Text :=p;
    ed_urut.Text :=p;
    end else
    begin
    dm_pinjam.qu_pinjam.Append;
    ed_kode_pinjam.Text :='00001';
    ed_urut.Text :='00001';
  end;
end;
end;

0 komentar:

Posting Komentar