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.

448 lines
12 KiB
Plaintext

11 months ago
unit u_op_seae_teshushen;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, XPMenu, Menus, dxDBTLCl, dxGrClms, dxDBCtrl, dxDBGrid,
dxTL, dxCntner, DB, ADODB, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdblook,
RxLookup, wwdbdatetimepicker, StdCtrls, bsSkinCtrls, ExtCtrls, ComCtrls,
bsSkinTabs, DBCtrls,DateUtils;
type
Tfrm_op_seae_teshushenhe = class(TForm)
t_op_seae: TADOQuery;
t_op_seae1: TDataSource;
bsSkinButton13: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
PopupMenu2: TPopupMenu;
N16: TMenuItem;
XPMenu1: TXPMenu;
t_op_seaesel: TADOQuery;
ds_op_seaesel1: TDataSource;
pm1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
bsSkinPanel2: TbsSkinPanel;
bsSkinPanel3: TbsSkinPanel;
bsSkinButton3: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
t_op_bill: TADOQuery;
ds_op_bill1: TDataSource;
bsSkinPageControl1: TbsSkinPageControl;
bskntbsht1: TbsSkinTabSheet;
bskntbsht2: TbsSkinTabSheet;
dxDBGrid2: TdxDBGrid;
dxDBGrid2Column2: TdxDBGridColumn;
dxDBGrid2Column3: TdxDBGridColumn;
dxDBGrid2Column4: TdxDBGridColumn;
dxDBGrid2Column5: TdxDBGridColumn;
dxDBGrid2Column6: TdxDBGridColumn;
bsSkinPanel4: TbsSkinPanel;
dxDBGrid3: TdxDBGrid;
dxDBGridMaskColumn4: TdxDBGridMaskColumn;
dxDBGridMaskColumn7: TdxDBGridMaskColumn;
dxDBGridMaskColumn13: TdxDBGridMaskColumn;
dxDBGridMaskColumn14: TdxDBGridMaskColumn;
dxDBGridMaskColumn15: TdxDBGridMaskColumn;
dxDBGridDateColumn1: TdxDBGridDateColumn;
dxDBGridMaskColumn17: TdxDBGridMaskColumn;
dxDBGridMaskColumn24: TdxDBGridMaskColumn;
dxDBGridMaskColumn57: TdxDBGridMaskColumn;
dxDBGridMaskColumn58: TdxDBGridMaskColumn;
dxDBGridMaskColumn61: TdxDBGridMaskColumn;
PopupMenu1: TPopupMenu;
MenuItem1: TMenuItem;
bsSkinButton5: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
PopupMenu3: TPopupMenu;
MenuItem2: TMenuItem;
dxDBGrid2Column7: TdxDBGridColumn;
bsSkinPanel5: TbsSkinPanel;
Panel1: TPanel;
bsSkinButton11: TbsSkinButton;
Label17: TLabel;
wwDBDateTimePicker6: TwwDBDateTimePicker;
Label18: TLabel;
wwDBDateTimePicker7: TwwDBDateTimePicker;
Label19: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
dxDBGrid2Column8: TdxDBGridColumn;
dxDBGrid2Column9: TdxDBGridColumn;
dxDBGrid3Column12: TdxDBGridColumn;
dxDBGrid3Column13: TdxDBGridColumn;
dxDBGrid3Column14: TdxDBGridColumn;
dxDBGrid3Column15: TdxDBGridColumn;
Label4: TLabel;
Label7: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label15: TLabel;
Label25: TLabel;
Label26: TLabel;
RxDBLookupCombo4: TRxDBLookupCombo;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
wwDBDateTimePicker5: TwwDBDateTimePicker;
DBEdit1: TDBEdit;
wwDBDateTimePicker8: TwwDBDateTimePicker;
RxDBLookupCombo7: TRxDBLookupCombo;
wwDBDateTimePicker9: TwwDBDateTimePicker;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
RxDBLookupCombo8: TRxDBLookupCombo;
dxDBGrid2Column10: TdxDBGridColumn;
dxDBGrid2Column11: TdxDBGridColumn;
bsSkinButton38: TbsSkinButton;
dxDBGrid2Column12: TdxDBGridColumn;
dxDBGrid2Column13: TdxDBGridColumn;
dxDBGrid2Column14: TdxDBGridColumn;
RxDBLookupCombo2: TRxDBLookupCombo;
Label2: TLabel;
Label3: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
RxDBLookupCombo3: TRxDBLookupCombo;
dxDBGrid2Column15: TdxDBGridColumn;
dxDBGrid2Column16: TdxDBGridColumn;
Label1: TLabel;
DBMemo1: TDBMemo;
Label29: TLabel;
DBMemo2: TDBMemo;
Label6: TLabel;
DBMemo3: TDBMemo;
Label8: TLabel;
DBMemo4: TDBMemo;
Label9: TLabel;
DBMemo5: TDBMemo;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton38Click(Sender: TObject);
procedure dxDBGrid2Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure RxDBLookupCombo8Change(Sender: TObject);
procedure RxDBLookupCombo7Change(Sender: TObject);
procedure RxDBLookupCombo4Change(Sender: TObject);
procedure RxDBLookupCombo2Change(Sender: TObject);
procedure RxDBLookupCombo3Change(Sender: TObject);
procedure dxDBGrid3DblClick(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function UpdateBillStatus(bsStStatus:string):Boolean;
end;
var
frm_op_seae_teshushenhe: Tfrm_op_seae_teshushenhe;
implementation
uses my_sys_function, u_main, my_sys_chat;
{$R *.dfm}
function Tfrm_op_seae_teshushenhe.UpdateBillStatus(bsStStatus:string):Boolean;
var aAdoQuery,aAdoQuerySelect:TAdoQuery;
begin
{var aAdoQuery:TAdoQuery;
begin
result:=False;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;Sql.Clear;
SQL.Add('select count(<28><><EFBFBD><EFBFBD>) c from t_op_fangdan');
SQL.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=BsNo;
Open;
if aAdoQuery.FieldByName('c').AsInteger=0 then
begin
Close;Sql.Clear;
SQL.Add('Insert into t_op_fangdan (<28><><EFBFBD><EFBFBD>, <20>ŵ<EFBFBD>״̬,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)');
SQL.Add('values (:<3A><><EFBFBD><EFBFBD>,:<3A>ŵ<EFBFBD>״̬,:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=BsNo;
Parameters.ParamByName('<27>ŵ<EFBFBD>״̬').Value:='<27><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>';
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=employee;
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=date;
ExecSQL;
end;
finally
aAdoQuery.Free;
end;
}
result:=False;
aAdoQuery:=CreateAdoQuery;
aAdoQuerySelect:=CreateAdoQuery;
with t_op_seaesel do
try
Open;First;
while not eof do
begin
aAdoQuerySelect.Close;aAdoQuerySelect.Sql.Clear;
aAdoQuerySelect.SQL.Add('select count(<28><><EFBFBD><EFBFBD>) c from t_op_fangdan');
aAdoQuerySelect.SQL.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
aAdoQuerySelect.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
aAdoQuerySelect.Open;
if aAdoQuerySelect.FieldByName('c').AsInteger=0 then
begin
aAdoQuery.Close;aAdoQuery.Sql.Clear;
aAdoQuery.SQL.Add('Insert into t_op_fangdan (<28><><EFBFBD><EFBFBD>, <20>ŵ<EFBFBD>״̬)');
aAdoQuery.SQL.Add('values (:<3A><><EFBFBD><EFBFBD>,:<3A>ŵ<EFBFBD>״̬)');
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
aAdoQuery.Parameters.ParamByName('<27>ŵ<EFBFBD>״̬').Value:=bsStStatus;
aAdoQuery.ExecSQL;
end
else
begin
aAdoQuery.Close;aAdoQuery.Sql.Clear;
aAdoQuery.SQL.Add('Update t_op_fangdan set <20>ŵ<EFBFBD>״̬=:<3A>ŵ<EFBFBD>״̬');
aAdoQuery.SQL.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
aAdoQuery.Parameters.ParamByName('<27>ŵ<EFBFBD>״̬').Value:=bsStStatus;
aAdoQuery.ExecSQL;
end;
Next;
end;
finally
aAdoQuery.Free;
aAdoQuerySelect.Free;
end;
end;
procedure Tfrm_op_seae_teshushenhe.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid2,caption);
savereggrid(dxdbgrid3,caption+'1');
frm_op_seae_teshushenhe.Hide;
frm_op_seae_teshushenhe.ManualFloat(frm_op_seae_teshushenhe.BoundsRect );
frm_main.freeTabs('frm_op_seae_teshushenhe');
action:=cafree;
frm_op_seae_teshushenhe:=nil;
end;
procedure Tfrm_op_seae_teshushenhe.FormShow(Sender: TObject);
begin
loadreggrid(dxdbgrid2,true,caption);
loadreggrid(dxdbgrid3,true,caption+'1');
with t_op_bill do
begin
Parameters.ParamByName('Employee').Value:=Employee;
Open;
end;
t_op_seaesel.Open;
end;
procedure Tfrm_op_seae_teshushenhe.bsSkinButton3Click(Sender: TObject);
begin
if t_op_bill.State in [dsedit,dsinsert] then
t_op_bill.Post;
end;
procedure Tfrm_op_seae_teshushenhe.bsSkinButton7Click(Sender: TObject);
begin
if t_op_bill.IsEmpty then
exit;
t_op_bill.Cancel;
end;
procedure Tfrm_op_seae_teshushenhe.bsSkinButton8Click(Sender: TObject);
begin
Close;
end;
procedure Tfrm_op_seae_teshushenhe.bsSkinButton5Click(Sender: TObject);
begin
if t_op_bill.IsEmpty then
exit;
if t_op_bill.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
begin
showmessage('<27><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>');
Exit;
end
else
begin
t_op_bill.edit;
t_op_bill['״̬']:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_op_bill['ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=Now;
t_op_bill['ǩ<><C7A9><EFBFBD><EFBFBD>']:=employee;
t_op_bill.post;
UpdateBillStatus('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
with t_op_seaesel do
begin
First;
while not eof do
begin
InsertSeaeStatus(FieldByName('<27><><EFBFBD><EFBFBD>').AsString,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',employee,FormatDateTime('YYYY-MM-DD',Now));
Next;
end;
end;
t_op_bill.Refresh;
end;
end;
procedure Tfrm_op_seae_teshushenhe.bsSkinButton9Click(Sender: TObject);
var str:string;
begin
if t_op_bill.IsEmpty then
exit;
if t_op_bill.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
begin
showmessage('û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
Exit;
end
else
if (not t_op_bill.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull) and t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
begin
t_op_bill.edit;
t_op_bill.FieldByName('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>ԭ<EFBFBD><D4AD>').AsString:=t_op_bill.FieldByName('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>ԭ<EFBFBD><D4AD>').AsString+#13#10+employee+' '+FormatDateTime('YYYY-MM-DD hh:ss',Now);
t_op_bill['״̬']:='<27>½<EFBFBD>ǩ<EFBFBD><C7A9>';
t_op_bill['ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
t_op_bill['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
t_op_bill.post;
// UpdateBillStatus('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
with t_op_seaesel do
begin
First;
while not eof do
begin
DelteSeaeStatus(fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Next;
end;
end;
with t_op_seaesel do
begin
First;
while not eof do
begin
DelteSeaeStatus(fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Next;
end;
end;
t_op_bill.Refresh;
end
else
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><CBBA>ſ<EFBFBD><C5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>');
end;
procedure Tfrm_op_seae_teshushenhe.bsSkinButton38Click(Sender: TObject);
begin
t_op_bill.Refresh;
end;
procedure Tfrm_op_seae_teshushenhe.dxDBGrid2Click(Sender: TObject);
begin
bsSkinPageControl1.ActivePageIndex:=1;
end;
procedure Tfrm_op_seae_teshushenhe.N16Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid2);
end;
procedure Tfrm_op_seae_teshushenhe.RxDBLookupCombo8Change(Sender: TObject);
begin
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
begin
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
t_op_bill.Cancel;
end;
end;
procedure Tfrm_op_seae_teshushenhe.RxDBLookupCombo7Change(Sender: TObject);
begin
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
begin
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
t_op_bill.Cancel;
end;
end;
procedure Tfrm_op_seae_teshushenhe.RxDBLookupCombo4Change(Sender: TObject);
begin
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
begin
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
t_op_bill.Cancel;
end;
end;
procedure Tfrm_op_seae_teshushenhe.RxDBLookupCombo2Change(Sender: TObject);
begin
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
begin
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
t_op_bill.Cancel;
end;
end;
procedure Tfrm_op_seae_teshushenhe.RxDBLookupCombo3Change(Sender: TObject);
begin
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
begin
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
t_op_bill.Cancel;
end;
end;
procedure Tfrm_op_seae_teshushenhe.dxDBGrid3DblClick(Sender: TObject);
begin
fee_view(t_op_seaesel.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
procedure Tfrm_op_seae_teshushenhe.bsSkinButton11Click(Sender: TObject);
begin
with t_op_bill do
begin
Close;
sql.Clear;
sql.Add('select * from t_op_bill_fangdan');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :date1 and :date2 and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('order by BILL_ID DESC');
Parameters.ParamByName('date1').Value:=wwDBDateTimePicker6.Date;
Parameters.ParamByName('date2').Value:=wwDBDateTimePicker7.Date;
Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=RxDBLookupCombo1.value;
Open;
end;
end;
end.