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.

1579 lines
62 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_rp_dui_month;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl,
dxDBGrid, DB, ADODB, StdCtrls, Mask, DBCtrls, dxDBTLCl, dxGrClms,
RxLookup, wwdbdatetimepicker, Menus, XPMenu, ComCtrls, bsSkinTabs,
RxMemDS, wwdbedit, Wwdotdot, Wwdbcomb, Grids, DBGrids, wwdblook,
kbmMemTable, bsdbctrls, DBCtrlsEh,IdSMTP,IdMessage,IdAttachmentFile,
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase;
type
Tfrm_rp_dui_month = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
t_ch_dui_month: TADOQuery;
XPMenu1: TXPMenu;
bsSkinButton38: TbsSkinButton;
Notebook1: TNotebook;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridMaskColumn;
dxDBGrid1Column8: TdxDBGridMaskColumn;
dxDBGrid1Column9: TdxDBGridDateColumn;
dxDBGrid1Column7: TdxDBGridColumn;
bsSkinPanel9: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
t_ch_dui_month1: TDataSource;
t_ch_dui_corp_month: TADOQuery;
t_ch_dui_corp_month1: TDataSource;
t_ch_dui_detail_month: TADOQuery;
t_ch_dui_detail_month1: TDataSource;
dxDBGrid2: TdxDBGrid;
dxDBGrid2Column8: TdxDBGridColumn;
dxDBGrid2Column19: TdxDBGridColumn;
dxDBGrid2Column18: TdxDBGridColumn;
dxDBGrid2Column3: TdxDBGridColumn;
dxDBGrid2Column17: TdxDBGridColumn;
dxDBGrid2Column13: TdxDBGridColumn;
dxDBGrid2Column16: TdxDBGridColumn;
dxDBGrid2Column12: TdxDBGridColumn;
dxDBGrid2Column14: TdxDBGridColumn;
dxDBGrid2Column9: TdxDBGridColumn;
dxDBGrid2Column10: TdxDBGridColumn;
dxDBGrid2Column11: TdxDBGridColumn;
dxDBGrid3: TdxDBGrid;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGridColumn4: TdxDBGridColumn;
dxDBGridColumn5: TdxDBGridColumn;
dxDBGridColumn6: TdxDBGridColumn;
dxDBGridColumn7: TdxDBGridColumn;
dxDBGridColumn8: TdxDBGridColumn;
dxDBGridColumn9: TdxDBGridColumn;
dxDBGrid2Column15: TdxDBGridColumn;
dxDBGrid2Column20: TdxDBGridColumn;
dxDBGrid2Column21: TdxDBGridColumn;
dxDBGrid2Column22: TdxDBGridColumn;
bsSkinPanel1: TbsSkinPanel;
tex: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsSkinPanel3: TbsSkinPanel;
Label38: TLabel;
DBEdit9: TDBEdit;
Label1: TLabel;
DBEdit1: TDBEdit;
Label2: TLabel;
DBEdit2: TDBEdit;
Label213: TLabel;
RxDBLookupCombo57: TRxDBLookupCombo;
bsSkinPanel4: TbsSkinPanel;
bsSkinButton9: TbsSkinButton;
Label18: TLabel;
wwDBDateTimePicker3: TwwDBDateTimePicker;
t_crm_client_sales: TADOQuery;
wwDBDateTimePicker1: TwwDBDateTimePicker;
Label3: TLabel;
bsSkinButton8: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
dxDBGrid2Column23: TdxDBGridCheckColumn;
dxDBGrid2Column24: TdxDBGridColumn;
dxDBGrid2Column25: TdxDBGridColumn;
Label4: TLabel;
wwDBDateTimePicker2: TwwDBDateTimePicker;
bsSkinButton13: TbsSkinButton;
bsSkinButton14: TbsSkinButton;
Label5: TLabel;
wwDBDateTimePicker4: TwwDBDateTimePicker;
bsSkinButton15: TbsSkinButton;
dxDBGrid3Column10: TdxDBGridColumn;
dxDBGrid3Column11: TdxDBGridColumn;
dxDBGrid3Column12: TdxDBGridColumn;
dxDBGrid2Column26: TdxDBGridColumn;
t_ch_dui: TADOQuery;
t_ch_dui_bill: TADOQuery;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
t_ch_dui_corp_monthSel1: TDataSource;
t_ch_dui_corp_monthSel: TADOQuery;
dxDBGrid2Column27: TdxDBGridColumn;
dxDBGrid2Column28: TdxDBGridColumn;
dxDBGrid3Column13: TdxDBGridColumn;
dxDBGrid3Column14: TdxDBGridColumn;
dxDBGrid2Column29: TdxDBGridColumn;
mailSend: TkbmMemTable;
mailSendStringField: TStringField;
mailSendField: TStringField;
bsSkinButton16: TbsSkinButton;
bsSkinButton17: TbsSkinButton;
wwDBComboBox44: TwwDBComboBox;
Label39: TLabel;
dxDBGrid3Column15: TdxDBGridColumn;
dxDBGrid2Column30: TdxDBGridColumn;
SMTP1: TIdSMTP;
IdMsg: TIdMessage;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinPanel2Resize(Sender: TObject);
procedure t_ch_dui_monthAfterInsert(DataSet: TDataSet);
procedure t_ch_dui_monthBeforePost(DataSet: TDataSet);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure bsSkinButton38Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure texClick(Sender: TObject);
procedure dxDBGrid2DblClick(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton13Click(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure bsSkinButton15Click(Sender: TObject);
procedure dxDBGrid2Click(Sender: TObject);
procedure bsSkinButton16Click(Sender: TObject);
procedure bsSkinButton17Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetInvoiceAmt:boolean;
Procedure ExportExcelFile(FileName: string; bWriteTitle: Boolean; aDataSet: TDataSet);
Procedure UpdateDuiNo(bsno:string;typeid:integer);
end;
var
frm_rp_dui_month: Tfrm_rp_dui_month;
implementation
uses u_main, my_sys_function, u_data_share, u_rp_dui_format, u_rp_dui_query,
u_rp_dui_formatrpt, u_rp_op_ttl, u_sys_progress, u_sendmail_message;
{$R *.dfm}
function Tfrm_rp_dui_month.GetInvoiceAmt:boolean;
begin
end;
procedure Tfrm_rp_dui_month.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_dui_month.bsSkinPanel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.width/7);
bsSkinButton1.width:=i;
bsSkinButton2.width:=i;
bsSkinButton3.width:=i;
bsSkinButton4.width:=i;
bsSkinButton11.width:=i;
bsSkinButton38.width:=i;
end;
procedure Tfrm_rp_dui_month.t_ch_dui_monthAfterInsert(DataSet: TDataSet);
begin
t_ch_dui_month['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_ch_dui_month['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
end;
procedure Tfrm_rp_dui_month.t_ch_dui_monthBeforePost(DataSet: TDataSet);
begin
if t_ch_dui_month.State=dsinsert then
begin
t_ch_dui_month['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=get_no(date,'JF');
end;
end;
procedure Tfrm_rp_dui_month.bsSkinButton1Click(Sender: TObject);
begin
t_ch_dui_month.insert;
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end;
procedure Tfrm_rp_dui_month.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_ch_dui_month);
end;
Procedure Tfrm_rp_dui_month.UpdateDuiNo(bsno:string;typeid:integer);
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('Update t_op_seae set <20><><EFBFBD><EFBFBD><ECB5A5>=:<3A><><EFBFBD><EFBFBD><ECB5A5>');
sql.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=bsno;
case typeid of
0:Parameters.ParamByName('<27><><EFBFBD><EFBFBD><ECB5A5>').Value:='';
1:Parameters.ParamByName('<27><><EFBFBD><EFBFBD><ECB5A5>').Value:=t_ch_dui_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString;
end;
Execsql;
Close;sql.Clear;
sql.Add('Update t_ch_fee set <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and (t_ch_fee.<2E>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> is null or t_ch_fee.<2E>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0) and t_ch_fee.<2E><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=bsno;
case typeid of
0:Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=false;
1:Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=true;
end;
Execsql;
finally
Free;
end;
end;
procedure Tfrm_rp_dui_month.bsSkinButton4Click(Sender: TObject);
var aAdoQuery:TAdoQuery;
str:widestring;
begin
if t_ch_dui_month.IsEmpty then
exit;
if (t_ch_dui_corp_month.RecordCount>0) or (t_ch_dui_detail_month.RecordCount>0) then
begin
if MessageDlg('<27><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>,ȷʵҪɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
exit
else
begin
frm_main.db.BeginTrans;
try
t_ch_dui_corp_month.DisableControls;
t_ch_dui_detail_month.DisableControls;
t_ch_dui_corp_month.First;
while not t_ch_dui_corp_month.eof do
t_ch_dui_corp_month.delete;
t_ch_dui_detail_month.First;
while not t_ch_dui_detail_month.eof do
begin
UpdateDuiNo(t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString,0);
t_ch_dui_detail_month.delete;
end;
t_ch_dui_corp_month.EnableControls;
t_ch_dui_detail_month.EnableControls;
t_ch_dui_month.Delete;
frm_main.db.CommitTrans;
finally
if frm_main.db.InTransaction then
begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>ԣ<EFBFBD>',mterror,[mbok],0);
frm_main.db.RollbackTrans;
end
end;
end;
end
else t_ch_dui_month.Delete;
end;
procedure Tfrm_rp_dui_month.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_ch_dui_month);
end;
procedure Tfrm_rp_dui_month.bsSkinButton11Click(Sender: TObject);
var
answer:TModalResult;
begin
if bsSkinButton11.Caption='<27><EFBFBD>޸<EFBFBD>' then
begin
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end
else
begin
if (t_ch_dui_month.State=dsinsert)or(t_ch_dui_month.State=dsedit) then
BEGIN
answer:=messagedlg( '<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE>޸ģ<DEB8><C4A3>Ƿ񱣴棿',mtWarning,mbYesNoCancel,0);
if answer=mrYes then
begin
t_ch_dui_month.post;
end;
if answer=mrNo then
begin
t_ch_dui_month.cancel;
end;
if answer=mrCancel then
begin
exit;
end;
END;
Notebook1.PageIndex:=0;
bsSkinButton11.Caption:='<27><EFBFBD>޸<EFBFBD>';
end;
end;
procedure Tfrm_rp_dui_month.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid2,caption+'2');
savereggrid(dxdbgrid3,caption+'3');
frm_rp_dui_month.Hide;
frm_rp_dui_month.ManualFloat(frm_rp_dui_month.BoundsRect );
frm_main.freeTabs('frm_rp_dui_month');
action:=cafree;
frm_rp_dui_month:=nil;
end;
procedure Tfrm_rp_dui_month.FormShow(Sender: TObject);
var
str:widestring;
begin
loadreggrid(dxdbgrid2,false,caption+'2');
loadreggrid(dxdbgrid3,false,caption+'3');
Notebook1.PageIndex:=0;
try
str:='select top 50 * from t_ch_dui_month ';
str:=str+' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc';
t_ch_dui_month.close;
t_ch_dui_month.SQL.clear;
t_ch_dui_month.sql.Add(str);
t_ch_dui_month.open;
t_ch_dui_corp_month.close;
t_ch_dui_corp_month.open;
t_ch_dui_detail_month.close;
t_ch_dui_detail_month.open;
t_crm_client_sales.open;
except
on e : exception do begin
showmessage(e.Message);
end;
end;
end;
procedure Tfrm_rp_dui_month.dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort(Column,t_ch_dui_month,'<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>');
end;
procedure Tfrm_rp_dui_month.bsSkinButton38Click(Sender: TObject);
var
book1:Tbookmark;
begin
book1:=t_ch_dui_month.GetBookmark;
t_ch_dui_month.Requery;
t_ch_dui_month.GotoBookmark(book1);
end;
procedure Tfrm_rp_dui_month.bsSkinButton7Click(Sender: TObject);
begin
grid_save_xls(dxDBGrid2);
end;
procedure Tfrm_rp_dui_month.texClick(Sender: TObject);
var ADOQuerySelect,aQuery:TAdoquery;
begin
if wwDBDateTimePicker2.Text='' then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>');
exit;
end;
if wwDBDateTimePicker3.Text='' then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>');
exit;
end;
if t_ch_dui_month.IsEmpty then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6>ʵ<EFBFBD>!');
exit;
end;
if (t_ch_dui_month.State=dsinsert)or(t_ch_dui_month.State=dsedit)then
t_ch_dui_month.post;
if (not t_ch_dui_corp_month.IsEmpty) then begin
if MessageDlg('<27>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>˵<EFBFBD><CBB5><EFBFBD><E6B5B5>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbYes,mbNo],0)<>mrYes then begin
exit;
end;
end;
{
if (t_ch_dui_corp_month.RecordCount>0) or (t_ch_dui_detail_month.RecordCount>0) then
begin
if MessageDlg('<27><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>,<2C><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
exit
else
begin
frm_main.db.BeginTrans;
try
t_ch_dui_corp_month.DisableControls;
t_ch_dui_detail_month.DisableControls;
t_ch_dui_corp_month.First;
while not t_ch_dui_corp_month.eof do
t_ch_dui_corp_month.delete;
t_ch_dui_detail_month.First;
while not t_ch_dui_detail_month.eof do
begin
UpdateDuiNo(t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString,0);
t_ch_dui_detail_month.delete;
end;
t_ch_dui_corp_month.EnableControls;
t_ch_dui_detail_month.EnableControls;
frm_main.db.CommitTrans;
finally
if frm_main.db.InTransaction then
begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>ԣ<EFBFBD>',mterror,[mbok],0);
frm_main.db.RollbackTrans;
end
end;
end;
end;
}
frm_main.db.BeginTrans;
try
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ򡣡<C8BA><F2A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=100;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
t_ch_dui_corp_month.DisableControls;
t_ch_dui_detail_month.DisableControls;
ADOQuerySelect:=CreateAdoQuery;
aQuery:=CreateAdoQuery;
with ADOQuerySelect do
begin
close;
sql.Clear;
sql.add('select t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD><E1B5A5>,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.װ<><D7B0><EFBFBD><EFBFBD>,t_op_seae.Ŀ<>ĵ<EFBFBD>,t_op_seae.<2E><>װ<EFBFBD><D7B0>,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>');
sql.add(',CASE WHEN ISNULL(t_ch_fee.<2E><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD>,'''')='''' THEN t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ELSE t_ch_fee.<2E><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD> END <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>,t_crm_client_sales.<2E><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add(',t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ');
sql.add(',t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,(32-DAY(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+32-DAY(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)))) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add(',sum(case when <20>ұ<EFBFBD>=''USD'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) USD');
sql.add(',sum(case when <20>ұ<EFBFBD>=''RMB'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) RMB');
sql.add(',');
sql.add('case');
sql.add(' when t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' then');
sql.add(' t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add(' else');
sql.add(' case when (32-DAY(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+32-DAY(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>))))');
sql.add('>=t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and cast(t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as int)>1 then');
sql.add(' CONVERT(datetime');
sql.add(' ,cast(YEAR(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)) as varchar)');
sql.add(' +''/''+');
sql.add(' cast(month(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)) as varchar)');
sql.add(' +''/''+');
sql.add(' cast(t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as varchar)');
sql.add(' )');
sql.add(' else');
sql.add(' CONVERT(datetime');
sql.add(' ,cast(YEAR(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)) as varchar)');
sql.add(' +''/''+');
sql.add(' cast(month(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)) as varchar)');
sql.add(' +''/''+');
sql.add(' cast((32-DAY(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+32-DAY(DATEADD([month],CAST(t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ AS int),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)))) as varchar)');
sql.add(' )');
sql.add(' end ');
sql.add('end Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add(',');
sql.Add('Case t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('when ''Լ<><D4BC>ʱ<EFBFBD><CAB1>'' then ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''+t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ+''<27><> ''+''ÿ<><C3BF>''+convert(varchar(20),t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+''<27><>''');
sql.Add('when ''Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' then ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''+convert(varchar(20),t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+''<27><>''');
sql.Add('end Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add('from t_ch_fee');
sql.add('Left join t_op_seae on t_op_seae.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD>');
sql.add('Left join t_crm_client_sales on t_crm_client_sales.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ');
sql.add('where (not t_ch_fee.<2E><><EFBFBD><EFBFBD> is null) and (not t_op_seae.<2E><><EFBFBD><EFBFBD> is null) ');
sql.add('and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=:<3A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
// sql.add('and SUBSTRING(CONVERT(char(15),t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,111),1,7)='''+FormatDateTime('YYYY',wwDBDateTimePicker3.Date)+'/'+FormatDateTime('MM',wwDBDateTimePicker3.Date)+''' ');
sql.add('and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add('and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=t_crm_client_sales.<2E><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
// sql.add(' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add('and (t_op_seae.<2E><><EFBFBD><EFBFBD><ECB5A5> is null or t_op_seae.<2E><><EFBFBD><EFBFBD><ECB5A5>='''') and (t_op_seae.<2E><><EFBFBD><EFBFBD>״̬=''<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>'' or t_op_seae.<2E><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'') ');
// sql.add('and (t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> is null or t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=0)');
sql.add(' and (t_ch_fee.<2E>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> is null or t_ch_fee.<2E>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0) and t_ch_fee.<2E><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>''');
if RxDBLookupCombo57.Text<>'<<3C><>>' then
begin
SQL.Add('and CASE WHEN ISNULL(t_ch_fee.<2E><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD>,'''')='''' THEN t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ELSE t_ch_fee.<2E><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD> END='''+RxDBLookupCombo57.DisplayValues[1]+'''');
// Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=RxDBLookupCombo57.DisplayValues[1];
end;
if wwDBComboBox44.text='20<32>պ<EFBFBD>' then begin
sql.add(' and t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''Լ<><D4BC>ʱ<EFBFBD><CAB1>'' and cast(t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as int)>=20 ');
end;
if wwDBComboBox44.text='20<32><30>ǰ' then begin
sql.add(' and ((t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''Լ<><D4BC>ʱ<EFBFBD><CAB1>'' and cast(t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as int)<20) or t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>''Լ<><D4BC>ʱ<EFBFBD><CAB1>'') ');
end;
sql.add('Group by t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD><E1B5A5>,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.װ<><D7B0><EFBFBD><EFBFBD>,t_op_seae.Ŀ<>ĵ<EFBFBD>,t_op_seae.<2E><>װ<EFBFBD><D7B0>,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>');
sql.add(',CASE WHEN ISNULL(t_ch_fee.<2E><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD>,'''')='''' THEN t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ELSE t_ch_fee.<2E><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD> END,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add(',t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD>ģʽ,t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.add(' order by CASE WHEN ISNULL(t_ch_fee.<2E><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD>,'''')='''' THEN t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ELSE t_ch_fee.<2E><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD> END,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD><E1B5A5>');
Parameters.ParamByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker2.Date;
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker3.Date;
Open;First;
//
// showmessage(sql.text);
if not isempty then
frm_sys_progress.bsSkinGauge1.MaxValue:=Recordcount;
while not eof do
begin
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD><EFBFBD><EFBFBD>'+FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
if (FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString<>'<27><><EFBFBD>̺<EFBFBD>ӥ') then begin
t_ch_dui_detail_month.Append;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString:=t_ch_dui_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_detail_month.FieldByName('<27>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_detail_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString:=trim(FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString);
t_ch_dui_detail_month.FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString:=FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('Ŀ<>ĵ<EFBFBD>').AsString:=FieldByName('Ŀ<>ĵ<EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><>װ<EFBFBD><D7B0>').AsString:=FieldByName('<27><>װ<EFBFBD><D7B0>').AsString;
if (trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD>̺<EFBFBD>ӥ') then
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString
else
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:='';
t_ch_dui_detail_month.FieldByName('USD').AsFloat:=FieldByName('USD').AsFloat;
t_ch_dui_detail_month.FieldByName('RMB').AsFloat:=FieldByName('RMB').AsFloat;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.post;
end else begin
if FieldByName('USD').AsFloat<>0 then begin
t_ch_dui_detail_month.Append;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString:=t_ch_dui_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_detail_month.FieldByName('<27>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_detail_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString:=trim(FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString);
t_ch_dui_detail_month.FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString:=FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('Ŀ<>ĵ<EFBFBD>').AsString:=FieldByName('Ŀ<>ĵ<EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><>װ<EFBFBD><D7B0>').AsString:=FieldByName('<27><>װ<EFBFBD><D7B0>').AsString;
if (trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD>̺<EFBFBD>ӥ') then
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString
else
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:='';
t_ch_dui_detail_month.FieldByName('<27>ұ<EFBFBD>').AsString:='USD';
t_ch_dui_detail_month.FieldByName('USD').AsFloat:=FieldByName('USD').AsFloat;
t_ch_dui_detail_month.FieldByName('RMB').AsFloat:=0;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.post;
end;
if FieldByName('RMB').AsFloat<>0 then begin
t_ch_dui_detail_month.Append;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString:=t_ch_dui_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_detail_month.FieldByName('<27>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_detail_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString:=trim(FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString);
t_ch_dui_detail_month.FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString:=FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('Ŀ<>ĵ<EFBFBD>').AsString:=FieldByName('Ŀ<>ĵ<EFBFBD>').AsString;
t_ch_dui_detail_month.FieldByName('<27><>װ<EFBFBD><D7B0>').AsString:=FieldByName('<27><>װ<EFBFBD><D7B0>').AsString;
if (trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD>̺<EFBFBD>ӥ') then
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString
else
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:='';
t_ch_dui_detail_month.FieldByName('<27>ұ<EFBFBD>').AsString:='RMB';
t_ch_dui_detail_month.FieldByName('USD').AsFloat:=0;
t_ch_dui_detail_month.FieldByName('RMB').AsFloat:=FieldByName('RMB').AsFloat;
t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_detail_month.post;
end;
end;
UpdateDuiNo(t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString,1);
if (FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString<>'<27><><EFBFBD>̺<EFBFBD>ӥ') then begin
if t_ch_dui_corp_month.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),[]) then
begin
t_ch_dui_corp_month.Edit;
t_ch_dui_corp_month.FieldByName('USD').AsFloat:=t_ch_dui_corp_month.FieldByName('USD').AsFloat+FieldByName('USD').AsFloat;
t_ch_dui_corp_month.FieldByName('RMB').AsFloat:=t_ch_dui_corp_month.FieldByName('RMB').AsFloat+FieldByName('RMB').AsFloat;
t_ch_dui_corp_month.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.post;
end
else if not t_ch_dui_corp_month.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),[]) then
begin
t_ch_dui_corp_month.Append;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString:=t_ch_dui_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_corp_month.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('USD').AsFloat:=FieldByName('USD').AsFloat;
t_ch_dui_corp_month.FieldByName('RMB').AsFloat:=FieldByName('RMB').AsFloat;
t_ch_dui_corp_month.FieldByName('<27><EFBFBD>ʼ<EFBFBD>').AsBoolean:=true;
t_ch_dui_corp_month.FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').AsString:=trim(FieldByName('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').AsString);
if t_crm_client_sales.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),[]) then
begin
t_ch_dui_corp_month.FieldByName('Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>β<EFBFBD><CEB2><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>绰').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵绰').AsString;
end;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:='';
if frm_data_share.t_crm_client_all.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),[]) then
begin
t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_crm_client_all.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=getzq(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_corp_month.post;
end;
end else begin
if FieldByName('USD').AsFloat<>0 then begin
if t_ch_dui_corp_month.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B>ұ<EFBFBD>',VarArrayOf([trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),'USD']),[]) then
begin
t_ch_dui_corp_month.Edit;
t_ch_dui_corp_month.FieldByName('USD').AsFloat:=t_ch_dui_corp_month.FieldByName('USD').AsFloat+FieldByName('USD').AsFloat;
t_ch_dui_corp_month.FieldByName('RMB').AsFloat:=0;
t_ch_dui_corp_month.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.post;
end
else
begin
t_ch_dui_corp_month.Append;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString:=t_ch_dui_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_corp_month.FieldByName('<27>ұ<EFBFBD>').AsString:='USD';
t_ch_dui_corp_month.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('USD').AsFloat:=FieldByName('USD').AsFloat;
t_ch_dui_corp_month.FieldByName('RMB').AsFloat:=0;
t_ch_dui_corp_month.FieldByName('<27><EFBFBD>ʼ<EFBFBD>').AsBoolean:=true;
t_ch_dui_corp_month.FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').AsString:=trim(FieldByName('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').AsString);
if t_crm_client_sales.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),[]) then
begin
t_ch_dui_corp_month.FieldByName('Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>β<EFBFBD><CEB2><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>绰').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵绰').AsString;
end;
if (trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD>̺<EFBFBD>ӥ') then
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString;
{
if (trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD>̺<EFBFBD>ӥ') then begin
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString;
aQuery.SQL.Text:='select * from t_crm_client_linkman where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>̺<EFBFBD>ӥ'' and <20><><EFBFBD><EFBFBD>='''+FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString+'''';
aQuery.Open;
if not aQuery.IsEmpty then begin
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:='joanna.yin@cevalogistics.com';
t_ch_dui_corp_month.FieldByName('<27>绰').AsString:=aQuery.FieldByName('<27><EFBFBD>绰').AsString;
end;
end else
}
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:='';
if frm_data_share.t_crm_client_all.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),[]) then
begin
t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_crm_client_all.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=getzq(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_corp_month.post;
end;
end;
if FieldByName('RMB').AsFloat<>0 then begin
if t_ch_dui_corp_month.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B>ұ<EFBFBD>',VarArrayOf([trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),'RMB']),[]) then
begin
t_ch_dui_corp_month.Edit;
t_ch_dui_corp_month.FieldByName('USD').AsFloat:=0;
t_ch_dui_corp_month.FieldByName('RMB').AsFloat:=t_ch_dui_corp_month.FieldByName('RMB').AsFloat+FieldByName('RMB').AsFloat;;
t_ch_dui_corp_month.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.post;
end
else
begin
t_ch_dui_corp_month.Append;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString:=t_ch_dui_month.FieldByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_corp_month.FieldByName('<27>ұ<EFBFBD>').AsString:='RMB';
t_ch_dui_corp_month.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('RMB').AsFloat:=FieldByName('RMB').AsFloat;
t_ch_dui_corp_month.FieldByName('USD').AsFloat:=0;
t_ch_dui_corp_month.FieldByName('<27><EFBFBD>ʼ<EFBFBD>').AsBoolean:=true;
t_ch_dui_corp_month.FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').AsString:=trim(FieldByName('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').AsString);
if t_crm_client_sales.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),[]) then
begin
t_ch_dui_corp_month.FieldByName('Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD>β<EFBFBD><CEB2><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>绰').AsString:=t_crm_client_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵绰').AsString;
end;
if (trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD>̺<EFBFBD>ӥ') then
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString;
{
if (trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD>̺<EFBFBD>ӥ') then begin
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString;
aQuery.SQL.Text:='select * from t_crm_client_linkman where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>̺<EFBFBD>ӥ'' and <20><><EFBFBD><EFBFBD>='''+FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString+'''';
aQuery.Open;
if not aQuery.IsEmpty then begin
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=aQuery.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>绰').AsString:=aQuery.FieldByName('<27><EFBFBD>绰').AsString;
end;
end else
}
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString:='';
if frm_data_share.t_crm_client_all.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString),[]) then
begin
t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_crm_client_all.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=getzq(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
t_ch_dui_corp_month.post;
end;
end;
end;
next;
end;
end;
frm_main.db.CommitTrans;
finally
if frm_main.db.InTransaction then
begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>ԣ<EFBFBD>',mterror,[mbok],0);
frm_main.db.RollbackTrans;
end;
frm_sys_progress.close;
frm_sys_progress:=nil;
t_ch_dui_corp_month.EnableControls;
t_ch_dui_detail_month.EnableControls;
ADOQuerySelect.Free;
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_rp_dui_month.dxDBGrid2DblClick(Sender: TObject);
begin
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end;
procedure Tfrm_rp_dui_month.bsSkinButton9Click(Sender: TObject);
begin
grid_save_xls(dxDBGrid3);
end;
procedure Tfrm_rp_dui_month.bsSkinButton10Click(Sender: TObject);
begin
with t_ch_dui_month do
begin
close;sql.Clear;
sql.Add(' select * from t_ch_dui_month');
sql.Add('where 1=1 ');
if wwDBDateTimePicker1.Text<>'' then
sql.add('and SUBSTRING(CONVERT(char(15),<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,111),1,7)='''+FormatDateTime('YYYY',wwDBDateTimePicker1.Date)+'/'+FormatDateTime('MM',wwDBDateTimePicker1.Date)+''' ');
sql.Add('order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
Open;First;
end
end;
Procedure Tfrm_rp_dui_month.ExportExcelFile(FileName: string; bWriteTitle: Boolean; aDataSet: TDataSet);
var
i,j: integer;
Col , row: word;
ABookMark: TBookMark;
aFileStream: TFileStream;
procedure incColRow; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
begin
if Col = ADataSet.FieldCount - 1 then
begin
Inc(Row);
Col :=0;
end
else
Inc(Col);
end;
procedure WriteStringCell(AValue: string);//д<>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
var
L: Word;
begin
L := Length(AValue);
arXlsString[1] := 8 + L;
arXlsString[2] := Row;
arXlsString[3] := Col;
arXlsString[5] := L;
aFileStream.WriteBuffer(arXlsString, SizeOf (arXlsString));
aFileStream.WriteBuffer(Pointer(AValue)^, L);
IncColRow;
end;
procedure WriteIntegerCell(AValue: integer);//д<><D0B4><EFBFBD><EFBFBD>
var
V: Integer;
begin
arXlsInteger[2] := Row;
arXlsInteger[3] := Col;
aFileStream.WriteBuffer(arXlsInteger, SizeOf(arXlsInteger));
V := (AValue shl 2) or 2;
aFileStream.WriteBuffer(V, 4);
IncColRow;
end;
procedure WriteFloatCell(AValue: double );//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
begin
arXlsNumber[2] := Row;
arXlsNumber[3] := Col;
aFileStream.WriteBuffer(arXlsNumber, SizeOf(arXlsNumber));
aFileStream.WriteBuffer(AValue, 8);
IncColRow;
end;
begin
if FileExists(FileName) then DeleteFile(FileName); //<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>ɾ<EFBFBD><C9BE>
aFileStream := TFileStream.Create(FileName, fmCreate);
Try //д<>ļ<EFBFBD>ͷ<EFBFBD><CDB7>
aFileStream.WriteBuffer(arXlsBegin, SizeOf(arXlsBegin)); //д<><D0B4>ͷ <20><>
Col := 0; Row := 0;
if bWriteTitle then
begin
for i := 0 to aDataSet.FieldCount - 1 do
WriteStringCell(aDataSet.Fields[i].FieldName);
end;
//д<><D0B4><EFBFBD>ݼ<EFBFBD><DDBC>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
aDataSet.DisableControls;
//ABookMark := aDataSet.GetBookmark;
aDataSet.First ;
while not aDataSet.Eof do
begin
for i := 0 to aDataSet.FieldCount - 1 do
case ADataSet.Fields[i].DataType of
ftSmallint, ftInteger, ftWord, ftAutoInc, ftBytes:
WriteIntegerCell(aDataSet.Fields[i].AsInteger);
ftFloat, ftCurrency, ftBCD:
WriteFloatCell(StrToFloat(FormatFloat('0.00;-0.00;0',aDataSet.Fields[i].AsFloat)))
else
WriteStringCell(aDataSet.Fields[i].AsString);
end;
aDataSet.Next;
Application.ProcessMessages;
end;
//д<>ļ<EFBFBD>β <20><>
AFileStream.WriteBuffer(arXlsEnd, SizeOf(arXlsEnd));
//if ADataSet.BookmarkValid(ABookMark) then aDataSet.GotoBookmark(ABookMark);
Finally
AFileStream.Free;
ADataSet.EnableControls;
end;
end;
procedure Tfrm_rp_dui_month.bsSkinButton8Click(Sender: TObject);
var
i:integer;
str_memo:Tmemo;
// SMTP1:TIdSMTP;
// IdMsg:TIdMessage;
strfile,mailremarks:string;
naspath:string;
begin
naspath:=get_parameters_value(175,'\\223.223.95.160\data');
if not assigned(frm_sendmail_message) then
frm_sendmail_message:=tfrm_sendmail_message.Create (self);
if frm_sendmail_message.ShowModal = mrOK then
begin
mailremarks:=frm_sendmail_message.Memo1.Text;
end
else exit;
if MessageDlg('ȷʵҪ<CAB5><D2AA><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
exit ;
try
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=100;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
t_ch_dui_corp_month.DisableControls;
t_ch_dui_detail_month.DisableControls;
with t_ch_dui_corp_month do
begin
First;
frm_sys_progress.bsSkinGauge1.MaxValue:=recordcount;
while not eof do
begin
if FieldByName('<27><EFBFBD>ʼ<EFBFBD>').AsBoolean then
begin
{
t_ch_dui_detail_month.Filtered:=false;
t_ch_dui_detail_month.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
t_ch_dui_detail_month.Filtered:=true;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
}
if not DirectoryExists(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)) then
MkDir(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now));
dxDBGrid3.Filter.Add(dxDBGridColumn1,t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'');
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ' then begin
// dxDBGrid3.Filter.Add(dxDBGrid3Column13,t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString,'');
dxDBGrid3.Filter.Add(dxDBGrid3Column14,t_ch_dui_corp_month.FieldByName('<27>ұ<EFBFBD>').AsString,'');
end;
strfile:=ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)+'\'+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+trim(t_ch_dui_corp_month.FieldByName('<27>ұ<EFBFBD>').AsString)+trim(t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString)+FormatDateTime('YYMMDDhhmm',Now)+'.xls';
dxDBGrid3.SaveToXLS(strfile,true);
dxDBGrid3.Filter.Clear;
// ExportExcelFile(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)+'\'+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+FormatDateTime('YYMMDDhhmm',Now)+'.xls',true,TDataSet(t_ch_dui_detail_month));
// SMTP1:=TIdSMTP.Create(nil);
// IdMsg:=TIdMessage.Create(nil);
str_memo:=Tmemo.create(nil);
SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL);
SMTP1.username:=MailAddress;
SMTP1.Password :=MailPw;
// SMTP1.Host :='smtpcom.263xmail.com';
SMTP1.Host :='mail.sdsmartlogistics.com';
SMTP1.Port :=25;
try
SMTP1.Connect;
except
on e : Exception do
begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+E.Message);
end;
end;
if not SMTP1.Connected then
begin
SMTP1.Connect;
end;
if FieldByName('<27><><EFBFBD><EFBFBD>').AsString<>'' then
try
with IdMsg do
begin
body.Clear;
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ' then begin
Body.Add('FROM:ɽ<><C9BD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾-SHANDONG SMART INTERNATIONAL LOGISTICS CO.,LTD');
Body.Add('<27><>Ӧ<EFBFBD>̴<EFBFBD><CCB4>룺28070442');
Body.Add('');
Body.Add(mailremarks);
end else
Body.Text:=mailremarks;
// Body.add('<27>½<EFBFBD><C2BD><EFBFBD><EFBFBD>˵<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
From.address :=MailAddress;
Recipients.EMailAddresses :=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
{
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ' then
Subject:='vendor code<64><65>28070442 <20>ݷ<EFBFBD> '+FormatDateTime('YYYY-MM',t_ch_dui_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)+'<27><EFBFBD><C2B6>˵<EFBFBD>'+' '+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+FormatDateTime('YYMMDD',Now)+FieldByName('<27>ұ<EFBFBD>').AsString +'<27>ϼ<EFBFBD> USD '+FieldByName('USD').AsString+' RMB '+FieldByName('RMB').AsString
else
}
Subject:='<27>ݷ<EFBFBD> '+FormatDateTime('YYYY-MM',t_ch_dui_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)+'<27><EFBFBD><C2B6>˵<EFBFBD>'+' '+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+FormatDateTime('YYMMDD',Now) +'<27>ϼ<EFBFBD> USD '+FieldByName('USD').AsString+' RMB '+FieldByName('RMB').AsString;
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ' then Subject:=Subject+' <20><>Ӧ<EFBFBD>̴<EFBFBD><CCB4>룺28070442';
// strfile:=ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)+'\'+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+trim(t_ch_dui_corp_month.FieldByName('<27>ұ<EFBFBD>').AsString)+trim(t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString)+FormatDateTime('YYMMDDhhmm',Now)+'.xls';
TIdAttachmentFile.Create(MessageParts,strfile);
end;
if not SMTP1.Connected then
begin
Sleep(1000);
SMTP1.Connect;
end;
SMTP1.Send(IdMsg);
IdMsg.Clear;
Edit;
FieldByName('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=Date;
Post;
UpLoadmailFile(strfile,naspath,'user','user',t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString,t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString,'<27>½<EFBFBD><C2BD><EFBFBD><EFBFBD>˵<EFBFBD>'
,t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+FieldByName('<27><><EFBFBD><EFBFBD>').AsString,IdMsg.Subject,mailremarks,false);
//deletefile(strfile);
finally
IdMsg.Clear;
SMTP1.Disconnect;
end;
try
finally
str_memo.Free;
// SMTP1.Free;
// IdMsg.Free;
end;
end;
Next;
end;
end;
finally
frm_sys_progress.close;
frm_sys_progress:=nil;
t_ch_dui_corp_month.EnableControls;
t_ch_dui_detail_month.EnableControls;
end;
end;
procedure Tfrm_rp_dui_month.bsSkinButton12Click(Sender: TObject);
var
i:integer;
str_memo:Tmemo;
// SMTP1:TIdSMTP;
// IdMsg:TIdMessage;
strfile,mailremarks,naspath:string;
begin
naspath:=get_parameters_value(175,'\\223.223.95.160\data');
if not assigned(frm_sendmail_message) then
frm_sendmail_message:=tfrm_sendmail_message.Create(self);
if frm_sendmail_message.ShowModal = mrOK then
begin
mailremarks:=frm_sendmail_message.Memo1.Text;
end
else close;
if MessageDlg('ȷʵҪ<CAB5><D2AA><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
exit ;
try
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid2.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
t_ch_dui_corp_month.DisableControls;
t_ch_dui_detail_month.DisableControls;
for i:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_ch_dui_corp_month.GotoBookmark(pointer(dxDBGrid2.selectedrows[i]));
if t_ch_dui_corp_month.FieldByName('<27><EFBFBD>ʼ<EFBFBD>').AsBoolean then
begin
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
{
t_ch_dui_detail_month.Filtered:=false;
t_ch_dui_detail_month.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
t_ch_dui_detail_month.Filtered:=true;
}
if not DirectoryExists(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)) then
MkDir(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now));
dxDBGrid3.Filter.Add(dxDBGridColumn1,t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'');
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ' then begin
// dxDBGrid3.Filter.Add(dxDBGrid3Column13,t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString,'');
dxDBGrid3.Filter.Add(dxDBGrid3Column14,t_ch_dui_corp_month.FieldByName('<27>ұ<EFBFBD>').AsString,'');
end;
strfile:=ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)+'\'+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+trim(t_ch_dui_corp_month.FieldByName('<27>ұ<EFBFBD>').AsString)+trim(t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString)+FormatDateTime('YYMMDDhhmm',Now)+'.xls';
dxDBGrid3.SaveToXLS(strfile,true);
dxDBGrid3.Filter.Clear;
// ExportExcelFile(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)+'\'+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+FormatDateTime('YYMMDDhhmm',Now)+'.xls',true,TDataSet(t_ch_dui_detail_month));
{
SMTP1:=TIdSMTP.Create(nil);
IdMsg:=TIdMessage.Create(nil);
}
str_memo:=Tmemo.create(nil);
SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL);
SMTP1.username:=MailAddress;
SMTP1.Password :=MailPw;
SMTP1.Host :='mail.sdsmartlogistics.com';
// SMTP1.Host :='smtpcom.263xmail.com';
SMTP1.Port :=25;
try
SMTP1.Connect;
except
on e : Exception do
begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+E.Message);
end;
end;
if not SMTP1.Connected then
begin
SMTP1.Connect;
end;
if t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString<>'' then
try
with IdMsg do
begin
body.Clear;
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ' then begin
Body.Add('FROM:ɽ<><C9BD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾-SHANDONG SMART INTERNATIONAL LOGISTICS CO.,LTD');
Body.Add('<27><>Ӧ<EFBFBD>̴<EFBFBD><CCB4>룺28070442');
Body.Add('');
Body.Add(mailremarks);
end else
Body.Text:=mailremarks;
From.address :=MailAddress;
Recipients.EMailAddresses :=t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
{
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ' then
Subject:='vendor code<64><65>28070442 <20>ݷ<EFBFBD> '+FormatDateTime('YYYY-MM',t_ch_dui_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)+'<27><EFBFBD><C2B6>˵<EFBFBD>'+' '+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+FormatDateTime('YYMMDD',Now) +'<27>ϼ<EFBFBD> USD '+t_ch_dui_corp_month.FieldByName('USD').AsString+' RMB '+t_ch_dui_corp_month.FieldByName('RMB').AsString
else
}
Subject:='<27>ݷ<EFBFBD> '+FormatDateTime('YYYY-MM',t_ch_dui_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)+'<27><EFBFBD><C2B6>˵<EFBFBD>'+' '+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+FormatDateTime('YYMMDD',Now) +'<27>ϼ<EFBFBD> USD '+t_ch_dui_corp_month.FieldByName('USD').AsString+' RMB '+t_ch_dui_corp_month.FieldByName('RMB').AsString;
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ' then Subject:=Subject+' <20><>Ӧ<EFBFBD>̴<EFBFBD><CCB4>룺28070442';
// strfile:=ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)+'\'+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+FormatDateTime('YYMMDDhhmm',Now)+'.xls';
TIdAttachmentFile.Create(MessageParts,strfile);
end;
if not SMTP1.Connected then
begin
Sleep(1000);
SMTP1.Connect;
end;
SMTP1.Send(IdMsg);
// IdMsg.Clear;
t_ch_dui_corp_month.Edit;
t_ch_dui_corp_month.FieldByName('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=Date;
t_ch_dui_corp_month.Post;
UpLoadmailFile(strfile,naspath,'user','user',t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString,t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString,'<27>½<EFBFBD><C2BD><EFBFBD><EFBFBD>˵<EFBFBD>'
,t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString,IdMsg.Subject,mailremarks,false);
finally
IdMsg.Clear;
SMTP1.Disconnect;
end;
try
finally
str_memo.Free;
// SMTP1.Free;
// IdMsg.Free;
end;
end;
end;
finally
frm_sys_progress.close;
frm_sys_progress:=nil;
t_ch_dui_corp_month.EnableControls;
t_ch_dui_detail_month.EnableControls;
// frm_sendmail_message.Free;
end;
end;
procedure Tfrm_rp_dui_month.bsSkinButton13Click(Sender: TObject);
var
i:integer;
ADOQuerySelect,aQuery:TAdoQuery;
begin
ADOQuerySelect:=CreateAdoQuery;
aQuery:=CreateAdoQuery;
with ADOQuerySelect do
begin
close;
sql.Clear;
sql.add('select t_crm_client_sales.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵绰');
sql.add('from t_crm_client_sales');
sql.add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
end;
try
for i:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_ch_dui_corp_month.GotoBookmark(pointer(dxDBGrid2.selectedrows[i]));
ADOQuerySelect.Close;
ADOQuerySelect.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
ADOQuerySelect.Open;
t_ch_dui_corp_month.Edit;
t_ch_dui_corp_month.FieldByName('Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=ADOQuerySelect.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=ADOQuerySelect.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>绰').AsString:=ADOQuerySelect.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵绰').AsString;
{
if (trim(t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD>̺<EFBFBD>ӥ') then begin
aQuery.SQL.Text:='select * from t_crm_client_linkman where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>̺<EFBFBD>ӥ'' and <20><><EFBFBD><EFBFBD>='''+t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString+'''';
aQuery.Open;
if not aQuery.IsEmpty then begin
t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=aQuery.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_dui_corp_month.FieldByName('<27>绰').AsString:=aQuery.FieldByName('<27><EFBFBD>绰').AsString;
end;
end;
}
t_ch_dui_corp_month.Post;
end;
finally
ADOQuerySelect.Free;
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_rp_dui_month.bsSkinButton14Click(Sender: TObject);
begin
t_ch_dui_corp_month.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',RxDBLookupCombo57.DisplayValues[1],[])
end;
procedure Tfrm_rp_dui_month.bsSkinButton15Click(Sender: TObject);
var i:integer;
begin
if MessageDlg('ȷʵҪȡ<D2AA><C8A1><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
exit;
frm_main.db.BeginTrans;
try
{
if (t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><><EFBFBD>̺<EFBFBD>ӥ') then begin
t_ch_dui_detail_month.Filtered:=false;
t_ch_dui_detail_month.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>='''+t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString+'''';
t_ch_dui_detail_month.Filtered:=true;
end else begin
}
t_ch_dui_detail_month.Filtered:=false;
t_ch_dui_detail_month.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
t_ch_dui_detail_month.Filtered:=true;
// end;
t_ch_dui_detail_month.First;
while not t_ch_dui_detail_month.eof do
begin
UpdateDuiNo(t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').AsString,0);
t_ch_dui_detail_month.delete;
end;
t_ch_dui_corp_month.delete;
frm_main.db.CommitTrans;
finally
t_ch_dui_detail_month.Filter:='';
t_ch_dui_detail_month.Filtered:=false;
if frm_main.db.InTransaction then
begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>ԣ<EFBFBD>',mterror,[mbok],0);
frm_main.db.RollbackTrans;
end;
end;
end;
procedure Tfrm_rp_dui_month.dxDBGrid2Click(Sender: TObject);
begin
{
t_ch_dui_detail_month.Filtered:=false;
t_ch_dui_detail_month.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+'''';
t_ch_dui_detail_month.Filtered:=true;
}
end;
procedure Tfrm_rp_dui_month.bsSkinButton16Click(Sender: TObject);
var
aQuery,aQuery2:TADOQuery;
dcno:string;
i:Integer;
aList:TStringList;
aListNo:TStringList;
book1:Tbookmark;
begin
aList:=TStringList.Create;
aListNo:=TStringList.Create;
if not t_ch_dui.Active then t_ch_dui.Open;
if not t_ch_dui_bill.Active then t_ch_dui_bill.Open;
aQuery:=CreateAdoQuery;
aQuery.Close;
aQuery.SQL.Text:='update t_ch_fee set <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=1,<2C><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>=:<3A><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD> where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and isnull(<28><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD>,'''')=:<3A><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD> and <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>=0 and <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=1 ';
aQuery2:=CreateAdoQuery;
aQuery2.Close;
aQuery2.SQL.Text:='select count(*) ct from t_ch_dui_bill where <20><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>=:<3A><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD> and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>';
book1:=t_ch_dui_corp_month.GetBookmark;
for i:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_ch_dui_corp_month.GotoBookmark(pointer(dxDBGrid2.selectedrows[i]));
if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString='' then
begin
// if t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString<>'<27><><EFBFBD>̺<EFBFBD>ӥ' then begin
dcno:=get_no(date,'D1');
t_ch_dui.Insert;
t_ch_dui['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_ch_dui['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_ch_dui['<27><><EFBFBD><EFBFBD>']:=9;
t_ch_dui['<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>']:='ȫ<><C8AB>';
t_ch_dui['<27><><EFBFBD>÷<EFBFBD>Χ']:='<27><>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_ch_dui['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=dcno;
if (t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').asstring<>'') then
t_ch_dui['<27><><EFBFBD>ʿͻ<CABF>']:=t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').asstring
else
t_ch_dui['<27><><EFBFBD>ʿͻ<CABF>']:=t_ch_dui_corp_month.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_dui['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_dui_month.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui.Post;
t_ch_dui_detail_month.Filtered:=false;
{
if (t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').asstring<>'') then
t_ch_dui_detail_month.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').asstring+''''
else
}
t_ch_dui_detail_month.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_ch_dui_corp_month.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+'''';
t_ch_dui_detail_month.Filtered:=true;
t_ch_dui_detail_month.First;
while not t_ch_dui_detail_month.Eof do begin
aQuery2.Close;
aQuery2.Parameters.ParamByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').Value:=dcno;
aQuery2.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
aQuery2.Open;
if (aQuery2.FieldByName('ct').AsInteger=0) then begin
t_ch_dui_bill.insert;
t_ch_dui_bill['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=dcno;
t_ch_dui_bill['<27><><EFBFBD><EFBFBD>']:=t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_dui_bill.post;
end;
aQuery.Close;
aQuery.Parameters.ParamByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').Value:=dcno;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
if (t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').asstring=t_ch_dui_corp_month.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring) then begin
aQuery.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').asstring;
aQuery.Parameters.ParamByName('<27><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:='';
end else begin
aQuery.Parameters.ParamByName('<27><><EFBFBD>ʿͻ<CABF><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_dui_corp_month.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
aQuery.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>').asstring;
end;
aQuery.ExecSQL;
t_ch_dui_detail_month.Next;
end;
t_ch_dui_corp_month.edit;
t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString:=dcno;
t_ch_dui_corp_month.post;
{
end else begin
if aList.IndexOf(t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString)<0 then begin
aList.Add(t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString);
dcno:=get_no(date,'D1');
t_ch_dui.Insert;
t_ch_dui['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_ch_dui['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_ch_dui['<27><><EFBFBD><EFBFBD>']:=9;
t_ch_dui['<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>']:='ȫ<><C8AB>';
t_ch_dui['<27><><EFBFBD>÷<EFBFBD>Χ']:='<27><>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_ch_dui['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=dcno;
t_ch_dui['<27><><EFBFBD>ʿͻ<CABF>']:=t_ch_dui_corp_month.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_dui['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_dui_month.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_dui.Post;
t_ch_dui_detail_month.Filtered:=false;
t_ch_dui_detail_month.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_ch_dui_corp_month.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>='''+t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString+'''';
t_ch_dui_detail_month.Filtered:=true;
t_ch_dui_detail_month.First;
while not t_ch_dui_detail_month.Eof do begin
if aListNo.IndexOf(t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').asstring)<0 then begin
aListNo.Add(t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
t_ch_dui_bill.insert;
t_ch_dui_bill['<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>']:=dcno;
t_ch_dui_bill['<27><><EFBFBD><EFBFBD>']:=t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_dui_bill.post;
aQuery.Close;
aQuery.Parameters.ParamByName('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').Value:=dcno;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=t_ch_dui_detail_month.FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
aQuery.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_dui_corp_month.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
aQuery.ExecSQL;
end;
t_ch_dui_detail_month.Next;
end;
t_ch_dui_corp_month.edit;
t_ch_dui_corp_month.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').AsString:=dcno;
t_ch_dui_corp_month.post;
aQuery2.close;
aQuery2.sql.clear;
aQuery2.sql.add('update t_ch_dui_corp_month set <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>='''+dcno+''' where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_ch_dui_corp_month.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>='''+t_ch_dui_corp_month.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>').AsString+''' and <20><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>='''+t_ch_dui_corp_month.fieldbyname('<27><><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>').asstring+''' ');
aQuery2.ExecSQL;
end;
end;
}
end;
end;
t_ch_dui_detail_month.Filtered:=false;
t_ch_dui_corp_month.Close;
t_ch_dui_corp_month.Open;
freeandnil(aList);
freeandnil(aListNo);
freeandnil(aQuery);
freeandnil(aQuery2);
t_ch_dui_corp_month.GotoBookmark(book1);
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD>ɿͻ<C9BF><CDBB>˵<EFBFBD><CBB5><EFBFBD>');
end;
procedure Tfrm_rp_dui_month.bsSkinButton17Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton17.ClientToScreen(Point(0,bsSkinButton17.Height));
PopupMenu1.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_rp_dui_month.N3Click(Sender: TObject);
begin
sys_print('<27>½ጝ<C2BD><E18C9D>',2,t_ch_dui_month1,nil,nil,nil,t_ch_dui_corp_month1,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_rp_dui_month.N1Click(Sender: TObject);
var
k:integer;
str:widestring;
begin
if dxDBGrid2.SelectedCount>=1 then
begin
for k:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_ch_dui_corp_month.GotoBookmark(pointer(dxDBGrid2.selectedrows[k]));
if k=0 then
str:='('+t_ch_dui_corp_month.fieldbyname('DB_ID').asstring
else
str:=str+','+t_ch_dui_corp_month.fieldbyname('DB_ID').asstring;
end;
end else begin
str:='('+t_ch_dui_corp_month.fieldbyname('DB_ID').asstring;
end;
str:=str+')';
t_ch_dui_corp_monthSel.close;
t_ch_dui_corp_monthSel.sql.clear;
t_ch_dui_corp_monthSel.sql.add('select * from t_ch_dui_corp_month '
+'where DB_ID in '+str
);
t_ch_dui_corp_monthSel.open;
sys_print('<27>½ጝ<C2BD><E18C9D>',2,t_ch_dui_month1,nil,nil,nil,t_ch_dui_corp_monthSel1,nil,nil,nil,nil,nil,nil);
end;
end.