📄 query3unit.pas
字号:
end;
end;
procedure TQuery3Form.AddSeviceSum(curPos:string;Money:single);
var
i:integer;
begin
for i:=0 to ListView3.Columns.Count-1 do
begin
if(ListView3.Columns[i].Caption=curPos)then
begin
ListView3.Items[12].SubItems[i-1]:=ConverterPercent(FloatToStr(StrToFloat(ListView3.Items[12].SubItems[i-1])+Money));
exit;
end;
end;
for i:=0 to ListView1.Columns.Count-1 do
begin
if(ListView1.Columns[i].Caption=curPos)then
begin
ListView1.Items[12].SubItems[i-1]:=ConverterPercent(FloatToStr(StrToInt(ListView1.Items[12].SubItems[i-1])+Money));
exit;
end;
end;
end;
procedure TQuery3Form.AddPRO1(curPos:string;InputStr:string);
var
i,j:integer;
tmpstr:string;
begin
for i:=1 to ListView2.Columns.Count-1 do
if(ListView2.Columns[i].Caption=curPos)then
begin
for j:=0 to ListView2.Items.Count-1 do
begin
tmpstr:=copy(ListView2.Items[j].Caption,4,Length(ListView2.Items[j].Caption)-3);
if(tmpstr=InputStr)then
begin
ListView2.Items[j].SubItems[i-1]:=IntToStr(StrToInt(ListView2.Items[j].SubItems[i-1])+1);
exit;
end;
end;
end;
for i:=1 to ListView4.Columns.Count-1 do
if(ListView4.Columns[i].Caption=curPos)then
begin
for j:=0 to ListView4.Items.Count-1 do
begin
tmpstr:=copy(ListView4.Items[j].Caption,4,Length(ListView4.Items[j].Caption)-3);
if(tmpstr=InputStr)then
begin
ListView4.Items[j].SubItems[i-1]:=IntToStr(StrToInt(ListView4.Items[j].SubItems[i-1])+1);
exit;
end;
end;
end;
end;
procedure TQuery3Form.AddPRO2(curPos:string;InputStr:string);
var
i,j:integer;
tmpstr:string;
begin
for i:=1 to ListView3.Columns.Count-1 do
if(ListView2.Columns[i].Caption=curPos)then
begin
for j:=0 to ListView3.Items.Count-1 do
begin
tmpstr:=copy(ListView3.Items[j].Caption,4,Length(ListView3.Items[j].Caption)-3);
if(tmpstr=InputStr)then
begin
ListView3.Items[j].SubItems[i-1]:=IntToStr(StrToInt(ListView3.Items[j].SubItems[i-1])+1);
exit;
end;
end;
end;
for i:=1 to ListView1.Columns.Count-1 do
if(ListView1.Columns[i].Caption=curPos)then
begin
for j:=0 to ListView1.Items.Count-1 do
begin
tmpstr:=copy(ListView1.Items[j].Caption,4,Length(ListView1.Items[j].Caption)-3);
if(tmpstr=InputStr)then
begin
ListView1.Items[j].SubItems[i-1]:=IntToStr(StrToInt(ListView1.Items[j].SubItems[i-1])+1);
exit;
end;
end;
end;
end;
procedure TQuery3Form.AddService(curPos:string;Service:string;ServiceName:string);
var
i,j:integer;
tmpstr:string;
begin
for i:=1 to ListView2.Columns.Count-1 do
if(ListView2.Columns[i].Caption=curPos)then
begin
for j:=0 to ListView2.Items.Count-1 do
begin
tmpstr:=copy(ListView2.Items[j].Caption,4,Length(ListView2.Items[j].Caption)-3);
if(ServiceName=tmpstr)then
begin
if(Service='1')then
begin
ListView2.Items[j].SubItems[i-1]:=IntToStr(StrToInt(ListView2.Items[j].SubItems[i-1])+1);
exit;
end;
end;
end;
end;
for i:=1 to ListView4.Columns.Count-1 do
if(ListView4.Columns[i].Caption=curPos)then
begin
for j:=0 to ListView4.Items.Count-1 do
begin
tmpstr:=copy(ListView4.Items[j].Caption,4,Length(ListView4.Items[j].Caption)-3);
if(ServiceName=tmpstr)then
begin
if(Service='1')then
begin
ListView4.Items[j].SubItems[i-1]:=IntToStr(StrToInt(ListView4.Items[j].SubItems[i-1])+1);
exit;
end;
end;
end;
end;
end;
procedure TQuery3Form.AddMoney(curPos:string;Service:string;ServiceName:string;Money:single);
var
i,j:integer;
tmpstr:string;
begin if(ServiceName<>'1')then exit;
for i:=1 to ListView3.Columns.Count-1 do
if(ListView2.Columns[i].Caption=curPos)then
begin
for j:=0 to ListView3.Items.Count-1 do
begin
tmpstr:=copy(ListView3.Items[j].Caption,4,Length(ListView3.Items[j].Caption)-3);
if(Service=tmpstr)then
begin
if(ListView3.Items[j].SubItems[i-1]<>'0')then
ListView3.Items[j].SubItems[i-1]:=ConverterPercent(FloatToStr(StrToFloat(ListView3.Items[j].SubItems[i-1])+Money)) else
ListView3.Items[j].SubItems[i-1]:= ConverterPercent(FloatToStr(Money));
exit;
end;
end;
end;
for i:=1 to ListView1.Columns.Count-1 do
if(ListView1.Columns[i].Caption=curPos)then
begin
for j:=0 to ListView4.Items.Count-1 do
begin
tmpstr:=copy(ListView2.Items[j].Caption,4,Length(ListView3.Items[j].Caption)-3);
if(Service=tmpstr)then
begin
if(ListView3.Items[j].SubItems[i-1]<>'0')then
ListView3.Items[j].SubItems[i-1]:=ConverterPercent(FloatToStr(StrToFloat(ListView3.Items[j].SubItems[i-1])+Money)) else
ListView3.Items[j].SubItems[i-1]:= ConverterPercent(FloatToStr(Money));
exit;
end;
end;
end;
end;
procedure TQuery3Form.AddColSum;
var
i,j,sum:integer;
sum1:single;
begin
for i:=0 to ListView2.Items.Count-1 do
begin
sum:=0;
for j:=2 to ListView2.Items[i].SubItems.Count-1 do
begin
if(ListView2.Items[i].SubItems[j]<>'0')then
sum:=sum+StrToInt(ListView2.Items[i].SubItems[j]);
end;
for j:=1 to ListView4.Items[i].SubItems.Count-1 do
begin
if(ListView4.Items[i].SubItems[j]<>'0')then
sum:=sum+StrToInt(ListView4.Items[i].SubItems[j]);
end;
if(sum<>0)then
ListView2.Items[i].SubItems[1]:=IntToStr(sum);
end;
for i:=0 to ListView3.Items.Count-1 do
begin
sum1:=0;
for j:=2 to ListView3.Items[i].SubItems.Count-1 do
begin
if(ListView3.Items[i].SubItems[j]<>'0')then
sum1:=sum1+StrToFloat(ListView3.Items[i].SubItems[j]);
end;
for j:=1 to ListView1.Items[i].SubItems.Count-1 do
begin
if(ListView1.Items[i].SubItems[j]<>'0')then
sum1:=sum1+StrToFloat(ListView1.Items[i].SubItems[j]);
end;
if(sum1<>0)then
if i>=12 then
ListView3.Items[i].SubItems[1]:=ConverterPercent(FloatToStr(sum1)) else
ListView3.Items[i].SubItems[1]:=FloatToStr(sum1);
end;
end;
procedure TQuery3Form.AddRowSum(curListView:TListView;begincol,endcol,beginrow,endrow,desirow:integer);
var
i,j,sum:integer;
begin
for i:=beginrow to endrow do
begin
for j:=begincol to endcol do
begin
sum:=0;
//ShowMessage(curListView.Items[i].subItems[j]);
if(curListView.Items[desirow].subItems[j]<>'0')then
sum:=StrToInt(curListView.Items[desirow].subItems[j]);
if(curListView.Items[i].subItems[j]<>'0')then
curListView.Items[desirow].subItems[j]:=IntToStr(sum+StrToInt(curListView.Items[i].subItems[j]))
else
if(sum<>0)then
curListView.Items[desirow].subItems[j]:=IntToStr(sum);
end;
end;
end;
procedure TQuery3Form.AddAllCount(UnitName:string);
var
i:integer;
begin
for i:=1 to ListView2.Columns.Count-1 do
begin
if(ListView2.Columns[i].Caption=UnitName)then
begin
if(ListView2.Items[0].SubItems[i-1]<>'0')then
ListView2.Items[0].SubItems[i-1]:=
IntToStr(StrToInt(ListView2.Items[0].SubItems[i-1])+1) else
ListView2.Items[0].SubItems[i-1]:='1';
end;
end;
for i:=1 to ListView4.Columns.Count-1 do
begin
if(ListView4.Columns[i].Caption=UnitName)then
begin
if(ListView4.Items[0].SubItems[i-1]<>'0')then
ListView4.Items[0].SubItems[i-1]:=
IntToStr(StrToInt(ListView4.Items[0].SubItems[i-1])+1) else
ListView4.Items[0].SubItems[i-1]:='1';
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -