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.

876 lines
24 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_op_seae_invoice_sign;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB,
ADODB, dxDBTLCl, dxGrClms, StdCtrls, DBCtrls, Mask, wwdblook, ComCtrls,
bsSkinTabs, bsdbctrls, RxLookup, u_ch_add_do, u_ch_delete_do,
wwdbdatetimepicker, Menus, XPMenu, wwdbedit, Wwdotdot, Wwdbcomb,
kbmMemTable, DBCtrlsEh, ExtCtrls, cxControls, cxContainer, cxEdit,
cxLabel, OleCtrls, iWebPDFEditorLib_TLB,EncdDecd,ShellAPI, bsSkinBoxCtrls,
cxTextEdit, cxDBEdit;
type
Tfrm_op_seae_invoice_sign = class(TForm)
bsknpnl1_toolbar1: TbsSkinPanel;
btn3_delSign: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
btn2_sign: TbsSkinButton;
btn1_newSign: TbsSkinButton;
btn4_viewSign: TbsSkinButton;
bsSkinNotebook1: TbsSkinNotebook;
t_ch_invoice_shen1: TDataSource;
XPMenu1: TXPMenu;
PopupMenu2: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N13: TMenuItem;
N12: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
PopupMenu3: TPopupMenu;
N17: TMenuItem;
N18: TMenuItem;
N34: TMenuItem;
N35: TMenuItem;
N36: TMenuItem;
N1: TMenuItem;
N6: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
bsSkinButton38: TbsSkinButton;
memtblprint: TkbmMemTable;
memtblprint1: TDataSource;
bsknpnl1: TbsSkinPanel;
bsknpnl2: TbsSkinPanel;
Edit1_fph0: TEdit;
bsknpnl3: TbsSkinPanel;
lbl1: TLabel;
kbmMemTable1: TkbmMemTable;
lbl2: TLabel;
Edit2_fph: TEdit;
bsknpnl4: TbsSkinPanel;
bsknpnl8: TbsSkinPanel;
shp7: TShape;
shp6: TShape;
shp5: TShape;
shp4: TShape;
bskndbtxt5_czr: TbsSkinDBText;
bskndbtxtd: TbsSkinDBText;
bskndbtxt6: TbsSkinDBText;
lbl1_signtip: TLabel;
cxlbl9: TcxLabel;
cxlbl10: TcxLabel;
cxlbl11: TcxLabel;
cxlbl13: TcxLabel;
cxlbl15: TcxLabel;
bsknspltr1: TbsSkinSplitter;
qry1_fpm: TADOQuery;
qry2_fpd: TADOQuery;
ds1_fpm: TDataSource;
ds2_fpd: TDataSource;
qry_ch_invoice: TADOQuery;
iwbpdfdtr1: TiWebPDFEditor;
btn8_confirmsign: TbsSkinButton;
btn3_custprint: TbsSkinButton;
bsknpgcntrl1: TbsSkinPageControl;
bskntbsht1: TbsSkinTabSheet;
bskntbsht2: TbsSkinTabSheet;
bsknpnl5: TbsSkinPanel;
btn3_searchReturn: TbsSkinButton;
btn2: TbsSkinButton;
bsknpnl6: TbsSkinPanel;
btn4_searchNew: TbsSkinButton;
edt1_khmch: TbsSkinDBEdit;
lbl6: TLabel;
lbl3: TLabel;
lbl4: TLabel;
lbl5: TLabel;
Edit1_seach_fpqsbh: TEdit;
Edit2_seach_khmch: TEdit;
wdbdtmpckr1_seach_lu: TwwDBDateTimePicker;
wdbdtmpckr2_seach_lu: TwwDBDateTimePicker;
dxdbgrd3: TdxDBGrid;
dxdbgrdclmn5: TdxDBGridColumn;
dxdbgrdmskclmn1: TdxDBGridMaskColumn;
dxdbgrdmskclmn4: TdxDBGridMaskColumn;
dxdbgrdclmn6: TdxDBGridColumn;
dxdbgrdmskclmn5: TdxDBGridMaskColumn;
bsknpnl7: TbsSkinPanel;
shp2: TShape;
shp3: TShape;
shp8: TShape;
shp9: TShape;
shp10: TShape;
cxlbl1: TcxLabel;
cxlbl2: TcxLabel;
cxlbl3: TcxLabel;
cxlbl4: TcxLabel;
cxlbl5: TcxLabel;
bsknpnl9: TbsSkinPanel;
img2: TImage;
dxdbgrd4: TdxDBGrid;
dxdbgrdclmn7: TdxDBGridColumn;
dxdbgrdclmn8: TdxDBGridColumn;
dxdbgrdclmn9: TdxDBGridColumn;
dxdbgrdclmn10: TdxDBGridColumn;
dxdbgrdclmn11: TdxDBGridColumn;
cxlbl6: TcxLabel;
cxlbl7: TcxLabel;
qry1_sear_fpm: TADOQuery;
ds1_sear_fpm: TDataSource;
ds2_sear_fpd: TDataSource;
qry2_sear_fpd: TADOQuery;
btn10_viewsign: TbsSkinButton;
cxlbl18: TcxLabel;
cxlbl19: TcxLabel;
img1: TImage;
cxlbl12: TcxLabel;
btn3_clearConditon: TbsSkinButton;
shp11: TShape;
cxdbtxtdt1: TcxDBTextEdit;
cxdbtxtdt2: TcxDBTextEdit;
cxdbtxtdt3: TcxDBTextEdit;
dxdbgrd2: TdxDBGrid;
dxdbgrdclmn2: TdxDBGridColumn;
dxdbgrdclmn1: TdxDBGridColumn;
dxdbgrdclmn3: TdxDBGridColumn;
dxdbgrdclmn4: TdxDBGridColumn;
dxdbgrdclmndxdbgrd2Column5: TdxDBGridColumn;
shp1: TShape;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure btn2_signClick(Sender: TObject);
procedure btn1_newSignClick(Sender: TObject);
procedure bsknpnl1_toolbar1Resize(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Edit1_fph0KeyPress(Sender: TObject; var Key: Char);
procedure bsknpnl2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure iwbpdfdtr1SignFinish(Sender: TObject;
const bSucceed: WideString);
procedure btn8_confirmsignClick(Sender: TObject);
procedure btn3_custprintClick(Sender: TObject);
procedure btn4_viewSignClick(Sender: TObject);
procedure bsSkinButton38Click(Sender: TObject);
procedure btn4_searchNewClick(Sender: TObject);
procedure btn3_searchReturnClick(Sender: TObject);
procedure btn10_viewsignClick(Sender: TObject);
procedure dxdbgrd3DblClick(Sender: TObject);
procedure dxdbgrd4DblClick(Sender: TObject);
procedure btn3_delSignClick(Sender: TObject);
procedure btn3_clearConditonClick(Sender: TObject);
procedure Edit2_seach_khmchKeyPress(Sender: TObject; var Key: Char);
procedure qry2_fpdBeforePost(DataSet: TDataSet);
procedure edt1_khmchKeyPress(Sender: TObject; var Key: Char);
procedure dxdbgrd3ChangeNode(Sender: TObject; OldNode,
Node: TdxTreeListNode);
private
{ Private declarations }
m_isNewSign:Boolean;
m_newfilename:string;
m_blhastranse:Boolean;
m_op_state:string;//<2F><><EFBFBD><EFBFBD>״̬
m_invoceno:string;//<2F><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_custname:string;//ί<>е<EFBFBD>λ m_custname
m_dbTime:TDateTime;
ch_invoice_shen_open:boolean;
function check_invoiceNo(strbh:string):boolean; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ч<EFBFBD><D0A7>
function checkinvocenoScaned(invoceno:string):Boolean; //<2F>Ƿ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>
procedure displayInvoiceinfo(strfpbh:string);
procedure intialNewSign();
procedure clearNouseSign();
procedure showHisSign();
//procedure bindDetail();
public
{ Public declarations }
MblNo:string;
end;
var
frm_op_seae_invoice_sign: Tfrm_op_seae_invoice_sign;
implementation
uses u_main, my_sys_function, u_ch_shen_query, u_data_share,
u_op_seae_invoice_sign_detail;
{$R *.dfm}
/// <summary>
/// <20><>ʱĿ¼
/// </summary>
function GetWinTempPath: string;
var
TempDir: array[0..255] of char;
begin
GetTempPath(255, @TempDir);
Result := strPas(TempDir);
end;
///<2F><>Bitmapλͼת<CDBC><D7AA>Ϊbase64<36>ַ<EFBFBD><D6B7><EFBFBD>
function BitmapToString(img:TBitmap):string ;
var
ms:TMemoryStream;
ss:TStringStream;
s:string;
begin
ms := TMemoryStream.Create;
img.SaveToStream(ms);
ss := TStringStream.Create('');
ms.Position:=0;
EncodeStream(ms,ss);//<2F><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊbase64<36>ַ<EFBFBD><D6B7><EFBFBD>
s:=ss.DataString;
ms.Free;
ss.Free;
result:=s;
end;
function StringToBitmap(imgStr:string):TBitmap;
var ss:TStringStream;
ms:TMemoryStream;
bitmap:TBitmap;
begin
ss := TStringStream.Create(imgStr);
ms := TMemoryStream.Create;
DecodeStream(ss,ms);//<2F><>base64<36>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ԭΪ<D4AD>ڴ<EFBFBD><DAB4><EFBFBD>
ms.Position:=0;
bitmap := TBitmap.Create;
bitmap.LoadFromStream(ms);
ss.Free;
ms.Free;
result :=bitmap;
end;
function stringfindCount(s1,s2:string):integer ;
begin
result:=0;
while pos(s1,s2)>0 do
begin
s2:=copy(s2,pos(s1,s2)+1,100);
//<2F><><EFBFBD><EFBFBD>s2<73><32><EFBFBD>󳤶<EFBFBD>Ϊ100<30><30><EFBFBD>ַ<EFBFBD>
result:=result+1;
end;
end;
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ȡֵ
/// </summary>
function GetPosString(S1:string;m:integer):String;
var
z:integer;
begin
Result:='';
if pos(',',S1)=0 then exit;
for z:=1 to m-1 do begin
if Pos(',',S1)=0 then exit;
if Pos(',',S1)=1 then
S1:=Copy(S1,Pos(',',S1)+1,(length(s1)-Pos(',',S1)))
else
S1:=Copy(S1,Pos(',',S1)+1,(length(s1)-Pos(',',S1)));
end;
if pos(',',S1)=1 then exit;
if Pos(',',S1)=0 then
Result:=Copy(S1,1,length(S1)-1)
else Result:=Copy(S1,1,Pos(',',S1)-1);
end;
procedure Tfrm_op_seae_invoice_sign.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_invoice_sign.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
ch_invoice_shen_open:=false;
frm_op_seae_invoice_sign.Hide;
frm_op_seae_invoice_sign.ManualFloat(frm_op_seae_invoice_sign.BoundsRect);
frm_main.freeTabs('frm_op_seae_invoice_sign');
action:=cafree;
frm_op_seae_invoice_sign:=nil;
end;
procedure Tfrm_op_seae_invoice_sign.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if( m_blhastranse=True) then
begin
if( qry2_fpd.Recordset<>nil) and ( qry2_fpd.Recordset.RecordCount>0) then
begin
if( Application.MessageBox(PChar('<27><>ǰ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?'),PChar('<27><>Ϣ<EFBFBD><CFA2>ʾ')
,MB_YESNO+MB_ICONQUESTION)=IDYES) then
begin
//
qry1_fpm.Cancel;
qry2_fpd.Cancel;
//frm_main.db.RollbackTrans;
m_blhastranse:=False;
end
else
CanClose:=false;
end;
qry1_fpm.Cancel;
qry2_fpd.Cancel;
//frm_main.db.RollbackTrans;
m_blhastranse:=False;//CanClose:=frm_close_query(qry2_fpd);
end;
//<2F><><EFBFBD><EFBFBD>
clearNouseSign();
end;
procedure Tfrm_op_seae_invoice_sign.btn2_signClick(Sender: TObject);
var
strpath:string;
oldfilename:string;
msg:Integer;
pzt:WideString;
i1:Integer;
i2:Integer;
i3:Integer;
i4:Integer;
i5:Integer;
str :string;
aQuery:TADOQuery;
begin
// m_invoceno:='fpqz'+ aQuery.FieldByName('qdtbh').AsString;
if(qry2_fpd.IsEmpty) or (qry2_fpd.Recordset.RecordCount< 1) then
begin
Application.MessageBox('<27><>Ʊ<EFBFBD><C6B1>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
Exit;
end;
strpath:= GetWinTempPath() ;
oldfilename:= strpath+ 'cwsgn222.PDF' ;
m_newfilename := strpath+m_invoceno+'_'+ IntToStr(Random(10))+ '.PDF' ;
sys_frprintFile('<27><>Ʊǩ<C6B1>յ<EFBFBD>','PDF',ds1_fpm,ds2_fpd,nil,nil,nil,nil,nil,nil,nil,nil,nil,True,'',nil,nil,oldfilename);
deletefile(m_newfilename);
CopyFile(pchar(oldfilename), PChar(m_newfilename),true);
iwbpdfdtr1.LoadFromFile(m_newfilename);
pzt:= '598*94' ;
i1:=1;
i2:=1;
i3:=0;
i4:=50;
i5:=30;
msg := iwbpdfdtr1.HandSignAtTouchMonitor(i1,i2,i3,pzt, i4, i5);
end;
procedure Tfrm_op_seae_invoice_sign.intialNewSign();
var
str,bsno:widestring;
i:integer;
aQuery:TAdoQuery;
strwtdw1,strwtdw2:string;
dbTime:TDateTime;
sqldelete:string;
begin
//end check
// m_blhastranse:=True;
//if(
m_blhastranse:=True;
// frm_main.db.BeginTrans;
aQuery:=CreateAdoQuery();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sqldelete:=' delete from t_ch_invoice_sign_detail where <20><>Ʊǩ<C6B1>ձ<EFBFBD><D5B1><EFBFBD> '
+' not in (select <20><>Ʊǩ<C6B1>ձ<EFBFBD><D5B1><EFBFBD> from t_ch_invoice_sign_main);';
aQuery.SQL.Add(sqldelete);
aQuery.ExecSQL();
//qdm_Query:=CreateAdoQuery();
//qdd_Query:=CreateAdoQuery();
m_custname:='';
str:= 'INSERT INTO t_sys_sign_invoice_id (mainorderno) VALUES (''<27><><EFBFBD><EFBFBD>Ʊ'');';
aQuery.SQL.Add(str) ;
aQuery.ExecSQL();
aQuery.sql.Clear();
str:= 'select MAX(signid) as invoceno,GETDATE()as FDate from t_sys_sign_invoice_id; ';
aQuery.sql.add(str);
aQuery.OPEN;
aQuery.First;
m_invoceno:= aQuery.FieldByName('invoceno').AsString;
m_dbTime:=aQuery.FieldByName('FDate').AsDateTime; m_op_state:='<27><>Ʊ';
qry1_fpm.Close();
qry1_fpm.SQL.Clear;
qry1_fpm.SQL.Add('SELECT * FROM [t_ch_invoice_sign_main] where 1=2');
qry1_fpm.Open;
qry2_fpd.Close();
qry2_fpd.SQL.Clear;
qry2_fpd.SQL.Add('SELECT * FROM [t_ch_invoice_sign_detail] where 1=2');
qry2_fpd.Open;
end;
procedure Tfrm_op_seae_invoice_sign.btn1_newSignClick(Sender: TObject);
begin
intialNewSign();
Edit1_fph0.Focused();
end;
procedure Tfrm_op_seae_invoice_sign.bsknpnl1_toolbar1Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsknpnl1_toolbar1.Width/14);
end;
procedure Tfrm_op_seae_invoice_sign.bsSkinButton7Click(Sender: TObject);
var
Pnt:Tpoint;
begin
end;
procedure Tfrm_op_seae_invoice_sign.FormCreate(Sender: TObject);
begin
m_blhastranse:=False;
// bsSkinNotebook1.PageIndex:=0;
{
hen_open:=true;
t_ch_invoice_shen.Close;
t_ch_invoice_shen.SQL.clear;
t_ch_invoice_shen.SQL.Add('select * from t_ch_invoice_shen where <20><><EFBFBD><EFBFBD>״̬ not in ('+''''+'<27><>׼<EFBFBD><D7BC>Ʊ'+''''
+','+''''+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ'+''''+') and '
+open_data('1001','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no')
+'order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
}
end;
/// <summary>
/// <20><><EFBFBD>鷢Ʊ<E9B7A2><C6B1><EFBFBD>Ƿ<EFBFBD><C7B7>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
function Tfrm_op_seae_invoice_sign.checkinvocenoScaned(invoceno:string):Boolean;
var
a:OleVariant;
i,j:integer;
b:string;
begin
Result:=False;
if(qry2_fpd.Recordset=nil) then
Exit;
qry2_fpd.Last;
if (qry2_fpd.Recordset.RecordCount<1 ) then
Exit;
a:=Self.qry2_fpd.Recordset.GetRows(-1,1,emptyparam);
if Varisarray(a) then
begin
for i:=0 to qry2_fpd.RecordCount-1 do
begin
if(a[3,i]=null) then
Continue;
b:=a[3,i];
if(b=invoceno) then
begin
result:=True;
Application.MessageBox(PChar('<27><>Ʊ<EFBFBD><C6B1><EFBFBD>ظ<EFBFBD>!'),PChar('<27><>Ϣ<EFBFBD><CFA2>ʾ') ,MB_ICONINFORMATION);
Break;
end;
end;
end;
end;
function Tfrm_op_seae_invoice_sign.check_invoiceNo(strbh:string):boolean;
var
strtmp,mainorder,custname0,sqlcheck:string;
invocemoney:Double;
aquery:TADOQuery;
begin
result:=false;
if Length(strbh)<=3 then
Exit;
if Length(strbh)<=10 then
Edit2_fph.Text:=strbh
else if (Length(strbh)>10) and (pos(',',strbh)>0 ) and ( stringfindCount(',',strbh)>5) then
begin
//
Edit2_fph.Text:=GetPosString(strbh,4);
try
invocemoney:=StrToFloat( GetPosString(strbh,5));
except
on E: Exception do
begin
Application.MessageBox(PChar('<27><>Ʊ<EFBFBD><C6B1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>!'),pchar('<27><>Ϣ<EFBFBD><CFA2>ʾ'),MB_ICONWARNING);
Exit;
end;
end;
end;
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD>ɨ<EFBFBD><C9A8>
if (checkinvocenoScaned(Edit2_fph.Text) ) then
Exit;
//<2F><><EFBFBD>鷢Ʊ<E9B7A2><C6B1>ϵͳ<CFB5><CDB3><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
aquery:=CreateAdoQuery();
sqlcheck:= 'select '
+ ' (select COUNT(1) as qfcount from t_ch_invoice_sign_detail where <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>='''+Edit2_fph.Text+''') as fpbhcount ,'
+ ' v2.* from (select v.fph,chv.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,chv.<2E><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>,chv.<2E><EFBFBD><E1B5A5>,chv.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,chv.<2E>ұ<EFBFBD>,chv.<2E>ϼƽ<CFBC><C6BD><EFBFBD> '
+ ' from (select ''' +Edit2_fph.Text + ''' as fph) v left join t_ch_invoice chv on v.fph=chv.<2E><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> '
+ ' ) v2 ';
With aquery do
begin
SQL.add(sqlcheck);
OPen;
First;
if (fieldbyname('fpbhcount').AsInteger>0 ) then
begin
//
MessageBox(self.WindowHandle,PChar('<27><>Ʊ<EFBFBD><C6B1>'+Edit2_fph.Text+'<27><>ǩ<EFBFBD><C7A9>!'),pchar('<27><>Ϣ<EFBFBD><CFA2>ʾ'),mb_ok);
Close;
Exit;
end;
end;
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD>
if(not aquery.FieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').IsNull) then
begin
//
invocemoney := aquery.fieldbyname('<27>ϼƽ<CFBC><C6BD><EFBFBD>').asfloat;
with qry2_fpd do
begin
Insert;
FieldByName('<27><>Ʊǩ<C6B1>ձ<EFBFBD><D5B1><EFBFBD>').AsString:=m_invoceno;
if( aquery.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').IsNull) then
custname0:=''
else
custname0:= aquery.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
//m_custname
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=aquery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
FieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString:=aquery.fieldbyname('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
FieldByName('<27><EFBFBD><E1B5A5>').AsString:=aquery.fieldbyname('<27><EFBFBD><E1B5A5>').AsString;
FieldByName('<27>ұ<EFBFBD>').AsString :=aquery.fieldbyname('<27>ұ<EFBFBD>').AsString;
FieldByName('<27><><EFBFBD><EFBFBD>').AsString :=aquery.fieldbyname('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsString;
end;
end
else
begin
//
with qry2_fpd do
begin
Insert;
FieldByName('<27><>Ʊǩ<C6B1>ձ<EFBFBD><D5B1><EFBFBD>').AsString:=m_invoceno;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><>';
FieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString:=Edit2_fph.Text;
FieldByName('<27><EFBFBD><E1B5A5>').AsString:='<27><>';
FieldByName('<27>ұ<EFBFBD>').AsString :='RMB';
FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat :=invocemoney;
end;
end;
//
qry1_fpm.Last;
qry2_fpd.Last;
if (qry2_fpd.FieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').isnull) or (qry2_fpd.FieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString='') then
qry2_fpd.delete;
if(qry2_fpd.recordset.recordcount=1) and (qry1_fpm.Recordset.recordcount<1 ) then
begin
qry1_fpm.Insert;
qry1_fpm.fieldbyname('<27><>Ʊǩ<C6B1>ձ<EFBFBD><D5B1><EFBFBD>').asstring:=m_invoceno;
qry1_fpm.fieldbyname('¼<><C2BC><EFBFBD><EFBFBD>').asstring:=employee;
qry1_fpm.fieldbyname('¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=m_dbtime;
qry1_fpm.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring:=m_custname;
end;
//<2F>ڳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( custname0<>'' ) then
begin
m_custname:=custname0;
if (qry1_fpm.recordset.recordcount>0) and
(qry1_fpm.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').IsNull or (Trim(qry1_fpm.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString) ='')) then
begin
qry1_fpm.Edit;
qry1_fpm.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring:=m_custname;
end;
end;
end;
procedure Tfrm_op_seae_invoice_sign.displayInvoiceinfo(strfpbh:string);
var
str: string;
strtmp:string;
begin
str:=' where <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> ';
str:=str+ ' in('''+ m_invoceno + ''') ';
//δǩ<CEB4><C7A9>
//<2F><>ǩ<EFBFBD><C7A9>
qry_ch_invoice.Close;
qry_ch_invoice.sql.clear;
qry_ch_invoice.sql.add('select * from t_ch_invoice '''+str +''' ');
qry_ch_invoice.open;
end;
procedure Tfrm_op_seae_invoice_sign.Edit1_fph0KeyPress(Sender: TObject;
var Key: Char);
var
strkey:string;
blOk:Boolean;
begin
//
if key=#13 then
begin
if( m_op_state='' ) then
intialNewSign();
strkey:= Edit1_fph0.Text;
Edit1_fph0.Clear();
blOk:=check_invoiceNo(strkey);
if(blOk) then
Exit; //<2F>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD> <20>˳<EFBFBD>
//<2F><>֤<EFBFBD><D6A4>Ʊ<EFBFBD><C6B1>
//m_op_state.Text:=str;
//show_qdtxx(str,0);
end;
end;
procedure Tfrm_op_seae_invoice_sign.bsknpnl2Click(Sender: TObject);
begin
//frm_main.db.
end;
procedure Tfrm_op_seae_invoice_sign.FormShow(Sender: TObject);
begin
intialNewSign();
bsSkinNotebook1.ActivePage :='list';
Edit1_fph0.Focused();
end;
procedure Tfrm_op_seae_invoice_sign.iwbpdfdtr1SignFinish(Sender: TObject;
const bSucceed: WideString);
begin
img1.Picture.Bitmap:= StringToBitmap(iwbpdfdtr1.GetTouchMonitorImageBASE64());
img1.Visible:=True;
iwbpdfdtr1.Save();
iwbpdfdtr1.CloseRead();
m_isNewSign:=True;
btn8_confirmsign.Enabled:=True;
//Ĭ<><C4AC><EFBFBD><EFBFBD>ǰ̨
lbl1_signtip.Caption:='ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ȷ<EFBFBD><C8B7>ǩ<EFBFBD><C7A9>!';
img1.Visible:=true;
application.MessageBox(PChar('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ȷ<EFBFBD><C8B7>ǩ<EFBFBD>ֽ<EFBFBD><D6BD>б<EFBFBD><D0B1><EFBFBD>!'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION) ;
end;
procedure Tfrm_op_seae_invoice_sign.btn8_confirmsignClick(Sender: TObject);
var
pdffile,picfile:string;
remotePath:string;
begin
if m_newfilename='' then
begin
application.MessageBox(PChar('<27><><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>!'),'<27><>Ϣ<EFBFBD><CFA2>ʾ') ;
exit;
end;
remotePath:=get_parameters_value(175,'\\223.223.95.160\data')+'\custsign';
//remotePath:='\\dev000\custsign';
//remotePath:='\\X6x8-20170109nn\<5C><><EFBFBD>Դ洢<D4B4>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>';
try
picfile:= copy(m_newfilename,0, length(m_newfilename) - 3)+'bmp';
img1.Picture.SaveToFile(picfile);
UpLoadCustFPSignFile(m_newfilename,picfile ,remotePath,'user','user',m_invoceno);
application.MessageBox(PChar('ȷ<><C8B7>ǩ<EFBFBD>ֳɹ<D6B3><><C7A9><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD>!'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION) ;
m_isNewSign:=False;
intialNewSign();
Edit1_fph0.Focused();
m_blhastranse:=False;
btn8_confirmsign.Enabled:=False;
img1.Visible:=False;
lbl1_signtip.Caption:='';
except
on Ex:Exception do
begin
Application.MessageBox(PChar('ȷ<><C8B7>ǩ<EFBFBD><C7A9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>쳣:'+ex.Message),PChar('<27><>Ϣ<EFBFBD><CFA2>ʾ'),MB_ICONINFORMATION);
end;
end;
end;
procedure Tfrm_op_seae_invoice_sign.btn3_custprintClick(Sender: TObject);
begin
sys_print('<27><>Ʊǩ<C6B1>յ<EFBFBD>',2,ds1_fpm,ds2_fpd,nil,nil,nil,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_op_seae_invoice_sign.btn4_viewSignClick(Sender: TObject);
begin
if(m_newfilename='') or (not FileExists(m_newfilename)) then
Exit;
ShellExecute(Handle, nil, pchar(m_newfilename), nil, nil, SW_NORMAL);
end;
procedure Tfrm_op_seae_invoice_sign.bsSkinButton38Click(Sender: TObject);
begin
bsSkinNotebook1.ActivePage :='page1';
end;
procedure Tfrm_op_seae_invoice_sign.btn4_searchNewClick(Sender: TObject);
var
str:string;
begin
str:=' where 1=1 ' ;
if Edit1_seach_fpqsbh.text<>''then
str:=str+' and <20><>Ʊǩ<C6B1>ձ<EFBFBD><D5B1><EFBFBD> like '+''''+'%'
+Edit1_seach_fpqsbh.text+'%'+'''';
if Edit2_seach_khmch.text<>''then
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'
+ StringReplace(trim(Edit2_seach_khmch.text),'''','''''',[rfReplaceall])+'%'+'''';
if wdbdtmpckr1_seach_lu.text<>''then
str:=str+' and ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wdbdtmpckr1_seach_lu.text+'''';
if wdbdtmpckr2_seach_lu.text<>''then
str:=str+' and ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wdbdtmpckr2_seach_lu.text+' 23:59:59''';
str:='select * from t_ch_invoice_sign_main ' + str;
qry1_sear_fpm.SQL.Add(str);
qry1_sear_fpm.Open;
with qry1_sear_fpm do
begin
close;sql.clear;
sql.add(str);
open;First;
end;
qry2_sear_fpd.Close();
qry2_sear_fpd.Open;
showHisSign();
if qry1_sear_fpm.IsEmpty then
begin
showmessage('û<>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ҵļ<D2B5>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>');
//exit;
end;
bsknpgcntrl1.ActivePageIndex:=0;
end;
procedure Tfrm_op_seae_invoice_sign.btn3_searchReturnClick(
Sender: TObject);
begin
bsSkinNotebook1.ActivePage :='list';
end;
procedure Tfrm_op_seae_invoice_sign.btn10_viewsignClick(Sender: TObject);
var
tmpfile:string;
begin
if qry1_sear_fpm.IsEmpty then Exit;
if(qry1_sear_fpm.fieldbyname('<27>ͻ<EFBFBD>ǩ<EFBFBD><C7A9>').IsNull) then Exit;
try
tmpfile:=qry1_sear_fpm.fieldbyname('<27>ͻ<EFBFBD>ǩ<EFBFBD><C7A9>').asstring;
if(tmpfile='') or (not FileExists(tmpfile)) then
Exit;
ShellExecute(Handle, nil, pchar(tmpfile), nil, nil, SW_NORMAL);
except
showmessage('<27><><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飡');
end ;
end;
procedure Tfrm_op_seae_invoice_sign.dxdbgrd3DblClick(Sender: TObject);
begin
bsknpgcntrl1.ActivePageIndex:=1;
end;
procedure Tfrm_op_seae_invoice_sign.dxdbgrd4DblClick(Sender: TObject);
begin
bsknpgcntrl1.ActivePageIndex:=0;
end;
procedure Tfrm_op_seae_invoice_sign.clearNouseSign();
var
aquey:TADOQuery;
sqldelete:string;
begin
//<2F><><EFBFBD><EFBFBD>
sqldelete:='delete from t_ch_invoice_sign_main where <20>ͻ<EFBFBD>ǩ<EFBFBD><C7A9> is null '
+' and ¼<><C2BC><EFBFBD><EFBFBD>='''+ employee +'''; '
+' delete from t_ch_invoice_sign_detail where <20><>Ʊǩ<C6B1>ձ<EFBFBD><D5B1><EFBFBD> '
+' not in (select <20><>Ʊǩ<C6B1>ձ<EFBFBD><D5B1><EFBFBD> from t_ch_invoice_sign_main);';
aquey:=CreateAdoQuery();
aquey.SQL.Add(sqldelete);
aquey.ExecSQL(); //
end;
procedure Tfrm_op_seae_invoice_sign.btn3_delSignClick(Sender: TObject);
begin
if qry2_fpd.Recordset.RecordCount=1 then
qry2_fpd.First;
if not qry2_fpd.eof then
qry2_fpd.Delete();
end;
procedure Tfrm_op_seae_invoice_sign.btn3_clearConditonClick(
Sender: TObject);
begin
Edit2_seach_khmch.text :='';
wdbdtmpckr1_seach_lu.text :='';
wdbdtmpckr2_seach_lu.text :='';
Edit1_seach_fpqsbh.text :='';
end;
procedure Tfrm_op_seae_invoice_sign.Edit2_seach_khmchKeyPress(
Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
btn4_searchNewClick(Self.btn4_searchNew);
end;
end;
procedure Tfrm_op_seae_invoice_sign.qry2_fpdBeforePost(DataSet: TDataSet);
begin
//
end;
procedure Tfrm_op_seae_invoice_sign.edt1_khmchKeyPress(Sender: TObject;
var Key: Char);
begin
//
if cxdbtxtdt1.Text='' then
Key:= #0;
end;
procedure Tfrm_op_seae_invoice_sign.showHisSign() ;
var
tmpfile:string;
begin
img2.Visible:=False;
if qry1_sear_fpm.IsEmpty then Exit;
if(qry1_sear_fpm.fieldbyname('<27>ͻ<EFBFBD>ǩ<EFBFBD><C7A9>ͼƬ').IsNull) then Exit;
try
tmpfile:=qry1_sear_fpm.fieldbyname('<27>ͻ<EFBFBD>ǩ<EFBFBD><C7A9>ͼƬ').asstring;
if(tmpfile='') or (not FileExists(tmpfile)) then
Exit;
img2.Picture.LoadFromFile(tmpfile);
img2.Visible :=True;
except
end
end;
procedure Tfrm_op_seae_invoice_sign.dxdbgrd3ChangeNode(Sender: TObject;
OldNode, Node: TdxTreeListNode);
begin
showHisSign();
end;
end.