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.

298 lines
10 KiB
Plaintext

11 months ago
unit u_ch_check_do;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, StdCtrls, BusinessSkinForm, DBCtrls, Mask, RxLookup,
ComCtrls;
type
Tfrm_ch_check_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;
Label134: TLabel;
RxDBLookupCombo19: TRxDBLookupCombo;
Label133: TLabel;
Label136: TLabel;
Edit4: TEdit;
Edit5: TEdit;
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_check_do: Tfrm_ch_check_do;
implementation
uses u_main, u_ch_balance_pay, u_data_share, my_sys_function,
u_sys_progress;
{$R *.dfm}
procedure Tfrm_ch_check_do.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_check_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:='<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ򡣡<C8BA><F2A1A3A1><EFBFBD>';
frm_sys_progress.Show;
bsSkinButton1.Enabled:=false;
frm_main.db.BeginTrans;
with frm_ch_balance_pay do
try
ch_balance_pay_post:=false;
t_ch_balance.Insert;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD><EFBFBD>';
t_ch_balance['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_check.Fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring:=get_no(date,'BP');
str:=RxDBLookupCombo2.DisplayValue;
t_ch_balance['<27><><EFBFBD>ʽ']:=str;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=formatdatetime('YYYY-MM-DD',DateTimePicker1.date);
// t_ch_balance.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=FormatDateTime('YYYY-MM-DD hh:mm:sss',DateTimePicker1.date);
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=formatdatetime('YYYY-MM-DD',DateTimePicker1.date);
t_ch_balance['<27>ұ<EFBFBD>']:=t_ch_check.fieldbyname('<27>ұ<EFBFBD>').AsString;
if trim(frm_ch_check_do.Edit4.Text)<>'' then
t_ch_balance['<27><><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>']:=StrToFloat(frm_ch_check_do.Edit4.Text);
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>']:=frm_ch_check_do.RxDBLookupCombo19.DisplayValues[0];
if trim(frm_ch_check_do.Edit5.Text)<>'' then
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=StrToFloat(frm_ch_check_do.Edit5.Text);
{
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_check['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_check['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>'];
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_check['<27><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'];
}
t_ch_balance['<27>Զ<EFBFBD>']:=t_ch_check['<27>Զ<EFBFBD>'];
t_ch_balance['Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
{
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=t_ch_check['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>'];
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=t_ch_check['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>'];
}
t_ch_balance['<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>']:=frm_ch_check_do.edit1.text;
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>']:=frm_ch_check_do.edit3.text;
t_ch_balance['<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>']:=frm_ch_check_do.RxDBLookupCombo3.DisplayValues[0];
t_ch_balance['<27><><EFBFBD><EFBFBD>']:=frm_ch_check_do.RxDBLookupCombo3.DisplayValues[1];
if StrToBool(get_parameters_value(83,'false')) then
begin
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD>д<EFBFBD><D0B4><EFBFBD>']:=frm_ch_check_do.RxDBLookupCombo1.DisplayValues[0];
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=frm_ch_check_do.RxDBLookupCombo1.DisplayValues[1];
end;
t_ch_balance['ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>']:=frm_ch_check_do.Edit2.text;
t_ch_balance['<27><>ע']:=frm_ch_check_do.Memo1.text;
if dxDBGrid2.SelectedCount>0 then
begin
if t_ch_fee_do_check.RecordCount>0 then
frm_sys_progress.bsSkinGauge1.MaxValue:=t_ch_fee_do_check.RecordCount+2;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
for i:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_ch_check.GotoBookmark(pointer(dxDBGrid2.selectedrows[i]));
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_check.Fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsCurrency;
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_check.Fieldbyname('ʵ<>ʽ<EFBFBD><CABD><EFBFBD>').AsCurrency;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_check.Fieldbyname('<27><EFBFBD><E9BFAA><EFBFBD><EFBFBD>').AsCurrency;
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']+t_ch_check.Fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').AsCurrency;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']+t_ch_check.Fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').AsCurrency;
t_ch_fee_do_check.Close;
t_ch_fee_do_check.open;
t_ch_fee_do_check.first;
t_ch_fee_do.open;
while not t_ch_fee_do_check.eof do
begin
t_ch_fee_do.insert;
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee_do_check.Fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_fee_do['CH_ID']:=t_ch_fee_do_check.Fieldbyname('CH_ID').AsInteger;
t_ch_fee_do['<27>ұ<EFBFBD>']:=t_ch_fee_do_check.Fieldbyname('<27>ұ<EFBFBD>').AsString;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_do_check.Fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee_do_check.Fieldbyname('ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>').AsCurrency;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:='4';
t_ch_fee_do.Post;
Setfee(0,t_ch_fee_do_check.fieldbyname('CH_ID').asinteger,t_ch_fee_do_check.fieldByName('ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>').AsCurrency);
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_ch_fee_do_check.next;
end;
t_ch_check.Edit;
t_ch_check['<27><><EFBFBD><EFBFBD>״̬']:='֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_ch_check['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_check['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_ch_check['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
t_ch_check['֧<><D6A7><EFBFBD><EFBFBD>ʽ']:=str;
t_ch_check['<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>']:=frm_ch_check_do.edit1.text;
t_ch_check.post;
end;
end
else
begin
if t_ch_fee_do_check.RecordCount>0 then
frm_sys_progress.bsSkinGauge1.MaxValue:=t_ch_fee_do_check.RecordCount+2;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_check.Fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsCurrency;
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_check.Fieldbyname('ʵ<>ʽ<EFBFBD><CABD><EFBFBD>').AsCurrency;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_check.Fieldbyname('<27><EFBFBD><E9BFAA><EFBFBD><EFBFBD>').AsCurrency;
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']+t_ch_check.Fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').AsCurrency;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']+t_ch_check.Fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').AsCurrency;
t_ch_fee_do_check.Close;
t_ch_fee_do_check.open;
t_ch_fee_do_check.first;
t_ch_fee_do.open;
while not t_ch_fee_do_check.eof do
begin
t_ch_fee_do.insert;
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee_do_check.Fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do['CH_ID']:=t_ch_fee_do_check.Fieldbyname('CH_ID').AsInteger;
t_ch_fee_do['<27>ұ<EFBFBD>']:=t_ch_fee_do_check.Fieldbyname('<27>ұ<EFBFBD>').asstring;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_do_check.Fieldbyname('<27><><EFBFBD><EFBFBD>').AsCurrency;
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee_do_check.Fieldbyname('ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>').AsCurrency;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:='4';
t_ch_fee_do.Post;
Setfee(0,t_ch_fee_do_check.fieldbyname('CH_ID').AsInteger,t_ch_fee_do_check.fieldbyname('ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>').AsCurrency);
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_ch_fee_do_check.next;
end;
t_ch_check.Edit;
t_ch_check['<27><><EFBFBD><EFBFBD>״̬']:='֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_ch_check['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_check['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_ch_check['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
t_ch_check['֧<><D6A7><EFBFBD><EFBFBD>ʽ']:=str;
t_ch_check['<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>']:=frm_ch_check_do.edit1.text;
t_ch_check.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_check.requery();
t_ch_check_detail.requery();
bsSkinButton1.Enabled:=true;
frm_sys_progress.Close;
frm_sys_progress.Free;
frm_sys_progress:=nil;
frm_ch_check_do.close;
{
str_feeValid:=SetfeeValid(t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring);
if trim(str_feeValid) <>'' then
begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>'+#13#10+str_feeValid);
end;
}
if frm_main.db.InTransaction then
begin
ShowMessage('֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>');
frm_main.db.RollbackTrans;
end;
end;
end;
procedure Tfrm_ch_check_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;
Label134.Visible:=false;
Edit4.Visible:=false;
Label133.Visible:=false;
RxDBLookupCombo19.Visible:=false;
Label136.Visible:=false;
Edit5.Visible:=false;
end else begin
RxDBLookupCombo1.Visible:=false;
Label2.Visible:=false;
Label6.Caption:='<27><> <20><>';
Label3.Visible:=false;
edit3.Visible:=false;
Label1.Caption:='<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>';
end;
end;
procedure Tfrm_ch_check_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:='<27>ұ<EFBFBD>=''RMB''';
frm_data_share.t_sys_bank.Filtered:=true;
end;
end;
procedure Tfrm_ch_check_do.RxDBLookupCombo3Exit(Sender: TObject);
begin
frm_data_share.t_sys_bank.Filtered:=false;
end;
procedure Tfrm_ch_check_do.RxDBLookupCombo1Enter(Sender: TObject);
begin
frm_data_share.t_sys_bank.Filtered:=false;
frm_data_share.t_sys_bank.Filter:='<27>ұ<EFBFBD>=''USD''';
frm_data_share.t_sys_bank.Filtered:=true;
end;
procedure Tfrm_ch_check_do.RxDBLookupCombo1Exit(Sender: TObject);
begin
frm_data_share.t_sys_bank.Filtered:=false;
end;
end.