📄 unit1.~pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,StrUtils, ComCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Edit1: TEdit;
Label4: TLabel;
ListBox1: TListBox;
Label5: TLabel;
Label7: TLabel;
BtnSJ: TButton;
Edit2: TEdit;
StatusBar1: TStatusBar;
EdtSum: TEdit;
BtnClear: TButton;
EdtTC: TEdit;
Label8: TLabel;
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure BtnSJClick(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BtnClearClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
sum: Real; //申明一个全局变量,用于做累加运算。
implementation
{$R *.dfm}
procedure TForm1.ComboBox1Change(Sender: TObject);//添加项目
begin
if ComboBox1.text='智能型复合开关' then
begin
ComboBox2.Items.Clear; //清空以前的项目
ComboBox2.Items.Add('ZFK-40-1/Y');
ComboBox2.Items.Add('ZFK-40-1x3/Y');
ComboBox2.Items.Add('ZFK-40-3/Y');
ComboBox2.Items.Add('ZFK-40-3/△');
ComboBox2.Items.Add('ZFK-60-1x3/Y');
ComboBox2.Items.Add('ZFK-60-3/△');
end
else
if ComboBox1.Text='无功补偿控制器' then
begin
ComboBox2.Items.Clear;
ComboBox2.Items.Add('JKFA2-8(室外型)');
ComboBox2.Items.Add('JKFA3-8(室外型)');
ComboBox2.Items.Add('JKFB3-X(室外型)');
ComboBox2.Items.Add('JKFB1-32');
ComboBox2.Items.Add('JKFB1-3');
ComboBox2.Items.Add('JKFB1-32W');
ComboBox2.Items.Add('JKFB1-52W');
ComboBox2.Items.Add('JKFB1-73W');
ComboBox2.Items.Add('JKFB1-XW');
ComboBox2.Items.Add('JKFB2-XW');
ComboBox2.Items.Add('JKFB2-X');
end
else
if ComboBox1.Text='配电监测仪' then
begin
ComboBox2.Items.Clear;
ComboBox2.Items.Add('PJC-16');
ComboBox2.Items.Add('PJC-64');
ComboBox2.Items.Add('PJC-64A');
end
else
if ComboBox1.Text='GPRS数传模块' then
begin
ComboBox2.Items.Clear;
ComboBox2.Items.Add('增强型');
ComboBox2.Items.Add('普通型');
end;
ComboBox2.ItemIndex:=0;
ComboBox2Change(self);
end;
procedure TForm1.ComboBox2Change(Sender: TObject); //添加默认单价
begin
if ComboBox1.text='智能型复合开关' then
begin
case ComboBox2.ItemIndex of
0:begin
ListBox1.Clear;//清空以前项目
ListBox1.Items.Add('158');
end;
1:begin
ListBox1.Clear;
ListBox1.Items.Add('518');
end;
2:begin
ListBox1.Clear;
ListBox1.Items.Add('420');
end;
3:begin
ListBox1.Clear;
ListBox1.Items.Add('320');
end;
4:begin
ListBox1.Clear;
ListBox1.Items.Add('425');
end;
5:begin
ListBox1.Clear;
ListBox1.Items.Add('430');
end;
end;
end
else
if ComboBox1.Text='无功补偿控制器' then
begin
case ComboBox2.ItemIndex of
0:begin
ListBox1.Clear;
ListBox1.Items.Add('680');
end;
1:begin
ListBox1.Clear;
ListBox1.Items.Add('720');
end;
2: begin
ListBox1.Clear;
ListBox1.Items.Add('650');
end;
3: begin
ListBox1.Clear;
ListBox1.Items.Add('980');
end;
4: begin
ListBox1.Clear;
ListBox1.Items.Add('1100');
end;
5: begin
ListBox1.Clear;
ListBox1.Items.Add('1700');
end;
6: begin
ListBox1.Clear;
ListBox1.Items.Add('1800');
end;
7: begin
ListBox1.Clear;
ListBox1.Items.Add('1900');
end;
8:begin
ListBox1.Clear;
ListBox1.Items.Add('1300');
end;
9: begin
ListBox1.Clear;
ListBox1.Items.Add('1300');
end;
10: begin
ListBox1.Clear;
ListBox1.Items.Add('1580');
end;
end;
end
else
if ComboBox1.Text='配电监测仪' then
begin
case ComboBox2.ItemIndex of
0:begin
ListBox1.Clear;
ListBox1.Items.Add('1950');
end;
1: begin
ListBox1.Clear;
ListBox1.Items.Add('1950');
end;
2:begin
ListBox1.Clear;
ListBox1.Items.Add('2350');
end;
end;
end
else
if ComboBox1.Text='GPRS数传模块' then
begin
case ComboBox2.ItemIndex of
0:begin
ListBox1.Clear;
ListBox1.Items.Add('1750');
end;
1:begin
ListBox1.Clear;
ListBox1.Items.Add('1550');
end;
end;
end;
end;
procedure TForm1.BtnSJClick(Sender: TObject);//对奖金提成的运算
var
m,n:Integer;
a:Real;//浮点型变量的声明
begin
m:=StrToInt(Edit1.Text); //台数
n:=StrToInt(Edit2.Text); //实际销售单价
if ComboBox1.text='智能型复合开关' then
begin
case ComboBox2.ItemIndex of
0:begin
if n<=100 then
begin
a:=n*m*0.02;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>100) and (n<=115)) then
begin
a:=100*m*0.02+(n-100)*m*0.09;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>115) and (n<=130)) then
begin
a:=100*m*0.02+15*m*0.09+(n-115)*m*0.12;
EdtTC.Text:=FloatToStr(a);
end
else
if 130<n then
begin
a:=100*m*0.02+15*m*0.09+15*m*0.12+(n-130)*m*0.18;
EdtTC.Text:=FloatToStr(a);
end;
end;
1:begin
end;
2:begin
if n<=250 then
begin
a:=n*m*0.02;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>250) and (n<=270)) then
begin
a:=250*m*0.02+(n-250)*m*0.09;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>270) and (n<=290)) then
begin
a:=250*m*0.02+20*m*0.09+(n-270)*m*0.12;
EdtTC.Text:=FloatToStr(a);
end
else
if 290<n then
begin
a:=250*m*0.02+20*m*0.09+20*m*0.12+(n-290)*m*0.18;
EdtTC.Text:=FloatToStr(a);
end;
end;
3:begin
if n<=270 then
begin
a:=n*m*0.02;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>270) and (n<=320)) then
begin
a:=270*m*0.02+(n-270)*m*0.09;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>320) and (n<=340)) then
begin
a:=270*m*0.02+50*m*0.09+(n-320)*m*0.12;
EdtTC.Text:=FloatToStr(a);
end
else
if 340<n then
begin
a:=270*m*0.02+50*m*0.09+20*m*0.12+(n-340)*m*0.18;
EdtTC.Text:=FloatToStr(a);
end;
end;
4:begin
if n<=380 then
begin
a:=n*m*0.02;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>380) and (n<=420)) then
begin
a:=380*m*0.02+(n-380)*m*0.09;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>420) and (n<=440)) then
begin
a:=380*m*0.02+40*m*0.09+(n-420)*m*0.12;
EdtTC.Text:=FloatToStr(a);
end
else
if 440<n then
begin
a:=380*m*0.02+40*m*0.09+20*m*0.12+(n-440)*m*0.18;
EdtTC.Text:=FloatToStr(a);
end;
end;
5:begin
if n<=380 then
begin
a:=n*m*0.02;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>380) and (n<=420)) then
begin
a:=380*m*0.02+(n-380)*m*0.09;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>420) and (n<=440)) then
begin
a:=380*m*0.02+40*m*0.09+(n-420)*m*0.12;
EdtTC.Text:=FloatToStr(a);
end
else
if 440<n then
begin
a:=380*m*0.02+40*m*0.09+20*m*0.12+(n-440)*m*0.18;
EdtTC.Text:=FloatToStr(a);
end;
end;
end;
end
else
if ComboBox1.Text='无功补偿控制器' then
begin
case ComboBox2.ItemIndex of
0:begin
if n<=310 then
begin
a:=n*m*0.02;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>310) and (n<=350)) then
begin
a:=310*m*0.02+(n-310)*m*0.09;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>350) and (n<=400)) then
begin
a:=310*m*0.02+40*m*0.09+(n-350)*m*0.12;
EdtTC.Text:=FloatToStr(a);
end
else
if 400<n then
begin
a:=310*m*0.02+40*m*0.09+50*m*0.12+(n-400)*m*0.18;
EdtTC.Text:=FloatToStr(a);
end;
end;
1:begin
if n<=310 then
begin
a:=n*m*0.02;
EdtTC.Text:=FloatToStr(a);
end
else
if ((n>310) and (n<=350)) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -