📄 sccgssb.pas
字号:
end;
with stringGrid2 do
begin
//RowCount:=publicquery2.RecordCount+1;
for I:=0 to publicquery2.RecordCount-1 do
begin
if Publicquery2.Eof then
exit;
Cells[9,I+1]:=Readkcsl(publicquery2.FieldByName('cpbh').asstring);
Cells[1,I+1]:=publicquery2.FieldByname('jhy').asstring;
cells[7,I+1]:=sqInputForm.ShowMeDate(sqrqstr);
Cells[12,I+1]:=sqdwstr;
//Cells[13,I+1]:=Publicquery2.FieldByName('sccj').asstring;
cells[2,I+1]:=Publicquery2.FieldByName('cpmc').asstring;
cells[3,I+1]:=Publicquery2.FieldByName('xhgg').asstring;
cells[4,I+1]:=Publicquery2.FieldByName('cpbh').asstring;
cells[5,I+1]:=Publicquery2.FieldByName('jldw').asstring;
cells[6,I+1]:=Publicquery2.FieldByName('sbsl').asstring;
Cells[8,I+1]:=Publicquery2.FieldByName('sccj').asstring;
if (strtofloat(Cells[6,I+1])-strTofloat(cells[9,I+1]))>0 then
Cells[10,I+1]:=Floattostr(strtofloat(Cells[6,I+1])-strTofloat(cells[9,I+1]))
else cells[10,I+1]:='0.0';
Publicquery2.Next;
end;
end;
publicquery1.close;
publicquery2.close;
end;
end;
procedure TjhssForm.StringGrid2DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
with Sender as TStringGrid do
begin
if gdFocused in State then
begin
if ACol=1 then
begin
jhyCombo.SetBounds(
Rect.Left+StringGrid2.left+1,
Rect.Top+StringGrid2.Top+1,
Rect.Right-Rect.Left+1,
StringGrid2.DefaultRowHeight);
Canvas.DrawFocusRect(Rect);
end;
if ACol=11 then
begin
ycdhrqDate.SetBounds(
Rect.Left+StringGrid2.left+1,
Rect.Top+StringGrid2.Top+1,
Rect.Right-Rect.Left+1,
StringGrid2.DefaultRowHeight);
Canvas.DrawFocusRect(Rect);
end;
end;
end;
end;
procedure TjhssForm.StringGrid2SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
MyRowCount:=ARow;
if ACol=1 then
begin
SetSgridEMode;
jhyCombo.Visible:=true;
jhyzdcjCombo.Visible:=False;
ycdhrqDate.Visible:=False;
end
else
if ACol=11 then
begin
SetSgridEMode;
ycdhrqDate.Visible:=True;
jhyCombo.Visible:=False;
jhyzdcjCombo.Visible:=False;
end
else
begin
jhyCombo.Visible:=False;
jhyzdcjCombo.Visible:=False;
ycdhrqDate.Visible:=False;
with stringGrid2 do
begin
if not (GoEditing in Options) then
Options:=Options+[GoEditing];
end;
end;
end;
procedure TjhssForm.jhyComboChange(Sender: TObject);
begin
stringGrid2.cells[1,MyRowCount]:=jhyCombo.Text;
end;
procedure TjhssForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
with datamodule1 do
begin
ssjhzbTable.close;
ssjhzbTable.close;
publicquery1.RequestLive:=false;
jhssForm.Release;
end;
end;
procedure TjhssForm.bzsjDateCloseUp(Sender: TObject);
var bzrqstr:string;
begin
with sqinputForm do
bzrqstr:=ShowMeDate(DateTo709str(bzsjDate.Date));
bzsjedit.Text:=bzrqstr;
end;
procedure TjhssForm.jhyzdcjComboChange(Sender: TObject);
begin
stringGrid2.cells[9,MyRowCount]:=jhyzdcjCombo.Text;
end;
procedure TjhssForm.ycdhrqDateCloseUp(Sender: TObject);
begin
if AnsiStrComp(pchar(stringGrid2.Cells[7,myRowCount]),pchar(sqinputForm.ShowMeDate(sqinputForm.DateTo709str(ycdhrqDate.date))))>0 then
begin
showmessage(' 你输入的预测到货时间早于申请时间!');
if stringGrid2.cells[11,MyRowCount]<>'' then
stringGrid2.cells[11,MyRowCount]:='';
exit;
end;
stringGrid2.cells[11,MyRowCount]:=sqinputForm.ShowMeDate(sqinputForm.DateTo709str(ycdhrqDate.date));
end;
procedure TjhssForm.bzfzrqzDateCloseUp(Sender: TObject);
begin
bzfzrqzedit.text:=sqinputForm.ShowMeDate(sqinputForm.DateTo709str(bzfzrqzDate.date));
end;
procedure TjhssForm.shrqDateCloseUp(Sender: TObject);
begin
shrqedit.text:=sqinputForm.ShowMeDate(sqinputForm.DateTo709str(shrqDate.date));
end;
procedure TjhssForm.pzrqDateCloseUp(Sender: TObject);
begin
pzrqedit.text:=sqinputForm.ShowMeDate(sqinputForm.DateTo709str(pzrqDate.date));
end;
procedure TjhssForm.BitBtn1Click(Sender: TObject);
begin
with datamodule1.publicQuery3 do
begin
sql.Clear;
sql.Add('select * From dbo.a_cgsszb');
sql.Add('where sqbid='+''''+sqbidCombo.text+'''');
prepare;
open;
if RecordCount<>0 then
begin
showmessage('您已经提交了这张采购实施计划表!');
close;
exit;
end;
close;
end;
if messageDlg('您确认已经正确完成这张实施计划表的录入工作吗?'+#13+
'是,请按OK!否,请按CANCEL!',mtInformation,[mbOK,mbCANCEL],0)=mrCancel then
exit;
postjhsszb;
postjhssxb;
Showmessage('您已经成功完成了实施计划表的录入工作!');
with datamodule1.publicQuery3 do
begin
close;
sql.clear;
sql.Add('select sqbid From dbo.a_cgsqzb');
sql.add('where scssb_flag='+''''+'0'+'''');
prepare;
open;
if RecordCount=0 then
begin
close;
jhssForm.close;
end;
close;
end;
end;
procedure TjhssForm.sqbidComboKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
showmessage('对不起!您不能修改表单号!');
end;
procedure TjhssForm.sqbidComboChange(Sender: TObject);
begin
initjhssForm;
end;
procedure TjhssForm.FormActivate(Sender: TObject);
begin
bzsjDate.DateTime:=Date;
bzfzrqzDate.DateTime:=Date;
shrqDate.DateTime:=Date;
pzrqDate.DateTime:=Date;
ycdhrqDate.DateTime:=Date;
with datamodule1.publicQuery3 do
begin
close;
sql.clear;
sql.Add('select sqbid From dbo.a_cgsqzb');
sql.add('where scssb_flag='+''''+'0'+'''');
prepare;
open;
if RecordCount=0 then
begin
showmessage('没有未生成实施表的申请表!');
exit;
end;
jhssForm.sqbidCombo.Items.clear;
while not Eof do
begin
jhssForm.sqbidComBo.Items.Add(FieldByName('sqbid').asstring);
next;
end;
jhssForm.sqbidComBo.Text:=jhssForm.sqbidComBo.Items[jhssForm.sqbidComBo.Items.count-1];
close;
end;
datamodule1.ssjhzbTable.open;
datamodule1.ssjhxbTable.open;
initstringGrid;
with datamodule1.publicquery1 do
begin
//初始化部门名称和部门人员名称
sql.clear;
sql.add('Select bmmc,bmfzr from dbo.e_bmmcb');
open;
first;
bzfzrCombo.Items.Clear;
shrCombo.Items.Clear;
pzrCombo.Items.Clear;
while not eof do
begin
bzfzrCombo.Items.Add(FieldByName('bmfzr').asstring);
pzrCombo.Items.Add(FieldByName('bmfzr').asstring);
shrCombo.Items.Add(FieldByName('bmfzr').asstring);
next;
end;
sql.clear;
sql.add('Select jhyid from dbo.p_jhyb');
prepare;
open;
first;
jhyCombo.Items.Clear;
while not eof do
begin
jhyCombo.Items.Add(FieldByName('jhyid').asstring);
next;
end;
close;
end;
bzsjedit.Text:=sqinputForm.ShowMeDate(sqinputForm.DateTo709str(Date));
InitSGridHead;
InitjhssForm;
end;
end.
//[goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goRangeSelect,goDrawFocusSelected,goColSizing,goRowMoving,goEditing,goTabs]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -