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.

377 lines
11 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_no_zou;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, DbChart,
bsSkinCtrls, StdCtrls, wwdbdatetimepicker, RxLookup, Mask, wwdbedit,
Wwdotdot, Wwdbcomb,teeprevi, DB, ADODB, RxMemDS, Menus, XPMenu, ComCtrls;
type
Tfrm_rp_no_zou = class(TForm)
bsSkinPanel1: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
Label16: TLabel;
RxDBLookupCombo6: TRxDBLookupCombo;
Label14: TLabel;
RxDBLookupCombo3: TRxDBLookupCombo;
RxDBLookupCombo12: TRxDBLookupCombo;
Label23: TLabel;
Label22: TLabel;
RxDBLookupCombo10: TRxDBLookupCombo;
Label10: TLabel;
Label5: TLabel;
wwDBComboBox1: TwwDBComboBox;
Label7: TLabel;
Label9: TLabel;
RxDBLookupCombo2: TRxDBLookupCombo;
bsSkinButton1: TbsSkinButton;
p_no_accept: TADOStoredProc;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
wwDBComboBox2: TwwDBComboBox;
wwDBComboBox3: TwwDBComboBox;
wwDBComboBox4: TwwDBComboBox;
wwDBComboBox5: TwwDBComboBox;
bsSkinPanel2: TbsSkinPanel;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox4: TbsSkinCheckRadioBox;
bsSkinPanel3: TbsSkinPanel;
bsSkinPanel4: TbsSkinPanel;
DBChart1: TDBChart;
Series1: TLineSeries;
DBChart2: TDBChart;
LineSeries1: TBarSeries;
bsSkinPanel5: TbsSkinPanel;
DBChart3: TDBChart;
LineSeries2: TLineSeries;
DBChart4: TDBChart;
BarSeries1: TBarSeries;
p_no_pay: TADOStoredProc;
PopupMenu1: TPopupMenu;
N5: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
XPMenu1: TXPMenu;
t_sum: TRxMemoryData;
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 N2Click(Sender: TObject);
procedure bsSkinPanel3Resize(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_no_zou: Tfrm_rp_no_zou;
implementation
uses u_main, my_sys_function, u_data_share;
{$R *.dfm}
procedure Tfrm_rp_no_zou.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_no_zou.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_no_zou.Hide;
frm_rp_no_zou.ManualFloat(frm_rp_no_zou.BoundsRect );
frm_main.freeTabs('frm_rp_no_zou');
action:=cafree;
frm_rp_no_zou:=nil;
end;
procedure Tfrm_rp_no_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_no_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_no_zou.bsSkinButton1Click(Sender: TObject);
var
str_op:widestring;
str_start,str_end:string;
str_date:string;
i,j,f,h:integer;
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;
str_end:=wwDBComboBox5.text+'/'+wwDBComboBox4.text;
str_op:=' where '+open_data('0033','v_no_ying.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_no_ying.<2E><><EFBFBD><EFBFBD>Ա','v_no_ying.<2E>ͷ<EFBFBD>Ա','v_no_ying.<2E><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>','v_no_ying.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if wwDBComboBox1.ItemIndex<>-1 then
str_op:=str_op+' and v_no_ying.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+wwDBComboBox1.text+'''';
if RxDBLookupCombo6.DisplayValue<>''then
str_op:=str_op+' and v_no_ying.<2E><><EFBFBD><EFBFBD>Ա='+''''+RxDBLookupCombo6.DisplayValue+'''';
if RxDBLookupCombo12.DisplayValue<>''then
str_op:=str_op+' and v_no_ying.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo12.DisplayValue+'''';
if RxDBLookupCombo3.DisplayValue<>''then
str_op:=str_op+' and v_no_ying.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
if RxDBLookupCombo10.DisplayValue<>''then
str_op:=str_op+' and v_no_ying.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
if RxDBLookupCombo2.DisplayValues[1]<>''then
str_op:=str_op+' and v_no_ying.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
str_op:='select sum(Ӧ<>ս<EFBFBD><D5BD><EFBFBD>) as Ӧ<>ս<EFBFBD><D5BD><EFBFBD>,sum(Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> from v_no_ying '
+str_op+' and (<28><><EFBFBD><EFBFBD> between '+''''+str_start+''''+' and '+''''+str_end+''''
+') group by <20><><EFBFBD><EFBFBD>';
p_no_accept.close;
p_no_accept.Parameters.ParamByName('SQLStr').value:=str_op;
p_no_accept.Open;
str_op:=' where '+open_data('0033','v_no_jie.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_no_jie.<2E><><EFBFBD><EFBFBD>Ա','v_no_jie.<2E>ͷ<EFBFBD>Ա','v_no_jie.<2E><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>','v_no_jie.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if wwDBComboBox1.ItemIndex<>-1 then
str_op:=str_op+' and v_no_jie.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+wwDBComboBox1.text+'''';
if RxDBLookupCombo6.DisplayValue<>''then
str_op:=str_op+' and v_no_jie.<2E><><EFBFBD><EFBFBD>Ա='+''''+RxDBLookupCombo6.DisplayValue+'''';
if RxDBLookupCombo12.DisplayValue<>''then
str_op:=str_op+' and v_no_jie.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo12.DisplayValue+'''';
if RxDBLookupCombo3.DisplayValue<>''then
str_op:=str_op+' and v_no_jie.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
if RxDBLookupCombo10.DisplayValue<>''then
str_op:=str_op+' and v_no_jie.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
if RxDBLookupCombo2.DisplayValues[1]<>''then
str_op:=str_op+' and v_no_jie.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
str_op:='select sum(<28><><EFBFBD>ս<EFBFBD><D5BD><EFBFBD>) as <20><><EFBFBD>ս<EFBFBD><D5BD><EFBFBD>,sum(<28>Ѹ<EFBFBD><D1B8><EFBFBD><EFBFBD><EFBFBD>) as <20>Ѹ<EFBFBD><D1B8><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> from v_no_jie '
+str_op+' and (<28><><EFBFBD><EFBFBD> between '+''''+str_start+''''+' and '+''''+str_end+''''
+') group by <20><><EFBFBD><EFBFBD>';
p_no_pay.close;
p_no_pay.Parameters.ParamByName('SQLStr').value:=str_op;
p_no_pay.Open;
t_sum.close;
t_sum.open;
i:=strtoint(wwDBComboBox5.text)-strtoint(wwDBComboBox2.text);
if i=0 then
begin
for j:=strtoint(wwDBComboBox3.text) to strtoint(wwDBComboBox4.text) do
begin
t_sum.append;
if j<10 then
t_sum['<27><><EFBFBD><EFBFBD>']:=wwDBComboBox5.text+'/0'+inttostr(j)
else
t_sum['<27><><EFBFBD><EFBFBD>']:=wwDBComboBox5.text+'/'+inttostr(j);
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=0;
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=0;
t_sum.Post;
end;
end
else
begin
for j:=0 to i do
begin
if j=0 then
begin
for f:=strtoint(wwDBComboBox3.text) to 12 do
begin
t_sum.append;
if f<10 then
t_sum['<27><><EFBFBD><EFBFBD>']:=wwDBComboBox2.text+'/0'+inttostr(f)
else
t_sum['<27><><EFBFBD><EFBFBD>']:=wwDBComboBox2.text+'/'+inttostr(f);
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=0;
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=0;
t_sum.Post;
end;
end
else if j=i then
begin
for f:=1 to strtoint(wwDBComboBox4.text) do
begin
t_sum.append;
if f<10 then
t_sum['<27><><EFBFBD><EFBFBD>']:=wwDBComboBox5.text+'/0'+inttostr(f)
else
t_sum['<27><><EFBFBD><EFBFBD>']:=wwDBComboBox5.text+'/'+inttostr(f);
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=0;
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=0;
t_sum.Post;
end;
end
else
begin
for f:=1 to 12 do
begin
t_sum.append;
if f<10 then
t_sum['<27><><EFBFBD><EFBFBD>']:=inttostr(strtoint(wwDBComboBox2.text)+j)+'/0'+inttostr(f)
else
t_sum['<27><><EFBFBD><EFBFBD>']:=inttostr(strtoint(wwDBComboBox2.text)+j)+'/'+inttostr(f);
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=0;
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=0;
t_sum.Post;
end;
end;
end;
end;
p_no_accept.First;
while not p_no_accept.eof do
begin
t_sum.first;
while not t_sum.eof do
begin
if p_no_accept.FieldByName('<27><><EFBFBD><EFBFBD>').asstring<=t_sum.FieldByName('<27><><EFBFBD><EFBFBD>').asstring then
begin
t_sum.edit;
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']+p_no_accept['Ӧ<>ս<EFBFBD><D5BD><EFBFBD>'];
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']+p_no_accept['Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_sum.Post;
end;
t_sum.next;
end;
p_no_accept.next;
end;
p_no_pay.First;
while not p_no_pay.eof do
begin
t_sum.first;
while not t_sum.eof do
begin
if p_no_pay.FieldByName('<27><><EFBFBD><EFBFBD>').asstring<=t_sum.FieldByName('<27><><EFBFBD><EFBFBD>').asstring then
begin
t_sum.edit;
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']-p_no_pay['<27><><EFBFBD>ս<EFBFBD><D5BD><EFBFBD>'];
t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']:=t_sum['Ӧ<><D3A6>Ƿ<EFBFBD><C7B7>']-p_no_pay['<27>Ѹ<EFBFBD><D1B8><EFBFBD><EFBFBD><EFBFBD>'];
t_sum.Post;
end;
t_sum.next;
end;
p_no_pay.next;
end;
t_sum.SortOnFields('<27><><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_no_zou.bsSkinCheckRadioBox4Click(Sender: TObject);
begin
DBChart1.Visible:=true;
DBChart2.Visible:=false;
DBChart3.Visible:=true;
DBChart4.Visible:=false;
frm_rp_no_zou.FormShow(Sender);
end;
procedure Tfrm_rp_no_zou.bsSkinCheckRadioBox3Click(Sender: TObject);
begin
DBChart2.Visible:=true;
DBChart1.Visible:=false;
DBChart4.Visible:=true;
DBChart3.Visible:=false;
frm_rp_no_zou.FormShow(Sender);
end;
procedure Tfrm_rp_no_zou.N2Click(Sender: TObject);
begin
if DBChart3.Visible=true then
chartpreview(frm_rp_no_zou,dbchart3)
else
chartpreview(frm_rp_no_zou,dbchart4);
end;
procedure Tfrm_rp_no_zou.bsSkinPanel3Resize(Sender: TObject);
begin
bsSkinPanel4.Height:=round(bsSkinPanel3.Height/2);
end;
procedure Tfrm_rp_no_zou.N5Click(Sender: TObject);
begin
if DBChart1.Visible=true then
chartpreview(frm_rp_no_zou,dbchart1)
else
chartpreview(frm_rp_no_zou,dbchart2);
end;
procedure Tfrm_rp_no_zou.FormShow(Sender: TObject);
begin
if frm_data_share.t_load_employee.FieldByName('Ӧ<><D3A6>').asboolean then
begin
DBChart2.Visible:=true;
DBChart1.Visible:=true;
end
else
begin
DBChart2.Visible:=false;
DBChart1.Visible:=false;
end;
if frm_data_share.t_load_employee.FieldByName('Ӧ<><D3A6>').asboolean then
begin
DBChart3.Visible:=true;
DBChart4.Visible:=true;
end
else
begin
DBChart3.Visible:=false;
DBChart4.Visible:=false;
end;
end;
end.