uvadimedicine.pas

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

PAS
116
字号
unit UVADIMedicine;

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, DBCtrls, RzDBCmbo, StdCtrls, Mask, RzEdit, RzDBEdit,
  RzLabel, UCloneDataModel;

type
  TVADIMedicine = class(TAdapterDataItemView)
    DoseID: TDataSource;
    MedicineCatalogID: TDataSource;
    UnitsID: TDataSource;
    RzLabel1: TRzLabel;
    RzLabel2: TRzLabel;
    RzLabel3: TRzLabel;
    RzLabel4: TRzLabel;
    RzLabel5: TRzLabel;
    RzLabel6: TRzLabel;
    RzLabel7: TRzLabel;
    RzLabel8: TRzLabel;
    RzLabel9: TRzLabel;
    RzDBEdit1: TRzDBEdit;
    RzDBEdit2: TRzDBEdit;
    RzDBEdit3: TRzDBEdit;
    RzDBEdit4: TRzDBEdit;
    RzDBEdit5: TRzDBEdit;
    RzDBEdit6: TRzDBEdit;
    RzDBLookupComboBox1: TRzDBLookupComboBox;
    RzDBLookupComboBox2: TRzDBLookupComboBox;
    RzDBLookupComboBox3: TRzDBLookupComboBox;
    RzLabel10: TRzLabel;
    RzLabel11: TRzLabel;
    RzLabel12: TRzLabel;
    RzDBEdit7: TRzDBEdit;
    RzDBEdit8: TRzDBEdit;
    USEMETHODID: TDataSource;
    RzLabel13: TRzLabel;
    RzDBEdit9: TRzDBEdit;
    RzDBLookupComboBox4: TRzDBLookupComboBox;
    RzButton1: TRzButton;
    RzDBLookupComboBox5: TRzDBLookupComboBox;
    RzLabel14: TRzLabel;
    RzLabel15: TRzLabel;
    RzDBNumericEdit1: TRzDBNumericEdit;
    MinUnitsID: TDataSource;
    procedure RzButton1Click(Sender: TObject);
  private
    UnitsIDModel: TCloneDataModel;
    DoseIDModel: TCloneDataModel;
    MedicineCatalogIDModel: TCloneDataModel;
    USEMETHODIDModel: TCloneDataModel;
    MinUnitsIDModel: TCloneDataModel;
  protected
    procedure InitModel; override;
  public
    function GetCaption: string; override;
  end;
implementation

uses MyTools, UMADMedicine, UView, UPrimaryDataModel, Factory, UDialogDataItemsView, UVADGMedicineCatalog, UDataItemsView,
  UMADUnits;

{$R *.dfm}

{ TVADIMedicine }

function TVADIMedicine.GetCaption: string;
begin
  Result := '药品详细信息';
end;

procedure TVADIMedicine.InitModel;
begin
  inherited;
  DoseIDModel:= TCloneDataModel.Create(Self);
  TPrimaryDataModel(DoseFactory.GetModel).Clone(DoseIDModel);
  DoseID.DataSet :=DoseIDModel.GetDataSet;

  MedicineCatalogIDModel := TCloneDataModel.Create(Self);
  TPrimaryDataModel(MedicineCatalogFactory.GetModel).Clone(MedicineCatalogIDModel);
  MedicineCatalogID.DataSet := MedicineCatalogIDModel.GetDataSet;

  UnitsIDModel := TCloneDataModel.Create(Self);
  TPrimaryDataModel(UnitsFactory.GetModel).Clone(UnitsIDModel);
  UnitsID.DataSet := UnitsIDModel.GetDataSet;

  USEMETHODIDModel := TCloneDataModel.Create(Self);
  TPrimaryDataModel(USEMETHODFactory.GetModel).Clone(USEMETHODIDModel);
  USEMETHODID.DataSet := USEMETHODIDModel.GetDataSet;

  MinUnitsIDModel := TCloneDataModel.Create(Self);
  TPrimaryDataModel(UnitsFactory.GetModel).Clone(MinUnitsIDModel);
  MinUnitsID.DataSet := MinUnitsIDModel.GetDataSet;  
end;

procedure TVADIMedicine.RzButton1Click(Sender: TObject);
var
  Dialog: TDialogDataItemsView;
begin
  GetDataModel.GetDataSet.Edit;
  try
    Dialog := TDialogDataItemsView.Create(Self, TDataItemsView(TVADGMedicineCatalog.Create(Self, MedicineCatalogFactory)));
    if Dialog.ShowModal = mrOk then
      GetDataModel.GetDataSet.FieldByName('MedicineCatalogID').AsInteger := IIntegerKey(Dialog.GetKey).GetKey;
  finally
    Dialog.Free;
  end;
end;

end.

⌨️ 快捷键说明

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