⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 untwldwstaff.pas

📁 适合行业为眼镜业
💻 PAS
📖 第 1 页 / 共 3 页
字号:
      str1:=str1+')';
      tj:=tj+' and a.storage_no in '+trim(str1);
    end;
    screen.Cursor :=  crHourGlass;
    temp:=tables+''''+vbegin+''''+','+''''+vend+''''+','+''''+tj+''''+','+iflag+','+inttostr(LocalCount);
    try
    datas:=adisp.GetRecord(temp);
    except
      application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
      screen.Cursor :=  crdefault;
      exit;
    end;
       ////////////////////////////////
    if  not varisnull(datas) then
    begin
    cdssoft.Data:=datas;
    cdssoft.Open;
    datas:=null;
    cdssoft.Last;
    LocalCount := GetKeyFieldValue('id',cdssoft);   //传入具体字段
    btnpagedown.Enabled:=true;
    with cdssoft.IndexDefs.AddIndexDef do
    begin
      Fields := 'goods_no';  //
      Options := [];
    end;
    cdssoft.IndexDefs.Update;
    cdssoft.Open;
    Gridback.Visible:=false;
    dbgrid2.Visible:=true;
    ///////////////////////
    dbgrid1.DataSource:=nil;
    dbgrid3.DataSource:=nil;
    dbgrid4.DataSource:=nil;
    dbgrid2.DataSource:=dsview;
    ////////////////////////
    setdbgrid(dbgrid2,3);
    end;
    screen.Cursor :=  crdefault;

end;

procedure TfmWldwStaff.ChbtypeClick(Sender: TObject);
begin
  inherited;
  ckbcmb(chbtype,cmbtype);
  CmBTypeChange(cmbtype);
end;

procedure TfmWldwStaff.ChbbrandClick(Sender: TObject);
begin
  inherited;
   ckbcmb(chbbrand,cmbbrand);
   cmbbrandchange(cmbbrand);
end;

procedure TfmWldwStaff.ChBbreedClick(Sender: TObject);
begin
  inherited;
  ckbcmb(chbbreed,cmbbreed);
end;

procedure TfmWldwStaff.ChbMstorageClick(Sender: TObject);
begin
  inherited;
  ckbcmb(chbmstorage,cmbbmstorage);
end;

procedure TfmWldwStaff.ChbstorageClick(Sender: TObject);
begin
  inherited;
  ckbcmb(chbstorage,cmbbstorage);
end;

procedure TfmWldwStaff.ChbwldwClick(Sender: TObject);
begin
  inherited;
  ckbedit(chbwldw,edtgeher);
end;

procedure TfmWldwStaff.CmbtypeChange(Sender: TObject);
var
  t_sql:string;
begin
  inherited;
  //调品牌
  t_sql:='select  distinct brand from  [goods_code] where type ='+''''+trim(cmbtype.text)+'''';
  GetDataToComBoX(cmbBrand,t_sql,'brand');
  cmbBrand.ItemIndex := -1;
  cmbbreed.Clear;

end;

procedure TfmWldwStaff.CmbbrandChange(Sender: TObject);
var
  t_sql:string;
begin
  inherited;
  //调品种
  if cmbtype.Text = '' then exit;
  t_sql:='select distinct breed  from  [goods_code] where brand ='+''''+trim(cmbbrand.text)+''''+' and type =' +''''+trim(cmbtype.text)+'''';
  GetDataToComBoX(cmbBreed,t_sql,'breed');
  cmbBreed.ItemIndex := -1;

end;

procedure TfmWldwStaff.CmbBmstorageChange(Sender: TObject);
var
  t_sql:string;
begin
  inherited;
  t_sql:='select storageid from stock_manager where managerid='+''''+trim(copy(trim(cmbbmstorage.Text),pos('仓库',trim(cmbbmstorage.Text))+4,length(trim(cmbbmstorage.Text))))+'''';
  GetDataToComBoX(cmbbstorage,t_sql,'storageid');
  cmbbstorage.Items.Add('全部仓库');
  cmbbstorage.ItemIndex:=-1;
end;

procedure TfmWldwStaff.DBGrid2DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
  inherited;
  setdbgrid(dbgrid2,2);
end;

procedure TfmWldwStaff.DBGrid2DrawDataCell(Sender: TObject;
  const Rect: TRect; Field: TField; State: TGridDrawState);
begin
  inherited;
  setdbgrid(dbgrid2,2);
end;

procedure TfmWldwStaff.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  cdssoft.Close;
  cdssoft.Data:=null;
  cdspart.Close;
  cdspart.Data:=null;
  inherited;

end;

procedure TfmWldwStaff.DBGrid2TitleClick(Column: TColumn);
begin
  inherited;
  if (not dbgrid2.DataSource.DataSet.Active ) then exit;
  if trim(column.Field.AsString)='' then exit;
  sortgrid(column.Field.FieldName,cdssoft,dbgrid2,column);
end;

procedure TfmWldwStaff.BitBtn10Click(Sender: TObject);
var
  temp:widestring;
  datas:olevariant;
begin
  inherited;
  tables:=' * from [Supply_Company]';
  cdssoft.Close;
  cdssoft.Data:=null;
  cdssoft.IndexName:='';
  cdssoft.IndexDefs.Clear;
  tj:=' where 1=1 ';
  if chbcode.Checked then tj:=tj+'and supply_NO='+''''+trim(edtcode.Text)+'''';
  if chbname.Checked then tj:=tj+'and supply_Name='+''''+trim(edtname.Text)+'''';
  if chbtotalys.Checked then tj:=tj+'and Must_gather='+trim(edttotalys.Text);
  if chbtotalyf.Checked then tj:=tj+' and Pay_gather='+trim(edttotalyf.Text);
  if chbxy.Checked then tj:=tj+' and contact='+trim(edtxy.Text);
   screen.Cursor :=  crHourGlass;
    temp:=tempsql+tables+tj;
    try
    datas:=adisp.GetRecord(temp);
    except
      application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
      screen.Cursor :=  crdefault;
      exit;
    end;
       ////////////////////////////////
    if  not varisnull(datas) then
    begin
    cdssoft.Data:=datas;
    cdssoft.Open;
    datas:=null;
    cdssoft.Last;
    LocalCount := GetKeyFieldValue('id',cdssoft);   //传入具体字段
    btnpagedown.Enabled:=true;
    with cdssoft.IndexDefs.AddIndexDef do
    begin
      Fields := 'supply_NO';  //
      Options := [];
    end;
    cdssoft.IndexDefs.Update;
    cdssoft.Open;
    Gridbase.Visible:=false;
    dbgrid1.Visible:=true;
    ///////////////////////
    dbgrid2.DataSource:=nil;
    dbgrid1.DataSource:=nil;
    dbgrid4.DataSource:=nil;
    dbgrid3.DataSource:=dsview;
    ////////////////////////
    setdbgrid(dbgrid2,3);
    end;
    screen.Cursor :=  crdefault;

end;

procedure TfmWldwStaff.ChbcodeClick(Sender: TObject);
begin
  inherited;
  ckbedit(chbcode,edtcode);
end;

procedure TfmWldwStaff.ChbNameClick(Sender: TObject);
begin
  inherited;
  ckbedit(chbname,edtname);
end;

procedure TfmWldwStaff.ChbtotalYsClick(Sender: TObject);
begin
  inherited;
  ckbedit(chbtotalys,edttotalys);
end;

procedure TfmWldwStaff.ChbTotalYfClick(Sender: TObject);
begin
  inherited;
  ckbedit(chbtotalyf,edttotalyf);
end;

procedure TfmWldwStaff.ChBXYClick(Sender: TObject);
begin
  inherited;
  ckbedit(chbxy,edtxy);
end;

procedure TfmWldwStaff.DBGrid3TitleClick(Column: TColumn);
begin
  inherited;
  if (not dbgrid3.DataSource.DataSet.Active ) then exit;
  if trim(column.Field.AsString)='' then exit;
  sortgrid(column.Field.FieldName,cdssoft,dbgrid3,column);
end;

procedure TfmWldwStaff.DBGrid3DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
  inherited;
  setdbgrid(dbgrid3,2);
end;

procedure TfmWldwStaff.DBGrid3DrawDataCell(Sender: TObject;
  const Rect: TRect; Field: TField; State: TGridDrawState);
begin
  inherited;
  setdbgrid(dbgrid3,2);
end;

procedure TfmWldwStaff.PageC1Change(Sender: TObject);
begin
  inherited;
  case pagec1.ActivePageIndex of
    0 : dbgCur:=dbgrid1;
    1 : dbgCur:=dbgrid2;
    2 : dbgCur:=dbgrid4;
    3:  dbgCur:=dbgrid3;
  end;
end;

procedure TfmWldwStaff.SpeedButton1Click(Sender: TObject);
begin
  inherited;
  Check_Mond:='';
  Check_Mond:='Stock_pay_Str';
  frm_Supply_Monad:=Tfrm_Supply_Monad.Create(self);
  frm_Supply_Monad.Caption:='【往来单位】';
  frm_Supply_Monad.ShowModal;
  EdTSup_no.Text:=check_Mond_Result;
  no:=wldwno;
  frm_Supply_Monad.Free;
end;

procedure TfmWldwStaff.ckbnewDateClick(Sender: TObject);
begin
  inherited;
  ckbDtps(ckbnewdate,dtpbegin,dtpend);
end;

procedure TfmWldwStaff.CbnameClick(Sender: TObject);
begin
  inherited;
  ckbedit(cbname,edtsup_no);
end;

procedure TfmWldwStaff.BitBtn14Click(Sender: TObject);
var
  vbegin,vend,SNO:string;
  temp:widestring;
  datas:olevariant;
begin
  inherited;
  vbegin:='';
  vend:='';
  sno:='';
  cdssoft.Close;
  cdssoft.Data:=null;
  cdssoft.IndexName:='';
  cdssoft.IndexDefs.Clear;
  datas:=null;
  temp:=' exec JCGeherTotalAccount ';
  dbgrid1.DataSource:=nil;
  dbgrid3.DataSource:=nil;
  dbgrid2.DataSource:=nil;
  if cbname.Checked then sno:=no;
  if ckbnewdate.Checked then
  begin
    vbegin:=formatdatetime('yyyy-mm-dd',dtpbegin.Date);
    vend:=formatdatetime('yyyy-mm-dd',dtpend.Date);
  end;
  if rb1.Checked then
  begin
    temp:=temp+''''+vbegin+''''+','+''''+vend+''''+','+''''+sno+''''+','+'0';
    dbgrid4.Columns.Items[4].Title.caption:='应付帐款';
    dbgrid4.Columns.Items[5].Title.caption:='已付帐款';
    dbgrid4.Columns.Items[6].Title.caption:='未付帐款';
  end;
  if rb2.Checked then
  begin
    temp:=temp+''''+vbegin+''''+','+''''+vend+''''+','+''''+sno+''''+','+'1';
    dbgrid4.Columns.Items[4].Title.caption:='应收帐款';
    dbgrid4.Columns.Items[5].Title.caption:='已收帐款';
    dbgrid4.Columns.Items[6].Title.caption:='未收帐款';
  end;
  try
    datas:=adisp.GetRecord(temp);
    except
      application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
      screen.Cursor :=  crdefault;
      exit;
    end;
       ////////////////////////////////
    if  not varisnull(datas) then
    begin
    cdssoft.Data:=datas;
    cdssoft.Open;
    datas:=null;
    cdssoft.Last;
    //LocalCount := GetKeyFieldValue('id',cdssoft);   //传入具体字段
    btnpagedown.Enabled:=true;
    with cdssoft.IndexDefs.AddIndexDef do
    begin
      Fields := 'wldw';  //
      Options := [];
    end;
    cdssoft.IndexDefs.Update;
    cdssoft.Open;
    dbgrid4.DataSource:=dsview;
    ////////////////////////
    setdbgrid(dbgrid4,3);
    end;
    screen.Cursor :=  crdefault;
end;

procedure TfmWldwStaff.DBGrid4TitleClick(Column: TColumn);
begin
  inherited;
   if (not dbgrid4.DataSource.DataSet.Active ) then exit;
  if trim(column.Field.AsString)='' then exit;
  sortgrid(column.Field.FieldName,cdssoft,dbgrid4,column);
end;

procedure TfmWldwStaff.DBGrid4DrawDataCell(Sender: TObject;
  const Rect: TRect; Field: TField; State: TGridDrawState);
begin
  inherited;
  setdbgrid(dbgrid4,3);
end;

procedure TfmWldwStaff.DBGrid4DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
  inherited;
  setdbgrid(dbgrid4,3);
end;

procedure TfmWldwStaff.btnprintClick(Sender: TObject);
begin
  inherited;
  if pagec1.ActivePageIndex=0 then
  begin
    printgrid(gridbase);
  end;
  if pagec1.ActivePageIndex=1 then
  begin
    printgrid(gridback);
  end;
end;

procedure TfmWldwStaff.CBinputClick(Sender: TObject);
begin
  inherited;
  ckbDtps(cbinput,dtpinputb,dtpinpute);
end;

procedure TfmWldwStaff.cbcancelClick(Sender: TObject);
begin
  inherited;
  ckbDtps(cbcancel,dtpcancelb,dtpcancele);
end;

procedure TfmWldwStaff.BitBtn12Click(Sender: TObject);
var
  temp:widestring;
  datas:oleVariant;
begin
  inherited;
   if not cdssoft.Active then exit;
    screen.Cursor := crhourglass;
   cdssoft.DisableControls;
  try
  temp:=tempsql+tables+tj+' and id>'+inttostr(LocalCount);
  try
  datas:=adisp.GetRecord(temp);
  except
    application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
    screen.Cursor :=  crdefault;
    exit;
  end;
  if not varisnull(datas) then
  begin
    cdssoft.Close;
    cdssoft.Open;
    cdssoft.AppendData(datas,true);
    cdssoft.Last;
    LocalCount := GetKeyFieldValue('id',cdssoft);   //传入具体字段
     ////////////////////////////////
    with cdssoft.IndexDefs.AddIndexDef do
    begin
      if pagec1.ActivePageIndex in [0,1] then
      begin
        Fields := 'goods_no';  //
      end ;
      if pagec1.ActivePageIndex=3 then
      begin
        Fields := 'supply_NO';  //
      end;
      Options := [];
    end;
    cdssoft.IndexDefs.Update;
    cdssoft.Open;
  //////////////////////////////////////       dmmain.cdsquery.Last;
    //重新打开
      cdssoft.EnableControls;
     setdbgrid(dbgrid1,3);
    end else
    begin
       //不再有数据
        cdssoft.EnableControls;        //ydy  必须要
       btnpagedown.Enabled := false;
       screen.Cursor :=  crdefault;
      exit;
    end;
  except
  end;
  if pagec1.ActivePageIndex =0 then
  begin
    dbgrid1.Visible:=true;
    gridbase.Visible:=false;
  end;
  if pagec1.ActivePageIndex =1 then
  begin
    dbgrid2.Visible:=true;
    gridback.Visible:=false;
  end;
  screen.Cursor :=  crdefault;
end;

end.

⌨️ 快捷键说明

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