|
|
unit u_op_seae_teshufandan;
|
|
|
|
|
|
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_teshufandan = class(TForm)
|
|
|
Panel2: TPanel;
|
|
|
Panel3: TPanel;
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
bsSkinButton6: TbsSkinButton;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
Label6: TLabel;
|
|
|
Label3: TLabel;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
Label10: TLabel;
|
|
|
Label5: TLabel;
|
|
|
Label9: TLabel;
|
|
|
Label8: TLabel;
|
|
|
Label11: TLabel;
|
|
|
Label30: TLabel;
|
|
|
Label125: TLabel;
|
|
|
Label124: TLabel;
|
|
|
Label16: TLabel;
|
|
|
Edit1: TEdit;
|
|
|
Edit4: TEdit;
|
|
|
Edit2: TEdit;
|
|
|
Edit3: TEdit;
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
|
wwDBDateTimePicker3: TwwDBDateTimePicker;
|
|
|
wwDBDateTimePicker4: TwwDBDateTimePicker;
|
|
|
Edit7: TEdit;
|
|
|
wwDBLookupCombo49: TwwDBLookupCombo;
|
|
|
wwDBLookupCombo52: TwwDBLookupCombo;
|
|
|
RxDBLookupCombo6: TRxDBLookupCombo;
|
|
|
t_op_seae: TADOQuery;
|
|
|
t_op_seae1: TDataSource;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column84: TdxDBGridCheckColumn;
|
|
|
dxDBGrid1Column85: TdxDBGridColumn;
|
|
|
dxDBGrid1Column1: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column2: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column3: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column4: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column5: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column6: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column7: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column8: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column78: TdxDBGridColumn;
|
|
|
dxDBGrid1Column9: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column10: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column11: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column12: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column13: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column14: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column15: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column16: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column17: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column18: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column19: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column20: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column22: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column23: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column24: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column25: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column26: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column27: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column28: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column29: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column30: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column31: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column32: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column33: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column34: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column35: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column36: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column37: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column38: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column39: TdxDBGridColumn;
|
|
|
dxDBGrid1Column40: TdxDBGridColumn;
|
|
|
dxDBGrid11: TdxDBGridMaskColumn;
|
|
|
dxDBGrid12: TdxDBGridMaskColumn;
|
|
|
dxDBGrid13: TdxDBGridMaskColumn;
|
|
|
dxDBGrid14: TdxDBGridMaskColumn;
|
|
|
dxDBGrid15: TdxDBGridMaskColumn;
|
|
|
dxDBGrid16: TdxDBGridMaskColumn;
|
|
|
dxDBGrid17: TdxDBGridMaskColumn;
|
|
|
dxDBGrid18: TdxDBGridMaskColumn;
|
|
|
dxDBGrid19: TdxDBGridMaskColumn;
|
|
|
dxDBGrid110: TdxDBGridMaskColumn;
|
|
|
dxDBGrid111: TdxDBGridMaskColumn;
|
|
|
dxDBGrid112: TdxDBGridMaskColumn;
|
|
|
dxDBGrid113: TdxDBGridMaskColumn;
|
|
|
dxDBGrid114: TdxDBGridMaskColumn;
|
|
|
dxDBGrid115: TdxDBGridMaskColumn;
|
|
|
dxDBGrid116: TdxDBGridMaskColumn;
|
|
|
dxDBGrid117: TdxDBGridMaskColumn;
|
|
|
dxDBGrid118: TdxDBGridMaskColumn;
|
|
|
dxDBGrid119: TdxDBGridMaskColumn;
|
|
|
dxDBGrid120: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column61: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1TEU: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column63: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column64: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column65: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column66: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column67: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column72: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column68: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column69: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column70: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column74: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column75: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column73: TdxDBGridColumn;
|
|
|
dxDBGrid1Column76: TdxDBGridColumn;
|
|
|
dxDBGrid1Column77: TdxDBGridCheckColumn;
|
|
|
dxDBGrid1Column79: TdxDBGridColumn;
|
|
|
dxDBGrid1Column80: TdxDBGridColumn;
|
|
|
dxDBGrid1Column81: TdxDBGridColumn;
|
|
|
dxDBGrid1Column86: TdxDBGridCheckColumn;
|
|
|
dxDBGrid1Column87: TdxDBGridCheckColumn;
|
|
|
dxDBGrid1Column88: TdxDBGridColumn;
|
|
|
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;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
bsSkinButton7: TbsSkinButton;
|
|
|
bsSkinButton8: TbsSkinButton;
|
|
|
bsSkinButton12: 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;
|
|
|
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;
|
|
|
wwDBDateTimePicker9: TwwDBDateTimePicker;
|
|
|
Label15: TLabel;
|
|
|
DBEdit2: TDBEdit;
|
|
|
Label25: TLabel;
|
|
|
DBEdit3: TDBEdit;
|
|
|
Label26: TLabel;
|
|
|
dxDBGrid2Column10: TdxDBGridColumn;
|
|
|
dxDBGrid2Column11: TdxDBGridColumn;
|
|
|
Label27: TLabel;
|
|
|
bsSkinButton38: TbsSkinButton;
|
|
|
RxDBLookupCombo8: TRxDBLookupCombo;
|
|
|
dxDBGrid2Column12: TdxDBGridColumn;
|
|
|
dxDBGrid2Column13: TdxDBGridColumn;
|
|
|
dxDBGrid2Column14: TdxDBGridColumn;
|
|
|
Label28: TLabel;
|
|
|
DBMemo1: TDBMemo;
|
|
|
dxDBGrid1Column89: TdxDBGridColumn;
|
|
|
Label29: TLabel;
|
|
|
DBMemo2: TDBMemo;
|
|
|
DataSource1: TDataSource;
|
|
|
ADOQuery1: TADOQuery;
|
|
|
Label31: TLabel;
|
|
|
RxDBLookupCombo31: TRxDBLookupCombo;
|
|
|
dxDBGrid2Column15: TdxDBGridColumn;
|
|
|
dxDBGrid1Column90: TdxDBGridColumn;
|
|
|
t_op_bill_items: TADOQuery;
|
|
|
t_op_bill_items1: TDataSource;
|
|
|
bsSkinTabSheet3: TbsSkinTabSheet;
|
|
|
dxDBGrid4: TdxDBGrid;
|
|
|
dxDBGrid4Column1: TdxDBGridColumn;
|
|
|
dxDBGrid4Column2: TdxDBGridColumn;
|
|
|
dxDBGrid4Column3: TdxDBGridColumn;
|
|
|
dxDBGrid4Column4: TdxDBGridColumn;
|
|
|
Label32: TLabel;
|
|
|
wwDBDateTimePicker10: TwwDBDateTimePicker;
|
|
|
Label34: TLabel;
|
|
|
bsSkinPanel6: TbsSkinPanel;
|
|
|
Label33: TLabel;
|
|
|
RxDBLookupCombo12: TRxDBLookupCombo;
|
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
RxDBLookupCombo4: TRxDBLookupCombo;
|
|
|
wwDBLookupCombo1: TwwDBLookupCombo;
|
|
|
Label35: TLabel;
|
|
|
Label36: TLabel;
|
|
|
DBMemo3: TDBMemo;
|
|
|
dxDBGrid2Column16: TdxDBGridColumn;
|
|
|
dxDBGrid2Column17: TdxDBGridColumn;
|
|
|
dxDBGrid2Column18: TdxDBGridColumn;
|
|
|
Label37: TLabel;
|
|
|
DBMemo4: TDBMemo;
|
|
|
Label38: TLabel;
|
|
|
DBEdit4: TDBEdit;
|
|
|
Label39: TLabel;
|
|
|
DBEdit5: TDBEdit;
|
|
|
Label40: TLabel;
|
|
|
Label41: TLabel;
|
|
|
ADOQuery2: TADOQuery;
|
|
|
DBEdit6: TDBEdit;
|
|
|
DBEdit7: TDBEdit;
|
|
|
Label42: TLabel;
|
|
|
DBEdit8: TDBEdit;
|
|
|
DBEdit11: TDBEdit;
|
|
|
Label43: TLabel;
|
|
|
DBEdit12: TDBEdit;
|
|
|
DBEdit13: TDBEdit;
|
|
|
Label44: TLabel;
|
|
|
Label45: TLabel;
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
procedure bsSkinButton6Click(Sender: TObject);
|
|
|
procedure dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
procedure N16Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure N3Click(Sender: TObject);
|
|
|
procedure N1Click(Sender: TObject);
|
|
|
procedure MenuItem2Click(Sender: TObject);
|
|
|
procedure t_op_billAfterInsert(DataSet: TDataSet);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
procedure bsSkinButton7Click(Sender: TObject);
|
|
|
procedure bsSkinButton8Click(Sender: TObject);
|
|
|
procedure bsSkinButton12Click(Sender: TObject);
|
|
|
procedure t_op_seaeselBeforeDelete(DataSet: TDataSet);
|
|
|
procedure t_op_billBeforeEdit(DataSet: TDataSet);
|
|
|
procedure t_op_billBeforeDelete(DataSet: TDataSet);
|
|
|
procedure t_op_seaeselBeforeEdit(DataSet: TDataSet);
|
|
|
procedure bsSkinButton38Click(Sender: TObject);
|
|
|
procedure RxDBLookupCombo8Enter(Sender: TObject);
|
|
|
procedure RxDBLookupCombo8Exit(Sender: TObject);
|
|
|
procedure dxDBGrid2Click(Sender: TObject);
|
|
|
procedure bsSkinButton11Click(Sender: TObject);
|
|
|
procedure dxDBGrid1Column90CustomDraw(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 t_op_billBeforePost(DataSet: TDataSet);
|
|
|
procedure RxDBLookupCombo12Enter(Sender: TObject);
|
|
|
procedure RxDBLookupCombo1Enter(Sender: TObject);
|
|
|
procedure RxDBLookupCombo5Enter(Sender: TObject);
|
|
|
procedure RxDBLookupCombo12Exit(Sender: TObject);
|
|
|
procedure RxDBLookupCombo1Exit(Sender: TObject);
|
|
|
procedure RxDBLookupCombo5Exit(Sender: TObject);
|
|
|
procedure RxDBLookupCombo8Change(Sender: TObject);
|
|
|
procedure dxDBGrid2CustomDrawCell(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 bsSkinPageControl1Change(Sender: TObject);
|
|
|
procedure t_op_billAfterPost(DataSet: TDataSet);
|
|
|
procedure t_op_billAfterScroll(DataSet: TDataSet);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
function InsertBillStatus(BsNo:string):Boolean;
|
|
|
function DeleteBillStatus(BsNo,or_id:string):Boolean;
|
|
|
function checkwy(client:string):Boolean;
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_op_seae_teshufandan: Tfrm_op_seae_teshufandan;
|
|
|
|
|
|
Guarantee:Boolean;
|
|
|
tefangload:Boolean;
|
|
|
implementation
|
|
|
|
|
|
uses my_sys_function, u_main, u_data_share;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
function Tfrm_op_seae_teshufandan.InsertBillStatus(BsNo:string):Boolean;
|
|
|
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;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_teshufandan.DeleteBillStatus(BsNo,or_id:string):Boolean;
|
|
|
var aAdoQuery:TAdoQuery;
|
|
|
begin
|
|
|
result:=False;
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
with aAdoQuery do
|
|
|
try
|
|
|
if BsNo<>'' then
|
|
|
begin
|
|
|
Close;Sql.Clear;
|
|
|
SQL.Add('delete from t_op_fangdan');
|
|
|
SQL.Add('Where '+BsNo+'');
|
|
|
ExecSQL;
|
|
|
end;
|
|
|
if or_id<>'' then
|
|
|
begin
|
|
|
Close;Sql.Clear;
|
|
|
SQL.Add('delete from t_op_seae_app');
|
|
|
SQL.Add('Where '+or_id+'');
|
|
|
ExecSQL;
|
|
|
end;
|
|
|
finally
|
|
|
aAdoQuery.Free;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
savereggrid(dxdbgrid1,caption);
|
|
|
frm_op_seae_teshufandan.Hide;
|
|
|
frm_op_seae_teshufandan.ManualFloat(frm_op_seae_teshufandan.BoundsRect );
|
|
|
frm_main.freeTabs('frm_op_seae_teshufandan');
|
|
|
action:=cafree;
|
|
|
frm_op_seae_teshufandan:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton10Click(Sender: TObject);
|
|
|
var
|
|
|
str:widestring;
|
|
|
begin
|
|
|
|
|
|
str:='where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>''';
|
|
|
|
|
|
if Edit1.text<>''then
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit1.text+'%'+'''';
|
|
|
if Edit4.text<>''then
|
|
|
str:=str+' and ί<>б<EFBFBD><D0B1><EFBFBD> like '+''''+'%'+Edit4.text+'%'+'''';
|
|
|
if Edit2.text<>''then
|
|
|
str:=str+' and <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5> like '+''''+'%'+Edit2.text+'%'+'''';
|
|
|
if Edit3.text<>''then
|
|
|
str:=str+' and <20><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD> like '+''''+'%'+Edit3.text+'%'+'''';
|
|
|
if wwDBDateTimePicker1.text<>''then
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker1.text+'''';
|
|
|
if wwDBDateTimePicker2.text<>''then
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker2.text+'''';
|
|
|
if wwDBDateTimePicker3.text<>''then
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker3.text+'''';
|
|
|
if wwDBDateTimePicker4.text<>''then
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker4.text+'''';
|
|
|
if RxDBLookupCombo2.DisplayValues[1]<>''then
|
|
|
str:=str+' and ί<>е<EFBFBD>λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
|
|
|
// if RxDBLookupCombo6.DisplayValues[1]<>''then
|
|
|
// str:=str+' and <20><><EFBFBD><EFBFBD>Ա='+''''+RxDBLookupCombo6.DisplayValues[1]+'''';
|
|
|
if wwDBLookupCombo49.text<>''then
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD> like '+''''+'%'+wwDBLookupCombo49.text+'%'+'''';
|
|
|
if Edit7.text<>''then
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD> like '+''''+'%'+Edit7.text+'%'+'''';
|
|
|
if wwDBLookupCombo52.text<>''then
|
|
|
str:=str+' and ж<><D0B6><EFBFBD><EFBFBD> like '+''''+'%'+wwDBLookupCombo52.text+'%'+'''';
|
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+FormatDateTime('yyyy-mm-dd',date)+'''';
|
|
|
|
|
|
str:=str+' and (((ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' ) and EXISTS (SELECT 1 FROM t_op_state WHERE t_op_state.ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' AND t_op_seae.<2E><><EFBFBD><EFBFBD>=t_op_state.<2E><><EFBFBD><EFBFBD>) )';
|
|
|
str:=str+' or ((ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' or ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''Seaway'' or ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD><EFBFBD>ᵥ'') and EXISTS (SELECT 1 FROM t_op_state WHERE t_op_state.ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' AND t_op_seae.<2E><><EFBFBD><EFBFBD>=t_op_state.<2E><><EFBFBD><EFBFBD>))) ';
|
|
|
|
|
|
str:=str+'and <20><><EFBFBD><EFBFBD> not in (select <20><><EFBFBD><EFBFBD> from t_op_fangdan)';
|
|
|
|
|
|
|
|
|
str:=str+'and <20><><EFBFBD><EFBFBD> not in (select <20><><EFBFBD><EFBFBD> from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' or ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'')';
|
|
|
|
|
|
|
|
|
t_op_seae.close;
|
|
|
t_op_seae.sql.clear;
|
|
|
t_op_seae.sql.add('select * from t_op_seae '+str+default_sort(53,'t_op_seae','','desc'));
|
|
|
t_op_seae.open;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton6Click(Sender: TObject);
|
|
|
begin
|
|
|
Edit1.text:='';
|
|
|
Edit4.text:='';
|
|
|
Edit2.text:='';
|
|
|
Edit3.text:='';
|
|
|
wwDBDateTimePicker1.text:='';
|
|
|
wwDBDateTimePicker2.text:='';
|
|
|
RxDBLookupCombo2.ClearValue;
|
|
|
wwDBDateTimePicker3.text:='';
|
|
|
wwDBDateTimePicker4.text:='';
|
|
|
wwDBLookupCombo49.text:='';
|
|
|
Edit7.text:='';
|
|
|
wwDBLookupCombo52.text:='';
|
|
|
RxDBLookupCombo6.ClearValue;
|
|
|
wwDBDateTimePicker5.text:='';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
begin
|
|
|
Column_sort(Column,t_op_seae,'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.N16Click(Sender: TObject);
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid2);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
loadreggrid(dxdbgrid1,true,caption);
|
|
|
wwDBLookupCombo1.displayvalue:=employee;
|
|
|
wwDBDateTimePicker6.Date:=Date;
|
|
|
wwDBDateTimePicker7.Date:=Date;
|
|
|
t_op_bill.Close;
|
|
|
t_op_bill.Parameters.ParamByName('<27><><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;
|
|
|
tefangload:=true;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.N3Click(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
str:widestring;
|
|
|
begin
|
|
|
if t_op_seae.IsEmpty then
|
|
|
exit;
|
|
|
if dxDBGrid1.SelectedCount>=0 then
|
|
|
begin
|
|
|
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
|
|
|
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
|
|
|
if i=0 then
|
|
|
str:='('+''''+t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+''''
|
|
|
else
|
|
|
str:=str+','+''''+t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+'''';
|
|
|
end;
|
|
|
end else begin
|
|
|
str:='('+''''+t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+'''';
|
|
|
end;
|
|
|
str:=str+')';
|
|
|
|
|
|
t_op_seaesel.close;
|
|
|
t_op_seaesel.sql.clear;
|
|
|
t_op_seaesel.sql.add('select * from t_op_seae '
|
|
|
+'where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in '+str
|
|
|
+default_sort(53,'t_op_seae','','desc'));
|
|
|
t_op_seaesel.open;
|
|
|
|
|
|
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ǩ<EFBFBD><C7A9>',2,nil,nil,nil,nil,ds_op_seaesel1,nil,nil,nil,nil,nil,nil);
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.N1Click(Sender: TObject);
|
|
|
var
|
|
|
i,StlDay,qty,moduleqty:integer;
|
|
|
aAdoQueryAmt,aAdoQuery,aAdoQuerycurAmt,aQuery,aQueryDr:TAdoQuery;
|
|
|
AEtd:TDateTime;
|
|
|
JFLX,rqms,FeeItems:string;
|
|
|
StlMonth:integer;
|
|
|
amt,usd,amt1,usd1:double;
|
|
|
aBillQuery,aFeeQuery:TAdoQuery;
|
|
|
lxms,jfrq,jfqx:Integer;
|
|
|
aYear,aMonth,aDay:Word;
|
|
|
SQLStr:string;
|
|
|
aDate:TDateTime;
|
|
|
begin
|
|
|
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>employee then
|
|
|
begin
|
|
|
ShowMessage(t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if wwDBDateTimePicker10.Date-now>20 then
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>ڲ<EFBFBD><DAB2>ܳ<EFBFBD><DCB3><EFBFBD>20<32>죡');
|
|
|
Exit;
|
|
|
end;
|
|
|
amt:=0;
|
|
|
usd:=0;
|
|
|
|
|
|
if checkwy(t_op_seae.fieldbyname('ί<>е<EFBFBD>λ').AsString)then
|
|
|
begin
|
|
|
Label35.Visible:=True;
|
|
|
// t_op_bill.Edit;
|
|
|
Label35.Caption:='<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>ҪΥԼ<CEA5><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
// t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger:=1;
|
|
|
// t_op_bill.Post;
|
|
|
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Label35.Visible:=False;
|
|
|
Label35.Caption:='';
|
|
|
// t_op_bill.Edit;
|
|
|
// t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger:=0;
|
|
|
// t_op_bill.Post;
|
|
|
DBMemo3.Enabled:=False;
|
|
|
end;
|
|
|
|
|
|
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
|
with aAdoQuery do
|
|
|
begin
|
|
|
Close;Sql.Clear;
|
|
|
SQL.Add('Select <20><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ģʽ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales');
|
|
|
SQL.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=:aDate and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>''<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>''');
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if (t_op_bill.FieldByName('״̬').asstring='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')then
|
|
|
begin
|
|
|
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if t_op_bill.FieldByName('ί<>е<EFBFBD>λ').AsString='' then
|
|
|
begin
|
|
|
showmessage('ί<>е<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if t_op_seae.IsEmpty then
|
|
|
exit;
|
|
|
|
|
|
if t_op_bill.IsEmpty then
|
|
|
exit;
|
|
|
|
|
|
bsSkinPageControl1.ActivePageIndex:=1;
|
|
|
|
|
|
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;
|
|
|
|
|
|
aQueryDr:=CreateAdoQuery;
|
|
|
with aQueryDr do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select count(*) rc ');
|
|
|
SQL.Add('From t_ch_fee ');
|
|
|
SQL.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
|
|
|
aAdoQuerycurAmt:=CreateAdoQuery;
|
|
|
with aAdoQuerycurAmt do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select');
|
|
|
SQL.Add('SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when ''USD'' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END ) as USD ');
|
|
|
SQL.Add(',');
|
|
|
SQL.Add('SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as RMB ');
|
|
|
SQL.Add('From t_ch_fee ');
|
|
|
SQL.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>շѣ<D5B7>'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''MCCREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>(<28>շ<EFBFBD>)'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''SMTREF''');
|
|
|
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27>ݷ<EFBFBD><DDB7>Ƶ<EFBFBD><C6B5>շ<EFBFBD>'' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''AUSREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''APLREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''ONEREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''SAFREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''SUDREF'' ');
|
|
|
|
|
|
end;
|
|
|
|
|
|
aAdoQueryAmt:=CreateAdoQuery;
|
|
|
with aAdoQueryAmt do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select');
|
|
|
SQL.Add('SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when ''USD'' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END ) as USD ');
|
|
|
SQL.Add(',');
|
|
|
SQL.Add('SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when ''RMB'' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as RMB ');
|
|
|
SQL.Add('From t_ch_fee ');
|
|
|
SQL.Add('Left Join t_op_seae on t_op_seae.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add('where t_op_seae.ί<>е<EFBFBD>λ=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>շѣ<D5B7>'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''MCCREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>(<28>շ<EFBFBD>)'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''SMTREF''');
|
|
|
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27>ݷ<EFBFBD><DDB7>Ƶ<EFBFBD><C6B5>շ<EFBFBD>'' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''AUSREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''APLREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''ONEREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''SAFREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''SUDREF'' ');
|
|
|
|
|
|
SQL.Add(' and (t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+30)<=:ETD');
|
|
|
end;
|
|
|
|
|
|
aBillQuery:=CreateAdoQuery;
|
|
|
aFeeQuery:=CreateAdoQuery;
|
|
|
frm_main.db.BeginTrans;
|
|
|
try
|
|
|
if dxDBGrid1.SelectedCount>=1 then
|
|
|
begin
|
|
|
for i:=0 to dxDBGrid1.SelectedCount-1 do
|
|
|
begin
|
|
|
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
|
|
|
if (t_op_seae.fieldByName('ί<>е<EFBFBD>λ').AsString=t_op_bill.fieldByName('ί<>е<EFBFBD>λ').AsString)
|
|
|
and (not t_op_seaesel.Locate('<27><><EFBFBD><EFBFBD>',t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>').AsString,[])) then
|
|
|
|
|
|
begin
|
|
|
aQueryDr.Close;
|
|
|
aQueryDr.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
aQueryDr.open;
|
|
|
if aQueryDr.FieldByName('rc').AsInteger=0 then
|
|
|
begin
|
|
|
ShowMessage('<27>ᵥ<EFBFBD>ţ<EFBFBD>'+t_op_seae.fieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString+' δ¼<CEB4><C2BC><EFBFBD>շ<EFBFBD>,<2C><><EFBFBD>ܼ<EFBFBD><DCBC>룡');
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_seaesel.Insert;
|
|
|
t_op_seaesel.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=t_op_bill.fieldByName('BILL_ID').AsInteger;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('ҵ<><D2B5>״̬').AsString:=t_op_seae.fieldByName('ҵ<><D2B5>״̬').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString;
|
|
|
t_op_seaesel.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').Value:=t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>'];
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
t_op_seaesel.FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString:=t_op_seae.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('ί<>е<EFBFBD>λ').AsString:=t_op_seae.fieldByName('ί<>е<EFBFBD>λ').AsString;
|
|
|
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
|
|
|
t_op_seaesel.FieldByName('ж<><D0B6><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldByName('ж<><D0B6><EFBFBD><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').AsString:=t_op_seae.fieldByName('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>˾').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('<27>ᵥǩ<E1B5A5><C7A9>״̬').AsString:=t_op_seae.fieldByName('<27>ᵥǩ<E1B5A5><C7A9>״̬').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>').Value:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD>').AsString;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD>۸<EFBFBD><DBB8><EFBFBD>').Value:=t_op_seae.fieldByName('<27><><EFBFBD>۸<EFBFBD><DBB8><EFBFBD>').Value;
|
|
|
|
|
|
aAdoQuerycurAmt.Close;
|
|
|
aAdoQuerycurAmt.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
aAdoQuerycurAmt.open;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD>RMB').Value:=aAdoQuerycurAmt.FieldByName('RMB').Value;
|
|
|
t_op_seaesel.FieldByName('<27><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD>USD').Value:=aAdoQuerycurAmt.FieldByName('USD').Value;
|
|
|
t_op_seaesel.Post;
|
|
|
amt:=amt+aAdoQuerycurAmt.FieldByName('RMB').Value;
|
|
|
usd:=usd+aAdoQuerycurAmt.FieldByName('USD').Value;
|
|
|
try
|
|
|
InsertBillStatus(t_op_seae.fieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
InsertSeaeStatus(t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD>').AsString,'<27><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>',employee,FormatDateTime('YYYY-MM-DD',Now));
|
|
|
except
|
|
|
on e:exception do ShowMessage(e.message);
|
|
|
end;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>:'+t_op_bill.fieldByName('ί<>е<EFBFBD>λ').AsString+' ѡ<><D1A1><EFBFBD>ͻ<EFBFBD>:'+t_op_seae.fieldByName('ί<>е<EFBFBD>λ').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>');
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
t_op_bill.Edit;
|
|
|
t_op_bill.FieldByName('<27>˿<EFBFBD>RMB').Value:=0;
|
|
|
t_op_bill.FieldByName('<27>˿<EFBFBD>USD').Value:=0;
|
|
|
t_op_bill.Post;
|
|
|
|
|
|
|
|
|
aAdoQuery.Close;
|
|
|
aAdoQuery.Parameters.ParamByName('aDate').Value:=date;
|
|
|
aAdoQuery.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seae.fieldByName('ί<>е<EFBFBD>λ').AsString;
|
|
|
aAdoQuery.open;
|
|
|
if not aAdoQuery.IsEmpty then
|
|
|
JFLX:=aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
else JFLX:='<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
if JFLX='<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
begin
|
|
|
aAdoQueryAmt.Close;
|
|
|
aAdoQueryAmt.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seaesel.FieldByName('ί<>е<EFBFBD>λ').Value;
|
|
|
aAdoQueryAmt.Parameters.ParamByName('ETD').Value:=Date;
|
|
|
aAdoQueryAmt.Open;
|
|
|
t_op_bill.Edit;
|
|
|
t_op_bill.FieldByName('<27>˿<EFBFBD>RMB').Value:=aAdoQueryAmt.FieldByName('RMB').asfloat+amt;
|
|
|
t_op_bill.FieldByName('<27>˿<EFBFBD>USD').Value:=aAdoQueryAmt.FieldByName('USD').asfloat+usd;
|
|
|
t_op_bill.Post;
|
|
|
|
|
|
|
|
|
//2018-6-22<32><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>t_ch_fee<65><65>CH_ID<49><44>t_op_bill_fee<65><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
aFeeQuery.Close;
|
|
|
aFeeQuery.SQL.Clear;
|
|
|
aFeeQuery.SQL.Add('select * from t_ch_fee Left Join t_op_seae on t_op_seae.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
|
|
|
+' where t_op_seae.ί<>е<EFBFBD>λ=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>շѣ<D5B7>'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''MCCREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>(<28>շ<EFBFBD>)'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''SMTREF'' '
|
|
|
+' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''AUSREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''APLREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''ONEREF'' '
|
|
|
+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=:ETD');
|
|
|
aFeeQuery.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seaesel.FieldByName('ί<>е<EFBFBD>λ').Value;
|
|
|
aFeeQuery.Parameters.ParamByName('ETD').Value:=Date;
|
|
|
aFeeQuery.Open;
|
|
|
aFeeQuery.First;
|
|
|
while not aFeeQuery.Eof do
|
|
|
begin
|
|
|
aBillQuery.Close;
|
|
|
aBillQuery.SQL.Clear;
|
|
|
aBillQuery.SQL.Add('insert into t_op_bill_fee (bill_id,ch_id) values ('+t_op_bill.fieldbyname('Bill_ID').AsString
|
|
|
+','+aFeeQuery.fieldbyname('CH_ID').AsString+')' );
|
|
|
aBillQuery.ExecSQL;
|
|
|
aFeeQuery.Next;
|
|
|
end;
|
|
|
|
|
|
//2018-6-22<32><32><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD>
|
|
|
end
|
|
|
else
|
|
|
if GetCrmsales('',t_op_bill.fieldByName('ί<>е<EFBFBD>λ').AsString,'Լ<><D4BC>ʱ<EFBFBD><CAB1>',amt,usd,FeeItems) then
|
|
|
begin
|
|
|
t_op_bill.Edit;
|
|
|
t_op_bill.FieldByName('<27>˿<EFBFBD>RMB').Value:=amt;
|
|
|
t_op_bill.FieldByName('<27>˿<EFBFBD>USD').Value:=usd;
|
|
|
t_op_bill.Post;
|
|
|
//2018-6-22<32><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>t_ch_fee<65><65>CH_ID<49><44>t_op_bill_fee<65><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
with aAdoQuery do
|
|
|
begin
|
|
|
Close;
|
|
|
Sql.Clear;
|
|
|
Sql.Add('select * from t_crm_client_sales');
|
|
|
Sql.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_bill.fieldByName('ί<>е<EFBFBD>λ').Value;
|
|
|
Open;
|
|
|
if aAdoQuery.IsEmpty then Exit;
|
|
|
jflx:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString; //Լ<><D4BC>ʱ<EFBFBD><CAB1> <20>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD> Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').IsNull then lxms:=0 else lxms:=FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').Asinteger; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 1,2 ,3 <20><>
|
|
|
rqms:=FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString; // <20>̶<EFBFBD> <20><><EFBFBD>̶<EFBFBD>
|
|
|
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then jfrq:=0 else jfrq:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asinteger; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then jfqx:=0 else jfqx:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asinteger; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1000<30><30>
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
|
|
|
aDate:=returngetzqdate(t_op_bill.FieldByName('ί<>е<EFBFBD>λ').Asstring,Date);
|
|
|
|
|
|
aFeeQuery.Close;
|
|
|
aFeeQuery.SQL.Clear;
|
|
|
SQLStr:='Select t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,V_op_bscard_All.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>, '
|
|
|
+' SUM(CASE <20><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case <20>ұ<EFBFBD> when ''USD'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END ) as USD, '
|
|
|
+' SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case <20>ұ<EFBFBD> when ''RMB'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as RMB '
|
|
|
+' From t_ch_fee '
|
|
|
+' inner Join V_op_bscard_All on t_ch_fee.<2E><><EFBFBD><EFBFBD>= V_op_bscard_All.<2E><><EFBFBD><EFBFBD> '
|
|
|
+' where t_ch_fee.<2E><><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><:<3A><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD> '
|
|
|
+' Group by t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,V_op_bscard_All.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5> ';
|
|
|
aFeeQuery.SQL.Add(SQLStr);
|
|
|
aFeeQuery.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_bill.fieldByName('ί<>е<EFBFBD>λ').Value;
|
|
|
// aFeeQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=aDate;
|
|
|
aFeeQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').Value:=aDate;
|
|
|
aFeeQuery.Open;
|
|
|
aFeeQuery.First;
|
|
|
while not aFeeQuery.Eof do
|
|
|
begin
|
|
|
aBillQuery.Close;
|
|
|
aBillQuery.SQL.Clear;
|
|
|
aBillQuery.SQL.Add('insert t_op_bill_fee (bill_id,ch_id) select '+t_op_bill.fieldbyname('Bill_ID').AsString
|
|
|
+',ch_id from t_ch_fee where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+quotedstr(t_op_bill.fieldByName('ί<>е<EFBFBD>λ').AsString)
|
|
|
+' and <20><><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD>='+quotedstr(aFeeQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString));
|
|
|
aBillQuery.ExecSQL;
|
|
|
{
|
|
|
aEtd:=aFeeQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime;
|
|
|
aYear:=0;
|
|
|
aMonth:=0;
|
|
|
aDay:=0;
|
|
|
if (jflx='Լ<><D4BC>ʱ<EFBFBD><CAB1>') and (rqms='<27>̶<EFBFBD>') then
|
|
|
begin
|
|
|
DecodeDate(IncMonth(AEtd,lxms),aYear,aMonth,aDay);
|
|
|
case aMonth of
|
|
|
1,3,5,7,8,10,12: ;
|
|
|
2: if jfrq>28 then jfrq:=28;
|
|
|
4,6,9,11: if jfrq>30 then jfrq:=30;
|
|
|
end;
|
|
|
if Date>_getzq(aFeeQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aEtd) then
|
|
|
begin
|
|
|
aBillQuery.Close;
|
|
|
aBillQuery.SQL.Clear;
|
|
|
aBillQuery.SQL.Add('insert into t_op_bill_fee (bill_id,ch_id) values select '+t_op_bill.fieldbyname('Bill_ID').AsString
|
|
|
+',ch_id from t_ch_fee where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+quotedstr(t_op_bill.fieldByName('ί<>е<EFBFBD>λ').AsString)
|
|
|
+' and <20><><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD>='+quotedstr(aFeeQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString));
|
|
|
aBillQuery.ExecSQL;
|
|
|
end;
|
|
|
end;
|
|
|
if jflx='Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
begin
|
|
|
if Date>_getzq(aFeeQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aEtd) then
|
|
|
begin
|
|
|
aBillQuery.Close;
|
|
|
aBillQuery.SQL.Clear;
|
|
|
aBillQuery.SQL.Add('insert into t_op_bill_fee (bill_id,ch_id) values select '+t_op_bill.fieldbyname('Bill_ID').AsString
|
|
|
+',ch_id from t_ch_fee where <20><><EFBFBD><EFBFBD>=''<27><>'' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+quotedstr(t_op_bill.fieldByName('ί<>е<EFBFBD>λ').AsString)
|
|
|
+' and <20><><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD>='+quotedstr(aFeeQuery.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString));
|
|
|
aBillQuery.ExecSQL;
|
|
|
end;
|
|
|
end;
|
|
|
}
|
|
|
aFeeQuery.Next;
|
|
|
end;
|
|
|
|
|
|
//2018-6-22<32><32><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD>
|
|
|
|
|
|
end;
|
|
|
|
|
|
if t_op_bill.state in [dsedit,dsinsert] then
|
|
|
t_op_bill.Post;
|
|
|
frm_main.db.CommitTrans;
|
|
|
finally
|
|
|
if frm_main.db.InTransaction then
|
|
|
frm_main.db.RollbackTrans;
|
|
|
|
|
|
aAdoQueryAmt.Free;
|
|
|
aAdoQuery.Free;
|
|
|
aAdoQuerycurAmt.Free;
|
|
|
FreeAndNil(aQuery);
|
|
|
FreeAndNil(aBillQuery);
|
|
|
FreeAndNil(aFeeQuery);
|
|
|
t_op_seae.Requery();
|
|
|
t_op_seaesel.Requery();
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.MenuItem2Click(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
str,or_id:string;
|
|
|
aQuery,bQuery:TADOQuery;
|
|
|
begin
|
|
|
|
|
|
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>employee then
|
|
|
begin
|
|
|
ShowMessage(t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if (t_op_bill.FieldByName('״̬').asstring<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>')then
|
|
|
begin
|
|
|
showmessage(t_op_bill.FieldByName('״̬').asstring+'ͨ<><CDA8>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if t_op_seaesel.IsEmpty then
|
|
|
exit;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
bQuery:=CreateAdoQuery;
|
|
|
frm_main.db.BeginTrans;
|
|
|
try
|
|
|
if dxDBGrid3.SelectedCount>=1 then
|
|
|
begin
|
|
|
for i:=0 to dxDBGrid3.SelectedCount-1 do
|
|
|
begin
|
|
|
t_op_seaesel.GotoBookmark(pointer(dxDBGrid3.selectedrows[i]));
|
|
|
if str='' then
|
|
|
str:='<27><><EFBFBD><EFBFBD>='+''''+t_op_seaesel.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
|
|
|
else
|
|
|
str:=str+' or <20><><EFBFBD><EFBFBD>='+''''+t_op_seaesel.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
|
|
|
|
|
|
if or_id='' then
|
|
|
or_id:='or_id='+t_op_seaesel.fieldbyname('or_id').AsString
|
|
|
else
|
|
|
or_id:=or_id+' or or_id='+t_op_seaesel.fieldbyname('or_id').AsString;
|
|
|
|
|
|
DelteSeaeStatus(t_op_seaesel.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,'<27><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
end;
|
|
|
if (str<>'') and (or_id<>'') then
|
|
|
begin
|
|
|
str:=' ('+str+')';
|
|
|
or_id:=' ('+or_id+')';
|
|
|
DeleteBillStatus(str,or_id);
|
|
|
end;
|
|
|
|
|
|
frm_main.db.CommitTrans;
|
|
|
finally
|
|
|
t_op_seaesel.Requery();
|
|
|
if frm_main.db.InTransaction then
|
|
|
frm_main.db.RollbackTrans;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.t_op_billAfterInsert(DataSet: TDataSet);
|
|
|
function GetMaxItems:Integer;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
CLose;SQL.Clear;
|
|
|
sql.Add('Select Max(BILL_ID) from t_op_bill_fangdan');
|
|
|
open;
|
|
|
if Fields[0].IsNull then
|
|
|
Result:=1
|
|
|
else
|
|
|
Result:=Fields[0].AsInteger+1;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
begin
|
|
|
DataSet.FieldByName('BILL_ID').AsInteger:=GetMaxItems;
|
|
|
DataSet.FieldByName('״̬').AsString:='<27>½<EFBFBD>ǩ<EFBFBD><C7A9>';
|
|
|
DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=employee;
|
|
|
DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=NOW;
|
|
|
dataset['<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
dataset['<27><><EFBFBD><EFBFBD><EFBFBD>طŵ<D8B7><C5B5><EFBFBD>']:=0;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
t_op_bill.Insert;
|
|
|
// t_op_bill.Post;
|
|
|
bsSkinPageControl1.ActivePageIndex:=1;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton3Click(Sender: TObject);
|
|
|
begin
|
|
|
if wwDBDateTimePicker10.Date-now>20 then
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>ڲ<EFBFBD><DAB2>ܳ<EFBFBD><DCB3><EFBFBD>20<32>죡');
|
|
|
Exit;
|
|
|
end;
|
|
|
if checkwy(RxDBLookupCombo8.DisplayValues[1]) then
|
|
|
begin
|
|
|
if DBMemo3.Text='' then
|
|
|
begin
|
|
|
ShowMessage('<27><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>طű<D8B7><C5B1><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>');
|
|
|
Exit;
|
|
|
end;
|
|
|
t_op_bill.Edit;
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger:=1;
|
|
|
t_op_bill.Post;
|
|
|
end;
|
|
|
if t_op_bill.State in [dsedit,dsinsert] then t_op_bill.Post;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton4Click(Sender: TObject);
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
begin
|
|
|
if t_op_bill.IsEmpty then
|
|
|
exit;
|
|
|
if t_op_bill.FieldByName('״̬').asstring<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
|
|
|
begin
|
|
|
showmessage(t_op_bill.FieldByName('״̬').asstring+'ͨ<><CDA8>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if t_op_seaesel.RecordCount>=1 then
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD>ڷŵ<DAB7><C5B5><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>,<2C><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>ϸ');
|
|
|
exit;
|
|
|
end;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
with aQuery do
|
|
|
begin
|
|
|
Close;
|
|
|
SQL.Clear;
|
|
|
SQL.Add('delete t_op_bill_fee where bill_id='+t_op_bill.fieldbyname('BILL_ID').AsString);
|
|
|
ExecSQL;
|
|
|
end;
|
|
|
t_op_bill.Delete;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton7Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_op_bill.IsEmpty then
|
|
|
exit;
|
|
|
t_op_bill.Cancel;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton8Click(Sender: TObject);
|
|
|
begin
|
|
|
Close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton12Click(Sender: TObject);
|
|
|
var aDate:TDateTime;
|
|
|
aAdoQuery,aQuery:TAdoQuery;
|
|
|
AccoutDesc:string;
|
|
|
billcount:Integer;
|
|
|
begin
|
|
|
{
|
|
|
if (t_op_bill.FieldByName('״̬').AsString='<27>½<EFBFBD>ǩ<EFBFBD><C7A9>')
|
|
|
|
|
|
or (t_op_bill.FieldByName('״̬').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
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);
|
|
|
billcount:=0;
|
|
|
//ShowMessage(datetostr(aDate));
|
|
|
{
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add(' select count(*) rt from t_op_seae where ί<>е<EFBFBD>λ='''+t_op_bill.FieldByName('ί<>е<EFBFBD>λ').Asstring+''' and ');
|
|
|
sql.Add(' (װ<>˷<EFBFBD>ʽ<>''ƴ<><C6B4><EFBFBD><EFBFBD>Ʊ'' and װ<>˷<EFBFBD>ʽ<>''½<><C2BD>'') and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>'' and <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5><>'''' and ǩ<><C7A9><EFBFBD><EFBFBD>ʽ<>'''' and ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' ');
|
|
|
sql.Add(' and <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'') and <20><><EFBFBD><EFBFBD> not in (select <20><><EFBFBD><EFBFBD> from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'') ');
|
|
|
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
}
|
|
|
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(',SUM(CASE <20><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case <20>ұ<EFBFBD> when ''USD'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END ) as AMTUSD ');
|
|
|
SQL.Add(',');
|
|
|
SQL.Add('SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN ''<27><>'' THEN (case <20>ұ<EFBFBD> when ''RMB'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as AMTRMB ');
|
|
|
|
|
|
sql.Add('From t_ch_fee');
|
|
|
sql.Add('inner Join v_op_bscard on t_ch_fee.<2E><><EFBFBD><EFBFBD>= v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
sql.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>շѣ<D5B7>'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''MCCREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''<27><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>(<28>շ<EFBFBD>)'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''SMTREF''');
|
|
|
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''AUSREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''APLREF'' AND t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>''ONEREF'' ');
|
|
|
|
|
|
// sql.Add('from v_op_bscard ');
|
|
|
sql.Add(' and ί<>е<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('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_bill.FieldByName('ί<>е<EFBFBD>λ').Asstring;
|
|
|
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_teshufandan.t_op_seaeselBeforeDelete(
|
|
|
DataSet: TDataSet);
|
|
|
begin
|
|
|
if not t_op_bill.IsEmpty then
|
|
|
begin
|
|
|
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
|
|
|
begin
|
|
|
ShowMessage(t_op_bill.FieldByName('״̬').AsString+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>employee then
|
|
|
begin
|
|
|
ShowMessage(t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.t_op_billBeforeEdit(DataSet: TDataSet);
|
|
|
begin
|
|
|
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
|
|
|
begin
|
|
|
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>employee then
|
|
|
begin
|
|
|
ShowMessage(t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.t_op_billBeforeDelete(
|
|
|
DataSet: TDataSet);
|
|
|
begin
|
|
|
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
|
|
|
begin
|
|
|
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
|
|
|
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>employee then
|
|
|
begin
|
|
|
ShowMessage(t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.t_op_seaeselBeforeEdit(
|
|
|
DataSet: TDataSet);
|
|
|
begin
|
|
|
if t_op_bill.FieldByName('״̬').AsString<>'<27>½<EFBFBD>ǩ<EFBFBD><C7A9>' then
|
|
|
begin
|
|
|
ShowMessage('<27><>ǰ״̬'+t_op_bill.FieldByName('״̬').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
|
|
|
if t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>employee then
|
|
|
begin
|
|
|
ShowMessage(t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinButton38Click(Sender: TObject);
|
|
|
begin
|
|
|
t_op_bill.Refresh;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.RxDBLookupCombo8Enter(Sender: TObject);
|
|
|
begin
|
|
|
RxLookupComboEnter(RxDBLookupCombo8);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.RxDBLookupCombo8Exit(Sender: TObject);
|
|
|
begin
|
|
|
if checkwy(RxDBLookupCombo8.DisplayValues[1])then
|
|
|
begin
|
|
|
Label35.Visible:=True;
|
|
|
Label35.Caption:='<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger:=1;
|
|
|
DBMemo3.Enabled:=True;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Label35.Visible:=False;
|
|
|
Label35.Caption:='';
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger:=0;
|
|
|
DBMemo3.Enabled:=False;
|
|
|
end;
|
|
|
RxLookupComboExit(RxDBLookupCombo8);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.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_teshufandan.bsSkinButton11Click(Sender: TObject);
|
|
|
begin
|
|
|
with t_op_bill do
|
|
|
begin
|
|
|
Close;
|
|
|
sql.Clear;
|
|
|
sql.Add('select * from t_op_bill_fangdan');
|
|
|
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :date1 and :date2 and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
sql.Add('order by BILL_ID DESC');
|
|
|
Parameters.ParamByName('date1').Value:=wwDBDateTimePicker6.Date;
|
|
|
Parameters.ParamByName('date2').Value:=wwDBDateTimePicker7.Date;
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=wwDBLookupCombo1.DisplayValue;
|
|
|
Open;
|
|
|
end;
|
|
|
//
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.dxDBGrid1Column90CustomDraw(
|
|
|
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[dxDBGrid1Column90.Index]))='TRUE' then
|
|
|
AColor:=clred;
|
|
|
AFont.Color:=clblack;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.t_op_billBeforePost(DataSet: TDataSet);
|
|
|
var
|
|
|
dfcount,zbcount,dztdcount,seawaycount:Integer;
|
|
|
begin
|
|
|
if (ADOQuery2.Active) then ADOQuery2.Close;
|
|
|
ADOQuery2.SQL.Clear;
|
|
|
ADOQuery2.SQL.Add('select count(1) ZBCOUNT ');
|
|
|
ADOQuery2.SQL.Add(' from t_op_seae where ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>'' ');
|
|
|
ADOQuery2.SQL.Add(' and <20>ᵥǩ<E1B5A5><C7A9>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' and not EXISTS (select 1 from t_op_state where (t_op_state.ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' or 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+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=getdate() ');
|
|
|
ADOQuery2.Open;
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=ADOQuery2.fieldbyname('ZBCOUNT').asinteger;
|
|
|
ADOQuery2.SQL.Clear;
|
|
|
ADOQuery2.SQL.Add('select sum(case when ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end) DFCOUNT ');
|
|
|
ADOQuery2.SQL.Add(',sum(case when ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD><EFBFBD>ᵥ'' then 1 else 0 end) DZTDCOUNT from t_op_seae where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>'' ');
|
|
|
ADOQuery2.SQL.Add(' and not EXISTS (select 1 from t_op_state where (t_op_state.ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' or 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+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=getdate() and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=''2023-06-01''');
|
|
|
ADOQuery2.Open;
|
|
|
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>طŵ<D8B7><C5B5><EFBFBD>').AsInteger:=ADOQuery2.fieldbyname('DFCOUNT').asinteger;
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>طŵ<D8B7><C5B5><EFBFBD><EFBFBD>ᵥ').AsInteger:=ADOQuery2.fieldbyname('DZTDCOUNT').asinteger;
|
|
|
ADOQuery2.Close;
|
|
|
ADOQuery2.SQL.Clear;
|
|
|
ADOQuery2.SQL.Add('select count(1) ZBCOUNT ');
|
|
|
ADOQuery2.SQL.Add(' from t_op_seae where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>'' ');
|
|
|
ADOQuery2.SQL.Add(' and ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''seaway'' and not EXISTS (select 1 from t_op_state where (t_op_state.ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' or 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+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=GETDATE()-60 and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=getdate() ');
|
|
|
ADOQuery2.Open;
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD>SEAWAY').AsInteger:=ADOQuery2.fieldbyname('ZBCOUNT').asinteger;
|
|
|
|
|
|
t_op_seaesel.First;
|
|
|
while not t_op_seaesel.Eof do begin
|
|
|
if (t_op_seaesel.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').AsString='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
zbcount:=zbcount+1;
|
|
|
end;
|
|
|
if (t_op_seaesel.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').AsString='<27><><EFBFBD><EFBFBD>') then begin
|
|
|
dfcount:=dfcount+1;
|
|
|
end;
|
|
|
if (t_op_seaesel.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').AsString='Seaway') then begin
|
|
|
seawaycount:=seawaycount+1;
|
|
|
end;
|
|
|
if (t_op_seaesel.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD>ʽ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD>ᵥ') then begin
|
|
|
dztdcount:=dztdcount+1;
|
|
|
end;
|
|
|
t_op_seaesel.Next;
|
|
|
end;
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3>').AsInteger:=t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>').AsInteger-zbcount;
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>طŵ<D8B7><C5B5><EFBFBD>ʣ<EFBFBD><CAA3>').AsInteger:=t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>طŵ<D8B7><C5B5><EFBFBD>').AsInteger-dfcount;
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD>SEAWAYʣ<59><CAA3>').AsInteger:=t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD>SEAWAY').AsInteger-seawaycount;
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>طŵ<D8B7><C5B5><EFBFBD><EFBFBD>ᵥʣ<E1B5A5><CAA3>').AsInteger:=t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>طŵ<D8B7><C5B5><EFBFBD><EFBFBD>ᵥ').AsInteger-dztdcount;
|
|
|
|
|
|
{
|
|
|
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>35 then
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>ڲ<EFBFBD><DAB2>ܳ<EFBFBD><DCB3><EFBFBD>35<33>죡');
|
|
|
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_teshufandan.RxDBLookupCombo12Enter(Sender: TObject);
|
|
|
begin
|
|
|
TRxDBLookupCombo(Sender).LookupDisplay:='<27><><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.RxDBLookupCombo1Enter(Sender: TObject);
|
|
|
begin
|
|
|
TRxDBLookupCombo(Sender).LookupDisplay:='<27><><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.RxDBLookupCombo5Enter(Sender: TObject);
|
|
|
begin
|
|
|
TRxDBLookupCombo(Sender).LookupDisplay:='<27><><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.RxDBLookupCombo12Exit(Sender: TObject);
|
|
|
begin
|
|
|
TRxDBLookupCombo(Sender).LookupDisplay:='<27><><EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.RxDBLookupCombo1Exit(Sender: TObject);
|
|
|
begin
|
|
|
TRxDBLookupCombo(Sender).LookupDisplay:='<27><><EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.RxDBLookupCombo5Exit(Sender: TObject);
|
|
|
begin
|
|
|
TRxDBLookupCombo(Sender).LookupDisplay:='<27><><EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
|
|
|
function Tfrm_op_seae_teshufandan.checkwy(client:string):Boolean;
|
|
|
var
|
|
|
aAdoQuery:TADOQuery;
|
|
|
i:Integer;
|
|
|
begin
|
|
|
result:=false;
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
with aAdoQuery do
|
|
|
begin
|
|
|
Close;
|
|
|
SQL.Clear;
|
|
|
SQL.Add('select * from t_op_bill_fangdanwy where ί<>е<EFBFBD>λ='+quotedstr(client)+' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD> desc' );
|
|
|
Open;
|
|
|
end;
|
|
|
aAdoQuery.First;
|
|
|
i:=0;
|
|
|
while not aAdoQuery.Eof do
|
|
|
begin
|
|
|
if aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger=0 then i:=i+1 else Break;
|
|
|
if not aAdoQuery.FieldByName('ΥԼ<CEA5><D4BC>־').AsBoolean then Break;
|
|
|
if i=1 then Result:=True;
|
|
|
|
|
|
// if i=2 then Result:=True;
|
|
|
if Result then Break;
|
|
|
aAdoQuery.Next;
|
|
|
end;
|
|
|
FreeAndNil(aAdoQuery);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.RxDBLookupCombo8Change(Sender: TObject);
|
|
|
begin
|
|
|
|
|
|
if checkwy(RxDBLookupCombo8.DisplayValues[1])then
|
|
|
begin
|
|
|
Label35.Visible:=True;
|
|
|
Label35.Caption:='<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>ҪΥԼ<CEA5><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
if (t_op_bill.State in [dsedit,dsinsert]) then
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger:=1;
|
|
|
DBMemo3.Enabled:=True;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Label35.Visible:=False;
|
|
|
Label35.Caption:='';
|
|
|
if (t_op_bill.State in [dsedit,dsinsert]) then
|
|
|
t_op_bill.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־').AsInteger:=0;
|
|
|
DBMemo3.Enabled:=False;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.dxDBGrid2CustomDrawCell(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);
|
|
|
var
|
|
|
sValues : string;
|
|
|
begin
|
|
|
if not VarIsNull(ANode.Values[dxDBGrid2Column18.Index]) then
|
|
|
begin
|
|
|
sValues :=ANode.Values[dxDBGrid2Column18.Index];
|
|
|
if StrToIntDef(sValues,0) = 1 then afont.Color:=$00C080FF;
|
|
|
end;
|
|
|
if not VarIsNull(ANode.Values[dxDBGrid2Column17.Index]) then
|
|
|
begin
|
|
|
sValues :=ANode.Values[dxDBGrid2Column17.Index];
|
|
|
if StrToIntDef(sValues,0) = 1 then afont.Color:=clred;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.bsSkinPageControl1Change(
|
|
|
Sender: TObject);
|
|
|
begin
|
|
|
if (not tefangload) 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_teshufandan.t_op_billAfterPost(DataSet: TDataSet);
|
|
|
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;
|
|
|
|
|
|
procedure Tfrm_op_seae_teshufandan.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.
|