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.

214 lines
7.9 KiB
Plaintext

11 months ago
unit u_ch_invoice_add;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, StdCtrls, wwdblook, RxLookup, bsSkinCtrls, DB,
ADODB;
type
Tfrm_ch_invoice_add = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
Label48: TLabel;
wwDBLookupCombo6: TwwDBLookupCombo;
Label63: TLabel;
RxDBLookupCombo3: TRxDBLookupCombo;
Label1: TLabel;
Edit1: TEdit;
bsSkinCheckRadioBox7: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox8: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
p_invoice_no: TADOStoredProc;
Edit2: TEdit;
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_invoice_add: Tfrm_ch_invoice_add;
implementation
uses u_data_share, u_ch_invoice, u_main, my_sys_function, my_sys_chat;
{$R *.dfm}
procedure Tfrm_ch_invoice_add.bsSkinButton1Click(Sender: TObject);
var
afield : variant;
i: Integer;
begin
if trim(Edit1.Text)='' then
begin
showmessage('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>');
exit;
end;
if bsSkinCheckRadioBox7.Checked or bsSkinCheckRadioBox8.Checked then
begin
if trim(wwDBLookupCombo6.Text)='' then
begin
showmessage('<27><>Ʊ<EFBFBD>ұ<EFBFBD><D2B1><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>');
exit;
end;
if RxDBLookupCombo3.DisplayValue='' then
begin
showmessage('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>');
exit;
end;
end;
if bsSkinCheckRadioBox7.Checked then
begin
try
modify_all:=true;
frm_ch_invoice.t_ch_invoice.Insert;
frm_ch_invoice.t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:='<27><><EFBFBD>ɷ<EFBFBD>Ʊ';
frm_ch_invoice.t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=trim(Edit1.Text);
frm_ch_invoice.t_ch_invoice['<27>ұ<EFBFBD>']:=wwDBLookupCombo6.Text;
frm_ch_invoice.t_ch_invoice['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=RxDBLookupCombo3.DisplayValues[1];
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=get_parameters_value(7,'<27><><EFBFBD>˷<EFBFBD>');
if not frm_data_share.t_crm_client_all.IsEmpty then
if frm_data_share.t_crm_client_all.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',RxDBLookupCombo3.DisplayValues[1],[]) then
begin
if trim(frm_data_share.t_crm_client_all.fieldbyname('<27><>Ʊ̧ͷ').asstring)<>''then
frm_ch_invoice.t_ch_invoice['<27><>Ʊ̧ͷ']:=frm_data_share.t_crm_client_all.fieldbyname('<27><>Ʊ̧ͷ').asstring;
end;
frm_ch_invoice.t_ch_invoice.post;
modify_all:=false;
except
if frm_ch_invoice.t_ch_invoice.State=dsinsert then
frm_ch_invoice.t_ch_invoice.cancel;
modify_all:=true;
showmessage('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
frm_ch_invoice.bsSkinTabSheet2.show;
close;
exit;
end;
if bsSkinCheckRadioBox8.Checked then
begin
try
modify_all:=true;
afield := vararraycreate([0,frm_ch_invoice.t_ch_invoice.fieldcount-1],varvariant);
for i := 0 to (frm_ch_invoice.t_ch_invoice.fieldcount-1) do
begin
afield[i] :=frm_ch_invoice.t_ch_invoice.fields[i].value ;
end;
frm_ch_invoice.t_ch_invoice.append;
for i := 0 to (frm_ch_invoice.t_ch_invoice.fieldcount-1) do
begin
if frm_ch_invoice.t_ch_invoice.fields[i].FieldName<>'IN_ID'then
frm_ch_invoice.t_ch_invoice.fields[i].value := afield[i] ;
end;
frm_ch_invoice.t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:='<27><><EFBFBD>ɷ<EFBFBD>Ʊ';
frm_ch_invoice.t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=trim(Edit1.Text);
frm_ch_invoice.t_ch_invoice['<27>ұ<EFBFBD>']:=wwDBLookupCombo6.Text;
frm_ch_invoice.t_ch_invoice['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=RxDBLookupCombo3.DisplayValues[1];
if not frm_data_share.t_crm_client_all.IsEmpty then
if frm_data_share.t_crm_client_all.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',RxDBLookupCombo3.DisplayValues[1],[]) then
begin
if trim(frm_data_share.t_crm_client_all.fieldbyname('<27><>Ʊ̧ͷ').asstring)<>''then
frm_ch_invoice.t_ch_invoice['<27><>Ʊ̧ͷ']:=frm_data_share.t_crm_client_all.fieldbyname('<27><>Ʊ̧ͷ').asstring;
end;
frm_ch_invoice.t_ch_invoice['<27>Ƶ<EFBFBD><C6B5><EFBFBD>']:=employee;
frm_ch_invoice.t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=date;
frm_ch_invoice.t_ch_invoice['<27>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ']:=0;
frm_ch_invoice.t_ch_invoice['<27>Ƿ<EFBFBD><C7B7>ϳ<EFBFBD>']:=0;
frm_ch_invoice.t_ch_invoice['<27>ϳ<EFBFBD>ԭ<EFBFBD><D4AD>']:='';
frm_ch_invoice.t_ch_invoice['<27>ϳ<EFBFBD><CFB3><EFBFBD>']:='';
frm_ch_invoice.t_ch_invoice['<27>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD><EFBFBD>']:=null;
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='';
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
frm_ch_invoice.t_ch_invoice.post;
modify_all:=false;
except
if frm_ch_invoice.t_ch_invoice.State=dsinsert then
frm_ch_invoice.t_ch_invoice.cancel;
modify_all:=true;
showmessage('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
frm_ch_invoice.bsSkinTabSheet2.show;
close;
exit;
end;
if bsSkinCheckRadioBox1.Checked then
begin
try
modify_all:=true;
frm_ch_invoice.t_ch_invoice.Insert;
frm_ch_invoice.t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:='<27><><EFBFBD>뷢Ʊ';
frm_ch_invoice.t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=trim(Edit1.Text);
frm_ch_invoice.t_ch_invoice['<27>ұ<EFBFBD>']:=wwDBLookupCombo6.Text;
frm_ch_invoice.t_ch_invoice['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=edit2.text;
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><>Ʊ̧ͷ']:=frm_ch_invoice.t_ch_invoice_shen['<27><>Ʊ̧ͷ'];
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><EFBFBD><E1B5A5>']:=frm_ch_invoice.t_ch_invoice_shen['<27><EFBFBD><E1B5A5>'];
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD>˸<EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD>˸<EFBFBD>'];
frm_ch_invoice.t_ch_invoice['ж<><D0B6><EFBFBD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['ж<><D0B6><EFBFBD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice['Ŀ<>ĸ<EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['Ŀ<>ĸ<EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><>ע']:=frm_ch_invoice.t_ch_invoice_shen['<27><>ע'];
frm_ch_invoice.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><EFBFBD><E9BFAA><EFBFBD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27>ұ<EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27>ұ<EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
frm_ch_invoice.t_ch_invoice.post;
frm_ch_invoice.t_ch_invoice_shen.Edit;
frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD>״̬']:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ';
frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
frm_ch_invoice.t_ch_invoice_shen['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
frm_ch_invoice.t_ch_invoice_shen['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=trim(Edit1.Text);
frm_ch_invoice.t_ch_invoice_shen.post;
modify_all:=false;
Send_invocie_check_check('<27><><EFBFBD>뷢Ʊ<EBB7A2><C6B1><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+frm_ch_invoice.t_ch_invoice_shen.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
+',<2C>ͻ<EFBFBD>:'+frm_ch_invoice.t_ch_invoice_shen.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring,frm_ch_invoice.t_ch_invoice_shen.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,'25');
except
if frm_ch_invoice.t_ch_invoice.State=dsinsert then
frm_ch_invoice.t_ch_invoice.cancel;
modify_all:=true;
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊʧ<C6B1>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
frm_ch_invoice.bsSkinTabSheet2.show;
close;
exit;
end;
end;
procedure Tfrm_ch_invoice_add.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_invoice_add.FormShow(Sender: TObject);
var
i:integer;
begin
p_invoice_no.ExecProc;
try
i:=strtoint(p_invoice_no.Parameters[1].value);
Edit1.Text:=inttostr(i+1);
except
;
end;
end;
end.