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

📄 unit2.pas

📁 发票套打功能
💻 PAS
📖 第 1 页 / 共 3 页
字号:
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, QRCtrls, jpeg, QuickRpt, ExtCtrls, ComCtrls, ToolWin,
  Grids, DBGrids,  DB, LabelButton ;

type
  TForm2 = class(TForm)
    palUp: TPanel;
    palLeftUp: TPanel;
    imgGrayLeftUp: TImage;
    imgColorLeftUp: TImage;
    imgLeftUp: TImage;
    imgSysIcon: TImage;
    imgLeftUp1: TImage;
    palRightUp: TPanel;
    imgGrayRightUp: TImage;
    imgRestoreButton: TImage;
    imgMaxButton: TImage;
    imgRightUp: TImage;
    imgCloseButton: TImage;
    imgMinButton: TImage;
    imgSizeButton: TImage;
    imgColorRightUp: TImage;
    imgRightUp1: TImage;
    palUpMid: TPanel;
    imgColorMenubar: TImage;
    imgGrayCaption: TImage;
    imgGrayMenuBar: TImage;
    imgCaption: TImage;
    lbCaption: TLabel;
    imgColorCaption: TImage;
    CoolBarMenu: TCoolBar;
    ToolBarMenu: TToolBar;
    palDown: TPanel;
    imgLeftDown: TImage;
    imgRightDown: TImage;
    imgDownMin: TImage;
    palLeft: TPanel;
    imgLeft: TImage;
    palRight: TPanel;
    imgRight: TImage;
    palClient: TPanel;
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    DBGrid1: TDBGrid;
    Button3: TButton;
    ZFXS: TDataSource;
    ComboBox1: TComboBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    procedure imgCaptionMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure imgCaptionMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure imgCaptionMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure imgCloseButtonClick(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ComboBox3Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Button3Click(Sender: TObject);
    procedure ComboBox3Exit(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure ComboBox1Exit(Sender: TObject);
    procedure SeSkinRadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure ComboBox2Exit(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
  private
    {发票种类变量}
    FpZL : String ;
    {当选择框选择哪个时,把汉字转为拼音,以对表的名字}
    Fppy : String ;
    //移动窗体
    canmove:boolean;
    curPoint:TPoint;
    oldPoint:TPoint;
    Canvas:TCanvas;
    {查询租赁业发票}
    procedure ZlyFP();
    {查询转让无形资产发票}
    procedure ZrwxzcFP();
    {查询其它服务业发票}
    procedure QtfwyFP();
    {查询转让不动产发票}
    procedure ZrbdcFP();
    {查询建筑业发票}
    procedure JzyFP();

    {作废租赁业发票}
    procedure ZlyFPZF();
    {作废转让无形资产发票}
    procedure ZrwxzcFPZF();
    {作废其它服务业发票}
    procedure QtfwyFPZF();
    {作废其它服务业产发票}
    procedure ZrbdcFPZF();
    {作废建筑业发票}
    procedure JzyFPZF();

    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses Unit3, unit4;

{$R *.dfm}

procedure TForm2.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 TForm2.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 TForm2.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 TForm2.imgCloseButtonClick(Sender: TObject);
begin
  close ;
end;

procedure TForm2.Button2Click(Sender: TObject);
begin
  close ;
end;

procedure TForm2.ComboBox3Change(Sender: TObject);
begin
   Case combobox1.ItemIndex of
      0:
        {建筑业发票}
        begin
           Fppy := 'JzyFP';
        end;
      1:
        {其它服务业发票}
        begin
           Fppy := 'QtfwyFP';
        end;
      2:
        {转让不动产发票}
        begin
           Fppy := 'ZrbdcFP';
        end;
      3:
        {转让无形资产发票}
        begin
           Fppy := 'ZrwxzcFP';
        end;
      4:
        {租赁业发票}
        begin
           Fppy := 'ZlyFP';
        end;
    end;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
  if edit1.Text ='' then
  Begin
    application.messagebox(pchar('请输入要查询的条件   !   '),pchar('提示')  ,MB_ICONINFORMATION);
    Exit ;
  end ;
  if combobox1.Text ='租赁业发票' then
  begin
    {查询租赁业发票}
    ZlyFP ;
    exit ;
  end;
  if combobox1.Text ='转让无形资产发票' then
  begin
    {查询转让无形资产发票}
    ZrwxzcFP ;
    exit ;
  end;
  if combobox1.Text ='其它服务业发票' then
  begin
    {查询其它服务业发票}
    QtfwyFP ;
    exit ;
  end;
  if combobox1.Text ='转让不动产发票' then
  begin
    {查询转让不动产发票}
    ZrbdcFP ;
    exit ;
  end;
  if combobox1.Text ='建筑业发票' then
  begin
    {查询建筑业发票}
    JzyFP ;
    exit ;
  end;
  Application.MessageBox(PChar('对不起,没有此发票  !'), PChar('提示'),MB_ICONINFORMATION);
end;
{查询查询建筑业发票}
procedure TForm2.JzyFP();
Var
  {定义一个查询的条件Where}
  Tj : String ;
begin
try
   with CustomerData do
   begin
     //发票号码
     if Radiobutton1.Checked then
     begin
        //它的意思是模糊查询
        //Tj := 'Where 发票号码 like'+'"'+'%'+edit1.Text+'%'+'"' ;
        //完全
        FpZF.Close ;
        Tj := 'Where 发票号码 ='+''''+edit1.Text+'''' ;
        FpZF.SQL.Clear ;
        {Fppy为要查询的表名}
        FpZF.SQL.Add('Select * From JzyFP') ;
        FpZF.SQL.Add(Tj) ;
        {开始查询}
        FpZF.Open ;
        exit ;
     end;
     //客户名称
     if Radiobutton2.Checked then
     begin
        FpZF.Close ;
        //Tj := 'Where 客户编码 like'+'"'+'%'+edit1.Text+'%'+'"' ;
        Tj := 'Where 客户编码 ='+''''+edit1.Text+'''' ;
        FpZF.SQL.Clear ;
        {Fppy为要查询的表名}
        FpZF.SQL.Add('Select * From JzyFP') ;
        FpZF.SQL.Add(Tj) ;
        {开始查询}
        FpZF.Open ;
        exit ;
     end;
     //客户名称
     if Radiobutton3.Checked then
     begin
        FpZF.Close ;
        Tj := 'Where 客户名称 like'+''''+'%'+edit1.Text+'%'+'''' ; ;
        FpZF.SQL.Clear ;
        {Fppy为要查询的表名}
        FpZF.SQL.Add('Select * From JzyFP') ;
        FpZF.SQL.Add(Tj) ;
        {开始查询}
        FpZF.Open ;
        exit ;
     end;
   end;
     Application.MessageBox(PChar('对不起,没有此发票  !'), PChar('提示'),MB_ICONINFORMATION);
     exit ;
except
     Application.MessageBox(PChar('对不起,没有此发票  !'), PChar('提示'),MB_ICONINFORMATION);
end;
end;
{查询转让不动产发票}
procedure TForm2.ZrbdcFP();
Var
  {定义一个查询的条件Where}
  Tj : String ;
begin

⌨️ 快捷键说明

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