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.

496 lines
14 KiB
Plaintext

11 months ago
unit u_rp_dui_formatrpt;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, bsSkinCtrls, BusinessSkinForm, dxExEdtr, dxCntner,
dxTL, dxDBCtrl, dxDBGrid, bsSkinBoxCtrls, StdCtrls, DBCtrls, Grids,
Wwdbigrd, Wwdbgrid, dxDBTLCl, dxGrClms;
type
Tfrm_rp_dui_formatrpt = class(TForm)
t_ch_dui_format: TADOQuery;
t_ch_dui_format1: TDataSource;
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinPanel1: TbsSkinPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinPanel5: TbsSkinPanel;
bsSkinPanel6: TbsSkinPanel;
bsSkinButton6: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
bsSkinPanel7: TbsSkinPanel;
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinListBox1: TbsSkinListBox;
bsSkinGroupBox2: TbsSkinGroupBox;
dxDBGrid3: TdxDBGrid;
dxDBGrid3Column1: TdxDBGridMaskColumn;
bsSkinButton5: TbsSkinButton;
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
Memo4: TMemo;
bsSkinButton7: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
Memo5: TMemo;
bsSkinPanel3: TbsSkinPanel;
bsSkinPanel4: TbsSkinPanel;
DBListBox1: TListBox;
bsSkinPanel8: TbsSkinPanel;
bsSkinPanel9: TbsSkinPanel;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
t_ch_dui_feefield: TADOQuery;
t_ch_dui_feefield1: TDataSource;
t_ch_dui_feename: TADOQuery;
t_ch_dui_feename1: TDataSource;
bsSkinPanel10: TbsSkinPanel;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
Label1: TLabel;
bsSkinPanel11: TbsSkinPanel;
Label2: TLabel;
wwDBGrid1: TwwDBGrid;
bsSkinButton9: TbsSkinButton;
bsSkinButton13: TbsSkinButton;
bsSkinButton14: TbsSkinButton;
dxDBGrid1Column3: TdxDBGridCheckColumn;
dxDBGrid1Column4: TdxDBGridCheckColumn;
dxDBGrid1Column5: TdxDBGridCheckColumn;
dxDBGrid1Column6: TdxDBGridCheckColumn;
dxDBGrid1Column7: TdxDBGridCheckColumn;
dxDBGrid1Column8: TdxDBGridCheckColumn;
dxDBGrid1Column9: TdxDBGridCheckColumn;
dxDBGrid1Column10: TdxDBGridCheckColumn;
dxDBGrid1Column12: TdxDBGridCheckColumn;
dxDBGrid1Column13: TdxDBGridCheckColumn;
dxDBGrid1Column14: TdxDBGridCheckColumn;
dxDBGrid1Column15: TdxDBGridCheckColumn;
bsSkinPanel12: TbsSkinPanel;
dxDBGrid1Column16: TdxDBGridCheckColumn;
dxDBGrid1Column17: TdxDBGridCheckColumn;
ListBox1: TListBox;
bsSkinButton15: TbsSkinButton;
bsSkinButton16: TbsSkinButton;
Label3: TLabel;
dxDBGrid1Column19: TdxDBGridCheckColumn;
dxDBGrid1Column18: TdxDBGridCheckColumn;
dxDBGrid1Column20: TdxDBGridCheckColumn;
dxDBGrid1Column21: TdxDBGridCheckColumn;
dxDBGrid1Column22: TdxDBGridCheckColumn;
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure t_ch_dui_formatAfterInsert(DataSet: TDataSet);
procedure t_ch_dui_formatBeforePost(DataSet: TDataSet);
procedure t_ch_dui_formatDeleteError(DataSet: TDataSet;
E: EDatabaseError; var Action: TDataAction);
procedure t_ch_dui_format_detailBeforeInsert(DataSet: TDataSet);
procedure bsSkinButton5Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure t_ch_dui_formatAfterScroll(DataSet: TDataSet);
procedure t_ch_dui_feefieldAfterInsert(DataSet: TDataSet);
procedure t_ch_dui_feenameAfterInsert(DataSet: TDataSet);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton13Click(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure t_ch_dui_feefieldBeforeInsert(DataSet: TDataSet);
procedure t_ch_dui_feenameBeforeInsert(DataSet: TDataSet);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton15Click(Sender: TObject);
procedure bsSkinButton16Click(Sender: TObject);
procedure t_ch_dui_feefieldBeforeDelete(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_dui_formatrpt: Tfrm_rp_dui_formatrpt;
dui_format_type:integer;
implementation
uses u_main, u_data_share, my_sys_function;
{$R *.dfm}
procedure Tfrm_rp_dui_formatrpt.bsSkinButton1Click(Sender: TObject);
begin
t_ch_dui_format.Insert;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_ch_dui_format);
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton4Click(Sender: TObject);
var
aQuery:TAdoQuery;
begin
if MessageDlg('ȷʵҪɾ<D2AA><C9BE><EFBFBD>˶<EFBFBD><CBB6><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbNo],0)=mryes then begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;
sql.Text:='delete from t_ch_dui_feefield where DM_ID='+t_ch_dui_format.fieldbyname('DM_ID').AsString;
ExecSQL;
close;
sql.Text:='delete from t_ch_dui_feename where DM_ID='+t_ch_dui_format.fieldbyname('DM_ID').AsString;
ExecSQL;
end;
finally
freeandnil(aQuery);
end;
table_delete(t_ch_dui_format);
end;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_ch_dui_format);
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_formatAfterInsert(DataSet: TDataSet);
begin
t_ch_dui_format['<27><><EFBFBD><EFBFBD>']:=dui_format_type;
t_ch_dui_format['<27>Ƿ񰴷<C7B7><F1B0B4B7>ÿͻ<C3BF><CDBB>ϼ<EFBFBD>']:=1;
t_ch_dui_format['Ӧ<><D3A6>USD<53><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_ch_dui_format['Ӧ<><D3A6>RMB<4D><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_ch_dui_format['Ӧ<>պϼ<D5BA>USD']:=1;
t_ch_dui_format['Ӧ<>պϼ<D5BA>RMB']:=1;
t_ch_dui_format['Ӧ<><D3A6>USD<53><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_ch_dui_format['Ӧ<><D3A6>RMB<4D><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_ch_dui_format['Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>USD']:=1;
t_ch_dui_format['Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>RMB']:=1;
t_ch_dui_format['Ӧ<>պϼ<D5BA>']:=1;
t_ch_dui_format['Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>']:=1;
t_ch_dui_format['USD<53><44><EFBFBD><EFBFBD>']:=1;
t_ch_dui_format['RMB<4D><42><EFBFBD><EFBFBD>']:=1;
t_ch_dui_format['<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>']:=1;
t_ch_dui_format['Ӧ<><D3A6>OT<4F><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_ch_dui_format['Ӧ<>պϼ<D5BA>OT']:=1;
t_ch_dui_format['Ӧ<><D3A6>OT<4F><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_ch_dui_format['Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>OT']:=1;
t_ch_dui_format['OT<4F><54><EFBFBD><EFBFBD>']:=1;
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_formatBeforePost(DataSet: TDataSet);
begin
t_ch_dui_format['<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>']:=DBListBox1.Items.Text;
t_ch_dui_format['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']:=ListBox1.Items.Text;
table_before_post(t_ch_dui_format,'ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
table_before_post(t_ch_dui_format,'<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_formatDeleteError(DataSet: TDataSet;
E: EDatabaseError; var Action: TDataAction);
begin
showmessage('<27>ʵ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>Ѿ<EFBFBD>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
abort;
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_format_detailBeforeInsert(
DataSet: TDataSet);
begin
table_post(t_ch_dui_format);
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_dui_formatrpt.FormShow(Sender: TObject);
begin
t_ch_dui_format.Parameters[0].value:=dui_format_type;
t_ch_dui_format.open;
t_ch_dui_feefield.Open;
t_ch_dui_feename.Open;
case dui_format_type of
1,2,3,4:
begin
frm_data_share.t_code_fee.Requery();
frm_data_share.t_code_fee.Filtered:=false;
frm_data_share.t_code_fee.Filter:='<27><><EFBFBD><EFBFBD>=1';
frm_data_share.t_code_fee.Filtered:=true;
end;
5,6,7,8:
begin
frm_data_share.t_code_fee.Requery();
frm_data_share.t_code_fee.Filtered:=false;
frm_data_share.t_code_fee.Filter:='<27><><EFBFBD><EFBFBD>=1';
frm_data_share.t_code_fee.Filtered:=true;
end;
end;
case dui_format_type of
1,2:
begin
bsSkinListBox1.Items.Text:=memo1.text;
end;
3,4:
begin
bsSkinListBox1.Items.Text:=memo2.text;
end;
5,6:
begin
bsSkinListBox1.Items.Text:=memo3.text;
end;
7,8:
begin
bsSkinListBox1.Items.Text:=memo4.text;
end;
9,12:
begin
bsSkinListBox1.Items.Text:=memo5.text;
end;
end;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton6Click(Sender: TObject);
var
if_find:boolean;
i:integer;
begin
if t_ch_dui_format.IsEmpty then
exit;
if bsSkinListBox1.ItemIndex=-1 then
exit;
for i:=0 to DBListBox1.Items.Count-1 do
begin
if copy(DBListBox1.Items[i],2,length(DBListBox1.Items[i])-1)=bsSkinListBox1.Items[bsSkinListBox1.ItemIndex] then
exit;
end;
t_ch_dui_format.edit;
DBListBox1.Items.Add('0'+bsSkinListBox1.Items[bsSkinListBox1.ItemIndex]);
t_ch_dui_format.post;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton10Click(Sender: TObject);
begin
if DBListBox1.ItemIndex=-1 then
exit;
t_ch_dui_format.edit;
DBListBox1.Items.Delete(DBListBox1.ItemIndex);
t_ch_dui_format.post;
// t_ch_dui_feename.Post;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton11Click(Sender: TObject);
var
if_find:boolean;
i:integer;
aQuery:TADOQuery;
begin
if t_ch_dui_feefield.State in [dsedit,dsinsert] then t_ch_dui_feefield.Post;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_ch_dui_feename where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+frm_data_share.t_code_fee.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+''' and DM_ID='+inttostr(t_ch_dui_format['DM_ID']));
Open;
if IsEmpty then begin
t_ch_dui_feename.Insert;
t_ch_dui_feename['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_data_share.t_code_fee.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_dui_feename.Post;
end;
end;
finally
FreeAndNil(aQuery);
end;
{
if t_ch_dui_format.IsEmpty then
exit;
if bsSkinListBox1.ItemIndex=-1 then
exit;
for i:=0 to DBListBox1.Items.Count-1 do
begin
if copy(DBListBox1.Items[i],2,length(DBListBox1.Items[i])-1)=frm_data_share.t_code_fee.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring then
exit;
end;
t_ch_dui_format.edit;
DBListBox1.Items.Add('1'+frm_data_share.t_code_fee.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
t_ch_dui_format.post;
}
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton7Click(Sender: TObject);
var
i:integer;
begin
if t_ch_dui_format.IsEmpty then
exit;
if DBListBox1.ItemIndex=-1 then
exit;
if DBListBox1.ItemIndex=0 then
exit;
t_ch_dui_format.edit;
i:=DBListBox1.ItemIndex-1;
DBListBox1.Items.Move(DBListBox1.ItemIndex,DBListBox1.ItemIndex-1);
t_ch_dui_format.post;
DBListBox1.ItemIndex:=i;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton8Click(Sender: TObject);
var
i:integer;
begin
if t_ch_dui_format.IsEmpty then
exit;
if DBListBox1.ItemIndex=-1 then
exit;
if DBListBox1.ItemIndex=DBListBox1.Items.Count-1 then
exit;
t_ch_dui_format.edit;
i:=DBListBox1.ItemIndex+1;
DBListBox1.Items.Move(DBListBox1.ItemIndex,DBListBox1.ItemIndex+1);
t_ch_dui_format.post;
DBListBox1.ItemIndex:=i;
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_formatAfterScroll(DataSet: TDataSet);
begin
DBListBox1.Items.Text:=t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring;
ListBox1.Items.Text:=t_ch_dui_format.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>').asstring;
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_feefieldAfterInsert(
DataSet: TDataSet);
begin
t_ch_dui_feefield['DM_ID']:=t_ch_dui_format['DM_ID'];
t_ch_dui_feefield['Ӧ<><D3A6>USD']:=1;
t_ch_dui_feefield['Ӧ<><D3A6>RMB']:=1;
t_ch_dui_feefield['Ӧ<><D3A6>USD']:=1;
t_ch_dui_feefield['Ӧ<><D3A6>RMB']:=1;
t_ch_dui_feefield['Ӧ<>պϼ<D5BA>']:=1;
t_ch_dui_feefield['Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>']:=1;
t_ch_dui_feefield['<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>']:=1;
t_ch_dui_feefield['Ӧ<><D3A6>USD<53><44>ʾ']:='';
t_ch_dui_feefield['Ӧ<><D3A6>RMB<4D><42>ʾ']:='';
t_ch_dui_feefield['Ӧ<><D3A6>USD<53><44>ʾ']:='';
t_ch_dui_feefield['Ӧ<><D3A6>RMB<4D><42>ʾ']:='';
t_ch_dui_feefield['Ӧ<>պϼ<D5BA><CFBC><EFBFBD>ʾ']:='';
t_ch_dui_feefield['Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD>ʾ']:='';
t_ch_dui_feefield['<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD>ʾ']:='';
t_ch_dui_feefield['Ӧ<><D3A6>OT']:=1;
t_ch_dui_feefield['Ӧ<><D3A6>OT']:=1;
t_ch_dui_feefield['Ӧ<><D3A6>OT<4F><54>ʾ']:='';
t_ch_dui_feefield['Ӧ<><D3A6>OT<4F><54>ʾ']:='';
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_feenameAfterInsert(
DataSet: TDataSet);
begin
t_ch_dui_feename['FF_ID']:=t_ch_dui_feefield['FF_ID'];
t_ch_dui_feename['DM_ID']:=t_ch_dui_feefield['DM_ID'];
t_ch_dui_feename['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>']:=t_ch_dui_feefield['<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>'];
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton9Click(Sender: TObject);
begin
if t_ch_dui_format.State in [dsedit,dsinsert] then
t_ch_dui_format.Post;
t_ch_dui_feefield.Insert;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton13Click(Sender: TObject);
begin
t_ch_dui_feefield.Delete;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton14Click(Sender: TObject);
begin
t_ch_dui_feefield.Post;
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_feefieldBeforeInsert(
DataSet: TDataSet);
begin
if t_ch_dui_format.IsEmpty then exit;
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_feenameBeforeInsert(
DataSet: TDataSet);
begin
if t_ch_dui_feefield.IsEmpty then exit;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton12Click(Sender: TObject);
begin
if t_ch_dui_feename.IsEmpty then Exit;
t_ch_dui_feename.Delete;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton15Click(Sender: TObject);
var
if_find:boolean;
i:integer;
begin
if t_ch_dui_format.IsEmpty then
exit;
if DBListBox1.ItemIndex=-1 then
exit;
for i:=0 to ListBox1.Items.Count-1 do
begin
if ListBox1.Items[i]=DBListBox1.Items[DBListBox1.ItemIndex] then
exit;
end;
t_ch_dui_format.edit;
ListBox1.Items.Add(copy(DBListBox1.Items[DBListBox1.ItemIndex],2,length(DBListBox1.Items[DBListBox1.ItemIndex])-1));
t_ch_dui_format.post;
end;
procedure Tfrm_rp_dui_formatrpt.bsSkinButton16Click(Sender: TObject);
begin
if ListBox1.ItemIndex=-1 then
exit;
t_ch_dui_format.edit;
ListBox1.Items.Delete(ListBox1.ItemIndex);
t_ch_dui_format.post;
end;
procedure Tfrm_rp_dui_formatrpt.t_ch_dui_feefieldBeforeDelete(
DataSet: TDataSet);
begin
{
if not t_ch_dui_feename.IsEmpty then begin
MessageDlg('<27>˷<EFBFBD><CBB7>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ,<2C><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>޸ķ<DEB8><C4B7>飡',mtWarning,[mbOk],0);
abort;
end;
}
end;
end.