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.

568 lines
16 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_seae_teshusales;
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_teshusales = class(TForm)
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;
RxDBLookupCombo4: TRxDBLookupCombo;
Label4: TLabel;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
Label7: TLabel;
Label12: TLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
PopupMenu3: TPopupMenu;
MenuItem2: TMenuItem;
dxDBGrid2Column7: TdxDBGridColumn;
Label13: TLabel;
DBEdit1: TDBEdit;
Label14: TLabel;
bsSkinPanel5: TbsSkinPanel;
Panel1: TPanel;
bsSkinButton11: TbsSkinButton;
Label17: TLabel;
wwDBDateTimePicker6: TwwDBDateTimePicker;
Label18: TLabel;
wwDBDateTimePicker7: TwwDBDateTimePicker;
Label19: TLabel;
Label20: TLabel;
dxDBGrid2Column8: TdxDBGridColumn;
dxDBGrid2Column9: TdxDBGridColumn;
dxDBGrid3Column12: TdxDBGridColumn;
dxDBGrid3Column13: TdxDBGridColumn;
dxDBGrid3Column14: TdxDBGridColumn;
dxDBGrid3Column15: TdxDBGridColumn;
Label21: TLabel;
Label22: TLabel;
RxDBLookupCombo5: TRxDBLookupCombo;
wwDBDateTimePicker8: TwwDBDateTimePicker;
Label23: TLabel;
Label24: TLabel;
RxDBLookupCombo7: TRxDBLookupCombo;
wwDBDateTimePicker9: TwwDBDateTimePicker;
Label15: TLabel;
DBEdit2: TDBEdit;
Label25: TLabel;
DBEdit3: TDBEdit;
Label26: TLabel;
RxDBLookupCombo8: TRxDBLookupCombo;
dxDBGrid2Column10: TdxDBGridColumn;
dxDBGrid2Column11: TdxDBGridColumn;
Label27: TLabel;
dxDBGrid2Column12: TdxDBGridColumn;
bsSkinButton38: TbsSkinButton;
dxDBGrid2Column13: TdxDBGridColumn;
dxDBGrid2Column14: TdxDBGridColumn;
dxDBGrid2Column15: TdxDBGridColumn;
Label1: TLabel;
DBMemo1: TDBMemo;
Label29: TLabel;
DBMemo2: TDBMemo;
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
Label2: TLabel;
RxDBLookupCombo31: TRxDBLookupCombo;
dxDBGrid2Column16: TdxDBGridColumn;
bsSkinButton12: TbsSkinButton;
t_op_bill_items1: TDataSource;
t_op_bill_items: TADOQuery;
bsSkinTabSheet3: TbsSkinTabSheet;
dxDBGrid4: TdxDBGrid;
dxDBGrid4Column1: TdxDBGridColumn;
dxDBGrid4Column2: TdxDBGridColumn;
dxDBGrid4Column3: TdxDBGridColumn;
dxDBGrid4Column4: TdxDBGridColumn;
wwDBDateTimePicker10: TwwDBDateTimePicker;
Label32: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
RxDBLookupCombo2: TRxDBLookupCombo;
RxDBLookupCombo3: TRxDBLookupCombo;
Label35: TLabel;
dxDBGrid2Column17: TdxDBGridColumn;
Label36: TLabel;
DBMemo3: TDBMemo;
dxDBGrid2Column18: TdxDBGridColumn;
dxDBGrid2Column19: TdxDBGridColumn;
Label37: TLabel;
DBEdit4: TDBEdit;
Label38: TLabel;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label42: TLabel;
DBEdit11: TDBEdit;
DBEdit12: TDBEdit;
Label43: TLabel;
DBEdit13: TDBEdit;
DBEdit14: TDBEdit;
Label44: TLabel;
Label45: TLabel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton5Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton38Click(Sender: TObject);
procedure dxDBGrid2Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure t_op_billBeforeEdit(DataSet: TDataSet);
procedure bsSkinButton12Click(Sender: TObject);
procedure t_op_billBeforePost(DataSet: TDataSet);
procedure RxDBLookupCombo1Enter(Sender: TObject);
procedure RxDBLookupCombo1Exit(Sender: TObject);
procedure dxDBGrid2CustomDraw(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
AFocused: Boolean; var ADone: Boolean);
private
{ Private declarations }
public
{ Public declarations }
function UpdateBillStatus(bsStStatus:string):Boolean;
end;
var
frm_op_seae_teshusales: Tfrm_op_seae_teshusales;
implementation
uses my_sys_function, u_main;
{$R *.dfm}
function Tfrm_op_seae_teshusales.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_teshusales.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_op_seae_teshusales.Hide;
frm_op_seae_teshusales.ManualFloat(frm_op_seae_teshusales.BoundsRect );
frm_main.freeTabs('frm_op_seae_teshusales');
action:=cafree;
frm_op_seae_teshusales:=nil;
end;
procedure Tfrm_op_seae_teshusales.bsSkinButton5Click(Sender: TObject);
var
aQuery:TADOQuery;
begin
if t_op_bill.IsEmpty then
exit;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;SQL.Clear;
sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_op_bill.FieldByName('ί<>е<EFBFBD>λ').AsString+'''');
open;
if not IsEmpty then begin
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>').AsString='<27><>' then begin
if MessageDlg(t_op_bill.FieldByName('ί<>е<EFBFBD>λ').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>Ϊ:'+fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>').AsString+#13#10+'ȷʵҪ<CAB5>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
begin
exit;
end;
end;
end;
end;
finally
FreeAndNil(aQuery);
end;
if not t_op_bill.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
begin
showmessage('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
end
else
begin
if trim(t_op_bill.FieldByName('<27><>ע').asstring)='' then
begin
showmessage('<27>ط<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
exit;
end;
if Length(trim(t_op_bill.FieldByName('<27><>ע').asstring))<12 then
begin
showmessage('<27>ط<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
exit;
end;
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD>').AsDateTime-now>20 then
begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>ڲ<EFBFBD><DAB2>ܳ<EFBFBD><DCB3><EFBFBD>20<32>죡');
exit;
end;
if (t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger=1) and (trim(t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>').asstring)='') then
begin
ShowMessage('<27>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΥԼ,<2C><>ҪΥԼ<CEA5><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дΥԼ<CEA5><D4BC>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>');
exit;
end;
t_op_bill.edit;
t_op_bill['״̬']:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_op_bill['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_bill['ҵ<><D2B5><EFBFBD><EFBFBD><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_teshusales.FormShow(Sender: TObject);
begin
t_op_bill.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=employee;
t_op_bill.Open;
t_op_seaesel.Open;
t_op_bill_items.Open;
ADOQuery1.Open;
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger=1 then
begin
Label35.Visible:=True;
Label35.Caption:='<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end
else
begin
label35.Visible:=false;
Label35.Caption:='';
end;
end;
procedure Tfrm_op_seae_teshusales.bsSkinButton9Click(Sender: TObject);
var str:string;
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('û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
end
else
if (not t_op_bill.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull) and t_op_bill.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
begin
t_op_bill.edit;
t_op_bill['״̬']:='<27>½<EFBFBD>ǩ<EFBFBD><C7A9>';
t_op_bill['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
t_op_bill.post;
UpdateBillStatus('<27><><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;
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_teshusales.bsSkinButton7Click(Sender: TObject);
begin
if t_op_bill.IsEmpty then
exit;
t_op_bill.Cancel;
end;
procedure Tfrm_op_seae_teshusales.bsSkinButton8Click(Sender: TObject);
begin
Close;
end;
procedure Tfrm_op_seae_teshusales.bsSkinButton38Click(Sender: TObject);
begin
t_op_bill.Refresh;
end;
procedure Tfrm_op_seae_teshusales.dxDBGrid2Click(Sender: TObject);
begin
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger=1 then
begin
Label35.Visible:=True;
Label35.Caption:='<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end
else
begin
label35.Visible:=false;
Label35.Caption:='';
end;
bsSkinPageControl1.ActivePageIndex:=1;
end;
procedure Tfrm_op_seae_teshusales.N16Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid2);
end;
procedure Tfrm_op_seae_teshusales.t_op_billBeforeEdit(DataSet: TDataSet);
begin
if (t_op_bill.FieldByName('״̬').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') or (t_op_bill.FieldByName('״̬').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
begin
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
abort;
end;
end;
procedure Tfrm_op_seae_teshusales.bsSkinButton12Click(Sender: TObject);
var aDate:TDateTime;
aAdoQuery:TAdoQuery;
AccoutDesc:string;
begin
if t_op_bill.FieldByName('״̬').AsString='<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
begin
t_op_bill_items.First;
while not t_op_bill_items.Eof do
begin
t_op_bill_items.Delete;
end;
aDate:=returngetzqdate(t_op_bill.FieldByName('ί<>е<EFBFBD>λ').Asstring,Date);
AccoutDesc:=getzq(t_op_bill.FieldByName('ί<>е<EFBFBD>λ').Asstring);
//ShowMessage(datetostr(aDate));
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('select ');
sql.Add('SUBSTRING(CONVERT(char(15),<2C><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,111),1,7) Ƿ<><C7B7><EFBFBD>·<EFBFBD>');
sql.Add(',sum(Ӧ<><D3A6>RMB-<2D><><EFBFBD><EFBFBD>RMB) AMTRMB,sum(Ӧ<><D3A6>USD-<2D><><EFBFBD><EFBFBD>USD) AMTUSD');
sql.Add('from v_op_bscard ');
sql.Add('where ί<>е<EFBFBD>λ=:ί<>е<EFBFBD>λ and <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6><><3E>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><:aDate');
sql.Add('Group by SUBSTRING(CONVERT(char(15),<2C><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,111),1,7)');
Parameters.ParamByName('ί<>е<EFBFBD>λ').Value:=t_op_bill.FieldByName('ί<>е<EFBFBD>λ').Asstring;
Parameters.ParamByName('aDate').Value:=aDate;
Open;First;
while not eof do
begin
t_op_bill_items.Insert;
t_op_bill_items.FieldByName('BILL_ID').AsInteger:=t_op_bill.FieldByName('BILL_ID').AsInteger;
t_op_bill_items.FieldByName('Ƿ<><C7B7><EFBFBD>·<EFBFBD>').AsString:=FieldByName('Ƿ<><C7B7><EFBFBD>·<EFBFBD>').Asstring;
t_op_bill_items.FieldByName('AMTRMB').AsFloat:=FieldByName('AMTRMB').AsFloat;
t_op_bill_items.FieldByName('AMTUSD').AsFloat:=FieldByName('AMTUSD').AsFloat;
t_op_bill_items.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=AccoutDesc;
t_op_bill_items.post;
Next;
end;
finally
Free;
end;
end;
sys_print('<27>طű<D8B7><C5B1><EFBFBD>',2,ds_op_bill1,nil,nil,nil, ds_op_seaesel1,nil,nil,nil,ds_op_bill1,t_op_bill_items1,nil);
end;
procedure Tfrm_op_seae_teshusales.t_op_billBeforePost(DataSet: TDataSet);
begin
table_before_post(t_op_bill,'<27>طŷ<D8B7><C5B7><EFBFBD>');
table_before_post(t_op_bill,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD>');
if trim(t_op_bill.FieldByName('<27><>ע').asstring)='' then
begin
showmessage('<27>ط<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
abort;
end;
if Length(trim(t_op_bill.FieldByName('<27><>ע').asstring))<12 then
begin
showmessage('<27>ط<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
abort;
end;
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD>').AsDateTime-now>20 then
begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>ڲ<EFBFBD><DAB2>ܳ<EFBFBD><DCB3><EFBFBD>20<32>죡');
abort;
end;
if (t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger=1) and (trim(t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>').asstring)='') then
begin
ShowMessage('<27>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΥԼ,<2C><>ҪΥԼ<CEA5><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дΥԼ<CEA5><D4BC>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>');
abort;
end;
{
if (t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>').AsInteger=0) and (t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>طŵ<D8B7><C5B5><EFBFBD>').AsInteger=0) then begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5>Ų<EFBFBD><C5B2><EFBFBD>Ϊ0<CEAA><30>');
abort;
end;
}
end;
procedure Tfrm_op_seae_teshusales.RxDBLookupCombo1Enter(Sender: TObject);
begin
TRxDBLookupCombo(Sender).LookupDisplay:='<27><><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD>';
end;
procedure Tfrm_op_seae_teshusales.RxDBLookupCombo1Exit(Sender: TObject);
begin
TRxDBLookupCombo(Sender).LookupDisplay:='<27><><EFBFBD><EFBFBD>';
end;
procedure Tfrm_op_seae_teshusales.dxDBGrid2CustomDraw(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
var
sValues : string;
begin
if not VarIsNull(ANode.Values[dxDBGrid2Column19.Index]) then
begin
sValues :=ANode.Values[dxDBGrid2Column19.Index];
if StrToIntDef(sValues,0) = 1 then afont.Color:=$00C080FF;
end;
if not VarIsNull(ANode.Values[dxDBGrid2Column18.Index]) then
begin
sValues :=ANode.Values[dxDBGrid2Column18.Index];
if StrToIntDef(sValues,0) = 1 then afont.Color:=clred;
end;
end;
end.