说三道四技术文摘-感悟人生的经典句子
说三道四 > 文档快照

源文件,修改??

编辑:说三道四文库 发布时间:2018-02-24 05:58
HTML文档下载 WORD文档下载 PDF文档下载
var
num:integer;
begin
dbgrid2.Visible:=false;
//显示当前日期应该继续的单号
dtp_cgrq.Date:=NOW;
with adoq_csh do
  begin
      close;
      sql.clear;
      sql.Add('select distinct pjh from tbl_cgxx where rq='''+datetostr(dtp_cgrq.date)+'''');
      open;
      if RecordCount=0 then
        begin
            edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+'001';
        end;
      if recordCount<>0 then
        begin
            num:=recordcount;
            if (length(inttostr(num))=1) and (num<>9)then
                begin
                        edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+'00'+inttostr(num+1);
                end;
            if num=9 then
                begin
                        edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+'0'+inttostr(num+1);
                end;
            if (length(inttostr(num))=2) and (num<>99) then
                begin
                        edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+'0'+inttostr(num+1);
                end;
            if num=99 then
                begin
                        edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+inttostr(num+1);
                end;
            if (length(inttostr(num))=3) and (num<>999) then
                begin
                        edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+inttostr(num+1);
                end;
           { if num=999 then
                begin
                        showmessage('单号已经超过了一天应该开的单数了,很抱歉,如果有需要请与软件开发商联系!');
                        edt_cgdh.Text:='';
                        exit;
                end;      }
        end;
  end;
//窗体创建后,dbgrid1的显示
with adoq_add do
  begin
     close;
     sql.Clear;
     {sql.Add('insert into ##cglsb values('''+trim(edt_cgdh.text)+''','''+trim(edt_gysbh.text)+''','''+trim(edt_gysmc.text)+''','''+trim(edt_hpdh.text)+''','''+trim(edt_hpmc.Text)+''','+edt_cgdj.Text+','+edt_cgsl.Text+','+'0'+','''+trim(edt_rhckbh.text)+''','''+trim(edt_rhck.Text)+''')');
     //showmessage('insert into ##cglsb values('''+trim(edt_cgdh.text)+''','''+trim(edt_gysbh.text)+''','''+trim(edt_gysmc.text)+''','''+trim(edt_hpdh.text)+''','+edt_cgdj.Text+','+edt_cgsl.Text+','+'0'+','''+trim(edt_rhckbh.text)+''','''+trim(edt_rhck.Text)+''')');
     execsql;
     close;
     sql.Clear;
    sql.Add('select gysmc as 供应商名称,##cglsb.hpdh as 货品编号,hpmc as 货品名称,cgdj as 预采购单价,cgsl as 预采购数量,ckmc as 预入货仓库 from ##cglsb,tbl_hpxx,tbl_gysxx,tbl_ckxx ');
     sql.Add(' where ##cglsb.gysbh=tbl_gysxx.gysbh and ##cglsb.hpdh=tbl_hpxx.hpdh and ##cglsb.rhckbh=tbl_ckxx.ckbh'); }
     sql.Add('select gysbh as 供应商编号,gysmc as 供应商名称,hpdh as 货品编号,hpmc as 货品名称,cgdj as 预采购单价,cgsl as 预采购数量,rhckbh as 仓库编号,rhckmc as 仓库名称 from ##cglsb');
     open;
  end;
  //窗体创建后,第一个获得焦点的对象
edt_czy.SetFocus;
贴的代码太长了!
欢迎与我探讨问题,我的E-Mail: guangbowang@yahoo.com.cn
先做一个取数据库服务器时间的函数,如GETSERVERDATE。(如果单机版则不必)
with adoq_csh do
  begin
      close;
      sql.clear;
      sql.Add('select distinct pjh from tbl_cgxx where rq=convert(varchar(10),getdate(),20))');
      open;
      if RecordCount=0 then
        begin
            edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+'001';
        end;
      if recordCount<>0 then
        begin
            //查询一次单号最大值(省略)dhLength
//再判断是否为999
            case dhLength of
            1:edit1.Text:=日期+'00'+inttostr(strtoint(fieldvalues['dh'])+1);
            2:edit1.Text:=日期+'0'+inttostr(strtoint(fieldvalues['dh'])+1);
            3:edit1.Text:=日期+inttostr(strtoint(fieldvalues['dh'])+1);
         end;
      else =99
        edt_cgdh.Text:='';
                        exit;
                end;      }
        end;
  end;
大概就这样,临时表我不明白情况/
先做一个取数据库服务器时间的函数,如GETSERVERDATE。(如果单机版则不必)
with adoq_csh do
  begin
      close;
      sql.clear;
      sql.Add('select distinct pjh from tbl_cgxx where rq=convert(varchar(10),getdate(),20))');
      open;
      if RecordCount=0 then
        begin
            edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+'001';
        end;
      if recordCount<>0 then
        begin
            //查询一次单号最大值(省略)dhLength
//再判断是否为999
            case dhLength of
            1:edit1.Text:=日期+'00'+inttostr(strtoint(fieldvalues['dh'])+1);
            2:edit1.Text:=日期+'0'+inttostr(strtoint(fieldvalues['dh'])+1);
            3:edit1.Text:=日期+inttostr(strtoint(fieldvalues['dh'])+1);
         end;
      else =99
        edt_cgdh.Text:='';
                        exit;
                end;      }
        end;
  end;
大概就这样,临时表我不明白情况/
先做一个取数据库服务器时间的函数,如GETSERVERDATE。(如果单机版则不必)
with adoq_csh do
  begin
      close;
      sql.clear;
      sql.Add('select distinct pjh from tbl_cgxx where rq=convert(varchar(10),getdate(),20))');
      open;
      if RecordCount=0 then
        begin
            edt_cgdh.Text:='C'+formatdatetime('yyyymmdd',now)+'001';
        end;
      if recordCount<>0 then
        begin
            //查询一次单号最大值(省略)dhLength
//再判断是否为999
            case dhLength of
            1:edit1.Text:=日期+'00'+inttostr(strtoint(fieldvalues['dh'])+1);
            2:edit1.Text:=日期+'0'+inttostr(strtoint(fieldvalues['dh'])+1);
            3:edit1.Text:=日期+inttostr(strtoint(fieldvalues['dh'])+1);
         end;
      else =99
        edt_cgdh.Text:='';
                        exit;
                end;      }
        end;
  end;
大概就这样,临时表我不明白情况/
备案号:鲁ICP备13029499号-2 说三道四 www.s3d4.cn 说三道四技术文摘