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.

354 lines
8.3 KiB
Plaintext

unit u_op_card;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DB, ADODB, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid,
dxDBTLCl, dxGrClms, XPMenu, Menus, Grids, Wwdbigrd, Wwdbgrid, StdCtrls,
wwdblook;
type
Tfra_op_card = class(TFrame)
bsSkinGroupBox1: TbsSkinGroupBox;
t_op_card: TADOQuery;
t_op_card1: TDataSource;
XPMenu1: TXPMenu;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N17: TMenuItem;
N18: TMenuItem;
N19: TMenuItem;
N20: TMenuItem;
N21: TMenuItem;
N22: TMenuItem;
N23: TMenuItem;
N24: TMenuItem;
N25: TMenuItem;
N26: TMenuItem;
N27: TMenuItem;
N28: TMenuItem;
wwDBGrid1: TwwDBGrid;
wwDBLookupCombo2: TwwDBLookupCombo;
wwDBLookupCombo1: TwwDBLookupCombo;
wwDBLookupCombo3: TwwDBLookupCombo;
procedure t_op_cardAfterInsert(DataSet: TDataSet);
procedure t_op_cardBeforePost(DataSet: TDataSet);
procedure N1Click(Sender: TObject);
procedure dxDBGrid1Column1ButtonClick(Sender: TObject;
AbsoluteIndex: Integer);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N15Click(Sender: TObject);
procedure N19Click(Sender: TObject);
procedure N24Click(Sender: TObject);
procedure N21Click(Sender: TObject);
procedure N26Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure N23Click(Sender: TObject);
procedure N28Click(Sender: TObject);
procedure t_op_cardBeforeInsert(DataSet: TDataSet);
procedure FrameEnter(Sender: TObject);
private
procedure t_op_carddjoncharge(Sender: TField);
procedure t_op_cardhmoncharge(Sender: TField);
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses u_main, my_sys_function, u_op_card_add, u_data_share;
{$R *.dfm}
procedure Tfra_op_card.t_op_cardAfterInsert(DataSet: TDataSet);
begin
t_op_card['<27><><EFBFBD><EFBFBD>']:=t_op_card.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=0;
t_op_card['<27>Ƿ񻹵<C7B7>']:=0;
end;
procedure Tfra_op_card.t_op_cardBeforePost(DataSet: TDataSet);
begin
table_before_post(t_op_card,'<27><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>');
end;
procedure Tfra_op_card.N1Click(Sender: TObject);
begin
if t_op_card.DataSource.DataSet=nil then
exit;
if t_op_card.DataSource.DataSet.state=dsinsert then
t_op_card.DataSource.DataSet.post;
try
frm_op_card_add:=tfrm_op_card_add.Create (self);
frm_op_card_add.bsSkinCheckRadioBox2.Checked:=true;
frm_op_card_add.DataSource1.Enabled:=false;
frm_op_card_add.DataSource1.DataSet:=t_op_card;
frm_op_card_add.DataSource1.Enabled:=true;
frm_op_card_add.ShowModal;
finally
frm_op_card_add.Free;
frm_op_card_add:=nil;
end;
end;
procedure Tfra_op_card.dxDBGrid1Column1ButtonClick(Sender: TObject;
AbsoluteIndex: Integer);
begin
try
frm_op_card_add:=tfrm_op_card_add.Create (self);
frm_op_card_add.bsSkinCheckRadioBox1.Checked:=true;
frm_op_card_add.DataSource1.DataSet:=t_op_card;
frm_op_card_add.ShowModal;
finally
frm_op_card_add.Free;
frm_op_card_add:=nil;
end;
end;
procedure Tfra_op_card.N3Click(Sender: TObject);
begin
table_post(t_op_card);
end;
procedure Tfra_op_card.N4Click(Sender: TObject);
var
i:integer;
begin
if t_op_card.isempty then
exit;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)<>IDOK then
exit;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_op_card.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
t_op_card.delete;
end;
end
else
begin
t_op_card.delete;
end;
end;
procedure Tfra_op_card.N7Click(Sender: TObject);
begin
table_cancel(t_op_card);
end;
procedure Tfra_op_card.N14Click(Sender: TObject);
begin
if t_op_card.isempty then
exit;
t_op_card.Edit;
t_op_card['<27>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
procedure Tfra_op_card.N15Click(Sender: TObject);
var
i:integer;
begin
if t_op_card.isempty then
exit;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_op_card.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
t_op_card.Edit;
t_op_card['<27>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
end
else
begin
t_op_card.Edit;
t_op_card['<27>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
end;
procedure Tfra_op_card.N19Click(Sender: TObject);
begin
if t_op_card.isempty then
exit;
t_op_card.Edit;
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=1;
t_op_card['<27>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
procedure Tfra_op_card.N24Click(Sender: TObject);
begin
if t_op_card.isempty then
exit;
t_op_card.Edit;
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=1;
t_op_card['<27>Ƿ񻹵<C7B7>']:=1;
t_op_card['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
procedure Tfra_op_card.N21Click(Sender: TObject);
var
i:integer;
begin
if t_op_card.isempty then
exit;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_op_card.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
t_op_card.Edit;
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=1;
t_op_card['<27>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
end
else
begin
t_op_card.Edit;
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=1;
t_op_card['<27>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
end;
procedure Tfra_op_card.N26Click(Sender: TObject);
var
i:integer;
begin
if t_op_card.isempty then
exit;
if wwDBGrid1.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
begin
t_op_card.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
t_op_card.Edit;
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=1;
t_op_card['<27>Ƿ񻹵<C7B7>']:=1;
t_op_card['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
end
else
begin
t_op_card.Edit;
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=1;
t_op_card['<27>Ƿ񻹵<C7B7>']:=1;
t_op_card['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
end;
end;
procedure Tfra_op_card.N16Click(Sender: TObject);
begin
if t_op_card.isempty then
exit;
t_op_card.first;
while not t_op_card.eof do
begin
t_op_card.Edit;
t_op_card['<27>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
t_op_card.next;
end;
end;
procedure Tfra_op_card.N23Click(Sender: TObject);
begin
if t_op_card.isempty then
exit;
t_op_card.first;
while not t_op_card.eof do
begin
t_op_card.Edit;
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=1;
t_op_card['<27>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
t_op_card.next;
end;
end;
procedure Tfra_op_card.N28Click(Sender: TObject);
begin
if t_op_card.isempty then
exit;
t_op_card.first;
while not t_op_card.eof do
begin
t_op_card.Edit;
t_op_card['<27>Ƿ<EFBFBD><C7B7>ص<EFBFBD>']:=1;
t_op_card['<27>Ƿ񻹵<C7B7>']:=1;
t_op_card['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_card.post;
t_op_card.next;
end;
end;
procedure Tfra_op_card.t_op_cardBeforeInsert(DataSet: TDataSet);
begin
if t_op_card.DataSource.DataSet.State=dsinsert then
t_op_card.DataSource.DataSet.post;
end;
procedure Tfra_op_card.t_op_carddjoncharge(Sender: TField);
begin
if t_op_card.DataSource.DataSet.FindField(Sender.AsString+'<27><>')<>nil then begin
if t_op_card.DataSource.DataSet.Fieldbyname(Sender.AsString+'<27><>').AsString<>'' then begin
t_op_card.Edit;
t_op_card.fieldbyname('<27><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>').AsString:=t_op_card.DataSource.DataSet.Fieldbyname(t_op_card.fieldbyname('<27><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>').AsString+'<27><>').AsString;
t_op_card.Post;
end;
end;
end;
procedure Tfra_op_card.FrameEnter(Sender: TObject);
begin
t_op_card.FieldByName('<27><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>').OnChange:=t_op_carddjoncharge;
t_op_card.FieldByName('<27><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>').OnChange:=t_op_cardhmoncharge;
end;
procedure Tfra_op_card.t_op_cardhmoncharge(Sender: TField);
var
dname,dno:string;
begin
{
dname:=sender.DataSet.fieldbyname('<27><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>').AsString+'<27><>';
dno:=sender.AsString;
if t_op_card.DataSource.DataSet.FindField(dname)<>nil then begin
t_op_card.DataSource.DataSet.Edit;
t_op_card.DataSource.DataSet.Fieldbyname(dname).Value:=dno;
t_op_card.DataSource.DataSet.Post;
end;
}
end;
end.