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

📄 pur510_01.pas.svn-base

📁 开源的网站整站程序,功能强大带采集系统.
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
begin
  inherited;
//查询
  if (edtFromDate.Text='') or (edtToDate.Text='') then
  begin
    ShowMsg('UMS10000319');  //起止日期不可为空
    if edtFromDate.Text='' then edtFromDate.SetFocus else edtToDate.SetFocus;
    Abort;
  end;
  if edtFromDate.Date>edtToDate.Date then
  begin
    ShowMsg('UMS10000320');  //结束日期不能小于起始日期
    edtToDate.SetFocus;
    Abort;
  end;

  Screen.Cursor:=crHourGlass;
  ADOQuery1.DisableControls;
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('select A.*,');
  ADOQuery1.SQL.Add('    B.P100_002,');
  ADOQuery1.SQL.Add('    C.O150_002,C.O150_003,C.O150_005,C.O150_006,C.O150_012,');
  ADOQuery1.SQL.Add('    D.G100_002,D.G100_003,');
  ADOQuery1.SQL.Add('    E.G110_002');
  ADOQuery1.SQL.Add('from PUR510A A,PUR100 B,ORD150 C,GLD100 D,GLD110 E');
  ADOQuery1.SQL.Add('where A.P510A_002=B.P100_001 and A.P510A_017=C.O150_001 and A.P510A_007=D.G100_001 and A.P510A_009=E.G110_001');
  ADOQuery1.SQL.Add('order by A.P510A_001');
  ADOQuery1.Open;
  ARecordCount:=GetDataSetCount(ADOQuery1);
  ADOQuery1.EnableControls;
  Screen.Cursor:=crDefault;
end;

procedure TPur510_01Form.dxDBGrid1CustomDrawCell(Sender: TObject;
  ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
  AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean;
  var AText: String; var AColor: TColor; AFont: TFont;
  var AAlignment: TAlignment; var ADone: Boolean);
begin
  inherited;
  if ANode.HasChildren then Exit;
end;

procedure TPur510_01Form.ReportGetValue(const ParName: String; var ParValue: Variant);
begin
  inherited;
  if ParName='ADate' then ParValue:=lblDate.Caption  //日期
  else if ParName='AFromDate' then ParValue:=edtFromDate.Text  //
  else if ParName='AToDate' then ParValue:=edtToDate.Text  //
end;

procedure TPur510_01Form.BrowseEvent;
begin
  inherited;
  Pur510_02Form:=TPur510_02Form.Create(Application);
  Pur510_02Form.OpenData(ADOQuery1P510A_001.AsString);
  Pur510_02Form.ShowModal;
end;

procedure TPur510_01Form.DeleteEvent;
var
  ACode:String;
begin
  inherited;
  //0=新建,1=核准,2=执行,3=收货,4=完成,5=取消
  if ADOQuery1.FieldByName('P510A_004').AsInteger<>0 then
  begin
    ShowMsg('UMS10000551');  //不允许删除非新建状态的采购定单
    Abort;
  end;
  ACode:=ADOQuery1.FieldByName('P510A_001').AsString;
  SYSDM.qryQuery.Close;
  SYSDM.qryQuery.SQL.Clear;
  SYSDM.qryQuery.SQL.Add('delete from PUR510B where P510B_001='+''''+ACode+'''');
  SYSDM.qryQuery.ExecSQL;
  DeleteTableRecord(ADOQuery1,'PUR510A','P510A_001='+''''+ACode+'''');
end;

procedure TPur510_01Form.InsertEvent;
begin
  inherited;
//新增
  Pur510_02Form:=TPur510_02Form.Create(Application);
  Pur510_02Form.OpenData('');
  Pur510_02Form.ActInsert.Execute;
  Pur510_02Form.ShowModal;
end;

procedure TPur510_01Form.UpdateEvent;
begin
  inherited;
//修改
  //0=新建,1=核准,2=执行,3=收货,4=完成,5=取消
  if ADOQuery1.FieldByName('P510A_004').AsInteger<>0 then
  begin
    ShowMsg('UMS10000532');  //不允许修改非新建状态的销售定单
    Abort;
  end;
  Pur510_02Form:=TPur510_02Form.Create(Application);
  Pur510_02Form.OpenData(ADOQuery1P510A_001.AsString);
  Pur510_02Form.ActUpdate.Execute;
  Pur510_02Form.ShowModal;
end;

procedure TPur510_01Form.ADOQuery1P510A_004GetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
  inherited;
  if ADOQuery1.IsEmpty then Exit;
  Text:=AStatus[Sender.AsInteger];
end;

procedure TPur510_01Form.ADOQuery1P510A_006GetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
  inherited;
  if ADOQuery1.IsEmpty then Exit;
  Text:=AFrom[Sender.AsInteger];
end;

procedure TPur510_01Form.ADOQuery1P510A_019GetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
  inherited;
  if ADOQuery1.IsEmpty then Exit;
  Text:=APick[Sender.AsInteger];
end;

procedure TPur510_01Form.dxDBGrid1P510A_001DrawSummaryFooter(
  Sender: TObject; ACanvas: TCanvas; ARect: TRect; var AText: String;
  var AAlignment: TAlignment; AFont: TFont; var AColor: TColor;
  var ADone: Boolean);
begin
  inherited;
  AColor:=clWhite;
  AText:=GetDBString('COM00004002')+IntToStr(ARecordCount);  //记录总数:
end;

procedure TPur510_01Form.Action1Execute(Sender: TObject);
begin
  inherited;
//核准
  //0=新建,1=核准,2=执行,3=收货,4=完成,5=取消
  if ADOQuery1.IsEmpty then
  begin
    ShowMsg('UMS10000002');  //表记录为空,操作无效
    Abort;
  end;
  if ADOQuery1P510A_004.Value<>0 then
  begin
    ShowMsg('UMS10000557');  //仅新建状态的采购定单可以核准
    Abort;
  end;
  ADOQuery1.Edit;
  ADOQuery1P510A_004.Value:=1;
  ADOQuery1.Post;
  ActRefresh.Execute;
  ShowMsg('UMS10000558');  //采购定单已成功设置为核准状态
end;

procedure TPur510_01Form.Action2Execute(Sender: TObject);
begin
  inherited;
//执行
  //0=新建,1=核准,2=执行,3=收货,4=完成,5=取消
  if ADOQuery1.IsEmpty then
  begin
    ShowMsg('UMS10000002');  //表记录为空,操作无效
    Abort;
  end;
  if ADOQuery1P510A_004.Value<>0 then
  begin
    ShowMsg('UMS10000559');  //仅核准状态的采购定单可以执行
    Abort;
  end;
  ADOQuery1.Edit;
  ADOQuery1P510A_004.Value:=2;
  ADOQuery1.Post;
  ActRefresh.Execute;
  ShowMsg('UMS10000560');  //采购定单已成功设置为执行状态
end;

procedure TPur510_01Form.Action3Execute(Sender: TObject);
begin
  inherited;
//取消
  //0=新建,1=核准,2=执行,3=收货,4=完成,5=取消
  if ADOQuery1.IsEmpty then
  begin
    ShowMsg('UMS10000002');  //表记录为空,操作无效
    Abort;
  end;
  if not (ADOQuery1P510A_004.Value in [2,3]) then
  begin
    ShowMsg('UMS10000561');  //仅执行和收货状态的采购定单可以取消
    Abort;
  end;
  ADOQuery1.Edit;
  ADOQuery1P510A_004.Value:=2;
  ADOQuery1.Post;
  ActRefresh.Execute;
  ShowMsg('UMS10000562');  //采购定单已成功设置为取消状态
end;

initialization
  RegisterClass(TPur510_01Form);

finalization
  UnRegisterClass(TPur510_01Form);

end.

⌨️ 快捷键说明

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