339 lines
9.5 KiB
ObjectPascal
339 lines
9.5 KiB
ObjectPascal
|
|
unit U_JWLOutChkCXList;
|
|||
|
|
|
|||
|
|
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, cxCalendar, cxButtonEdit, cxDropDownEdit,
|
|||
|
|
DBClient, Menus, cxSplitter, cxTextEdit, RM_Common, RM_Class,
|
|||
|
|
RM_GridReport, RM_System, RM_Dataset, RM_e_Xls, dxPSGlbl, dxPSUtl,
|
|||
|
|
dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider,
|
|||
|
|
dxPSFillPatterns, dxPSEdgePatterns, dxPSCore, dxPScxCommon, dxPScxGridLnk,
|
|||
|
|
cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinBlack,
|
|||
|
|
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
|||
|
|
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle,
|
|||
|
|
dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary,
|
|||
|
|
dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin,
|
|||
|
|
dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
|||
|
|
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
|||
|
|
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
|||
|
|
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
|||
|
|
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
|
|||
|
|
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
|
|||
|
|
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
|
|||
|
|
dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine,
|
|||
|
|
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter,
|
|||
|
|
cxNavigator;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmJWLOutChkCXList = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBPrint: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
YCLName10: TEdit;
|
|||
|
|
YCLSpec10: TEdit;
|
|||
|
|
GYSName10: TEdit;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
v1DepotClass: TcxGridDBColumn;
|
|||
|
|
v1P_ChnName: TcxGridDBColumn;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
v1ShortName: TcxGridDBColumn;
|
|||
|
|
v1Quantity: TcxGridDBColumn;
|
|||
|
|
v1UnitName: TcxGridDBColumn;
|
|||
|
|
v1Note: TcxGridDBColumn;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
CDS_Main: TClientDataSet;
|
|||
|
|
RMDB_Main: TRMDBDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
CRType: TComboBox;
|
|||
|
|
v1Column4: TcxGridDBColumn;
|
|||
|
|
v1Column5: TcxGridDBColumn;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
LYDept: TEdit;
|
|||
|
|
LYPerson: TEdit;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
v1YCLMoney: TcxGridDBColumn;
|
|||
|
|
v1CheHao: TcxGridDBColumn;
|
|||
|
|
v1CLName: TcxGridDBColumn;
|
|||
|
|
v1SJName: TcxGridDBColumn;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
CLName: TEdit;
|
|||
|
|
SJName: TEdit;
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure TBExportClick(Sender: TObject);
|
|||
|
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure YCLName10Change(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView;
|
|||
|
|
ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem;
|
|||
|
|
out AStyle: TcxStyle);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
canshu1,canshu2:String;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitForm();
|
|||
|
|
function DelYFData():Boolean;
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_RTFun,U_JWLChkOut, U_ModuleNote;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Application:=MainApplication;
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
cxgrid1.Align:=alClient;
|
|||
|
|
canshu1:=Trim(DParameters1);
|
|||
|
|
canshu2:=Trim(DParameters2);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
WriteCxGrid('X<><58><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'ԭ<><D4AD><EFBFBD>ϲֿ<CFB2>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.*,YCLName10=B.YCLName,YCLSpec10=B.YCLSpec,GYSName10=B.GYSName,CRUnit10=B.CRUnit ');
|
|||
|
|
sql.Add(',YCLPrice10=B.YCLPrice,YCLMoney10=B.YCLPrice*A.CRQty');
|
|||
|
|
sql.Add(' from CK_YCLONE_CR A');
|
|||
|
|
sql.Add(' inner join CK_YCLONE_CR B on A.RKID=B.MSID');
|
|||
|
|
SQL.Add(' where A.CRTime>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime))+'''');
|
|||
|
|
SQL.Add(' and A.CRTime<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.DateTime+1))+'''');
|
|||
|
|
sql.Add(' and A.CKName='''+Trim(canshu1)+'''');
|
|||
|
|
SQL.Add(' and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.InitForm();
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('X<><58><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'ԭ<><D4AD><EFBFBD>ϲֿ<CFB2>');
|
|||
|
|
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
|
|||
|
|
BegDate.DateTime:=EndDate.DateTime-7;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.TBFindClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.TBPrintClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile,FConNoM,RPTName:string;
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>.rmf' ;
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RMVariables['begdate']:=BegDate.DateTime;
|
|||
|
|
RMVariables['enddate']:=enddate.DateTime;
|
|||
|
|
//RMVariables['printtime']:=Now;
|
|||
|
|
//RMVariables['printer']:=Trim(gUserName);
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+RPTName),'<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
BegDate.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.YCLName10Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitForm();
|
|||
|
|
end;
|
|||
|
|
function TfrmJWLOutChkCXList.DelYFData():Boolean;
|
|||
|
|
var
|
|||
|
|
CRID,OrdMainId,YFID:String;
|
|||
|
|
begin
|
|||
|
|
Result:=False;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_CR where YFTypeId='''+Trim(CDS_Main.fieldbyname('MSID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Result:=True;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_KC where FactoryName='''+Trim(CDS_Main.fieldbyname('GYSName').AsString)+'''');
|
|||
|
|
SQL.Add(' and ZdyStr1=''Ӧ<><D3A6><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
|
begin
|
|||
|
|
CRID:=ADOQueryTemp.fieldbyname('CRID').AsString;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from YF_Money_CR where YFTypeId='''+Trim(CDS_Main.fieldbyname('MSID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
|
sql.Add(' where CRID='+CRID);
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_CR where CRID='+CRID);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete YF_Money_KC where CRID='+CRID);
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Result:=True;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.Tv1StylesGetContentStyle(
|
|||
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|||
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|||
|
|
var
|
|||
|
|
id,id10:Integer;
|
|||
|
|
begin
|
|||
|
|
{if Trim(DParameters7)='<27>Ѹ<EFBFBD><D1B8><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
if Tv1.GroupedItemCount=0 then
|
|||
|
|
begin
|
|||
|
|
Id:=Tv1.GetColumnByFieldName('YFMoney').Index-tv1.GroupedItemCount;
|
|||
|
|
if Trim(VarToStr(ARecord.Values[id]))='' then Exit;
|
|||
|
|
if Id<=0 then Exit;
|
|||
|
|
if ARecord.Values[id]>0 then
|
|||
|
|
AStyle:=DataLink_JWLCK.Red;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
except
|
|||
|
|
end;
|
|||
|
|
end; }
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJWLOutChkCXList.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmModuleNote:=TfrmModuleNote.Create(Application);
|
|||
|
|
with frmModuleNote do
|
|||
|
|
begin
|
|||
|
|
flag:='<27>칫<EFBFBD><ECB9AB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmModuleNote.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|