You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

582 lines
16 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_info_luntan;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, DB, ADODB, StdCtrls, ComCtrls, DBCtrls, Mask,shellapi,
dxDBGrid, ExtCtrls, bsSkinCtrls, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl,
dxCntner, ImgList, ToolWin, ActnList, wwriched, Grids, Wwdbigrd, Wwdbgrid,
RxLookup, wwdbdatetimepicker,wwrtfconverter;
type
Tfrm_info_luntan = class(TForm)
Panel1: TPanel;
bsSkinButton7: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
t_info_luntan: TADOQuery;
t_info_luntan1: TDataSource;
qrytmp: TADOQuery;
ToolbarImages: TImageList;
t_info_luntan_detail: TADOQuery;
t_info_luntan_detail1: TDataSource;
Notebook1: TNotebook;
bsSkinPanel1: TbsSkinPanel;
bsSkinPanel2: TbsSkinPanel;
Splitter1: TSplitter;
bsSkinPanel3: TbsSkinPanel;
bsSkinPanel7: TbsSkinPanel;
bsSkinPanel8: TbsSkinPanel;
bsSkinPanel9: TbsSkinPanel;
bsSkinButton13: TbsSkinButton;
bsSkinPanel10: TbsSkinPanel;
bsSkinPanel4: TbsSkinPanel;
bsSkinPanel5: TbsSkinPanel;
dxDBGrid1: TdxDBGrid;
dxDBGrid1sc_id: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
bsSkinPanel12: TbsSkinPanel;
Label3: TLabel;
Edit1: TEdit;
bsSkinButton12: TbsSkinButton;
bsSkinPanel13: TbsSkinPanel;
bsSkinPanel15: TbsSkinPanel;
Label4: TLabel;
Label5: TLabel;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
bsSkinButton14: TbsSkinButton;
Label7: TLabel;
wwDBRichEdit2: TwwDBRichEdit;
wwDBRichEdit3: TwwDBRichEdit;
bsSkinButton2: TbsSkinButton;
Label11: TLabel;
DBEdit7: TDBEdit;
Editor: TwwDBRichEdit;
Label12: TLabel;
Edit3: TEdit;
bsSkinPanel11: TbsSkinPanel;
bsSkinSpeedButton1: TbsSkinSpeedButton;
bsSkinSpeedButton2: TbsSkinSpeedButton;
bsSkinSpeedButton3: TbsSkinSpeedButton;
LeftAlign: TbsSkinSpeedButton;
CenterAlign: TbsSkinSpeedButton;
RightAlign: TbsSkinSpeedButton;
FontName: TComboBox;
FontSize: TEdit;
UpDown1: TUpDown;
bsSkinSpeedButton10: TbsSkinSpeedButton;
Splitter2: TSplitter;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Label9: TLabel;
Label13: TLabel;
RxDBLookupCombo4: TRxDBLookupCombo;
Label15: TLabel;
OpenDialog1: TOpenDialog;
bsSkinGroupBox1: TbsSkinGroupBox;
wwDBRichEdit1: TwwDBRichEdit;
bsSkinPanel6: TbsSkinPanel;
Label1: TLabel;
Label2: TLabel;
Label6: TLabel;
Label8: TLabel;
bsSkinPanel14: TbsSkinPanel;
DBEdit1: TDBEdit;
bsSkinPanel17: TbsSkinPanel;
DBEdit2: TDBEdit;
bsSkinPanel18: TbsSkinPanel;
DBEdit5: TDBEdit;
bsSkinPanel19: TbsSkinPanel;
DBEdit6: TDBEdit;
bsSkinGroupBox2: TbsSkinGroupBox;
wwDBGrid1: TwwDBGrid;
bsSkinButton9: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
Label10: TLabel;
DBEdit8: TDBEdit;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure t_info_luntanAfterInsert(DataSet: TDataSet);
procedure t_info_luntanBeforePost(DataSet: TDataSet);
procedure t_info_luntanBeforeEdit(DataSet: TDataSet);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormResize(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure FileNewCmdExecute(Sender: TObject);
procedure bsSkinSpeedButton1Click(Sender: TObject);
procedure bsSkinSpeedButton2Click(Sender: TObject);
procedure bsSkinSpeedButton3Click(Sender: TObject);
procedure FontNameChange(Sender: TObject);
procedure FontSizeChange(Sender: TObject);
procedure LeftAlignClick(Sender: TObject);
procedure EditorSelectionChange(Sender: TObject);
procedure dxDBGrid1DblClick(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure bsSkinSpeedButton10Click(Sender: TObject);
procedure t_info_luntan_detailAfterInsert(DataSet: TDataSet);
procedure bsSkinButton13Click(Sender: TObject);
procedure t_info_luntan_detailBeforeEdit(DataSet: TDataSet);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure Notebook1PageChanged(Sender: TObject);
private
FUpdating:boolean;
{ Private declarations }
procedure UpLoadPro(fname:string); //fname<6D><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
procedure DownLoadPro(fname:string); //<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function CurrText: TTextAttributes;
procedure GetFontNames;
public
{ Public declarations }
end;
var
frm_info_luntan: Tfrm_info_luntan;
implementation
{$R *.dfm}
uses u_main, my_sys_function,u_sys_progress;
function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
FontType: Integer; Data: Pointer): Integer; stdcall;
begin
TStrings(Data).Add(LogFont.lfFaceName);
Result := 1;
end;
procedure Tfrm_info_luntan.GetFontNames;
var
DC: HDC;
begin
DC := GetDC(0);
EnumFonts(DC, nil, @EnumFontsProc, Pointer(FontName.Items));
ReleaseDC(0, DC);
FontName.Sorted := True;
end;
procedure Tfrm_info_luntan.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption+'1');
savewwgrid(wwDBGrid1,'<27>ڲ<EFBFBD><DAB2><EFBFBD>̳');
frm_info_luntan.Hide;
frm_info_luntan.ManualFloat(frm_info_luntan.BoundsRect );
frm_main.freeTabs('frm_info_luntan');
action:=cafree;
frm_info_luntan:=nil;
end;
procedure Tfrm_info_luntan.FormShow(Sender: TObject);
begin
loadreggrid(dxdbgrid1,false,caption+'1');
loadwwgrid(wwDBGrid1,'<27>ڲ<EFBFBD><DAB2><EFBFBD>̳');
with t_info_luntan,sql do
begin
close ;clear ;
add('select top 50 * from t_info_luntan ');
add('where ¼<><C2BC><EFBFBD><EFBFBD>='+''''+employee+''' or ') ;
add(open_data('9005','¼<><C2BC><EFBFBD><EFBFBD>','no','no','no','no')) ;
add(' order by ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
Open;
end ;
t_info_luntan_detail.Open ;
GetFontNames;
end;
procedure Tfrm_info_luntan.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_info_luntan.bsSkinButton7Click(Sender: TObject);
begin
table_Prior(t_info_luntan);
end;
procedure Tfrm_info_luntan.bsSkinButton6Click(Sender: TObject);
begin
table_next(t_info_luntan);
end;
procedure Tfrm_info_luntan.bsSkinButton8Click(Sender: TObject);
begin
t_info_luntan.edit;
table_post(t_info_luntan);
end;
procedure Tfrm_info_luntan.bsSkinButton4Click(Sender: TObject);
begin
if not if_open('247') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
exit;
end;
if do_data('9005',t_info_luntan.fieldbyname('¼<><C2BC><EFBFBD><EFBFBD>').asstring,'','','','','')=false then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩɾ<C8A8><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>');
abort;
end;
if t_info_luntan.isempty then
exit;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)=IDOK then
begin
with qrytmp,sql do //ɾ<><C9BE><EFBFBD>ӱ<EFBFBD>
begin
close ; clear ;
add('delete from t_info_luntan_detail where lt_id=:ltid');
parameters.ParamByName('ltid').Value:=t_info_luntan.fieldbyname('lt_id').value ;
execsql ;
end ;
t_info_luntan.delete;
end ;
end;
procedure Tfrm_info_luntan.bsSkinButton3Click(Sender: TObject);
begin
if bsSkinButton3.Caption='<27><EFBFBD><E9BFB4><EFBFBD><EFBFBD>' then begin
Notebook1.PageIndex:=2;
bsSkinButton3.Caption:='<27><EFBFBD>б<EFBFBD>';
end else begin
Notebook1.PageIndex:=0;
bsSkinButton3.Caption:='<27><EFBFBD><E9BFB4><EFBFBD><EFBFBD>';
end;
end;
procedure Tfrm_info_luntan.bsSkinButton1Click(Sender: TObject);
begin
if not if_open('245') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
exit;
end;
Notebook1.PageIndex:=1;
t_info_luntan.insert;
// bsSkinButton14.Caption:='<27><EFBFBD>б<EFBFBD>';
end;
procedure Tfrm_info_luntan.t_info_luntanAfterInsert(DataSet: TDataSet);
begin
t_info_luntan['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
t_info_luntan['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
end;
procedure Tfrm_info_luntan.t_info_luntanBeforePost(DataSet: TDataSet);
begin
table_before_post(t_info_luntan,'<27><>̳<EFBFBD><CCB3><EFBFBD><EFBFBD>');
table_before_post(t_info_luntan,'<27><><EFBFBD><EFBFBD>');
end;
procedure Tfrm_info_luntan.t_info_luntanBeforeEdit(DataSet: TDataSet);
begin
if t_info_luntan.FieldByName('¼<><C2BC><EFBFBD><EFBFBD>').asstring<>employee then abort;
end;
procedure Tfrm_info_luntan.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose:=close_query(t_info_luntan);
end;
procedure Tfrm_info_luntan.FormResize(Sender: TObject);
var
i:integer;
begin
i:=round(panel1.Width/8);
bsSkinButton7.Width:=i;
bsSkinButton8.Width:=i;
bsSkinButton6.Width:=i;
bsSkinButton1.Width:=i;
bsSkinButton4.Width:=i;
bsSkinButton14.Width:=i;
bsSkinButton3.Width:=i;
DBEdit1.Width:=bsSkinPanel2.Width-DBEdit1.Left-6;
end;
procedure Tfrm_info_luntan.DownLoadPro(fname: string);
begin
end;
procedure Tfrm_info_luntan.UpLoadPro(fname: string);
begin
end;
procedure Tfrm_info_luntan.bsSkinButton2Click(Sender: TObject);
var importRCL: TwwRtfConverterlist;
begin
ImportRcl := TwwRtfConverterList.create(True);
try
OpenDialog1.InitialDir := '';
OpenDialog1.Filter := 'Rich Text Format (*.rtf)|*.rtf|';
OpenDialog1.Filter := OpenDialog1.Filter + ImportRcl.FilterList;
OpenDialog1.Title := '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>';
if ( not OpenDialog1.Execute) then exit;
if OpenDialog1.FilterIndex=1 then
begin
wwDBRichEdit2.lines.LoadFromFile(OpenDialog1.FileName);
exit;
end;
// LastFormat:= ImportRCL.FormatClass[OpenDialog1.FilterIndex-2];
try
wwDBRichEdit2.Import(
ImportRCL.FormatClass[OpenDialog1.FilterIndex-2],
OpenDialog1.FileName)
except
On E: EwwRTFError do begin
Showmessage(E.message +
' ErrorCode:' + inttostr(e.ErrorCode));
end;
end;
finally
ImportRCL.Free;
end;
end;
procedure Tfrm_info_luntan.bsSkinButton12Click(Sender: TObject);
begin
with t_info_luntan,sql do
begin
close ;clear ;
add('select * from t_info_luntan ');
add('where 1=1 ') ;
if trim(edit1.text)<>'' then begin
add(' and <20><>̳<EFBFBD><CCB3><EFBFBD><EFBFBD> like ''%'+edit1.text+'%''and ') ;
end;
if trim(edit3.text)<>'' then begin
add(' and <20><><EFBFBD><EFBFBD> like ''%'+edit3.text+'%''and ') ;
end;
if wwDBDateTimePicker1.text<>''then
begin
add(' and ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >='+''''+wwDBDateTimePicker1.text+'''');
end;
if wwDBDateTimePicker2.text<>''then
begin
add(' and ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <='+''''+wwDBDateTimePicker2.text+'''');
end;
if RxDBLookupCombo4.DisplayValue<>''then
add(' and ¼<><C2BC><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo4.DisplayValue+'''');
add(' and '+open_data('9005','¼<><C2BC><EFBFBD><EFBFBD>','no','no','no','no')) ;
add(' order by ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
Open;
end ;
t_info_luntan_detail.Open ;
end;
procedure Tfrm_info_luntan.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
bsSkinButton12.OnClick(Sender);
end;
function Tfrm_info_luntan.CurrText: TTextAttributes;
begin
if Editor.SelLength > 0 then Result := Editor.SelAttributes
else Result := Editor.DefAttributes;
end;
procedure Tfrm_info_luntan.FileNewCmdExecute(Sender: TObject);
begin
Editor.Lines.Clear;
end;
procedure Tfrm_info_luntan.bsSkinSpeedButton1Click(Sender: TObject);
begin
if fsBold in Editor.SelAttributes.Style then
CurrText.Style := CurrText.Style - [fsBold]
else
CurrText.Style := CurrText.Style + [fsBold];
end;
procedure Tfrm_info_luntan.bsSkinSpeedButton2Click(Sender: TObject);
begin
if fsItalic in Editor.SelAttributes.Style then
CurrText.Style := CurrText.Style - [fsItalic]
else
CurrText.Style := CurrText.Style + [fsItalic];
end;
procedure Tfrm_info_luntan.bsSkinSpeedButton3Click(Sender: TObject);
begin
if fsUnderline in Editor.SelAttributes.Style then
CurrText.Style := CurrText.Style - [fsUnderline]
else
CurrText.Style := CurrText.Style + [fsUnderline];
end;
procedure Tfrm_info_luntan.FontNameChange(Sender: TObject);
begin
if FUpdating then Exit;
CurrText.Name := FontName.Items[FontName.ItemIndex];
end;
procedure Tfrm_info_luntan.FontSizeChange(Sender: TObject);
begin
if FUpdating then Exit;
CurrText.Size := StrToInt(FontSize.Text);
end;
procedure Tfrm_info_luntan.LeftAlignClick(Sender: TObject);
begin
Editor.Paragraph.Alignment := TAlignment(TControl(Sender).Tag);
end;
procedure Tfrm_info_luntan.EditorSelectionChange(Sender: TObject);
begin
with Editor.Paragraph do
try
FUpdating := True;
FontSize.Text := IntToStr(Editor.SelAttributes.Size);
FontName.Text := Editor.SelAttributes.Name;
case Ord(Alignment) of
0: LeftAlign.Down := True;
1: RightAlign.Down := True;
2: CenterAlign.Down := True;
end;
finally
FUpdating := False;
end;
end;
procedure Tfrm_info_luntan.dxDBGrid1DblClick(Sender: TObject);
begin
Notebook1.PageIndex:=2;
bsSkinButton3.Caption:='<27><EFBFBD>б<EFBFBD>';
end;
procedure Tfrm_info_luntan.bsSkinButton14Click(Sender: TObject);
begin
if bsSkinButton14.Caption='<27><EFBFBD><E9BFB4><EFBFBD><EFBFBD>' then begin
Notebook1.PageIndex:=1;
bsSkinButton14.Caption:='<27><EFBFBD>б<EFBFBD>';
end else begin
Notebook1.PageIndex:=0;
bsSkinButton14.Caption:='<27><EFBFBD><E9BFB4><EFBFBD><EFBFBD>';
end;
end;
procedure Tfrm_info_luntan.bsSkinSpeedButton10Click(Sender: TObject);
var importRCL: TwwRtfConverterlist;
begin
ImportRcl := TwwRtfConverterList.create(True);
try
OpenDialog1.InitialDir := '';
OpenDialog1.Filter := 'Rich Text Format (*.rtf)|*.rtf|';
OpenDialog1.Filter := OpenDialog1.Filter + ImportRcl.FilterList;
OpenDialog1.Title := '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>';
if ( not OpenDialog1.Execute) then exit;
if OpenDialog1.FilterIndex=1 then
begin
Editor.lines.LoadFromFile(OpenDialog1.FileName);
exit;
end;
// LastFormat:= ImportRCL.FormatClass[OpenDialog1.FilterIndex-2];
try
Editor.Import(
ImportRCL.FormatClass[OpenDialog1.FilterIndex-2],
OpenDialog1.FileName)
except
On E: EwwRTFError do begin
Showmessage(E.message +
' ErrorCode:' + inttostr(e.ErrorCode));
end;
end;
finally
ImportRCL.Free;
end;
end;
procedure Tfrm_info_luntan.t_info_luntan_detailAfterInsert(
DataSet: TDataSet);
begin
t_info_luntan_detail['lt_id']:=t_info_luntan['lt_id'];
t_info_luntan_detail['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_info_luntan_detail['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
end;
procedure Tfrm_info_luntan.bsSkinButton13Click(Sender: TObject);
begin
// if not (t_info_luntan_detail.state in [dsedit,dsinsert]) then
// t_info_luntan_detail.Edit;
t_info_luntan_detail.Post;
end;
procedure Tfrm_info_luntan.t_info_luntan_detailBeforeEdit(
DataSet: TDataSet);
begin
if t_info_luntan_detail.FieldByName('¼<><C2BC><EFBFBD><EFBFBD>').asstring<>employee then abort;
end;
procedure Tfrm_info_luntan.bsSkinButton9Click(Sender: TObject);
begin
t_info_luntan_detail.Insert;
end;
procedure Tfrm_info_luntan.bsSkinButton10Click(Sender: TObject);
begin
if t_info_luntan_detail.IsEmpty then exit;
t_info_luntan_detail.Delete;
end;
procedure Tfrm_info_luntan.Notebook1PageChanged(Sender: TObject);
begin
if Notebook1.PageIndex=0 then begin
bsSkinButton14.Caption:='<27><EFBFBD><E9BFB4><EFBFBD><EFBFBD>';
bsSkinButton3.Caption:='<27><EFBFBD><E9BFB4><EFBFBD><EFBFBD>';
end else if Notebook1.PageIndex=1 then begin
bsSkinButton14.Caption:='<27><EFBFBD>б<EFBFBD>';
bsSkinButton3.Caption:='<27><EFBFBD><E9BFB4><EFBFBD><EFBFBD>';
end else if Notebook1.PageIndex=2 then begin
bsSkinButton14.Caption:='<27><EFBFBD><E9BFB4><EFBFBD><EFBFBD>';
bsSkinButton3.Caption:='<27><EFBFBD>б<EFBFBD>';
end;
end;
end.