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.

358 lines
9.6 KiB
Plaintext

11 months ago
unit u_ch_fee_truck;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, ExtCtrls, Grids, Wwdbigrd, Wwdbgrid, bsSkinCtrls,
StdCtrls, wwdblook, BusinessSkinForm;
type
Tfrm_ch_fee_truck = class(TForm)
t_ch_fee_truck: TADOQuery;
t_ch_fee_truck1: TDataSource;
Panel1: TPanel;
wwDBGrid1: TwwDBGrid;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
wwDBLookupCombo1: TwwDBLookupCombo;
wwDBLookupCombo2: TwwDBLookupCombo;
wwDBLookupCombo3: TwwDBLookupCombo;
wwDBLookupCombo4: TwwDBLookupCombo;
wwDBLookupCombo5: TwwDBLookupCombo;
bsSkinButton5: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsBusinessSkinForm1: TbsBusinessSkinForm;
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure t_ch_fee_truckAfterInsert(DataSet: TDataSet);
procedure t_ch_fee_truckBeforePost(DataSet: TDataSet);
procedure wwDBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure t_ch_fee_truckBeforeEdit(DataSet: TDataSet);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_fee_truck: Tfrm_ch_fee_truck;
implementation
uses u_op_seae, u_main, my_sys_function, u_data_share;
{$R *.dfm}
procedure Tfrm_ch_fee_truck.bsSkinButton1Click(Sender: TObject);
begin
t_ch_fee_truck.insert;
end;
procedure Tfrm_ch_fee_truck.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_ch_fee_truck);
end;
procedure Tfrm_ch_fee_truck.bsSkinButton4Click(Sender: TObject);
begin
table_delete(t_ch_fee_truck);
end;
procedure Tfrm_ch_fee_truck.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_ch_fee_truck);
end;
procedure Tfrm_ch_fee_truck.t_ch_fee_truckAfterInsert(DataSet: TDataSet);
begin
t_ch_fee_truck['<27>շѽ<D5B7><D1BD><EFBFBD>']:=0;
t_ch_fee_truck['<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>']:=0;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>']:=0;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:='¼<><C2BC>״̬';
t_ch_fee_truck['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_ch_fee_truck['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
end;
procedure Tfrm_ch_fee_truck.t_ch_fee_truckBeforePost(DataSet: TDataSet);
begin
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:=t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬'];
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_truck['<27>շѽ<D5B7><D1BD><EFBFBD>']-t_ch_fee_truck['<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>'];
end;
procedure Tfrm_ch_fee_truck.wwDBGrid1DrawDataCell(Sender: TObject;
const Rect: TRect; Field: TField; State: TGridDrawState);
begin
fee_color(t_ch_fee_truck,wwDBGrid1,Rect,Field);
end;
procedure Tfrm_ch_fee_truck.bsSkinButton11Click(Sender: TObject);
var
i:integer;
begin
if t_ch_fee_truck.isempty then
exit;
if (t_ch_fee_truck.State=dsinsert)
or (t_ch_fee_truck.State=dsedit) then
begin
t_ch_fee_truck.post;
end;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_ch_fee_truck.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
if (t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'¼<><C2BC>״̬') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD>ύ') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>׼<EFBFBD>޸<EFBFBD>') then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1BDBB><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
exit;
end;
end;
end
else
begin
if (t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'¼<><C2BC>״̬') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD>ύ') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>׼<EFBFBD>޸<EFBFBD>') then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1BDBB><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
exit;
end;
end;
try
frm_main.db.BeginTrans;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_ch_fee_truck.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
t_ch_fee_truck.edit;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:='<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>';
t_ch_fee_truck.post;
end;
end
else
begin
t_ch_fee_truck.edit;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:='<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>';
t_ch_fee_truck.post;
end;
frm_main.db.CommitTrans;
except
frm_main.db.RollbackTrans;
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
exit;
end;
end;
procedure Tfrm_ch_fee_truck.bsSkinButton6Click(Sender: TObject);
var
i:integer;
begin
if t_ch_fee_truck.isempty then
exit;
if (t_ch_fee_truck.State=dsinsert)
or (t_ch_fee_truck.State=dsedit) then
begin
t_ch_fee_truck.post;
end;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_ch_fee_truck.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
if (t_ch_fee_truck.FieldByName('<27>շѽ<D5B7><D1BD><EFBFBD>').asfloat<>0) and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>').asfloat<>0) then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><E3B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
exit;
end;
if (t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹ<EFBFBD>޸<EFBFBD>') then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
exit;
end;
end;
end
else
begin
if (t_ch_fee_truck.FieldByName('<27>շѽ<D5B7><D1BD><EFBFBD>').asfloat<>0) and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>').asfloat<>0) then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><E3B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
exit;
end;
if (t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹ<EFBFBD>޸<EFBFBD>') then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
exit;
end;
end;
try
frm_main.db.BeginTrans;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_ch_fee_truck.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
t_ch_fee_truck.edit;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:='<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>';
t_ch_fee_truck.post;
end;
end
else
begin
t_ch_fee_truck.edit;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:='<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>';
t_ch_fee_truck.post;
end;
frm_main.db.CommitTrans;
except
frm_main.db.RollbackTrans;
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>ʧ<EFBFBD><CAA7>!');
exit;
end;
end;
procedure Tfrm_ch_fee_truck.bsSkinButton8Click(Sender: TObject);
var
i:integer;
begin
if t_ch_fee_truck.isempty then
exit;
if (t_ch_fee_truck.State=dsinsert)
or (t_ch_fee_truck.State=dsedit) then
begin
t_ch_fee_truck.post;
end;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_ch_fee_truck.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
if (t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>') then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
exit;
end;
end;
end
else
begin
if (t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>') then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
exit;
end;
end;
try
frm_main.db.BeginTrans;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_ch_fee_truck.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
t_ch_fee_truck.edit;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>';
t_ch_fee_truck.post;
end;
end
else
begin
t_ch_fee_truck.edit;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>';
t_ch_fee_truck.post;
end;
frm_main.db.CommitTrans;
except
frm_main.db.RollbackTrans;
showmessage('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>ʧ<EFBFBD><CAA7>!');
exit;
end;
end;
procedure Tfrm_ch_fee_truck.t_ch_fee_truckBeforeEdit(DataSet: TDataSet);
begin
if not modify_all then
begin
if t_ch_fee_truck.IsEmpty then
exit;
if (t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'¼<><C2BC>״̬') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD>ύ') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>') and
(t_ch_fee_truck.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>׼<EFBFBD>޸<EFBFBD>') then
begin
showmessage('<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>ܽ<EFBFBD><DCBD>и<EFBFBD><D0B8>ģ<EFBFBD><C4A3><EFBFBD>');
abort;
end
end;
end;
procedure Tfrm_ch_fee_truck.FormShow(Sender: TObject);
begin
t_ch_fee_truck.open;
end;
procedure Tfrm_ch_fee_truck.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
t_ch_fee_truck.close;
end;
procedure Tfrm_ch_fee_truck.bsSkinButton5Click(Sender: TObject);
var
afield : variant;
i: Integer;
begin
if t_ch_fee_truck.IsEmpty then
exit;
afield := vararraycreate([0,t_ch_fee_truck.fieldcount-1],varvariant);
for i := 0 to (t_ch_fee_truck.fieldcount-1) do
begin
afield[i] :=t_ch_fee_truck.fields[i].value ;
end;
t_ch_fee_truck.append;
for i :=0 to (t_ch_fee_truck.fieldcount-1) do
begin
if t_ch_fee_truck.fields[i].FieldName<>'TF_ID' then
t_ch_fee_truck.fields[i].value := afield[i] ;
end;
t_ch_fee_truck['<27><><EFBFBD><EFBFBD>״̬']:='¼<><C2BC>״̬';
t_ch_fee_truck['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_ch_fee_truck['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
t_ch_fee_truck['<27>շѽ<D5B7><D1BD><EFBFBD>']:=0;
t_ch_fee_truck['<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>']:=0;
end;
procedure Tfrm_ch_fee_truck.bsSkinButton7Click(Sender: TObject);
begin
close;
end;
end.