report_tax.pas

来自「pasa人力资源考勤管理系统」· PAS 代码 · 共 257 行

PAS
257
字号
unit report_tax;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Mask, ExtCtrls, Db, ppDB, ppDBPipe, ppDBBDE, ADODB, ppCtrls,
  ppBands, ppPrnabl, ppClass, ppCache, ppComm, ppRelatv, ppProd, ppReport,
  ppVar;

type
  Tformtax = class(TForm)
    RadioGroup1: TRadioGroup;
    Edit1: TMaskEdit;
    ComboBox1: TComboBox;
    Edit2: TEdit;
    StaticText1: TStaticText;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    ppReport6: TppReport;
    ppHeaderBand5: TppHeaderBand;
    ppLabel214: TppLabel;
    ppLabel216: TppLabel;
    ppLabel219: TppLabel;
    ppDetailBand6: TppDetailBand;
    ppLine98: TppLine;
    ppLine99: TppLine;
    ppLabel215: TppLabel;
    ppLabel217: TppLabel;
    ppLine101: TppLine;
    ppLine102: TppLine;
    ppLine103: TppLine;
    ppLine104: TppLine;
    ppLine105: TppLine;
    ppLine106: TppLine;
    ppLabel218: TppLabel;
    ppLine109: TppLine;
    ppLabel221: TppLabel;
    ppLabel222: TppLabel;
    ppLabel223: TppLabel;
    ppLabel224: TppLabel;
    ppLine112: TppLine;
    ppLabel225: TppLabel;
    ppLine113: TppLine;
    ppLabel226: TppLabel;
    ppLine114: TppLine;
    ppLabel227: TppLabel;
    ppLine115: TppLine;
    ppLine116: TppLine;
    ppLabel228: TppLabel;
    ppLabel229: TppLabel;
    ppLine117: TppLine;
    ppFooterBand6: TppFooterBand;
    ppLine107: TppLine;
    ppLine108: TppLine;
    ppLine110: TppLine;
    ppLabel220: TppLabel;
    ppLine111: TppLine;
    ppDBText158: TppDBText;
    ppDBText159: TppDBText;
    ppLabel231: TppLabel;
    ppLine120: TppLine;
    ADODataSet2: TADODataSet;
    ppBDEPipeline1: TppBDEPipeline;
    DataSource1: TDataSource;
    ppLabel1: TppLabel;
    ppLine1: TppLine;
    ADODataSet2peopleid: TStringField;
    ADODataSet2name: TStringField;
    ADODataSet2tempvalue: TBCDField;
    ADODataSet2pubtax: TBCDField;
    ADODataSet2pubtax_1: TBCDField;
    ADODataSet2tempvalue2: TBCDField;
    ADODataSet2tax1: TBCDField;
    ADODataSet2tax2: TBCDField;
    ADODataSet2tax: TBCDField;
    ppDBText1: TppDBText;
    ppDBText2: TppDBText;
    ppLine2: TppLine;
    ppLine3: TppLine;
    ppDBText4: TppDBText;
    ppLine4: TppLine;
    ppLine5: TppLine;
    ppLine6: TppLine;
    ppDBText5: TppDBText;
    ppLine7: TppLine;
    ppLine8: TppLine;
    ppLine9: TppLine;
    ppLine10: TppLine;
    ppLine11: TppLine;
    ppDBText6: TppDBText;
    ppDBText7: TppDBText;
    ppLabel2: TppLabel;
    ADOQuery1: TADOQuery;
    ppSystemVariable1: TppSystemVariable;
    ppLabel3: TppLabel;
    ppLabel4: TppLabel;
    ppSystemVariable2: TppSystemVariable;
    ppLabel5: TppLabel;
    ppLine12: TppLine;
    ppLine13: TppLine;
    ppDBText3: TppDBText;
    procedure Button2Click(Sender: TObject);
    procedure ppReport6BeforePrint(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure Button1KeyPress(Sender: TObject; var Key: Char);
    procedure RadioGroup1Click(Sender: TObject);
    procedure ppReport6PreviewFormCreate(Sender: TObject);
    procedure Edit2Exit(Sender: TObject);
    procedure Edit2KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
    year:string;
  end;

var
  formtax: Tformtax;

implementation

uses datamol,main,publicfunction, salcal;

{$R *.DFM}

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

procedure Tformtax.ppReport6BeforePrint(Sender: TObject);

begin
  pplabel231.Caption:=edit1.Text+'/01';
  pplabel231.caption:=copy(pplabel231.caption,6,6);
  pplabel1.Caption:=edit1.Text+'/'+inttostr(getdays(copy(edit1.text,6,2),copy(edit1.text,1,4)));
  pplabel1.Caption:=copy(pplabel1.caption,6,6);
  pplabel219.caption:='制表人:'+pubworkname;

  adoquery1.Close;
  adoquery1.sql.clear;
  adoquery1.sql.Text:='select taxbasic from sal02010';
  adoquery1.Open;
  pplabel2.Caption:=adoquery1.fieldbyname('taxbasic').asstring;
  end;
procedure Tformtax.Button1Click(Sender: TObject);
begin
if trim(edit1.text)='' then begin showmessage('请确定要打印的月份'); exit; end;
with datamod do
begin
  adoquery1.close;
  adoquery1.sql.clear;
  adoquery1.sql.add('exec (''update sal21010 set tempvalue='+tax+' where monthy='''''+edit1.text+''''' '')');
  adoquery1.sql.add('update sal21010 set tempvalue2=tempvalue-b.taxbasic-isnull(pubtax,0) from sal02010 b where monthy='''+edit1.text+'''');
  adoquery1.sql.add('update sal21010 set tempvalue2=0 where tempvalue2<0 and monthy='''+edit1.text+'''');
  adoquery1.sql.savetofile('c:\xx.sql');
  adoquery1.execsql;
  if (trim(edit1.Text) <>'/')  then
  begin
   adodataset2.Close;
   if radiogroup1.itemindex=0 then
      adodataset2.CommandText:='select a.peopleid, a.name, b.tempvalue, b.pubtax, b.pubtax, b.tempvalue2, b.tax1, b.tax2, b.tax from sal21010 b left join per24010 a on a.workno=b.workno where b.tax<>0 and b.tax is not null and monthy='''+edit1.text+''''
   else if radiogroup1.itemindex=1 then
      adodataset2.CommandText:='select a.peopleid, a.name, b.tempvalue, b.pubtax, b.pubtax, b.tempvalue2, b.tax1, b.tax2, b.tax from sal21010 b left join per24010 a on a.workno=b.workno '+
        'where b.deptname='''+combobox1.text+'''and  b.tax<>0 and b.tax is not null and monthy='''+edit1.text+''' '
   else
      adodataset2.CommandText:='select a.peopleid, a.name, b.tempvalue, b.pubtax, b.pubtax, b.tempvalue2, b.tax1, b.tax2, b.tax from sal21010 b left join per24010 a on a.workno=b.workno'+
      ' where b.workno between '''+edit2.text+''' and '''+edit3.text+'''and b.tax<>0 and tax is not null and monthy='''+edit1.text+'''';
    adodataset2.open;
    ppreport6.print;
  end
end;
end;
procedure Tformtax.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if key=#13 then
     selectnext(activecontrol,true,true);
end;

procedure Tformtax.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if key=#13 then
     selectnext(activecontrol,true,true);
end;

procedure Tformtax.Button1KeyPress(Sender: TObject; var Key: Char);
begin
  if key=#13 then
     selectnext(activecontrol,true,true);
end;

procedure Tformtax.RadioGroup1Click(Sender: TObject);
  var
qry:tadoquery;
begin
     case radiogroup1.ItemIndex of
       0:
         begin
           combobox1.visible:=false;
           edit2.visible:=false;
           edit3.visible:=false;
           statictext1.Visible:=false;
         end;
       1:
       begin
         combobox1.visible:=true;
         combobox1.SetFocus;
         edit2.Visible:=false;
         edit3.visible:=false;
         qry:=tadoquery.Create(self);
         qry.Connection:=datamod.Database1;
         qry.SQL.Text:='select * from pub05010 order by dno';
         qry.Open;
         statictext1.Visible:=false;
      while not qry.Eof do
        begin
          combobox1.Items.Add(qry.fieldbyname('dept').asstring);
          qry.Next;
        end;
          qry.Close;
        combobox1.text:=combobox1.items[0];
       end;
       2:
         begin
           edit2.Visible:=true;
           edit2.SetFocus;
           edit3.visible:=true;
           combobox1.Visible:=false;
           statictext1.Visible:=true;
         end;
     end;
end;

procedure Tformtax.ppReport6PreviewFormCreate(Sender: TObject);
begin
    tppreport(sender).previewform.windowstate:=wsmaximized;
end;

procedure Tformtax.Edit2Exit(Sender: TObject);
begin
  edit3.text:=edit2.text;
end;

procedure Tformtax.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  if key=#13 then
     selectnext(activecontrol,true,true);
end;

end.

⌨️ 快捷键说明

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