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.

276 lines
9.8 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_op_givectn_add;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, wwdbdatetimepicker, bsSkinCtrls, BusinessSkinForm, DB,
dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner, RxLookup, ADODB, dxDBTLCl,
dxGrClms, ComCtrls, bsSkinTabs, Grids, DBGrids;
type
Tfrm_op_givectn_add = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
DataSource1: TDataSource;
bsSkinPanel1: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinPanel2: TbsSkinPanel;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
dxDBGrid1Column9: TdxDBGridColumn;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridColumn;
dxDBGrid1Column13: TdxDBGridColumn;
dxDBGrid1Column22: TdxDBGridColumn;
dxDBGrid1Column23: TdxDBGridColumn;
Edit1: TEdit;
Label6: TLabel;
Label2: TLabel;
Edit3: TEdit;
Label10: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
Label5: TLabel;
wwDBDateTimePicker2: TwwDBDateTimePicker;
bsSkinButton44: TbsSkinButton;
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinPanel3: TbsSkinPanel;
v_op_ctnmg_detail: TADOQuery;
v_op_ctnmg_detail1: TDataSource;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
dxDBGrid2: TdxDBGrid;
dxDBGrid1Column25: TdxDBGridColumn;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGrid1Column15: TdxDBGridColumn;
dxDBGrid1Column16: TdxDBGridCheckColumn;
dxDBGridColumn4: TdxDBGridColumn;
dxDBGridColumn5: TdxDBGridColumn;
dxDBGridColumn6: TdxDBGridColumn;
dxDBGridColumn7: TdxDBGridColumn;
dxDBGridColumn8: TdxDBGridColumn;
dxDBGridColumn9: TdxDBGridColumn;
dxDBGrid1Column17: TdxDBGridColumn;
dxDBGrid1Column18: TdxDBGridColumn;
dxDBGridColumn10: TdxDBGridColumn;
dxDBGridColumn11: TdxDBGridColumn;
t_ch_fee: TADOQuery;
dxDBGrid2Column17: TdxDBGridColumn;
t_op_ctnmg_status: TADOQuery;
DBGrid1: TDBGrid;
t_ch_fee_detail: TADOQuery;
t_ch_fee_detail1: TDataSource;
bsSkinButton6: TbsSkinButton;
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton44Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
private
function getcompanyname(op:string):string;
{ Private declarations }
public
{ Public declarations }
BSTYPE:string;
end;
var
frm_op_givectn_add: Tfrm_op_givectn_add;
implementation
uses my_sys_function, u_op_railway_shencode, u_main, u_data_share;
{$R *.dfm}
procedure Tfrm_op_givectn_add.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_givectn_add.bsSkinButton1Click(Sender: TObject);
var
i:Integer;
begin
try
DataSource1.DataSet.Edit;
DataSource1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring:=v_op_ctnmg_detail.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
DataSource1.DataSet.fieldbyname('ctnid').asstring:=v_op_ctnmg_detail.fieldbyname('ctnid').AsString;
DataSource1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring:=v_op_ctnmg_detail.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
DataSource1.DataSet.post;
v_op_ctnmg_detail.edit;
v_op_ctnmg_detail.FieldByName('<27><>ǰ<EFBFBD><C7B0>̬').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
v_op_ctnmg_detail.FieldByName('<27><>̬ʱ<CCAC><CAB1>').AsDateTime:=Date;
v_op_ctnmg_detail.FieldByName('<27><><EFBFBD><EFBFBD>').AsBoolean:=True;
v_op_ctnmg_detail.FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring:=DataSource1.DataSet.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
v_op_ctnmg_detail.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring:=DataSource1.DataSet.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;;
v_op_ctnmg_detail.post;
t_op_ctnmg_status.Open;
t_op_ctnmg_status.Insert;
t_op_ctnmg_status['ctnid']:=v_op_ctnmg_detail['ctnid'];
t_op_ctnmg_status['<27><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>']:=v_op_ctnmg_detail['<27><>ǰ<EFBFBD><C7B0>̬'];
t_op_ctnmg_status['<27><>̬ʱ<CCAC><CAB1>']:=v_op_ctnmg_detail['<27><>̬ʱ<CCAC><CAB1>'];
t_op_ctnmg_status['״̬']:=v_op_ctnmg_detail['<27><>ǰ״̬'];
t_op_ctnmg_status['<27><EFBFBD><E1B5A5>']:=v_op_ctnmg_detail.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
t_op_ctnmg_status['<27><><EFBFBD><EFBFBD>']:=v_op_ctnmg_detail['<27><><EFBFBD><EFBFBD>'];
t_op_ctnmg_status['<27><>ע']:=v_op_ctnmg_detail['<27><>ע'];
t_op_ctnmg_status['<27><><EFBFBD><EFBFBD>Ա']:=employee;
t_op_ctnmg_status['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=date;
t_op_ctnmg_status.Post;
if not t_ch_fee.Active then t_ch_fee.open;
t_ch_fee_detail.First;
while not t_ch_fee_detail.Eof do begin
t_ch_fee.Insert;
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=DataSource1.DataSet['<27><><EFBFBD><EFBFBD>'];
t_ch_fee['<27><><EFBFBD><EFBFBD>']:='<27><>';
t_ch_fee['<27><><EFBFBD><EFBFBD>״̬']:='¼<><C2BC>״̬';
t_ch_fee['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_ch_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee_detail['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_detail['<27><><EFBFBD><EFBFBD>'];
t_ch_fee['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>']:=t_ch_fee_detail['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>'];
t_ch_fee['˰<><CBB0>']:=t_ch_fee_detail['˰<><CBB0>'];
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_detail['<27><><EFBFBD><EFBFBD>'];
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_detail['<27><><EFBFBD><EFBFBD>'];
t_ch_fee['˰<><CBB0>']:=t_ch_fee_detail['˰<><CBB0>'];
t_ch_fee['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>']:=t_ch_fee_detail['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>'];
t_ch_fee['<27>ұ<EFBFBD>']:=t_ch_fee_detail['<27>ұ<EFBFBD>'];
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_detail['<27><><EFBFBD><EFBFBD>'];
t_ch_fee['<27><>׼']:=t_ch_fee_detail['<27><>׼'];
t_ch_fee['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>']:=0;
t_ch_fee['<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>']:=0;
t_ch_fee['<27><><EFBFBD>񲻺<EFBFBD>˰<EFBFBD><CBB0>']:=0;
t_ch_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_ch_fee['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=0;
t_ch_fee['<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>']:=0;
t_ch_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_ch_fee['<27><><EFBFBD>뿪Ʊ']:=0;
t_ch_fee['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
t_ch_fee['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_ch_fee['<27>Ƿ<EFBFBD><C7B7>渶']:=0;
t_ch_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ']:=0;
t_ch_fee['˳<><CBB3>']:=1;
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=0;
t_ch_fee['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=getcompanyname(v_op_ctnmg_detail.fieldbyname('¼<><C2BC><EFBFBD><EFBFBD>').AsString);
t_ch_fee.Post;
t_ch_fee_detail.Next;
end;
finally
end;
close;
end;
procedure Tfrm_op_givectn_add.FormShow(Sender: TObject);
begin
// wwDBDateTimePicker1.MinDate:=date;
v_op_ctnmg_detail.Close;
v_op_ctnmg_detail.SQL.Clear;
v_op_ctnmg_detail.SQL.Add('select * from v_op_ctnmg_detail where <20><>ǰ<EFBFBD><C7B0>̬=''<27><><EFBFBD><EFBFBD>'' ');
if DataSource1.DataSet.FieldByName('<27><>Դ').AsString='<27><>˾<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>' then begin
v_op_ctnmg_detail.SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' ');
end;
if DataSource1.DataSet.FieldByName('<27><>Դ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
v_op_ctnmg_detail.SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' ');
end;
v_op_ctnmg_detail.SQL.Add(' order by ctnid');
v_op_ctnmg_detail.Open;
t_ch_fee_detail.Close;
t_ch_fee_detail.SQL.Text:='select * from t_ch_fee where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+getcompanyname(employee)+''' and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>';
t_ch_fee_detail.DataSource:=v_op_ctnmg_detail1;
t_ch_fee_detail.Open;
end;
procedure Tfrm_op_givectn_add.bsSkinButton44Click(Sender: TObject);
begin
v_op_ctnmg_detail.close;
v_op_ctnmg_detail.SQL.clear;
v_op_ctnmg_detail.SQL.add('select * from v_op_ctnmg_detail where <20><>ǰ<EFBFBD><C7B0>̬=''<27><><EFBFBD><EFBFBD>'' ');
if DataSource1.DataSet.FieldByName('<27><>Դ').AsString='<27><>˾<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>' then
begin
v_op_ctnmg_detail.SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' ');
end;
if DataSource1.DataSet.FieldByName('<27><>Դ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
v_op_ctnmg_detail.SQL.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' ');
end;
if Edit3.Text<>'' then
v_op_ctnmg_detail.SQL.add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+edit3.text+'''');
if Edit1.Text<>'' then
v_op_ctnmg_detail.SQL.add(' and <20><><EFBFBD><EFBFBD> like '+'''%'+edit1.Text+'%''');
if wwDBDateTimePicker1.text<>''then
v_op_ctnmg_detail.SQL.add(' and <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>>='+''''+wwDBDateTimePicker1.text+'''');
if wwDBDateTimePicker2.text<>''then
v_op_ctnmg_detail.SQL.add(' and <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><='+''''+wwDBDateTimePicker2.text+'''');
v_op_ctnmg_detail.SQL.add(' order by ctnid');
v_op_ctnmg_detail.open;
end;
function Tfrm_op_givectn_add.getcompanyname(op: string): string;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('select <20>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+op+'''');
open;
if not IsEmpty then Result:=fieldbyname('<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_givectn_add.bsSkinButton6Click(Sender: TObject);
var
aQuery,aQuery2:TADOQuery;
begin
aQuery:=CreateAdoQuery;
aQuery2:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add(' delete from t_op_ctnmg_status where ctnid='+DataSource1.DataSet.fieldbyname('ctnid').asstring+' and <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
ExecSQL;
aQuery2.SQL.Text:='select top 1 * from t_op_ctnmg_status where ctnid='+DataSource1.DataSet.fieldbyname('ctnid').asstring+' order by <20><>̬ʱ<CCAC><CAB1> DESC ';
aQuery2.Open;
if aQuery2.IsEmpty then begin
Close;SQL.Clear;
SQL.Add(' update t_op_ctnmg_detail set <20><>ǰ<EFBFBD><C7B0>̬=''<27><><EFBFBD><EFBFBD>'',<2C><><EFBFBD><EFBFBD>=0,ί<>б<EFBFBD><D0B1><EFBFBD>='''',<2C><><EFBFBD><EFBFBD><E1B5A5>='''' where ctnid='+DataSource1.DataSet.fieldbyname('ctnid').asstring);
ExecSQL;
end else begin
Close;SQL.Clear;
SQL.Add(' update t_op_ctnmg_detail set <20><>ǰ<EFBFBD><C7B0>̬='''+aQuery2.fieldbyname('<27><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>').AsString+''',<2C><>̬ʱ<CCAC><CAB1>='''+aQuery2.fieldbyname('<27><>̬ʱ<CCAC><CAB1>').AsString+''',<2C><><EFBFBD><EFBFBD>=0,ί<>б<EFBFBD><D0B1><EFBFBD>='''',<2C><><EFBFBD><EFBFBD><E1B5A5>='''' where ctnid='+DataSource1.DataSet.fieldbyname('ctnid').asstring);
ExecSQL;
end;
end;
DataSource1.DataSet.Edit;
DataSource1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring:='';
DataSource1.DataSet.fieldbyname('ctnid').asstring:='';
DataSource1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring:='';
DataSource1.DataSet.post;
finally
FreeAndNil(aQuery);
FreeAndNil(aQuery2);
end;
end;
end.