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.

108 lines
2.9 KiB
Plaintext

unit u_ch_balance_invhx;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls, RxLookup,ADODB,
wwdbdatetimepicker, DB;
type
Tfrm_ch_balance_invhx = class(TForm)
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsBusinessSkinForm1: TbsBusinessSkinForm;
Label25: TLabel;
Edit1: TEdit;
t_ch_invoice_hexiao: TADOQuery;
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_balance_invhx: Tfrm_ch_balance_invhx;
implementation
uses u_ch_balance_accept, my_sys_function, u_main, u_sys_progress,
u_ch_check_do, u_data_share, u_ch_balance_pay;
{$R *.dfm}
procedure Tfrm_ch_balance_invhx.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_balance_invhx.bsSkinButton1Click(Sender: TObject);
var
balno:string;
aQuery, t_ch_fee:TADOQuery;
begin
if (Edit1.Text='') then begin
ShowMessage('发票号不能为空!');
exit;
end;
balno:=get_no(date,'HA');
aQuery:=CreateAdoQuery;
t_ch_fee:=CreateAdoQuery;
try
with aQuery do begin
close;sql.Clear;
SQL.Add('select * from t_ch_fee_do where 工作编号='''+frm_ch_balance_pay.t_ch_balance['帐单编号']+''' ');
Open;
reccount:=FieldCount;
selcount:=0;
if not aQuery.IsEmpty then begin
t_ch_fee.Close;
t_ch_fee.SQL.Text:='select top 0 * from t_ch_fee_do';;
t_ch_fee.Open;
First;
while not Eof do begin
t_ch_fee.Insert;
t_ch_fee['工作编号']:=balno;
t_ch_fee['类型']:='7';
t_ch_fee['业务编号']:=aQuery['业务编号'];
t_ch_fee['CH_ID']:=aQuery['CH_ID'];
t_ch_fee['币别']:=aQuery['币别'];
t_ch_fee['金额']:=aQuery['金额'];
t_ch_fee['原始金额']:=aQuery['原始金额'];
t_ch_fee.Post;
Next;
end;
end;
end;
finally
FreeAndNil(aQuery);
FreeAndNil(t_ch_fee);
end;
t_ch_invoice_hexiao.open;
t_ch_invoice_hexiao.Insert;
t_ch_invoice_hexiao['自动']:=1;
t_ch_invoice_hexiao['核销类别']:='实际开票';
t_ch_invoice_hexiao['发票类别']:='付费开票';
t_ch_invoice_hexiao['实际金额']:=frm_ch_balance_pay.t_ch_balance['实结金额'];
t_ch_invoice_hexiao['开出人']:=employee;
t_ch_invoice_hexiao['开出日期']:=date;
t_ch_invoice_hexiao['是否结算']:=1;
t_ch_invoice_hexiao['核销编号']:=balno;
t_ch_invoice_hexiao['发票号码']:=Edit1.Text;
t_ch_invoice_hexiao['客户名称']:=frm_ch_balance_pay.t_ch_balance['客户名称'];
t_ch_invoice_hexiao['币别']:=frm_ch_balance_pay.t_ch_balance['币别'];
t_ch_invoice_hexiao['帐单编号']:=frm_ch_balance_pay.t_ch_balance['帐单编号'];
t_ch_invoice_hexiao.Post;
close;
end;
end.