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.

174 lines
5.4 KiB
Plaintext

unit u_ch_invoice_do;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls, RxLookup,ADODB;
type
Tfrm_ch_invoice_do = class(TForm)
bsSkinGroupBox1: TbsSkinGroupBox;
Label6: TLabel;
Label7: TLabel;
Label10: TLabel;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox4: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox6: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox7: TbsSkinCheckRadioBox;
Edit2: TEdit;
Memo1: TMemo;
bsSkinCheckRadioBox5: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox8: TbsSkinCheckRadioBox;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsBusinessSkinForm1: TbsBusinessSkinForm;
RxDBLookupCombo15: TRxDBLookupCombo;
RxDBLookupCombo2: TRxDBLookupCombo;
Label2: TLabel;
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_invoice_do: Tfrm_ch_invoice_do;
implementation
uses u_ch_balance_accept, my_sys_function, u_main, u_sys_progress,
u_ch_check_do, u_data_share;
{$R *.dfm}
procedure Tfrm_ch_invoice_do.bsSkinButton1Click(Sender: TObject);
var
str:string;
function isPayTrue(CH_ID:integer;PayAmt:Double):Boolean;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
result:=false;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select ½ð¶î,½áËã½ð¶î from t_ch_fee where ch_id='+inttostr(CH_ID));
Open;
if not IsEmpty then begin
if FieldByName('½ð¶î').AsFloat>=0 then begin
if (FieldByName('½áËã½ð¶î').AsFloat+payamt)<=FieldByName('½ð¶î').AsFloat then
result:=true;
end else begin
if (FieldByName('½áËã½ð¶î').AsFloat+payamt)>=FieldByName('½ð¶î').AsFloat then
result:=true;
end;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
begin
if bsSkinCheckRadioBox1.Checked then
str:=bsSkinCheckRadioBox1.Caption;
if bsSkinCheckRadioBox2.Checked then
str:=bsSkinCheckRadioBox2.Caption;
if bsSkinCheckRadioBox3.Checked then
str:=bsSkinCheckRadioBox3.Caption;
if bsSkinCheckRadioBox4.Checked then
str:=bsSkinCheckRadioBox4.Caption;
if bsSkinCheckRadioBox6.Checked then
str:=bsSkinCheckRadioBox6.Caption;
if bsSkinCheckRadioBox7.Checked then
str:=bsSkinCheckRadioBox7.Caption;
if bsSkinCheckRadioBox5.Checked then
str:=bsSkinCheckRadioBox5.Caption;
if bsSkinCheckRadioBox8.Checked then
str:=bsSkinCheckRadioBox8.Caption;
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.bsSkinGauge1.ProgressText:='ÕýÔÚ´¦ÀíÊý¾Ý¡£¡£¡£';
frm_sys_progress.Show;
frm_main.db.BeginTrans;
try
with frm_ch_balance_accept do
begin
t_ch_balance.Insert;
t_ch_balance['½áËãÀà±ð']:='·¢Æ±';
t_ch_balance['¿Í»§Ãû³Æ']:=t_ch_invoice_shen['¿Í»§Ãû³Æ'];
t_ch_balance['½áË㷽ʽ']:=str;
t_ch_balance['±Ò±ð']:=t_ch_invoice_shen['±Ò±ð'];
t_ch_balance['½áËã½ð¶î']:=t_ch_invoice_shen['ÉêÇë½ð¶î'];
t_ch_balance['ʵ½á½ð¶î']:=t_ch_invoice_shen['ʵ¼Ê½ð¶î'];
t_ch_balance['Ðé½á½ð¶î']:=t_ch_invoice_shen['Ð鿪½ð¶î'];
t_ch_balance['ÒøÐдúÂë']:=frm_ch_invoice_do.RxDBLookupCombo15.DisplayValues[0];
if frm_data_share.t_sys_bank.Locate('´úÂë',frm_ch_invoice_do.RxDBLookupCombo15.DisplayValues[0],[])then begin
t_ch_balance['ÒøÐÐ']:=frm_data_share.t_sys_bank.fieldbyname('ÒøÐÐÃû³Æ').asstring;
end else begin
t_ch_balance['ÒøÐÐ']:='';
end;
t_ch_balance['ƾ֤ºÅÂë']:=frm_ch_invoice_do.Edit2.text;
t_ch_balance['±¸×¢']:=frm_ch_invoice_do.Memo1.text;
t_ch_balance.Post;
if t_ch_fee_do_invoice.recordcount>0 then
frm_sys_progress.bsSkinGauge1.MaxValue:=t_ch_fee_do_invoice.recordcount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
t_ch_fee_do_invoice.DisableControls;
t_ch_fee_do_invoice.first;
while not t_ch_fee_do_invoice.eof do
begin
if isPayTrue(t_ch_fee_do_invoice['CH_ID'],t_ch_fee_do_invoice['ԭʼ½ð¶î']) then
begin
t_ch_fee_do.insert;
t_ch_fee_do['¹¤×÷±àºÅ']:=t_ch_balance.fieldbyname('Õʵ¥±àºÅ').asstring;
t_ch_fee_do['ÒµÎñ±àºÅ']:=t_ch_fee_do_invoice['ÒµÎñ±àºÅ'];
t_ch_fee_do['CH_ID']:=t_ch_fee_do_invoice['CH_ID'];
t_ch_fee_do['±Ò±ð']:=t_ch_fee_do_invoice['±Ò±ð'];
t_ch_fee_do['½ð¶î']:=t_ch_fee_do_invoice['½ð¶î'];
t_ch_fee_do['ԭʼ½ð¶î']:=t_ch_fee_do_invoice['ԭʼ½ð¶î'];
t_ch_fee_do['ÀàÐÍ']:='3';
t_ch_fee_do.Post;
Setfee(0,t_ch_fee_do_invoice.fieldbyname('CH_ID').asinteger,t_ch_fee_do_invoice.fieldbyname('ԭʼ½ð¶î').asfloat);
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_ch_fee_do_invoice.next;
end;
t_ch_invoice_shen.requery;
t_ch_balance.edit;
t_ch_balance.post;
end;
frm_main.db.CommitTrans;
finally
frm_ch_balance_accept.t_ch_fee_do_invoice.EnableControls;
frm_sys_progress.close;
frm_sys_progress:=nil;
close;
if frm_main.db.InTransaction then
begin
frm_main.db.RollbackTrans;
end;
end;
end;
procedure Tfrm_ch_invoice_do.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
end.