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.

402 lines
12 KiB
Plaintext

unit u_special_price_qus;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ExtCtrls, DB, ADODB, dxExEdtr, dxDBTLCl, dxGrClms,
dxTL, dxDBCtrl, dxDBGrid, dxCntner, StdCtrls, RxLookup,
wwdbdatetimepicker, Mask, DBCtrls;
type
Tfrm_special_price_qus = class(TForm)
qrymaster: TADOQuery;
dsrmaster: TDataSource;
Panel1: TPanel;
bsSkinButton7: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
bsSkinPanel1: TbsSkinPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
DBMemo1: TDBMemo;
DBMemo2: TDBMemo;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBMemo3: TDBMemo;
DBEdit6: TDBEdit;
RxDBLookupCombo3: TRxDBLookupCombo;
RxDBLookupCombo4: TRxDBLookupCombo;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Label15: TLabel;
Label16: TLabel;
DBEdit7: TDBEdit;
RxDBLookupCombo5: TRxDBLookupCombo;
dxDBGrid2: TdxDBGrid;
RxDBLookupCombo2: TRxDBLookupCombo;
bsSkinButton3: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
Label17: TLabel;
wwDBDateTimePicker3: TwwDBDateTimePicker;
dxDBGrid2fid: TdxDBGridMaskColumn;
dxDBGrid2Column2: TdxDBGridMaskColumn;
dxDBGrid2Shipper: TdxDBGridMaskColumn;
dxDBGrid2Column4: TdxDBGridMaskColumn;
dxDBGrid2Column5: TdxDBGridMaskColumn;
dxDBGrid2Column6: TdxDBGridCurrencyColumn;
dxDBGrid2Column7: TdxDBGridCurrencyColumn;
dxDBGrid2Column8: TdxDBGridDateColumn;
dxDBGrid2Column9: TdxDBGridDateColumn;
dxDBGrid2Column10: TdxDBGridMaskColumn;
dxDBGrid2Column11: TdxDBGridMaskColumn;
dxDBGrid2Column12: TdxDBGridMaskColumn;
dxDBGrid2Column13: TdxDBGridMaskColumn;
dxDBGrid2Column14: TdxDBGridMaskColumn;
dxDBGrid2Column15: TdxDBGridDateColumn;
dxDBGrid2Column16: TdxDBGridMaskColumn;
dxDBGrid2Column17: TdxDBGridMaskColumn;
dxDBGrid2Column18: TdxDBGridMaskColumn;
dxDBGrid2Column19: TdxDBGridButtonColumn;
procedure bsSkinButton9Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure Label2Click(Sender: TObject);
procedure DBEdit7Change(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure dxDBGrid2Column18CustomDrawCell(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxTreeListColumn; ASelected, AFocused,
ANewItemRow: Boolean; var AText: String; var AColor: TColor;
AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
procedure qrymasterNewRecord(DataSet: TDataSet);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure dxDBGrid2Column19EditButtonClick(Sender: TObject);
procedure RxDBLookupCombo5KeyPress(Sender: TObject; var Key: Char);
procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit3KeyPress(Sender: TObject; var Key: Char);
procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit4KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit5KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit6KeyPress(Sender: TObject; var Key: Char);
procedure RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
procedure getlen;
public
{ Public declarations }
end;
var
frm_special_price_qus: Tfrm_special_price_qus;
implementation
{$R *.dfm}
uses u_main,my_sys_function,u_data_share,{$IFDEF KHGUANLI}u_rp_crm_credit,{$ENDIF}u_special_query;
procedure Tfrm_special_price_qus.bsSkinButton9Click(Sender: TObject);
begin
close ;
end;
procedure Tfrm_special_price_qus.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose:=frm_close_query(qrymaster);
end;
procedure Tfrm_special_price_qus.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_special_price_qus.Hide;
frm_special_price_qus.ManualFloat(frm_special_price_qus.BoundsRect );
frm_main.freeTabs('frm_special_price_qus');
action:=cafree;
frm_special_price_qus:=nil;
end;
procedure Tfrm_special_price_qus.FormShow(Sender: TObject);
var showchk:boolean ;
begin
qrymaster.Open ;
showchk:=if_open('258');
bsSkinButton3.enabled:=showchk ;
bsSkinButton12.enabled:=showchk ;
if (if_open('257')) and showchk then
dxDBGrid2Column19.Visible:=true
else dxDBGrid2Column19.Visible:=False ;
end;
procedure Tfrm_special_price_qus.bsSkinButton2Click(Sender: TObject);
begin
RxDBLookupCombo5.SetFocus ;
qrymaster.Append ;
end;
procedure Tfrm_special_price_qus.Label2Click(Sender: TObject);
begin
// open_code_edit('097');
// client_view(qrymaster.fieldbyname('shipper<65><72><EFBFBD><EFBFBD>').asstring,frm_data_share.t_crm_client_ship);
end;
procedure Tfrm_special_price_qus.DBEdit7Change(Sender: TObject);
var canmodify:boolean ;
i:integer ;
begin
canmodify:=DBEdit7.text='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' ;
with bsSkinPanel1 do
for i:=0 to ControlCount-1 do
if Controls[i] is TRxDBLookupCombo then (Controls[i] as TRxDBLookupCombo).ReadOnly :=canmodify
else if Controls[i] is TwwDBDateTimePicker then (Controls[i] as TwwDBDateTimePicker).ReadOnly :=canmodify
else if Controls[i] is TDBMemo then (Controls[i] as TDBMemo).ReadOnly :=canmodify
else if Controls[i] is TDBEdit then (Controls[i] as TDBedit).ReadOnly :=canmodify ;
RxDBLookupCombo4.ReadOnly:=true ;
wwDBDateTimePicker3.ReadOnly:=true ;
DBEdit7.ReadOnly:=true ;
end;
procedure Tfrm_special_price_qus.bsSkinButton10Click(Sender: TObject);
begin
qrymaster.edit ;
end;
procedure Tfrm_special_price_qus.bsSkinButton11Click(Sender: TObject);
begin
table_post(qrymaster) ;
end;
procedure Tfrm_special_price_qus.bsSkinButton4Click(Sender: TObject);
begin
if DBEdit7.text='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then
begin
showmessage('<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>,<2C><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>');
exit ;
end ;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)=IDOK then
qrymaster.delete;
end;
procedure Tfrm_special_price_qus.bsSkinButton8Click(Sender: TObject);
begin
qrymaster.Cancel ;
end;
procedure Tfrm_special_price_qus.bsSkinButton5Click(Sender: TObject);
begin
sys_print('<27>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD>뵥',2,nil,nil,nil,nil,dsrmaster,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_special_price_qus.bsSkinButton7Click(Sender: TObject);
begin
qrymaster.Prior ;
end;
procedure Tfrm_special_price_qus.bsSkinButton6Click(Sender: TObject);
begin
qrymaster.Next ;
end;
procedure Tfrm_special_price_qus.dxDBGrid2Column18CustomDrawCell(
Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean;
var AText: String; var AColor: TColor; AFont: TFont;
var AAlignment: TAlignment; var ADone: Boolean);
begin
if AText ='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then AColor:=clskyblue
else Acolor:=clwhite ;
end;
procedure Tfrm_special_price_qus.qrymasterNewRecord(DataSet: TDataSet);
begin
with qrymaster do
begin
fieldbyname('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>').asdatetime:=date ;
fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=employee ;
fieldbyname('<27><><EFBFBD><EFBFBD>').asstring:=employee ;
fieldbyname('<27><><EFBFBD><EFBFBD>״̬').asstring:='¼<><C2BC>״̬' ;
end ;
end;
procedure Tfrm_special_price_qus.bsSkinButton3Click(Sender: TObject);
begin
if not if_open('258') then
begin
showmessage('<27><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>!');
exit ;
end ;
if qrymaster.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then
begin
qrymaster.edit ;
qrymaster.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' ;
qrymaster.FieldByName('<27><><EFBFBD><EFBFBD>').asstring:=employee ;
qrymaster.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=date ;
qrymaster.post ;
end ;
end;
procedure Tfrm_special_price_qus.bsSkinButton12Click(Sender: TObject);
begin
if not if_open('258') then
begin
showmessage('<27><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>!');
exit ;
end ;
if qrymaster.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then
begin
qrymaster.edit ;
qrymaster.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString:='<27><><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>' ;
qrymaster.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:='' ;
qrymaster.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=date ;
qrymaster.post ;
end ;
end;
procedure Tfrm_special_price_qus.bsSkinButton1Click(Sender: TObject);
begin
frm_special_query:=Tfrm_special_query.create(self);
if frm_special_query.showmodal=mrok then
begin
with qrymaster,sql do
begin
close ;clear;
add('select * from t_info_special_price ');
add(frm_special_query.str_special);
open ;
end ;
end ;
frm_special_query.free ;
end;
procedure Tfrm_special_price_qus.getlen;
var i,cnt,mylen:integer ;
begin
cnt:=0 ;
with panel1 do
for i:=0 to ControlCount-1 do
if (Controls[i] as TbsSkinButton).Visible then cnt:=cnt+1 ;
mylen:=round((Width-10)/cnt) ;
with panel1 do
for i:=0 to ControlCount-1 do
if (Controls[i] is TbsSkinButton) and (Controls[i].Visible=true)
then (Controls[i] as TbsSkinButton).width :=mylen ;
end;
procedure Tfrm_special_price_qus.dxDBGrid2Column19EditButtonClick(
Sender: TObject);
var
y,m,d:word;
begin
{$IFDEF KHGUANLI}
if not if_open('257') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
exit;
end;
if not assigned(frm_crm_credit) then
frm_crm_credit:=tfrm_crm_credit.Create (self);
ShowPrice:=true ;
frm_crm_credit.ManualDock(frm_main.SearchTabs('frm_crm_credit',frm_crm_credit.caption),nil,alClient);
// frm_crm_credit.show;
if wwDBDateTimePicker2.Text<>'' then
decodedate(wwDBDateTimePicker2.Date,y,m,d) else decodedate(date,y,m,d) ;
frm_crm_credit.showcrm(y, m, RxDBLookupCombo5.Value);
{$ENDIF}
end;
procedure Tfrm_special_price_qus.RxDBLookupCombo5KeyPress(Sender: TObject;
var Key: Char);
begin
key_wwDBDateTimePicker(Key,wwDBDateTimePicker2);
end;
procedure Tfrm_special_price_qus.wwDBDateTimePicker2KeyPress(
Sender: TObject; var Key: Char);
begin
key_DBMemo(key,dbmemo1) ;
end;
procedure Tfrm_special_price_qus.DBEdit1KeyPress(Sender: TObject;
var Key: Char);
begin
key_dbedit(key,dbedit2);
end;
procedure Tfrm_special_price_qus.DBEdit2KeyPress(Sender: TObject;
var Key: Char);
begin
key_dbedit(key,dbedit3);
end;
procedure Tfrm_special_price_qus.DBEdit3KeyPress(Sender: TObject;
var Key: Char);
begin
key_wwDBDateTimePicker(Key,wwDBDateTimePicker1);
end;
procedure Tfrm_special_price_qus.wwDBDateTimePicker1KeyPress(
Sender: TObject; var Key: Char);
begin
key_dbedit(key,dbedit4);
end;
procedure Tfrm_special_price_qus.DBEdit4KeyPress(Sender: TObject;
var Key: Char);
begin
key_dbedit(key,dbedit5);
end;
procedure Tfrm_special_price_qus.DBEdit5KeyPress(Sender: TObject;
var Key: Char);
begin
key_DBMemo(key,dbmemo3) ;
end;
procedure Tfrm_special_price_qus.DBEdit6KeyPress(Sender: TObject;
var Key: Char);
begin
key_RxDBLookupCombo(Key,RxDBLookupCombo3);
end;
procedure Tfrm_special_price_qus.RxDBLookupCombo3KeyPress(Sender: TObject;
var Key: Char);
begin
key_RxDBLookupCombo(Key,RxDBLookupCombo2);
end;
end.