📄 calctax.pas
字号:
unit CalcTax;
interface
uses
DB, GZGLCommon, ADODB;
type
TCalcTax = class (TObject)
private
procedure GetSl(AJsjs: Double; var ASl, ASskcs: Double);
public
procedure CalcSj(var AGZRec: TGZRec);
end;
implementation
{ TCalcTax }
procedure TCalcTax.CalcSj(var AGZRec: TGZRec);
var
l_Jsjs, l_Qzd, l_Sl, l_Sskcs: Double;
begin
with TAdoQuery.Create(nil) do
try
Connection := AdoGzgl;
SQL.Text := 'Select * from Qzd';
Open;
if RecordCount <> 0 then
l_Qzd := FieldByName('Qzd').AsFloat
else
l_Qzd := 0;
Close;
finally
Free;
end;
// 计算税金
with AGZRec do
begin
l_Jsjs := Jbgz + Zwgz + Bt + Kq - l_Qzd;
GetSl(l_Jsjs, l_Sl, l_Sskcs);
Sj := l_Jsjs * l_Sl - l_Sskcs;
end;
end;
procedure TCalcTax.GetSl(AJsjs: Double; var ASl, ASskcs: Double);
begin
with TAdoQuery.Create(nil) do
try
Connection := AdoGzgl;
SQL.Text := 'Select * from Slxx Order by Sxe';
Open;
// 找到匹配的税率和速算扣除数
First;
while not eof do
begin
if AJsjs > FieldByName('Sxe').AsFloat then
Next
else begin
ASl := FieldByName('Sl').AsFloat;
ASskcs := FieldByName('Sskcs').AsFloat;
Break;
end;
end;
if Eof then
begin
Last;
ASl := FieldByName('Sl').AsFloat;
ASskcs := FieldByName('Sskcs').AsFloat;
end;
Close;
finally
Free;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -