/HRManager/__history/APPOINTMENTEDITUnit.pas.~22~
Unknown | 266 lines | 240 code | 26 blank | 0 comment | 0 complexity | f07946904076012ab4c02c39cf97d316 MD5 | raw file
1unit APPOINTMENTEDITUnit; 2 3interface 4 5uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, EditDialogUnit, StdCtrls, ExtCtrls, PKDBDictEdit, PKDBTable, ComCtrls, 8 PKDBEdit, PKDBBBaseComboBox,dictunit, DB, uADStanIntf, uADStanOption, 9 uADStanParam, uADStanError, uADDatSManager, uADPhysIntf, uADDAptIntf, 10 uADStanAsync, uADDAptManager, uADCompClient, uADCompDataSet, reportunit; 11 12type 13 TAPPOINTMENTEDIT = class(TEditDialog) 14 PKDBDictEdit2: TPKDBDictEdit; 15 Label2: TLabel; 16 PKDBLabelEdit3: TPKDBLabelEdit; 17 PKDBLabelEdit4: TPKDBLabelEdit; 18 PKDBLabelEdit5: TPKDBLabelEdit; 19 PKDBDictEdit3: TPKDBDictEdit; 20 ADStoredProc2: TADStoredProc; 21 PKDBDictLabelEdit1: TPKDBDictLabelEdit; 22 ADQuery1: TADQuery; 23 PKDBTable2: TPKDBTable; 24 PKDBDictEdit1: TPKDBDictEdit; 25 ADQuery1ID: TFMTBCDField; 26 Label1: TLabel; 27 PKDBDictEdit4: TPKDBDictEdit; 28 PKDBDictEdit5: TPKDBDictEdit; 29 PKDBDictEdit6: TPKDBDictEdit; 30 ADQuery1WORKCONTRACTID: TFMTBCDField; 31 PKDBTable3: TPKDBTable; 32 GroupBox1: TGroupBox; 33 PKDBLabelEdit2: TPKDBLabelEdit; 34 PKDBLabelEdit1: TPKDBLabelEdit; 35 PKDBLabelEdit6: TPKDBLabelEdit; 36 CheckBox1: TCheckBox; 37 PKDBDictEdit7: TPKDBDictEdit; 38 PKDBDictEdit8: TPKDBDictEdit; 39 PKDBDictEdit9: TPKDBDictEdit; 40 PKDBLabelEdit7: TPKDBLabelEdit; 41 PKDBLabelEdit8: TPKDBLabelEdit; 42 PKDBLabelEdit9: TPKDBLabelEdit; 43 CheckBox2: TCheckBox; 44 PKDBTable4: TPKDBTable; 45 GroupBox2: TGroupBox; 46 PKDBLabelEdit10: TPKDBLabelEdit; 47 PKDBLabelEdit11: TPKDBLabelEdit; 48 PKDBDictEdit10: TPKDBDictEdit; 49 PKDBDictEdit11: TPKDBDictEdit; 50 PKDBDictEdit12: TPKDBDictEdit; 51 procedure PKDBDictEdit1BeforeOpenButtonClick(Sender: TObject; 52 Form: TDictForm); 53 procedure Button1Click(Sender: TObject); 54 procedure FormShow(Sender: TObject); 55 procedure open; override; 56 procedure runcommand; override; 57 function finderrors:boolean; override; 58 private 59 { Private declarations } 60 public 61 { Public declarations } 62 end; 63 64var 65 APPOINTMENTEDIT : TAPPOINTMENTEDIT ; 66 Cform : TWREPORT; 67 68implementation 69 uses DM, EMPLOYEEUnit; 70 71{$R *.dfm} 72 73 74procedure TAPPOINTMENTEDIT.Button1Click(Sender: TObject); 75begin 76 inherited; 77// ????????(???? ??????? < ???? ??????????) 78if (PKDBLabelEdit5.text<>'') and (strtodate(PKDBLabelEdit4.text) > strtodate(PKDBLabelEdit5.text)) then 79 begin 80 showmessage('???? ??????? ?? ????????? ?????? ???? ?????? ???? ?????(???????? ???????? ??? ????? ?????????).'); 81 exit; 82 end 83 else 84 begin 85 ADStoredProc2.Params[0].Value:= PKDBTable2.Fields.PrimaryKey.FieldVal; // ????????? 86 ADStoredProc2.Params[1].Value:= strtodate(PKDBLabelEdit4.Text); // ???? ??????/?????????? 87 ADStoredProc2.ExecProc; 88 end; 89end; 90 91procedure TAPPOINTMENTEDIT.FormShow(Sender: TObject); 92begin 93 inherited; // ???????? ???????? ?????????? ?????????? 94 PKDBDictLabelEdit1.SetValue(PKDBTable1.Fields.ParentKey.FieldVal); 95 96 // ????? ?????? ?????????. 97 // ???? ? ????. ?????? 2? ???????? (??????) 98 ADQuery1.Params[0].Value:=PKDBTable1.Fields.ParentKey.FieldVal; 99 ADQuery1.Open; 100 101 // ???????? ?????? ?????????? ?????? ??????? 102 PKDBDictEdit6.DictionaryValue:= ADQuery1WORKCONTRACTID.asstring; 103 104 if (ADQuery1.RecordCount>1) then 105 begin 106 showmessage('? ?????????? ?????? 1 ??????????? ????? ??????. ??????? ?????? ??????.'); 107 // exit; 108 end 109 else 110 begin 111 // ???????? ???????? ?????? ????????? ?? ????????? 112 PKDBTable2.Fields.PrimaryKey.FieldVal:= ADQuery1ID.asstring; 113 PKDBTable2.ReadFromDB(PKDBTable2.Fields.PrimaryKey.FieldVal); 114 // ?????? ? ????? ?????? ???????? ? id ?????? ????????? 115 // 25.05 ???? ???????? ?????? ??? ?????? ???????? 116 // PKDBDictEdit4.DictionaryValue:= ADQuery1ID.asstring; 117 118 PKDBDictEdit5.DictionaryValue:= '''???????'''; 119 // ????????? ?????????? ? ?????? 120 PKDBTable4.Fields.ParentKey.FieldVal:= ADQuery1ID.asstring;; 121 end; 122 ADQuery1.Close; 123end; 124 125procedure TAPPOINTMENTEDIT.PKDBDictEdit1BeforeOpenButtonClick(Sender: TObject; 126 Form: TDictForm); 127begin 128 inherited; 129 // ?? ???? ????? ????? ??????? ?????? ?????????? ?? ?????? ?????? 130 PKDBDictEdit3.DictionaryValue:= '3009016'; 131end; 132 133procedure TAPPOINTMENTEDIT.Open; 134begin 135 136 case CommandType of 137 tcInsert: 138 begin 139 Caption := Caption + ': ??????????'; 140 if PKDBTable1.NeedGenPrimaryKey then PKDBTable1.GetTempPrimarykey; 141 if PKDBTable3.NeedGenPrimaryKey then PKDBTable3.GetTempPrimarykey; 142 if PKDBTable4.NeedGenPrimaryKey then PKDBTable4.GetTempPrimarykey; 143 144 // ??????????? ?????????? ? ?????????? 145 PKDBTable3.Fields.ParentKey.FieldVal:= PKDBTable1.Fields.PrimaryKey.FieldVal; 146 // ??????????? ?????? ?????????? ? ??????? 147 PKDBDictEdit12.DictionaryValue:= PKDBTable1.Fields.PrimaryKey.FieldVal; 148 // ??????????? ?????????? ? ??????? 149 PKDBDictEdit11.DictionaryValue:= PKDBTable3.Fields.PrimaryKey.FieldVal; 150 151 end; 152 tcUpdate: 153 Begin 154 Caption := Caption + ': ?????????'; 155 self.Button1.Enabled:=false; 156 // ?????????????? ????? ??????????,?? ??????????? ??????? 157 End; 158 tcCopy: 159 Begin 160 Caption := Caption + ': ???????????'; 161 self.Button1.Enabled:=false; 162 // ??????????? ????? ??????????,?? ??????????? ??????? 163 End; 164 tcView: 165 Begin 166 Caption := Caption + ': ????????'; 167 self.Button1.Enabled:=false; 168 end; 169 end; 170 if CommandType <> tcInsert then 171 begin 172 // ???????? ??????????? ?????????? ? ?? 173 PKDBTable1.ReadFromDB(PrimaryKey); 174 end; 175 if PKDBTable1.Fields.ParentKey <> nil then 176 begin 177 PKDBTable1.Fields.ParentKey.FieldVal := ParentKey; 178 end; 179 if CommandType = tcView then 180 Begin 181 Button1.Enabled := false; 182 End; 183end; 184 185procedure TAPPOINTMENTEDIT.RunCommand; 186begin 187 188 case CommandType of 189 tcInsert: 190 begin 191 PrimaryKey := PKDBTable1.Insert; 192 PKDBTable3.Insert; 193 PKDBTable4.Insert; 194 end; 195 tcCopy: 196 begin 197 // ??????????? ?? ?????????????? ? ?????? ????????? 198 end; 199 tcUpdate: 200 begin 201 // ?????????????? ?? ?????????????? ? ?????? ????????? 202 end; 203 end; 204 205 if CheckBox1.Checked then // ???? ???? ??????? ????? ?????????? ????? "??" 206 begin 207 Cform := TWREPORT.Create(EMPLOYEE); 208 Cform.madeExtAgreement(strtofloat(PKDBTable3.Fields.PrimaryKey.FieldVal)); 209 end; 210 211 if CheckBox2.Checked then // ???? ???? ??????? ????? ??????? ????? "??" 212 begin 213 Cform := TWREPORT.Create(EMPLOYEE); 214 Cform.madeOrderAppoint(strtofloat(PKDBTable4.Fields.PrimaryKey.FieldVal)); 215 end; 216end; 217 218function TAPPOINTMENTEDIT.FindErrors: Boolean; 219Var 220 i: integer; 221begin 222 // ?????? ????????? ? ?????????? 223 PKDBDictEdit7.DictionaryValue:= PKDBDictEdit1.DictionaryValue; 224 // ????? ????????? ? ?????????? 225 PKDBDictEdit8.DictionaryValue:= PKDBDictEdit2.DictionaryValue; 226 // ??? ??????????=? ???????? 227 PKDBDictEdit9.DictionaryValue:='4136894'; 228 // ??? ???????=? ???????? 229 PKDBDictEdit10.DictionaryValue:='4180888'; 230 231 Result := False; 232 for i := 0 to PKDBTable1.Fields.Count - 1 do 233 Begin 234 if (PKDBTable1.Fields.Items[i].Nullable = false) and 235 (PKDBTable1.Fields.Items[i].IsEmpty) then 236 Begin 237 if (PKDBTable1.Fields.Items[i].IsPrimaryKey = false) then 238 Result := True; 239 End; 240 End; 241 for i := 0 to PKDBTable3.Fields.Count - 1 do 242 Begin 243 if (PKDBTable3.Fields.Items[i].Nullable = false) and 244 (PKDBTable3.Fields.Items[i].IsEmpty) then 245 Begin 246 if (PKDBTable3.Fields.Items[i].IsPrimaryKey = false) then 247 Result := True; 248 End; 249 End; 250 for i := 0 to PKDBTable4.Fields.Count - 1 do 251 Begin 252 if (PKDBTable4.Fields.Items[i].Nullable = false) and 253 (PKDBTable4.Fields.Items[i].IsEmpty) then 254 Begin 255 if (PKDBTable4.Fields.Items[i].IsPrimaryKey = false) then 256 Result := True; 257 End; 258 End; 259 if Result then 260 ShowMessage('?? ????????? ???????????? ????'); 261end; 262 263initialization 264 265RegisterClasses([TAPPOINTMENTEDIT]); 266end.