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.

266 lines
8.7 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_zj_zou;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, Series, TeEngine, ExtCtrls, TeeProcs, Chart, DbChart, DB,
ADODB, bsSkinCtrls, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb,
RxLookup,teeprevi, XPMenu;
type
Tfrm_rp_zj_zou = class(TForm)
bsSkinPanel1: TbsSkinPanel;
Label16: TLabel;
Label14: TLabel;
Label23: TLabel;
Label22: TLabel;
Label10: TLabel;
Label5: TLabel;
Label7: TLabel;
Label9: TLabel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
RxDBLookupCombo6: TRxDBLookupCombo;
RxDBLookupCombo3: TRxDBLookupCombo;
RxDBLookupCombo12: TRxDBLookupCombo;
RxDBLookupCombo10: TRxDBLookupCombo;
wwDBComboBox1: TwwDBComboBox;
RxDBLookupCombo2: TRxDBLookupCombo;
bsSkinButton1: TbsSkinButton;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
wwDBComboBox2: TwwDBComboBox;
wwDBComboBox3: TwwDBComboBox;
wwDBComboBox5: TwwDBComboBox;
wwDBComboBox4: TwwDBComboBox;
bsSkinPanel2: TbsSkinPanel;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox4: TbsSkinCheckRadioBox;
p_no_accept: TADOStoredProc;
bsSkinPanel3: TbsSkinPanel;
bsSkinPanel4: TbsSkinPanel;
DBChart2: TDBChart;
LineSeries1: TBarSeries;
DBChart1: TDBChart;
Series1: TLineSeries;
bsSkinPanel5: TbsSkinPanel;
DBChart3: TDBChart;
LineSeries2: TLineSeries;
DBChart4: TDBChart;
BarSeries1: TBarSeries;
p_no_pay: TADOStoredProc;
PopupMenu1: TPopupMenu;
N5: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
XPMenu1: TXPMenu;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinCheckRadioBox4Click(Sender: TObject);
procedure bsSkinCheckRadioBox3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure bsSkinPanel3Resize(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_zj_zou: Tfrm_rp_zj_zou;
implementation
uses u_main, my_sys_function;
{$R *.dfm}
procedure Tfrm_rp_zj_zou.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_zj_zou.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_zj_zou.Hide;
frm_rp_zj_zou.ManualFloat(frm_rp_zj_zou.BoundsRect );
frm_main.freeTabs('frm_rp_zj_zou');
action:=cafree;
frm_rp_zj_zou:=nil;
end;
procedure Tfrm_rp_zj_zou.bsSkinButton10Click(Sender: TObject);
begin
wwDBComboBox2.text:='';
wwDBComboBox3.text:='';
wwDBComboBox4.text:='';
wwDBComboBox5.text:='';
wwDBComboBox1.text:='';
RxDBLookupCombo2.ClearValue;
RxDBLookupCombo6.ClearValue;
RxDBLookupCombo12.ClearValue;
RxDBLookupCombo3.ClearValue;
RxDBLookupCombo10.ClearValue;
end;
procedure Tfrm_rp_zj_zou.bsSkinButton9Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height));
PopupMenu1.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_rp_zj_zou.bsSkinButton1Click(Sender: TObject);
var
str_op,str:widestring;
str_start,str_end:string;
str_date:string;
begin
if (wwDBComboBox2.ItemIndex=-1)or(wwDBComboBox3.ItemIndex=-1)or
(wwDBComboBox4.ItemIndex=-1)or(wwDBComboBox5.ItemIndex=-1) then
begin
showmessage('<27><EFBFBD><EBBDAB>ʼ<EFBFBD><CABC><EFBFBD>ºͽ<C2BA><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
try
if strtoint(wwDBComboBox2.text)>strtoint(wwDBComboBox5.text) then
begin
showmessage('<27><>ʼ<EFBFBD><CABC><EFBFBD>²<EFBFBD><C2B2>ܴ<EFBFBD><DCB4>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD>');
exit;
end;
if strtoint(wwDBComboBox2.text)=strtoint(wwDBComboBox5.text) then
begin
if strtoint(wwDBComboBox3.text)>strtoint(wwDBComboBox4.text) then
begin
showmessage('<27><>ʼ<EFBFBD><CABC><EFBFBD>²<EFBFBD><C2B2>ܴ<EFBFBD><DCB4>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD>');
exit;
end;
end;
except
showmessage('<27><EFBFBD><EBBDAB>ʼ<EFBFBD><CABC><EFBFBD>ºͽ<C2BA><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if bsSkinCheckRadioBox2.Checked then
str_date:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
else
str_date:='<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>';
str_start:=wwDBComboBox2.text+'-'+wwDBComboBox3.text+'-'+'01';
str_end:=wwDBComboBox5.text+'-'+wwDBComboBox4.text+'-'+'01';
str_op:=open_data('0036','v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_no.<2E><><EFBFBD><EFBFBD>Ա','v_op_no.<2E>ͷ<EFBFBD>Ա','v_op_no.<2E><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>','v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if wwDBComboBox1.ItemIndex<>-1 then
str_op:=str_op+' and v_op_no.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+wwDBComboBox1.text+'''';
if RxDBLookupCombo6.DisplayValue<>''then
str_op:=str_op+' and v_op_no.<2E><><EFBFBD><EFBFBD>Ա='+''''+RxDBLookupCombo6.DisplayValue+'''';
if RxDBLookupCombo12.DisplayValue<>''then
str_op:=str_op+' and v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo12.DisplayValue+'''';
if RxDBLookupCombo3.DisplayValue<>''then
str_op:=str_op+' and v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
if RxDBLookupCombo10.DisplayValue<>''then
str_op:=str_op+' and v_op_no.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
if RxDBLookupCombo2.DisplayValues[1]<>''then
str_op:=str_op+' and v_op_no.ί<>е<EFBFBD>λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
str:='CREATE TABLE #t_sum_no '
+'( '
+' <20><><EFBFBD><EFBFBD> varchar(6), '
+' Ƿ<><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> float '
+') '
+' DECLARE @cha int,@begin_date smalldatetime,@NXYF CHAR(6),@no_money float '
+' set @begin_date='+''''+str_start+''''
+' set @cha=datediff(month,@begin_date,'+''''+str_end+''''+')'
+' set @begin_date=DATEADD(month,-1,@begin_date)'
+' while @cha>=0 '
+' begin '
+' SET @begin_date= DATEADD(month, 1, @begin_date) '
+' SET @NXYF=CAST(DATEPART(Year,@begin_date) AS CHAR(4))+RIGHT(CAST(DATEPART(MONTH,@begin_date)+100 AS CHAR(3)),2) '
+' set @no_money=isnull((SELECT SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD>) FROM t_ch_fee INNER JOIN '
+' v_op_no ON t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> where t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''+' and '+str_op+' and '
+' (CAST(DATEPART(Year,v_op_no.'+str_date+') AS CHAR(4))+RIGHT(CAST(DATEPART(MONTH,v_op_no.'+str_date+')+100 AS CHAR(3)),2))=@NXYF),0) '
+' INSERT #t_sum_no (<28><><EFBFBD><EFBFBD><><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) VALUES (@NXYF,@no_money) '
+' set @cha=@cha-1 '
+' end '
+' select * from #t_sum_no '
+' order by <20><><EFBFBD><EFBFBD> ';
p_no_accept.close;
p_no_accept.Parameters.ParamByName('SQLStr').value:=str;
p_no_accept.Open;
str:='CREATE TABLE #t_sum_no '
+'( '
+' <20><><EFBFBD><EFBFBD> varchar(6), '
+' Ƿ<><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> float '
+') '
+' DECLARE @cha int,@begin_date smalldatetime,@NXYF CHAR(6),@no_money float '
+' set @begin_date='+''''+str_start+''''
+' set @cha=datediff(month,@begin_date,'+''''+str_end+''''+')'
+' set @begin_date=DATEADD(month,-1,@begin_date)'
+' while @cha>=0 '
+' begin '
+' SET @begin_date= DATEADD(month, 1, @begin_date) '
+' SET @NXYF=CAST(DATEPART(Year,@begin_date) AS CHAR(4))+RIGHT(CAST(DATEPART(MONTH,@begin_date)+100 AS CHAR(3)),2) '
+'set @no_money=isnull((SELECT SUM(t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD>) FROM dbo.t_ch_fee_do INNER JOIN '
+'t_ch_balance ON t_ch_fee_do.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =t_ch_balance.<2E>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> INNER JOIN '
+'t_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID where t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''+' and t_ch_fee_do.<2E><><EFBFBD><EFBFBD>='
+''''+'4'+''''+' and t_ch_fee.<2E><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from v_op_no where '+str_op+')'+' and '
+'(CAST(DATEPART(Year,t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)AS CHAR(4))+RIGHT(CAST(DATEPART(MONTH,t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+100 AS CHAR(3)),2))=@NXYF),0) '
+' INSERT #t_sum_no (<28><><EFBFBD><EFBFBD><><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) VALUES (@NXYF,@no_money) '
+' set @cha=@cha-1 '
+' end '
+' select * from #t_sum_no '
+' order by <20><><EFBFBD><EFBFBD> ';
p_no_pay.close;
p_no_pay.Parameters.ParamByName('SQLStr').value:=str;
p_no_pay.Open;
end;
procedure Tfrm_rp_zj_zou.bsSkinCheckRadioBox4Click(Sender: TObject);
begin
DBChart1.Visible:=true;
DBChart2.Visible:=false;
DBChart3.Visible:=true;
DBChart4.Visible:=false;
end;
procedure Tfrm_rp_zj_zou.bsSkinCheckRadioBox3Click(Sender: TObject);
begin
DBChart2.Visible:=true;
DBChart1.Visible:=false;
DBChart4.Visible:=true;
DBChart3.Visible:=false;
end;
procedure Tfrm_rp_zj_zou.N5Click(Sender: TObject);
begin
if DBChart1.Visible=true then
chartpreview(frm_rp_zj_zou,dbchart1)
else
chartpreview(frm_rp_zj_zou,dbchart2);
end;
procedure Tfrm_rp_zj_zou.N2Click(Sender: TObject);
begin
if DBChart3.Visible=true then
chartpreview(frm_rp_zj_zou,dbchart3)
else
chartpreview(frm_rp_zj_zou,dbchart4);
end;
procedure Tfrm_rp_zj_zou.bsSkinPanel3Resize(Sender: TObject);
begin
bsSkinPanel4.Height:=round(bsSkinPanel3.Height/2);
end;
end.