untnewshopgoods.pas

来自「适合行业为眼镜业」· PAS 代码 · 共 515 行 · 第 1/2 页

PAS
515
字号
          edtp.Text:=dmmain.CDSquery2.FieldValues['Proposer'];
          edtrs.Text:=dmmain.CDSquery2.FieldValues['resume'];
          edtrm.Text:=dmmain.CDSquery2.FieldValues['Remark'];
          //******************
          for i:=1 to dmmain.CDSquery2.RecordCount  do //wy edit;
          begin
            gridbase.Cells[0,i]:=IntTostr(i); //表示第0列第i行的名称
            gridbase.Cells[1,i]:=trim(dmmain.CDSquery2.FieldByName('Goods_NO').AsString);
            gridbase.Cells[2,i]:=trim(dmmain.CDSquery2.FieldByName('Goods_Name').AsString);
            gridbase.Cells[3,i]:=trim(dmmain.CDSquery2.fieldbyname('Amount').AsString);
            gridbase.Cells[4,i]:=trim(dmmain.CDSquery2.fieldbyname('provider').AsString);
            gridbase.Cells[5,i]:=trim(dmmain.CDSquery2.FieldByName('memo').AsString);
            dmmain.CDSquery2.Next;
          end;
          GetDataPrint(dmmain.cdsprintmaster,dmmain.CDsquery2);
      end else
      begin
          application.MessageBox('此需求单已不存在,请核对后更正!',pchar(application.Title),mb_iconinformation);
      end;
    end;
end;

procedure Tfmshopgoods.SpeedButton1Click(Sender: TObject);
begin
  inherited;
   dlgSQpspart:=tdlgSQpspart.Create(self);
   dlgSQpspart.ShowModal;
   dlgSQpspart.Free;
   if dmmain.CDSdata.IsEmpty  then exit;
   edtsendstock.Text:=trim(dmmain.CDSdata.fieldbyname('storageid').AsString);
   dmmain.CDSdata.Close;
   dmmain.CDSdata.Data:=null;
end;

procedure Tfmshopgoods.SpeedButton5Click(Sender: TObject);
begin
  inherited;
  dlgSQpspart:=tdlgSQpspart.Create(self);
   dlgSQpspart.ShowModal;
   dlgSQpspart.Free;
   if dmmain.CDSdata.IsEmpty  then exit;
   edtrestock.Text:=trim(dmmain.CDSdata.fieldbyname('storageid').AsString);
   dmmain.CDSdata.Close;
   dmmain.CDSdata.Data:=null;
end;

procedure Tfmshopgoods.SpeedButton9Click(Sender: TObject);
begin
  inherited;
  Employe_Check:='';
  Employe_Check:='Storage_Umanage_Fad';
  Employe_Check_Result:='';
  frm_Login_Man:=Tfrm_Login_Man.Create(self);
  frm_Login_Man.Caption:='经手人选择';
  frm_Login_Man.ShowModal;
  Edtp.Text := Employe_Check_Result;
end;

procedure Tfmshopgoods.gridbaseDrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
  var
  s:string;
  r:TRect;
begin
//ydy add 设置显示颜色
 with Sender as Tstringgrid do
        begin
        if gdSelected in State then
        Canvas.Brush.Color:= clTeal;  //clBlue; //clyellow;//clRed;
        Canvas.TextRect(Rect,Rect.Left,Rect.Top,' '+Cells[ACol,ARow]);
        if gdFocused in State then
        Canvas.DrawFocusRect(Rect);
        end;

//不但水平居中,还垂直居中
with Sender as Tstringgrid do
    begin
      Canvas.FillRect(Rect);
      s:=Cells[ACol,ARow];
      r:=Rect;
      DrawText(Canvas.Handle,PChar(s),Length(s),r,DT_CENTER or DT_SINGLELINE or DT_VCENTER);
    end;

end;

procedure Tfmshopgoods.gridbaseSelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  inherited;
  pcol:=acol;
  prow:=arow;
end;

procedure Tfmshopgoods.gridbaseKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if pcol=3 then
  begin
    if key in ['0'..'9',#8,#13,#37] then
    begin
      gridbase.Options:=gridbase.Options+[goediting];
    end else
    begin
      gridbase.Options:=gridbase.Options-[goediting];
      key:=#0;
    end;
  end else
  begin
    gridbase.Options:=gridbase.Options-[goediting];
    key:=#0;
  end;
end;

procedure Tfmshopgoods.SpeedButton2Click(Sender: TObject);
var
  user,temp,remarks,ofid:widestring;
  flag,intof:olevariant;
  totals:double;
  i:integer;
begin
  inherited;
   if Public_Do<>'edited'then exit;
  no:=trim(edit2.Text);
  typed:='新店铺货';
  user:=trim(Handle_No);
  try
  flag:=adisp.receipted(no,typed,user,1,Handle_Part);
  if flag='3' then //
  begin
    flag:=ipubtemp.OutNewShop(no);
  end;
  except
    //
  end;
  if flag='1' then
  begin
    application.MessageBox('审核成功!',pchar(application.Title),mb_iconinformation);
    close;
    exit;
  end;
  if flag='2' then
  begin
    application.MessageBox('无权进行进行审核',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='3' then
  begin
    application.MessageBox('审核完毕!',pchar(application.Title),mb_iconinformation);
    close;
    //exit;
  end;
  if flag='4' then
  begin
    application.MessageBox('反审核完毕!',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='5' then
  begin
    application.MessageBox('反审核成功!',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='6' then
  begin
    application.MessageBox('单据过帐后,不能进行审核或反审核!',pchar(application.Title),mb_iconinformation);
    exit;
  end;
end;

procedure Tfmshopgoods.gridbaseDblClick(Sender: TObject);
var
  i,j:integer;
begin
  inherited;
  if pcol in [1,2] then
  begin
   fmgoodCodeSelStr:= TfmgoodCodeSelStr.Create(self);
   try
   fmgoodcodeselStr.show_mode:='12';
   fmgoodcodeselStr.ShowModal;
   finally
   fmgoodcodeselStr.Free;
   end;
  end;
  if pcol = 3 then  //复制数量
  begin
    j:=gridbase.ColCount-1;
   for i := prow+1 to gridbase.rowcount -1 do
   begin
     gridbase.cells[3,i]:= gridbase.cells[3,prow];
     if trim(gridbase.cells[3,i-1])<>'' then
     begin
       if strtofloat(gridbase.cells[3,i-1])> strtofloat(gridbase.cells[j,i-1]) then
       begin
         application.MessageBox(pchar('库存数量不能满足铺货数量!请检查!'),pchar(application.Title),mb_iconinformation);
         gridbase.SetFocus;
         exit;
       end;
     end;
  end;
  end;
end;

procedure Tfmshopgoods.gridbaseMouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
  var
    i:integer;
begin
  inherited;
  for i:=1 to gridbase.RowCount-1do
  begin
    if (trim(gridbase.cells[3,i])<>'') and (trim(gridbase.cells[6,i])<>'') then
    begin
      if strtofloat(gridbase.cells[3,i])> strtofloat(gridbase.cells[6,i]) then
      begin
        application.MessageBox(pchar('库存数量不能满足铺货数量!请检查!'),pchar(application.Title),mb_iconinformation);
        gridbase.cells[3,i]:='0';
        gridbase.SetFocus;
        exit;
      end;
    end;
  end;
end;

procedure Tfmshopgoods.Cmd_AddClick(Sender: TObject);
begin
  inherited;
  addgridrows(gridbase);
end;

procedure Tfmshopgoods.Cmd_DeleteClick(Sender: TObject);
begin
  inherited;
  deletegridrows(gridbase,prow);
end;

procedure Tfmshopgoods.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  dmmain.CDSquery2.Close;
  dmmain.CDSquery2.Data:=null;
  dmmain.cdsprintmaster.Close;
  dmmain.cdsprintmaster.Data:=null;
end;

procedure Tfmshopgoods.SpeedButton3Click(Sender: TObject);
begin
  inherited;
  if dmmain.cdsprintmaster.IsEmpty then exit;
  fastrepxf:=tfastrepxf.Create(self);
  fastrepxf.filenames:='NewShopGoods.ini';
  fastrepxf.ShowModal;
  fastrepxf.Free;
end;

end.

⌨️ 快捷键说明

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