?? uvadirecipecharge.pas
字號:
unit UVADIRecipeCharge;
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, Mask, RzEdit, UView, UControllerView,
UPagesView, UAdapterDataPagesView, RzLabel, RzDBEdit, RzRadGrp, RzDBRGrp,
DBCtrls, RzDBCmbo, MyTools, UQueryDataModel, UCloneDataModel, UPrimaryDataModel, Factory,
RzTabs, UVADGRMedicine, UVADGRservice, UAdapterDataModel, ppProd,
ppClass, ppReport, ppComm, ppRelatv, ppDB, ppDBPipe, ppBands, ppCache,
ppCtrls, ppPrnabl, ppVar;
type
TVADIRecipeCharge = class(TAdapterDataItemView)
PagesView: TAdapterDataPagesView;
RzPanel6: TRzPanel;
RzBitBtn1: TRzBitBtn;
RzEdit1: TRzEdit;
RzLabel1: TRzLabel;
WedlockID: TDataSource;
PaymentMethodID: TDataSource;
NationID: TDataSource;
NativePlaceID: TDataSource;
ProfessionID: TDataSource;
TollStationID: TDataSource;
RecipeTollCharge: TDataSource;
Doctor: TDataSource;
RzPanel7: TRzPanel;
RzLabel7: TRzLabel;
RzLabel8: TRzLabel;
RzLabel9: TRzLabel;
RzLabel10: TRzLabel;
RzLabel14: TRzLabel;
RzLabel15: TRzLabel;
RzLabel16: TRzLabel;
RzLabel2: TRzLabel;
RzLabel3: TRzLabel;
RzLabel5: TRzLabel;
RzDBEdit2: TRzDBEdit;
RzDBLookupComboBox3: TRzDBLookupComboBox;
RzDBLookupComboBox4: TRzDBLookupComboBox;
RzDBLookupComboBox5: TRzDBLookupComboBox;
RzDBLookupComboBox6: TRzDBLookupComboBox;
RzDBLookupComboBox7: TRzDBLookupComboBox;
RzDBDateTimeEdit3: TRzDBDateTimeEdit;
RzDBLookupComboBox1: TRzDBLookupComboBox;
RzDBRadioGroup1: TRzDBRadioGroup;
RzDBLookupComboBox2: TRzDBLookupComboBox;
Splitter1: TSplitter;
ppDBPipeline1: TppDBPipeline;
ppReport1: TppReport;
RecipeReckoning: TDataSource;
ppHeaderBand1: TppHeaderBand;
ppDetailBand1: TppDetailBand;
ppFooterBand1: TppFooterBand;
ppTitleBand1: TppTitleBand;
ppLabel1: TppLabel;
ppDBText1: TppDBText;
ppLabel2: TppLabel;
ppDBText2: TppDBText;
ppLabel3: TppLabel;
ppDBText3: TppDBText;
ppLabel4: TppLabel;
ppLine1: TppLine;
ppDBCalc1: TppDBCalc;
ppLabel5: TppLabel;
ppLine2: TppLine;
ppLabel6: TppLabel;
ppLine3: TppLine;
ppLabel8: TppLabel;
procedure RzBitBtn1Click(Sender: TObject);
private
RecipeModel: TQueryDataModel;
DoctorModel: TQueryDataModel;
RecipeReckoningModel: TQueryDataModel;
PaymentMethodIDModel: TCloneDataModel;
NationIDModel: TCloneDataModel;
NativePlaceIDModel: TCloneDataModel;
ProfessionIDModel: TCloneDataModel;
WedlockIDModel: TCloneDataModel;
TollStationIDModel: TCloneDataModel;
RMedicineView : TVADGRmedicine;
RServiceView : TVADGRservice;
protected
procedure InitView; override;
procedure InitModel; override;
public
function GetCaption : String; override;
procedure Append(Parameters: IParameters); override;
procedure Save(Parameters: IParameters); override;
procedure Delete(Parameters: IParameters); override;
procedure Cancel(Parameters: IParameters); override;
procedure Print; override;
end;
implementation
uses
UMQDSickByCode, UMADPaymentMethod, UMADWedlock, UMADNation,
UMADNativePlace, UMADProfession, UMADTollStation,
UMADRecipeTollCharge, UMADDoctorToll, UMADEmployee, UAdapterDataView,
Math, UDataView, UMQDRecipeReckoning;
{$R *.dfm}
procedure TVADIRecipeCharge.Append(Parameters: IParameters);
var
ReckoningKey: IIntegerKey;
begin
if (GetDataModel.GetDataSet.IsEmpty) or (not GetDataModel.GetDataSet.Active) then exit;
TAdapterDataView(PagesView.GetActiveView).GetAdapterDataModel.DataSet.Edit;
TAdapterDataView(PagesView.GetActiveView).Append(Parameters);
TAdapterDataView(PagesView.GetActiveView).GetDataModel.GetDataSet.FieldByName('ReckoningID').AsInteger := RecipeModel.GetDataSet.FieldByName('ReckoningID').AsInteger;
end;
procedure TVADIRecipeCharge.Cancel(Parameters: IParameters);
begin
TAdapterDataView(PagesView.GetActiveView).Cancel(Parameters);
end;
procedure TVADIRecipeCharge.Delete(Parameters: IParameters);
begin
TAdapterDataView(PagesView.GetActiveView).Delete(Parameters);
end;
function TVADIRecipeCharge.GetCaption: String;
begin
Result := '門診收費';
end;
procedure TVADIRecipeCharge.InitModel;
begin
inherited;
RecipeModel := TQueryDataModel(RecipeTollChargeFactory.GetModel);
DoctorModel := TQueryDataModel(DoctorTollFactory.GetModel);
RecipeReckoningModel := TQueryDataModel(QRecipeReckoningFactory.GetModel);
RecipeTollCharge.DataSet := RecipeModel.GetDataSet;
Doctor.DataSet := DoctorModel.GetDataSet;
RecipeReckoning.DataSet := RecipeReckoningModel.GetDataSet;
PaymentMethodIDModel := GetCloneDataModel(TPrimaryDataModel(PaymentMethodFactory.GetModel));
PaymentMethodID.DataSet := PaymentMethodIDModel.GetDataSet;
NationIDModel := GetCloneDataModel(TPrimaryDataModel(NationFactory.GetModel));
NationID.DataSet := NationIDModel.GetDataSet;
NativePlaceIDModel := GetCloneDataModel(TPrimaryDataModel(NativePlaceFactory.GetModel));
NativePlaceID.DataSet := NativePlaceIDModel.GetDataSet;
ProfessionIDModel := GetCloneDataModel(TPrimaryDataModel(ProfessionFactory.GetModel));
ProfessionID.DataSet := ProfessionIDModel.GetDataSet;
WedlockIDModel := GetCloneDataModel(TPrimaryDataModel(WedlockFactory.GetModel));
WedlockID.DataSet := WedlockIDModel.GetDataSet;
TollStationIDModel := GetCloneDataModel(TPrimaryDataModel(TollStationFactory.GetModel));
TollStationID.DataSet := TollStationIDModel.GetDataSet;
end;
procedure TVADIRecipeCharge.InitView;
var
Page: TRzTabSheet;
Key: IKey;
begin
inherited;
Page := PagesView.NewPage;
RMedicineView := TVADGRmedicine.Create(Page, RmedicineFactory);
PagesView.BandView(Page,RMedicineView);
Page := PagesView.NewPage;
RServiceView := TVADGRService.Create(Page, RServiceFactory);
PagesView.BandView(Page,RServiceView);
end;
procedure TVADIRecipeCharge.Print;
begin
if GetDataModel.GetDataSet.Active and (not GetDataModel.GetDataSet.IsEmpty) then
begin
ppLabel8.Caption := '姓名:'+GetDataModel.GetDataSet.FieldByName('CNAME').AsString+' 門診號:'+GetDataModel.GetDataSet.FieldByName('CODE').AsString;
ppLabel5.Caption := '工作單位:'+GetDataModel.GetDataSet.FieldByName('DEPARTMENT').AsString;
ppReport1.PrintToDevices;
ppReport1.Print;
end;
end;
procedure TVADIRecipeCharge.RzBitBtn1Click(Sender: TObject);
var
SKey: IStringKey;
IntKey: IIntegerKey;
ReckoningKey: IIntegerKey;
begin
inherited;
RzEdit1.Text := UpperCase(Trim(RzEdit1.Text));
if RzEdit1.Text = '' then Exit;
SKey := TStringKey.Create;
SKey.SetKey(RzEdit1.Text);
TQueryDataModel(GetDataModel).Query(IParameters(SKey));
If GetDataModel.GetDataSet.IsEmpty then Exit;
RecipeModel.Query(GetDataModel.GetKey);
IntKey := TIntegerKey.Create;
IntKey.SetKey(GetDataModel.GetDataSet.FieldByName('TOLLSTATIONID').AsInteger);
DoctorModel.Query(IQueryParameters(IntKey));
ReckoningKey := TIntegerKey.Create;
ReckoningKey.SetKey(RecipeModel.GetDataSet.FieldByName('ReckoningID').AsInteger);
TQueryDataModel(RServiceView.GetDataModel).Query(ReckoningKey);
TQueryDataModel(RMedicineView.GetDataModel).Query(ReckoningKey);
RecipeReckoningModel.Query(ReckoningKey);
end;
procedure TVADIRecipeCharge.Save(Parameters: IParameters);
begin
If (not GetDataModel.GetDataSet.Active) and GetDataModel.GetDataSet.IsEmpty then Exit;
if RzDBLookupComboBox2.Text = '' then
ShowMessage('請?zhí)钐幏结t(yī)生')
else
begin
RecipeModel.Save(Parameters);
TAdapterDataView(PagesView.GetActiveView).Save(Parameters);
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -