|
|
unit u_rp_edi;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, StdCtrls, DB, ADODB,ComObj,IniFiles, DBClient, bsSkinCtrls, DateUtils,
|
|
|
Mask, bsSkinBoxCtrls, ExtCtrls, TeeProcs, TeEngine, Chart, DbChart,math,my_sys_function,
|
|
|
Series, bsdbctrls, wwdblook;
|
|
|
|
|
|
type
|
|
|
Tfrm_rp_edi = class(TForm)
|
|
|
OpenDialog1: TOpenDialog;
|
|
|
QryExcel: TADOQuery;
|
|
|
ADOQuery1: TADOQuery;
|
|
|
QryData: TADOQuery;
|
|
|
bsSkinGauge1: TbsSkinGauge;
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
Label1: TLabel;
|
|
|
ComboBox1: TComboBox;
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
Button2: TbsSkinButton;
|
|
|
Button1: TbsSkinButton;
|
|
|
Button3: TbsSkinButton;
|
|
|
Label2: TLabel;
|
|
|
ComboBox2: TComboBox;
|
|
|
t_num: TADOQuery;
|
|
|
t_ys: TADOQuery;
|
|
|
Chart1: TChart;
|
|
|
Chart2: TChart;
|
|
|
Chart3: TChart;
|
|
|
t_yf: TADOQuery;
|
|
|
t_lr: TADOQuery;
|
|
|
Label3: TLabel;
|
|
|
dt1: TbsSkinDateEdit;
|
|
|
Label4: TLabel;
|
|
|
dt2: TbsSkinDateEdit;
|
|
|
bsSkinRadioGroup1: TbsSkinRadioGroup;
|
|
|
t_ctn: TADOQuery;
|
|
|
bsSkinRadioGroup2: TbsSkinRadioGroup;
|
|
|
bsSkinRadioGroup3: TbsSkinRadioGroup;
|
|
|
wwDBLookupCombo25: TwwDBLookupCombo;
|
|
|
t_code_CUST: TADOQuery;
|
|
|
t_code_cust1: TDataSource;
|
|
|
|
|
|
procedure Button2Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure Button1Click(Sender: TObject);
|
|
|
procedure Button3Click(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure GetBeginEndDate;
|
|
|
procedure bsSkinRadioGroup1Click(Sender: TObject);
|
|
|
procedure dt1Change(Sender: TObject);
|
|
|
procedure dt2Change(Sender: TObject);
|
|
|
procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure bsSkinRadioGroup2Click(Sender: TObject);
|
|
|
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
XlsFileNameStr,ztdh,yfje,ysje,sbrq,begindate,enddate:string;
|
|
|
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_rp_edi: Tfrm_rp_edi;
|
|
|
|
|
|
var
|
|
|
clientjp,clientname:array of string;
|
|
|
const
|
|
|
myarr:array[0..11] of string=
|
|
|
('һ<><D2BB>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','ʮ<><CAAE>','ʮһ<CAAE><D2BB>','ʮ<><CAAE><EFBFBD><EFBFBD>');
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_data_share, u_op_seae, u_main;
|
|
|
{$R *.dfm}
|
|
|
var
|
|
|
ReadXlsThread,UpdateDataThread: THandle; {<7B>߳̾<DFB3><CCBE><EFBFBD>}
|
|
|
|
|
|
function GetHzPy(const AHzStr: string): string;
|
|
|
const
|
|
|
ChinaCode: array[0..25, 0..1] of Integer = ((1601, 1636), (1637, 1832), (1833, 2077),
|
|
|
(2078, 2273), (2274, 2301), (2302, 2432), (2433, 2593), (2594, 2786), (9999, 0000),
|
|
|
(2787, 3105), (3106, 3211), (3212, 3471), (3472, 3634), (3635, 3722), (3723, 3729),
|
|
|
(3730, 3857), (3858, 4026), (4027, 4085), (4086, 4389), (4390, 4557), (9999, 0000),
|
|
|
(9999, 0000), (4558, 4683), (4684, 4924), (4925, 5248), (5249, 5589));
|
|
|
var
|
|
|
i, j, HzOrd: integer;
|
|
|
begin
|
|
|
i:= 1;
|
|
|
while i <= Length(AHzStr) do
|
|
|
begin
|
|
|
if (AHzStr[i] >= #160) and (AHzStr[i + 1] >= #160) then
|
|
|
begin
|
|
|
HzOrd := (Ord(AHzStr[i]) - 160) * 100 + Ord(AHzStr[i + 1]) - 160;
|
|
|
for j := 0 to 25 do
|
|
|
begin
|
|
|
if (HzOrd >= ChinaCode[j][0]) and (HzOrd <= ChinaCode[j][1]) then
|
|
|
begin
|
|
|
Result := Result + char(byte( 'a') + j);
|
|
|
break;
|
|
|
end;
|
|
|
end;
|
|
|
Inc(i);
|
|
|
end else Result := Result + AHzStr[i];
|
|
|
Inc(i);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure openaq(aq:TADOQuery;sqlstr:string);
|
|
|
begin
|
|
|
aq.Close;
|
|
|
aq.SQL.Clear;
|
|
|
aq.SQL.Add(sqlstr);
|
|
|
aq.Open;
|
|
|
end;
|
|
|
|
|
|
procedure execaq(aq:TADOQuery;sqlstr:string);
|
|
|
begin
|
|
|
aq.Close;
|
|
|
aq.SQL.Clear;
|
|
|
aq.SQL.Add(sqlstr);
|
|
|
aq.ExecSQL;
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_edi.Button2Click(Sender: TObject);
|
|
|
var
|
|
|
Excel: OleVariant;
|
|
|
i : integer;
|
|
|
begin
|
|
|
OpenDialog1.Title := '<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>excel<65>ļ<EFBFBD>';
|
|
|
OpenDialog1.Filter := 'Excel(*.xls)|*.xlsx';
|
|
|
if OpenDialog1.Execute then XlsFileNameStr := OpenDialog1.FileName;
|
|
|
|
|
|
if (trim(XlsFileNameStr ) = '') then
|
|
|
begin
|
|
|
GetActiveWindow();
|
|
|
showmessage( '<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>excel·<6C><C2B7>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
Excel := CreateOLEObject('Excel.Application');
|
|
|
except
|
|
|
showmessage('excelû<6C>а<EFBFBD>װ');
|
|
|
Exit;
|
|
|
end;
|
|
|
Excel.DisplayAlerts:=false;
|
|
|
Excel.Visible := False;
|
|
|
Excel.WorkBooks.Open(XlsFileNameStr);
|
|
|
ComboBox1.Items.Clear;
|
|
|
for i:=1 to Excel.Worksheets.COUNT do ComboBox1.Items.Add(Excel.WorkSheets[i].Name);
|
|
|
Excel.Quit;
|
|
|
execaq(QryExcel,'create table #EDI (<28><><EFBFBD><EFBFBD> integer null,<2C><><EFBFBD><EFBFBD> varchar(50) null,Ӧ<><D3A6> numeric(18,4) null,Ӧ<><D3A6> numeric(18,4) null)');
|
|
|
end;
|
|
|
|
|
|
procedure UpdateData;
|
|
|
var
|
|
|
i:Integer;
|
|
|
bh,dh,ys,yf,s:string;
|
|
|
begin
|
|
|
openaq(frm_rp_edi.QryData,'select * from #EDI order by <20><><EFBFBD><EFBFBD>');
|
|
|
frm_rp_edi.QryData.First;
|
|
|
frm_rp_edi.bsSkinGauge1.ProgressText:='<27><><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<D4BA><F3A1A3A1><EFBFBD>';
|
|
|
frm_rp_edi.bsSkinGauge1.MaxValue:=frm_rp_edi.QryData.RecordCount;
|
|
|
frm_rp_edi.bsSkinGauge1.MinValue:=0;
|
|
|
frm_rp_edi.bsSkinGauge1.Value:=0;
|
|
|
while not frm_rp_edi.QryData.Eof do
|
|
|
begin
|
|
|
dh:= frm_rp_edi.QryData.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
ys:= frm_rp_edi.QryData.fieldbyname('Ӧ<><D3A6>').AsString;
|
|
|
yf:= frm_rp_edi.QryData.fieldbyname('Ӧ<><D3A6>').AsString;
|
|
|
s:='select * from t_op_seae_edi where (<28><><EFBFBD>ᵥ<EFBFBD><E1B5A5>= '+QuotedStr(dh)+' or <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>= '+QuotedStr(dh)+') and (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between '
|
|
|
+QuotedStr(frm_rp_edi.begindate)+' and '+QuotedStr(frm_rp_edi.enddate)+') and <20><>־ is null ';
|
|
|
openaq(frm_rp_edi.ADOQuery1,s);
|
|
|
|
|
|
{ if Form1.ADOQuery1.RecordCount=0 then
|
|
|
begin
|
|
|
s:= 'select * from t_op_seae_edi where (<28><><EFBFBD>ᵥ<EFBFBD><E1B5A5>= '+QuotedStr(dh)+' or <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>= '+QuotedStr(dh)+') and (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between '
|
|
|
+QuotedStr(form1.begindate)+' and '+QuotedStr(Form1.enddate)+') ';
|
|
|
openaq(Form1.QryExcel,s);
|
|
|
|
|
|
Form1.Memo1.Lines.Add('<27><><EFBFBD><EFBFBD>'+Form1.QryData.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27>ᵥ<EFBFBD><E1B5A5>:'+dh+'<27><><EFBFBD><EFBFBD> Ӧ<><D3A6>='+Form1.QryExcel.fieldbyname('Ӧ<><D3A6>').AsString+' Ӧ<><D3A6>='+Form1.QryExcel.fieldbyname('Ӧ<><D3A6>').AsString);
|
|
|
end;
|
|
|
}
|
|
|
if frm_rp_edi.ADOQuery1.RecordCount>0 then
|
|
|
begin
|
|
|
frm_rp_edi.ADOQuery1.First;
|
|
|
bh:= frm_rp_edi.ADOQuery1.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
s:= 'update t_op_seae_edi set Ӧ<><D3A6>='+QuotedStr(yf)+',Ӧ<><D3A6>='+QuotedStr(ys)+',<2C><>־=1 where <20><><EFBFBD><EFBFBD>='+QuotedStr(bh);
|
|
|
execaq(frm_rp_edi.QryExcel,s);
|
|
|
end;
|
|
|
frm_rp_edi.bsSkinGauge1.Value:=frm_rp_edi.bsSkinGauge1.Value+1;
|
|
|
frm_rp_edi.QryData.Next;
|
|
|
end;
|
|
|
frm_rp_edi.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
frm_rp_edi.bsSkinGauge1.Value:=0;
|
|
|
TerminateThread(ReadXlsThread,0);
|
|
|
end;
|
|
|
|
|
|
function ReadXls(p: Pointer): Integer; stdcall;
|
|
|
const
|
|
|
BeginRow = 2; BeginCol = 1;
|
|
|
var
|
|
|
Excel: OleVariant;
|
|
|
iRow,iCol,i,isheet,iztdh,idj,icb,irq : integer;
|
|
|
xlsFilename,s: string;
|
|
|
ExcelRowCount : integer;
|
|
|
begin
|
|
|
frm_rp_edi.GetBeginEndDate;
|
|
|
|
|
|
if (frm_rp_edi.begindate='') or (frm_rp_edi.enddate='') then
|
|
|
begin
|
|
|
Exit;
|
|
|
end;
|
|
|
try
|
|
|
Excel := CreateOLEObject('Excel.Application');
|
|
|
except
|
|
|
showmessage('excelû<6C>а<EFBFBD>װ');
|
|
|
Exit;
|
|
|
end;
|
|
|
Excel.DisplayAlerts:=false;
|
|
|
Excel.Visible := False;
|
|
|
Excel.WorkBooks.Open(frm_rp_edi.XlsFileNameStr);
|
|
|
for i:=1 to Excel.Worksheets.COUNT do
|
|
|
begin
|
|
|
if Excel.WorkSheets[i].Name=frm_rp_edi.ComboBox1.Text then
|
|
|
begin
|
|
|
ExcelRowCount := Excel.WorkSheets[i].UsedRange.Rows.Count;
|
|
|
isheet:=i;
|
|
|
Break;
|
|
|
end;
|
|
|
end;
|
|
|
frm_rp_edi.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡExcel<65><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<D4BA><F3A1A3A1><EFBFBD>';
|
|
|
frm_rp_edi.bsSkinGauge1.MaxValue:=ExcelRowCount;
|
|
|
frm_rp_edi.bsSkinGauge1.MinValue:=0;
|
|
|
frm_rp_edi.bsSkinGauge1.Value:=0;
|
|
|
try
|
|
|
iRow := BeginRow;
|
|
|
for i:=1 to Excel.WorkSheets[isheet].UsedRange.columns.count do
|
|
|
begin
|
|
|
if Excel.WorkSheets[isheet].UsedRange.Cells[1,i].value='<27>ᵥ<EFBFBD><E1B5A5>' then iztdh:=i;
|
|
|
if Excel.WorkSheets[isheet].UsedRange.Cells[1,i].value='Ӧ<><D3A6>' then idj:=i; // column[i].Name
|
|
|
if Excel.WorkSheets[isheet].UsedRange.Cells[1,i].value='Ӧ<><D3A6>' then icb:=i;
|
|
|
if Excel.WorkSheets[isheet].UsedRange.Cells[1,i].value='<27>걨<EFBFBD><EAB1A8><EFBFBD><EFBFBD>' then irq:=i;
|
|
|
end;
|
|
|
|
|
|
while trim(Excel.WorkSheets[isheet].Cells[iRow,iztdh].value) <> '' do
|
|
|
begin
|
|
|
frm_rp_edi.ztdh:= trim(Excel.WorkSheets[isheet].Cells[iRow,iztdh].value);
|
|
|
frm_rp_edi.yfje:= trim(Excel.WorkSheets[isheet].Cells[iRow,idj].value);
|
|
|
frm_rp_edi.ysje:= trim(Excel.WorkSheets[isheet].Cells[iRow,icb].value);
|
|
|
frm_rp_edi.sbrq:= trim(Excel.WorkSheets[isheet].Cells[iRow,irq].value);
|
|
|
if frm_rp_edi.yfje='' then frm_rp_edi.yfje:='0';
|
|
|
if frm_rp_edi.ysje='' then frm_rp_edi.ysje:='0';
|
|
|
s:='insert into #EDI (<28><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,Ӧ<><D3A6>,Ӧ<><D3A6>) values ('+inttostr(iRow-1)+','+QuotedStr(frm_rp_edi.ztdh)
|
|
|
+','+QuotedStr(frm_rp_edi.ysje)+','+QuotedStr(frm_rp_edi.yfje)+')';
|
|
|
execaq(frm_rp_edi.QryExcel,s);
|
|
|
frm_rp_edi.bsSkinGauge1.Value:=frm_rp_edi.bsSkinGauge1.Value+1;
|
|
|
iRow := iRow + 1;
|
|
|
end;
|
|
|
Excel.Quit;
|
|
|
frm_rp_edi.bsSkinGauge1.ProgressText:='';
|
|
|
frm_rp_edi.bsSkinGauge1.Value:=0;
|
|
|
|
|
|
UpdateData;
|
|
|
execaq(frm_rp_edi.QryExcel,'drop table #EDI');
|
|
|
except
|
|
|
Excel.Quit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_edi.FormShow(Sender: TObject);
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
i:Integer;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
openaq(aQuery,'select distinct ί<>з<EFBFBD><D0B7>ͷ<EFBFBD> from t_op_seae_edi where ltrim(rtrim(ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>))<>'''' order by ί<>з<EFBFBD><D0B7>ͷ<EFBFBD> ');
|
|
|
SetLength(clientname,aQuery.RecordCount);
|
|
|
SetLength(clientjp,aQuery.RecordCount);
|
|
|
t_code_CUST.Open;
|
|
|
dt2.Date:=Now;
|
|
|
ComboBox2.Items.Clear;
|
|
|
for i:=0 to aQuery.RecordCount-1 do
|
|
|
begin
|
|
|
ComboBox2.Items.Add(aQuery.fieldbyname('ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>').AsString);
|
|
|
clientname[i]:=aQuery.fieldbyname('ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>').AsString;
|
|
|
clientjp[i]:=GetHzPy(aQuery.fieldbyname('ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>').AsString);
|
|
|
aQuery.Next;
|
|
|
end;
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
|
bsSkinGauge1.Value:=0;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.Button1Click(Sender: TObject);
|
|
|
var
|
|
|
ID: DWORD;
|
|
|
begin
|
|
|
if (trim(XlsFileNameStr ) = '') then
|
|
|
begin
|
|
|
ShowMessage('<27><>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Excel<65>ļ<EFBFBD>!');
|
|
|
Exit;
|
|
|
end;
|
|
|
if ComboBox1.ItemIndex=-1 then
|
|
|
begin
|
|
|
ShowMessage('<27><>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD>!');
|
|
|
Exit;
|
|
|
end;
|
|
|
if MessageBox(Handle,PChar('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD>Ϊ'+trim(ComboBox1.Text)+'?'),'ȷ<><C8B7><EFBFBD><EFBFBD>Ϣ',MB_OKCANCEL)=idok then
|
|
|
begin
|
|
|
execaq(QryExcel,'delete #EDI ');
|
|
|
ReadXlsThread := CreateThread(nil, 0, @ReadXls, nil, CREATE_SUSPENDED, ID);
|
|
|
|
|
|
begindate:='';
|
|
|
enddate:='';
|
|
|
ResumeThread(ReadXlsThread);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.Button3Click(Sender: TObject);
|
|
|
begin
|
|
|
if ReadXlsThread>0 then TerminateThread(ReadXlsThread,0);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
i,k,j:Integer;
|
|
|
MySeries: TChartSeries;
|
|
|
str:string;
|
|
|
begin
|
|
|
if (bsSkinRadioGroup3.ItemIndex=0) then begin
|
|
|
if bsSkinRadioGroup1.ItemIndex=0 then
|
|
|
begin
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_ys.Close;
|
|
|
t_ys.SQL.Clear;
|
|
|
t_ys.SQL.Add('SELECT YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =1 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) һ<><D2BB>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =2 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =3 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =4 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =5 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =6 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =7 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =8 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =9 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =10 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) ʮ<><CAAE>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =11 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) ʮһ<CAAE><D2BB>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =12 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) ʮ<><CAAE><EFBFBD><EFBFBD> '
|
|
|
+' FROM '
|
|
|
+' (select '
|
|
|
+' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<>ս<EFBFBD><D5BD><EFBFBD>, '
|
|
|
+' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,* '
|
|
|
+' from t_op_seae_edi where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2) '+str+' ) t '
|
|
|
+' GROUP BY YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ' ) ;
|
|
|
|
|
|
t_ys.Parameters[0].Value:=dt1.date;
|
|
|
t_ys.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_ys.Open;
|
|
|
|
|
|
chart1.RemoveAllSeries;
|
|
|
|
|
|
if t_ys.RecordCount>0 then
|
|
|
begin
|
|
|
t_ys.First;
|
|
|
while not t_ys.Eof do
|
|
|
begin
|
|
|
if t_ys.RecordCount=1 then
|
|
|
begin
|
|
|
Chart1.Legend.Visible := False;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>----'+t_ys.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart1.Legend.Visible := True;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_ys.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for i:=0 to 11 do MySeries.AddXY(i,t_ys.fieldbyname(myarr[i]).AsFloat,myarr[i]);
|
|
|
Chart1.AddSeries(MySeries);
|
|
|
|
|
|
t_ys.Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsSkinRadioGroup1.ItemIndex=1 then
|
|
|
begin
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_yf.Close;
|
|
|
t_yf.SQL.Clear;
|
|
|
t_yf.SQL.Add('SELECT YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =1 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) һ<><D2BB>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =2 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =3 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =4 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =5 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =6 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =7 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =8 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =9 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =10 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) ʮ<><CAAE>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =11 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) ʮһ<CAAE><D2BB>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =12 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) ʮ<><CAAE><EFBFBD><EFBFBD> '
|
|
|
+' FROM '
|
|
|
+' (select '
|
|
|
+' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<>ս<EFBFBD><D5BD><EFBFBD>, '
|
|
|
+' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,* '
|
|
|
+' from t_op_seae_edi where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2) '+str+' ) t '
|
|
|
+' GROUP BY YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ' ) ;
|
|
|
t_yf.Parameters[0].Value:=dt1.date;
|
|
|
t_yf.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_yf.Open;
|
|
|
|
|
|
chart1.RemoveAllSeries;
|
|
|
if t_yf.RecordCount>0 then
|
|
|
begin
|
|
|
t_yf.First;
|
|
|
while not t_yf.Eof do
|
|
|
begin
|
|
|
if t_yf.RecordCount=1 then
|
|
|
begin
|
|
|
Chart1.Legend.Visible := False;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>----'+t_yf.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart1.Legend.Visible := True;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_yf.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for i:=0 to 11 do MySeries.AddXY(i,t_yf.fieldbyname(myarr[i]).AsFloat,myarr[i]);
|
|
|
Chart1.AddSeries(MySeries);
|
|
|
t_yf.Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsSkinRadioGroup1.ItemIndex=2 then
|
|
|
begin
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_lr.Close;
|
|
|
t_lr.SQL.Clear;
|
|
|
t_lr.SQL.Add('SELECT YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =1 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =1 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) һ<><D2BB>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =2 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =2 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =3 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =3 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =4 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =4 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =5 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =5 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =6 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =6 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =7 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =7 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =8 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =8 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =9 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =9 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =10 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =10 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) ʮ<><CAAE>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =11 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =11 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) ʮһ<CAAE><D2BB>, '
|
|
|
+'SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =12 THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN MONTH(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) =12 THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) ʮ<><CAAE><EFBFBD><EFBFBD> '
|
|
|
+' FROM '
|
|
|
+' (select '
|
|
|
+' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<>ս<EFBFBD><D5BD><EFBFBD>, '
|
|
|
+' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,* '
|
|
|
+' from t_op_seae_edi where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2) '+str+' ) t '
|
|
|
+' GROUP BY YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ' ) ;
|
|
|
|
|
|
t_lr.Parameters[0].Value:=dt1.date;
|
|
|
t_lr.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_lr.Open;
|
|
|
|
|
|
chart1.RemoveAllSeries;
|
|
|
if t_lr.RecordCount>0 then
|
|
|
begin
|
|
|
t_lr.First;
|
|
|
while not t_lr.Eof do
|
|
|
begin
|
|
|
if t_lr.RecordCount=1 then
|
|
|
begin
|
|
|
Chart1.Legend.Visible := False;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>----'+t_lr.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart1.Legend.Visible := True;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_lr.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for i:=0 to 11 do MySeries.AddXY(i,t_lr.fieldbyname(myarr[i]).AsFloat,myarr[i]);
|
|
|
Chart1.AddSeries(MySeries);
|
|
|
t_lr.Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_num.Close;
|
|
|
t_num.SQL.Clear;
|
|
|
t_num.SQL.Add('select datepart(year,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=1 then 1 else 0 end) as һ<><D2BB>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=2 then 1 else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=3 then 1 else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=4 then 1 else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=5 then 1 else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=6 then 1 else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=7 then 1 else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=8 then 1 else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=9 then 1 else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=10 then 1 else 0 end) as ʮ<><CAAE>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=11 then 1 else 0 end) as ʮһ<CAAE><D2BB>, '
|
|
|
+'sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=12 then 1 else 0 end) as ʮ<><CAAE><EFBFBD><EFBFBD> '
|
|
|
+' from t_op_seae_edi where ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2 '+str
|
|
|
+' group by datepart(year,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ');
|
|
|
t_num.Parameters[0].Value:=dt1.date;
|
|
|
t_num.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_num.Open;
|
|
|
chart3.RemoveAllSeries;
|
|
|
if t_num.RecordCount>0 then
|
|
|
begin
|
|
|
t_num.First;
|
|
|
while not t_num.Eof do
|
|
|
begin
|
|
|
if t_num.RecordCount=1 then
|
|
|
begin
|
|
|
Chart3.Legend.Visible := False;
|
|
|
Chart3.Title.Text.Text:='Ʊ<><C6B1><EFBFBD>Ա<EFBFBD>----'+t_num.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart3.Legend.Visible := True;
|
|
|
Chart3.Title.Text.Text:='Ʊ<><C6B1><EFBFBD>Ա<EFBFBD>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_num.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for i:=0 to 11 do MySeries.AddXY(i,t_num.fieldbyname(myarr[i]).AsFloat,myarr[i]);
|
|
|
Chart3.AddSeries(MySeries);
|
|
|
t_num.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_ctn.Close;
|
|
|
t_ctn.SQL.Clear;
|
|
|
t_ctn.SQL.Add('select datepart(year,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=1 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as һ<><D2BB>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=2 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=3 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=4 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=5 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=6 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=7 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=8 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=9 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=10 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as ʮ<><CAAE>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=11 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as ʮһ<CAAE><D2BB>, '
|
|
|
+' sum(case when datepart(month,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)=12 then ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) as ʮ<><CAAE><EFBFBD><EFBFBD> '
|
|
|
+' from '
|
|
|
+' (select case when <20><><EFBFBD><EFBFBD> is null then 0 when <20><><EFBFBD><EFBFBD>='''' then 0 else <20><><EFBFBD><EFBFBD> end as ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,* from t_op_seae_edi '
|
|
|
// +' where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between '+QuotedStr(FormatDateTime('yyyy-mm-dd',dt1.Date))+' and '+QuotedStr(FormatDateTime('yyyy-mm-dd',dt2.Date))+') '+str+' ) t '
|
|
|
+' where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2) '+str+' ) t '
|
|
|
+' group by datepart(year,t.¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ');
|
|
|
t_ctn.Parameters[0].Value:=dt1.date;
|
|
|
t_ctn.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_ctn.Open;
|
|
|
chart2.RemoveAllSeries;
|
|
|
if t_ctn.RecordCount>0 then
|
|
|
begin
|
|
|
t_ctn.First;
|
|
|
while not t_ctn.Eof do
|
|
|
begin
|
|
|
if t_ctn.RecordCount=1 then
|
|
|
begin
|
|
|
Chart2.Legend.Visible := False;
|
|
|
Chart2.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>----'+t_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart2.Legend.Visible := True;
|
|
|
Chart2.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for i:=0 to 11 do MySeries.AddXY(i,t_ctn.fieldbyname(myarr[i]).AsFloat,myarr[i]);
|
|
|
Chart2.AddSeries(MySeries);
|
|
|
t_ctn.Next;
|
|
|
end;
|
|
|
end;
|
|
|
end else begin
|
|
|
if bsSkinRadioGroup1.ItemIndex=0 then
|
|
|
begin
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_ys.Close;
|
|
|
t_ys.SQL.Clear;
|
|
|
t_ys.SQL.Add('SELECT YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, ');
|
|
|
for j:=1 to 53 do begin
|
|
|
t_ys.SQL.Add('SUM(CASE WHEN datename(week,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ='+inttostr(j)+' THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END) <20><>'+inttostr(j)+'<27><>, ');
|
|
|
end;
|
|
|
t_ys.SQL.Add('0 ʮ<><CAAE><EFBFBD><EFBFBD> ');
|
|
|
t_ys.SQL.Add(' FROM ');
|
|
|
t_ys.SQL.Add(' (select ');
|
|
|
t_ys.SQL.Add(' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<>ս<EFBFBD><D5BD><EFBFBD>, ');
|
|
|
t_ys.SQL.Add(' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,* ');
|
|
|
t_ys.SQL.Add(' from t_op_seae_edi where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2) '+str+' ) t ');
|
|
|
t_ys.SQL.Add(' GROUP BY YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ' ) ;
|
|
|
|
|
|
t_ys.Parameters[0].Value:=dt1.date;
|
|
|
t_ys.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_ys.Open;
|
|
|
|
|
|
chart1.RemoveAllSeries;
|
|
|
|
|
|
if t_ys.RecordCount>0 then
|
|
|
begin
|
|
|
t_ys.First;
|
|
|
while not t_ys.Eof do
|
|
|
begin
|
|
|
if t_ys.RecordCount=1 then
|
|
|
begin
|
|
|
Chart1.Legend.Visible := False;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>----'+t_ys.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart1.Legend.Visible := True;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_ys.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for j:=1 to 53 do begin MySeries.AddXY(j,t_ys.fieldbyname('<27><>'+inttostr(j)+'<27><>').AsFloat,'<27><>'+inttostr(j)+'<27><>');
|
|
|
end;
|
|
|
Chart1.AddSeries(MySeries);
|
|
|
t_ys.Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsSkinRadioGroup1.ItemIndex=1 then
|
|
|
begin
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_yf.Close;
|
|
|
t_yf.SQL.Clear;
|
|
|
t_yf.SQL.Add('SELECT YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, ');
|
|
|
for j:=1 to 53 do begin
|
|
|
t_yf.SQL.Add('SUM(CASE WHEN datename(week,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ='+inttostr(j)+' THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><>'+inttostr(j)+'<27><>, ');
|
|
|
end;
|
|
|
t_yf.SQL.Add('0 ʮ<><CAAE><EFBFBD><EFBFBD> ');
|
|
|
t_yf.SQL.Add(' FROM ');
|
|
|
t_yf.SQL.Add(' (select ');
|
|
|
t_yf.SQL.Add(' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<>ս<EFBFBD><D5BD><EFBFBD>, ');
|
|
|
t_yf.SQL.Add(' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,* ');
|
|
|
t_yf.SQL.Add(' from t_op_seae_edi where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2) '+str+' ) t ');
|
|
|
t_yf.SQL.Add(' GROUP BY YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ' ) ;
|
|
|
t_yf.Parameters[0].Value:=dt1.date;
|
|
|
t_yf.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_yf.Open;
|
|
|
|
|
|
chart1.RemoveAllSeries;
|
|
|
if t_yf.RecordCount>0 then
|
|
|
begin
|
|
|
t_yf.First;
|
|
|
while not t_yf.Eof do
|
|
|
begin
|
|
|
if t_yf.RecordCount=1 then
|
|
|
begin
|
|
|
Chart1.Legend.Visible := False;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>----'+t_yf.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart1.Legend.Visible := True;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_yf.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for j:=1 to 53 do begin MySeries.AddXY(j,t_yf.fieldbyname('<27><>'+inttostr(j)+'<27><>').AsFloat,'<27><>'+inttostr(j)+'<27><>');
|
|
|
|
|
|
end;
|
|
|
Chart1.AddSeries(MySeries);
|
|
|
t_yf.Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsSkinRadioGroup1.ItemIndex=2 then
|
|
|
begin
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_lr.Close;
|
|
|
t_lr.SQL.Clear;
|
|
|
t_lr.SQL.Add('SELECT YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, ');
|
|
|
for j:=1 to 53 do begin
|
|
|
t_lr.SQL.Add('SUM(CASE WHEN datename(week,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ='+inttostr(j)+' THEN Ӧ<>ս<EFBFBD><D5BD><EFBFBD> ELSE 0 END)-SUM(CASE WHEN datename(week,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ='+inttostr(j)+' THEN Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><>'+inttostr(j)+'<27><>, ');
|
|
|
end;
|
|
|
t_lr.SQL.Add('0 ʮ<><CAAE><EFBFBD><EFBFBD> ');
|
|
|
t_lr.SQL.Add(' FROM ');
|
|
|
t_lr.SQL.Add(' (select ');
|
|
|
t_lr.SQL.Add(' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<>ս<EFBFBD><D5BD><EFBFBD>, ');
|
|
|
t_lr.SQL.Add(' case when Ӧ<><D3A6> IS null then 0 else Ӧ<><D3A6> end as Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,* ');
|
|
|
t_lr.SQL.Add(' from t_op_seae_edi where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2) '+str+' ) t ');
|
|
|
t_lr.SQL.Add(' GROUP BY YEAR(¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ' ) ;
|
|
|
|
|
|
t_lr.Parameters[0].Value:=dt1.date;
|
|
|
t_lr.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_lr.Open;
|
|
|
|
|
|
chart1.RemoveAllSeries;
|
|
|
if t_lr.RecordCount>0 then
|
|
|
begin
|
|
|
t_lr.First;
|
|
|
while not t_lr.Eof do
|
|
|
begin
|
|
|
if t_lr.RecordCount=1 then
|
|
|
begin
|
|
|
Chart1.Legend.Visible := False;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>----'+t_lr.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart1.Legend.Visible := True;
|
|
|
Chart1.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶԱ<DDB6>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_lr.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for j:=1 to 53 do begin MySeries.AddXY(j,t_lr.fieldbyname('<27><>'+inttostr(j)+'<27><>').AsFloat,'<27><>'+inttostr(j)+'<27><>');
|
|
|
end;
|
|
|
Chart1.AddSeries(MySeries);
|
|
|
t_lr.Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_num.Close;
|
|
|
t_num.SQL.Clear;
|
|
|
t_num.SQL.Add('select datepart(year,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>, ');
|
|
|
for j:=1 to 53 do begin
|
|
|
t_num.SQL.Add('SUM(CASE WHEN datename(week,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ='+inttostr(j)+' THEN 1 ELSE 0 END) <20><>'+inttostr(j)+'<27><>, ');
|
|
|
end;
|
|
|
t_num.SQL.Add('0 ʮ<><CAAE><EFBFBD><EFBFBD> ');
|
|
|
t_num.SQL.Add(' from t_op_seae_edi where ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2 '+str);
|
|
|
t_num.SQL.Add(' group by datepart(year,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ');
|
|
|
t_num.Parameters[0].Value:=dt1.date;
|
|
|
t_num.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_num.Open;
|
|
|
chart3.RemoveAllSeries;
|
|
|
if t_num.RecordCount>0 then
|
|
|
begin
|
|
|
t_num.First;
|
|
|
while not t_num.Eof do
|
|
|
begin
|
|
|
if t_num.RecordCount=1 then
|
|
|
begin
|
|
|
Chart3.Legend.Visible := False;
|
|
|
Chart3.Title.Text.Text:='Ʊ<><C6B1><EFBFBD>Ա<EFBFBD>----'+t_num.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart3.Legend.Visible := True;
|
|
|
Chart3.Title.Text.Text:='Ʊ<><C6B1><EFBFBD>Ա<EFBFBD>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_num.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for j:=1 to 53 do begin MySeries.AddXY(j,t_num.fieldbyname('<27><>'+inttostr(j)+'<27><>').AsFloat,'<27><>'+inttostr(j)+'<27><>');
|
|
|
end;
|
|
|
Chart3.AddSeries(MySeries);
|
|
|
t_num.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if Trim(wwDBLookupCombo25.Text)='' then str:='' else str:=' and ί<>з<EFBFBD><D0B7>ͷ<EFBFBD>='+QuotedStr(Trim(wwDBLookupCombo25.Text));
|
|
|
t_ctn.Close;
|
|
|
t_ctn.SQL.Clear;
|
|
|
t_ctn.SQL.Add('select datepart(year,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>, ');
|
|
|
for j:=1 to 53 do begin
|
|
|
t_ctn.SQL.Add('SUM(CASE WHEN datename(week,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ='+inttostr(j)+' THEN ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ELSE 0 END) <20><>'+inttostr(j)+'<27><>, ');
|
|
|
end;
|
|
|
t_ctn.SQL.Add('0 ʮ<><CAAE><EFBFBD><EFBFBD> ');
|
|
|
|
|
|
t_ctn.SQL.Add(' from ');
|
|
|
t_ctn.SQL.Add(' (select case when <20><><EFBFBD><EFBFBD> is null then 0 when <20><><EFBFBD><EFBFBD>='''' then 0 else <20><><EFBFBD><EFBFBD> end as ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,* from t_op_seae_edi ');
|
|
|
t_ctn.SQL.Add(' where (¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :dt1 and :dt2) '+str+' ) t ');
|
|
|
t_ctn.SQL.Add(' group by datepart(year,t.¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ');
|
|
|
t_ctn.Parameters[0].Value:=dt1.date;
|
|
|
t_ctn.Parameters[1].Value:=StrToDateTime(DateTimeToStr(dt2.date)+' 23:59:59');
|
|
|
t_ctn.Open;
|
|
|
chart2.RemoveAllSeries;
|
|
|
if t_ctn.RecordCount>0 then
|
|
|
begin
|
|
|
t_ctn.First;
|
|
|
while not t_ctn.Eof do
|
|
|
begin
|
|
|
if t_ctn.RecordCount=1 then
|
|
|
begin
|
|
|
Chart2.Legend.Visible := False;
|
|
|
Chart2.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>----'+t_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Chart2.Legend.Visible := True;
|
|
|
Chart2.Title.Text.Text:='<27><><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>';
|
|
|
end;
|
|
|
if bsSkinRadioGroup2.ItemIndex=0 then MySeries := TBarSeries.Create(Application) else MySeries := TLineSeries.Create(Application);
|
|
|
MySeries.Title:= t_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
MySeries.Marks.Style:=smsValue;
|
|
|
for j:=1 to 53 do begin MySeries.AddXY(j,t_ctn.fieldbyname('<27><>'+inttostr(j)+'<27><>').AsFloat,'<27><>'+inttostr(j)+'<27><>');
|
|
|
end;
|
|
|
Chart2.AddSeries(MySeries);
|
|
|
t_ctn.Next;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.GetBeginEndDate;
|
|
|
var
|
|
|
str,s,s1,s2:string;
|
|
|
begin
|
|
|
str:=Trim(ComboBox1.Text);
|
|
|
if str='' then
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʽΪyyyy.mm<6D>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
Exit;
|
|
|
end;
|
|
|
dateseparator := '-';
|
|
|
s1:=Copy(str,0,Pos('.',str)-1);
|
|
|
s2:=Copy(str,Pos('.',str)+1,Length(str));
|
|
|
begindate:=s1+dateseparator+s2+dateseparator+'01';
|
|
|
if s2='12' then
|
|
|
begin
|
|
|
s1:=IntToStr(1+strtoint(s1));
|
|
|
s2:=IntToStr(strtoint(s2)-1);
|
|
|
end;
|
|
|
enddate:=s1+dateseparator+IntToStr(strtoint(s2)+1)+dateseparator+'01';
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.bsSkinRadioGroup1Click(Sender: TObject);
|
|
|
begin
|
|
|
// bsSkinButton1Click(nil);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.dt1Change(Sender: TObject);
|
|
|
begin
|
|
|
// bsSkinButton1Click(nil);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.dt2Change(Sender: TObject);
|
|
|
begin
|
|
|
// bsSkinButton1Click(nil);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.ComboBox2KeyPress(Sender: TObject; var Key: Char);
|
|
|
begin
|
|
|
{ if Key=#13 then
|
|
|
begin
|
|
|
ShowMessage(GetHzPy(ComboBox2.Text));
|
|
|
//bsSkinButton1Click(nil);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
|
|
|
end; }
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_edi.bsSkinRadioGroup2Click(Sender: TObject);
|
|
|
begin
|
|
|
// bsSkinButton1Click(nil);
|
|
|
end;
|
|
|
|
|
|
end.
|
|
|
|
|
|
|