776 lines
21 KiB
ObjectPascal
776 lines
21 KiB
ObjectPascal
|
|
unit U_WorkDeptFeeList_LKFK;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
|
|||
|
|
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
|||
|
|
cxGridDBTableView, cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter,
|
|||
|
|
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
|
|||
|
|
cxTextEdit, cxPC, cxCheckBox, Menus, IdBaseComponent, IdComponent,
|
|||
|
|
IdTCPConnection, IdTCPClient, IdFTP,jpeg;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmWorkDeptFeeListLKFK = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDBMain: TRMDBDataSet;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
Order_Sub: TClientDataSet;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1Column5: TcxGridDBColumn;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
v1Column7: TcxGridDBColumn;
|
|||
|
|
v1Note: TcxGridDBColumn;
|
|||
|
|
Worker: TEdit;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
v1Column17: TcxGridDBColumn;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
WFNO: TEdit;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
TFKCX: TToolButton;
|
|||
|
|
CDS_Chker: TClientDataSet;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
ItemName: TEdit;
|
|||
|
|
v1WFType: TcxGridDBColumn;
|
|||
|
|
v1ItemName: TcxGridDBColumn;
|
|||
|
|
v1ZhaiYao: TcxGridDBColumn;
|
|||
|
|
DataSource2: TDataSource;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
v1ChkNote: TcxGridDBColumn;
|
|||
|
|
TDSFK: TToolButton;
|
|||
|
|
TSel: TToolButton;
|
|||
|
|
TPrint: TToolButton;
|
|||
|
|
CDS_PRT: TClientDataSet;
|
|||
|
|
v1CWChktime: TcxGridDBColumn;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
ADOQueryHZ: TADOQuery;
|
|||
|
|
IdFTP1: TIdFTP;
|
|||
|
|
ODPat: TOpenDialog;
|
|||
|
|
SaveDialog1: TSaveDialog;
|
|||
|
|
v1Huilv: TcxGridDBColumn;
|
|||
|
|
v1HZBBMoney: TcxGridDBColumn;
|
|||
|
|
v1BZUnit: TcxGridDBColumn;
|
|||
|
|
v1Ssel: TcxGridDBColumn;
|
|||
|
|
v1WFNO: TcxGridDBColumn;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
WFType: TEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
ChkNote: TMemo;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBExportClick(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure WorkerChange(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure TFKCXClick(Sender: TObject);
|
|||
|
|
procedure v1Column8PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure TSelClick(Sender: TObject);
|
|||
|
|
procedure TDSFKClick(Sender: TObject);
|
|||
|
|
procedure v1SselPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure TPrintClick(Sender: TObject);
|
|||
|
|
procedure v1ChkNotePropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure v1HuilvPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
private
|
|||
|
|
FInt,PFInt:Integer;
|
|||
|
|
canshu1,canshu2:string;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitForm();
|
|||
|
|
function DelData():Boolean;
|
|||
|
|
procedure InitGridWsql(fsj:string);
|
|||
|
|
function SaveData():Boolean;
|
|||
|
|
procedure InitImage();
|
|||
|
|
procedure FYBXMoney();
|
|||
|
|
procedure setstatus();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmWorkDeptFeeListLKFK: TfrmWorkDeptFeeListLKFK;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_RTFun,U_ModuleNote,U_WorkerDeptFeeInPutDJ, U_ZDYHelpSel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.setstatus();
|
|||
|
|
begin
|
|||
|
|
TDSFK.Visible:=false;
|
|||
|
|
TFKCX.Visible:=False;
|
|||
|
|
if trim(CanShu1)<>'<27><>ѯ' then
|
|||
|
|
begin
|
|||
|
|
if cxtabcontrol1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
TDSFK.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
if cxtabcontrol1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
TFKCX.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.FYBXMoney();
|
|||
|
|
var maxno,maxSubNo:string;
|
|||
|
|
begin
|
|||
|
|
if trim(order_Main.FieldByName('ItemName').AsString)='<27>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>뵥' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('select * from Worker_Fee_Main A ');
|
|||
|
|
sql.add('inner join Worker_Fee_Sub B on B.WFID=A.WFID ');
|
|||
|
|
sql.add('where A.WFID='''+Order_Main.fieldbyname('WFID').AsString+''' ');
|
|||
|
|
sql.add('and A.ItemName=''<27>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>뵥'' ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if GetLSNo(ADOQueryMain,maxno,'WF','Worker_Fee_Main',3,1)=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select * from Worker_Fee_Main where WFId='''+Trim(maxno)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('WFId').Value:=Trim(maxno);
|
|||
|
|
RTSetsavedata(ADOQueryMain,'Worker_Fee_Main',Panel1,0);
|
|||
|
|
FieldByName('HZStatus').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
|
FieldByName('FillCode').Value:=Trim(DCode);
|
|||
|
|
FieldByName('FillerCode').Value:=Trim(DCode);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Trim(Order_Sub.fieldbyname('WSId').AsString)='' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryMain,maxSubNo,'WS','Worker_Fee_Sub',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ɷ<EFBFBD><C9B7>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
maxSubNo:=Trim(Order_Sub.fieldbyname('WSId').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from Worker_Fee_Sub where ');
|
|||
|
|
sql.Add(' WSId='''+Trim(maxSubNo)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
if Trim(Order_Sub.fieldbyname('WSId').AsString)='' then
|
|||
|
|
Append
|
|||
|
|
else
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('WFID').Value:=Trim(maxno);
|
|||
|
|
FieldByName('WSId').Value:=Trim(maxSubNo);
|
|||
|
|
RTSetSaveDataCDS(ADOQueryMain,Tv1,Order_Sub,'Worker_Fee_Sub',0);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
Order_Sub.Edit;
|
|||
|
|
Order_Sub.FieldByName('WSId').Value:=Trim(maxSubNo);
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update Worker_Fee_Main Set HZMoney=');
|
|||
|
|
sql.Add(' (select isnull(Sum(isnull(Money,0)),0) from Worker_Fee_Sub A where A.WFID=Worker_Fee_Main.WFID)');
|
|||
|
|
sql.Add(' where WFID='''+Trim(maxno)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.InitImage();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmWorkDeptFeeListLKFK:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
WriteCxGrid('<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>ѯ',Tv1,'<27><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select isnull(Huilv,1) Huilv,A.*,HZBBMoney=isnull(HZMoney,0)*isnull(HuiLV,1),');
|
|||
|
|
sql.Add(' BZUnit=(select Top 1 B.PriceUnit from Worker_Fee_LKSub B where B.WFID=A.WFID) ');
|
|||
|
|
sql.add(' ,ZhaiYao=(select Top 1 C.ZhaiYao from Worker_Fee_LKSub C where C.WFID=A.WFID)');
|
|||
|
|
SQL.Add(' from Worker_Fee_LKMain A ');
|
|||
|
|
sql.Add(' where A.HZStatus=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' and A.ItemName<>''<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>''');
|
|||
|
|
if CanShu2<>'' then
|
|||
|
|
sql.add(' and A.WFType='''+trim(CanShu2)+'''');
|
|||
|
|
if cxTabControl1.TabIndex<>0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and A.WFDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
|||
|
|
sql.Add(' and A.WFDate<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(A.CWChkStatus,'''')='''' ');
|
|||
|
|
end else
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(A.CWChkStatus,'''')=''<27>Ѹ<EFBFBD><D1B8><EFBFBD>'' and isnull(A.ZuoFeiFlag,'''')<>''1'' ');
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(A.ZuoFeiFlag,'''')=''1'' ');
|
|||
|
|
end;
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
{with ADOQueryHZ do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select SumJYMoney=isnull(AA.XJMoney,0)-isnull(AA.SumFKMoney,0) From (');
|
|||
|
|
sql.add('select XJMoney=(select sum(A.LYMoney) from Worker_Fee_LK A Where A.ChkStatus=''1''),');
|
|||
|
|
sql.add('SumFKMoney=Sum(B.YuJieMoney) from Worker_Fee_Main B ');
|
|||
|
|
sql.add('where B.CWChkStatus=''<27>Ѹ<EFBFBD><D1B8><EFBFBD>'' and B.WFType=''<27><>˽ҵ<CBBD><D2B5>'' and isnull(B.ZuoFeiFlag,'''')='''') AA');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
label7.Caption:=ADOQueryHZ.fieldbyname('SumJYMoney').AsString;}
|
|||
|
|
finally;
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.InitForm();
|
|||
|
|
begin
|
|||
|
|
endDate.Date:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
BegDate.Date:=EndDate.Date-7;
|
|||
|
|
cxTabControl1.TabIndex:=0;
|
|||
|
|
setstatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmWorkDeptFeeListLKFK.DelData():Boolean;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Result:=false;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete Worker_Fee_FenTan where WFId='''+Trim(Order_Main.fieldbyname('WFId').AsString)+'''');
|
|||
|
|
sql.Add('delete Worker_Fee_Main where WFId='''+Trim(Order_Main.fieldbyname('WFId').AsString)+'''');
|
|||
|
|
sql.Add('delete Worker_Fee_Sub where WFId='''+Trim(Order_Main.fieldbyname('WFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result:=True;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Result:=False;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
TcxGridToExcel('<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>',cxGrid1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>ѯ',Tv1,'<27><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>');
|
|||
|
|
InitForm();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.cxPageControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmModuleNote:=TfrmModuleNote.Create(Application);
|
|||
|
|
with frmModuleNote do
|
|||
|
|
begin
|
|||
|
|
flag:='<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmModuleNote.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
canshu1:=Trim(DParameters1);
|
|||
|
|
canshu2:=Trim(DParameters2);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.InitGridWsql(fsj:string);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.*,FS.*,HJMoney=FS.YunFee+FS.MaTouFee+FS.YangBanFee+FS.OtherFee ');
|
|||
|
|
SQL.Add(' from JYOrderKP_Fee A inner join JYOrderKP_Fee_Sub FS on A.FMID=FS.FMID');
|
|||
|
|
sql.Add(' where 1=1');
|
|||
|
|
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and A.Filler='''+Trim(DName)+'''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(fsj);
|
|||
|
|
sql.Add(' order by A.FPNo');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
function TfrmWorkDeptFeeListLKFK.SaveData():Boolean;
|
|||
|
|
var
|
|||
|
|
maxno,maxSubNo:String;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Result:=False;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if Trim(Order_Main.fieldbyname('MRID').AsString)='' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd,maxno,'MR','Module_Prompt_Result',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
maxno:=Trim(Order_Main.fieldbyname('MRID').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select * from Module_Prompt_Result where MRId='''+Trim(Order_Main.fieldbyname('MRID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(Order_Main.fieldbyname('MRID').AsString)='' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
end
|
|||
|
|
else begin
|
|||
|
|
Edit;
|
|||
|
|
end;
|
|||
|
|
FieldByName('MPId').Value:=Trim(Order_Main.fieldbyname('MPId').AsString);
|
|||
|
|
FieldByName('MRId').Value:=Trim(maxno);
|
|||
|
|
FieldByName('MRStatus').Value:='<27>Ѵ<EFBFBD><D1B4><EFBFBD>';
|
|||
|
|
FieldByName('MRDate').Value:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
if Trim(Order_Main.fieldbyname('MRId').AsString)='' then
|
|||
|
|
begin
|
|||
|
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
FieldByName('Editer').Value:=Trim(DName);
|
|||
|
|
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result:=True;
|
|||
|
|
except
|
|||
|
|
Result:=False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
v1Huilv.Options.Editing:=False;
|
|||
|
|
//v1YuJieMoney.Options.Editing:=False;
|
|||
|
|
|
|||
|
|
v1ChkNote.Options.Editing:=False;
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
v1Huilv.Options.Editing:=true;
|
|||
|
|
//v1YuJieMoney.Options.Editing:=true;
|
|||
|
|
|
|||
|
|
v1ChkNote.Options.Editing:=true;
|
|||
|
|
end;
|
|||
|
|
setstatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.WorkerChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.TFKCXClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>1 then Exit;
|
|||
|
|
if Order_Main.Locate('SSel',True,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('select * from Worker_Fee_LKSub ');
|
|||
|
|
sql.add('where WFID='''+Order_Main.fieldbyname('WFID').AsString+'''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if ADOQueryCmd.FieldByName('ZuoFeiFlag').Asstring='1' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('update Worker_Fee_LKMain set CWChkStatus='''',CWChker='''',CWChktime=NULL ');
|
|||
|
|
sql.add(',YuJieMoney=Null,ChkNote='''' ');
|
|||
|
|
sql.add('where WFID='''+Order_Main.fieldbyname('WFID').AsString+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
initGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.v1Column8PropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var FMoney,FWFID: string;
|
|||
|
|
begin
|
|||
|
|
FMoney:='0';
|
|||
|
|
FWFID:=Trim(Order_Main.fieldbyname('WFID').AsString);
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
DisableControls;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('Ssel').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
FMoney:=floattoStr(strtofloat(FMoney)+FieldByName('HZMoney').AsFloat);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
order_main.Locate('WFID',FWFID,[]);
|
|||
|
|
label2.Caption:=FMoney;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.TSelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmWorkerDeptFeeInPutDJ:=TfrmWorkerDeptFeeInPutDJ.Create(Application);
|
|||
|
|
with frmWorkerDeptFeeInPutDJ do
|
|||
|
|
begin
|
|||
|
|
PState:=1;
|
|||
|
|
FMainId:=Trim(Self.Order_Main.fieldbyname('WFID').AsString);
|
|||
|
|
TBSave.Visible:=False;
|
|||
|
|
ToolBar2.Visible:=False;
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
initGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmWorkerDeptFeeInPutDJ.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.TDSFKClick(Sender: TObject);
|
|||
|
|
var maxno: string;
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
|
if Order_Main.Locate('SSel',True,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('Ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
{if Order_Main.FieldByName('YuJieMoney').AsString='' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB2BB>Ϊ<EFBFBD><CEAA>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;}
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('update Worker_Fee_LKMain set CWChkStatus=''<27>Ѹ<EFBFBD><D1B8><EFBFBD>'',CWChker='''+trim(DName)+''',CWChktime=getDate() ');
|
|||
|
|
if Order_Main.FieldByName('YuJieMoney').AsString<>'' then
|
|||
|
|
begin
|
|||
|
|
sql.add(',YuJieMoney='''+trim(Order_Main.fieldbyname('YuJieMoney').AsString)+'''');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
sql.add(',YuJieMoney=''0''');
|
|||
|
|
end;
|
|||
|
|
sql.add(',ChkNote='''+trim(ChkNote.Text)+''' ');
|
|||
|
|
sql.add('where WFID='''+Order_Main.fieldbyname('WFID').AsString+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.v1SselPropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var FMoney,FWFID: string;
|
|||
|
|
begin
|
|||
|
|
FMoney:='0';
|
|||
|
|
FWFID:=Trim(Order_Main.fieldbyname('WFID').AsString);
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
DisableControls;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('Ssel').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
FMoney:=floattoStr(strtofloat(FMoney)+FieldByName('HZMoney').AsFloat);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
order_main.Locate('WFID',FWFID,[]);
|
|||
|
|
//label5.Caption:=FMoney;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.TPrintClick(Sender: TObject);
|
|||
|
|
var FPrintFile,FYCLName,FpriceUnit,FZhaiYao: string;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then exit;
|
|||
|
|
FYCLName:='';
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
SQL.Add(' from Worker_Fee_Main A ');
|
|||
|
|
sql.add(' where WFID='''+trim(Order_Main.fieldbyname('WFID').asstring)+''' ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryCmd,CDS_PRT);
|
|||
|
|
SInitCDSData20(ADOQueryCmd,CDS_PRT);
|
|||
|
|
With ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
SQL.Add(' from Worker_Fee_Sub A ');
|
|||
|
|
sql.add(' where WFID='''+trim(Order_Main.fieldbyname('WFID').asstring)+''' ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if trim(FYCLName)='' then
|
|||
|
|
FYCLName:=trim(fieldbyname('YCLName').AsString)
|
|||
|
|
else
|
|||
|
|
FYCLName:=FYCLName+','+trim(fieldbyname('YCLName').AsString);
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
FpriceUnit:=trim(fieldbyname('priceUnit').AsString);
|
|||
|
|
FZhaiYao:=trim(fieldbyname('ZhaiYao').AsString);
|
|||
|
|
end;
|
|||
|
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>.rmf';
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RMVariables['YCLName']:=trim(FYCLName);
|
|||
|
|
RMVariables['priceUnit']:=trim(FpriceUnit);
|
|||
|
|
RMVariables['ZhaiYao']:=trim(FZhaiYao);
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.v1ChkNotePropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var mvalue: string;
|
|||
|
|
begin
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('update Worker_Fee_Main set ');
|
|||
|
|
sql.add('ChkNote='''+trim(Mvalue)+''' ');
|
|||
|
|
sql.add('where WFID='''+Order_Main.fieldbyname('WFID').AsString+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.v1HuilvPropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var mvalue: string;
|
|||
|
|
begin
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
if mvalue='' then
|
|||
|
|
mvalue:='0';
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
fieldbyname('Huilv').Value:=trim(mvalue);
|
|||
|
|
fieldbyname('HZBBMoney').Value:=strtofloat(mvalue)*fieldbyname('HZMoney').AsFloat;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryHZ do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update Worker_Fee_LKMain set Huilv='''+trim(order_Main.fieldbyname('Huilv').AsString)+''' ');
|
|||
|
|
sql.add('where WFID='''+trim(order_Main.fieldbyname('WFID').AsString)+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmWorkDeptFeeListLKFK.Tv1CellDblClick(
|
|||
|
|
Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
TSel.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|