ssbqr.pas

来自「一个仓库管理中的子系统--采购子系统」· PAS 代码 · 共 737 行 · 第 1/2 页

PAS
737
字号
     begin
      SetSgridEMode;
      tjqrCheck.Visible:=False;
      jhyzdcjCombo.Visible:=False;
      cgfsCombo.Visible:=true;
      ycdhrqDate.Visible:=False;
      hgfczfcheck.Visible:=False;
     end
     else
     if ACol=15 then
     begin
      SetSgridEMode;
      tjqrCheck.Visible:=False;
      jhyzdcjCombo.Visible:=False;
      cgfsCombo.Visible:=False;
      ycdhrqDate.Visible:=true;
      hgfczfcheck.Visible:=False;
     end
     else
     if Acol=17 then
     begin
     tjqrCheck.Visible:=False;
     cgfsCombo.Visible:=False;
     hgfczfcheck.Visible:=False;
     jhyzdcjCombo.Visible:=False;
     ycdhrqDate.Visible:=False;
     with stringGrid1 do
     begin
     if not (GoEditing in Options) then
     Options:=Options+[GoEditing];
     end;
     end
     else
     begin
     tjqrCheck.Visible:=False;
     cgfsCombo.Visible:=False;
     hgfczfcheck.Visible:=False;
     jhyzdcjCombo.Visible:=False;
     ycdhrqDate.Visible:=False;
     end;
     end
     else
     begin
     tjqrCheck.Visible:=False;
     cgfsCombo.Visible:=False;
     hgfczfcheck.Visible:=False;
     jhyzdcjCombo.Visible:=False;
     ycdhrqDate.Visible:=False;
     end;
end;

procedure TssbqrForm.jhyzdcjComboChange(Sender: TObject);
begin
    stringGrid1.cells[10,MyRowCount]:=jhyzdcjCombo.Text;
end;

procedure TssbqrForm.ycdhrqDateCloseUp(Sender: TObject);
begin
   if AnsiStrComp(pchar(stringGrid1.Cells[8,myRowCount]),pchar(sqinputForm.ShowMeDate(sqinputForm.DateTo709str(ycdhrqDate.date))))>0 then
   begin
   showmessage(' 你输入的预测到货时间早于申请时间!');
   if stringGrid1.cells[15,MyRowCount]<>'' then
   stringGrid1.cells[15,MyRowCount]:='';
   exit;
   end;
   stringGrid1.cells[15,MyRowCount]:=sqinputForm.ShowMeDate(sqinputForm.DateTo709str(ycdhrqDate.date));
end;

procedure TssbqrForm.cgfsComboChange(Sender: TObject);
begin
   stringGrid1.cells[12,MyRowCount]:=cgfsCombo.text;
end;

procedure TssbqrForm.hgfczf1CheckClick(Sender: TObject);
begin
    if hgfczfCheck.Checked then
    stringGrid1.cells[11,MyRowCount]:='是'
    else
    stringGrid1.cells[11,MyRowCount]:='不是';
end;

procedure TssbqrForm.FormActivate(Sender: TObject);
begin
    ycdhrqDate.DateTime:=Date;
    date1.DateTime:=date;
    date2.DateTime:=date;
    //initstringGrid;
    initsGridhead;
    initssbqrForm;
    startedit.text:='2001-05-01';
    endedit.Text:=sqinputForm.ShowMeDate(sqinputForm.DateTo709Str(date));
    with datamodule1.PublicQuery1 do
    begin
    close;
    sql.clear;
    sql.add('select gysmc from dbo.e_fczfzb');
    open;
    first;
       jhyzdcjCombo.Items.Clear;
       while  not eof do
       begin
         jhyzdcjCombo.Items.Add(FieldByName('gysmc').asstring);
         next;
       end;
    close;
    end;

end;

procedure TssbqrForm.qrBtnClick(Sender: TObject);
var I:integer;
begin
    if posttoDataBase then
    begin
    For I:=1 to RwRecordCount do
    begin
    if (stringGrid1.Cells[11,I]='不是') then
    begin
    bhgsqbqrForm:=TbhgsqbqrForm.Create(application);
    with BhgsqbqrForm do
    begin
    sqbidlabel.caption:=ssbqrForm.StringGrid1.Cells[2,I];
    with datamodule1.PublicQuery1 do
    begin
    sql.Clear;
    sql.Add('select * From dbo.a_cgsqxb');
    sql.Add('where sqbid='+''''+ssbqrForm.stringGrid1.Cells[2,I]+''''+' and ');
    sql.Add('cpbh='+''''+ ssbqrForm.stringGrid1.Cells[5,I]+'''');
    prepare;
    open;
    stringGrid2.Cells[2,1]:=FieldByname('cpmc').asstring;
    stringGrid2.Cells[3,1]:=FieldByname('xhgg').asstring;
    stringGrid2.Cells[1,1]:=FieldByname('cpbh').asstring;
    stringGrid2.Cells[4,1]:=FieldByname('jldw').asstring;
    stringGrid2.Cells[5,1]:=FieldByname('sbsl').asstring;
    stringGrid2.Cells[6,1]:=FieldByname('gjje').asstring;
    stringGrid2.Cells[7,1]:=ssbqrForm.stringGrid1.cells[10,I];
    stringGrid2.Cells[8,1]:=FieldByname('yyhrw').asstring;
    stringGrid2.Cells[9,1]:=FieldByname('sjyq').asstring;
    close;
    end;
    end;
    hide;
    bhgsqbqrForm.ShowModal;
    bhgsqbqrForm.free;
    show;
    end;
    end;
    Formactivate(self);
    end;
end;


procedure TssbqrForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
    datamodule1.PublicQuery1.RequestLive:=false;
    datamodule1.PublicQuery1.close;
    ssbqrForm.Release;
end;

procedure TssbqrForm.tjqrCheckClick(Sender: TObject);
begin
   if tjqrCheck.Checked then
    stringGrid1.cells[1,MyRowCount]:='确认'
    else
    stringGrid1.cells[1,MyRowCount]:='不确认';
end;

procedure TssbqrForm.TabControl1Change(Sender: TObject);
var oldcaption:string;
begin
    oldcaption:='您好!以下是到今天为止的所有你还没有确认的任务。';
    with TabControl1 do
    begin
     if TabIndex=1 then
     begin
     //设置按钮的可见状态
     qrBtn.Visible:=False;
     stringGrid1.Visible:=False;
     label2.Caption:='您好!';
     //设置DBGrid1的显示性质
     with DbGrid1 do
       begin
       Visible:=True;
       startlabel.Visible:=True;
       endLabel.Visible:=True;
       cxbtn.Visible:=True;
       qrbtn.Visible:=False;
       startedit.Visible:=True;
       endedit.Visible:=true;
       date1.Visible:=true;
       date2.Visible:=True;
       printButton.Visible:=True;
       Height:=stringGrid1.Height;
       Width:=stringGrid1.Width;
       Left:=stringGrid1.Left;
       top:=stringGrid1.Top;
       end;
      with datamodule1.qrssbQuery do
      begin
      sql.clear;
      sql.Add('select dbo.a_cgsszb.sqbid as 申请表单号,');
      sql.add('cpmc as 产品名称,xhgg as 型号规格,jldw as 计量单位, sbsl as 申报数量,');
      sql.Add('sbrq as 申请日期,kcsl as 库存数量,xcgsl as 需采购数量,ycdhsj as 预测到货时间,');
      sql.Add('xqdw as 需求单位,cgslhs as 采购数量核实,bz as 备注 from dbo.a_cgssxb,dbo.a_cgsszb ');
      sql.Add('where dbo.a_cgssxb.sqbid=dbo.a_cgsszb.sqbid and ');
      sql.Add('dbo.a_cgssxb.jhy='+''''+jhyidlabel.Caption+''''+' and ');
      SQL.ADD(' dbo.a_cgssxb.tjqr='+''''+'1'+''''+' and sbrq>='+''''+sqinputForm.GetDate709(startedit.Text)+''''+' and sbrq<='+''''+sqinputForm.GetDate709(endedit.text)+'''');
      prepare;
      open;
      First;
      end;
      end
      else
        begin
        label2.Caption:=oldcaption;
        qrBtn.Visible:=True;
        cxbtn.Visible:=False;
        startlabel.Visible:=False;
        endLabel.Visible:=False;
        startedit.Visible:=False;
        endedit.Visible:=False;
        date1.Visible:=False;
        date2.Visible:=False;
        printButton.Visible:=False;
        stringGrid1.Visible:=True;
        dbGrid1.Visible:=False;
        datamodule1.qrssbQuery.close;
        //FormActivate(self);
        end;
      end;
end;
procedure TssbqrForm.jhyzdcjComboKeyPress(Sender: TObject; var Key: Char);
begin
    if key=#13 then
   with datamodule1.PublicQuery1 do
    begin
    close;
    sql.Clear;
    sql.Add('select gysmc from dbo.e_fczfzb');
    sql.Add('where gysmc like ');
    sql.add(''''+jhyzdcjCombo.text+'%'+'''');
    open;
    first;
    jhyzdcjCombo.Items.Clear;
       while  not eof do
       begin
         jhyzdcjCombo.Items.Add(FieldByName('gysmc').asstring);
         next;
       end;
     close;
    end;
end;

procedure TssbqrForm.StringGrid1DblClick(Sender: TObject);
begin
    if stringGrid1.col=2 then
   begin
   jhycxForm:=TjhycxForm.Create(application);
   hide;
   jhycxForm.ShowModal;
   jhycxForm.free;
   show;
   end;
end;

procedure TssbqrForm.Date1CloseUp(Sender: TObject);
begin
    startedit.Text:=sqinputForm.ShowMeDate(sqinputForm.dateTo709str(date1.date));
end;

procedure TssbqrForm.Date2CloseUp(Sender: TObject);
begin
    endedit.Text:=sqinputForm.ShowMeDate(sqinputForm.dateTo709str(date2.date));
end;

procedure TssbqrForm.cxBtnClick(Sender: TObject);
begin
   with datamodule1.qrssbQuery do
      begin
      sql.clear;
      sql.Add('select dbo.a_cgsszb.sqbid as 申请表单号,');
      sql.add('cpmc as 产品名称,xhgg as 型号规格,jldw as 计量单位, sbsl as 申报数量,');
      sql.Add('sbrq as 申请日期,kcsl as 库存数量,xcgsl as 需采购数量,ycdhsj as 预测到货时间,');
      sql.Add('xqdw as 需求单位,cgslhs as 采购数量核实,bz as 备注 from dbo.a_cgssxb,dbo.a_cgsszb ');
      sql.Add('where dbo.a_cgssxb.sqbid=dbo.a_cgsszb.sqbid and ');
      sql.Add('dbo.a_cgssxb.jhy='+''''+jhyidlabel.Caption+''''+' and ');
      SQL.ADD(' dbo.a_cgssxb.tjqr='+''''+'1'+''''+' and sbrq>='+''''+sqinputForm.GetDate709(startedit.Text)+''''+' and sbrq<='+''''+sqinputForm.GetDate709(endedit.text)+'''');
      prepare;
      open;
      First;
      end;
end;

procedure TssbqrForm.printButtonClick(Sender: TObject);
begin
   jhyrwReportForm:=TjhyrwReportForm.Create(application);
   Report:=jhyrwReportform.QuickRep;
   with datamodule1.qrssbQuery do
   begin
   with  jhyrwreportForm do
   begin
   jhyqr.Caption:=jhyidLabel.Caption;
   startQr.Caption:=startedit.Text;
   endqr.Caption:=endedit.Text;
   RecordCountqr.Caption:=IntTostr(RecordCount);
   sqbidqr.DataField:=FieldByName('申请表单号').fieldname;
   cpmcqr.DataField:=FieldByName('产品名称').fieldName;
   xhggQR.DataField:=FieldByName('型号规格').fieldName;
   jldwQR.DataField:=FieldByName('计量单位').fieldName;
   sbslQR.DataField:=FieldByName('申报数量').fieldName;
   sbsjQR.DataField:=FieldByName('申请日期').fieldName;
   kcslQr.DataField:=FieldByname('库存数量').FieldName;
   xcgslQR.DataField:=FieldByname('需采购数量').FieldName;
   ycdhsjQR.DataField:=FieldByname('预测到货时间').Fieldname;
   xqdwQR.DataField:=FieldByName('需求单位').FieldName;
   cgslhsQR.DataField:=FieldByname('采购数量核实').Fieldname;
   bzqr.DataField:=FieldByName('备注').Fieldname;
   end;
   end;
   Report.Preview;
   jhyrwReportForm.Close;
   jhyrwreportForm.free;
end;

procedure TssbqrForm.DBGrid1CellClick(Column: TColumn);
begin
    if (Column.Field=datamodule1.qrssbQuery.FieldByName('申请表单号')) then
    begin
      jhycxForm:=TjhycxForm.Create(application);
      with jhycxForm do
      begin
      bdidlabel.Caption:=column.Field.Text;
      with datamodule1.PublicQuery1 do
      begin
      close;
      sql.Clear;
      sql.Add('select sqbid,rwmc,yxnx,lsh,sqdw,sqrq,bzr,xqfzr,shr,pzr,bzrq,xqrq,shrq,pzrq');
      sql.Add('From dbo.a_cgsqzb');
      sql.Add('where sqbid='+''''+bdidLabel.caption+'''');
      prepare;
      open;
      rwmclabel.Caption:=FieldByName('rwmc').asstring;
      yxnxlabel.Caption:=FieldByname('yxnx').asstring;
      lshlabel.Caption:=FieldByName('lsh').asstring;
      sqdwlabel.Caption:=FieldByName('sqdw').asstring;
      sqsjlabel.Caption:=sqinputForm.ShowmeDate(FieldByName('sqrq').asstring);
      xqfzrlabel.Caption:=FieldByName('xqfzr').asstring;
      xqqzrqlabel.Caption:=sqinputForm.ShowmeDate(FieldByName('xqrq').asstring);
      bzrlabel.Caption:=FieldByName('bzr').asstring;
      bzrqlabel.Caption:=sqinputForm.ShowmeDate(FieldByName('bzrq').asstring);
      shrlabel.Caption:=FieldByName('shr').asstring;
      shrqlabel.Caption:=sqinputForm.ShowmeDate(FieldByName('shrq').asstring);
      pzrlabel.Caption:=FieldByName('pzr').asstring;
      pzrqlabel.Caption:=sqinputForm.ShowmeDate(FieldByName('pzrq').asstring);
      close;
      end;
      end;
    hide;
    jhycxForm.ShowModal;
    jhycxForm.free;
    show;
    end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?