📄 u_form_datacheck_3.pas
字号:
begin
param.clear;
param.add('CHK_BW_Beer');
param.add(_CheckDate);
param.add(_whichStore);
param.add('1');
strsql:='insert into PG_ChangeBill_BW_Flag(CHK_Type,CHK_Checkdate,CHK_WhichStore,CHK_successFlag) ';
strsql:=strsql+'Values(:s1,:s2,:s3,:s4)';
_AdoNewProduce.actionRecord(strsql,param);
param.clear;
param.add('CHK_BW_Wrap');
param.add(_CheckDate);
param.add(_whichStore);
param.add('1');
strsql:='insert into PG_ChangeBill_BW_Flag(CHK_Type,CHK_Checkdate,CHK_WhichStore,CHK_successFlag) ';
strsql:=strsql+'Values(:s1,:s2,:s3,:s4)';
_AdoNewProduce.actionRecord(strsql,param);
EnableWindow(Form_MainMenu.Handle,true);
CanClose:=true;
end;
}
end;
procedure TForm_DataCheck_3.ButtonExCtl1Click(Sender: TObject);
var
param:TStringList;
strsql:string;
i,j:integer;
_col5,_col6:string;
_Total:double;
begin
///ghgfhgfhfg
param:=TStringList.Create;
param.Clear;
{/*
进行数据验证
*/}
if not _Check.Do_Control(combobox3,1,'请选择酒库名称...') then exit;
param:=TStringList.Create;
param.Clear;
{/*
进行数据验证
*/}
if not _Check.Do_Control(combobox3,1,'请选择酒库名称...') then exit;
{/*
清空数据
*/}
for i:=3 to grid3.RowCount-1 do
begin
for j:=1 to grid3.ColCount-1 do
begin
grid3.cells[j,i].ForeText:='';
end;
end;
grid3.RowCount:=5;
grid3.Refresh;
{/*
查询产品品种
*/}
{param.Clear;
param.Add(_whichStore2);
strSql:='select OrderID,ProduceName,specification,UnitName from sale_Storage Where whichStore=:s1 order by OrderID';
_AdonewProduce.BindToGrid_JK(grid3,strsql,param,1,4,2);
}
with AdoQuery1 do
begin
connectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=newproduce;Data Source=NTSERVER';
close;
sql.clear;
strSql:='select distinct SCW_ProductName,SCW_specification,SCW_UnitName from sale_newSample_BW Where SCW_whichStore=:s1';
sql.Add(strSql);
parameters.ParamByName('s1').Value:=trim(_whichStore);
prepared;
open;
if recordcount<>0 then
begin
i:=3;
while not eof do
begin
grid3.RowCount:=i+2;
grid3.Cells[1,i].ForeText:=intToStr(i-2);
grid3.Cells[2,i].ForeText:=trim(FieldByName('scw_productname').AsString);
grid3.Cells[3,i].ForeText:=trim(FieldByName('scw_specification').AsString);
grid3.Cells[4,i].ForeText:=trim(FieldByName('scw_unitName').AsString);
next;
inc(i);
end;
end;
end;
{/*
查询保卫输入的数据
*/}
for i:=3 to grid3.RowCount-2 do
begin
param.Clear;
param.Add(trim(beginDate2.text));
param.Add(trim(endDate2.text));
param.Add(trim(_whichStore));
param.Add(trim(grid3.cells[2,i].foretext));
param.Add(trim(grid3.cells[3,i].foretext));
param.Add(trim(grid3.cells[4,i].foretext));
strsql:='select sum(convert(real,SCW_saleNum)) as a from sale_newSample_BW where SCW_OutStoreDate>=:s1 and ';
strsql:=strsql+'SCW_outStoreDate<=:s2 and SCW_whichStore=:s3 and SCW_productName=:s4 and SCW_specification=:s5 and ';
strsql:=strsql+'SCW_unitName=:s6';
grid3.Cells[5,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
end;
{/*
查询酒库调票数据
*/}
for i:=3 to grid3.RowCount-2 do
begin
param.Clear;
//param.Add(trim(beginDate2.text)+' 00:00:00');
//param.Add(trim(endDate2.text)+' 23:59:59');
param.Add(trim(begindate2.text));
param.Add(trim(_whichStore));
//showmessage(trim(grid3.cells[2,i].foretext)+'∕'+'1'+'×'+trim(grid3.cells[3,i].foretext)+'--'+trim(grid3.cells[4,i].foretext));
param.Add(trim(grid3.cells[2,i].foretext));
param.Add(trim(grid3.cells[3,i].foretext));
param.Add(trim(grid3.cells[4,i].foretext));
strsql:='select sum(convert(real,productNum)) as a from sale_newSample_Office where OutStoreTime=:s1 ';
strsql:=strsql+' and whichStore=:s3 and productName=:s4 and specification=:s5 and ';
strsql:=strsql+'unitName=:s6';
grid3.Cells[6,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
end;
{/*
计算差额
*/}
for i:=3 to grid3.RowCount-2 do
begin
if grid3.cells[5,i].ForeText='' then
begin
_col5:='0';
end
else
_col5:=trim(grid3.cells[5,i].ForeText);
if grid3.cells[6,i].ForeText='' then
begin
_col6:='0';
end
else
_col6:=trim(grid3.cells[6,i].ForeText);
if (grid3.cells[5,i].ForeText<>'') and (grid3.cells[6,i].ForeText<>'') then
begin
grid3.cells[7,i].ForeText:=formatFloat('##0',strToFloat(grid3.cells[5,i].ForeText)-strToFloat(grid3.cells[6,i].ForeText));
end;
end;//for
{/*
设置第七列颜色
*/}
for i:=3 to grid3.RowCount-2 do
begin
grid3.Cells[7,i].Color:=rgb(241,222,157);
if grid3.cells[7,i].ForeText<>'0' then
begin
grid3.cells[7,i].FontColor:=rgb(255,0,0);
end;
end;
{/*
计算合计
*/}
_Total:=0;
for i:=3 to grid3.RowCount-2 do
begin
_Total:=_Total+strToFloat(grid3.cells[7,i].foretext);
end;
grid3.Cells[7,grid3.RowCount-1].ForeText:=formatFloat('##0',_Total);
{/*
设置最后一行的颜色
*/}
for i:=1 to grid3.ColCount-1 do
begin
grid3.cells[i,grid3.rowcount-1].Color:=rgb(0,143,247);
grid3.cells[i,grid3.rowcount-1].FontColor:=rgb(255,255,255);
end;
grid3.cells[1,grid3.RowCount-1].ForeText:='合计:';
grid3.Refresh;
end;
procedure TForm_DataCheck_3.ButtonExCtl2Click(Sender: TObject);
var
param:TStringList;
strsql:string;
i,j:integer;
_col5,_col6:string;
_Total:double;
begin
/////hgjghjhgjgh
param:=TStringList.Create;
param.Clear;
{/*
进行数据验证
*/}
if not _Check.Do_Control(combobox4,1,'请选择酒库名称...') then exit;
{/*
清空数据
*/}
for i:=3 to grid4.RowCount-1 do
begin
for j:=1 to grid4.ColCount-1 do
begin
grid4.cells[j,i].ForeText:='';
end;
end;
grid4.RowCount:=5;
grid4.Refresh;
{/*
查询产品品种
*/}
//param.Clear;
//param.Add(_whichStore3);
//strSql:='select OrderID,ProduceName,specification,UnitName from sale_Storage Where whichStore=:s1 order by OrderID';
//_AdonewProduce.BindToGrid_JK(grid4,strsql,param,1,4,2);
with AdoQuery1 do
begin
connectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=newproduce;Data Source=NTSERVER';
close;
sql.clear;
strSql:='select distinct SCW_ProductName,SCW_specification,SCW_UnitName from sale_AccidentBill_BW Where SCW_whichStore=:s1';
sql.Add(strSql);
parameters.ParamByName('s1').Value:=trim(_whichStore);
prepared;
open;
if recordcount<>0 then
begin
i:=3;
while not eof do
begin
grid4.RowCount:=i+2;
grid4.Cells[1,i].ForeText:=intToStr(i-2);
grid4.Cells[2,i].ForeText:=trim(FieldByName('scw_productname').AsString);
grid4.Cells[3,i].ForeText:=trim(FieldByName('scw_specification').AsString);
grid4.Cells[4,i].ForeText:=trim(FieldByName('scw_unitName').AsString);
next;
inc(i);
end;
end;
end;
{/*
查询保卫输入的数据
*/}
for i:=3 to grid4.RowCount-2 do
begin
param.Clear;
param.Add(trim(beginDate3.text));
param.Add(trim(endDate3.text));
param.Add(trim(_whichStore));
param.Add(trim(grid4.cells[2,i].foretext));
param.Add(trim(grid4.cells[3,i].foretext));
param.Add(trim(grid4.cells[4,i].foretext));
strsql:='select sum(convert(real,SCW_saleNum)) as a from sale_AccidentBill_BW where SCW_OutStoreDate>=:s1 and ';
strsql:=strsql+'SCW_outStoreDate<=:s2 and SCW_whichStore=:s3 and SCW_productName=:s4 and SCW_specification=:s5 and ';
strsql:=strsql+'SCW_unitName=:s6';
grid4.Cells[5,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
end;
{/*
查询酒库调票数据
*/}
for i:=3 to grid4.RowCount-2 do
begin
param.Clear;
param.Add(trim(beginDate3.text)+' 00:00:00');
param.Add(trim(endDate3.text)+' 23:59:59');
param.Add(trim(_whichStore));
param.Add(trim(grid4.cells[2,i].foretext)+'∕'+'1'+'×'+trim(grid4.cells[3,i].foretext)+'--'+trim(grid4.cells[4,i].foretext));
param.Add('1'+'×'+trim(grid4.cells[3,i].foretext));
param.Add(trim(grid4.cells[4,i].foretext));
strsql:='select sum(convert(real,productNum)) as a from sale_newSample_Accident where OutStoreTime>=:s1 and ';
strsql:=strsql+'outStoreTime<=:s2 and whichStore=:s3 and productName=:s4 and specification=:s5 and ';
strsql:=strsql+'unitName=:s6';
grid4.Cells[6,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
end;
{/*
计算差额
*/}
for i:=3 to grid4.RowCount-2 do
begin
if grid4.cells[5,i].ForeText='' then
begin
_col5:='0';
end
else
_col5:=trim(grid4.cells[5,i].ForeText);
if grid4.cells[6,i].ForeText='' then
begin
_col6:='0';
end
else
_col6:=trim(grid4.cells[6,i].ForeText);
if (grid4.cells[5,i].ForeText<>'') and (grid4.cells[6,i].ForeText<>'') then
begin
grid4.cells[7,i].ForeText:=formatFloat('##0',strToFloat(grid4.cells[5,i].ForeText)-strToFloat(grid4.cells[6,i].ForeText));
end;
end;//for
{/*
设置第七列颜色
*/}
for i:=3 to grid4.RowCount-2 do
begin
grid4.Cells[7,i].Color:=rgb(241,222,157);
if grid4.cells[7,i].ForeText<>'0' then
begin
grid4.cells[7,i].FontColor:=rgb(255,0,0);
end;
end;
{/*
计算合计
*/}
_Total:=0;
for i:=3 to grid4.RowCount-2 do
begin
_Total:=_Total+strToFloat(grid4.cells[7,i].foretext);
end;
grid4.Cells[7,grid4.RowCount-1].ForeText:=formatFloat('##0',_Total);
{/*
设置最后一行的颜色
*/}
for i:=1 to grid4.ColCount-1 do
begin
grid4.cells[i,grid4.rowcount-1].Color:=rgb(0,143,247);
grid4.cells[i,grid4.rowcount-1].FontColor:=rgb(255,255,255);
end;
grid4.cells[1,grid4.RowCount-1].ForeText:='合计:';
grid4.Refresh;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -