You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

884 lines
28 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_op_fee;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB,
ADODB, dxDBTLCl, dxGrClms, ExtCtrls, RxLookup, StdCtrls,DateUtils,
wwdbdatetimepicker, Mask, wwdbedit, Wwdotdot, Wwdbcomb, DBCtrls, wwdblook,
Menus, DBCtrlsEh, DBLookupEh, dxGrClEx, ComCtrls, bsSkinBoxCtrls;
type
Tfrm_op_fee = class(TForm)
bsSkinPanel1: TbsSkinPanel;
dxDBGrid1: TdxDBGrid;
t_op_fee: TADOQuery;
t_op_fee1: TDataSource;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column3: TdxDBGridDateColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column5: TdxDBGridMaskColumn;
dxDBGrid1Column7: TdxDBGridMaskColumn;
dxDBGrid1Column8: TdxDBGridDateColumn;
Panel1: TPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
Label9: TLabel;
RxDBLookupCombo2: TRxDBLookupCombo;
Label23: TLabel;
RxDBLookupCombo7: TRxDBLookupCombo;
Label1: TLabel;
Label2: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBComboBox1: TwwDBComboBox;
Label3: TLabel;
wwDBComboBox2: TwwDBComboBox;
Label4: TLabel;
DBEdit1: TDBEdit;
DBMemo1: TDBMemo;
Label5: TLabel;
dxDBGrid1Column6: TdxDBGridColumn;
Label6: TLabel;
RxDBLookupCombo9: TRxDBLookupCombo;
dxDBGrid1Column9: TdxDBGridColumn;
Label91: TLabel;
wwDBComboBox4: TwwDBComboBox;
Label95: TLabel;
RxDBLookupCombo15: TRxDBLookupCombo;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridColumn;
bsSkinButton6: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
DBEdit2: TDBEdit;
Label11: TLabel;
Label12: TLabel;
DBEdit3: TDBEdit;
dxDBGrid1Column14: TdxDBGridColumn;
dxDBGrid1Column16: TdxDBGridColumn;
dxDBGrid1Column15: TdxDBGridColumn;
dxDBGrid1Column17: TdxDBGridColumn;
dxDBGrid1Column18: TdxDBGridColumn;
PopupMenu2: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N13: TMenuItem;
N12: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N1: TMenuItem;
N3: TMenuItem;
N2: TMenuItem;
N4: TMenuItem;
bsSkinButton9: TbsSkinButton;
ADOQuery_bc: TADOQuery;
ADOQuery_cost: TADOQuery;
Label13: TLabel;
ADOQuery_bc1: TDataSource;
ADOQuery_cost1: TDataSource;
Label14: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
RxDBLookupCombo3: TRxDBLookupCombo;
dxDBGrid1Column19: TdxDBGridColumn;
dxDBGrid1Column20: TdxDBGridLookupColumn;
Label15: TLabel;
RxDBLookupCombo5: TRxDBLookupCombo;
RxDBLookupCombo6: TRxDBLookupCombo;
Label16: TLabel;
dxDBGrid1Column21: TdxDBGridCheckColumn;
Label36: TLabel;
RxDBLookupCombo11: TRxDBLookupCombo;
Label19: TLabel;
DBEdit4: TDBEdit;
dxDBGrid1Column22: TdxDBGridColumn;
DBEdit5: TDBEdit;
Label20: TLabel;
bsSkinPanel10: TbsSkinPanel;
Label49: TLabel;
wwDBDateTimePicker9: TwwDBDateTimePicker;
Label52: TLabel;
wwDBDateTimePicker12: TwwDBDateTimePicker;
Label7: TLabel;
RxDBLookupCombo4: TRxDBLookupCombo;
Label17: TLabel;
RxDBLookupCombo8: TRxDBLookupCombo;
Label18: TLabel;
RxDBLookupCombo10: TRxDBLookupCombo;
Label8: TLabel;
wwDBComboBox31: TwwDBComboBox;
Label10: TLabel;
wwDBComboBox3: TwwDBComboBox;
bsSkinButton8: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinPanel15: TbsSkinPanel;
bsSkinButton54: TbsSkinButton;
bsSkinButton53: TbsSkinButton;
bsSkinDateEdit1: TbsSkinDateEdit;
bsSkinLabel1: TbsSkinLabel;
dxDBGrid1Column23: TdxDBGridColumn;
procedure t_op_feeAfterInsert(DataSet: TDataSet);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure t_op_feeBeforePost(DataSet: TDataSet);
procedure FormShow(Sender: TObject);
procedure RxDBLookupCombo9Enter(Sender: TObject);
procedure RxDBLookupCombo9Exit(Sender: TObject);
procedure t_op_feeBeforeDelete(DataSet: TDataSet);
procedure t_op_feeBeforeEdit(DataSet: TDataSet);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure dxDBGrid1Column10CustomDraw(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 N10Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure RxDBLookupCombo3Enter(Sender: TObject);
procedure RxDBLookupCombo3Exit(Sender: TObject);
procedure RxDBLookupCombo3Change(Sender: TObject);
procedure RxDBLookupCombo5Enter(Sender: TObject);
procedure RxDBLookupCombo5Exit(Sender: TObject);
procedure RxDBLookupCombo5Change(Sender: TObject);
procedure dxDBGrid1CustomDraw(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 bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton54Click(Sender: TObject);
procedure bsSkinButton53Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetBankAccid(fdataSet:TDataSet):String;
function NewDrCrVou(fDataSet:TDataSet):String;
function InsertVouItems(fDataSet:TDataSet):String;
function GetVouNo:String;
function EditFieldVlaueZeros(FieldVlaue:string;len:integer):String;
function GetEmpID(EmplName:String):String;
function GetDeptID(DeptName:String):String;
end;
var
frm_op_fee: Tfrm_op_fee;
implementation
uses u_main, u_data_share, my_sys_function, dmAccu;
{$R *.dfm}
function Tfrm_op_fee.GetEmpID(EmplName:String):String;
begin
with dmAcc.tempQuery do
try
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+EmplName+'''');
Open;
if not FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else Result:='0';
finally
Close;
end;
end;
function Tfrm_op_fee.GetDeptID(DeptName:String):String;
var
aQry:TAdoQuery;
begin
aQry:=CreateadoQuery;
try
aQry.Close;
aQry.SQL.Clear;
aQry.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_department where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+DeptName+'''');
aQry.Open;
result:=aQry.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
finally
FreeAndNil(aQry);
end;
end;
function Tfrm_op_fee.EditFieldVlaueZeros(FieldVlaue:string;len:integer):String;
begin
Result:='';
while Length(FieldVlaue)<3 do
FieldVlaue:='0'+FieldVlaue;
Result:=FieldVlaue;
end;
function Tfrm_op_fee.GetVouNo:String;
var i :integer;
aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('select vouno from t_op_fee where OF_ID=(select max(OF_ID) from t_op_fee )');
Open;
if IsEmpty then begin
Close;SQL.Clear;
SQL.Add('select vouno from t_op_fee where OF_ID=(select max(OF_ID) from t_op_fee )');
Open;
end;
try
i:=strtoint(aQuery.fieldbyname('vouno').AsString);
result:=inttostr(i+1);
result:=EditFieldVlaueZeros(result,3);
except
;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_fee.t_op_feeAfterInsert(DataSet: TDataSet);
begin
// t_op_fee['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=DATE;
t_op_fee['<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>']:='<27><>';
t_op_fee['<27><><EFBFBD><EFBFBD>״̬']:='¼<><C2BC>״̬';
t_op_fee['<27><><EFBFBD><EFBFBD>']:=0;
t_op_fee['<27>ұ<EFBFBD>']:='RMB';
t_op_fee['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_op_fee['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_fee['ITEMNO']:=1;
t_op_fee['<27><><EFBFBD><EFBFBD>']:=1;
t_op_fee['<27><>ע']:='';
t_op_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա']:='';
t_op_fee['ACCID_COST']:='';
t_op_fee['ACCID_COSTNAME']:='';
t_op_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD><EFBFBD>';
t_op_fee.fieldByName('VouNO').value:=GetVouNo;
end;
procedure Tfrm_op_fee.bsSkinButton1Click(Sender: TObject);
begin
t_op_fee.insert;
end;
procedure Tfrm_op_fee.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_op_fee);
end;
procedure Tfrm_op_fee.bsSkinButton4Click(Sender: TObject);
begin
table_delete(t_op_fee);
end;
procedure Tfrm_op_fee.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_op_fee);
end;
procedure Tfrm_op_fee.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_fee.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ADOQuery_bc.Close;
ADOQuery_cost.Close;
savereggrid(dxdbgrid1,caption+'1');
frm_op_fee.Hide;
frm_op_fee.ManualFloat(frm_op_fee.BoundsRect );
frm_main.freeTabs('frm_op_fee');
action:=cafree;
frm_op_fee:=nil;
end;
procedure Tfrm_op_fee.t_op_feeBeforePost(DataSet: TDataSet);
begin
if not t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').IsNull then
begin
t_op_fee.fieldByName('Accyear').value:=Yearof(t_op_fee.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value);
t_op_fee.fieldByName('AccMonth').value:=Monthof(t_op_fee.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value);
end;
table_before_post(t_op_fee,'<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>');
table_before_post(t_op_fee,'<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>');
table_before_post(t_op_fee,'<27><><EFBFBD><EFBFBD>');
table_before_post(t_op_fee,'<27>ұ<EFBFBD>');
if trim(t_op_fee.fieldByName('<27><><EFBFBD>ʽ').value)='֧Ʊ' then
if trim(t_op_fee.FieldByName('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)='' then
begin
showmessage('<27><><EFBFBD>ʽΪ֧Ʊ֧Ʊ<D6A7>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
abort;
end;
if 1=1 then
// if StrToBool(get_parameters_value(83,'false')) then
begin
if frm_data_share.t_sys_bank.Locate('<27><><EFBFBD><EFBFBD>',RxDBLookupCombo15.Value,[]) then
if Trim(t_op_fee.fieldbyname('<27>ұ<EFBFBD>').asstring)='RMB' THEN
begin
t_op_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring:=frm_data_share.t_sys_bank.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_op_fee.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring:='';
end
else
begin
t_op_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring:='';
t_op_fee.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asstring:=frm_data_share.t_sys_bank.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if Trim(t_op_fee.fieldbyname('<27>ұ<EFBFBD>').asstring)='RMB' THEN
begin
t_op_fee.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').asFloat:=t_op_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat;
t_op_fee.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asFloat:=0;
end
else
begin
t_op_fee.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').asFloat:=0;
t_op_fee.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asFloat:=t_op_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asFloat;
end;
end;
end;
procedure Tfrm_op_fee.FormShow(Sender: TObject);
begin
bsSkinPanel15.Visible:=false;
bsSkinDateEdit1.Date:=Date;
loadreggrid(dxdbgrid1,true,caption+'1');
ADOQuery_bc.Open;
ADOQuery_cost.Open;
t_op_fee.close;
t_op_fee.sql.clear;
t_op_fee.sql.add('select top 100 * from t_op_fee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' and <20><><EFBFBD><EFBFBD>=0 and ¼<><C2BC><EFBFBD><EFBFBD>='+''''+employee+''''+' order by of_id');
t_op_fee.open;
wwDBDateTimePicker1.MinDate:=Logininfo.endday+1;
RxDBLookupCombo11.value:=Employee;
if not if_open('345') then begin
bsSkinButton6.Enabled:=false;
bsSkinButton7.Enabled:=false;
end;
end;
procedure Tfrm_op_fee.RxDBLookupCombo9Enter(Sender: TObject);
begin
RxDBLookupCombo9.LookupDisplay:='<27><><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
procedure Tfrm_op_fee.RxDBLookupCombo9Exit(Sender: TObject);
begin
RxDBLookupCombo9.LookupDisplay:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
procedure Tfrm_op_fee.t_op_feeBeforeDelete(DataSet: TDataSet);
var
sdate:tdate;
begin
if t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then
begin
showmessage('<27><><EFBFBD><EFBFBD>״̬Ϊ<CCAC><CEAA><EFBFBD><EFBFBD>״̬,<2C><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>');
abort;
end;
sdate:=EncodeDate(Logininfo.offyear,Logininfo.offmonth,1);
if not t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').IsNull then
if sdate>t_op_fee['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>'] then begin
showmessage('<27>ѽ<EFBFBD><D1BD>˲<EFBFBD><CBB2><EFBFBD>ɾ<EFBFBD><C9BE>!');
abort;
end;
end;
procedure Tfrm_op_fee.t_op_feeBeforeEdit(DataSet: TDataSet);
var
sdate:tdate;
begin
if not modify_all then
if t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then
begin
showmessage('<27><><EFBFBD><EFBFBD>״̬Ϊ<CCAC><CEAA><EFBFBD><EFBFBD>״̬,<2C><><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8>');
abort;
end;
sdate:=EncodeDate(Logininfo.offyear,Logininfo.offmonth,1);
if not t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').IsNull then
if sdate>t_op_fee['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>'] then begin
showmessage('<27>ѽ<EFBFBD><D1BD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD>޸<EFBFBD>!');
abort;
end;
end;
procedure Tfrm_op_fee.bsSkinButton8Click(Sender: TObject);
begin
with t_op_fee do begin
close;sql.Clear;
sql.Add('select * from t_op_fee where 1=1 and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>''');
if wwDBDateTimePicker9.text<>'' then
sql.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='''+wwDBDateTimePicker9.text+'''');
if wwDBDateTimePicker12.text<>'' then
sql.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='''+wwDBDateTimePicker12.text+'''');
if RxDBLookupCombo4.DisplayValue<>''then
sql.Add(' and <20><><EFBFBD>ؿͻ<D8BF>='''+RxDBLookupCombo4.DisplayValues[1]+'''');
if RxDBLookupCombo8.DisplayValue<>''then
sql.Add(' and <20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>='''+RxDBLookupCombo8.DisplayValues[1]+'''');
if RxDBLookupCombo10.DisplayValue<>''then
sql.Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա='''+RxDBLookupCombo10.DisplayValues[1]+'''');
if wwDBComboBox31.text<>'' then
sql.Add(' and <20>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>='''+wwDBComboBox31.text+'''');
if wwDBComboBox3.text<>'' then
begin
case wwDBComboBox3.ItemIndex of
0: begin
sql.Add(' and ҵ<>񻹿<EFBFBD>=0');
end;
1: begin
sql.Add(' and ҵ<>񻹿<EFBFBD>=1');
end;
end;
end;
open;
end;
end;
procedure Tfrm_op_fee.bsSkinButton6Click(Sender: TObject);
var i:Integer;
begin
if not t_op_fee.Active then exit;
if t_op_fee.IsEmpty then exit;
if dxDBGrid1.SelectedCount>=1 then
for i:=0 to dxDBGrid1.SelectedCount-1 do
begin
t_op_fee.GotoBookmark(pointer(dxdbgrid1.selectedrows[i]));
if t_op_fee['<27><><EFBFBD><EFBFBD>'] then
begin
Showmessage(t_op_fee.FieldByName('VOUNO').AsString+' '+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤,<2C><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
end
else
begin
if t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then
begin
t_op_fee.Edit;
t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>';
t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=employee;
t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asdatetime:=date;
t_op_fee.post;
end;
end;
end;
end;
procedure Tfrm_op_fee.bsSkinButton7Click(Sender: TObject);
var i:Integer;
begin
if not t_op_fee.Active then exit;
if t_op_fee.IsEmpty then exit;
if dxDBGrid1.SelectedCount>=1 then
for i:=0 to dxDBGrid1.SelectedCount-1 do
begin
t_op_fee.GotoBookmark(pointer(dxdbgrid1.selectedrows[I]));
if t_op_fee['<27><><EFBFBD><EFBFBD>'] then
begin
Showmessage(t_op_fee.FieldByName('VOUNO').AsString+' '+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤,<2C><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
end
else
begin
if t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>' then
begin
modify_all:=True;
t_op_fee.Edit;
t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString:='¼<><C2BC>״̬';
t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='';
t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=null;
t_op_fee.post;
modify_all:=False;
end;
end;
end;
end;
procedure Tfrm_op_fee.dxDBGrid1Column10CustomDraw(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
AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid1Column10.Index]);
AFont.Color:=clblack;
end;
procedure Tfrm_op_fee.N10Click(Sender: TObject);
begin
update_grid_view_no(dxdbgrid1);
end;
procedure Tfrm_op_fee.N14Click(Sender: TObject);
begin
update_grid_view_all(dxdbgrid1);
end;
procedure Tfrm_op_fee.N12Click(Sender: TObject);
begin
update_grid(dxdbgrid1,211);
end;
procedure Tfrm_op_fee.N16Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid1);
end;
procedure Tfrm_op_fee.N3Click(Sender: TObject);
begin
dxdbgrid1.FullExpand;
end;
procedure Tfrm_op_fee.N4Click(Sender: TObject);
begin
dxdbgrid1.FullCollapse;
end;
procedure Tfrm_op_fee.RxDBLookupCombo3Enter(Sender: TObject);
begin
RxDBLookupCombo3.LookupDisplay:='ACCID;ACCNAME';
end;
procedure Tfrm_op_fee.RxDBLookupCombo3Exit(Sender: TObject);
begin
RxDBLookupCombo3.LookupDisplay:='accname';
end;
procedure Tfrm_op_fee.RxDBLookupCombo3Change(Sender: TObject);
begin
if t_op_fee1.DataSet=nil then
exit;
if t_op_fee1.DataSet.State in [dsinsert,dsEdit] then
begin
if ADOQuery_cost.Locate('accid',trim(t_op_fee.fieldbyname('accid_COST').asstring),[])then
begin
t_op_fee1.DataSet['accid_COSTname']:=ADOQuery_cost.fieldbyname('Accname').asstring;
end;
end;
end;
procedure Tfrm_op_fee.RxDBLookupCombo5Enter(Sender: TObject);
begin
RxDBLookupCombo5.LookupDisplay:='ACCID;ACCNAME';
end;
procedure Tfrm_op_fee.RxDBLookupCombo5Exit(Sender: TObject);
begin
RxDBLookupCombo5.LookupDisplay:='accname';
end;
procedure Tfrm_op_fee.RxDBLookupCombo5Change(Sender: TObject);
begin
if t_op_fee1.DataSet=nil then
exit;
if t_op_fee1.DataSet.State in [dsinsert,dsEdit] then
begin
if ADOQuery_bc.Locate('accid',trim(t_op_fee.fieldbyname('accid_bc').asstring),[])then
begin
t_op_fee1.DataSet['accid_bcname']:=ADOQuery_bc.fieldbyname('Accname').asstring;
end;
end;
end;
procedure Tfrm_op_fee.dxDBGrid1CustomDraw(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(ANode.Strings[dxDBGrid1Column21.Index])='TRUE' then begin
AColor:=$00FBE8FF;
exit;
end;
end;
function Tfrm_op_fee.GetBankAccid(fdataSet:TDataSet):String;
var
aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
with aQuery do
try
Close;sql.Clear;
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_bank');
sql.Add('where <20><><EFBFBD><EFBFBD>='''+fDataSet.fieldbyname('<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString+'''');
Open;
if Recordcount<>0 then
result:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
result:='';
finally
freeAndNil(aQuery);
end;
end;
function Tfrm_op_fee.InsertVouItems(fDataSet:TDataSet):String;
begin
end;
function Tfrm_op_fee.NewDrCrVou(fDataSet:TDataSet):String;
var
BankAccid,DC:String;
amt,Exrate:double;
begin
Result:='';
try
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=3;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
dmAcc.AdotblVou.FieldByName('Voudate').value:=FormatDateTime('YYYY-MM-DD',t_op_fee.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime);
dmAcc.AdotblVou.FieldByName('ACCYEAR').value:=yearof(t_op_fee.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime);
dmAcc.AdotblVou.FieldByName('ACCMonth').value:=monthof(t_op_fee.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime);
VoucherDate:=StrToDate(FormatDateTime('YYYY-MM-DD',t_op_fee.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime));
{
if Trim(AccInfo.TransName)<>'' then
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=AccInfo.TransName
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
}
dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo11.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
with fDataSet do
begin
open;First;
while not eof do
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=FieldByName('ACCID_COST').AsString;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:=FieldByName('<27>ұ<EFBFBD>').AsString;
if trim(FieldByName('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><>' then
begin
if trim(FieldByName('<27>ұ<EFBFBD>').AsString)='RMB' then
begin
dmAcc.AdotblVouItems.FieldByName('AmtDr').Asstring:=formatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').Asstring:=formatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
dmAcc.AdotblVouItems.FieldByName('AmtDr').Asstring:=formatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0;
end;
end
else
begin
if trim(FieldByName('<27>ұ<EFBFBD>').AsString)='RMB' then
begin
dmAcc.AdotblVouItems.FieldByName('AmtDr').Asstring:='0';
dmAcc.AdotblVouItems.FieldByName('AmtCr').Asstring:=formatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCR').Asstring:=formatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').Asstring:=formatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end;
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=t_op_fee.FieldByName('<27><>ע').AsString+' '+t_op_fee.FieldByName('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('EmplID').AsString:=GetEmpID(t_op_fee.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա').AsString);
dmAcc.AdotblVouItems.FieldByName('DeptID').AsString:=GetDEPTID(t_op_fee.fieldByName('<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>').AsString);
dmAcc.AdotblVouItems.Post;
amt:=amt+FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
Exrate:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
BankAccid:=GetBankAccid(fdataSet);
next;
end;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=BankAccid;
if trim(FieldByName('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><>' then
begin
if trim(FieldByName('<27>ұ<EFBFBD>').AsString)='RMB' then
begin
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').Asstring:=formatFloat('0.00;-0.00;0',amt);
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').Asstring:=formatFloat('0.00;-0.00;0',amt);
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').Asstring:=formatFloat('0.00;-0.00;0',amt*FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
end;
end
else
begin
if trim(FieldByName('<27>ұ<EFBFBD>').AsString)='RMB' then
begin
dmAcc.AdotblVouItems.FieldByName('AmtDr').Asstring:=formatFloat('0.00;-0.00;0',amt);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsString:=formatFloat('0.00;-0.00;0',amt);
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
dmAcc.AdotblVouItems.FieldByName('AmtDr').Asstring:=formatFloat('0.00;-0.00;0',amt*FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
end;
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=t_op_fee.FieldByName('<27><>ע').AsString+' '+t_op_fee.FieldByName('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').AsString;
// dmAcc.AdotblVouItems.FieldByName('EmplID').AsString:=GetEmpID(t_op_fee.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա').AsString);
// dmAcc.AdotblVouItems.FieldByName('DeptID').AsString:=GetDEPTID(t_op_fee.fieldByName('<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>').AsString);
dmAcc.AdotblVouItems.Post;
end;
finally
end;
end;
procedure Tfrm_op_fee.bsSkinButton9Click(Sender: TObject);
var k:integer;
aQuery,aAdoQueryVouItems:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
aAdoQueryVouItems:=CreateAdoQuery;
with aAdoQueryVouItems do
begin
Close;Sql.Clear;
Sql.Add('select accid_cost,<2C><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>,<2C>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>,<2C>ұ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա,sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD> from t_op_fee');
Sql.Add('where vouno=:vouno and <20><><EFBFBD><EFBFBD>=0 and <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>'' And AccYear=:AccYear and AccMonth=:AccMonth');
Sql.Add('Group by accid_cost,<2C><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>,<2C>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>,<2C>ұ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա');
end;
with aQuery do
try
aVKNO:=1;
dmacc:=TdmAcc.Create(self);
dmAcc.ADOtblVou.Open;
dmAcc.ADOtblVouItems.Open;
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update t_op_fee set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where vouno=:vouno And AccYear=:AccYear and AccMonth=:AccMonth and <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>''');
if dxdbgrid1.SelectedCount>0 then
begin
for k:=0 to dxdbgrid1.SelectedCount-1 do
begin
t_op_fee.GotoBookmark(pointer(dxdbgrid1.selectedrows[k]));
aAdoQueryVouItems.Close;
aAdoQueryVouItems.Parameters.ParamByName('vouno').Value:=t_op_fee.fieldbyname('vouno').AsString;
aAdoQueryVouItems.Parameters.ParamByName('AccYear').Value:=t_op_fee.fieldbyname('AccYear').AsString;
aAdoQueryVouItems.Parameters.ParamByName('AccMonth').Value:=t_op_fee.fieldbyname('AccMonth').AsString;
aAdoQueryVouItems.Open;
if (not aAdoQueryVouItems.IsEmpty) and (trim(t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString)='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>') and (not t_op_fee.FieldByName('<27><><EFBFBD><EFBFBD>').AsBoolean) then
begin
NewDrCrVou(aAdoQueryVouItems);
aQuery.Close;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('vouno').Value:=t_op_fee.fieldbyname('vouno').AsString;
aQuery.Parameters.ParamByName('AccYear').Value:=t_op_fee.fieldbyname('AccYear').AsString;
aQuery.Parameters.ParamByName('AccMonth').Value:=t_op_fee.fieldbyname('AccMonth').AsString;
aQuery.ExecSQL;
end;
end
end
else
begin
end;
finally
Free;
aAdoQueryVouItems.free;
freeAndNil(dmacc);
t_op_fee.Requery();
end;
end;
procedure Tfrm_op_fee.bsSkinButton10Click(Sender: TObject);
begin
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',2,nil,nil,nil,nil,t_op_fee1,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_op_fee.bsSkinButton11Click(Sender: TObject);
begin
bsSkinPanel15.Visible:=True;
end;
procedure Tfrm_op_fee.bsSkinButton54Click(Sender: TObject);
var aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
with aQuery do
try
Close;Sql.Clear;
Sql.Add('update t_op_fee set <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>=:date1');
Sql.Add('where of_id=:of_id');
Parameters.ParamByName('date1').Value:=FormatDateTime('YYYY-MM-DD',bsSkinDateEdit1.Date);
Parameters.ParamByName('of_id').Value:=t_op_fee.fieldbyname('of_id').AsInteger;
ExecSQL;
finally
Free;
t_op_fee.Refresh;
bsSkinPanel15.Visible:=False;
end;
end;
procedure Tfrm_op_fee.bsSkinButton53Click(Sender: TObject);
begin
bsSkinPanel15.Visible:=False;
end;
end.