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.

461 lines
14 KiB
Plaintext

11 months ago
unit u_ch_custbefbal_do;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, bsSkinTabs, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl,
dxDBGrid, dxDBTLCl, dxGrClms, Menus, StdCtrls, XPMenu, Grids, DBGridEh,
bsSkinCtrls, RxMemDS;
type
Tfra_ch_custbefbal_do = class(TFrame)
do_ban1: TDataSource;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
XPMenu1: TXPMenu;
t_ch_cust_befbal_sum: TADOQuery;
t_ch_cust_befbal_sum1: TDataSource;
t_ch_cust_befbal1: TDataSource;
t_ch_cust_befbal: TADOQuery;
PopupMenu2: TPopupMenu;
MenuItem1: TMenuItem;
PopupMenu3: TPopupMenu;
N7: TMenuItem;
t_ch_cust_befbalnew: TADOQuery;
t_rate: TRxMemoryData;
N2: TMenuItem;
N3: TMenuItem;
bsSkinGroupBox2: TbsSkinGroupBox;
dxDBGrid12: TdxDBGrid;
dxDBGridMaskColumn59: TdxDBGridMaskColumn;
dxDBGridMaskColumn60: TdxDBGridMaskColumn;
dxDBGridMaskColumn61: TdxDBGridMaskColumn;
dxDBGridMaskColumn63: TdxDBGridMaskColumn;
dxDBGridColumn28: TdxDBGridColumn;
dxDBGrid12Column6: TdxDBGridColumn;
dxDBGrid12Column7: TdxDBGridColumn;
bsSkinGroupBox1: TbsSkinGroupBox;
dxDBGrid11: TdxDBGrid;
dxDBGrid11Column1: TdxDBGridColumn;
dxDBGrid11Column4: TdxDBGridColumn;
dxDBGrid11Column2: TdxDBGridColumn;
dxDBGrid11Column3: TdxDBGridColumn;
bs_text: TEdit;
procedure MenuItem1Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses u_main, my_sys_function, u_fee_do_fen;
{$R *.dfm}
procedure Tfra_ch_custbefbal_do.MenuItem1Click(Sender: TObject);
var
i:integer;
delete_num:real;
usddelete_num:real;
rmbdelete_num:real;
RE:Boolean;
begin
RE:=TRUE;
if (bs_text.Text='3') then begin
if (do_ban1.DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>') then begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
end;
do_ban1.DataSet.Edit;
delete_num:=0;
if t_ch_cust_befbal.IsEmpty then
exit;
if_ch_delete_do:=true;
delete_do_type_num:=1;
delete_num:=delete_num+t_ch_cust_befbal.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_cust_befbal.Delete;
if (delete_num<>0) then
begin
do_ban1.DataSet.edit;
do_ban1.DataSet['Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']-delete_num;
do_ban1.DataSet.post;
end;
t_ch_cust_befbal.Requery();
t_ch_cust_befbal_sum.Requery();
end;
procedure Tfra_ch_custbefbal_do.N7Click(Sender: TObject);
var
do_num:real;
i:integer;
jia_num:real;
rate_num:real;
if_hexiao:boolean;
begin
if t_ch_cust_befbal_sum.IsEmpty then
exit;
case strtoint(bs_text.Text) of
3,4:
begin
if (do_ban1.DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>')then
begin
if (do_ban1.DataSet.FieldByName('<27>ʵ<EFBFBD>״̬').asstring<>'ȷ<>Ϻ<EFBFBD><CFBA><EFBFBD>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if_hexiao:=true;
end
else
if_hexiao:=false;
if (do_ban1.DataSet.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if not do_ban1.DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
if Logininfo.endday>do_ban1.DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime then begin
MessageDlg('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><E3B5A5><EFBFBD><EFBFBD>ĩ<EFBFBD><C4A9><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>޸Ļ<DEB8>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ˣ<EFBFBD>',mtError,[mbok],0);
exit;
end;
end;
end;
if (do_ban1.DataSet.State=dsinsert)or(do_ban1.DataSet.State=dsedit)then
begin
end else begin
do_ban1.DataSet.edit;
end;
jia_num:=0;
if not t_ch_cust_befbalnew.Active then t_ch_cust_befbalnew.Open;
t_rate.open;
t_ch_cust_befbalnew.Insert;
t_ch_cust_befbalnew['<27><>ʽ']:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_ch_cust_befbalnew['״̬']:='¼<><C2BC>״̬';
t_ch_cust_befbalnew['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_ch_cust_befbalnew['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD>ʽ']:=do_ban1.DataSet['<27><><EFBFBD>ʽ'];
t_ch_cust_befbalnew['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>'];
t_ch_cust_befbalnew['Ԥ<>ս<EFBFBD><D5BD><EFBFBD>']:=0;
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
if do_ban1.DataSet.FieldByName('<27>ұ<EFBFBD>').asstring=t_ch_cust_befbal_sum.fieldbyname('<27>ұ<EFBFBD>').asstring then
begin
t_ch_cust_befbalnew['<27>ұ<EFBFBD>']:=do_ban1.DataSet['<27>ұ<EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>']:=do_ban1.DataSet['<27>ұ<EFBFBD>'];
t_ch_cust_befbalnew['Ԥ<>ս<EFBFBD><D5BD><EFBFBD>']:=t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat;
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat;
case strtoint(bs_text.Text) of
3:
begin
if t_ch_cust_befbal_sum.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>'then
jia_num:=jia_num+t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat
else
jia_num:=jia_num-t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat;
end;
4:
begin
if t_ch_cust_befbal_sum.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>'then
jia_num:=jia_num+t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat
else
jia_num:=jia_num-t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat;
end;
end;
end
else
begin
rate_num:=get_zh_cur(t_rate,t_ch_cust_befbal_sum.fieldbyname('<27>ұ<EFBFBD>').asstring,do_ban1.DataSet.FieldByName('<27>ұ<EFBFBD>').asstring);
if rate_num=-1 then
begin
t_ch_cust_befbalnew.Cancel;
do_ban1.DataSet['Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=jia_num;
do_ban1.dataset.post;
// update_table(bs_text,do_ban1,nil,t_ch_fee,t_ch_fee_sum,2,jia_num,str1,str2,add_fee,add_bill);
t_ch_cust_befbal.Requery();
t_ch_cust_befbal_sum.Requery();
exit;
end
else
begin
t_ch_cust_befbalnew['<27>ұ<EFBFBD>']:=t_ch_cust_befbal_sum['<27>ұ<EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>']:=do_ban1.DataSet['<27>ұ<EFBFBD>'];
t_ch_cust_befbalnew['Ԥ<>ս<EFBFBD><D5BD><EFBFBD>']:=t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat;
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=s_w(strtoint(apointnum),t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat*rate_num);
case strtoint(bs_text.Text) of
3:
begin
if t_ch_cust_befbal_sum.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>'then
jia_num:=jia_num+s_w(strtoint(apointnum),t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat*rate_num)
else
jia_num:=jia_num-s_w(strtoint(apointnum),t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat*rate_num);
end;
4:
begin
if t_ch_cust_befbal_sum.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>'then
jia_num:=jia_num+s_w(strtoint(apointnum),t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat*rate_num)
else
jia_num:=jia_num-s_w(strtoint(apointnum),t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat*rate_num);
end;
end;
end;
end;
t_ch_cust_befbalnew.post;
do_ban1.DataSet['Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=jia_num;
do_ban1.dataset.post;
t_ch_cust_befbal.Requery();
t_ch_cust_befbal_sum.Requery();
end;
procedure Tfra_ch_custbefbal_do.N3Click(Sender: TObject);
var
can_do_num,do_num:real;
rate_num,jia_num:real;
if_hexiao:boolean;
str1,str2:Tstringlist;
bk:TBookmark;
begin
case strtoint(bs_text.Text) of
3,4:
begin
if (do_ban1.DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring='<27><><EFBFBD><EFBFBD>')then
begin
if (do_ban1.DataSet.FieldByName('<27>ʵ<EFBFBD>״̬').asstring<>'ȷ<>Ϻ<EFBFBD><CFBA><EFBFBD>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if_hexiao:=true;
end
else
if_hexiao:=false;
if (do_ban1.DataSet.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if not do_ban1.DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
if Logininfo.endday>do_ban1.DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime then begin
MessageDlg('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><E3B5A5><EFBFBD><EFBFBD>ĩ<EFBFBD><C4A9><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>޸Ļ<DEB8>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ˣ<EFBFBD>',mtError,[mbok],0);
exit;
end;
end;
end;
if t_ch_cust_befbal_sum.IsEmpty then
exit;
if (do_ban1.DataSet.State=dsinsert)or(do_ban1.DataSet.State=dsedit)then
begin
end else begin
do_ban1.DataSet.edit;
end;
jia_num:=0;
if not t_ch_cust_befbalnew.Active then t_ch_cust_befbalnew.Open;
t_rate.open;
t_ch_cust_befbalnew.Insert;
t_ch_cust_befbalnew['<27><>ʽ']:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_ch_cust_befbalnew['״̬']:='¼<><C2BC>״̬';
t_ch_cust_befbalnew['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_ch_cust_befbalnew['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD>ʽ']:=do_ban1.DataSet['<27><><EFBFBD>ʽ'];
t_ch_cust_befbalnew['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD><EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>']:=do_ban1.DataSet['<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>'];
t_ch_cust_befbalnew['Ԥ<>ս<EFBFBD><D5BD><EFBFBD>']:=0;
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
if do_ban1.DataSet.FieldByName('<27>ұ<EFBFBD>').asstring=t_ch_cust_befbal_sum.fieldbyname('<27>ұ<EFBFBD>').asstring then
begin
try
frm_fee_do_fen:=Tfrm_fee_do_fen.Create(application);
case strtoint(bs_text.Text) of
3,4:
begin
if not do_ban1.DataSet.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
if can_do_num>t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat then
frm_fee_do_fen.Edit2.text:=floattostr(t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat)
else
frm_fee_do_fen.Edit2.text:=floattostr(can_do_num);
end
else
frm_fee_do_fen.Edit2.text:=floattostr(t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat);
end;
end;
frm_fee_do_fen.ShowModal;
if frm_fee_do_fen.ModalResult = mrOk then
begin
do_num:=strtofloat(frm_fee_do_fen.Edit1.text);
end
else
begin
do_num:=0;
end;
finally
frm_fee_do_fen.Free;
frm_fee_do_fen:=nil;
end;
if do_num=0 then
begin
t_ch_cust_befbalnew.Cancel;
exit;
end;
case strtoint(bs_text.Text) of
3,4:
begin
if ((t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat>0) and(do_num>t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat)) or ((t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat<0) and(do_num<t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat)) then
begin
showmessage('<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĽ<D0B5><C4BD>');
t_ch_cust_befbalnew.Cancel;
exit;
end;
end;
end;
t_ch_cust_befbalnew['<27>ұ<EFBFBD>']:=do_ban1.DataSet['<27>ұ<EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>']:=do_ban1.DataSet['<27>ұ<EFBFBD>'];
t_ch_cust_befbalnew['Ԥ<>ս<EFBFBD><D5BD><EFBFBD>']:=t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat;
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat;
case strtoint(bs_text.Text) of
3:
begin
if t_ch_cust_befbal_sum.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>'then
jia_num:=jia_num+do_num
else
jia_num:=jia_num-do_num;
end;
4:
begin
if t_ch_cust_befbal_sum.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>'then
jia_num:=jia_num+do_num
else
jia_num:=jia_num-do_num;
end;
end;
end
else
begin
rate_num:=get_zh_cur(t_rate,t_ch_cust_befbal_sum.fieldbyname('<27>ұ<EFBFBD>').asstring,do_ban1.DataSet.FieldByName('<27>ұ<EFBFBD>').asstring);
if rate_num=-1 then
begin
t_ch_cust_befbalnew.Cancel;
exit;
end
else
begin
try
frm_fee_do_fen:=Tfrm_fee_do_fen.Create(application);
case strtoint(bs_text.Text) of
3,4:
begin
if not do_ban1.DataSet.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
if can_do_num/rate_num>t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat then
frm_fee_do_fen.Edit2.text:=floattostr(t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat)
else
frm_fee_do_fen.Edit2.text:=floattostr(can_do_num/rate_num);
end
else
frm_fee_do_fen.Edit2.text:=floattostr(t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat);
end;
end;
frm_fee_do_fen.ShowModal;
if frm_fee_do_fen.ModalResult = mrOk then
begin
do_num:=strtofloat(frm_fee_do_fen.Edit1.text);
end
else
begin
do_num:=0;
end;
finally
frm_fee_do_fen.Free;
frm_fee_do_fen:=nil;
end;
if do_num=0 then
begin
t_ch_cust_befbalnew.Cancel;
exit;
end;
case strtoint(bs_text.Text) of
3,4:
begin
if ((t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat>0) and(do_num>t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat)) or ((t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat<0) and(do_num<t_ch_cust_befbal_sum.fieldbyname('Ԥ<>ս<EFBFBD><D5BD><EFBFBD>').asfloat)) then
begin
showmessage('<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĽ<D0B5><C4BD>');
t_ch_cust_befbalnew.Cancel;
exit;
end;
end;
end;
t_ch_cust_befbalnew['<27>ұ<EFBFBD>']:=t_ch_cust_befbal_sum['<27>ұ<EFBFBD>'];
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>']:=do_ban1.DataSet['<27>ұ<EFBFBD>'];
t_ch_cust_befbalnew['Ԥ<>ս<EFBFBD><D5BD><EFBFBD>']:=do_num;
t_ch_cust_befbalnew['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=do_num*rate_num;
case strtoint(bs_text.Text) of
3:
begin
if t_ch_cust_befbal_sum.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>'then
jia_num:=jia_num+do_num*rate_num
else
jia_num:=jia_num-do_num*rate_num;
end;
4:
begin
if t_ch_cust_befbal_sum.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>'then
jia_num:=jia_num+do_num*rate_num
else
jia_num:=jia_num-do_num*rate_num;
end;
end;
end;
end;
t_ch_cust_befbalnew.Post;
do_ban1.DataSet['Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=jia_num;
do_ban1.dataset.post;
t_ch_cust_befbal.Requery();
t_ch_cust_befbal_sum.Requery();
end;
end.