uvadipomedicinedetail.pas

来自「一整套的源代码」· PAS 代码 · 共 118 行

PAS
118
字号
unit UVADIPOMedicineDetail;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UAdapterDataItemView, dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg,
  dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns,
  dxPSEdgePatterns, DB, dxPSCore, RzCommon, RzButton, jpeg, RzBckgnd,
  ExtCtrls, RzPanel, StdCtrls, RzLabel, DBCtrls, RzDBCmbo, RzRadChk,
  RzDBChk, Mask, RzEdit, RzDBEdit, UCloneDataModel, UPrimaryDataModel, Factory,
  UDialogDataItemsView, UDataItemsView, MyTools;

type
  TVADIPOMedicineDetail = class(TAdapterDataItemView)
    PURChaseOrder: TDataSource;
    Medicine: TDataSource;
    RzLabel1: TRzLabel;
    RzLabel2: TRzLabel;
    RzLabel3: TRzLabel;
    RzLabel5: TRzLabel;
    RzLabel6: TRzLabel;
    RzLabel8: TRzLabel;
    RzDBEdit1: TRzDBEdit;
    RzDBEdit2: TRzDBEdit;
    RzDBEdit3: TRzDBEdit;
    RzDBEdit4: TRzDBEdit;
    RzDBEdit5: TRzDBEdit;
    RzDBLookupComboBox2: TRzDBLookupComboBox;
    Provider: TDataSource;
    RzDBLookupComboBox3: TRzDBLookupComboBox;
    RzLabel7: TRzLabel;
    RzBitBtn1: TRzBitBtn;
    RzBitBtn2: TRzBitBtn;
    RzPanel5: TRzPanel;
    RzLabel9: TRzLabel;
    RzLabel10: TRzLabel;
    RzLabel11: TRzLabel;
    RzLabel12: TRzLabel;
    RzLabel13: TRzLabel;
    RzLabel14: TRzLabel;
    RzDBLookupComboBox1: TRzDBLookupComboBox;
    RzDBLookupComboBox4: TRzDBLookupComboBox;
    RzDBLookupComboBox5: TRzDBLookupComboBox;
    RzDBLookupComboBox6: TRzDBLookupComboBox;
    RzDBLookupComboBox7: TRzDBLookupComboBox;
    RzDBLookupComboBox8: TRzDBLookupComboBox;
    RzLabel4: TRzLabel;
    RzDBEdit6: TRzDBEdit;
    procedure RzBitBtn1Click(Sender: TObject);
    procedure RzBitBtn2Click(Sender: TObject);
  private
    MedicineModel: TCloneDataModel;
    PURChaseOrderModel: TCloneDataModel;
    ProviderModel: TCloneDataModel;
  protected
    procedure InitModel; override;
  public
    function GetCaption: string; override;
  end;

implementation

uses UMADPOMedicineDetail, UMADMedicine, UMADPURChaseOrder, UMADProvider,
  UVMADGMedicine, UVADGProvider;

{$R *.dfm}

{ TVADIPOMedicineDetail }

function TVADIPOMedicineDetail.GetCaption: string;
begin
  Result := '医药采购明细';
end;

procedure TVADIPOMedicineDetail.InitModel;
begin
  inherited;
  MedicineModel := TCloneDataModel.Create(Self);
  TPrimaryDataModel(MedicineFactory.GetModel).Clone(MedicineModel);
  Medicine.DataSet := MedicineModel.GetDataSet;

  PURChaseOrderModel := TCloneDataModel.Create(Self);
  TPrimaryDataModel(PURChaseOrderFactory.GetModel).Clone(PURChaseOrderModel);
  PURChaseOrder.DataSet := PURChaseOrderModel.GetDataSet;

  ProviderModel := TCloneDataModel.Create(Self);
  TPrimaryDataModel(ProviderFactory.GetModel).Clone(ProviderModel);
  Provider.DataSet := ProviderModel.GetDataSet;
end;

procedure TVADIPOMedicineDetail.RzBitBtn1Click(Sender: TObject);
var
  Dialog: TDialogDataItemsView;
begin
  GetDataModel.GetDataSet.Edit;
  Dialog := TDialogDataItemsView.Create(Self, TDataItemsView(TVMADGMedicine.Create(Self, MedicineFactory)));
  if Dialog.ShowModal = mrOK then
    GetDataModel.GetDataSet.FieldByName('MedicineID').ASInteger := IIntegerKey(Dialog.GetKey).GetKey;
  Dialog.Free;
end;

procedure TVADIPOMedicineDetail.RzBitBtn2Click(Sender: TObject);
var
  Dialog: TDialogDataItemsView;
begin
  try
    GetDataModel.GetDataSet.Edit;
    Dialog := TDialogDataItemsView.Create(Self, TDataItemsView(TVADGProvider.Create(Self, ProviderFactory)));
    if Dialog.ShowModal = mrOK then
      GetDataModel.GetDataSet.FieldByName('ProviderID').ASInteger := IIntegerKey(Dialog.GetKey).GetKey;
  finally
    Dialog.Free;
  end;
end;

end.

⌨️ 快捷键说明

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