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.

779 lines
25 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;
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;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton8: TbsSkinButton;
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;
bsSkinPanel3: TbsSkinPanel;
Label49: TLabel;
wwDBDateTimePicker9: TwwDBDateTimePicker;
bsSkinPanel4: TbsSkinPanel;
Label52: TLabel;
wwDBDateTimePicker12: TwwDBDateTimePicker;
bsSkinPanel5: TbsSkinPanel;
Label7: TLabel;
RxDBLookupCombo4: TRxDBLookupCombo;
bsSkinPanel6: TbsSkinPanel;
Label17: TLabel;
RxDBLookupCombo8: TRxDBLookupCombo;
bsSkinPanel7: TbsSkinPanel;
Label18: TLabel;
RxDBLookupCombo10: TRxDBLookupCombo;
bsSkinPanel8: TbsSkinPanel;
Label8: TLabel;
wwDBComboBox31: TwwDBComboBox;
bsSkinPanel9: TbsSkinPanel;
wwDBComboBox3: TwwDBComboBox;
Label10: TLabel;
DBEdit5: TDBEdit;
Label20: TLabel;
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 bsSkinPanel2Resize(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;
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.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><><EFBFBD><EFBFBD>';
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.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;
end;
procedure Tfrm_op_fee.FormShow(Sender: TObject);
begin
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>=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');
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
sql.Add(' and <20><><EFBFBD><EFBFBD>״̬='''+wwDBComboBox3.text+'''');
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('ACCYMonth').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><><EFBFBD><EFBFBD>' 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('DEPTID').AsString:='';
dmAcc.AdotblVouItems.FieldByName('EMPLID').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><><EFBFBD><EFBFBD>' 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('DEPTID').AsString:='';
dmAcc.AdotblVouItems.FieldByName('EMPLID').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>,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 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>');
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.bsSkinPanel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.Width/8);
bsSkinPanel3.Width:=i;
bsSkinPanel4.Width:=i;
bsSkinPanel5.Width:=i;
bsSkinPanel6.Width:=i;
bsSkinPanel7.Width:=i;
bsSkinPanel8.Width:=i;
bsSkinPanel9.Width:=i;
bsSkinButton8.Left:=bsSkinPanel2.Width-bsSkinButton8.Width-20;
end;
end.