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.

661 lines
24 KiB
Plaintext

11 months ago
unit u_op_seae_feerp;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid,
dxDBTLCl, dxGrClms, ComCtrls, bsSkinTabs, bsSkinCtrls, Menus,
kbmMemTable, kbmMemBinaryStreamFormat, Grids, DBGrids, ExtCtrls,ShellAPI, Excels,
StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, RxLookup,
wwdbdatetimepicker, wwdblook;
type
Tfrm_op_seae_feerp = class(TForm)
bsSkinPanel1: TbsSkinPanel;
PopupMenu2: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
bsSkinButton9: TbsSkinButton;
t_op_seae: TADOQuery;
memtblnostart: TkbmMemTable;
memtblnostart1: TDataSource;
kbmThreadDataSet1: TkbmThreadDataSet;
kbmBinaryStreamFormat1: TkbmBinaryStreamFormat;
bsSkinButton8: TbsSkinButton;
PopupMenu1: TPopupMenu;
EXCEL1: TMenuItem;
N1: TMenuItem;
EMAIL: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
SaveDialog: TSaveDialog;
Excel2: TExcel;
t_excel_bill: TADOQuery;
t_excel_billEX_ID: TAutoIncField;
t_excel_billDSDesigner: TStringField;
t_excel_billDSDesigner2: TStringField;
t_excel_billDSDesigner3: TBlobField;
t_excel_bill_bill: TADOQuery;
t_excel_bill1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGridMaskColumn4: TdxDBGridMaskColumn;
dxDBGrid1Column20: TdxDBGridColumn;
dxDBGrid1Column22: TdxDBGridColumn;
memtblnostartField: TIntegerField;
memtblnostartField20GP: TIntegerField;
memtblnostartField40HC: TIntegerField;
dxDBGrid1Column23: TdxDBGridColumn;
bsSkinPanel3: TbsSkinPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
Label125: TLabel;
wwDBLookupCombo49: TwwDBLookupCombo;
Label30: TLabel;
Edit7: TEdit;
Label16: TLabel;
wwDBDateTimePicker11: TwwDBDateTimePicker;
Label17: TLabel;
wwDBDateTimePicker12: TwwDBDateTimePicker;
Label20: TLabel;
RxDBLookupCombo22: TRxDBLookupCombo;
Label124: TLabel;
RxDBLookupCombo8: TRxDBLookupCombo;
Label8: TLabel;
RxDBLookupCombo6: TRxDBLookupCombo;
memtblnostartField40GP: TIntegerField;
memtblnostartField2: TStringField;
memtblnostartField3: TStringField;
memtblnostartField4: TFloatField;
memtblnostartField5: TFloatField;
memtblnostartTHC: TFloatField;
memtblnostartField6: TFloatField;
memtblnostartField7: TFloatField;
memtblnostartField8: TFloatField;
memtblnostartField9: TFloatField;
memtblnostartCOD: TFloatField;
memtblnostartField10: TFloatField;
memtblnostartField11: TFloatField;
memtblnostartField12: TFloatField;
memtblnostartFloatField: TFloatField;
memtblnostartField13: TFloatField;
dxDBGrid1Column17: TdxDBGridColumn;
dxDBGrid1Column18: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
dxDBGrid1Column9: TdxDBGridColumn;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridColumn;
dxDBGrid1Column13: TdxDBGridColumn;
dxDBGrid1Column14: TdxDBGridColumn;
dxDBGrid1Column15: TdxDBGridColumn;
dxDBGrid1Column16: TdxDBGridColumn;
dxDBGrid1Column19: TdxDBGridColumn;
dxDBGrid1Column21: TdxDBGridColumn;
dxDBGrid1Column24: TdxDBGridColumn;
memtblnostartField14: TStringField;
memtblnostartField15: TStringField;
dxDBGrid1Column25: TdxDBGridColumn;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure EXCELClick(Sender: TObject);
procedure EMAILClick(Sender: TObject);
private
procedure Creatememtbl;
function getportcname(ename:string):string;
// function SendEMail(Handle : THandle; Mail : TStrings):Cardinal;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_op_seae_feerp: Tfrm_op_seae_feerp;
implementation
uses u_main, my_sys_function, u_op_seae_excel, u_data_share;
{$R *.dfm}
procedure Tfrm_op_seae_feerp.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_feerp.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption);
// savereggrid(dxdbgrid6,caption);
// savereggrid(dxdbgrid9,caption);
frm_op_seae_feerp.Hide;
frm_op_seae_feerp.ManualFloat(frm_op_seae_feerp.BoundsRect );
frm_main.freeTabs('frm_op_seae_feerp');
action:=cafree;
frm_op_seae_feerp:=nil;
end;
procedure Tfrm_op_seae_feerp.FormShow(Sender: TObject);
var
NewMenuItem:TMenuItem;
begin
loadreggrid(dxdbgrid1,false,caption);
t_excel_bill.Close;
t_excel_bill.SQL.Text:='select * from t_sys_excel where <20><><EFBFBD><EFBFBD>=''<27>ͻ<EFBFBD><CDBB>շ<EFBFBD><D5B7>嵥''';
t_excel_bill.Open;
with t_excel_bill do
begin
disablecontrols ;
first ;
while not eof do
begin
NewMenuItem:=TMenuItem.Create(Self);
NewMenuItem.Name:='A'+fieldbyname('EX_ID').asString ;
NewMenuItem.Caption:=fieldbyname('<27><><EFBFBD><EFBFBD>').asstring ;
NewMenuItem.Tag:=fieldbyname('EX_ID').asinteger ;
NewMenuItem.OnClick:=EXCELClick;
EXCEL1.add(NewMenuItem);
NewMenuItem:=TMenuItem.Create(Self);
NewMenuItem.Name:='B'+fieldbyname('EX_ID').asString ;
NewMenuItem.Caption:=fieldbyname('<27><><EFBFBD><EFBFBD>').asstring ;
NewMenuItem.Tag:=fieldbyname('EX_ID').asinteger ;
NewMenuItem.OnClick:=EMAILClick;
EMAIL.add(NewMenuItem);
Next ;
end ;
enablecontrols ;
end ;
end;
procedure Tfrm_op_seae_feerp.RadioGroup1Click(Sender: TObject);
var
str:widestring;
begin
end;
procedure Tfrm_op_seae_feerp.bsSkinButton9Click(Sender: TObject);
begin
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣͳ<CFA2><CDB3>',2,nil,nil,nil,nil,nil,memtblnostart1,nil,nil,nil,nil,nil);
end;
procedure Tfrm_op_seae_feerp.bsSkinButton10Click(Sender: TObject);
var
str:string;
i:Integer;
aQuery:TADOQuery;
begin
if RxDBLookupCombo6.DisplayValue='' then begin
ShowMessage('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
Exit;
end;
t_op_seae.Close;
str:='where t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo6.DisplayValues[1]+'''';
if edit7.text<>'' then str:=str+' and t_op_seae.<2E><><EFBFBD><EFBFBD> like '+''''+'%'+Edit7.text+'%'+'''';
if wwDBLookupCombo49.text<>''then
str:=str+' and t_op_seae.<2E><><EFBFBD><EFBFBD> like '+''''+'%'+wwDBLookupCombo49.text+'%'+'''';
if wwDBDateTimePicker11.text<>''then
str:=str+' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker11.text+'''';
if wwDBDateTimePicker12.text<>''then
str:=str+' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker12.text+'''';
if RxDBLookupCombo22.DisplayValue<>''then
str:=str+' and t_op_seae.װ<>۴<EFBFBD><DBB4><EFBFBD>='+''''+RxDBLookupCombo22.DisplayValues[2]+'''';
if RxDBLookupCombo8.DisplayValue<>''then
str:=str+' and t_op_seae.ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo8.DisplayValues[2]+'''';
t_op_seae.sql.text:='SELECT t_ch_fee.<2E><><EFBFBD><EFBFBD>, t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>, t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,t_ch_fee.<2E><><EFBFBD>ѷ<EFBFBD>ʽ,t_ch_fee.<2E><><EFBFBD><EFBFBD>,'
+'t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as <20><><EFBFBD>ս<EFBFBD><D5BD><EFBFBD>,(t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as δ<>ս<EFBFBD><D5BD><EFBFBD>,'
+'t_ch_fee.<2E><>׼ as <20><>׼,t_ch_fee.<2E><><EFBFBD><EFBFBD> as <20><><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD> as <20><><EFBFBD><EFBFBD>,t_ch_fee.<2E><>ע as <20><><EFBFBD>ñ<EFBFBD>ע,'
+'t_op_seae.<2E><><EFBFBD><EFBFBD><E1B5A5>,t_op_seae.<2E><><EFBFBD><EFBFBD>, t_op_seae.<2E><><EFBFBD><EFBFBD>, t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.ί<>е<EFBFBD>λ,'
+'t_op_seae.װ<><D7B0><EFBFBD><EFBFBD>, t_op_seae.ж<><D0B6><EFBFBD><EFBFBD>, '
+'t_op_seae.<2E><><EFBFBD><EFBFBD>1, t_op_seae.<2E><><EFBFBD><EFBFBD>2, t_op_seae.<2E><><EFBFBD><EFBFBD>3'
+' FROM t_ch_fee inner join t_op_seae on t_op_seae.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
+str+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
t_op_seae.open;
memtblnostart.Close;
memtblnostart.Open;
t_op_seae.First;
i:=1;
aQuery:=CreateAdoQuery;
try
while not t_op_seae.Eof do begin
if not memtblnostart.Locate('<27><><EFBFBD><EFBFBD>',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]) then begin
memtblnostart.Insert;
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger:=i;
memtblnostart['<27><><EFBFBD><EFBFBD>']:=t_op_seae['<27><><EFBFBD><EFBFBD>'];
memtblnostart['<27><><EFBFBD><EFBFBD><E1B5A5>']:=t_op_seae['<27><><EFBFBD><EFBFBD><E1B5A5>'];
memtblnostart['ж<><D0B6><EFBFBD><EFBFBD>']:=t_op_seae['ж<><D0B6><EFBFBD><EFBFBD>'];
memtblnostart['ί<>е<EFBFBD>λ']:=t_op_seae['ί<>е<EFBFBD>λ'];
memtblnostart['20GP']:=t_op_seae['<27><><EFBFBD><EFBFBD>1'];
memtblnostart['40GP']:=t_op_seae['<27><><EFBFBD><EFBFBD>2'];
memtblnostart['40HC']:=t_op_seae['<27><><EFBFBD><EFBFBD>3'];
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>').AsFloat:=0;
memtblnostart.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>').AsFloat:=0;
memtblnostart.FieldByName('THC').AsFloat:=0;
memtblnostart.FieldByName('<27><><EFBFBD>ŷ<EFBFBD>').AsFloat:=0;
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=0;
memtblnostart.FieldByName('<27><>Ʊ<EFBFBD><C6B1>').AsFloat:=0;
memtblnostart.FieldByName('<27><>Ʊ<EFBFBD><C6B1>').AsFloat:=0;
memtblnostart.FieldByName('COD<4F>ĸ۷<C4B8>').AsFloat:=0;
memtblnostart.FieldByName('<27><><EFBFBD>ķ<EFBFBD>').AsFloat:=0;
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=0;
memtblnostart.FieldByName('Ǧ<><C7A6><EFBFBD><EFBFBD>').AsFloat:=0;
memtblnostart.FieldByName('<27>ļ<EFBFBD><C4BC><EFBFBD>').AsFloat:=0;
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=0;
memtblnostart.Post;
Inc(i);
end;
memtblnostart.Edit;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>˷<EFBFBD>' then begin
if t_op_seae.FieldByName('<27><><EFBFBD>ѷ<EFBFBD>ʽ').AsString='CC' then
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>').AsFloat:=memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat
else
memtblnostart.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>').AsFloat:=memtblnostart.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='THC' then begin
memtblnostart.FieldByName('THC').AsFloat:=memtblnostart.FieldByName('THC').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>ŷ<EFBFBD>' then begin
memtblnostart.FieldByName('<27><><EFBFBD>ŷ<EFBFBD>').AsFloat:=memtblnostart.FieldByName('<27><><EFBFBD>ŷ<EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><>Ʊ<EFBFBD><C6B1>' then begin
memtblnostart.FieldByName('<27><>Ʊ<EFBFBD><C6B1>').AsFloat:=memtblnostart.FieldByName('<27><>Ʊ<EFBFBD><C6B1>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><>Ʊ<EFBFBD><C6B1>' then begin
memtblnostart.FieldByName('<27><>Ʊ<EFBFBD><C6B1>').AsFloat:=memtblnostart.FieldByName('<27><>Ʊ<EFBFBD><C6B1>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='COD<4F>ĸ۷<C4B8>' then begin
memtblnostart.FieldByName('COD<4F>ĸ۷<C4B8>').AsFloat:=memtblnostart.FieldByName('COD<4F>ĸ۷<C4B8>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>ķ<EFBFBD>' then begin
memtblnostart.FieldByName('<27><><EFBFBD>ķ<EFBFBD>').AsFloat:=memtblnostart.FieldByName('<27><><EFBFBD>ķ<EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Ǧ<><C7A6><EFBFBD><EFBFBD>' then begin
memtblnostart.FieldByName('Ǧ<><C7A6><EFBFBD><EFBFBD>').AsFloat:=memtblnostart.FieldByName('Ǧ<><C7A6><EFBFBD><EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ļ<EFBFBD><C4BC><EFBFBD>' then begin
memtblnostart.FieldByName('<27>ļ<EFBFBD><C4BC><EFBFBD>').AsFloat:=memtblnostart.FieldByName('<27>ļ<EFBFBD><C4BC><EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
if t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
end;
memtblnostart.Post;
t_op_seae.Next;
end;
finally
FreeAndNil(aQuery);
end;
memtblnostart.SortOn('<27><><EFBFBD><EFBFBD>',[]);
end;
procedure Tfrm_op_seae_feerp.Creatememtbl;
begin
end;
procedure Tfrm_op_seae_feerp.bsSkinButton8Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton8.ClientToScreen(Point(0,bsSkinButton8.Height));
PopupMenu1.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_op_seae_feerp.N4Click(Sender: TObject);
begin
if t_op_SEAE.IsEmpty then
exit;
try
frm_op_seae_excel:=tfrm_op_seae_excel.Create (self);
frm_op_seae_excel.tradetype:='<27>ͻ<EFBFBD><CDBB>շ<EFBFBD><D5B7>嵥';
frm_op_seae_excel.data1.dataset:=memtblnostart;
frm_op_seae_excel.ShowModal;
finally
frm_op_seae_excel.Free;
end;
end;
procedure Tfrm_op_seae_feerp.EXCELClick(Sender: TObject);
var
str:Tstringlist;
wide_str:widestring;
i:integer;
Y,j,GP20,GP40,HC40:INTEGER;
YFHYF,DFHYF,DFF,THC,AJF,BPF,FPF,COD,GGF,HDF,QFF,WJF,QTF:Double;
begin
if t_excel_bill.IsEmpty then
exit;
t_excel_bill.Locate('EX_ID',TMenuItem(Sender).tag,[]);
t_excel_billDSDesigner3.SaveToFile(ExtractFilePath(ParamStr(0))+t_excel_bill.fieldbyname('EX_ID').asstring+'.xls');
str:=Tstringlist.Create;
str.Clear;
excel2.Connect;
Excel2.Exec('[open('+'"'+ExtractFilePath(ParamStr(0))+t_excel_bill.fieldbyname('EX_ID').asstring+'.xls'+'"'+')]');
memtblnostart.First;
t_excel_bill_bill.Open;
i:=0;
J:=0;
GP20:=0;
GP40:=0;
while not memtblnostart.Eof do begin
Y:=memtblnostart.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger;
t_excel_bill_bill.First;
while not t_excel_bill_bill.eof do
begin
if trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)<>'<27>̶<EFBFBD>ֵ'then
begin
if (trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)='<27><><EFBFBD><EFBFBD>') or (trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)='<27><><EFBFBD><EFBFBD><E1B5A5>') or (trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)='ί<>е<EFBFBD>λ')
or (trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)='ж<><D0B6><EFBFBD><EFBFBD>') or (trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)='20GP')
or (trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)='40GP') or (trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)='40HC') then begin
excel2.putstr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i,
t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>X').asinteger,
memtblnostart.fieldbyname(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring).asstring);
end else begin
excel2.PutExt(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i,
t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>X').asinteger,
memtblnostart.fieldbyname(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring).AsFloat);
end;
end
else
begin
excel2.putstr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i,
t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>X').asinteger,
trim(t_excel_bill_bill.fieldbyname('<27>̶<EFBFBD>ֵ').asstring));
end;
t_excel_bill_bill.next;
end;
i:=i+1;
J:=memtblnostart.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger;
GP20:=GP20+memtblnostart.FieldByName('20GP').AsInteger;
GP40:=GP40+memtblnostart.FieldByName('40GP').AsInteger;
HC40:=HC40+memtblnostart.FieldByName('40HC').AsInteger;
DFHYF:=DFHYF+memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>').AsFloat;
YFHYF:=YFHYF+memtblnostart.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>').AsFloat;
THC:=THC+memtblnostart.FieldByName('THC').AsFloat;
DFF:=DFF+memtblnostart.FieldByName('<27><><EFBFBD>ŷ<EFBFBD>').AsFloat;
AJF:=AJF+memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
BPF:=BPF+memtblnostart.FieldByName('<27><>Ʊ<EFBFBD><C6B1>').AsFloat;
FPF:=FPF+memtblnostart.FieldByName('<27><>Ʊ<EFBFBD><C6B1>').AsFloat;
COD:=COD+memtblnostart.FieldByName('COD<4F>ĸ۷<C4B8>').AsFloat;
GGF:=GGF+memtblnostart.FieldByName('<27><><EFBFBD>ķ<EFBFBD>').AsFloat;
HDF:=HDF+memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
QFF:=QFF+memtblnostart.FieldByName('Ǧ<><C7A6><EFBFBD><EFBFBD>').AsFloat;
WJF:=WJF+memtblnostart.FieldByName('<27>ļ<EFBFBD><C4BC><EFBFBD>').AsFloat;
QTF:=QTF+memtblnostart.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
memtblnostart.Next;
end;
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,3,'<27>ϼ<EFBFBD>');
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,4,IntToStr(GP20));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,5,IntToStr(GP40));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,6,IntToStr(HC40));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,7,'$'+floattostr(YFHYF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,8,'$'+floattostr(DFHYF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,9,'<27><>'+floattostr(THC));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,10,'<27><>'+floattostr(DFF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,11,'<27><>'+floattostr(AJF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,12,'<27><>'+floattostr(BPF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,13,'<27><>'+floattostr(FPF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,14,'<27><>'+floattostr(COD));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,15,'<27><>'+floattostr(GGF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,16,'<27><>'+floattostr(HDF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,17,'<27><>'+floattostr(QFF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,18,'<27><>'+floattostr(WJF));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,19,'<27><>'+floattostr(QTF));
excel2.PutStr(2,1,'MV.'+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+' '+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
excel2.PutStr(3,1,'ETD SHA:'+formatdatetime('YYYY-MM-DD',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asdatetime));
SaveDialog.Filter := '(*.xls)|*.xls';
SaveDialog.FileName := t_excel_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'.xls';
if SaveDialog.Execute then
begin
excel2.Exec('[SAVE.AS("'+SaveDialog.FileName+'";1;"";false;"";false)]');
excel2.Exec('[CLOSE(false)]');
excel2.Exec('[open("'+SaveDialog.FileName+'")]');
excel2.Exec('[APP.maxIMIZE()]'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>excel
end;
deletefile(ExtractFilePath(ParamStr(0))+t_excel_bill.fieldbyname('EX_ID').asstring+'.xls');
end;
{
function Tfrm_op_railway_daterp.SendEMail(Handle : THandle; Mail : TStrings):Cardinal;
TYPE
TAttachAccessArray = ARRAY [0..0] OF TMapiFileDesc;
PAttachAccessArray = ^TAttachAccessArray;
VAR
MapiMessage : TMapiMessage;
Receip : TMapiRecipDesc;
Attachments : PAttachAccessArray;
AttachCount : INTEGER;
iCount : INTEGER;
FileName : STRING;
BEGIN
fillChar(MapiMessage, SizeOf(MapiMessage), #0);
Attachments := NIL;
fillChar(Receip,SizeOf(Receip), #0);
IF Mail.Values['to'] <> ''
THEN
BEGIN
Receip.ulReserved := 0;
Receip.ulRecipClass := MAPI_TO;
Receip.lpszName := StrNew(PChar(Mail.Values['to']));
Receip.lpszAddress := StrNew(PChar('SMTP:' + Mail.Values['to']));
Receip.ulEIDSize := 0;
MapiMessage.nRecipCount := 1;
MapiMessage.lpRecips := @Receip;
END;
AttachCount := 0;
FOR iCount := 0 TO MaxInt
DO
BEGIN
IF Mail.Values['attachment' + IntToStr(iCount)] = ''
THEN
BREAK;
AttachCount := AttachCount + 1;
END;
IF AttachCount > 0
THEN
BEGIN
GetMem(Attachments,SizeOf(TMapiFileDesc) * AttachCount);
FOR iCount := 0 TO (AttachCount - 1)
DO
BEGIN
FileName := Mail.Values['attachment' + IntToStr(iCount)];
Attachments[iCount].ulReserved := 0;
Attachments[iCount].flFlags := 0;
Attachments[iCount].nPosition := ULONG($FFFFFFFF);
Attachments[iCount].lpszPathName := StrNew(PChar(FileName));
Attachments[iCount].lpszFileName := StrNew(PChar(ExtractFileName(FileName)));
Attachments[iCount].lpFileType := NIL;
END;
MapiMessage.nFileCount := AttachCount;
MapiMessage.lpFiles := @Attachments^;
END;
IF Mail.Values['subject'] <> ''
THEN
MapiMessage.lpszSubject := StrNew(PChar(Mail.Values['subject']));
IF Mail.Values['body'] <> ''
THEN
MapiMessage.lpszNoteText := StrNew(PChar(Mail.Values['body']));
Result := MapiSendMail(0, Handle, MapiMessage,MAPI_DIALOG*Ord(Handle <> 0) OR MAPI_LOGON_UI OR MAPI_NEW_SESSION, 0);
FOR iCount := 0 TO (AttachCount - 1)
DO
BEGIN
strDispose(Attachments[iCount].lpszPathName);
strDispose(Attachments[iCount].lpszFileName);
END;
IF assigned(MapiMessage.lpszSubject)
THEN
strDispose(MapiMessage.lpszSubject);
IF assigned(MapiMessage.lpszNoteText)
THEN
strDispose(MapiMessage.lpszNoteText);
IF assigned(Receip.lpszAddress)
THEN
strDispose(Receip.lpszAddress);
IF assigned(Receip.lpszName)
THEN
strDispose(Receip.lpszName);
END;
}
procedure Tfrm_op_seae_feerp.EMAILClick(Sender: TObject);
var
str:Tstringlist;
wide_str,filename:widestring;
i:integer;
Y,j,GP20,GP40:INTEGER;
begin
if t_excel_bill.IsEmpty then
exit;
t_excel_bill.Locate('EX_ID',TMenuItem(Sender).tag,[]);
t_excel_billDSDesigner3.SaveToFile(ExtractFilePath(ParamStr(0))+t_excel_bill.fieldbyname('EX_ID').asstring+'.xls');
str:=Tstringlist.Create;
str.Clear;
excel2.Connect;
Excel2.Exec('[open('+'"'+ExtractFilePath(ParamStr(0))+t_excel_bill.fieldbyname('EX_ID').asstring+'.xls'+'"'+')]');
memtblnostart.First;
t_excel_bill_bill.Open;
i:=0;
J:=0;
GP20:=0;
GP40:=0;
while not memtblnostart.Eof do begin
Y:=memtblnostart.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger;
t_excel_bill_bill.First;
while not t_excel_bill_bill.eof do
begin
if trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)<>'<27>̶<EFBFBD>ֵ'then
begin
if trim(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring)<>'<27><><EFBFBD><EFBFBD>'then begin
excel2.putstr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i,
t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>X').asinteger,
memtblnostart.fieldbyname(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring).asstring);
end else begin
if J<>Y then begin
excel2.putstr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i,
t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>X').asinteger,
memtblnostart.fieldbyname(t_excel_bill_bill.fieldbyname('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>').asstring).asstring);
end;
end;
end
else
begin
excel2.putstr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i,
t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>X').asinteger,
trim(t_excel_bill_bill.fieldbyname('<27>̶<EFBFBD>ֵ').asstring));
end;
t_excel_bill_bill.next;
end;
i:=i+1;
J:=memtblnostart.fieldbyname('<27><><EFBFBD><EFBFBD>').AsInteger;
if memtblnostart.FieldByName('20GP').AsInteger=1 then begin
GP20:=GP20+1;
end else begin
GP40:=GP40+1;
end;
memtblnostart.Next;
end;
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,2,'<27>ϼ<EFBFBD>');
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,4,IntToStr(GP20));
excel2.PutStr(t_excel_bill_bill.fieldbyname('<27><><EFBFBD><EFBFBD>Y').asinteger+i+2,5,IntToStr(GP40));
excel2.PutStr(1,1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ('+memtblnostart.fieldbyname('<27><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE>').AsString+'<27>ڰ<EFBFBD><DAB0><EFBFBD>');
filename:=ExtractFilePath(application.ExeName)+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ'+formatdatetime('YYYYMMDDSS',Now)+'.XLS';
excel2.Exec('[SAVE.AS("'+filename+'";0;"";false;"";false)]');
excel2.Exec('[CLOSE(false)]');
// shellexecute(handle,'open',pchar(''+Logininfo.foxmail+''),pchar(''+ExtractFilePath(application.ExeName)+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ'+formatdatetime('YYYYMMDDSS',Now)+'.XLS'+''),nil,sw_shownormal);
{
frmsendmail:=Tfrmsendmail.Create(Self);
try
frmsendmail.Edit4.Text:=filename;
frmsendmail.ShowModal;
finally
FreeAndNil(frmsendmail);
end;
}
deletefile(filename);
deletefile(ExtractFilePath(ParamStr(0))+t_excel_bill.fieldbyname('EX_ID').asstring+'.xls');
// filename:='"'+filename+'"';
// ShellExecute(1,pchar('Open'),PChar('D:\Program Files\Foxmail 7.0\Foxmail.exe'),pchar(filename),'',SW_SHOW);
{
mail := TStringList.Create;
try
mail.values['attachment0'] :=filename;
sendEMail(Application.Handle, mail);
finally
mail.Free;
end;
}
// filename:='"'+filename+'"';
// excel2.Exec('[open("'+SaveDialog.FileName+'")]');
// excel2.Exec('[APP.maxIMIZE()]'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>excel
// ShellExecute(1,pchar('Open'),PChar('mailto:xxx@xx?subject'),pchar(filename),'',SW_SHOW);
// ShellExecute(Self.Handle, nil,PChar('mailto:xxx@xx?&Attach='+filename+''),nil,nil,1);
end;
function Tfrm_op_seae_feerp.getportcname(ename: string): string;
var
aQuery:TADOQuery;
begin
result:=ename;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_code_loaport where Ӣ<><D3A2><EFBFBD><EFBFBD>='''+ename+'''');
Open;
if not IsEmpty then
result:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
end.