cghzbcx.pas

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

PAS
1,289
字号
    Fields_count:=datamodule1.hzglquery.Fields.count;
    for I:=0 to datamodule1.hzglquery.Fields.Count-1 do
     if  visible_flag_array[I]=1 then
        datamodule1.hzglquery.Fields[I].Visible:=false;
    end;
    end
    else
    with datamodule1.hzglQuery do
    begin
    close;
    sql.Clear;
    sql.Text:=select_condition;
    prepare;
    open;
    for I:=0 to datamodule1.hzglquery.Fields.Count-1 do
     if  visible_flag_array[I]=1 then
        datamodule1.hzglquery.Fields[I].Visible:=false;
    Fields_count:=datamodule1.hzglquery.Fields.count;
    end;

    //label6.Caption:=IntToStr(dbgrid1.FieldCount);
    {For I:=0 to CghzbForm.DBGrid1.FieldCount-1 do
    cghzbForm.DBGrid1.Columns.Items[I].Width:=40;}
    Record_Count;
    TotalProduct_Count;
    TotalTable_Count('');
    TotalMoney_Count;
    ybjsl_count;
    bjhgsl_count;
    bjbhgsl_count;
    cgslhs_count;
end;

procedure TcghzbForm.printButtonClick(Sender: TObject);
begin
   cghzReportForm:=TcghzReportForm.Create(application);
   if PreparePrint=False then
   begin
   cghzReportForm.free;
   exit;
   end;
   with cghzReportForm do
   begin
     QuickRep.Preview;
     datamodule1.publicquery2.Close;
     datamodule1.publicquery3.Close;
   end;
end;

procedure TcghzbForm.dzbbBtnClick(Sender: TObject);
begin
    dzbbForm:=TdzbbForm.create(Application);
    hide;
    dzbbForm.showmodal;
    dzbbForm.free;
    show;
end;

procedure TcghzbForm.DBGrid1CellClick(Column: TColumn);
begin
   Datamodule1.set_flag:=2;
   if (Column.Field=datamodule1.hzglquery.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;

procedure TcghzbForm.N16Click(Sender: TObject);
begin
    jfgsForm:=TjfgsForm.Create(Application);
    hide;
    jfgsForm.ShowModal;
    jfgsForm.free;
    show;
end;

procedure TcghzbForm.N17Click(Sender: TObject);
begin
   cgzxqkForm:=TcgzxqkForm.Create(Application);
   hide;
   cgzxqkForm.ShowModal;
   cgzxqkForm.free;
   show;
end;

procedure TcghzbForm.BitBtn3Click(Sender: TObject);
var I:integer;
begin
    with Datamodule1 do
    begin
    hzglbSelect:='select  SQBID as 申请表单号,RWMC as 任务名称,YXNX as 有效年限,LSH as 流水号,JHY as 计划员,CPBH as 产品编号,CPMC as 产品名称,xHGG as 型号规格,SLDW as 计量单位,SBRQ as 申请日期,SBSL as 申报数量,KCSL as 库存数量,';
    hzglbSelect:=hzglbSelect+'SXSL as 需采购数量,GJJE as 估计金额,sccj as 申请指定厂家,SJCGSCCJ as 实际采购厂家,YBJSL as 已报检数量,CGSLHS as 采购数量核实,BJHGSJ as 报检合格时间,YSBX1 as 用于何任务,SJYQ as 时间要求,YCDHSJ as 预测到货时间,BJSJ as 报检时间,';
    hzglbSelect:=hzglbSelect+'BJHGSL as 报检合格数量,BJBHGSL as 报检不合格数量,XQDW as 申报部门,BZR as 申请表编制人,BZRQ as 编制日期,SHR as 申请表审核人,SHRQ as 审核时间,PZR as 申请表批准人,PZRQ as 批准时间,CGFS as 采购方式,HG_FLAG as 合格分承制方,'+'QT as 到货说明,BZ as 备注';
    with hzglquery do
    begin
    close;
    sql.Clear;
    sql.Add(hzglbselect);
    sql.Add('from dbo.a_cghzglb');
    if condition<>'' then
    sql.Add(' where '+condition);
    prepare;
    sql.Text:=sql.Text+'order by 申请表单号 desc,型号规格 asc';
    open;
    for I:=0 to datamodule1.hzglquery.Fields.Count-1 do
     if  visible_flag_array[I]=1 then
        datamodule1.hzglquery.Fields[I].Visible:=false;
    end;
    end;
end;

procedure TcghzbForm.N18Click(Sender: TObject);
var query_operator,query_date:string;
    I:integer;
begin
    dhqk_form:=Tdhqk_Form.Create(Application);
    hide;

    with dhqk_form do
    begin
    query_operator:=combobox2.Text;
    if ShowModal=mrok then
    begin

    if rd1.ItemIndex=0 then
    begin
    query_date:=combobox3.Text;
    with datamodule1.hzglquery do
     begin
     sql.Clear;
     if query_date='' then
     begin
     showmessage('您没有输入应有的查询条件!');
     dhqk_form.free;
     N18Click(Sender);
     exit;
     end;

     hzglbSelect:='select  SQBID as 申请表单号,RWMC as 任务名称,YXNX as 有效年限,LSH as 流水号,JHY as 计划员,CPBH as 产品编号,CPMC as 产品名称,xHGG as 型号规格,SLDW as 计量单位,SBRQ as 申请日期,SBSL as 申报数量,KCSL as 库存数量,';
      hzglbSelect:=hzglbSelect+'SXSL as 需采购数量,GJJE as 估计金额,sccj as 申请指定厂家,SJCGSCCJ as 实际采购厂家,YBJSL as 已报检数量,CGSLHS as 采购数量核实,BJHGSJ as 报检合格时间,YSBX1 as 用于何任务,SJYQ as 时间要求,YCDHSJ as 预测到货时间,BJSJ as 报检时间,';
      hzglbSelect:=hzglbSelect+'BJHGSL as 报检合格数量,BJBHGSL as 报检不合格数量,XQDW as 申报部门,BZR as 申请表编制人,BZRQ as 编制日期,SHR as 申请表审核人,SHRQ as 审核时间,PZR as 申请表批准人,PZRQ as 批准时间,CGFS as 采购方式,HG_FLAG as 合格分承制方,'+'QT as 到货说明,BZ as 备注';
      sql.Add(hzglbSelect);
      sql.Add('from dbo.a_cghzglb');
      sql.Add('where   ('+' bjsj='+''''+'0'+''''+' or YBJSL<CGSLHS'+' )'+' and '+'YCDHSJ'+query_operator+''''+query_date+''''+' and YBJSL<CGSLHS');
      //sql.Add('where  qt'+query_operator+''''+query_date+'''');
      sql.Text:=sql.Text+'order by 申请表单号 desc,计划员 asc';
      select_condition:=sql.Text; //记忆上一次查询的sql语句,准备回主查询窗口时刷新
      condition:=' ('+' bjsj='+''''+'0'+''''+' or YBJSL<CGSLHS'+' )'+' and '+'YCDHSJ'+query_operator+''''+query_date+'''';
      prepare;
      open;
     for I:=0 to datamodule1.hzglquery.Fields.Count-1 do
     if  visible_flag_array[I]=1 then
        datamodule1.hzglquery.Fields[I].Visible:=false;
     //Fields_count:=datamodule1.hzglquery.Fields.count;
     //visible_fields_count:=datamodule1.hzglquery.Fields.count;
     end;
     TotalTable_Count('where '+condition);
     dhqk_form.free;
     ybjsl_count;
     bjhgsl_count;
     bjbhgsl_count;
     cgslhs_count;
     Record_COunt;
     TotalProduct_Count;
     TotalMoney_Count;
    end
    else
    begin
    query_date:=combobox1.Text;
      with datamodule1.hzglquery do
      begin
      sql.Clear;
      if query_date='' then
      begin
      showmessage('您没有输入应有的查询条件!');
      dhqk_form.free;
      N18Click(Sender);
      exit;
      end;

      hzglbSelect:='select  SQBID as 申请表单号,RWMC as 任务名称,YXNX as 有效年限,LSH as 流水号,JHY as 计划员,CPBH as 产品编号,CPMC as 产品名称,xHGG as 型号规格,SLDW as 计量单位,SBRQ as 申请日期,SBSL as 申报数量,KCSL as 库存数量,';
     hzglbSelect:=hzglbSelect+'SXSL as 需采购数量,GJJE as 估计金额,sccj as 申请指定厂家,SJCGSCCJ as 实际采购厂家,YBJSL as 已报检数量,CGSLHS as 采购数量核实,BJHGSJ as 报检合格时间,YSBX1 as 用于何任务,SJYQ as 时间要求,YCDHSJ as 预测到货时间,BJSJ as 报检时间,';
     hzglbSelect:=hzglbSelect+'BJHGSL as 报检合格数量,BJBHGSL as 报检不合格数量,XQDW as 申报部门,BZR as 申请表编制人,BZRQ as 编制日期,SHR as 申请表审核人,SHRQ as 审核时间,PZR as 申请表批准人,PZRQ as 批准时间,CGFS as 采购方式,HG_FLAG as 合格分承制方,'+'QT as 到货说明,BZ as 备注';

     sql.Add(hzglbSelect);
     sql.Add('from dbo.a_cghzglb');
     sql.Add('where  bjsj='+''''+'0'+''''+' and '+'qt'+query_operator+''''+query_date+'''');
     //sql.Add('where  qt'+query_operator+''''+query_date+'''');
     sql.Text:=sql.Text+'order by 申请表单号 desc,计划员 asc';
     select_condition:=sql.Text; //记忆上一次查询的sql语句,准备回主查询窗口时刷新
     condition:=' bjsj='+''''+'0'+''''+' and '+'qt'+query_operator+''''+query_date+'''';
     //condition:='qt'+query_operator+''''+query_date+'''';
     //wherestr:='where qt'+query_operator+query_date;
     prepare;
     open;

      for I:=0 to datamodule1.hzglquery.Fields.Count-1 do
       if  visible_flag_array[I]=1 then
        datamodule1.hzglquery.Fields[I].Visible:=false;
     end;
     TotalTable_Count('where '+condition);
     dhqk_form.free;
     ybjsl_count;
     bjhgsl_count;
     bjbhgsl_count;
     cgslhs_count;
     Record_COunt;
     TotalProduct_Count;
     TotalMoney_Count;
     end;
     end;
     end;
     show;
end;

procedure TcghzbForm.BitBtn4Click(Sender: TObject);
var I:integer;
begin
     if xg_flag=false then
     begin
     showmessage('您现在没有使汇总管理表处于修改状态!');
     exit;
     end
     else
     xgCheckClick(xgcheck);
     
     visible_fields_count:=0;
     Form2:=Tform2.Create(application);
     hide;
     datamodule1.hzglQuery.close;
     form2.ShowModal;
     form2.free;
     
     with datamodule1.hzglQuery do
     begin
     sql.Clear;
     sql.Text:=select_condition;
     prepare;
     open;
     
     for I:=0 to datamodule1.hzglquery.Fields.Count-1 do
     if  visible_flag_array[I]=1 then
        datamodule1.hzglquery.Fields[I].Visible:=false;
     Fields_count:=datamodule1.hzglquery.Fields.count;
     end;
     show;
end;

procedure TcghzbForm.FormCreate(Sender: TObject);
begin
    xg_flag:=false;
end;

procedure TcghzbForm.xgCheckClick(Sender: TObject);
var I:integer;
    old_visible_flag_array : Array [0..35] of integer;
begin
    for I:=0 to 35 do
    old_visible_flag_array[I]:=visible_flag_array[I];

    if xgcheck.Checked then
    begin
    xg_flag:=true;
    with datamodule1.hzglQuery do
    begin
    fields.FieldByName('到货说明').visible:=true;
    fields.FieldByName('备注').visible:=true;
    fields.FieldByName('申请表单号').visible:=true;
    fields.FieldByName('产品编号').visible:=true;

    for I:=0 to fields_count-1 do
     visible_flag_array[I]:=0;

    for I:=0 to fields.Count-1 do
     if not fields[I].Visible then
     visible_flag_array[I]:=1;
     end;
     end
    else
    begin
    xg_flag:=false;
    for I:=0 to 35 do
    visible_flag_array[I]:=old_visible_flag_array[I];
    end;
end;

end.

⌨️ 快捷键说明

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