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

📄 unit5.~pas

📁 正配置数据才能运行 1.如果你没有配置数据库,那会提示你没有配置,强出一个框,你按确定后,进入登陆窗口,在最下面有一个新键配置方案,单击此处,然后弹出一个配置框,相信编写数据的朋友们应该知道怎么做了吧
💻 ~PAS
📖 第 1 页 / 共 3 页
字号:
        //FPTJ.SQL.Add('Select * From '+Fppy) ;
        FPTJ.SQL.Add(Tj) ;
        FPTJ.SQL.Add(Tj1) ;
        {开始查询}
        FPTJ.ExecSQL ;
        FPTJ.Close ;
        FPTJ.Open ;
        {如果没有记录则让查找为可用,统计为不可用}
        if FPTJ.RecordCount =0 then
        begin
            Application.MessageBox(PChar('对不起没有符合条件的记录 !'), PChar('提示'),MB_ICONINFORMATION);
            exit ;
        end;
        {显示共查找到多少条记录}
        Application.MessageBox(PChar('一共找到 '+inttostr(FPTJ.RecordCount)+'  条记录,如果要统计请单击上面 开始统计 按钮 !'), PChar('提示'),MB_ICONINFORMATION);
        StatusBar1.Panels[1].Text := inttostr(FPTJ.RecordCount);
        StatusBar1.Panels[3].Text := DatoFB('0.00');
        exit ;
     end;
     //以时间来统计
     if Radiobutton3.Checked then
     begin
        Tj := 'Where 客户名称 like'+''''+'%'+edit6.Text+'%'+'''' ;
        FPTJ.SQL.Clear ;
        {Fppy为要查询的表名}
        FPTJ.SQL.Add('Select * From ZrwxzcFP') ;
        //FPTJ.SQL.Add('Select * From '+Fppy) ;
        FPTJ.SQL.Add(Tj) ;
        {开始查询}
        FPTJ.ExecSQL ;
        FPTJ.Close ;
        FPTJ.Open ;
        {如果没有记录则让查找为可用,统计为不可用}
        if FPTJ.RecordCount =0 then
        begin
            Application.MessageBox(PChar('对不起没有符合条件的记录 !'), PChar('提示'),MB_ICONINFORMATION);
            exit ;
        end;
        {显示共查找到多少条记录}
        Application.MessageBox(PChar('一共找到 '+inttostr(FPTJ.RecordCount)+'  条记录,如果要统计请单击上面 开始统计 按钮 !'), PChar('提示'),MB_ICONINFORMATION);
        StatusBar1.Panels[1].Text := inttostr(FPTJ.RecordCount);
        StatusBar1.Panels[3].Text := DatoFB('0.00');
        exit ;
     end;
   end;
     Application.MessageBox(PChar('对不起,没有此发票  !'), PChar('提示'),MB_ICONINFORMATION);
     exit ;
except
     Application.MessageBox(PChar('对不起,没有此发票  !'), PChar('提示'),MB_ICONINFORMATION);
end;
end;
{查找租赁业发票}
procedure TForm5.Zlyfp();
Var
  {定义一个查询的条件Where}
  Tj, Tj1 : String ;
begin
try
   with CustomerData do
   begin
     //客户编码
     if Radiobutton1.Checked then
     begin
        //Tj := 'Where 日期>= '+'"'+edit2.Text+'"'+ ' AND 日期 <= '+'"'+edit3.Text+'"'+'  客户编码 like'+'"'+'%'+edit1.Text+'%'+'"' ;
        //Tj := 'Where 日期 '+'"'+edit2.Text+'"'+' and 日期<=' +'"'+edit3.Text+'"' ;
        //Tj := 'Where 客户编码 =' +'"'+edit1.Text+'"' ;
        Tj := 'Where 客户编码 =' +''''+edit1.Text+''''+'and 日期>= '+''''+edit2.Text+''''+'and 日期<= '+''''+edit3.Text+'''';
        FPTJ.SQL.Clear ;
        {Fppy为要查询的表名}
        FPTJ.SQL.Add('Select * From Zlyfp') ;
        //FPTJ.SQL.Add('Select * From '+Fppy) ;
        FPTJ.SQL.Add(Tj) ;
        FPTJ.SQL.Add(Tj1) ;
        {开始查询}
        FPTJ.ExecSQL ;
        FPTJ.Close ;
        FPTJ.Open ;
        {如果没有记录则让查找为可用,统计为不可用}
        if FPTJ.RecordCount =0 then
        begin
            Application.MessageBox(PChar('对不起没有符合条件的记录 !'), PChar('提示'),MB_ICONINFORMATION);
            exit ;
        end;
        {显示共查找到多少条记录}
        Application.MessageBox(PChar('一共找到 '+inttostr(FPTJ.RecordCount)+'  条记录,如果要统计请单击上面 开始统计 按钮 !'), PChar('提示'),MB_ICONINFORMATION);
        StatusBar1.Panels[1].Text := inttostr(FPTJ.RecordCount);
        StatusBar1.Panels[3].Text := DatoFB('0.00');
        exit ;
     end;
     //以时间来统计
     if Radiobutton2.Checked then
     begin
        Tj := 'Where 日期>= '+''''+edit4.Text+''''+' and 日期<= '+''''+edit5.Text+'''';
        //Tj :='WHERE (日期 >= "1985-08-27") AND (日期 <="2000-08-27")';
        FPTJ.SQL.Clear ;
        {Fppy为要查v询的表名}
        FPTJ.SQL.Add('Select * From Zlyfp') ;
        //FPTJ.SQL.Add('Select * From '+Fppy) ;
        FPTJ.SQL.Add(Tj) ;
        FPTJ.SQL.Add(Tj1) ;
        {开始查询}
        FPTJ.ExecSQL ;
        FPTJ.Close ;
        FPTJ.Open ;
        {如果没有记录则让查找为可用,统计为不可用}
        if FPTJ.RecordCount =0 then
        begin
            Application.MessageBox(PChar('对不起没有符合条件的记录 !'), PChar('提示'),MB_ICONINFORMATION);
            exit ;
        end;
        {显示共查找到多少条记录}
        Application.MessageBox(PChar('一共找到 '+inttostr(FPTJ.RecordCount)+'  条记录,如果要统计请单击上面 开始统计 按钮 !'), PChar('提示'),MB_ICONINFORMATION);
        StatusBar1.Panels[1].Text := inttostr(FPTJ.RecordCount);
        StatusBar1.Panels[3].Text := DatoFB('0.00');
        exit ;
     end;
     //以时间来统计
     if Radiobutton3.Checked then
     begin
        Tj := 'Where 承租方 like '+''''+'%'+edit6.Text+'%'+'''' ;
        //Tj :='WHERE (日期 >= "1985-08-27") AND (日期 <="2000-08-27")';
        FPTJ.SQL.Clear ;
        {Fppy为要查v询的表名}
        FPTJ.SQL.Add('Select * From Zlyfp ') ;
        //FPTJ.SQL.Add('Select * From '+Fppy) ;
        FPTJ.SQL.Add(Tj) ;
        {开始查询}
        FPTJ.ExecSQL ;
        FPTJ.Close ;
        FPTJ.Open ;
        {如果没有记录则让查找为可用,统计为不可用}
        if FPTJ.RecordCount =0 then
        begin
            Application.MessageBox(PChar('对不起没有符合条件的记录 !'), PChar('提示'),MB_ICONINFORMATION);
            exit ;
        end;
        {显示共查找到多少条记录}
        Application.MessageBox(PChar('一共找到 '+inttostr(FPTJ.RecordCount)+'  条记录,如果要统计请单击上面 开始统计 按钮 !'), PChar('提示'),MB_ICONINFORMATION);
        StatusBar1.Panels[1].Text := inttostr(FPTJ.RecordCount);
        StatusBar1.Panels[3].Text := DatoFB('0.00');
        exit ;
     end;
   end;
     Application.MessageBox(PChar('对不起,没有此发票  !'), PChar('提示'),MB_ICONINFORMATION);
     exit ;
except
     Application.MessageBox(PChar('对不起,没有此发票  !'), PChar('提示'),MB_ICONINFORMATION);
end;
end;

procedure TForm5.Edit2Exit(Sender: TObject);
var
  DDate : Tdate ;
begin
try
  DDate:= StrtoDatetime(edit2.Text);
  edit2.Text := formatdatetime('yyyy-mm-dd',DDate);
except
     Application.MessageBox(PChar('请正确填写日期,日期格式为:  1985-08-27   !'), PChar('提示'),MB_ICONINFORMATION);
     edit2.Text :='' ;
     edit2.SetFocus ;
end;
end;
procedure TForm5.Edit3Exit(Sender: TObject);
var
  DDate : Tdate ;
begin
try
  DDate:= StrtoDatetime(edit3.Text);
  edit3.Text := formatdatetime('yyyy-mm-dd',DDate);
except
     Application.MessageBox(PChar('请正确填写日期,日期格式为:  1985-08-27   !'), PChar('提示'),MB_ICONINFORMATION);
     edit3.Text :='' ;
     edit3.SetFocus ;  
end;
end;

procedure TForm5.Edit5Exit(Sender: TObject);
var
  DDate : Tdate ;
begin
try
  DDate:= StrtoDatetime(edit5.Text);
  edit5.Text := formatdatetime('yyyy-mm-dd',DDate);
except
     Application.MessageBox(PChar('请正确填写日期,日期格式为:  1985-08-27   !'), PChar('提示'),MB_ICONINFORMATION);
     edit5.Text :='' ;
     edit5.SetFocus ;
end;
end;
procedure TForm5.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
   //只能输入数字
  if not ( Key in ['0'..'9',#13,#8]) then Key := #0;
end;

procedure TForm5.imgCaptionMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if (Button=mbLeft)and(ssLeft in Shift)then
  begin
    canmove:=true;
    Canvas:=TCanvas.Create;
    with Canvas do
    begin
      pen.Style :=psdot;
      brush.Style :=bsClear;
      pen.Width :=2;
      Pen.Mode :=pmNotXor;
      Handle :=GetDC(0);
      Rectangle(left,top,Left+width,top+height);
      curPoint.X :=X;
      curPoint.Y :=Y;
      oldPoint.X :=Left;
      oldPoint.Y :=Top;
    end;        //end with
  end;  //end if
end;

procedure TForm5.imgCaptionMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
  if not canmove then exit;
  with Canvas do
  begin
    Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
    oldPoint.x :=Left +X-curPoint.x;
    oldPoint.y :=Top +Y-curPoint.y;
    Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
  end;
end;

procedure TForm5.imgCaptionMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if not canmove then exit;
  with Canvas do
  begin
    Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
    Left :=oldPoint.x;
    Top :=oldPoint.y;
    Free;
  end;
  canmove:=not canmove;
end;

procedure TForm5.Button1Click(Sender: TObject);
Var
   {合计金额}
   HJJA, i : Real ;
   {大写金额合计}
   DXJAHJ: String ;
begin
try
   with CustomerData do
   begin
     FPTJ.First ;
     HJJA := 0 ;
     while not FPTJ.Eof do
     begin
       HJJA := HJJA+FPTJ.FieldValues['金额'];
       FPTJ.Next ;
      end;
   end;
     DXJAHJ := DatoFB(formatfloat('0.00',HJJA)) ;
     Application.MessageBox(PChar('总记金额为:'+DXJAHJ +'  !'), PChar('提示'),MB_ICONINFORMATION);
     StatusBar1.Panels[3].Text := DXJAHJ ;
     //StatusBar1.Panels[5].Text := HJJA ;
except
     Application.MessageBox(PChar('统计金额失败  !'), PChar('提示'),MB_ICONINFORMATION);
end;
end;
procedure TForm5.FormShow(Sender: TObject);
begin
  {清空DBGrid1的内容}
  CustomerData.FPTJ.SQL.Clear ;
end;

procedure TForm5.ComboBox2Change(Sender: TObject);
begin
   Case combobox1.ItemIndex of
      0:
        {建筑业发票}
        begin
           Fppy := 'JzyFP';
        end;
      1:
        {租赁业发票}
        begin
           Fppy := 'Zlyfp';
        end;
      2:
        {其它服务业发票}
        begin
           Fppy := 'Qtfwyfp';
        end;
      3:
        {转让不动产发票}
        begin
           Fppy := 'Zrbdcfp';
        end;
      4:
        {转让无形资产发票}
        begin
           Fppy := 'Wxzcfp';
        end;
    end;
end;

procedure TForm5.RadioButton3Click(Sender: TObject);
begin
  if RadioButton3.Checked then
  begin
     GroupBox6.Enabled := true;
     GroupBox5.Enabled := False;
     GroupBox4.Enabled := False;
  end;
end;

procedure TForm5.Edit4Exit(Sender: TObject);
var
  DDate : Tdate ;
begin
try
  DDate:= StrtoDatetime(Edit4.Text);
  Edit4.Text := formatdatetime('yyyy-mm-dd',DDate);
except
     Application.MessageBox(PChar('请正确填写日期,日期格式为:  1985-08-27   !'), PChar('提示'),MB_ICONINFORMATION);
     Edit4.Text :='' ;
     Edit4.SetFocus ;
end;
end;

end.

⌨️ 快捷键说明

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