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.

366 lines
11 KiB
Plaintext

11 months ago
unit u_ch_cust_befbal;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RxLookup, StdCtrls, bsSkinCtrls, BusinessSkinForm, dxExEdtr,
DBCtrls, Grids, Wwdbigrd, Wwdbgrid, bsdbctrls, wwdblook,
wwdbdatetimepicker, Mask, wwdbedit, Wwdotdot, Wwdbcomb, dxDBTLCl,
dxGrClms, dxDBCtrl, dxDBGrid, dxTL, dxCntner, ComCtrls, bsSkinTabs,
ExtCtrls, DB, ADODB, Menus;
type
Tfrm_ch_cust_befbal = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
Panel2: TPanel;
bsSkinButton9: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton38: TbsSkinButton;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinPanel4: TbsSkinPanel;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column9: TdxDBGridColumn;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column14: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column114: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridMaskColumn;
dxDBGrid1Column13: TdxDBGridColumn;
dxDBGrid1Column32: TdxDBGridColumn;
bsSkinPanel3: TbsSkinPanel;
Label39: TLabel;
Label9: TLabel;
Label3: TLabel;
Label7: TLabel;
wwDBComboBox44: TwwDBComboBox;
RxDBLookupCombo2: TRxDBLookupCombo;
wwDBDateTimePicker5: TwwDBDateTimePicker;
wwDBDateTimePicker6: TwwDBDateTimePicker;
bsSkinButton10: TbsSkinButton;
bsSkinTabSheet2: TbsSkinTabSheet;
t_ch_cust_befbal1: TDataSource;
t_ch_cust_befbal: TADOQuery;
dxDBGrid1Column11: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridColumn;
dxDBGrid1Column15: TdxDBGridColumn;
dxDBGrid1Column16: TdxDBGridColumn;
dxDBGrid1Column17: TdxDBGridColumn;
Label25: TLabel;
DBEdit14: TDBEdit;
RxDBLookupCombo1: TRxDBLookupCombo;
Label12: TLabel;
Label1: TLabel;
wwDBComboBox1: TwwDBComboBox;
Label2: TLabel;
RxDBLookupCombo3: TRxDBLookupCombo;
DBEdit4: TDBEdit;
Label4: TLabel;
Label6: TLabel;
RxDBLookupCombo4: TRxDBLookupCombo;
RxDBLookupCombo17: TRxDBLookupCombo;
DBEdit9: TDBEdit;
Label8: TLabel;
Label5: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
DBMemo1: TDBMemo;
Label10: TLabel;
Label11: TLabel;
DBEdit1: TDBEdit;
Label13: TLabel;
DBEdit2: TDBEdit;
Label14: TLabel;
wwDBDateTimePicker2: TwwDBDateTimePicker;
bsSkinButton6: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
Label15: TLabel;
DBEdit3: TDBEdit;
Label16: TLabel;
RxDBLookupCombo5: TRxDBLookupCombo;
dxDBGrid1Column18: TdxDBGridColumn;
dxDBGrid1Column19: TdxDBGridColumn;
Label17: TLabel;
wwDBComboBox2: TwwDBComboBox;
dxDBGrid1Column20: TdxDBGridColumn;
dxDBGrid1Column21: TdxDBGridColumn;
PopupMenu2: TPopupMenu;
MenuItem4: TMenuItem;
MenuItem5: TMenuItem;
N21: TMenuItem;
N22: TMenuItem;
N20: TMenuItem;
Label18: TLabel;
DBEdit5: TDBEdit;
dxDBGrid1Column22: TdxDBGridColumn;
procedure bsSkinButton2Click(Sender: TObject);
procedure t_ch_cust_befbalAfterInsert(DataSet: TDataSet);
procedure t_ch_cust_befbalBeforeEdit(DataSet: TDataSet);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton38Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure RxDBLookupCombo4Change(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure t_ch_cust_befbalBeforePost(DataSet: TDataSet);
procedure dxDBGrid1DblClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton9Click(Sender: TObject);
procedure N20Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_cust_befbal: Tfrm_ch_cust_befbal;
implementation
uses u_main, u_data_share, my_sys_function, u_sys_progress;
{$R *.dfm}
procedure Tfrm_ch_cust_befbal.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_ch_cust_befbal);
end;
procedure Tfrm_ch_cust_befbal.t_ch_cust_befbalAfterInsert(
DataSet: TDataSet);
begin
t_ch_cust_befbal['״̬']:='¼<><C2BC>״̬';
t_ch_cust_befbal['<27><>ʽ']:='<27>ֶ<EFBFBD>¼<EFBFBD><C2BC>';
t_ch_cust_befbal['<27><><EFBFBD><EFBFBD>']:='<27><>';
t_ch_cust_befbal['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_ch_cust_befbal['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_ch_cust_befbal['<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>']:=get_no(date,'BD');;
end;
procedure Tfrm_ch_cust_befbal.t_ch_cust_befbalBeforeEdit(
DataSet: TDataSet);
var
aQuery:TAdoQuery;
begin
if not modify_all then
begin
if t_ch_cust_befbal.FieldByName('<27><>ʽ').AsString<>'<27>ֶ<EFBFBD>¼<EFBFBD><C2BC>' then begin
showmessage('ֻ<><D6BB><EFBFBD>ֶ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>IJ<EFBFBD><C4B2>ܹ<EFBFBD>ɾ<EFBFBD><C9BE>');
abort;
end;
if t_ch_cust_befbal.FieldByName('״̬').AsString<>'¼<><C2BC>״̬' then begin
showmessage('ֻ<><D6BB>¼<EFBFBD><C2BC>״̬<D7B4>IJ<EFBFBD><C4B2>ܹ<EFBFBD>ɾ<EFBFBD><C9BE>');
abort;
end;
end;
if (t_ch_cust_befbal.FieldByName('<27><>ʽ').AsString='<27>ֶ<EFBFBD>¼<EFBFBD><C2BC>') and (t_ch_cust_befbal.FieldByName('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>').AsString<>'') then begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;sql.Clear;
sql.Add('select count(*) as ct from t_ch_cust_befbal where BFID<>'+t_ch_cust_befbal.FieldByName('BFID').AsString+' and <20>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>='''+t_ch_cust_befbal.FieldByName('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
open;
if fieldbyname('ct').AsInteger<>0 then begin
showmessage('<27>Ѿ<EFBFBD><D1BE>ô˷<C3B4><CBB7>ý<EFBFBD><C3BD><EFBFBD><E3B2BB><EFBFBD>޸Ļ<DEB8>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>');
abort;
end;
end;
finally
freeandnil(aQuery);
end;
end;
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton1Click(Sender: TObject);
begin
t_ch_cust_befbal.Insert;
bsSkinPageControl1.ActivePageIndex:=1;
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton4Click(Sender: TObject);
begin
table_delete(t_ch_cust_befbal);
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_ch_cust_befbal);
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton38Click(Sender: TObject);
var
book1:Tbookmark;
begin
book1:=t_ch_cust_befbal.GetBookmark;
t_ch_cust_befbal.Requery;
t_ch_cust_befbal.GotoBookmark(book1);
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton6Click(Sender: TObject);
begin
if t_ch_cust_befbal.FieldByName('״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'then
begin
showmessage('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
end
else
begin
try
t_ch_cust_befbal.Refresh;
modify_all:=true;
t_ch_cust_befbal.edit;
t_ch_cust_befbal['״̬']:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>';
t_ch_cust_befbal['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_ch_cust_befbal['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_ch_cust_befbal.post;
modify_all:=false;
except
modify_all:=false;
showmessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
end;
t_ch_cust_befbal.Refresh;
end;
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton8Click(Sender: TObject);
begin
if t_ch_cust_befbal.FieldByName('״̬').asstring='¼<><C2BC>״̬'then
begin
showmessage('û<>б<EFBFBD>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
end
else
begin
try
modify_all:=true;
t_ch_cust_befbal.edit;
t_ch_cust_befbal['״̬']:='¼<><C2BC>״̬';
t_ch_cust_befbal['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='';
t_ch_cust_befbal['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
t_ch_cust_befbal.post;
modify_all:=false;
except
modify_all:=false;
showmessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
end;
t_ch_cust_befbal.Refresh;
end;
end;
procedure Tfrm_ch_cust_befbal.RxDBLookupCombo4Change(Sender: TObject);
begin
if not frm_data_share.t_sys_bank.IsEmpty then
if frm_data_share.t_sys_bank.Locate('<27><><EFBFBD><EFBFBD>',RxDBLookupCombo4.DisplayValues[0],[])then begin
t_ch_cust_befbal['<27><><EFBFBD><EFBFBD>']:=frm_data_share.t_sys_bank.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end else begin
t_ch_cust_befbal['<27><><EFBFBD><EFBFBD>']:='';
end;
end;
procedure Tfrm_ch_cust_befbal.FormShow(Sender: TObject);
begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ򡣡<C8BA><F2A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=1;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
t_ch_cust_befbal.Close;
t_ch_cust_befbal.SQL.clear;
t_ch_cust_befbal.SQL.Add('select * from t_ch_cust_befbal where ״̬=''¼<><C2BC>״̬'' and '
+open_data('1003','¼<><C2BC><EFBFBD><EFBFBD>','no','no','no','no')
+' order by ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_ch_cust_befbal.open;
loadreggrid(dxdbgrid1,false,caption);
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.close;
frm_sys_progress:=nil;
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton10Click(Sender: TObject);
var
str:string;
begin
str:=' and '+open_data('1003','¼<><C2BC><EFBFBD><EFBFBD>','no','no','no','no');
if wwDBComboBox44.text<>''then
str:=str+' and ״̬='+''''+wwDBComboBox44.text+'''';
if RxDBLookupCombo2.DisplayValues[1]<>''then
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
if wwDBDateTimePicker5.text<>''then
str:=str+' and ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker5.text+'''';
if wwDBDateTimePicker6.text<>''then
str:=str+' and ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker6.text+'''';
t_ch_cust_befbal.Close;
t_ch_cust_befbal.SQL.clear;
t_ch_cust_befbal.SQL.Add('select * from t_ch_cust_befbal where 1=1 '
+str
+' order by <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_ch_cust_befbal.open;
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_cust_befbal.t_ch_cust_befbalBeforePost(
DataSet: TDataSet);
begin
table_before_post(t_ch_cust_befbal,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
table_before_post(t_ch_cust_befbal,'<27>ұ<EFBFBD>');
table_before_post(t_ch_cust_befbal,'<27><><EFBFBD><EFBFBD>');
end;
procedure Tfrm_ch_cust_befbal.dxDBGrid1DblClick(Sender: TObject);
begin
bsSkinPageControl1.ActivePageIndex:=1;
end;
procedure Tfrm_ch_cust_befbal.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption);
frm_ch_cust_befbal.Hide;
frm_ch_cust_befbal.ManualFloat(frm_ch_cust_befbal.BoundsRect );
frm_main.freeTabs('frm_ch_cust_befbal');
action:=cafree;
frm_ch_cust_befbal:=nil;
end;
procedure Tfrm_ch_cust_befbal.bsSkinButton9Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height));
PopupMenu2.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_ch_cust_befbal.N20Click(Sender: TObject);
begin
sys_print('<27>ͻ<EFBFBD>Ԥ<EFBFBD><D4A4>Ԥ<EFBFBD><D4A4>',TMenuItem(Sender).tag,t_ch_cust_befbal1,nil,nil,nil,nil,NIL,NIL,NIL,nil,nil,nil);
end;
end.