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.

741 lines
22 KiB
Plaintext

11 months ago
unit u_rp_dui_aire_pay;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, ADODB, Menus, XPMenu, DB, Mask, DBCtrls, dxDBGrid,
RxLookup, wwdbdatetimepicker, StdCtrls, dxDBTLCl, dxGrClms, dxTL,
dxDBCtrl, dxCntner, ExtCtrls, bsSkinCtrls, ComCtrls, bsSkinTabs;
type
Tfrm_rp_dui_aire_pay = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
Notebook1: TNotebook;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column7: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridMaskColumn;
dxDBGrid1Column8: TdxDBGridMaskColumn;
dxDBGrid1Column9: TdxDBGridDateColumn;
bsSkinPanel3: TbsSkinPanel;
bsSkinPanel4: TbsSkinPanel;
Label1: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Edit4: TEdit;
Edit2: TEdit;
Edit3: TEdit;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker3: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
wwDBDateTimePicker4: TwwDBDateTimePicker;
RxDBLookupCombo2: TRxDBLookupCombo;
bsSkinButton7: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
bsSkinPanel5: TbsSkinPanel;
dxDBGrid3: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGridMaskColumn2: TdxDBGridMaskColumn;
dxDBGridMaskColumn3: TdxDBGridMaskColumn;
dxDBGridMaskColumn4: TdxDBGridMaskColumn;
dxDBGridMaskColumn5: TdxDBGridMaskColumn;
dxDBGridDateColumn1: TdxDBGridDateColumn;
dxDBGridDateColumn2: TdxDBGridDateColumn;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridMaskColumn8: TdxDBGridMaskColumn;
dxDBGridMaskColumn10: TdxDBGridMaskColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridMaskColumn11: TdxDBGridMaskColumn;
dxDBGridMaskColumn12: TdxDBGridMaskColumn;
dxDBGridMaskColumn13: TdxDBGridMaskColumn;
Panel2: TPanel;
dxDBGrid4: TdxDBGrid;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
bsSkinPanel1: TbsSkinPanel;
bsSkinPanel6: TbsSkinPanel;
Label2: TLabel;
Label5: TLabel;
Label6: TLabel;
Label15: TLabel;
Label3: TLabel;
Label4: TLabel;
DBEdit2: TDBEdit;
DBEdit5: TDBEdit;
RxDBLookupCombo3: TRxDBLookupCombo;
DBEdit6: TDBEdit;
RxDBLookupCombo1: TRxDBLookupCombo;
DBEdit4: TDBEdit;
t_ch_dui: TADOQuery;
t_ch_dui1: TDataSource;
t_bill_fee1: TDataSource;
t_op_seae: TADOQuery;
t_op_seae1: TDataSource;
t_ch_fee: TADOQuery;
t_ch_fee1: TDataSource;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
t_ch_dui_format1: TDataSource;
t_bill_fee: TADOStoredProc;
t_ch_dui_format: TADOQuery;
t_ch_dui_bill: TADOQuery;
p_update: TADOStoredProc;
PopupMenu3: TPopupMenu;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
v_dui_bill: TADOQuery;
v_dui_bill1: TDataSource;
v_dui_fee: TADOQuery;
v_dui_fee1: TDataSource;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
dxDBGrid5: TdxDBGrid;
dxDBGrid5Column1: TdxDBGridMaskColumn;
dxDBGrid5Column2: TdxDBGridMaskColumn;
dxDBGrid5Column6: TdxDBGridMaskColumn;
dxDBGrid5Column7: TdxDBGridColumn;
dxDBGrid5Column8: TdxDBGridColumn;
dxDBGrid5Column9: TdxDBGridColumn;
dxDBGrid6: TdxDBGrid;
dxDBGrid6Column1: TdxDBGridMaskColumn;
dxDBGrid6Column2: TdxDBGridMaskColumn;
dxDBGrid6Column3: TdxDBGridMaskColumn;
dxDBGrid6RMB: TdxDBGridColumn;
dxDBGrid6Column20: TdxDBGridColumn;
dxDBGrid6Column21: TdxDBGridColumn;
dxDBGrid6USD: TdxDBGridColumn;
dxDBGrid6Column23: TdxDBGridColumn;
dxDBGrid6Column24: TdxDBGridColumn;
dxDBGrid6Column4: TdxDBGridMaskColumn;
dxDBGrid6Column5: TdxDBGridMaskColumn;
dxDBGrid6Column6: TdxDBGridMaskColumn;
dxDBGrid6Column7: TdxDBGridDateColumn;
dxDBGrid6Column8: TdxDBGridMaskColumn;
dxDBGrid6Column9: TdxDBGridMaskColumn;
dxDBGrid6Column10: TdxDBGridMaskColumn;
dxDBGrid6Column11: TdxDBGridMaskColumn;
dxDBGrid6Column12: TdxDBGridColumn;
dxDBGrid6Column13: TdxDBGridCurrencyColumn;
dxDBGrid6Column14: TdxDBGridMaskColumn;
dxDBGrid6Column15: TdxDBGridMaskColumn;
dxDBGrid6Column16: TdxDBGridMaskColumn;
dxDBGrid6Column17: TdxDBGridMaskColumn;
dxDBGrid6Column18: TdxDBGridMaskColumn;
bsSkinTabSheet2: TbsSkinTabSheet;
dxDBGrid2: TdxDBGrid;
bsSkinButton6: TbsSkinButton;
PopupMenu2: TPopupMenu;
N5: TMenuItem;
XPMenu1: TXPMenu;
Label16: TLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
Label17: TLabel;
wwDBDateTimePicker6: TwwDBDateTimePicker;
Label7: TLabel;
DBEdit7: TDBEdit;
Label19: TLabel;
wwDBDateTimePicker7: TwwDBDateTimePicker;
Label18: TLabel;
DBEdit1: TDBEdit;
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinPanel2Resize(Sender: TObject);
procedure t_ch_duiAfterInsert(DataSet: TDataSet);
procedure t_ch_duiBeforePost(DataSet: TDataSet);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure t_ch_duiAfterScroll(DataSet: TDataSet);
procedure RxDBLookupCombo3Change(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure RxDBLookupCombo1Enter(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure dxDBGrid2ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure t_ch_duiAfterPost(DataSet: TDataSet);
procedure bsSkinButton9Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure t_ch_duiBeforeCancel(DataSet: TDataSet);
procedure bsSkinButton6Click(Sender: TObject);
procedure N5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_dui_aire_pay: Tfrm_rp_dui_aire_pay;
implementation
uses u_main, u_rp_dui_format, u_data_share, my_sys_function, u_rp_dui_query;
{$R *.dfm}
procedure Tfrm_rp_dui_aire_pay.bsSkinButton8Click(Sender: TObject);
begin
RxDBLookupCombo2.ClearValue;
Edit4.text:='';
Edit3.Text:='';
Edit2.text:='';
wwDBDateTimePicker1.Clear;
wwDBDateTimePicker2.clear;
wwDBDateTimePicker3.clear;
wwDBDateTimePicker4.clear;
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton7Click(Sender: TObject);
var
str_fee,str_op:widestring;
begin
if NOT strtobool(get_parameters_value(47,'false')) then
begin
str_fee:='where (<28>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0 OR <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> IS NULL) and <20><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''
+' and <20><><EFBFBD><EFBFBD>״̬ in ('+''''+'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'+''''+','+''''+'<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>'+''''
+','+''''+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+''''+','+''''+'<27><>ֹɾ<D6B9><C9BE>'+''''
+','+''''+'<27><>ֹ<EFBFBD>޸<EFBFBD>'+''''+')';
end
else
begin
str_fee:='where (<28>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0 OR <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> IS NULL) and <20><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''
+' and <20><><EFBFBD><EFBFBD>״̬ in ('+''''+'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'+''''+','+''''+'<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>'+''''
+','+''''+'<27><>ֹɾ<D6B9><C9BE>'+''''
+','+''''+'<27><>ֹ<EFBFBD>޸<EFBFBD>'+''''+')';
end;
if RxDBLookupCombo2.DisplayValues[1]<>''then
str_fee:=str_fee+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
str_op:='';
if Edit4.text<>''then
str_op:=str_op+' and ί<>б<EFBFBD><D0B1><EFBFBD> like '+''''+'%'+Edit4.text+'%'+'''';
if Edit2.text<>''then
str_op:=str_op+' and <20><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD> like '+''''+'%'+Edit2.text+'%'+'''';
if Edit3.text<>''then
str_op:=str_op+' and <20><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD> like '+''''+'%'+Edit3.text+'%'+'''';
if wwDBDateTimePicker1.text<>''then
str_op:=str_op+' and һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker1.text+'''';
if wwDBDateTimePicker2.text<>''then
str_op:=str_op+' and һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker2.text+'''';
if wwDBDateTimePicker3.text<>''then
str_op:=str_op+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker3.text+'''';
if wwDBDateTimePicker4.text<>''then
str_op:=str_op+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker4.text+'''';
str_op:='where <20><><EFBFBD><EFBFBD> in (select distinct <20><><EFBFBD><EFBFBD> from t_ch_fee '+str_fee+')'+str_op;
str_op:=str_op+' and '+open_data('0032','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>Ա','<27>ͷ<EFBFBD>Ա','no','no');
str_op:='select * from t_op_aire '+str_op+default_sort(55,'t_op_aire','','desc');
str_fee:='select * from t_ch_fee '
+str_fee+' and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> order by CH_ID';
t_ch_fee.Close;
t_op_seae.close;
t_op_seae.sql.clear;
t_op_seae.sql.add(str_op);
t_op_seae.open;
t_ch_fee.sql.clear;
t_ch_fee.sql.add(str_fee);
t_ch_fee.open;
end;
procedure Tfrm_rp_dui_aire_pay.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_dui_aire_pay.Hide;
frm_rp_dui_aire_pay.ManualFloat(frm_rp_dui_aire_pay.BoundsRect );
frm_main.freeTabs('frm_rp_dui_aire_pay');
action:=cafree;
frm_rp_dui_aire_pay:=nil;
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinPanel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.width/10);
bsSkinButton9.width:=i;
bsSkinButton12.width:=i;
bsSkinButton10.width:=i;
bsSkinButton1.width:=i;
bsSkinButton2.width:=i;
bsSkinButton4.width:=i;
bsSkinButton3.width:=i;
bsSkinButton11.width:=i;
bsSkinButton6.width:=i;
end;
procedure Tfrm_rp_dui_aire_pay.t_ch_duiAfterInsert(DataSet: TDataSet);
begin
t_ch_dui['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_ch_dui['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_ch_dui['<27><><EFBFBD><EFBFBD>']:=6;
if not t_ch_fee.IsEmpty then
t_ch_dui['<27><><EFBFBD>ʿͻ<CABF>']:=t_ch_fee.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
procedure Tfrm_rp_dui_aire_pay.t_ch_duiBeforePost(DataSet: TDataSet);
begin
table_before_post(t_ch_dui,'<27><><EFBFBD>ʿͻ<CABF>');
if t_ch_dui.State=dsinsert then
begin
t_ch_dui['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=get_no(date,'D6');
end;
modify_all:=true;
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton1Click(Sender: TObject);
begin
t_ch_dui.insert;
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_ch_dui);
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton4Click(Sender: TObject);
var
str:widestring;
begin
if t_ch_dui.IsEmpty then
exit;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)<>IDOK then
exit;
t_bill_fee.first;
while not t_bill_fee.eof do
begin
str:='update t_ch_fee set <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0,<2C><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>=null'
+' where <20><><EFBFBD><EFBFBD>='+''''+t_bill_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+''''
+' and <20><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>='+''''+t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring+'''';
p_update.Parameters.ParamByName('SQLStr').value:=str;
p_update.ExecProc;
if t_ch_dui_bill.Locate('<27><><EFBFBD><EFBFBD>',t_bill_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,[])then
t_ch_dui_bill.delete;
t_bill_fee.next;
end;
t_ch_dui.delete;
if t_op_seae.Active then
t_op_seae.Requery();
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_ch_dui);
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton11Click(Sender: TObject);
var
answer:TModalResult;
begin
if bsSkinButton11.Caption='<27><EFBFBD>޸<EFBFBD>' then
begin
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end
else
begin
if (t_ch_dui.State=dsinsert)or(t_ch_dui.State=dsedit) then
BEGIN
answer:=messagedlg( '<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE>޸ģ<DEB8><C4A3>Ƿ񱣴棿',mtWarning,mbYesNoCancel,0);
if answer=mrYes then
begin
t_ch_dui.post;
end;
if answer=mrNo then
begin
t_ch_dui.cancel;
end;
if answer=mrCancel then
begin
exit;
end;
END;
Notebook1.PageIndex:=0;
bsSkinButton11.Caption:='<27><EFBFBD>޸<EFBFBD>';
end;
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton12Click(Sender: TObject);
begin
try
if not assigned(frm_rp_dui_format) then
frm_rp_dui_format:=tfrm_rp_dui_format.Create (self);
dui_format_type:=6;
frm_rp_dui_format.showmodal;
finally
frm_rp_dui_format.free;
frm_rp_dui_format:=nil;
t_ch_dui_format.requery;
end;
end;
procedure Tfrm_rp_dui_aire_pay.FormShow(Sender: TObject);
var
str:widestring;
begin
t_ch_dui_format.Parameters[0].value:=6;
t_ch_dui_format.open;
str:='select top 50 * from t_ch_dui ';
str:=str+' where <20><><EFBFBD><EFBFBD>=6 and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+employee+''''+' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc';
t_ch_dui.close;
t_ch_dui.SQL.clear;
t_ch_dui.sql.Add(str);
modify_all:=true;
t_ch_dui.open;
t_ch_dui_bill.open;
v_dui_bill.open;
v_dui_fee.Parameters.ParamByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').value:=t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring;
v_dui_fee.open;
modify_all:=false;
frm_data_share.t_crm_client_all.requery;
if t_ch_dui.fieldbyname('DM_ID').asstring<>''then
if t_ch_dui_format.Locate('DM_ID',t_ch_dui.fieldbyname('DM_ID').asinteger,[])then
begin
dui_grid(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,dxdbgrid2);
t_bill_fee.close;
t_bill_fee.Parameters.ParamByName('SQLStr').value:=dui_sql(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,'t_op_aire',t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring);
t_bill_fee.open;
end;
frm_data_share.t_crm_client_all.requery;
end;
procedure Tfrm_rp_dui_aire_pay.t_ch_duiAfterScroll(DataSet: TDataSet);
begin
if not modify_all then
begin
if t_ch_dui.fieldbyname('DM_ID').asstring<>''then
if t_ch_dui_format.Locate('DM_ID',t_ch_dui.fieldbyname('DM_ID').asinteger,[])then
begin
dui_grid(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,dxdbgrid2);
t_bill_fee.close;
t_bill_fee.Parameters.ParamByName('SQLStr').value:=dui_sql(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,'t_op_aire',t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring);
t_bill_fee.open;
end
else
t_bill_fee.close;
end;
if v_dui_fee.active then
begin
v_dui_fee.close;
v_dui_fee.Parameters.ParamByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').value:=t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring;
v_dui_fee.open;
end;
end;
procedure Tfrm_rp_dui_aire_pay.RxDBLookupCombo3Change(Sender: TObject);
begin
if (t_ch_dui.state=dsinsert)or(t_ch_dui.state=dsedit) then
if t_ch_dui.fieldbyname('DM_ID').asstring<>''then
if t_ch_dui_format.Locate('DM_ID',t_ch_dui.fieldbyname('DM_ID').asinteger,[])then
begin
dui_grid(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,dxdbgrid2);
t_bill_fee.close;
t_bill_fee.Parameters.ParamByName('SQLStr').value:=dui_sql(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,'t_op_aire',t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring);
t_bill_fee.open;
end
else
t_bill_fee.close;
end;
procedure Tfrm_rp_dui_aire_pay.N1Click(Sender: TObject);
var
i,k:integer;
begin
if t_op_seae.IsEmpty then
exit;
if t_ch_dui.IsEmpty then
exit;
if t_ch_dui.FieldByName('<27><><EFBFBD>ʿͻ<CABF>').asstring='' then
begin
t_ch_dui.edit;
t_ch_dui['<27><><EFBFBD>ʿͻ<CABF>']:=t_ch_fee.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_dui.post;
end;
if dxDBGrid3.SelectedCount>=1 then
begin
for i:=0 to dxDBGrid3.SelectedCount-1 do
begin
t_op_seae.GotoBookmark(pointer(dxDBGrid3.selectedrows[i]));
t_ch_fee.first;
while not t_ch_fee.Eof do
begin
if t_ch_dui.FieldByName('<27><><EFBFBD>ʿͻ<CABF>').asstring<>t_ch_fee.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring then
begin
showmessage('<27><>ǰ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
t_ch_fee.next;
end;
end;
end
else
begin
t_ch_fee.first;
while not t_ch_fee.Eof do
begin
if t_ch_dui.FieldByName('<27><><EFBFBD>ʿͻ<CABF>').asstring<>t_ch_fee.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring then
begin
showmessage('<27><>ǰ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
t_ch_fee.next;
end;
end;
if (t_ch_dui.state=dsinsert)or(t_ch_dui.state=dsedit) then
t_ch_dui.Post;
if dxDBGrid3.SelectedCount>=1 then
begin
for i:=0 to dxDBGrid3.SelectedCount-1 do
begin
t_op_seae.GotoBookmark(pointer(dxDBGrid3.selectedrows[i]));
if not t_ch_fee.IsEmpty then
begin
t_ch_dui_bill.insert;
t_ch_dui_bill['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=t_ch_dui.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring;
t_ch_dui_bill['<27><><EFBFBD><EFBFBD>']:=t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_dui_bill.post;
t_ch_fee.first;
while not t_ch_fee.Eof do
begin
t_ch_fee.edit;
t_ch_fee['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_ch_fee['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=t_ch_dui.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring;
t_ch_fee.post;
t_ch_fee.next;
end;
end;
end;
end
else
begin
if not t_ch_fee.IsEmpty then
begin
t_ch_dui_bill.insert;
t_ch_dui_bill['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=t_ch_dui.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring;
t_ch_dui_bill['<27><><EFBFBD><EFBFBD>']:=t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_dui_bill.post;
t_ch_fee.first;
while not t_ch_fee.Eof do
begin
t_ch_fee.edit;
t_ch_fee['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_ch_fee['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=t_ch_dui.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring;
t_ch_fee.post;
t_ch_fee.next;
end;
end;
end;
t_op_seae.requery;
t_bill_fee.close;
t_bill_fee.Parameters.ParamByName('SQLStr').value:=dui_sql(t_ch_dui_format.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring,'t_op_aire',t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring);
t_bill_fee.open;
v_dui_bill.requery;
end;
procedure Tfrm_rp_dui_aire_pay.RxDBLookupCombo1Enter(Sender: TObject);
begin
if t_ch_dui_bill.IsEmpty then
RxDBLookupCombo1.ReadOnly:=false
else
RxDBLookupCombo1.ReadOnly:=true;
end;
procedure Tfrm_rp_dui_aire_pay.N2Click(Sender: TObject);
var
i:integer;
str:widestring;
begin
if t_bill_fee.IsEmpty then
exit;
if t_ch_dui.IsEmpty then
exit;
if dxDBGrid2.SelectedCount>=1 then
begin
for i:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_bill_fee.GotoBookmark(pointer(dxDBGrid2.selectedrows[i]));
str:='update t_ch_fee set <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0,<2C><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>=null'
+' where <20><><EFBFBD><EFBFBD>='+''''+t_bill_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+''''
+' and <20><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>='+''''+t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring+'''';
p_update.Parameters.ParamByName('SQLStr').value:=str;
p_update.ExecProc;
if t_ch_dui_bill.Locate('<27><><EFBFBD><EFBFBD>',t_bill_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,[])then
t_ch_dui_bill.delete;
end;
end
else
begin
str:='update t_ch_fee set <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0,<2C><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>=null'
+' where <20><><EFBFBD><EFBFBD>='+''''+t_bill_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+''''
+' and <20><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>='+''''+t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring+'''';
p_update.Parameters.ParamByName('SQLStr').value:=str;
p_update.ExecProc;
if t_ch_dui_bill.Locate('<27><><EFBFBD><EFBFBD>',t_bill_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,[])then
t_ch_dui_bill.delete;
end;
t_bill_fee.requery;
if t_op_seae.Active then
t_op_seae.Requery();
v_dui_bill.Requery();
end;
procedure Tfrm_rp_dui_aire_pay.dxDBGrid2ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,t_bill_fee,'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_dui_aire_pay.dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort(Column,t_ch_dui,'<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>');
end;
procedure Tfrm_rp_dui_aire_pay.t_ch_duiAfterPost(DataSet: TDataSet);
begin
modify_all:=false;
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton9Click(Sender: TObject);
begin
if t_ch_dui.IsEmpty then
exit;
if t_ch_dui.fieldbyname('DM_ID').asstring='' then
exit;
if t_ch_dui.fieldbyname('DM_ID').asstring='0' then
exit;
try
modify_all:=true;
t_ch_dui.DisableControls;
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+t_ch_dui.fieldbyname('DM_ID').asstring,2,t_ch_dui1,nil,nil,nil,t_bill_fee1,NIL,NIL,NIL,nil,nil,nil);
finally
t_ch_dui.EnableControls;
modify_all:=false;
end;
end;
procedure Tfrm_rp_dui_aire_pay.N4Click(Sender: TObject);
begin
grid_save_xls(dxDBGrid2);
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton10Click(Sender: TObject);
begin
try
if not assigned(frm_rp_dui_query) then
frm_rp_dui_query:=tfrm_rp_dui_query.Create (self);
dui_query_num:=6;
frm_rp_dui_query.showmodal;
finally
frm_rp_dui_query.free;
frm_rp_dui_query:=nil;
end;
end;
procedure Tfrm_rp_dui_aire_pay.t_ch_duiBeforeCancel(DataSet: TDataSet);
begin
modify_all:=true;
end;
procedure Tfrm_rp_dui_aire_pay.bsSkinButton6Click(Sender: TObject);
begin
if t_ch_dui.IsEmpty then
exit;
try
modify_all:=true;
t_ch_dui.DisableControls;
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',2,t_ch_dui1,nil,nil,nil,v_dui_bill1,v_dui_fee1,NIL,NIL,nil,nil,nil);
finally
t_ch_dui.EnableControls;
modify_all:=false;
end;
end;
procedure Tfrm_rp_dui_aire_pay.N5Click(Sender: TObject);
var
i:integer;
str:widestring;
begin
if v_dui_bill.IsEmpty then
exit;
if dxDBGrid6.SelectedCount>=1 then
begin
for i:=0 to dxDBGrid6.SelectedCount-1 do
begin
v_dui_bill.GotoBookmark(pointer(dxDBGrid6.selectedrows[i]));
str:='update t_ch_fee set <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0,<2C><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>=null'
+' where <20><><EFBFBD><EFBFBD>='+''''+v_dui_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+''''
+' and <20><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>='+''''+t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring+'''';
p_update.Parameters.ParamByName('SQLStr').value:=str;
p_update.ExecProc;
if t_ch_dui_bill.Locate('<27><><EFBFBD><EFBFBD>',v_dui_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,[])then
t_ch_dui_bill.delete;
end;
end
else
begin
str:='update t_ch_fee set <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0,<2C><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>=null'
+' where <20><><EFBFBD><EFBFBD>='+''''+v_dui_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+''''
+' and <20><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>='+''''+t_ch_dui.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring+'''';
p_update.Parameters.ParamByName('SQLStr').value:=str;
p_update.ExecProc;
if t_ch_dui_bill.Locate('<27><><EFBFBD><EFBFBD>',v_dui_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,[])then
t_ch_dui_bill.delete;
end;
t_bill_fee.requery;
if t_op_seae.Active then
t_op_seae.Requery();
v_dui_bill.Requery();
end;
end.