⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 un_applicant.~pas

📁 Delphi 开发的很好用的客户管理源代码
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
    Com_code:=' '
  else
    begin
    val(ed_code.Text,i,code);
    if code<>0 then
      begin
      Application.MessageBox('邮编输入不正确!','提示', mb_ok);
      exit;
      end;
    Com_code:=ed_code.Text ;//邮编
    end;
  com_mail:=ed_mail.text;
  if com_mail='' then com_mail:=' ';

  with select_company do
    begin
    Close ;
    sql.clear;
    sql.Add('select * from client where com_name=:@com_name');
    Parameters.ParamByName('@com_name').value:=com_name;
    prepared:=true;
    open;
    while not eof do
     if fieldbyname('client_id').value =com_id then
      next
    else
      begin
      xx:='公司名称:'+com_name+'已经存在!';
      Application.MessageBox(pchar(xx),'提示', MB_ok);
      exit;
      end;
    end ;

  with insert_client do
  begin
    close;
    sql.clear;
    sql.add('update client set Com_name=:@Com_name,Com_account=:@Com_account,Com_code=:@Com_code');
    sql.add(',Com_tel=:@Com_tel,Com_addr=:@Com_addr,Com_rep=:@Com_rep,com_mail=:@com_mail');
    sql.add(',Com_account_bank=:@Com_account_bank,com_relation=:@com_relation,com_tax_no=:@com_tax_no');
    sql.add(' where client_id=:@com_id');

    Parameters.ParamByName('@Com_id').value :=com_id;//id
    Parameters.ParamByName('@Com_name').value :=Com_name;//单位名称
    Parameters.ParamByName('@Com_account').value :=Com_account;//帐号
    Parameters.ParamByName('@Com_code').value :=Com_code;//邮编
    Parameters.ParamByName('@Com_tel').value :=Com_tel;//电话
    Parameters.ParamByName('@Com_addr').value :=Com_addr;//地址
    Parameters.ParamByName('@Com_rep').value :=Com_rep;//法人代表
    Parameters.ParamByName('@Com_account_bank').value :=Com_account_bank;//开户银行
    Parameters.ParamByName('@com_relation').value :=com_relation;//联系人
    Parameters.ParamByName('@com_tax_no').value :=com_tax_no;//税号
    Parameters.ParamByName('@com_mail').value :=com_mail;//e_mail
    prepared:=true;
    Execsql;
    Application.MessageBox('客户信息已修改.','客户信息', mb_ok);
    bitbtn4.Enabled :=false;
    ed_name.text:='';
    ed_account.text:='';
    ed_code.text:='';
    ed_rep.text:='';
    ed_tel.text:='';
    ed_addr.text:='';
    ed_tax_no.text:='';
    ed_mail.text:='';
    ed_relation.text:='';
    ed_account_bank.text:='';
  end;

end;


procedure Tfm_applicant.FormKeyPress(Sender: TObject; var Key: Char);
var
  sClassName:string;
begin


if Key = #13 then
     begin
     sClassName := TForm(Sender).ActiveControl.ClassName;
     if (sClassName <> 'TDBMemo')
     And (sClassName <> 'TMemo') then
     begin
     Key := #0;
     Perform(WM_NEXTDLGCTL, 0, 0);
     end;
     end;
end;
function NumMask(var key:char): char;
begin
if not(key in['0'..'9',#8])then
      begin
        key:=#0;
        MessageBeep(1);
      end;
      result :=key;
end;
function DoubleNumMask(var key:char):char;
begin
if not(key in['0'..'9',#8,'.'])then
      begin
        key:=#0;
        MessageBeep(1);
      end;
      result :=key;
end;
function TelNumMask(var key:char):char;
begin
if not(key in['0'..'9',#8,'-',','])then
      begin
        key:=#0;
        MessageBeep(1);
      end;
      result :=key;
end;

function AccNumMask(var key:char):char;
begin
if not(key in['0'..'9',#8,'-','X','x',','])then
      begin
        key:=#0;
        MessageBeep(1);
      end;
      result :=key;
end;


procedure Tfm_applicant.ed_telKeyPress(Sender: TObject; var Key: Char);
begin
key:=TelNumMask(key);
end;

procedure Tfm_applicant.ed_accountKeyPress(Sender: TObject; var Key: Char);
begin
key:=AccNumMask(key);
end;

procedure Tfm_applicant.ed_codeKeyPress(Sender: TObject; var Key: Char);
begin
key:=NumMask(key);

end;

procedure Tfm_applicant.ed_tax_noKeyPress(Sender: TObject; var Key: Char);
begin
key:=telNumMask(key);

end;
function num_str(ls: Variant): string; //转换大写(包含单位)
var
    dx_sz, dx_dw, str_int, str_dec, dx_str, fu: string;
    a, b, b2, c, d: string;
    num_int, num_dec, len_int, i, a_int, pp: integer;
    //dx—str为返回字符串
begin
    dx_sz := '零壹贰叁肆伍陆柒捌玖';
    dx_dw := '万仟佰拾亿仟佰拾万仟佰拾元';
//处理金额小于零情况
    if ls < 0 then
    begin
        ls := ls * (-1);
        fu := '负';
    end else fu := '';
//取得整数值及整数串
    dx_str := ls;
    if (ls > 0) and (ls < 1) then dx_str := '0' + dx_str;
    pp := pos('.', dx_str);
    if pp > 0 then str_int := copy(dx_str, 1, pos('.', dx_str) - 1)
    else str_int := dx_str;
    num_int := strtoint(str_int);
//取得小数值及小数串
    if (ls > 0) and (ls < 1) then num_dec := ls * 100
    else num_dec := (ls - num_int) * 100;
    str_dec := inttostr(num_dec);
    len_int := Length(str_int);
    dx_str := '';
//转换整数部分
    for i := 1 to len_int do
    begin
    //a为小写数字字符,b为对应的大写字符
    //c为对应大写单位,d为当前大写字符串的最后一个汉字
        a := copy(str_int, i, 1);
        a_int := strtoint(a);
        b := copy(dx_sz, (a_int * 2 + 1), 2);
        c := copy(dx_dw, ((13 - len_int + i - 1) * 2 + 1), 2);
        if dx_str <> '' then
            d := copy(dx_str, Length(dx_str) - 1, 2)
        else d := '';
        if (b = '零') and ((d = '零') or (b = b2) or (c = '元') or (c = '万') or (c = '亿')) then b := '';
        if (a = '0') and (c <> '元') and (c <> '万') and (c <> '亿') then c := '';
        if ((c = '元') or (c = '万') or (c = '亿')) and (d = '零') and (a = '0') then
        begin
            dx_str := copy(dx_str, 1, Length(dx_str) - 2);
            d := copy(dx_str, Length(dx_str) - 1, 2);
            if ((c = '元') and (d = '万')) or ((c = '万') and (d = '亿')) then c := '';
        end;
        dx_str := dx_str + b + c;
        b2 := b;
    end;
//处理金额小于1的情况
    if Length(dx_str) <= 2 then dx_str := '';
//转换小数部分
    if (num_dec < 10) and (ls > 0) then
    begin
        a_int := strtoint(str_dec);
        b := copy(dx_sz, (a_int * 2 + 1), 2);
        if num_dec = 0 then dx_str := dx_str + '整';
        if num_dec > 0 then dx_str := dx_str + '零' + b + '分';
    end;
    if num_dec >= 10 then
    begin
        a_int := strtoint(copy(str_dec, 1, 1));
        a := copy(dx_sz, (a_int * 2 + 1), 2);
        a_int := strtoint(copy(str_dec, 2, 1));
        b := copy(dx_sz, (a_int * 2 + 1), 2);
        if a <> '零' then a := a + '角';
        if b <> '零' then b := b + '分'
        else b := '';
        dx_str := dx_str + a + b;
    end;
    if ls = 0 then dx_str := '零元整';
    dx_str := fu + dx_str;
//函数返回字符串
    Result := dx_str;
end;

function num_str1(ls: Variant; spacenum: integer): string; //转换大写(不包含单位)
var
    dx_sz, dx_dw, str_int, str_dec, dx_str, fu, ls_space: string;
    a, b, b2, c, d: string;
    num_int, num_dec, len_int, i, a_int, pp: integer;
    //dx—str为返回字符串
begin
    dx_sz := '零壹贰叁肆伍陆柒捌玖';
    ls := ls * 100;
    str_int := ls;
//空格数
    ls_space := '';
    for i := 1 to spacenum do
    begin
        ls_space := ls_space + ' ';
    end;
{
//处理金额小于零情况
if ls<0 then
    begin
    ls:=ls*(-1) ;
    fu:='负';
    end else fu:='';
//取得整数值及整数串
dx_str:=ls;
if (ls>0)and(ls<1) then dx_str:='0'+dx_str;
    pp:=pos('.',dx_str);
if pp>0 then str_int:=copy(dx_str,1,pos('.',dx_str)-1)
else str_int:=dx_str;
num_int:=strtoint(str_int);
//取得小数值及小数串
if (ls>0)and(ls<1) then num_dec:=ls*100
else num_dec:=(ls-num_int)*100;
str_dec:=inttostr(num_dec);
}
    len_int := Length(str_int);
    dx_str := '';
//转换整数部分
    for i := 1 to len_int do
    begin
    //a为小写数字字符,b为对应的大写字符
    //c为对应大写单位,d为当前大写字符串的最后一个汉字
        a := copy(str_int, i, 1);
        a_int := strtoint(a);
        b := copy(dx_sz, (a_int * 2 + 1), 2);
    {
    c:=copy(dx_dw,((13-len_int+i-1)*2+1),2);
    if dx_str<> '' then
    d:=copy(dx_str,Length(dx_str)-1,2)
    else d:='' ;
    if (b='零') and ((d='零') or (b=b2) or (c='元') or (c='万') or (c='亿')) then b:='' ;
    if (a='0') and (c<>'元') and (c<>'万')and(c<>'亿') then c:='';
    if ((c='元') or (c='万') or (c='亿')) and (d='零') and (a='0') then
        begin
        dx_str:=copy(dx_str,1,Length(dx_str)-2);
        d:=copy(dx_str,Length(dx_str)-1,2);
        if ((c='元') and (d='万')) or ((c='万')and(d='亿')) then c:='';
        end;
    }
        dx_str := dx_str + ls_space + b; //+c;
    //b2:=b;
    end;
{
//处理金额小于1的情况
if Length(dx_str)<=2 then dx_str:='' ;
//转换小数部分
if (num_dec<10)and(ls>0) then
    begin
    a_int:=strtoint(str_dec);
    b:=copy(dx_sz,(a_int*2+1),2);
    if num_dec=0 then dx_str:=dx_str+'整';
    if num_dec>0 then dx_str:=dx_str+'零'+b+'分';
    end;
if num_dec>=10 then
    begin
    a_int:=strtoint(copy(str_dec,1,1));
    a:=copy(dx_sz,(a_int*2+1),2);
    a_int:=strtoint(copy(str_dec,2,1));
    b:=copy(dx_sz,(a_int*2+1),2);
    if a <> '零' then a:=a+'角';
    if b <> '零' then b:=b+'分'
    else b:='';
    dx_str:=dx_str+a+b;
    end;
if ls=0 then dx_str:='零元整';
dx_str:=fu+dx_str;
}
//函数返回字符串
    Result := dx_str;
end;

procedure Tfm_applicant.FormCreate(Sender: TObject);
begin
ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=client.mdb;Persist Security Info=False';
ADOConnection1.Connected:=true;
end;

procedure Tfm_applicant.ed_repKeyPress(Sender: TObject; var Key: Char);
begin
key:=TelNumMask(key);

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -