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

📄 frmmain.~pas

📁 发票管理系统其中包括: 1.租凭业发票 2.建筑业发票 3.固定资产发票 4.服务行业发票 5.无形资产发票
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
    AdvEdit4.SetFocus;
end;

procedure TMain.UpdateFP(aTable: string);
var
  aSQL: string;
begin
  with DataModule1.ADOSelect do
  begin
    SQL.Clear;
    aSQL := 'Delete From ' + aTable + ' Where 发票号码=' + QuotedStr(AdvEdit3.Text);
    SQL.Add(aSQL);
    ExecSQL;
    if aTable = 'TaxZly' then
      SaveFP01; //调用保存
    if aTable = 'TaxJzy' then
      SaveFP02; //调用保存
    if aTable = 'TaxGdzc' then
      SaveFP03; //调用保存
    if aTable = 'TaxFwhy' then
      SaveFP04; //调用保存
    if aTable = 'TaxWxzc' then
      SaveFP05; //调用保存
    Application.MessageBox('更新成功!  ', '贝壳提示', MB_OK + MB_ICONWARNING
      + MB_DEFBUTTON3 + MB_TOPMOST);
  end;
end;

procedure TMain.AdvEdit4KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
    AdvEdit5.SetFocus;
end;

procedure TMain.AdvEdit5KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
    AdvEdit6.SetFocus;
end;

procedure TMain.cxDateEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
    AdvEdit3.SetFocus;
end;

procedure TMain.N10Click(Sender: TObject);
begin
  Close;
end;

procedure TMain.SpeedButton6Click(Sender: TObject);
begin
  if CurrentFP = 'FP01' then
  begin
    aPrintForm := TPitPw.Create(Application);
    PrintFP01;
    aPrintForm.ShowModal;
  end;
  if CurrentFP = 'FP02' then
  begin
    aPrintForm := TPitPw.Create(Application);
    PrintFP02;
    aPrintForm.ShowModal;
  end;
  if CurrentFP = 'FP03' then
  begin
    aPrintForm := TPitPw.Create(Application);
    PrintFP03;
    aPrintForm.ShowModal;
  end;
  if CurrentFP = 'FP04' then
  begin
    aPrintForm := TPitPw.Create(Application);
    PrintFP04;
    aPrintForm.ShowModal;
  end;
  if CurrentFP = 'FP05' then
  begin
    aPrintForm := TPitPw.Create(Application);
    PrintFP05;
    aPrintForm.ShowModal;
  end;  
end;


procedure TMain.PrintFP02;
var
  CurrentIndex: Integer;
  aTmpFont: TFont;
  DrawMoneyCp, DrawMoney, DrawOne: string;
  i, j, THeight, TWidth: Integer;
begin
  with aPrintForm.Image1 do
  begin
    THeight := Canvas.TextHeight('1');
    aTmpFont := Canvas.Font;
    with Canvas do
    begin
      TextOut(500, 20, BKString);
      Font.Size := 14;
      Font.Name := '宋体';
      Font.Style := [fsBold];
      TextOut(250, 20, '建 筑 业 发 票');
      Font.Size := 10;
      Font.Name := '宋体';
      Font.Color := $004080FF;
      Font.Style := Font.Style - [fsBold];
    //////////////////////////////////////////////
      TextOut(370, 60, '开票日期:'); //
      TextOut(430, 60, DateToStr(cxDateEdit1.Date));
      TextOut(510, 60, '发票号码:'); //
      TextOut(570, 60, AdvEdit3.Text);
      TextOut(20, 80, '付款单位:'); //
      TextOut(80, 80, AdvEdit4.Text);
      TextOut(280, 80, '客户名称:'); //
      TextOut(340, 80, AdvEdit5.Text);
      TextOut(510, 80, '发票号码:'); //
      TextOut(570, 80, AdvEdit6.Text);

      Pen.Color := clBackground;
      MoveTo(430, 60 + THeight); //TextHeigth('1') 1只是个代表,计算它的高度
      LineTo(500, 60 + THeight);

      MoveTo(570, 60 + THeight);
      LineTo(570 + TextWidth(AdvEdit3.Text), 60 + THeight);

      MoveTo(80, 80 + THeight);
      LineTo(80 + TextWidth(AdvEdit4.Text), 80 + THeight);

      MoveTo(340, 80 + THeight);
      LineTo(500, 80 + THeight);

      MoveTo(570, 80 + THeight);
      LineTo(570 + TextWidth(AdvEdit3.Text), 80 + THeight);

      MoveTo(20, 100); LineTo(650, 100); //第一根横线
      MoveTo(20, 100); LineTo(20, 295); //第一根竖线
      MoveTo(650, 100); LineTo(650, 295); //最后一根竖线
      MoveTo(20, 130); LineTo(650, 130);
      MoveTo(430, 150); LineTo(650, 150);
      MoveTo(20, 170); LineTo(600, 170);
      for i := 1 to 4 do
      begin
        MoveTo(20, (170 + i * 20)); LineTo(600, (170 + i * 20));
      end;
      MoveTo(20, 275); LineTo(600, 275);
      MoveTo(20, 295); LineTo(650, 295);

      MoveTo(100, 100); LineTo(100, 130);
      MoveTo(230, 100); LineTo(230, 130);
      MoveTo(300, 100); LineTo(300, 130);
      MoveTo(430, 100); LineTo(430, 130);
      MoveTo(500, 100); LineTo(500, 130);
      TextOut(30, 110, '工程名称');
      TextOut(240, 110, '工程类别');
      TextOut(440, 110, '施工地点');
      TWidth := 100 - 2 + (230 - 100 - (TextWidth('杨') * Length(InVoiceTable.Cells[1, 0]) div 2)) div 2;
      TextOut(TWidth, 110, InVoiceTable.Cells[1, 0]);
      TWidth := 300 - 2 + (430 - 300 - (TextWidth('杨') * Length(InVoiceTable.Cells[6, 0]) div 2)) div 2;
      TextOut(TWidth, 110, InVoiceTable.Cells[6, 0]);
      TWidth := 500 - 2 + (650 - 500 - (TextWidth('杨') * Length(InVoiceTable.Cells[10, 0]) div 2)) div 2;
      TextOut(TWidth, 110, InVoiceTable.Cells[10, 0]);

      MoveTo(130, 130); LineTo(130, 275);
      MoveTo(300, 130); LineTo(300, 250);
      MoveTo(365, 130); LineTo(365, 250);
      MoveTo(430, 130); LineTo(430, 295);

      for i := 1 to 11 do
      begin
        if i = 2 then
          Pen.Color := clRed
        else
          Pen.Color := clBackground;
        if i <> 11 then
        begin
          MoveTo(600 - (20 * I) + 5 * i, 150);
          LineTo(600 - (20 * I) + 5 * i, 275);
        end;
        CurrentIndex := (12 - i + 1);
        DrawMoneyCp := Copy(MoneyCaStr, CurrentIndex * 2 - 1, 2);
        TextOut(587 - (20 * i - 5 * i) + 15, 155, DrawMoneyCp);
      end;
      for i := 0 to 4 do
      begin
        if i <> 4 then
        begin
          TWidth := 20 + (130 - 20 - (TextWidth('杨') * Length(InVoiceTable.Cells[0, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 175 + i * 20, InVoiceTable.Cells[0, 3 + i]);
          TWidth := 130 + (300 - 130 - (TextWidth('杨') * Length(InVoiceTable.Cells[2, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 175 + i * 20, InVoiceTable.Cells[2, 3 + i]);
          TWidth := 300 - 2 + (365 - 300 - (TextWidth('杨') * Length(InVoiceTable.Cells[6, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 175 + i * 20, InVoiceTable.Cells[6, 3 + i]);
          TWidth := 365 - 2 + (430 - 365 - (TextWidth('杨') * Length(InVoiceTable.Cells[7, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 175 + i * 20, InVoiceTable.Cells[7, 3 + i]);
        end;
        DrawMoney := InVoiceTable.Cells[9, 3 + i];
        if DrawMoney <> '' then
          DrawMoney := FormatFloat('0.00', StrToFloat(DrawMoney));
        DrawMoney := StringReplace(DrawMoney, '.', '', []);
        for J := 1 to 12 do
        begin
          TWidth := TextWidth('1') + 8;
          if J > Length(DrawMoney) then
            DrawOne := ''
          else
            DrawOne := Copy(DrawMoney, Length(DrawMoney) - J + 1, 1);
          TextOut(587 - (20 * j - 5 * j) + 15, 175 + i * 20, DrawOne);
        end;
      end;
      MoveTo(600, 130); LineTo(600, 295);
      TextOut(25, 140, '工程项目及其内容');
      TextOut(190, 140, '单    位');
      TextOut(315, 140, '数 量');
      TextOut(380, 140, '单 价');
      TextOut(490, 135, '金     额');
      TextOut(605, 137, '备 注');

      TextOut(30, 255, '金额合计(大写)');
      TWidth := 130 - 2 + (430 - 130 - (TextWidth('杨') * Length(InVoiceTable.Cells[2, 7]) div 2)) div 2;
      TextOut(TWidth, 255, InVoiceTable.Cells[2, 7]);

      MoveTo(170, 275); LineTo(170, 295);
      MoveTo(300, 275); LineTo(300, 295);
      MoveTo(520, 275); LineTo(520, 295);
      TextOut(40, 280, '开票单位(盖章有效)');
      TextOut(245, 280, '开票人:');
      TextOut(465, 280, '收款人:');
      TextOut(313, 280, InVoiceTable.Cells[6, 8]);
      TextOut(528, 280, InVoiceTable.Cells[10, 8]);

      TextOut(50, 300, ' 按照《中华人民共和国企业所得税暂行条例》的规定,这种车贴属于工资的组成部分,只能');
      TextOut(50, 315, '在企业所得税前限额扣除,超过部分要做纳税调整。而且按照《中华人民共和国个人所得税法》');
      TextOut(50, 330, '的规定,这种车贴也是要征收个人所得税的。如果允许编造这样一个虚假的合同到税务机关代开');
      TextOut(50, 345, '发票,企业不仅可以在缴纳所得税前全额扣除,作为员工个人还可以少缴或不缴个人所得税。');
    end;
  end;
end;

procedure TMain.PrintFP01;
var
  CurrentIndex: Integer;
  aTmpFont: TFont;
  DrawMoneyCp, DrawMoney, DrawOne: string;
  i, j, THeight, TWidth: Integer;
begin
  with aPrintForm.Image1 do
  begin
    THeight := Canvas.TextHeight('1');
    aTmpFont := Canvas.Font;
    with Canvas do
    begin
      TextOut(500, 20, BKString);
      Font.Size := 14;
      Font.Name := '宋体';
      Font.Style := [fsBold];
      TextOut(250, 20, '租 赁 业 发 票');
      Font.Size := 10;
      Font.Name := '宋体';
      Font.Color := $004080FF;
      Font.Style := Font.Style - [fsBold];
    //////////////////////////////////////////////
      TextOut(370, 60, '开票日期:'); //
      TextOut(430, 60, DateToStr(cxDateEdit1.Date));
      TextOut(510, 60, '发票号码:'); //
      TextOut(570, 60, AdvEdit3.Text);
      TextOut(20, 80, '承租方:'); //
      TextOut(65, 80, AdvEdit4.Text);
      TextOut(280, 80, '客户名称:'); //
      TextOut(340, 80, AdvEdit5.Text);
      TextOut(510, 80, '发票号码:'); //
      TextOut(570, 80, AdvEdit6.Text);

      Pen.Color := clBackground;
      MoveTo(430, 60 + THeight); //TextHeigth('1') 1只是个代表,计算它的高度
      LineTo(500, 60 + THeight);

      MoveTo(570, 60 + THeight);
      LineTo(570 + TextWidth(AdvEdit3.Text), 60 + THeight);

      MoveTo(65, 80 + THeight);
      LineTo(65 + TextWidth(AdvEdit4.Text), 80 + THeight);

      MoveTo(340, 80 + THeight);
      LineTo(500, 80 + THeight);

      MoveTo(570, 80 + THeight);
      LineTo(570 + TextWidth(AdvEdit3.Text), 80 + THeight);

    ////////////////////////////////////////////////
      MoveTo(20, 100); LineTo(650, 100); //第一根横线
      MoveTo(20, 100); LineTo(20, 290); //第一根竖线
      MoveTo(650, 100); LineTo(650, 290); //最后一根竖线
      MoveTo(20, 160); LineTo(650, 160);
      MoveTo(110, 120); LineTo(300, 120);
      MoveTo(110, 140); LineTo(260, 140);
      MoveTo(430, 120); LineTo(650, 120);

      MoveTo(110, 100); LineTo(110, 270);
      MoveTo(185, 120); LineTo(185, 220);
      MoveTo(260, 120); LineTo(260, 220);
      MoveTo(300, 100); LineTo(300, 220);
      MoveTo(340, 100); LineTo(340, 220);
      MoveTo(380, 100); LineTo(380, 220);
      MoveTo(430, 100); LineTo(430, 220);

      MoveTo(20, 240); LineTo(650, 240);
      MoveTo(20, 270); LineTo(650, 270);
      MoveTo(20, 290); LineTo(650, 290);

      MoveTo(160, 270); LineTo(160, 290);
      MoveTo(280, 270); LineTo(280, 290);
      MoveTo(410, 270); LineTo(410, 290);
      MoveTo(530, 270); LineTo(530, 290);

      for i := 1 to 3 do
      begin
        MoveTo(20, 160 + i * 20); LineTo(650, 160 + i * 20);
      end;
      //*******************************
      TextOut(30, 125, '租 赁 项 目');
      TextOut(158, 105, '租 赁 日 期');
      TextOut(135, 125, '起');
      TextOut(195, 125, '止');
      TextOut(115, 145, '年 月 日');
      TextOut(195, 145, '年 月 日');
      TextOut(265, 135, '天 数');
      TextOut(302, 125, '单 位');
      TextOut(345, 125, '数 量');
      TextOut(390, 120, '收 费');
      TextOut(390, 135, '标 准');
      TextOut(510, 105, '金    额');
      for i := 1 to 11 do
      begin
        if i = 2 then
          Pen.Color := clRed
        else
          Pen.Color := clBackground;
        MoveTo(650 - 20 * I, 120); LineTo(650 - I * 20, 240);
        CurrentIndex := (12 - i + 1);
        DrawMoneyCp := Copy(MoneyCaStr, CurrentIndex * 2 - 1, 2);
        TextOut(650 - (20 * i - 5), 135, DrawMoneyCp);
      end;
     //////////////////////////////////

      for i := 0 to 3 do
      begin
        if i <> 3 then
        begin
          TWidth := 20 + (110 - 20 - (TextWidth('杨') * Length(InVoiceTable.Cells[0, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 165 + i * 20, InVoiceTable.Cells[0, 3 + i]);
          TWidth := 110 + (185 - 110 - (TextWidth('杨') * Length(InVoiceTable.Cells[2, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 165 + i * 20, InVoiceTable.Cells[2, 3 + i]);
          TWidth := 185 - 2 + (260 - 185 - (TextWidth('杨') * Length(InVoiceTable.Cells[4, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 165 + i * 20, InVoiceTable.Cells[4, 3 + i]);
          TWidth := 260 - 2 + (300 - 260 - (TextWidth('杨') * Length(InVoiceTable.Cells[5, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 165 + i * 20, InVoiceTable.Cells[5, 3 + i]);
          TWidth := 300 - 2 + (340 - 300 - (TextWidth('杨') * Length(InVoiceTable.Cells[6, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 165 + i * 20, InVoiceTable.Cells[6, 3 + i]);
          TWidth := 340 - 2 + (380 - 340 - (TextWidth('杨') * Length(InVoiceTable.Cells[7, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 165 + i * 20, InVoiceTable.Cells[7, 3 + i]);
          TWidth := 380 - 2 + (430 - 380 - (TextWidth('杨') * Length(InVoiceTable.Cells[8, 3 + i]) div 2)) div 2;
          TextOut(TWidth, 165 + i * 20, InVoiceTable.Cells[8, 3 + i]);
        end;
        DrawMoney := InVoiceTable.Cells[9, 3 + i];
        if DrawMoney <> '' then
          DrawMoney := FormatFloat('0.00', StrToFloat(DrawMoney));
        DrawMoney := StringReplace(DrawMoney, '.', '', []);
        for J := 1 to 12 do
        begin
          TWidth := TextWidth('1') + 8;
          if J > Length(DrawMoney) then
            DrawOne := ''
          else
            DrawOne := Copy(DrawMoney, Length(DrawMoney) - J + 1, 1);
          TextOut(650 - (20 * j - 5), 165 + i * 20, DrawOne);
        end;
      end;
      TextOut(23, 225, '金额合计|大写');
      TextOut(130, 225, InVoiceTable.Cells[2, 6]);
      TextOut(35, 250, '备    注');
      TextOut(130, 250, InVoiceTable.Cells[2, 7]);
      TextOut(38, 275, '出租方(盖章有效)');
      TextOut(230, 275, '开票人:');
      TextOut(290, 275, InVoiceTable.Cells[6, 9]);
      TextOut(480, 275, '收款人:');
      TextOut(540, 275, InVoiceTable.Cells[10, 9]);
      Font.Color := clBackground;
      TextOut(50, 300, ' 按照《中华人民共和国企业所得税暂行条例》的规定,这种车贴属于工资的组成部分,只能');
      TextOut(50, 315, '在企业所得税前限额扣除,超过部分要做纳税调整。而且按照《中华人民共和国个人所得税法》');
      TextOut(50, 330,

⌨️ 快捷键说明

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