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.

248 lines
7.2 KiB
Plaintext

11 months ago
unit u_seai_sf_shenhe;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner,
DB, ADODB, StdCtrls, Mask, bsSkinBoxCtrls, bsSkinCtrls, kbmMemTable,DateUtils,
RxLookup, wwdbedit, Wwdotdot, Wwdbcomb;
type
Tfrm_seai_sf_shen = class(TForm)
t_op_ctn: TADOQuery;
t_op_ctn1: TDataSource;
bsSkinPanel1: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
kmltbl: TkbmMemTable;
kmltblField: TStringField;
kmltblField2: TStringField;
kmltblField3: TStringField;
kmltblField6: TStringField;
kmltblField7: TStringField;
Label131: TLabel;
Edit2: TEdit;
Label213: TLabel;
RxDBLookupCombo57: TRxDBLookupCombo;
Label25: TLabel;
wwDBComboBox31: TwwDBComboBox;
RxDBLookupCombo16: TRxDBLookupCombo;
Label38: TLabel;
kmltblField4: TStringField;
kmltblField5: TStringField;
kmltblField8: TStringField;
kmltblField10: TStringField;
kmltblField11: TStringField;
kmltblch_id: TIntegerField;
kmltblField9: TFloatField;
kmltblField12: TBooleanField;
dxDBGrid2: TdxDBGrid;
dxDBGrid2Column1: TdxDBGridCheckColumn;
dxDBGrid2Column2: TdxDBGridColumn;
dxDBGrid2Column3: TdxDBGridColumn;
dxDBGrid2Column4: TdxDBGridColumn;
dxDBGrid2Column5: TdxDBGridColumn;
dxDBGrid2Column6: TdxDBGridColumn;
dxDBGrid2Column7: TdxDBGridColumn;
dxDBGrid2Column8: TdxDBGridColumn;
dxDBGrid2Column9: TdxDBGridColumn;
dxDBGrid2Column10: TdxDBGridColumn;
bsSkinButton2: TbsSkinButton;
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
function GetCQFEE(bsNo,Carrer:string;CQDay:Integer):Double;
public
{ Public declarations }
end;
var
frm_seai_sf_shen: Tfrm_seai_sf_shen;
implementation
uses my_sys_function,u_main;
{$R *.dfm}
function Tfrm_seai_sf_shen.GetCQFEE(bsNo,Carrer:string;CQDay:Integer):Double;
var aAdoQuery,bAdoQuery:TAdoQuery;
begin
result:=0;
aAdoQuery:=CreateAdoQuery;
bAdoQuery:=CreateAdoQuery;
with bAdoQuery do
begin
Close;SQL.Clear;
SQL.Add('select *');
SQL.Add('from t_ctn_cqfee');
SQL.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ');
end;
with aAdoQuery do
try
Close;SQL.Clear;
SQL.Add('select *');
SQL.Add('from t_op_ctn');
SQL.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=bsNo;
Open;First;
while not Eof do
begin
bAdoQuery.Close;
bAdoQuery.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=Carrer;
bAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value;
bAdoQuery.Open;
if CQDay<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>1').AsInteger then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>1').asFloat;
end
else
if (CQDay>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>1').AsInteger) and (CQDay<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>2').asFloat;
end
else
if (CQDay>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) and (CQDay<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
end
else
if CQDay>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
end;
Next;
end;
finally
aAdoQuery.Free;
bAdoQuery.Free;
end;
end;
procedure Tfrm_seai_sf_shen.FormShow(Sender: TObject);
var YYYY,MM,DD:Word;
begin
DecodeDate(Date,YYYY,MM,DD);
{
bsSkinDateEdit1.Date:=EncodeDate(YYYY,MM,1);
bsSkinDateEdit2.Date:=Date;
}
// t_op_ctn.Close;
// t_op_ctn.Open;
end;
procedure Tfrm_seai_sf_shen.bsSkinButton1Click(Sender: TObject);
begin
kmltbl.EmptyTable;
kmltbl.Open;
with t_op_ctn do
begin
Close;SQL.Clear;
SQL.Add('select t_op_seai.<2E><><EFBFBD><EFBFBD>,t_op_seai.ί<>е<EFBFBD>λ,t_op_seai.<2E><><EFBFBD><EFBFBD><E1B5A5>,t_op_seai.<2E><><EFBFBD><EFBFBD>Ա,t_op_seai.<2E><><EFBFBD><EFBFBD>˾,t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
SQL.Add(',t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,t_ch_fee.ch_id');
SQL.Add('from t_op_seai');
SQL.Add('inner Join t_ch_fee on t_op_seai.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>״̬=''<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>''');
SQL.Add('where t_op_seai.װ<>˷<EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>''');
if Trim(RxDBLookupCombo57.DisplayValues[1])<>'' then
begin
SQL.Add('and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=Trim(RxDBLookupCombo57.DisplayValues[1]);
end;
if Trim(RxDBLookupCombo16.DisplayValues[1])<>'' then
begin
SQL.Add('and t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=Trim(RxDBLookupCombo16.DisplayValues[1]);
end;
if Trim(wwDBComboBox31.text)<>'' then
begin
SQL.Add('and t_ch_fee.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=Trim(wwDBComboBox31.text);
end;
if Trim(Edit2.Text)<>'' then
begin
SQL.Add('and t_op_seai.<2E><><EFBFBD><EFBFBD><E1B5A5> like '+''''+'%'+Edit2.text+'%'+'''');
end;
SQL.Add('Order by t_op_seai.<2E><><EFBFBD><EFBFBD><E1B5A5>');
Open;First;
while not Eof do
begin
kmltbl.Insert;
kmltbl.FieldByName('ѡ<><D1A1>').Value:=false;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD>').Value;
kmltbl.FieldByName('ί<>е<EFBFBD>λ').Value:=FieldByName('ί<>е<EFBFBD>λ').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').Value:=FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>Ա').Value:=FieldByName('<27><><EFBFBD><EFBFBD>Ա').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>˾').Value:=FieldByName('<27><><EFBFBD><EFBFBD>˾').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD>').Value;
kmltbl.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD>').Value;
kmltbl.FieldByName('<27>ұ<EFBFBD>').Value:=FieldByName('<27>ұ<EFBFBD>').Value;
kmltbl.FieldByName('ch_id').Value:=FieldByName('ch_id').Value;
kmltbl.Post;
Next;
end;
end;
end;
procedure Tfrm_seai_sf_shen.bsSkinButton2Click(Sender: TObject);
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
begin
Close;SQL.Clear;
SQL.Add('update t_ch_fee set <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
SQL.Add('where ch_id=:ch_id and <20><><EFBFBD><EFBFBD>״̬=''<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>''');
SQL.Add('');
end;
with kmltbl do
try
DisableControls;
First;
while not Eof do
begin
if kmltbl.FieldByName('ѡ<><D1A1>').AsBoolean then
begin
aAdoQuery.close;
aAdoQuery.Parameters.ParamByName('ch_id').Value:=FieldByName('ch_id').AsInteger;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=employee;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=now;
aAdoQuery.ExecSQL;
end;
Next;
end;
finally
EnableControls;
aAdoQuery.Free;
bsSkinButton1Click(sender);
end;
end;
procedure Tfrm_seai_sf_shen.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
action:=cafree;
frm_seai_sf_shen:=nil;
end;
end.