unit u_op_seae_teshufz;
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, DBCtrlsEh;
type
Tfrm_op_seae_teshufz = 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;
PopupMenu3: TPopupMenu;
MenuItem2: TMenuItem;
dxDBGrid2Column7: TdxDBGridColumn;
bsSkinPanel5: TbsSkinPanel;
Panel1: TPanel;
bsSkinButton11: TbsSkinButton;
Label17: TLabel;
wwDBDateTimePicker6: TwwDBDateTimePicker;
Label18: TLabel;
wwDBDateTimePicker7: TwwDBDateTimePicker;
Label19: TLabel;
bsSkinButton14: TbsSkinButton;
bsSkinButton15: TbsSkinButton;
bsSkinButton16: TbsSkinButton;
Label20: TLabel;
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;
RxDBLookupCombo5: TRxDBLookupCombo;
wwDBDateTimePicker8: TwwDBDateTimePicker;
RxDBLookupCombo7: TRxDBLookupCombo;
wwDBDateTimePicker9: TwwDBDateTimePicker;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
RxDBLookupCombo8: TRxDBLookupCombo;
dxDBGrid2Column10: TdxDBGridColumn;
dxDBGrid2Column11: TdxDBGridColumn;
bsSkinButton38: TbsSkinButton;
Label1: TLabel;
DBMemo1: TDBMemo;
dxDBGrid2Column12: TdxDBGridColumn;
dxDBGrid2Column13: TdxDBGridColumn;
dxDBGrid2Column14: TdxDBGridColumn;
Label29: TLabel;
DBMemo2: TDBMemo;
dxDBGrid2Column15: TdxDBGridColumn;
Label2: TLabel;
DBComboBoxEh2: TDBComboBoxEh;
bsSkinButton2: TbsSkinButton;
RxDBLookupCombo2: TRxDBLookupCombo;
Label3: TLabel;
dxDBGrid3Column16: TdxDBGridColumn;
Label5: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
Label6: TLabel;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Label8: TLabel;
DBComboBoxEh1: TDBComboBoxEh;
dxDBGrid2Column16: TdxDBGridColumn;
dxDBGrid2Column17: TdxDBGridColumn;
dxDBGrid2Column18: TdxDBGridColumn;
ds_crm_client_sales1: TDataSource;
t_crm_client_sales: TADOQuery;
bsSkinGroupBox13: TbsSkinGroupBox;
Label79: TLabel;
Label86: TLabel;
lblmonth: TLabel;
lbldate: TLabel;
Label91: TLabel;
wwDBComboBox14: TwwDBComboBox;
wwDBComboBox15: TwwDBComboBox;
DBEdit61: TDBEdit;
dxDBGrid5: TdxDBGrid;
dxDBGrid5ID: TdxDBGridMaskColumn;
dxDBGrid5Column2: TdxDBGridMaskColumn;
dxDBGrid5Column3: TdxDBGridMaskColumn;
dxDBGrid5Column4: TdxDBGridMaskColumn;
dxDBGrid5Column5: TdxDBGridMaskColumn;
dxDBGrid5Column6: TdxDBGridMaskColumn;
dxDBGrid5Column7: TdxDBGridMaskColumn;
dxDBGrid5Column8: TdxDBGridMaskColumn;
dxDBGrid5Column9: TdxDBGridCurrencyColumn;
dxDBGrid5Column10: TdxDBGridDateColumn;
dxDBGrid5Column11: TdxDBGridMaskColumn;
dxDBGrid5Column12: TdxDBGridMaskColumn;
dxDBGrid5Column13: TdxDBGridMaskColumn;
dxDBGrid5Column14: TdxDBGridMaskColumn;
dxDBGrid52: TdxDBGridMaskColumn;
dxDBGrid5Column16: TdxDBGridMaskColumn;
dxDBGrid5Column17: TdxDBGridMaskColumn;
dxDBGrid5Column18: TdxDBGridCheckColumn;
dxDBGrid5Column19: TdxDBGridMaskColumn;
dxDBGrid5Column20: TdxDBGridDateColumn;
dxDBGrid5Column21: TdxDBGridDateColumn;
Label9: TLabel;
wwDBComboBox13: TwwDBComboBox;
DBEdit55: TDBEdit;
lbl1: TLabel;
qry_crm_client_sales_tmp: TADOQuery;
ds_crm_client_sales_tmp1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGridMaskColumn2: TdxDBGridMaskColumn;
dxDBGridDateColumn3: TdxDBGridDateColumn;
dxDBGridDateColumn4: TdxDBGridDateColumn;
lbl2: TLabel;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
dxDBGrid4: TdxDBGrid;
dxDBGrid4Column1: TdxDBGridColumn;
dxDBGrid4Column2: TdxDBGridColumn;
dxDBGrid4Column3: TdxDBGridColumn;
dxDBGrid4Column4: TdxDBGridColumn;
DBEdit4: TDBEdit;
RxDBLookupCombo1: TRxDBLookupCombo;
RxDBLookupCombo3: TRxDBLookupCombo;
bsSkinButton4: TbsSkinButton;
Label35: TLabel;
Label36: TLabel;
DBMemo3: TDBMemo;
dxDBGrid2Column19: TdxDBGridColumn;
bsSkinButton5: TbsSkinButton;
dxDBGrid2Column20: TdxDBGridColumn;
dxDBGrid2Column21: TdxDBGridColumn;
Label37: TLabel;
DBEdit5: TDBEdit;
dxDBGrid2Column22: TdxDBGridColumn;
dxDBGrid2Column23: TdxDBGridColumn;
ADOQuery2: TADOQuery;
Label38: TLabel;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit11: TDBEdit;
Label42: TLabel;
DBEdit12: TDBEdit;
DBEdit13: TDBEdit;
Label43: TLabel;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
Label44: TLabel;
Label45: TLabel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure bsSkinButton15Click(Sender: TObject);
procedure bsSkinButton38Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure dxDBGrid2Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure DBComboBoxEh2DropDown(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure dxDBGrid3CustomDraw(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
AFocused: Boolean; var ADone: Boolean);
procedure RxDBLookupCombo1Enter(Sender: TObject);
procedure RxDBLookupCombo1Exit(Sender: TObject);
procedure bsSkinButton4Click(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);
procedure bsSkinButton5Click(Sender: TObject);
procedure dxDBGrid2Column19GetText(Sender: TObject;
ANode: TdxTreeListNode; var AText: String);
procedure dxDBGrid2Column20GetText(Sender: TObject;
ANode: TdxTreeListNode; var AText: String);
procedure dxDBGrid2Column21GetText(Sender: TObject;
ANode: TdxTreeListNode; var AText: String);
procedure bsSkinPageControl1Change(Sender: TObject);
procedure t_op_billAfterScroll(DataSet: TDataSet);
private
tefangfzload:Boolean;
{ Private declarations }
procedure gennerateSign();
public
{ Public declarations }
function UpdateBillStatus(bsStStatus:string):Boolean;
end;
var
frm_op_seae_teshufz: Tfrm_op_seae_teshufz;
implementation
uses my_sys_function, u_main;
{$R *.dfm}
function Tfrm_op_seae_teshufz.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_teshufz.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid2,caption+'2');
frm_op_seae_teshufz.Hide;
frm_op_seae_teshufz.ManualFloat(frm_op_seae_teshufz.BoundsRect );
frm_main.freeTabs('frm_op_seae_teshufz');
action:=cafree;
frm_op_seae_teshufz:=nil;
end;
procedure Tfrm_op_seae_teshufz.FormShow(Sender: TObject);
begin
t_op_bill.Open;
t_op_seaesel.Open;
t_crm_client_sales.open;
qry_crm_client_sales_tmp.open;
ADOQuery1.open;
loadreggrid(dxdbgrid2,false,caption+'2');
dxDBGrid2Column19.Visible:=true;
dxDBGrid2Column20.Visible:=true;
if if_open('453') then bsSkinButton8.Visible:=True else bsSkinButton8.Visible:=False;
if if_open('455') then bsSkinButton5.Visible:=True else bsSkinButton5.Visible:=False;
if t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־').AsInteger=1 then
begin
Label35.Visible:=True;
Label35.Caption:='<27> <> <EFBFBD> ط<EFBFBD> <D8B7> <EFBFBD> ҪΥ Լ<CEA5> <D4BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ';
end
else
begin
label35.Visible:=false;
Label35.Caption:='';
end;
tefangfzload:=true;
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton3Click(Sender: TObject);
begin
if t_op_bill.State in [dsedit,dsinsert] then
t_op_bill.Post;
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton7Click(Sender: TObject);
begin
if t_op_bill.IsEmpty then
exit;
t_op_bill.Cancel;
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton14Click(Sender: TObject);
var
aQuery:TADOQuery;
begin
if t_op_bill.IsEmpty then
exit;
//<2F> ̽<EFBFBD> <CCBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> ж<EFBFBD> :<3A> <> <EFBFBD> <EFBFBD> <EFBFBD> ˵IJ<CBB5> <C4B2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
if not t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').IsNull then
begin
showmessage('<27> Ѿ<EFBFBD> <D1BE> <EFBFBD> <EFBFBD> ˣ<EFBFBD> <CBA3> <EFBFBD> ');
end ;
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 t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־').AsInteger=1 then
begin
showmessage('<27> <> <EFBFBD> طſ ͻ<C5BF> <CDBB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> λ<EFBFBD> <CEBB> ,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ҪΥ Լ<CEA5> <D4BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ');
Exit;
end;
if t_op_bill.FieldByName('ǩ<> <C7A9> <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
frm_main.db.BeginTrans;
try
t_op_bill.edit;
t_op_bill['״̬']:='<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ';
t_op_bill['<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ']:=Now;
t_op_bill['<27> <> <EFBFBD> <EFBFBD> <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));
if GetStatus_notice(FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString,'<27> ᵥǩ<E1B5A5> <C7A9> ') then
begin
InsertSeaeStatus(FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString,'֪ͨ<CDA8> ŵ<EFBFBD> ',employee,FormatDateTime('YYYY-MM-DD',Now));
UpdateMblStatus(FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString,'֪ͨ<CDA8> ŵ<EFBFBD> ');
end;
Next;
end;
end;
//ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
gennerateSign();
//
frm_main.db.CommitTrans;
finally
if frm_main.db.InTransaction then
begin
MessageDlg('<27> <> <EFBFBD> ˳<EFBFBD> <CBB3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ر<EFBFBD> <D8B1> <EFBFBD> <EFBFBD> ԣ<EFBFBD> ',mterror,[mbok],0);
frm_main.db.RollbackTrans;
end;
end;
t_op_bill.Refresh;
end;
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton15Click(Sender: TObject);
var str,strsql,qdbh:string;
begin
if t_op_bill.IsEmpty then
exit;
if t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <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> ');
Exit;
end
else
begin
frm_main.db.BeginTrans;
try
t_op_bill.edit;
t_op_bill['״̬']:='<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ';
t_op_bill['<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ']:=null;
t_op_bill['<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ']:=null;
//<2F> <> <EFBFBD> <EFBFBD> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD>
qdbh:= t_op_bill.fieldbyname('BILL_ID').AsString;
strsql:='delete from t_op_seae_sign_detail where ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> '
+' in( select ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> from t_op_seae_sign_main where ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ='
+ qdbh +' );' + #13#10
+' update t_op_seae_sign_main set ״̬=''<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> '' where ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ='
+ qdbh+';'
+ 'delete FROM [t_op_state] WHERE ҵ<> <D2B5> ״̬ in (''<27> <> <EFBFBD> <EFBFBD> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> '',''֪ͨǩ<D6AA> <C7A9> '') and <20> <> <EFBFBD> <EFBFBD> in ( '
+ ' select <20> <> <EFBFBD> <EFBFBD> as ywbh from t_op_seae_app where ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> = ' +qdbh
+ ');';
frm_main.db.Execute(strsql);
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;
frm_main.db.CommitTrans;
finally
if frm_main.db.InTransaction then
begin
MessageDlg('ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> ˳<EFBFBD> <CBB3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ر<EFBFBD> <D8B1> <EFBFBD> <EFBFBD> ԣ<EFBFBD> ',mterror,[mbok],0);
frm_main.db.RollbackTrans;
end;
end;
if (str<>'') then
t_op_bill.Refresh;
end;
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton38Click(Sender: TObject);
begin
t_op_bill.Refresh;
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton8Click(Sender: TObject);
var
aQuery:TADOQuery;
mybook:TBookmark;
BillNo,tidstr,SQLStr:string;
begin
if t_op_bill.IsEmpty then exit;
if t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־').AsInteger=0 then
begin
ShowMessage('<27> <> <EFBFBD> طŲ<D8B7> <C5B2> <EFBFBD> Ҫ<EFBFBD> <D2AA> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ');
Exit;
end;
mybook:=t_op_bill.GetBookmark;
aQuery:=CreateAdoQuery;
SQLStr:='update t_op_bill_fangdanwy set <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־=1,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ='+QuotedStr(employee)+',<2C> <> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1> ='+QuotedStr(FormatDateTime('yyyy-mm-dd hh:mm:ss',Now))
+' where Υ Լ<CEA5> <D4BC> ־=1 and wyid in '
+' ( select top 2 wyid from t_op_bill_fangdanwy where ί<> е <EFBFBD> λ='
+QuotedStr(t_op_bill.fieldbyname('ί<> е <EFBFBD> λ').AsString)+' order by <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŵ<EFBFBD> <C5B5> <EFBFBD> <EFBFBD> desc )';
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
ExecSQL;
Close;
SQL.Clear;
SQL.Add('insert into t_op_bill_fangdantepi (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ,ί<> е <EFBFBD> λ,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ,<2C> <> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> ,<2C> <> <EFBFBD> <EFBFBD> RMB,<2C> <> <EFBFBD> <EFBFBD> USD,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ,Bill_ID) values ('
+QuotedStr(employee)+','+QuotedStr(t_op_bill.fieldbyname('ί<> е <EFBFBD> λ').AsString)
+','+QuotedStr(FormatDateTime('yyyy-mm-dd hh:mm:ss',Now))+','+QuotedStr(t_op_bill.fieldbyname('<27> <> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> ').AsString)+','
+QuotedStr(t_op_bill.fieldbyname('<27> ˿<EFBFBD> RMB').AsString)+','+QuotedStr(t_op_bill.fieldbyname('<27> ˿<EFBFBD> USD').AsString)+','
+QuotedStr(t_op_bill.fieldbyname('ҵ<> <D2B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsString)+','+QuotedStr(t_op_bill.fieldbyname('Bill_ID').AsString)+')' );
ExecSQL;
end;
t_op_bill.Edit;
t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־').AsInteger:=0;
t_op_bill.FieldByName('Υ Լ<CEA5> <D4BC> <EFBFBD> <EFBFBD> ').AsInteger:=1;
t_op_bill.Post;
FreeAndNil(aQuery);
t_op_bill.Requery();
t_op_bill.GotoBookmark(mybook);
if t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־').AsInteger=1 then
begin
Label35.Visible:=True;
Label35.Caption:='<27> <> <EFBFBD> ط<EFBFBD> <D8B7> <EFBFBD> ҪΥ Լ<CEA5> <D4BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ';
end
else
begin
label35.Visible:=false;
Label35.Caption:='';
end;
bsSkinButton14Click(nil);
end;
procedure Tfrm_op_seae_teshufz.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> ҪΥ Լ<CEA5> <D4BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ';
end
else
begin
label35.Visible:=false;
Label35.Caption:='';
end;
bsSkinPageControl1.ActivePageIndex:=1;
{
if (not t_op_bill.IsEmpty) then begin
if (ADOQuery2.Active) then ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('select sum(case when ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ =''<27> <> <EFBFBD> <EFBFBD> '' then 1 else 0 end) ZBCOUNT,sum(case when ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ =''<27> <> <EFBFBD> <EFBFBD> '' then 1 else 0 end) DFCOUNT ');
ADOQuery2.SQL.Add(' from t_op_seae where ҵ<> <D2B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> =''<27> <> ͨ<EFBFBD> <CDA8> '' and <20> ᵥǩ<E1B5A5> <C7A9> ״̬=''<27> ᵥǩ<E1B5A5> <C7A9> ''');
ADOQuery2.SQL.Add(' and not EXISTS (select 1 from t_op_state where t_op_state.ҵ<> <D2B5> ״̬=''<27> ᵥǩ<E1B5A5> <C7A9> '' and t_op_state.<2E> <> <EFBFBD> <EFBFBD> =t_op_seae.<2E> <> <EFBFBD> <EFBFBD> ) ');
ADOQuery2.SQL.Add(' and ί<> е <EFBFBD> λ='''+t_op_bill.fieldbyname('ί<> е <EFBFBD> λ').AsString+''' ');
ADOQuery2.Open;
Edit5.Text:=IntToStr(ADOQuery2.fieldbyname('ZBCOUNT').asinteger-t_op_bill.fieldbyname('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ط<EFBFBD> <D8B7> <EFBFBD> <EFBFBD> <EFBFBD> ').AsInteger);
Edit6.Text:=IntToStr(ADOQuery2.fieldbyname('DFCOUNT').asinteger-t_op_bill.fieldbyname('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> طŵ<D8B7> <C5B5> <EFBFBD> ').AsInteger);
end;
}
end;
procedure Tfrm_op_seae_teshufz.N16Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid2);
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton11Click(Sender: TObject);
begin
with t_op_bill do
begin
Close;
sql.Clear;
sql.Add('select *,(SELECT <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> FROM [t_sys_employee] where <20> <> <EFBFBD> <EFBFBD> =t_op_bill_fangdan.ҵ<> <D2B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ) <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ,(select top 1 (Case t_crm_client_sales.<2E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ');
sql.Add('when ''Լ<> <D4BC> ʱ<EFBFBD> <CAB1> '' then ''<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ''+t_crm_client_sales.<2E> <> <EFBFBD> <EFBFBD> ģʽ +''<27> <> ''+''ÿ<> <C3BF> ''+convert(varchar(20),t_crm_client_sales.<2E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )+''<27> <> ''');
sql.Add('when ''Լ<> <D4BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> '' then ''<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ''+convert(varchar(20),t_crm_client_sales.<2E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )+''<27> <> ''');
sql.Add('when ''<27> ֽ<EFBFBD> <D6BD> <EFBFBD> <EFBFBD> <EFBFBD> '' then ''<27> ֽ<EFBFBD> <D6BD> <EFBFBD> <EFBFBD> <EFBFBD> ''');
sql.Add('end) from t_crm_client_sales where <20> ͻ<EFBFBD> <CDBB> <EFBFBD> <EFBFBD> <EFBFBD> =t_op_bill_fangdan.ί<> е <EFBFBD> λ and <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> >=t_op_bill_fangdan.<2E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ) as <20> <> <EFBFBD> <EFBFBD> from t_op_bill_fangdan');
sql.Add('where 1=1 ');
if wwDBDateTimePicker6.TEXT<>''then
begin
sql.add(' and <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> >='+''''+wwDBDateTimePicker6.TEXT+'''');
end;
if wwDBDateTimePicker7.TEXT<>''then
begin
sql.add(' and <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <='+''''+wwDBDateTimePicker7.TEXT+' 23:59:59''');
end;
if RxDBLookupCombo2.DisplayValues[1]<>'' then
sql.add(' and ί<> е <EFBFBD> λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''');
sql.Add('order by BILL_ID DESC');
Open;
end;
end;
procedure Tfrm_op_seae_teshufz.DBComboBoxEh2DropDown(Sender: TObject);
var
aQuery:TADOQuery;
begin
DBComboBoxEh2.Items.Clear;
aQuery:=CreateAdoQuery;
with aQuery do
try
Close;SQL.Clear;
SQL.Add('select distinct <20> طŷ<D8B7> <C5B7> <EFBFBD> from t_op_bill_fangdan');
SQL.Add('where <20> طŷ<D8B7> <C5B7> <EFBFBD> <>''''');
SQL.Add('order by <20> طŷ<D8B7> <C5B7> <EFBFBD> ');
Open;
First;
while not Eof do begin
DBComboBoxEh2.Items.Add(FieldByName('<27> طŷ<D8B7> <C5B7> <EFBFBD> ').AsString);
Next;
end;
finally
Close;
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton2Click(Sender: TObject);
begin
if t_op_bill.IsEmpty then
exit;
t_op_bill.edit;
t_op_bill['״̬']:='<27> <> <EFBFBD> ܲ<EFBFBD> <DCB2> <EFBFBD> ';
t_op_bill['<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ']:=date;
t_op_bill['<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ']:=employee;
t_op_bill.post;
end;
procedure Tfrm_op_seae_teshufz.dxDBGrid3CustomDraw(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
begin
if UpperCase(Trim(ANode.Strings[dxDBGrid3Column16.Index]))='TRUE' then
begin
AColor:=clred;
exit;
end;
end;
function EmployeePhone():string;
var
empQuery:TADOQuery;
begin
//
Result:='';
empQuery:=CreateAdoQuery();
with empQuery do
begin
SQL.Add('select [<5B> ̶<EFBFBD> <CCB6> 绰],[<5B> ƶ<EFBFBD> <C6B6> 绰] from [t_sys_employee] where [<5B> <> <EFBFBD> <EFBFBD> ]='''+ employee +''' ');
Open;First;
Result :=FieldByName('<27> ̶<EFBFBD> <CCB6> 绰').AsString;
close();
end;
end;
/// <summary>
///
/// </summary>
procedure Tfrm_op_seae_teshufz.gennerateSign();
var
str,bsno:widestring;
i:integer;
aQuery:TAdoQuery;
qdm_Query:TAdoQuery;
qdd_Query:TAdoQuery;
qdtbh:string;
strwtdw1,strwtdw2:string;
dbTime:TDateTime;
stateNewQD:string;
qdfsh:string;//ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ <20> <> <EFBFBD> <EFBFBD>
mainIsAlreadyGen:Boolean;
begin
stateNewQD:='<27> <> <EFBFBD> <EFBFBD> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> ';
mainIsAlreadyGen:=False;
//no check
aQuery:=CreateAdoQuery();
qdm_Query:=CreateAdoQuery();
qdd_Query:=CreateAdoQuery();
str:= 'INSERT INTO t_sys_signid (mainorderno) VALUES (''222'');';
aQuery.SQL.Add(str) ;
aQuery.ExecSQL();
aQuery.sql.Clear();
str:= 'select MAX(signid) as qdtbh,GETDATE()as FDate from t_sys_signid; ';
aQuery.sql.add(str);
qdm_Query.SQL.Add('SELECT * FROM [t_op_seae_sign_main] where 1=2');
qdd_Query.SQL.Add('SELECT * FROM [t_op_seae_sign_detail] where 1=2');
aQuery.Open;
aQuery.First;
qdtbh:=aQuery.FieldByName('qdtbh').AsString;
dbTime:=aQuery.FieldByName('FDate').AsDateTime;
aQuery.sql.Clear();
aQuery.sql.Add('SELECT * FROM [t_op_state] WHERE 1=2');
aQuery.OPEN;
qdm_Query.Open;
qdd_Query.Open;
try
t_op_seaesel.first;
for i:=0 to t_op_seaesel.recordset.recordcount-1 do
begin
//<2F> <> ϸ<EFBFBD> <CFB8>
with qdd_Query do
begin
qdfsh:= t_op_seaesel.FieldByName('ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ ').AsString;
//TODO : <20> <> ȷ<EFBFBD> <C8B7>
// if( Trim(qdfsh)<>'<27> <> <EFBFBD> <EFBFBD> ') then
// Continue; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
Insert;
FieldByName('ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsString:= qdtbh;
FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString:= t_op_seaesel.FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString;
FieldByName('<27> <> <EFBFBD> ᵥ<EFBFBD> <E1B5A5> ').AsString:= t_op_seaesel.FieldByName('<27> <> <EFBFBD> ᵥ<EFBFBD> <E1B5A5> ').AsString;
FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString:= t_op_seaesel.FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString;
FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString:= t_op_seaesel.FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString;
FieldByName('ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ ').AsString:=qdfsh;
FieldByName('״̬').AsString:= stateNewQD;
end;
//<2F> <> <EFBFBD> <EFBFBD>
if mainIsAlreadyGen=false then
begin
strwtdw1 := t_op_bill.FieldByName('ί<> е <EFBFBD> λ').AsString;
strwtdw2:=strwtdw1;
with qdm_Query do
begin
Insert;
FieldByName('ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsString:=qdtbh;
FieldByName('<27> ͻ<EFBFBD> <CDBB> <EFBFBD> <EFBFBD> <EFBFBD> ').AsString:= strwtdw1;
FieldByName('¼<> <C2BC> <EFBFBD> <EFBFBD> ').AsString:= employee;
FieldByName('¼<> <C2BC> <EFBFBD> ˵绰').AsString:=EmployeePhone();
FieldByName('¼<> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsDateTime:= dbTime;
//<2F> <> <EFBFBD> պ<EFBFBD> <D5BA> <EFBFBD> <EFBFBD> <EFBFBD>
FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsDateTime:=EncodeDate(YearOf(dbTime+2),monthof(dbTime+2),DayOf(dbTime+2));
FieldByname('<27> <> <EFBFBD> <EFBFBD> ').AsString:=getzq(strwtdw1);
FieldByname('<27> ͻ<EFBFBD> <CDBB> <EFBFBD> <EFBFBD> <EFBFBD> ').AsString:=getzqlx(strwtdw1);
// //
FieldByName('״̬').AsString:= stateNewQD;
// ֱ<> <D6B1> ֪ͨ<CDA8> <D6AA> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֪ͨ from <20> ų<EFBFBD> Դ 2017-08-08
//FieldByName('״̬').AsString:='֪ͨǩ<D6AA> <C7A9> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> ';
//FieldByName('֪ͨǩ<D6AA> <C7A9> ʱ<EFBFBD> <CAB1> ').AsDateTime:= dbTime;
FieldByName('<27> Ƿ<EFBFBD> <C7B7> ط<EFBFBD> ').AsVariant:= 1;
FieldByName('ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsInteger:= t_op_seaesel.fieldbyname('ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsInteger;
FieldByname('ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsString:='<27> ½<EFBFBD> ';
end;
mainIsAlreadyGen:=True;
end ;
//״̬
with aQuery do
begin
//
Insert;
FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString:= t_op_seaesel.FieldByName('<27> <> <EFBFBD> <EFBFBD> ').AsString;
FieldByName('ҵ<> <D2B5> ״̬').AsString:= stateNewQD;
FieldByName('¼<> <C2BC> <EFBFBD> <EFBFBD> ').AsString:= employee;
FieldByName('¼<> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ').AsDateTime:= dbTime;
end;
t_op_seaesel.Next;
end;
//
qdm_Query.post;
qdd_Query.post;
aQuery.post;
//show_qdtxx(qdtbh,0);
aQuery.close();
qdm_Query.close();
qdd_Query.close();
//
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> ᵥǩ<E1B5A5> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
str:='update t_op_seae_sign_detail set <20> ᵥǩ<E1B5A5> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> =v.¼<> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> from '
+ '(select <20> <> <EFBFBD> <EFBFBD> ,¼<> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> from t_op_state where <20> <> <EFBFBD> <EFBFBD> in ( '
+ 'select <20> <> <EFBFBD> <EFBFBD> from t_op_seae_sign_detail where ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ='''+ qdtbh
+ ''' ) and ҵ<> <D2B5> ״̬=''<27> ᵥǩ<E1B5A5> <C7A9> '''
+ ') v where t_op_seae_sign_detail.<2E> <> <EFBFBD> <EFBFBD> =v.<2E> <> <EFBFBD> <EFBFBD> ';
frm_main.db.Execute(str);
{ //<2F> طŲ<D8B7> ִ<EFBFBD> <D6B4> :֪ͨǩ<D6AA> <C7A9> from <20> ų<EFBFBD> Դ 2017-08-08
// д״̬:֪ͨǩ<D6AA> <C7A9>
str:='INSERT INTO [dbo].[t_op_state]([<5B> <> <EFBFBD> <EFBFBD> ],[ҵ<> <D2B5> ״̬],[¼<> <C2BC> <EFBFBD> <EFBFBD> ] ,[¼<> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ] ) '
+'select <20> <> <EFBFBD> <EFBFBD> ,''֪ͨǩ<D6AA> <C7A9> '' as ҵ<> <D2B5> ״̬,'''+ employee +''' as ¼<> <C2BC> <EFBFBD> <EFBFBD> ,GETDATE() ¼<> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> from'
+' (select <20> <> <EFBFBD> <EFBFBD> from t_op_seae_sign_detail d where ǩ<> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ='''+ qdtbh +''''
+' and not exists (select <20> <> <EFBFBD> <EFBFBD> from [t_op_state] where ҵ<> <D2B5> ״̬=''֪ͨǩ<D6AA> <C7A9> '' and <20> <> <EFBFBD> <EFBFBD> = d.<2E> <> <EFBFBD> <EFBFBD> )) v;';
frm_main.db.Execute(str);
}
except
on ex: Exception do
begin
errorlog(ex.Message) ;
ShowMessage('<27> <> <EFBFBD> <EFBFBD> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ִ<EFBFBD> <D6B4> <EFBFBD> :'+ex.Message);
aQuery.Cancel;
qdm_Query.Cancel;
qdd_Query.Cancel;
end
end;
end;
procedure Tfrm_op_seae_teshufz.RxDBLookupCombo1Enter(Sender: TObject);
begin
TRxDBLookupCombo(Sender).LookupDisplay:='<27> <> <EFBFBD> <EFBFBD> ;<3B> <> <EFBFBD> <EFBFBD> ';
end;
procedure Tfrm_op_seae_teshufz.RxDBLookupCombo1Exit(Sender: TObject);
begin
TRxDBLookupCombo(Sender).LookupDisplay:='<27> <> <EFBFBD> <EFBFBD> ';
end;
procedure Tfrm_op_seae_teshufz.bsSkinButton4Click(Sender: TObject);
begin
Close;
end;
procedure Tfrm_op_seae_teshufz.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[dxDBGrid2Column20.Index]) then
begin
sValues :=ANode.Values[dxDBGrid2Column20.Index];
if StrToIntDef(sValues,0) = 1 then afont.Color:=$00C080FF;
end;
if not VarIsNull(ANode.Values[dxDBGrid2Column19.Index]) then
begin
sValues :=ANode.Values[dxDBGrid2Column19.Index];
if StrToIntDef(sValues,0) = 1 then afont.Color:=clred;
end;
if not VarIsNull(ANode.Values[dxDBGrid2Column21.Index]) then
begin
sValues :=ANode.Values[dxDBGrid2Column21.Index];
if StrToIntDef(sValues,0) = 1 then afont.Color:=clgreen;
end;
end;
//ȡ<> <C8A1> Υ Լ<CEA5> <D4BC> <EFBFBD> <EFBFBD>
{
procedure Tfrm_op_seae_teshufz.bsSkinButton5Click(Sender: TObject);
var
aQuery:TADOQuery;
mybook:TBookmark;
BillNo,tidstr,SQLStr:string;
begin
if t_op_bill.IsEmpty then exit;
if t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־').AsInteger<>0 then
begin
ShowMessage('<27> <> <EFBFBD> طŲ<D8B7> <C5B2> <EFBFBD> Ҫȡ<D2AA> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ');
Exit;
end;
mybook:=t_op_bill.GetBookmark;
aQuery:=CreateAdoQuery;
SQLStr:='update t_op_bill_fangdanwy set <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־=0,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> =null,<2C> <> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1> =null '
+' where Υ Լ<CEA5> <D4BC> ־=1 and wyid in '
+' ( select top 2 wyid from t_op_bill_fangdanwy where ί<> е <EFBFBD> λ='
+QuotedStr(t_op_bill.fieldbyname('ί<> е <EFBFBD> λ').AsString)+' order by <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŵ<EFBFBD> <C5B5> <EFBFBD> <EFBFBD> desc )';
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
ExecSQL;
Close;
SQL.Clear;
SQL.Add('delete t_op_bill_fangdantepi where Bill_ID='+QuotedStr(t_op_bill.fieldbyname('Bill_ID').AsString) );
ExecSQL;
end;
t_op_bill.Edit;
t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־').AsInteger:=1;
t_op_bill.Post;
FreeAndNil(aQuery);
bsSkinButton15Click(nil);
t_op_bill.Requery();
t_op_bill.GotoBookmark(mybook);
if t_op_bill.FieldByName('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־').AsInteger=1 then
begin
Label35.Visible:=True;
Label35.Caption:='<27> <> <EFBFBD> ط<EFBFBD> <D8B7> <EFBFBD> ҪΥ Լ<CEA5> <D4BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ';
end
else
begin
label35.Visible:=false;
Label35.Caption:='';
end;
end;
}
//ȡ<> <C8A1> Υ Լ <20> <> Υ Լ<CEA5> <D4BC> ˮ<EFBFBD> <CBAE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Υ Լ<CEA5> <D4BC> ¼û<C2BC> <C3BB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> һ <EFBFBD> £<EFBFBD> <C2A3> <EFBFBD> ǰfangdan<61> <6E> <EFBFBD> <EFBFBD> ¼<EFBFBD> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־<EFBFBD> <D6BE> Ϊ0
procedure Tfrm_op_seae_teshufz.bsSkinButton5Click(Sender: TObject);
var
aQuery:TADOQuery;
mybook:TBookmark;
BillNo,tidstr,SQLStr:string;
begin
if t_op_bill.IsEmpty then exit;
if t_op_bill.FieldByName('Υ Լ<CEA5> <D4BC> ־').AsInteger=0 then
begin
ShowMessage('<27> <> <EFBFBD> طŲ<D8B7> <C5B2> <EFBFBD> Ҫȡ<D2AA> <C8A1> Υ Լ<CEA5> <D4BC> ');
Exit;
end;
SQLStr:='update t_op_bill_fangdanwy set Υ Լ<CEA5> <D4BC> ־=0,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ־=1,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ='+QuotedStr(employee)+',<2C> <> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1> ='+QuotedStr(FormatDateTime('yyyy-mm-dd hh:mm:ss',Now))
+' where Υ Լ<CEA5> <D4BC> ־=1 and '
+' ί<> е <EFBFBD> λ='
+QuotedStr(t_op_bill.fieldbyname('ί<> е <EFBFBD> λ').AsString)+' and <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŵ<EFBFBD> <C5B5> <EFBFBD> <EFBFBD> ='+QuotedStr(t_op_bill.fieldbyname('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŵ<EFBFBD> <C5B5> <EFBFBD> <EFBFBD> ').AsString);
mybook:=t_op_bill.GetBookmark;
aQuery:=CreateAdoQuery;
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
ExecSQL;
end;
FreeAndNil(aQuery) ;
t_op_bill.Edit;
t_op_bill.FieldByName('Υ Լ<CEA5> <D4BC> ־').AsInteger:=0;
t_op_bill.Post;
t_op_bill.Requery();
t_op_bill.GotoBookmark(mybook);
label35.Visible:=false;
Label35.Caption:='';
end;
procedure Tfrm_op_seae_teshufz.dxDBGrid2Column19GetText(Sender: TObject;
ANode: TdxTreeListNode; var AText: String);
var
sValues : string;
begin
if not VarIsNull(ANode.Values[dxDBGrid2Column19.Index]) then
begin
sValues :=ANode.Values[dxDBGrid2Column19.Index];
if StrToIntDef(sValues,0) = 1 then AText:='<27> <> ' else AText:='';
end;
end;
procedure Tfrm_op_seae_teshufz.dxDBGrid2Column20GetText(Sender: TObject;
ANode: TdxTreeListNode; var AText: String);
var
sValues : string;
begin
if not VarIsNull(ANode.Values[dxDBGrid2Column20.Index]) then
begin
sValues :=ANode.Values[dxDBGrid2Column20.Index];
if StrToIntDef(sValues,0) = 1 then AText:='<27> <> ' else AText:='';
end;
end;
procedure Tfrm_op_seae_teshufz.dxDBGrid2Column21GetText(Sender: TObject;
ANode: TdxTreeListNode; var AText: String);
var
sValues : string;
begin
if not VarIsNull(ANode.Values[dxDBGrid2Column21.Index]) then
begin
sValues :=ANode.Values[dxDBGrid2Column21.Index];
if StrToIntDef(sValues,0) = 1 then AText:='<27> <> ' else AText:='';
end;
end;
procedure Tfrm_op_seae_teshufz.bsSkinPageControl1Change(Sender: TObject);
begin
if (not tefangfzload) then exit;
{
if (bsSkinPageControl1.ActivePage=bskntbsht2) then begin
if (not t_op_bill.IsEmpty) then begin
if (ADOQuery2.Active) then ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('select sum(case when ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ =''<27> <> <EFBFBD> <EFBFBD> '' then 1 else 0 end) ZBCOUNT,sum(case when ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ =''<27> <> <EFBFBD> <EFBFBD> '' then 1 else 0 end) DFCOUNT ');
ADOQuery2.SQL.Add(' from t_op_seae where ҵ<> <D2B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> =''<27> <> ͨ<EFBFBD> <CDA8> '' and <20> ᵥǩ<E1B5A5> <C7A9> ״̬=''<27> ᵥǩ<E1B5A5> <C7A9> ''');
ADOQuery2.SQL.Add(' and not EXISTS (select 1 from t_op_state where t_op_state.ҵ<> <D2B5> ״̬=''<27> ᵥǩ<E1B5A5> <C7A9> '' and t_op_state.<2E> <> <EFBFBD> <EFBFBD> =t_op_seae.<2E> <> <EFBFBD> <EFBFBD> ) ');
ADOQuery2.SQL.Add(' and ί<> е <EFBFBD> λ='''+t_op_bill.fieldbyname('ί<> е <EFBFBD> λ').AsString+''' ');
ADOQuery2.Open;
Edit5.Text:=IntToStr(ADOQuery2.fieldbyname('ZBCOUNT').asinteger-t_op_bill.fieldbyname('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ط<EFBFBD> <D8B7> <EFBFBD> <EFBFBD> <EFBFBD> ').AsInteger);
Edit6.Text:=IntToStr(ADOQuery2.fieldbyname('DFCOUNT').asinteger-t_op_bill.fieldbyname('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> طŵ<D8B7> <C5B5> <EFBFBD> ').AsInteger);
end;
end else begin
if (ADOQuery2.Active) then ADOQuery2.Close;
end;
}
end;
procedure Tfrm_op_seae_teshufz.t_op_billAfterScroll(DataSet: TDataSet);
begin
{
if (bsSkinPageControl1.ActivePage=bskntbsht2) then begin
if (not t_op_bill.IsEmpty) then begin
if (ADOQuery2.Active) then ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('select sum(case when ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ =''<27> <> <EFBFBD> <EFBFBD> '' then 1 else 0 end) ZBCOUNT,sum(case when ǩ<> <C7A9> <EFBFBD> <EFBFBD> ʽ =''<27> <> <EFBFBD> <EFBFBD> '' then 1 else 0 end) DFCOUNT ');
ADOQuery2.SQL.Add(' from t_op_seae where ҵ<> <D2B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> =''<27> <> ͨ<EFBFBD> <CDA8> '' and <20> ᵥǩ<E1B5A5> <C7A9> ״̬=''<27> ᵥǩ<E1B5A5> <C7A9> ''');
ADOQuery2.SQL.Add(' and not EXISTS (select 1 from t_op_state where t_op_state.ҵ<> <D2B5> ״̬=''<27> ᵥǩ<E1B5A5> <C7A9> '' and t_op_state.<2E> <> <EFBFBD> <EFBFBD> =t_op_seae.<2E> <> <EFBFBD> <EFBFBD> ) ');
ADOQuery2.SQL.Add(' and ί<> е <EFBFBD> λ='''+t_op_bill.fieldbyname('ί<> е <EFBFBD> λ').AsString+''' ');
ADOQuery2.Open;
Edit5.Text:=IntToStr(ADOQuery2.fieldbyname('ZBCOUNT').asinteger-t_op_bill.fieldbyname('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ط<EFBFBD> <D8B7> <EFBFBD> <EFBFBD> <EFBFBD> ').AsInteger);
Edit6.Text:=IntToStr(ADOQuery2.fieldbyname('DFCOUNT').asinteger-t_op_bill.fieldbyname('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> طŵ<D8B7> <C5B5> <EFBFBD> ').AsInteger);
end;
end
}
end;
end.