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

📄 ustock_cancel.pas

📁 适合行业为眼镜业
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      dmmain.CDSexecsql.FieldByName('proposer').AsString:=Trim(Edit8.Text);
      dmmain.CDSexecsql.FieldByName('Condense').AsString:=Trim(Edit9.Text);
      dmmain.CDSexecsql.FieldByName('Remark').AsString:=Trim(Edit10.Text);
      dmmain.CDSexecsql.Post;
          //dmmain.CDSexecsql.Next;
      try
        dmmain.CDSexecsql.ApplyUpdates(-1);
      except
        Application.MessageBox('服务器发生故障!',Pchar(Application.Title),Mb_ICONwarning);
        Exit;
      end;
      sqlsub:='select * from [Cancel_strip_detail] where Stock_No='+''''+Trim(List_NO)+'''';
      dmmain.CDSexecsql.Close;
      dmmain.CDSexecsql.Data:=adisp.execSql(sqlsub);
      dmmain.CDSexecsql.Open;
      for i:=1 to stringgrid1.RowCount-1 do
      begin
        dmmain.CDSexecsql.edit;
        dmmain.CDSexecsql.FieldByName('Goods_NO').AsString:=Trim(StringGrid1.Cells[1,i]);
        dmmain.CDSexecsql.FieldByName('amount').AsString:= Trim(StringGrid1.Cells[3,i]);
        dmmain.CDSexecsql.FieldByName('Pass_NO').AsString:= Trim(StringGrid1.Cells[4,i]);
        dmmain.CDSexecsql.FieldByName('quality').AsString:=Trim(StringGrid1.Cells[2,i]);
        dmmain.CDSexecsql.FieldByName('Fade_Name').AsString:=Trim(StringGrid1.Cells[5,i]);
        dmmain.CDSexecsql.Post;
        dmmain.CDSexecsql.Next;
      end;
      try
        dmmain.CDSexecsql.ApplyUpdates(-1);
      except
        Application.MessageBox('服务器发生故障!',Pchar(Application.Title),Mb_ICONwarning);
        Exit;
      end;
    end;
  end ;
  if Public_Do_Result='03' then
  begin
    close;
  end;
end;
////////////////////////////
procedure TFmCancel.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;
  Edit4.Text:=check_Mond_Result;
  frm_Supply_Monad.Free;
end;

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

procedure TFmCancel.FormShow(Sender: TObject);
begin
  inherited;
  init;
  readdata;
end;

procedure TFmCancel.Cmd_DeleteClick(Sender: TObject);
begin
  inherited;
  deletegridrows(stringgrid1,prow);
end;

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

procedure TFmCancel.SpeedButton4Click(Sender: TObject);
begin
  inherited;
  if not checkDATA THEN EXIT;
  frm_Public_Don:=Tfrm_Public_Don.Create(self);
  frm_Public_Don.no:=trim(edit2.Text);
  frm_Public_Don.ShowModal;
  frm_Public_Don.FREE;
  SAVEDATA;
end;

procedure TFmCancel.SpeedButton2Click(Sender: TObject);
var
  user,wldwname,remarks:widestring;
  flag,intof:olevariant;
  i:integer;
  totals:double;
begin
  inherited;
  if trim(Public_Do)<>'Edited' then exit;
  no:=trim(edit2.Text);
  typed:=' 库存退货单';
  user:=trim(Handle_No);
  flag:=adisp.receipted(no,typed,user,1,Handle_Part);
  if flag='3' then
  begin
    if adisp.CancelGoods(trim(edit5.Text),no) then   ///////减少实际的库存数量!!
    begin
      flag:='3';
    end else
    begin
      flag:='2';
    end;
  end;
  if flag='1' then
  begin
    application.MessageBox('审核成功!',pchar(application.Title),mb_iconinformation);
    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);
    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 TFmCancel.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  inherited;
  PCOL:=ACOL;
  PROW:=AROW;
end;

procedure TFmCancel.StringGrid1KeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  IF ((PCOL=3) OR (PCOL=5)) AND (PROW>0) THEN
  BEGIN
    IF (Pcol=3)  then
    begin
      if key in ['0'..'9',#8,#13,'.'] then
      begin
        stringgrid1.Options:=stringgrid1.Options+[goediting];
      end else
      begin
        key:=#0;
      end;
    end else
    begin
      stringgrid1.Options:=stringgrid1.Options+[goediting];
    end;
  END ELSE
  BEGIN
    stringgrid1.Options:=stringgrid1.Options-[goediting];
    KEY:=#0;
  END;
end;

procedure TFmCancel.StringGrid1MouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
  var
    i:integer;
begin
  inherited;
  for i:=1 to stringgrid1.RowCount-1 do
  begin
    if (trim(stringgrid1.Cells[3,i])<>'') and (trim(stringgrid1.Cells[6,i])<>'') then
    begin
      if strtoint(trim(stringgrid1.Cells[3,i]))>strtoint(trim(stringgrid1.Cells[6,i])) then
      begin
        application.MessageBox('退货数量不得多于库存数量!',pchar(application.Title)mb_iconinformation);
        stringgrid1.Cells[3,i]:='0';
        exit;
      end;
    end;
  end;
end;

procedure TFmCancel.StringGrid1DrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
var
  s:string;
  r:TRect;
begin
   inherited;
  with Sender as Tstringgrid do
  begin
  if gdSelected in State then
  Canvas.Brush.Color:= clTeal; //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 TFmCancel.StringGrid1DblClick(Sender: TObject);
var
  i:integer;
begin
  inherited;
  if pcol in [1,2] then
  begin
   fmgoodCodeSelStr:= TfmgoodCodeSelStr.Create(self);
   try
   fmgoodcodeselStr.show_mode:='14';
   fmgoodcodeselStr.ShowModal;
   finally
   fmgoodcodeselStr.Free;
   end;
  end;
  if pcol = 3 then  //复制数量
  begin
   for i := prow+1 to STRINGGRID1.rowcount -1 do
   begin
   STRINGGRID1.cells[3,i]:= STRINGGRID1.cells[3,prow];
   end;
  end;

end;

procedure TFmCancel.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  dmmain.CDSexecsql.Close;
  dmmain.CDSexecsql.Data:=null;
  dmmain.cdsCancel_strip.Close;
  dmmain.cdsCancel_strip.Data:=null;
  dmmain.cdsCanceldetail.Close;
  dmmain.cdsCanceldetail.Data:=null;
  inherited;

end;

end.

⌨️ 快捷键说明

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