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.
261 lines
9.7 KiB
Plaintext
261 lines
9.7 KiB
Plaintext
unit u_ch_hexiao_do;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, bsSkinCtrls, StdCtrls, BusinessSkinForm, DBCtrls, Mask, RxLookup,
|
|
ComCtrls;
|
|
|
|
type
|
|
Tfrm_ch_hexiao_do = class(TForm)
|
|
bsSkinGroupBox1: TbsSkinGroupBox;
|
|
Label1: TLabel;
|
|
Edit1: TEdit;
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
bsSkinButton1: TbsSkinButton;
|
|
bsSkinButton2: TbsSkinButton;
|
|
Label6: TLabel;
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
Label7: TLabel;
|
|
Label10: TLabel;
|
|
Edit2: TEdit;
|
|
Memo1: TMemo;
|
|
Label2: TLabel;
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
Edit3: TEdit;
|
|
Label3: TLabel;
|
|
Label4: TLabel;
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
DateTimePicker1: TDateTimePicker;
|
|
Label5: TLabel;
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure RxDBLookupCombo3Enter(Sender: TObject);
|
|
procedure RxDBLookupCombo3Exit(Sender: TObject);
|
|
procedure RxDBLookupCombo1Enter(Sender: TObject);
|
|
procedure RxDBLookupCombo1Exit(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_ch_hexiao_do: Tfrm_ch_hexiao_do;
|
|
|
|
implementation
|
|
|
|
uses u_main, u_ch_balance_pay, u_data_share, my_sys_function,
|
|
u_sys_progress;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure Tfrm_ch_hexiao_do.bsSkinButton2Click(Sender: TObject);
|
|
begin
|
|
close;
|
|
end;
|
|
|
|
procedure Tfrm_ch_hexiao_do.bsSkinButton1Click(Sender: TObject);
|
|
var
|
|
i :integer;
|
|
str,str_feeValid:string;
|
|
begin
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='正在处理数据请等候。。。';
|
|
frm_sys_progress.Show;
|
|
|
|
bsSkinButton1.Enabled:=false;
|
|
str:=RxDBLookupCombo2.DisplayValue;
|
|
|
|
frm_main.db.BeginTrans;
|
|
with frm_ch_balance_pay do
|
|
try
|
|
ch_balance_pay_post:=false;
|
|
t_ch_balance.Insert;
|
|
t_ch_balance['结算类别']:='发票';
|
|
t_ch_balance['客户名称']:=t_ch_invoice_hexiao.Fieldbyname('客户名称').AsString;
|
|
t_ch_balance['结算方式']:=str;
|
|
t_ch_balance['结算日期']:=formatdatetime('YYYY-MM-DD',DateTimePicker1.date);
|
|
t_ch_balance['核销日期']:=formatdatetime('YYYY-MM-DD',DateTimePicker1.date);
|
|
t_ch_balance['币别']:=t_ch_invoice_hexiao.fieldbyname('币别').AsString;
|
|
t_ch_balance.fieldbyname('帐单编号').asstring:=get_no(date,'BP');
|
|
t_ch_balance['预结金额']:=0;
|
|
t_ch_balance['相关号码']:=frm_ch_hexiao_do.edit1.text;
|
|
t_ch_balance['美元相关号码']:=frm_ch_hexiao_do.edit3.text;
|
|
|
|
t_ch_balance['银行代码']:=frm_ch_hexiao_do.RxDBLookupCombo3.DisplayValues[0];
|
|
t_ch_balance['银行']:=frm_ch_hexiao_do.RxDBLookupCombo3.DisplayValues[1];
|
|
|
|
|
|
if StrToBool(get_parameters_value(83,'false')) then
|
|
begin
|
|
t_ch_balance['美元银行代码']:=frm_ch_hexiao_do.RxDBLookupCombo1.DisplayValues[0];
|
|
t_ch_balance['美元银行']:=frm_ch_hexiao_do.RxDBLookupCombo1.DisplayValues[1];
|
|
end;
|
|
|
|
t_ch_balance['凭证号码']:=frm_ch_hexiao_do.Edit2.text;
|
|
t_ch_balance['备注']:=frm_ch_hexiao_do.Memo1.text;
|
|
|
|
if dxDBGrid30.SelectedCount>0 then
|
|
begin
|
|
if v_fee_do_bscard.RecordCount>0 then
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=v_fee_do_bscard.RecordCount+2;
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
for i:=0 to dxDBGrid30.SelectedCount-1 do
|
|
begin
|
|
t_ch_invoice_hexiao.GotoBookmark(pointer(dxDBGrid30.selectedrows[i]));
|
|
t_ch_balance['结算金额']:=t_ch_balance['结算金额']+t_ch_invoice_hexiao.Fieldbyname('实际金额').AsCurrency;
|
|
t_ch_balance['实结金额']:=t_ch_balance['实结金额']+t_ch_invoice_hexiao.Fieldbyname('实际金额').AsCurrency;
|
|
if t_ch_invoice_hexiao.fieldbyname('币别').AsString='USD' then
|
|
t_ch_balance['美元金额']:=t_ch_balance['美元金额']+t_ch_invoice_hexiao.Fieldbyname('实际金额').AsCurrency;
|
|
if t_ch_invoice_hexiao.fieldbyname('币别').AsString='RMB' then
|
|
t_ch_balance['人民币金额']:=t_ch_balance['人民币金额']+t_ch_invoice_hexiao.Fieldbyname('实际金额').AsCurrency;
|
|
v_fee_do_bscard.first;
|
|
t_ch_fee_do.open;
|
|
while not v_fee_do_bscard.eof do
|
|
begin
|
|
t_ch_fee_do.insert;
|
|
t_ch_fee_do['工作编号']:=t_ch_balance.fieldbyname('帐单编号').asstring;
|
|
t_ch_fee_do['业务编号']:=v_fee_do_bscard.Fieldbyname('编号').AsString;
|
|
t_ch_fee_do['CH_ID']:=v_fee_do_bscard.Fieldbyname('CH_ID').AsInteger;
|
|
t_ch_fee_do['币别']:=v_fee_do_bscard.Fieldbyname('币别').AsString;
|
|
t_ch_fee_do['金额']:=v_fee_do_bscard.Fieldbyname('金额').AsString;
|
|
t_ch_fee_do['原始金额']:=v_fee_do_bscard.Fieldbyname('原始金额').AsCurrency;
|
|
t_ch_fee_do['类型']:='4';
|
|
t_ch_fee_do.Post;
|
|
Setfee(0,v_fee_do_bscard.fieldbyname('CH_ID').asinteger,v_fee_do_bscard.fieldByName('原始金额').AsCurrency);
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
v_fee_do_bscard.next;
|
|
end;
|
|
t_ch_invoice_hexiao.Edit;
|
|
t_ch_invoice_hexiao['帐单编号']:=t_ch_balance.fieldbyname('帐单编号').asstring;
|
|
t_ch_invoice_hexiao['是否结算']:=true;
|
|
t_ch_invoice_hexiao['结算日期']:=formatdatetime('YYYY-MM-DD',DateTimePicker1.date);
|
|
t_ch_invoice_hexiao['申请状态']:='支付完毕';
|
|
|
|
// t_ch_invoice_hexiao['支付方式']:=str;
|
|
// t_ch_invoice_hexiao['相关号码']:=frm_ch_hexiao_do.edit1.text;
|
|
t_ch_invoice_hexiao.post;
|
|
end;
|
|
end
|
|
else
|
|
begin
|
|
if v_fee_do_bscard.RecordCount>0 then
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=v_fee_do_bscard.RecordCount+2;
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
t_ch_balance['结算金额']:=t_ch_balance['结算金额']+t_ch_invoice_hexiao.Fieldbyname('实际金额').AsCurrency;
|
|
t_ch_balance['实结金额']:=t_ch_balance['实结金额']+t_ch_invoice_hexiao.Fieldbyname('实际金额').AsCurrency;
|
|
// t_ch_balance['虚结金额']:=t_ch_balance['虚结金额']+t_ch_invoice_hexiao.Fieldbyname('虚开金额').AsCurrency;
|
|
if t_ch_invoice_hexiao.fieldbyname('币别').AsString='USD' then
|
|
t_ch_balance['美元金额']:=t_ch_balance['美元金额']+t_ch_invoice_hexiao.Fieldbyname('实际金额').AsCurrency;
|
|
if t_ch_invoice_hexiao.fieldbyname('币别').AsString='RMB' then
|
|
t_ch_balance['人民币金额']:=t_ch_balance['人民币金额']+t_ch_invoice_hexiao.Fieldbyname('实际金额').AsCurrency;
|
|
v_fee_do_bscard.first;
|
|
t_ch_fee_do.open;
|
|
while not v_fee_do_bscard.eof do
|
|
begin
|
|
t_ch_fee_do.insert;
|
|
t_ch_fee_do['工作编号']:=t_ch_balance.fieldbyname('帐单编号').asstring;
|
|
t_ch_fee_do['业务编号']:=v_fee_do_bscard.Fieldbyname('编号').asstring;
|
|
t_ch_fee_do['CH_ID']:=v_fee_do_bscard.Fieldbyname('CH_ID').AsInteger;
|
|
t_ch_fee_do['币别']:=v_fee_do_bscard.Fieldbyname('币别').asstring;
|
|
t_ch_fee_do['金额']:=v_fee_do_bscard.Fieldbyname('金额').AsCurrency;
|
|
t_ch_fee_do['原始金额']:=v_fee_do_bscard.Fieldbyname('原始金额').AsCurrency;
|
|
t_ch_fee_do['类型']:='4';
|
|
t_ch_fee_do.Post;
|
|
Setfee(0,v_fee_do_bscard.fieldbyname('CH_ID').AsInteger,v_fee_do_bscard.fieldbyname('原始金额').AsCurrency);
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
v_fee_do_bscard.next;
|
|
end;
|
|
t_ch_invoice_hexiao.Edit;
|
|
t_ch_invoice_hexiao['帐单编号']:=t_ch_balance.fieldbyname('帐单编号').asstring;
|
|
t_ch_invoice_hexiao['是否结算']:=true;
|
|
t_ch_invoice_hexiao['结算日期']:=formatdatetime('YYYY-MM-DD',DateTimePicker1.date);
|
|
// t_ch_invoice_hexiao['支付方式']:=str;
|
|
// t_ch_invoice_hexiao['相关号码']:=frm_ch_hexiao_do.edit1.text;
|
|
t_ch_invoice_hexiao.post;
|
|
end;
|
|
t_ch_balance.Post;
|
|
|
|
dxDBGrid2.ClearSelection;
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
t_ch_balance.Requery();
|
|
// t_ch_balance.edit;
|
|
// t_ch_balance.post;
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
frm_main.db.CommitTrans;
|
|
finally
|
|
t_ch_invoice_hexiao.requery();
|
|
bsSkinButton1.Enabled:=true;
|
|
frm_sys_progress.Close;
|
|
frm_sys_progress.Free;
|
|
frm_sys_progress:=nil;
|
|
frm_ch_hexiao_do.close;
|
|
{
|
|
str_feeValid:=SetfeeValid(t_ch_balance.fieldbyname('帐单编号').asstring);
|
|
if trim(str_feeValid) <>'' then
|
|
begin
|
|
ShowMessage('请检查以下费用'+#13#10+str_feeValid);
|
|
end;
|
|
}
|
|
if frm_main.db.InTransaction then
|
|
begin
|
|
ShowMessage('支付费用时出错,请刷新重试!');
|
|
frm_main.db.RollbackTrans;
|
|
end;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure Tfrm_ch_hexiao_do.FormShow(Sender: TObject);
|
|
begin
|
|
DateTimePicker1.date:=Date;
|
|
if StrToBool(get_parameters_value(83,'false')) then begin
|
|
RxDBLookupCombo1.Visible:=TRUE;
|
|
Label2.Visible:=true;
|
|
Label3.Visible:=true;
|
|
edit3.Visible:=true;
|
|
end else begin
|
|
RxDBLookupCombo1.Visible:=false;
|
|
Label2.Visible:=false;
|
|
Label6.Caption:='银 行';
|
|
Label3.Visible:=false;
|
|
edit3.Visible:=false;
|
|
Label1.Caption:='相关号码';
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_ch_hexiao_do.RxDBLookupCombo3Enter(Sender: TObject);
|
|
begin
|
|
frm_data_share.t_sys_bank.Filtered:=false;
|
|
if StrToBool(get_parameters_value(83,'false')) then begin
|
|
frm_data_share.t_sys_bank.Filter:='币别=''RMB''';
|
|
frm_data_share.t_sys_bank.Filtered:=true;
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_ch_hexiao_do.RxDBLookupCombo3Exit(Sender: TObject);
|
|
begin
|
|
frm_data_share.t_sys_bank.Filtered:=false;
|
|
end;
|
|
|
|
procedure Tfrm_ch_hexiao_do.RxDBLookupCombo1Enter(Sender: TObject);
|
|
begin
|
|
frm_data_share.t_sys_bank.Filtered:=false;
|
|
frm_data_share.t_sys_bank.Filter:='币别=''USD''';
|
|
frm_data_share.t_sys_bank.Filtered:=true;
|
|
end;
|
|
|
|
procedure Tfrm_ch_hexiao_do.RxDBLookupCombo1Exit(Sender: TObject);
|
|
begin
|
|
frm_data_share.t_sys_bank.Filtered:=false;
|
|
end;
|
|
|
|
end.
|